diff --git a/.claude/commands/upgrade-nodejs.md b/.claude/commands/upgrade-nodejs.md index 6ba1832ce661..001f8937be9e 100644 --- a/.claude/commands/upgrade-nodejs.md +++ b/.claude/commands/upgrade-nodejs.md @@ -22,7 +22,7 @@ Bun reports a Node.js version for compatibility with the Node.js ecosystem. This - `NODEJS_ABI_VERSION` - The ABI version number (find using command below) ### 3. Version Strings -- `src/bun.js/bindings/BunProcess.cpp` +- `src/buntime/bindings/BunProcess.cpp` - Update `Bun__versions_node` with the Node.js version - Update `Bun__versions_v8` with the V8 version (find using command below) @@ -33,7 +33,7 @@ Bun reports a Node.js version for compatibility with the Node.js ecosystem. This ## Files That May Need Updates Only check these if the build fails or tests crash after updating version numbers: -- V8 compatibility files in `src/bun.js/bindings/v8/` (if V8 API changed) +- V8 compatibility files in `src/buntime/bindings/v8/` (if V8 API changed) - Test files (if Node.js requires newer C++ standard) ## Quick Commands to Find Version Info diff --git a/.claude/skills/implementing-jsc-classes-cpp/SKILL.md b/.claude/skills/implementing-jsc-classes-cpp/SKILL.md index 27a2e5fd4d6f..cf1ce22fdbb8 100644 --- a/.claude/skills/implementing-jsc-classes-cpp/SKILL.md +++ b/.claude/skills/implementing-jsc-classes-cpp/SKILL.md @@ -19,8 +19,8 @@ No public constructor? Only Prototype and class needed. Classes with C++ fields need subspaces in: -- `src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h` -- `src/bun.js/bindings/webcore/DOMIsoSubspaces.h` +- `src/buntime/bindings/webcore/DOMClientIsoSubspaces.h` +- `src/buntime/bindings/webcore/DOMIsoSubspaces.h` ```cpp template diff --git a/.claude/skills/implementing-jsc-classes-zig/SKILL.md b/.claude/skills/implementing-jsc-classes-zig/SKILL.md index bf2e5a536826..d45da3aa8ebf 100644 --- a/.claude/skills/implementing-jsc-classes-zig/SKILL.md +++ b/.claude/skills/implementing-jsc-classes-zig/SKILL.md @@ -89,7 +89,7 @@ pub const TextDecoder = struct { - Use `bun.JSError!JSValue` return type for error handling - Use `globalObject` not `ctx` - `deinit()` for cleanup, `finalize()` called by GC -- Update `src/bun.js/bindings/generated_classes_list.zig` +- Update `src/buntime/bindings/generated_classes_list.zig` ## CallFrame Access @@ -196,7 +196,7 @@ pub const MyClass = struct { }; ``` -3. Add to `src/bun.js/bindings/generated_classes_list.zig` +3. Add to `src/buntime/bindings/generated_classes_list.zig` ## Generated Components diff --git a/CLAUDE.md b/CLAUDE.md index 767308d653ff..438260aaae21 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -102,84 +102,129 @@ test("(multi-file test) my feature", async () => { ## Code Architecture +### Directory Structure Overview + +The codebase is organized so you can **guess where code lives**: + +| Task | Location | +| --------------------- | ----------------------------------- | +| Fix the transpiler | `src/transpiler/` | +| Fix the test runner | `src/test_runner/` | +| Fix the bundler | `src/bundler/` | +| Fix bun install | `src/install/` | +| Fix CSS parsing | `src/css/` | +| Fix the shell | `src/shell/` | +| Fix Postgres | `src/sql/postgres/` | +| Fix MySQL | `src/sql/mysql/` | +| Fix Valkey/Redis | `src/valkey/` | +| Fix S3 | `src/s3/` or `src/buntime/api/s3/` | +| Fix Bake | `src/bake/` | +| Fix Bun.serve() | `src/buntime/api/server/` | +| Fix fetch() | `src/buntime/web/fetch/` | +| Fix WebSocket | `src/buntime/web/websocket/` | +| Fix node:fs | `src/buntime/node/fs/` | +| Fix node:crypto | `src/buntime/node/crypto/` | +| Fix crypto.subtle | `src/buntime/web/webcrypto/` | +| Fix N-API | `src/buntime/compat/napi/` | +| Fix V8 compat | `src/buntime/compat/v8/` | + ### Language Structure - **Zig code** (`src/*.zig`): Core runtime, JavaScript bindings, package manager -- **C++ code** (`src/bun.js/bindings/*.cpp`): JavaScriptCore bindings, Web APIs -- **TypeScript** (`src/js/`): Built-in JavaScript modules with special syntax (see JavaScript Modules section) -- **Generated code**: Many files are auto-generated from `.classes.ts` and other sources. Bun will automatically rebuild these files when you make changes to them. - -### Core Source Organization - -#### Runtime Core (`src/`) - -- `bun.zig` - Main entry point -- `cli.zig` - CLI command orchestration -- `js_parser.zig`, `js_lexer.zig`, `js_printer.zig` - JavaScript parsing/printing -- `transpiler.zig` - Wrapper around js_parser with sourcemap support -- `resolver/` - Module resolution system -- `allocators/` - Custom memory allocators for performance - -#### JavaScript Runtime (`src/bun.js/`) - -- `bindings/` - C++ JavaScriptCore bindings - - Generated classes from `.classes.ts` files - - Manual bindings for complex APIs -- `api/` - Bun-specific APIs - - `server.zig` - HTTP server implementation - - `FFI.zig` - Foreign Function Interface - - `crypto.zig` - Cryptographic operations - - `glob.zig` - File pattern matching -- `node/` - Node.js compatibility layer - - Module implementations (fs, path, crypto, etc.) - - Process and Buffer APIs -- `webcore/` - Web API implementations - - `fetch.zig` - Fetch API - - `streams.zig` - Web Streams - - `Blob.zig`, `Response.zig`, `Request.zig` -- `event_loop/` - Event loop and task management - -#### Build Tools & Package Manager - -- `src/bundler/` - JavaScript bundler - - Advanced tree-shaking - - CSS processing - - HTML handling -- `src/install/` - Package manager - - `lockfile/` - Lockfile handling - - `npm.zig` - npm registry client - - `lifecycle_script_runner.zig` - Package scripts - -#### Other Key Components - -- `src/shell/` - Cross-platform shell implementation -- `src/css/` - CSS parser and processor -- `src/http/` - HTTP client implementation - - `websocket_client/` - WebSocket client (including deflate support) -- `src/sql/` - SQL database integrations -- `src/bake/` - Server-side rendering framework - -### JavaScript Class Implementation (C++) - -When implementing JavaScript classes in C++: - -1. Create three classes if there's a public constructor: - - `class Foo : public JSC::JSDestructibleObject` (if has C++ fields) - - `class FooPrototype : public JSC::JSNonFinalObject` - - `class FooConstructor : public JSC::InternalFunction` - -2. Define properties using HashTableValue arrays -3. Add iso subspaces for classes with C++ fields -4. Cache structures in ZigGlobalObject +- **C++ code** (`src/buntime/**/*.cpp`): JavaScriptCore bindings, Web APIs +- **TypeScript** (`src/js/`): Built-in JavaScript modules with special syntax +- **Generated code**: Auto-generated from `.classes.ts` files during build + +### Top-Level Source Organization + +``` +src/ +├── transpiler/ # JS/TS transpiler (js_parser, js_lexer, js_printer) +├── test_runner/ # bun:test implementation +├── bundler/ # bun build +├── resolver/ # Module resolution +├── install/ # Package manager (bun install) +├── css/ # CSS parser +├── shell/ # Bun.$ shell +├── bake/ # Bake framework +├── sql/ # SQL clients (postgres/, mysql/) +├── s3/ # S3 core +├── valkey/ # Valkey/Redis +├── http/ # HTTP client +├── string/ # String utilities +├── ast/ # AST types +├── js/ # TypeScript built-in modules +│ +└── buntime/ # JavaScript runtime + ├── api/ # Bun.* APIs + │ ├── server/ # Bun.serve() + │ ├── console/ # console.* + │ ├── inspector/ # Debugger, profiler + │ ├── error/ # Error handling, stack traces + │ ├── cookie/ # Cookie parsing + │ ├── s3/ # S3 JS bindings + │ ├── ffi/ # Bun.FFI + │ ├── sqlite/ # bun:sqlite + │ ├── sql/ # SQL bindings + │ ├── shell/ # Shell bindings + │ ├── ipc/ # IPC + │ ├── plugin/ # Bundler plugins + │ ├── secrets/ # Secrets API + │ └── test/ # Test helpers + │ + ├── web/ # Web Standards + │ ├── fetch/ # Fetch API + │ ├── url/ # URL, URLSearchParams + │ ├── blob/ # Blob, File, FormData + │ ├── encoding/ # TextEncoder/Decoder + │ ├── compression/ # CompressionStream + │ ├── events/ # EventTarget, CustomEvent + │ ├── streams/ # ReadableStream, WritableStream + │ ├── performance/ # Performance API + │ ├── websocket/ # WebSocket + │ └── webcrypto/ # crypto.subtle + │ + ├── node/ # Node.js Compatibility + │ ├── buffer/ # Buffer + │ ├── process/ # process.* + │ ├── vm/ # node:vm + │ ├── crypto/ # node:crypto + │ ├── http/ # node:http + │ ├── fs/ # node:fs helpers + │ ├── os/ # node:os + │ ├── path/ # node:path + │ ├── util/ # node:util + │ ├── timers/ # Timers + │ ├── async_hooks/ # AsyncLocalStorage + │ ├── perf_hooks/ # Performance hooks + │ └── constants/ # Constants + │ + ├── compat/ # Native Addon Compatibility + │ ├── napi/ # N-API + │ ├── v8/ # V8 C++ API + │ ├── libuv/ # libuv polyfills + │ └── windows/ # Windows-specific + │ + ├── jsc/ # JavaScriptCore Integration + │ ├── types/ # JSValue, JSString, JSArray, etc. + │ ├── global/ # ZigGlobalObject, BunGlobalScope + │ ├── gc/ # GC helpers, weak refs + │ ├── interop/ # C++/Zig bindings, IDL + │ └── generated/ # Generated bindings + │ + ├── module/ # Module system (CommonJS, ESM) + ├── event_loop/ # Event loop, tasks, timers + └── core/ # VirtualMachine, config +``` ### Code Generation -Code generation happens automatically as part of the build process. The main scripts are: +Code generation happens automatically during build. Main scripts: -- `src/codegen/generate-classes.ts` - Generates Zig & C++ bindings from `*.classes.ts` files -- `src/codegen/generate-jssink.ts` - Generates stream-related classes -- `src/codegen/bundle-modules.ts` - Bundles built-in modules like `node:fs` -- `src/codegen/bundle-functions.ts` - Bundles global functions like `ReadableStream` +- `src/codegen/generate-classes.ts` - Generates Zig & C++ from `*.classes.ts` +- `src/codegen/generate-jssink.ts` - Stream-related classes +- `src/codegen/bundle-modules.ts` - Built-in modules like `node:fs` +- `src/codegen/bundle-functions.ts` - Global functions like `ReadableStream` In development, bundled modules can be reloaded without rebuilding Zig by running `bun run build`. diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 000000000000..45ab75043ae8 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,1112 @@ +# Bun Source Reorganization + +## The Goal: Guessability + +Claude should be able to **guess** where code lives without searching. + +| User says | Claude guesses | +| --------------------- | --------------------------------------------------- | +| "Fix the transpiler" | `src/transpiler/` | +| "Fix the test runner" | `src/test_runner/` | +| "Fix the bundler" | `src/bundler/` | +| "Fix bun install" | `src/install/` | +| "Fix CSS parsing" | `src/css/` | +| "Fix the shell" | `src/shell/` | +| "Fix Postgres" | `src/sql/postgres/` | +| "Fix MySQL" | `src/sql/mysql/` | +| "Fix Valkey/Redis" | `src/valkey/` | +| "Fix S3" | `src/s3/` (core) or `buntime/api/s3/` (JS bindings) | +| "Fix Bake" | `src/bake/` | +| "Fix Bun.serve()" | `src/buntime/api/server/` | +| "Fix fetch()" | `src/buntime/web/fetch/` | +| "Fix WebSocket" | `src/buntime/web/websocket/` | +| "Fix node:fs" | `src/buntime/node/fs/` | +| "Fix node:crypto" | `src/buntime/node/crypto/` | +| "Fix crypto.subtle" | `src/buntime/web/webcrypto/` | +| "Fix N-API" | `src/buntime/compat/napi/` | +| "Fix V8 compat" | `src/buntime/compat/v8/` | + +--- + +## Step 1: Rename `src/bun.js/` → `src/buntime/` + +```bash +git mv src/bun.js src/buntime +``` + +Update imports in `src/bun.zig`. Most code uses `bun.foo` namespaces, so they won't break. + +--- + +## Step 2: Create `src/transpiler/` + +Move the JS/TS transpiler from root: + +```bash +mkdir -p src/transpiler +git mv src/js_parser.zig src/transpiler/parser.zig +git mv src/js_lexer.zig src/transpiler/lexer.zig +git mv src/js_lexer_tables.zig src/transpiler/lexer_tables.zig +git mv src/js_printer.zig src/transpiler/printer.zig +git mv src/transpiler.zig src/transpiler/transpiler.zig +git mv src/js_lexer src/transpiler/js_lexer +``` + +--- + +## Step 3: Create `src/test_runner/` + +Move from `buntime/test/`: + +```bash +mkdir -p src/test_runner +git mv src/buntime/test/* src/test_runner/ +``` + +Files moved: + +- `bun_test.zig` +- `Collection.zig` +- `debug.zig` +- `diff/` (entire directory) +- `diff_format.zig` +- `DoneCallback.zig` +- `Execution.zig` +- `expect/` (entire directory with 70+ matchers) +- `expect.zig` +- `jest.classes.ts` +- `jest.zig` +- `Order.zig` +- `pretty_format.zig` +- `ScopeFunctions.zig` +- `snapshot.zig` +- `test.zig` +- `timers/` (FakeTimers.zig, FakeTimersConfig.bindv2.ts) + +--- + +## Step 4: Dissolve `bindings/` by Domain + +### 4.1 → `api/console/` + +``` +ConsoleObject.cpp +ConsoleObject.h +UtilInspect.cpp +UtilInspect.h +``` + +Plus from buntime root: `ConsoleObject.zig` + +### 4.2 → `api/inspector/` + +``` +BunCPUProfiler.cpp +BunCPUProfiler.h +BunCPUProfiler.zig +BunDebugger.cpp +BunInjectedScriptHost.cpp +BunInjectedScriptHost.h +BunInspector.cpp +CodeCoverage.cpp +generated_perf_trace_events.h +InspectorBunFrontendDevServerAgent.cpp +InspectorBunFrontendDevServerAgent.h +InspectorHTTPServerAgent.cpp +InspectorHTTPServerAgent.h +InspectorLifecycleAgent.cpp +InspectorLifecycleAgent.h +InspectorTestReporterAgent.cpp +InspectorTestReporterAgent.h +linux_perf_tracing.cpp +``` + +Plus from buntime root: `Debugger.zig` + +### 4.3 → `api/error/` + +``` +CallSite.cpp +CallSite.h +CallSitePrototype.cpp +CallSitePrototype.h +DeferredError.zig +DOMException.cpp +DOMException.h +Errorable.zig +ErrorCode.cpp +ErrorCode.h +ErrorCode.ts +ErrorCode.zig +ErrorStackFrame.cpp +ErrorStackFrame.h +ErrorStackTrace.cpp +ErrorStackTrace.h +Exception.h +Exception.zig +ExceptionCode.h +ExceptionOr.h +FormatStackTraceForJS.cpp +FormatStackTraceForJS.h +JSErrorCode.zig +SystemError.zig +ZigErrorType.zig +ZigException.cpp +ZigException.zig +ZigStackFrame.zig +ZigStackFrameCode.zig +ZigStackFramePosition.zig +ZigStackTrace.zig +``` + +### 4.4 → `api/cookie/` + +``` +Cookie.cpp +Cookie.h +CookieMap.cpp +CookieMap.h +``` + +Plus from webcore: `JSCookie.cpp`, `JSCookie.h`, `JSCookieMap.cpp`, `JSCookieMap.h` +Plus from buntime/webcore: `CookieMap.zig` + +### 4.5 → `api/s3/` + +``` +JSS3File.cpp +JSS3File.h +S3Error.cpp +S3Error.h +``` + +### 4.6 → `api/secrets/` + +``` +JSSecrets.cpp +JSSecrets.zig +Secrets.h +SecretsDarwin.cpp +SecretsLinux.cpp +SecretsWindows.cpp +``` + +### 4.7 → `api/ffi/` + +``` +DLHandleMap.h +ffi.cpp +FFI.zig +JSFFIFunction.cpp +JSFFIFunction.h +``` + +### 4.8 → `api/sqlite/` + +Entire `bindings/sqlite/` directory: + +``` +CMakeLists.txt +JSSQLStatement.cpp +JSSQLStatement.h +lazy_sqlite3.h +sqlite3.c +sqlite3_error_codes.h +sqlite3_local.h +``` + +### 4.9 → `api/sql/` + +``` +SQLClient.cpp +``` + +### 4.10 → `api/shell/` + +``` +ShellBindings.cpp +``` + +### 4.11 → `api/ipc/` + +``` +IPC.cpp +``` + +### 4.12 → `api/test/` + +``` +FuzzilliREPRL.cpp +InternalForTesting.cpp +InternalForTesting.h +JSCTestingHelpers.cpp +JSCTestingHelpers.h +JSMockFunction.cpp +JSMockFunction.h +NoOpForTesting.cpp +NoOpForTesting.h +``` + +### 4.13 → `api/server/` + +``` +BunHttp2CommonStrings.cpp +BunHttp2CommonStrings.h +HTTPServerAgent.zig +JSBunRequest.cpp +JSBunRequest.h +ServerRouteList.cpp +ServerRouteList.h +uws_bindings.cpp +``` + +### 4.14 → `api/plugin/` + +``` +BunPlugin.cpp +BunPlugin.h +JSBundler+BunPlugin-impl.h +JSBundlerPlugin.cpp +JSBundlerPlugin.h +``` + +--- + +### 4.20 → `web/fetch/` + +``` +FetchHeaders.zig +NodeFetch.cpp +NodeFetch.h +Undici.cpp +Undici.h +``` + +Plus from webcore: `FetchHeaders.cpp`, `FetchHeaders.h`, `JSFetchHeaders.cpp`, `JSFetchHeaders.h`, `HTTPHeader*.cpp/h` + +### 4.21 → `web/url/` + +``` +decodeURIComponentSIMD.cpp +decodeURIComponentSIMD.h +DOMURL.cpp +DOMURL.h +DOMURL.zig +EncodeURIComponent.cpp +EncodeURIComponent.h +NodeURL.cpp +NodeURL.h +URL.zig +URLDecomposition.cpp +URLDecomposition.h +URLSearchParams.cpp +URLSearchParams.h +URLSearchParams.zig +``` + +Plus from webcore: `JSDOMURL.cpp/h`, `JSURLSearchParams.cpp/h`, `URLPattern*.cpp/h`, `JSURLPattern*.cpp/h` + +### 4.22 → `web/blob/` + +``` +blob.cpp +blob.h +DOMFormData.cpp +DOMFormData.h +DOMFormData.zig +JSDOMFile.cpp +JSDOMFile.h +``` + +Plus from webcore: `JSDOMFormData.cpp/h` + +### 4.23 → `web/encoding/` + +``` +Base64Helpers.cpp +Base64Helpers.h +DecodeEscapeSequences.h +EncodingTables.cpp +EncodingTables.h +TextCodec.cpp +TextCodec.h +TextCodec.zig +TextCodecASCIIFastPath.h +TextCodecCJK.cpp +TextCodecCJK.h +TextCodecReplacement.cpp +TextCodecReplacement.h +TextCodecSingleByte.cpp +TextCodecSingleByte.h +TextCodecUserDefined.cpp +TextCodecUserDefined.h +TextCodecWrapper.cpp +TextEncoding.cpp +TextEncoding.h +TextEncodingRegistry.cpp +TextEncodingRegistry.h +UnencodableHandling.h +``` + +Plus from webcore: `JSTextEncoder.cpp/h`, `JSTextEncoderStream.cpp/h`, `JSTextDecoderStream.cpp/h`, `TextEncoder.cpp/h` + +### 4.24 → `web/compression/` + +``` +JSCompressionStream.cpp +JSCompressionStream.h +JSDecompressionStream.cpp +JSDecompressionStream.h +``` + +### 4.25 → `web/events/` + +From webcore directory: + +``` +AbortAlgorithm.h +AbortController.cpp/h +AbortSignal.cpp/h +BroadcastChannel.cpp/h +CloseEvent.cpp/h +CustomEvent.cpp/h +ErrorCallback.cpp/h +ErrorEvent.cpp/h +Event.cpp/h +EventContext.cpp/h +EventDispatcher.cpp/h +EventEmitter.cpp/h +EventFactory.cpp +EventListener.h +EventListenerMap.cpp/h +EventNames.cpp/h +EventPath.cpp/h +EventSender.h +EventTarget.cpp/h +EventTargetConcrete.cpp/h +EventTargetFactory.cpp +JSAbort*.cpp/h +JSBroadcastChannel.cpp/h +JSCloseEvent.cpp/h +JSCustomEvent.cpp/h +JSErrorCallback.cpp/h +JSErrorEvent.cpp/h +JSEvent*.cpp/h +MessageChannel.cpp/h +MessageEvent.cpp/h +MessagePort.cpp/h +MessagePortChannel*.cpp/h +JSMessage*.cpp/h +``` + +### 4.26 → `web/streams/` + +From webcore directory: + +``` +InternalWritableStream.cpp/h +JSByteLengthQueuingStrategy.cpp/h +JSCountQueuingStrategy.cpp/h +JSReadableByteStreamController.cpp/h +JSReadableStream.cpp/h +JSReadableStreamBYOBReader.cpp/h +JSReadableStreamBYOBRequest.cpp/h +JSReadableStreamDefaultController.cpp/h +JSReadableStreamDefaultReader.cpp/h +JSReadableStreamSink.cpp/h +JSReadableStreamSource.cpp/h +JSTransformStream.cpp/h +JSTransformStreamDefaultController.cpp/h +JSWritableStream.cpp/h +JSWritableStreamDefaultController.cpp/h +JSWritableStreamDefaultWriter.cpp/h +JSWritableStreamSink.cpp/h +ReadableStream.cpp/h +ReadableStreamDefaultController.cpp/h +ReadableStreamSink.cpp/h +ReadableStreamSource.cpp/h +WritableStream.cpp/h +WritableStreamSink.h +``` + +### 4.27 → `web/performance/` + +From webcore directory: + +``` +JSPerformance.cpp/h +JSPerformanceEntry.cpp/h +JSPerformanceMark.cpp/h +JSPerformanceMarkOptions.cpp/h +JSPerformanceMeasure.cpp/h +JSPerformanceMeasureOptions.cpp/h +JSPerformanceObserver.cpp/h +JSPerformanceObserverCallback.cpp/h +JSPerformanceObserverEntryList.cpp/h +JSPerformanceResourceTiming.cpp/h +JSPerformanceServerTiming.cpp/h +JSPerformanceTiming.cpp/h +NetworkLoadMetrics.cpp/h +Performance.cpp/h +PerformanceEntry.cpp/h +PerformanceMark.cpp/h +PerformanceMeasure.cpp/h +PerformanceObserver.cpp/h +PerformanceObserverEntryList.cpp/h +PerformanceResourceTiming.cpp/h +PerformanceServerTiming.cpp/h +PerformanceTiming.cpp/h +PerformanceUserTiming.cpp/h +ResourceLoadTiming.h +ResourceTiming.cpp/h +ServerTiming.cpp/h +ServerTimingParser.cpp/h +``` + +### 4.28 → `web/websocket/` + +From webcore directory: + +``` +JSWebSocket.cpp/h +WebSocket.cpp/h +WebSocketDeflate.h +WebSocketErrorCode.h +WebSocketIdentifier.h +``` + +### 4.29 → `web/webcrypto/` + +Entire `bindings/webcrypto/` directory (120+ files): + +- All `CryptoAlgorithm*.cpp/h` +- All `CryptoKey*.cpp/h` +- All `JSCrypto*.cpp/h` +- All `JS*Params.cpp/h` +- All `.idl` files +- `OpenSSL*.cpp/h` +- `SubtleCrypto.cpp/h` +- etc. + +--- + +### 4.30 → `node/buffer/` + +``` +BufferEncodingType.h +JSBuffer.cpp +JSBuffer.h +JSBufferEncodingType.cpp +JSBufferEncodingType.h +JSBufferList.cpp +JSBufferList.h +JSStringDecoder.cpp +JSStringDecoder.h +JSUint8Array.zig +Uint8Array.cpp +``` + +### 4.31 → `node/process/` + +``` +BunProcess.cpp +BunProcess.h +BunProcessReportObjectWindows.cpp +ExposeNodeModuleGlobals.cpp +JSEnvironmentVariableMap.cpp +JSEnvironmentVariableMap.h +JSNextTickQueue.cpp +JSNextTickQueue.h +ProcessBindingBuffer.cpp/h +ProcessBindingConstants.cpp/h +ProcessBindingFs.cpp/h +ProcessBindingHTTPParser.cpp/h +ProcessBindingNatives.cpp/h +ProcessBindingTTYWrap.cpp/h +ProcessBindingUV.cpp/h +ProcessIdentifier.cpp/h +``` + +### 4.32 → `node/vm/` + +``` +NodeVM.cpp +NodeVM.h +NodeVMModule.cpp +NodeVMModule.h +NodeVMScript.cpp +NodeVMScript.h +NodeVMScriptFetcher.h +NodeVMSourceTextModule.cpp +NodeVMSourceTextModule.h +NodeVMSyntheticModule.cpp +NodeVMSyntheticModule.h +``` + +### 4.33 → `node/crypto/` + +From bindings root: + +``` +AsymmetricKeyValue.cpp/h +dh-primes.h +JSX509Certificate.cpp/h +JSX509CertificateConstructor.cpp/h +JSX509CertificatePrototype.cpp/h +ncrpyto_engine.cpp +ncrypto.cpp +ncrypto.h +NodeTLS.cpp +NodeTLS.h +``` + +Plus entire `bindings/node/crypto/` directory (70+ files): + +- `CryptoDhJob.cpp/h` +- `CryptoGen*.cpp/h` +- `CryptoHkdf.cpp/h` +- `CryptoKeygen.cpp/h` +- `CryptoKeys.cpp/h` +- `CryptoPrimes.cpp/h` +- `CryptoSignJob.cpp/h` +- `CryptoUtil.cpp/h` +- `DiffieHellmanFunctions.h` +- `JSCipher*.cpp/h` +- `JSDiffieHellman*.cpp/h` +- `JSECDH*.cpp/h` +- `JSHash.cpp/h` +- `JSHmac.cpp/h` +- `JSKeyObject*.cpp/h` +- `JSPrivateKeyObject*.cpp/h` +- `JSPublicKeyObject*.cpp/h` +- `JSSecretKeyObject*.cpp/h` +- `JSSign.cpp/h` +- `JSVerify.cpp/h` +- `KeyObject.cpp/h` +- `KeyObjectData.h` +- `node_crypto_binding.cpp/h` + +### 4.34 → `node/http/` + +``` +NodeHTTP.cpp +NodeHTTP.h +``` + +Plus entire `bindings/node/http/` directory: + +- `JSConnectionsList*.cpp/h` +- `JSHTTPParser*.cpp/h` +- `llhttp/` subdirectory +- `NodeHTTPParser.cpp/h` + +Plus `bindings/node/`: + +- `JSNodeHTTPServerSocket.cpp/h` +- `JSNodeHTTPServerSocketPrototype.cpp/h` + +### 4.35 → `node/fs/` + +``` +NodeDirent.cpp +NodeDirent.h +NodeFSStatBinding.cpp +NodeFSStatBinding.h +NodeFSStatFSBinding.cpp +NodeFSStatFSBinding.h +``` + +### 4.36 → `node/os/` + +``` +OsBinding.cpp +``` + +### 4.37 → `node/path/` + +``` +Path.cpp +Path.h +PathInlines.h +``` + +### 4.38 → `node/util/` + +``` +NodeValidator.cpp +NodeValidator.h +``` + +### 4.39 → `node/timers/` + +``` +NodeTimerObject.cpp +``` + +Plus from `bindings/node/`: `NodeTimers.cpp/h` + +### 4.40 → `node/async_hooks/` + +``` +AsyncContextFrame.cpp +AsyncContextFrame.h +NodeAsyncHooks.cpp +NodeAsyncHooks.h +``` + +### 4.41 → `node/perf_hooks/` + +``` +JSNodePerformanceHooksHistogram.cpp +JSNodePerformanceHooksHistogram.h +JSNodePerformanceHooksHistogramConstructor.cpp +JSNodePerformanceHooksHistogramConstructor.h +JSNodePerformanceHooksHistogramPrototype.cpp +JSNodePerformanceHooksHistogramPrototype.h +``` + +### 4.42 → `node/constants/` + +``` +NodeConstants.h +``` + +--- + +### 4.50 → `compat/napi/` + +``` +napi.cpp +napi.h +napi_external.cpp +napi_external.h +napi_finalizer.cpp +napi_finalizer.h +napi_handle_scope.cpp +napi_handle_scope.h +napi_macros.h +napi_type_tag.cpp +napi_type_tag.h +NapiClass.cpp +NapiRef.cpp +NapiWeakValue.cpp +``` + +### 4.51 → `compat/v8/` + +Entire `bindings/v8/` directory (60+ files): + +- `CLAUDE.md` +- `node.cpp/h` +- `real_v8.h` +- `shim/` subdirectory (20 files) +- `v8.h` +- `v8_api_internal.cpp/h` +- `v8_compatibility_assertions.h` +- `v8_internal.cpp/h` +- `V8Array.cpp/h` +- `V8Boolean.cpp/h` +- `v8config.h` +- `V8Context.cpp/h` +- `V8Data.h` +- `V8EscapableHandleScope*.cpp/h` +- `V8External.cpp/h` +- `V8Function*.cpp/h` +- `V8HandleScope.cpp/h` +- `V8Isolate.cpp/h` +- `V8Local.cpp/h` +- `V8Maybe*.cpp/h` +- `V8Number.cpp/h` +- `V8Object*.cpp/h` +- `V8Primitive.h` +- `V8Signature.h` +- `V8String.cpp/h` +- `V8Template.cpp/h` +- `V8Value.cpp/h` + +### 4.52 → `compat/libuv/` + +Entire `bindings/libuv/` directory: + +- `uv.h` +- `uv/` subdirectory (platform headers) +- Generator scripts + +Plus from bindings root: + +``` +uv-posix-polyfills.c +uv-posix-polyfills.h +uv-posix-polyfills-darwin.c +uv-posix-polyfills-linux.c +uv-posix-polyfills-posix.c +uv-posix-stubs.c +``` + +### 4.53 → `compat/windows/` + +Entire `bindings/windows/` directory: + +``` +rescle-binding.cpp +rescle.cpp +rescle.h +``` + +--- + +### 4.60 → `jsc/types/` + +``` +AbortSignal.zig +AnyPromise.zig +CachedBytecode.zig +CallFrame.zig +CatchScope.zig +CommonAbortReason.zig +CommonStrings.zig +CustomGetterSetter.zig +DecodedJSValue.zig +EventType.zig +GetterSetter.zig +JSArray.zig +JSArrayIterator.zig +JSBigInt.zig +JSCell.zig +JSFunction.zig +JSGlobalObject.zig +JSInternalPromise.zig +JSMap.zig +JSObject.zig +JSPromise.zig +JSPromiseRejectionOperation.zig +JSPropertyIterator.zig +JSRef.zig +JSRuntimeType.zig +JSString.zig +JSType.zig +JSValue.zig +MarkedArgumentBuffer.zig +RegularExpression.cpp +RegularExpression.zig +ResolvedSource.zig +ScriptExecutionStatus.zig +SourceProvider.zig +SourceType.zig +VM.zig +``` + +### 4.61 → `jsc/global/` + +``` +BunGlobalScope.cpp +BunGlobalScope.h +BunObject.cpp +BunObject.h +BunObject+exports.h +BunWorkerGlobalScope.cpp +BunWorkerGlobalScope.h +DOMWrapperWorld-class.h +DOMWrapperWorld.cpp +DOMWrapperWorld.h +JSDOMGlobalObject.cpp +JSDOMGlobalObject.h +ScriptExecutionContext.cpp +ScriptExecutionContext.h +ZigGeneratedCode.cpp +ZigGlobalObject.cpp +ZigGlobalObject.h +ZigGlobalObject.lut.txt +ZigLazyStaticFunctions-inlines.h +ZigLazyStaticFunctions.h +ZigSourceProvider.cpp +ZigSourceProvider.h +``` + +### 4.62 → `jsc/gc/` + +``` +bmalloc_heap_ref.h +BunGCOutputConstraint.cpp +BunGCOutputConstraint.h +GCDefferalContext.h +MarkingConstraint.cpp +MimallocWTFMalloc.h +StrongRef.cpp +StrongRef.h +Weak.cpp +WebCoreOpaqueRoot.h +WebCoreOpaqueRootInlines.h +WriteBarrierList.h +``` + +### 4.63 → `jsc/interop/` + +``` +ActiveDOMCallback.cpp +ActiveDOMCallback.h +Algo/Tuple.h +ares_build.h +Bindgen/ (entire directory) +Bindgen.h +BindgenCustomEnforceRange.h +bindings.cpp +BunClientData.cpp +BunClientData.h +BunIDLConvert.h +BunIDLConvertBase.h +BunIDLConvertBlob.h +BunIDLConvertContext.h +BunIDLConvertNumbers.h +BunIDLHumanReadable.h +BunIDLTypes.h +BunJSCEventLoop.cpp +c-bindings.cpp +CachedScript.h +CatchScopeBinding.cpp +ConcatCStrings.h +coroutine.cpp +CPUFeatures.cpp +CPUFeatures.zig +debug-helpers.h +DeleteCallbackDataTask.h +EventLoopTask.h +EventLoopTaskNoContext.cpp +EventLoopTaskNoContext.h +headers-cpp.h +headers-handwritten.h +headers.h +helpers.cpp +helpers.h +IDLTypes.h +inlines.cpp +JSDOMBinding.h +JSDOMConvertBufferSource+JSBuffer.h +JSDOMExceptionHandling.cpp +JSDOMExceptionHandling.h +JSDOMWrapper.cpp +JSDOMWrapper.h +JSDOMWrapperCache.cpp +JSDOMWrapperCache.h +JSPropertyIterator.cpp +JSBigIntBinding.cpp +JSCTaskScheduler.cpp +JSCTaskScheduler.h +JSSocketAddressDTO.cpp +JSSocketAddressDTO.h +JSWrappingFunction.cpp +JSWrappingFunction.h +MarkedArgumentBufferBinding.cpp +ObjectBindings.cpp +ObjectBindings.h +objects.cpp +objects.h +root.h +Serialization.cpp +Sink.h +sizes.zig +static_export.zig +StreamGlobals.h +workaround-missing-symbols.cpp +wtf-bindings.cpp +wtf-bindings.h +WTF.zig +ZigString.zig +``` + +### 4.64 → `jsc/generated/` + +``` +codegen.zig +generated_classes_list.zig +GeneratedBindings.zig +GeneratedJS2Native.zig +JS2Native.cpp +JS2Native.h +js_classes.ts +``` + +--- + +### 4.70 → `module/` + +``` +ImportMetaObject.cpp +ImportMetaObject.h +InternalModuleRegistry.cpp +InternalModuleRegistry.h +isBuiltinModule.cpp +isBuiltinModule.h +JSCommonJSExtensions.cpp +JSCommonJSExtensions.h +JSCommonJSModule.cpp +JSCommonJSModule.h +JSModuleLoader.zig +ModuleLoader.cpp +ModuleLoader.h +NodeModuleModule.bind.ts +NodeModuleModule.zig +``` + +--- + +### 4.80 → `src/string/` + +``` +bun-simdutf.cpp +bun-simdutf.zig +BunCommonStrings.cpp +BunCommonStrings.h +BunString.cpp +BunString.h +DoubleFormatter.cpp +highway_strings.cpp +MiString.h +StringAdaptors.h +StringBuilder.zig +StringBuilderBinding.cpp +stripANSI.cpp +stripANSI.h +``` + +--- + +### 4.90 → `src/bake/` + +``` +BakeAdditionsToGlobalObject.cpp +BakeAdditionsToGlobalObject.h +HTMLEntryPoint.cpp +JSBakeResponse.cpp +JSBakeResponse.h +``` + +--- + +## Step 5: Move remaining webcore C++ + +From `bindings/webcore/` to appropriate `web/` subdirectories: + +- DOM helpers → `web/dom/` +- Structured clone → `web/` +- Worker → `web/worker/` +- MIME → `web/mime/` +- etc. + +--- + +## Final Structure + +``` +src/ +├── transpiler/ # JS/TS transpiler +├── test_runner/ # bun:test +├── bundler/ # bun build +├── resolver/ # Module resolution +├── install/ # Package manager +├── css/ # CSS parser +├── shell/ # Bun.$ +├── bake/ # Bake framework +├── sql/ # SQL (mysql/, postgres/) +├── s3/ # S3 core +├── valkey/ # Valkey/Redis +├── http/ # HTTP client +├── string/ # String utilities +├── ast/ # AST types +├── js/ # TypeScript modules +│ +└── buntime/ # JavaScript runtime + ├── api/ # Bun.* APIs + │ ├── server/ + │ ├── console/ + │ ├── inspector/ + │ ├── error/ + │ ├── cookie/ + │ ├── s3/ + │ ├── ffi/ + │ ├── sqlite/ + │ ├── sql/ + │ ├── shell/ + │ ├── ipc/ + │ ├── plugin/ + │ ├── secrets/ + │ └── test/ + │ + ├── web/ # Web Standards + │ ├── fetch/ + │ ├── url/ + │ ├── blob/ + │ ├── encoding/ + │ ├── compression/ + │ ├── events/ + │ ├── streams/ + │ ├── performance/ + │ ├── websocket/ + │ └── webcrypto/ + │ + ├── node/ # Node.js Compatibility + │ ├── buffer/ + │ ├── process/ + │ ├── vm/ + │ ├── crypto/ + │ ├── http/ + │ ├── fs/ + │ ├── os/ + │ ├── path/ + │ ├── util/ + │ ├── timers/ + │ ├── async_hooks/ + │ ├── perf_hooks/ + │ └── constants/ + │ + ├── compat/ # Native Addon Compat + │ ├── napi/ + │ ├── v8/ + │ ├── libuv/ + │ └── windows/ + │ + ├── jsc/ # JSC Integration + │ ├── types/ + │ ├── global/ + │ ├── gc/ + │ ├── interop/ + │ └── generated/ + │ + ├── module/ # Module System + └── event_loop/ # Event Loop +``` + +--- + +## Key Principle: Namespace Imports + +Bun uses `@import("bun")` namespaces: + +```zig +const bun = @import("bun"); +bun.sys // Not @import("./sys.zig") +bun.shell // Not @import("./shell/shell.zig") +``` + +Most code won't break - just update `bun.zig` exports. + +--- + +## Verification + +After each step: + +```bash +bun bd 2>&1 > out.txt | cat out.txt | head -50 +``` + +--- + +## Don't Forget + +1. **Strings go to `src/string/`** - simdutf, highway_strings, etc. +2. **RegularExpression goes to `jsc/types/`** - it's JSC-related +3. **S3 is a Bun API** → `api/s3/`, not `web/s3/` +4. **`webcrypto/` not `crypto/`** in web/ - distinguishes from node/crypto/ +5. **Keep `module/` flat** - no subdirectories needed +6. **bun-spawn.cpp, spawn.cpp** → `api/bun/spawn/` diff --git a/build.zig b/build.zig index cea24a8dfe19..acd95d5a4a61 100644 --- a/build.zig +++ b/build.zig @@ -42,7 +42,7 @@ const BunBuildOptions = struct { /// is set (to allow CI to build a portable executable). Affected files: /// /// - src/bake/runtime.ts (bundled) - /// - src/bun.js/api/FFI.h + /// - src/buntime/api/FFI.h /// /// A similar technique is used in C++ code for JavaScript builtins codegen_embed: bool = false, diff --git a/cmake/Sources.json b/cmake/Sources.json index 5ae49306939b..66a33694309c 100644 --- a/cmake/Sources.json +++ b/cmake/Sources.json @@ -9,14 +9,17 @@ }, { "output": "ZigGeneratedClassesSources.txt", - "paths": ["src/bun.js/*.classes.ts", "src/bun.js/{api,node,test,webcore}/*.classes.ts"] + "paths": [ + "src/buntime/*.classes.ts", + "src/buntime/{api,node,web}/*.classes.ts", + "src/buntime/web/*/*.classes.ts", + "src/buntime/api/*/*.classes.ts", + "src/test_runner/*.classes.ts" + ] }, { "output": "JavaScriptSources.txt", - "paths": [ - "src/js/**/*.{js,ts}", - "src/install/PackageManager/scanner-entry.ts" - ] + "paths": ["src/js/**/*.{js,ts}", "src/install/PackageManager/scanner-entry.ts"] }, { "output": "JavaScriptCodegenSources.txt", @@ -47,17 +50,63 @@ "output": "CxxSources.txt", "paths": [ "src/io/*.cpp", - "src/bun.js/modules/*.cpp", - "src/bun.js/bindings/*.cpp", - "src/bun.js/bindings/webcore/*.cpp", - "src/bun.js/bindings/sqlite/*.cpp", - "src/bun.js/bindings/webcrypto/*.cpp", - "src/bun.js/bindings/webcrypto/*/*.cpp", - "src/bun.js/bindings/node/*.cpp", - "src/bun.js/bindings/node/crypto/*.cpp", - "src/bun.js/bindings/node/http/*.cpp", - "src/bun.js/bindings/v8/*.cpp", - "src/bun.js/bindings/v8/shim/*.cpp", + "src/buntime/modules/*.cpp", + "src/buntime/jsc/types/*.cpp", + "src/buntime/jsc/global/*.cpp", + "src/buntime/jsc/gc/*.cpp", + "src/buntime/jsc/interop/*.cpp", + "src/buntime/jsc/generated/*.cpp", + "src/buntime/api/sqlite/*.cpp", + "src/buntime/web/webcrypto/*.cpp", + "src/buntime/web/webcrypto/*/*.cpp", + "src/buntime/node/buffer/*.cpp", + "src/buntime/node/process/*.cpp", + "src/buntime/node/vm/*.cpp", + "src/buntime/node/crypto/*.cpp", + "src/buntime/node/http/*.cpp", + "src/buntime/node/fs/*.cpp", + "src/buntime/node/os/*.cpp", + "src/buntime/node/path/*.cpp", + "src/buntime/node/util/*.cpp", + "src/buntime/node/timers/*.cpp", + "src/buntime/node/async_hooks/*.cpp", + "src/buntime/node/perf_hooks/*.cpp", + "src/buntime/compat/v8/*.cpp", + "src/buntime/compat/v8/shim/*.cpp", + "src/buntime/compat/napi/*.cpp", + "src/buntime/module/*.cpp", + "src/buntime/api/console/*.cpp", + "src/buntime/api/inspector/*.cpp", + "src/buntime/api/error/*.cpp", + "src/buntime/api/cookie/*.cpp", + "src/buntime/api/s3/*.cpp", + "src/buntime/api/secrets/*.cpp", + "src/buntime/api/ffi/*.cpp", + "src/buntime/api/sql/*.cpp", + "src/buntime/api/shell/*.cpp", + "src/buntime/api/ipc/*.cpp", + "src/buntime/api/test/*.cpp", + "src/buntime/api/server/*.cpp", + "src/buntime/api/plugin/*.cpp", + "src/buntime/api/process/*.cpp", + "src/buntime/api/bun/*.cpp", + "src/buntime/core/*.cpp", + "src/buntime/event_loop/*.cpp", + "src/string/*.cpp", + "src/buntime/web/fetch/*.cpp", + "src/buntime/web/url/*.cpp", + "src/buntime/web/blob/*.cpp", + "src/buntime/web/http/*.cpp", + "src/buntime/web/encoding/*.cpp", + "src/buntime/web/compression/*.cpp", + "src/buntime/web/events/*.cpp", + "src/buntime/web/streams/*.cpp", + "src/buntime/web/performance/*.cpp", + "src/buntime/web/websocket/*.cpp", + "src/buntime/web/workers/*.cpp", + "src/buntime/web/messaging/*.cpp", + "src/buntime/web/mime/*.cpp", + "src/buntime/web/serialization/*.cpp", "src/bake/*.cpp", "src/deps/*.cpp", "src/vm/*.cpp", @@ -71,10 +120,10 @@ "packages/bun-usockets/src/eventing/*.c", "packages/bun-usockets/src/internal/*.c", "packages/bun-usockets/src/crypto/*.c", - "src/bun.js/bindings/uv-posix-polyfills.c", - "src/bun.js/bindings/uv-posix-stubs.c", + "src/buntime/compat/libuv/uv-posix-polyfills.c", + "src/buntime/compat/libuv/uv-posix-stubs.c", "src/*.c", - "src/bun.js/bindings/node/http/llhttp/*.c" + "src/buntime/node/http/llhttp/*.c" ] } ] diff --git a/cmake/analysis/RunClangFormat.cmake b/cmake/analysis/RunClangFormat.cmake index f290116b53ff..1f7b404a0a0c 100644 --- a/cmake/analysis/RunClangFormat.cmake +++ b/cmake/analysis/RunClangFormat.cmake @@ -1,8 +1,8 @@ # https://clang.llvm.org/docs/ClangFormat.html file(GLOB BUN_H_SOURCES LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} - ${CWD}/src/bun.js/bindings/*.h - ${CWD}/src/bun.js/modules/*.h + ${CWD}/src/buntime/bindings/*.h + ${CWD}/src/buntime/modules/*.h ) set(CLANG_FORMAT_SOURCES ${BUN_C_SOURCES} ${BUN_CXX_SOURCES} ${BUN_H_SOURCES}) diff --git a/cmake/targets/BuildBun.cmake b/cmake/targets/BuildBun.cmake index 74580efaf999..fe26d2200567 100644 --- a/cmake/targets/BuildBun.cmake +++ b/cmake/targets/BuildBun.cmake @@ -225,9 +225,9 @@ set(BUN_ERROR_CODE_SCRIPT ${CWD}/src/codegen/generate-node-errors.ts) set(BUN_ERROR_CODE_SOURCES ${BUN_ERROR_CODE_SCRIPT} - ${CWD}/src/bun.js/bindings/ErrorCode.ts - ${CWD}/src/bun.js/bindings/ErrorCode.cpp - ${CWD}/src/bun.js/bindings/ErrorCode.h + ${CWD}/src/buntime/api/error/ErrorCode.ts + ${CWD}/src/buntime/api/error/ErrorCode.cpp + ${CWD}/src/buntime/api/error/ErrorCode.h ) set(BUN_ERROR_CODE_OUTPUTS @@ -295,7 +295,7 @@ absolute_sources(BUN_JAVASCRIPT_SOURCES ${CWD}/cmake/sources/JavaScriptSources.t absolute_sources(BUN_JAVASCRIPT_CODEGEN_SOURCES ${CWD}/cmake/sources/JavaScriptCodegenSources.txt) list(APPEND BUN_JAVASCRIPT_CODEGEN_SOURCES - ${CWD}/src/bun.js/bindings/InternalModuleRegistry.cpp + ${CWD}/src/buntime/module/InternalModuleRegistry.cpp ) set(BUN_JAVASCRIPT_OUTPUTS @@ -310,7 +310,7 @@ set(BUN_JAVASCRIPT_OUTPUTS ${CODEGEN_PATH}/SyntheticModuleType.h ${CODEGEN_PATH}/GeneratedJS2Native.h # Zig will complain if files are outside of the source directory - ${CWD}/src/bun.js/bindings/GeneratedJS2Native.zig + ${CWD}/src/buntime/jsc/generated/GeneratedJS2Native.zig ) set(BUN_CPP_OUTPUTS @@ -377,7 +377,7 @@ set(BUN_BAKE_RUNTIME_CODEGEN_SCRIPT ${CWD}/src/codegen/bake-codegen.ts) absolute_sources(BUN_BAKE_RUNTIME_SOURCES ${CWD}/cmake/sources/BakeRuntimeSources.txt) list(APPEND BUN_BAKE_RUNTIME_CODEGEN_SOURCES - ${CWD}/src/bun.js/bindings/InternalModuleRegistry.cpp + ${CWD}/src/buntime/module/InternalModuleRegistry.cpp ) set(BUN_BAKE_RUNTIME_OUTPUTS @@ -462,7 +462,7 @@ set(BUN_BINDGEN_CPP_OUTPUTS ) set(BUN_BINDGEN_ZIG_OUTPUTS - ${CWD}/src/bun.js/bindings/GeneratedBindings.zig + ${CWD}/src/buntime/jsc/generated/GeneratedBindings.zig ) register_command( @@ -516,16 +516,16 @@ register_command( set(BUN_OBJECT_LUT_SCRIPT ${CWD}/src/codegen/create-hash-table.ts) set(BUN_OBJECT_LUT_SOURCES - ${CWD}/src/bun.js/bindings/BunObject.cpp - ${CWD}/src/bun.js/bindings/ZigGlobalObject.lut.txt - ${CWD}/src/bun.js/bindings/JSBuffer.cpp - ${CWD}/src/bun.js/bindings/BunProcess.cpp - ${CWD}/src/bun.js/bindings/ProcessBindingBuffer.cpp - ${CWD}/src/bun.js/bindings/ProcessBindingConstants.cpp - ${CWD}/src/bun.js/bindings/ProcessBindingFs.cpp - ${CWD}/src/bun.js/bindings/ProcessBindingNatives.cpp - ${CWD}/src/bun.js/bindings/ProcessBindingHTTPParser.cpp - ${CWD}/src/bun.js/modules/NodeModuleModule.cpp + ${CWD}/src/buntime/jsc/global/BunObject.cpp + ${CWD}/src/buntime/jsc/global/ZigGlobalObject.lut.txt + ${CWD}/src/buntime/node/buffer/JSBuffer.cpp + ${CWD}/src/buntime/api/process/BunProcess.cpp + ${CWD}/src/buntime/api/process/ProcessBindingBuffer.cpp + ${CWD}/src/buntime/api/process/ProcessBindingConstants.cpp + ${CWD}/src/buntime/api/process/ProcessBindingFs.cpp + ${CWD}/src/buntime/api/process/ProcessBindingNatives.cpp + ${CWD}/src/buntime/api/process/ProcessBindingHTTPParser.cpp + ${CWD}/src/buntime/modules/NodeModuleModule.cpp ${CODEGEN_PATH}/ZigGeneratedClasses.lut.txt ) @@ -591,24 +591,24 @@ foreach(i RANGE 0 ${BUN_OBJECT_LUT_SOURCES_MAX_INDEX}) endforeach() WEBKIT_ADD_SOURCE_DEPENDENCIES( - ${CWD}/src/bun.js/bindings/ErrorCode.cpp + ${CWD}/src/buntime/api/error/ErrorCode.cpp ${CODEGEN_PATH}/ErrorCode+List.h ) WEBKIT_ADD_SOURCE_DEPENDENCIES( - ${CWD}/src/bun.js/bindings/ErrorCode.h + ${CWD}/src/buntime/api/error/ErrorCode.h ${CODEGEN_PATH}/ErrorCode+Data.h ) WEBKIT_ADD_SOURCE_DEPENDENCIES( - ${CWD}/src/bun.js/bindings/ZigGlobalObject.cpp + ${CWD}/src/buntime/jsc/global/ZigGlobalObject.cpp ${CODEGEN_PATH}/ZigGlobalObject.lut.h ) WEBKIT_ADD_SOURCE_DEPENDENCIES( - ${CWD}/src/bun.js/bindings/InternalModuleRegistry.cpp + ${CWD}/src/buntime/module/InternalModuleRegistry.cpp ${CODEGEN_PATH}/InternalModuleRegistryConstants.h ) @@ -727,8 +727,8 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "build.zig") set(BUN_USOCKETS_SOURCE ${CWD}/packages/bun-usockets) if(WIN32) - list(APPEND BUN_CXX_SOURCES ${CWD}/src/bun.js/bindings/windows/rescle.cpp) - list(APPEND BUN_CXX_SOURCES ${CWD}/src/bun.js/bindings/windows/rescle-binding.cpp) + list(APPEND BUN_CXX_SOURCES ${CWD}/src/buntime/compat/windows/rescle.cpp) + list(APPEND BUN_CXX_SOURCES ${CWD}/src/buntime/compat/windows/rescle-binding.cpp) endif() register_repository( @@ -843,7 +843,7 @@ if (NOT WIN32) # 2. In CI AND BUN_CPP_ONLY is enabled if(NOT CI OR (CI AND BUN_CPP_ONLY)) target_precompile_headers(${bun} PRIVATE - "$<$:${CWD}/src/bun.js/bindings/root.h>" + "$<$:${CWD}/src/buntime/jsc/interop/root.h>" ) endif() endif() @@ -851,21 +851,72 @@ endif() # --- C/C++ Includes --- if(WIN32) - target_include_directories(${bun} PRIVATE ${CWD}/src/bun.js/bindings/windows) + target_include_directories(${bun} PRIVATE ${CWD}/src/buntime/compat/windows) endif() target_include_directories(${bun} PRIVATE ${CWD}/packages ${CWD}/packages/bun-usockets ${CWD}/packages/bun-usockets/src - ${CWD}/src/bun.js/bindings - ${CWD}/src/bun.js/bindings/webcore - ${CWD}/src/bun.js/bindings/webcrypto - ${CWD}/src/bun.js/bindings/node/crypto - ${CWD}/src/bun.js/bindings/node/http - ${CWD}/src/bun.js/bindings/sqlite - ${CWD}/src/bun.js/bindings/v8 - ${CWD}/src/bun.js/modules + ${CWD}/src/buntime/jsc/interop + ${CWD}/src/buntime/jsc/global + ${CWD}/src/buntime/jsc/gc + ${CWD}/src/buntime/jsc/types + ${CWD}/src/buntime/jsc/generated + ${CWD}/src/bake + ${CWD}/src/string + ${CWD}/src/buntime/web + ${CWD}/src/buntime/web/webcrypto + ${CWD}/src/buntime/node + ${CWD}/src/buntime/node/buffer + ${CWD}/src/buntime/node/process + ${CWD}/src/buntime/node/vm + ${CWD}/src/buntime/node/crypto + ${CWD}/src/buntime/node/http + ${CWD}/src/buntime/node/fs + ${CWD}/src/buntime/node/os + ${CWD}/src/buntime/node/path + ${CWD}/src/buntime/node/util + ${CWD}/src/buntime/node/timers + ${CWD}/src/buntime/node/async_hooks + ${CWD}/src/buntime/node/perf_hooks + ${CWD}/src/buntime/node/constants + ${CWD}/src/buntime/api/sqlite + ${CWD}/src/buntime/compat/v8 + ${CWD}/src/buntime/compat/napi + ${CWD}/src/buntime/compat + ${CWD}/src/buntime/module + ${CWD}/src/buntime/api/console + ${CWD}/src/buntime/api/inspector + ${CWD}/src/buntime/api/error + ${CWD}/src/buntime/api/cookie + ${CWD}/src/buntime/api/s3 + ${CWD}/src/buntime/api/secrets + ${CWD}/src/buntime/api/ffi + ${CWD}/src/buntime/api/sql + ${CWD}/src/buntime/api/shell + ${CWD}/src/buntime/api/ipc + ${CWD}/src/buntime/api/test + ${CWD}/src/buntime/api/server + ${CWD}/src/buntime/api/plugin + ${CWD}/src/buntime/api/process + ${CWD}/src/buntime/core + ${CWD}/src/buntime/event_loop + ${CWD}/src/buntime/web/fetch + ${CWD}/src/buntime/web/url + ${CWD}/src/buntime/web/blob + ${CWD}/src/buntime/web/http + ${CWD}/src/buntime/web/encoding + ${CWD}/src/buntime/web/compression + ${CWD}/src/buntime/web/events + ${CWD}/src/buntime/web/streams + ${CWD}/src/buntime/web/performance + ${CWD}/src/buntime/web/websocket + ${CWD}/src/buntime/web/workers + ${CWD}/src/buntime/web/messaging + ${CWD}/src/buntime/web/mime + ${CWD}/src/buntime/web/serialization + ${CWD}/src/buntime/modules ${CWD}/src/js/builtins ${CWD}/src/napi ${CWD}/src/deps @@ -878,7 +929,7 @@ target_include_directories(${bun} PRIVATE ) if(NOT WIN32) - target_include_directories(${bun} PRIVATE ${CWD}/src/bun.js/bindings/libuv) + target_include_directories(${bun} PRIVATE ${CWD}/src/buntime/compat/libuv) endif() if(LINUX) diff --git a/cmake/targets/BuildSQLite.cmake b/cmake/targets/BuildSQLite.cmake index ce4cd8da24db..53425d7c429f 100644 --- a/cmake/targets/BuildSQLite.cmake +++ b/cmake/targets/BuildSQLite.cmake @@ -2,7 +2,7 @@ register_cmake_command( TARGET sqlite CWD - ${CWD}/src/bun.js/bindings/sqlite + ${CWD}/src/buntime/bindings/sqlite LIBRARIES sqlite3 INCLUDES diff --git a/cmake/tools/SetupBun.cmake b/cmake/tools/SetupBun.cmake index 3cb77ff4be9e..16b0fb631f59 100644 --- a/cmake/tools/SetupBun.cmake +++ b/cmake/tools/SetupBun.cmake @@ -18,7 +18,7 @@ if (NOT CI) endif() # If this is not set, some advanced features are not checked. -# https://github.com/oven-sh/bun/blob/cd7f6a1589db7f1e39dc4e3f4a17234afbe7826c/src/bun.js/javascript.zig#L1069-L1072 +# https://github.com/oven-sh/bun/blob/cd7f6a1589db7f1e39dc4e3f4a17234afbe7826c/src/buntime/javascript.zig#L1069-L1072 setenv(BUN_GARBAGE_COLLECTOR_LEVEL 1) setenv(BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING 1) setenv(BUN_DEBUG_QUIET_LOGS 1) diff --git a/package.json b/package.json index 3284a54a31fb..cef77cb49e09 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "build:debug-zig-release": "cmake . -DCMAKE_BUILD_TYPE=Release -DZIG_OPTIMIZE=Debug -GNinja -Bbuild-debug-zig-release && ninja -Cbuild-debug-zig-release", "run:linux": "docker run --rm -v \"$PWD:/root/bun/\" -w /root/bun ghcr.io/oven-sh/bun-development-docker-image", "css-properties": "bun run src/css/properties/generate_properties.ts", - "uv-posix-stubs": "bun run src/bun.js/bindings/libuv/generate_uv_posix_stubs.ts", + "uv-posix-stubs": "bun run src/buntime/compat/libuv/generate_uv_posix_stubs.ts", "bump": "bun ./scripts/bump.ts", "jsc:build": "bun ./scripts/build-jsc.ts release", "jsc:build:debug": "bun ./scripts/build-jsc.ts debug", diff --git a/src/AGENTS.md b/src/AGENTS.md deleted file mode 120000 index 681311eb9cf4..000000000000 --- a/src/AGENTS.md +++ /dev/null @@ -1 +0,0 @@ -CLAUDE.md \ No newline at end of file diff --git a/src/AGENTS.md b/src/AGENTS.md new file mode 100644 index 000000000000..7b394aa69fc1 --- /dev/null +++ b/src/AGENTS.md @@ -0,0 +1,11 @@ +## Zig + +Syntax reminders: + +- Private fields are fully supported in Zig with the `#` prefix. `struct { #foo: u32 };` makes a struct with a private field named `#foo`. +- Decl literals in Zig are recommended. `const decl: Decl = .{ .binding = 0, .value = 0 };` + +Conventions: + +- Prefer `@import` at the **bottom** of the file, but the auto formatter will move them so you don't need to worry about it. +- You must be patient with the build. diff --git a/src/ast.zig b/src/ast.zig index f94536941651..ac0fef3a6ad0 100644 --- a/src/ast.zig +++ b/src/ast.zig @@ -702,7 +702,7 @@ pub const BabyList = bun.BabyList; const string = []const u8; const std = @import("std"); -const TypeScript = @import("./js_parser.zig").TypeScript; +const TypeScript = @import("./transpiler/js_parser.zig").TypeScript; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/ast/Expr.zig b/src/ast/Expr.zig index aa9f7eb5b58a..4e4263882404 100644 --- a/src/ast/Expr.zig +++ b/src/ast/Expr.zig @@ -3254,7 +3254,7 @@ fn stringToEquivalentNumberValue(str: []const u8) f64 { const string = []const u8; const stringZ = [:0]const u8; -const JSPrinter = @import("../js_printer.zig"); +const JSPrinter = @import("../transpiler/js_printer.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp b/src/bake/BakeAdditionsToGlobalObject.cpp similarity index 100% rename from src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp rename to src/bake/BakeAdditionsToGlobalObject.cpp diff --git a/src/bun.js/bindings/BakeAdditionsToGlobalObject.h b/src/bake/BakeAdditionsToGlobalObject.h similarity index 100% rename from src/bun.js/bindings/BakeAdditionsToGlobalObject.h rename to src/bake/BakeAdditionsToGlobalObject.h diff --git a/src/bun.js/bindings/HTMLEntryPoint.cpp b/src/bake/HTMLEntryPoint.cpp similarity index 100% rename from src/bun.js/bindings/HTMLEntryPoint.cpp rename to src/bake/HTMLEntryPoint.cpp diff --git a/src/bun.js/bindings/JSBakeResponse.cpp b/src/bake/JSBakeResponse.cpp similarity index 100% rename from src/bun.js/bindings/JSBakeResponse.cpp rename to src/bake/JSBakeResponse.cpp diff --git a/src/bun.js/bindings/JSBakeResponse.h b/src/bake/JSBakeResponse.h similarity index 100% rename from src/bun.js/bindings/JSBakeResponse.h rename to src/bake/JSBakeResponse.h diff --git a/src/boringssl.zig b/src/boringssl.zig index 16e2d500d797..83688bdcacbf 100644 --- a/src/boringssl.zig +++ b/src/boringssl.zig @@ -219,7 +219,7 @@ pub fn ERR_toJS(globalThis: *jsc.JSGlobalObject, err_code: u32) jsc.JSValue { return globalThis.ERR(.BORINGSSL, "{s}", .{error_message}).toJS(); } -const X509 = @import("./bun.js/api/bun/x509.zig"); +const X509 = @import("./buntime/api/bun/x509.zig"); const boring = @import("./deps/boringssl.translated.zig"); const builtin = @import("builtin"); const c_ares = @import("./deps/c_ares.zig"); diff --git a/src/bun.js.zig b/src/bun.js.zig index bcd1af82d4df..a26a8690212e 100644 --- a/src/bun.js.zig +++ b/src/bun.js.zig @@ -1,7 +1,7 @@ -pub const jsc = @import("./bun.js/jsc.zig"); -pub const webcore = @import("./bun.js/webcore.zig"); -pub const api = @import("./bun.js/api.zig"); -pub const bindgen = @import("./bun.js/bindgen.zig"); +pub const jsc = @import("./buntime/jsc.zig"); +pub const webcore = @import("./buntime/webcore.zig"); +pub const api = @import("./buntime/api.zig"); +pub const bindgen = @import("./buntime/jsc/interop/bindgen.zig"); pub const Run = struct { ctx: Command.Context, @@ -147,7 +147,7 @@ pub const Run = struct { var bundle = try bun.Transpiler.init( ctx.allocator, ctx.log, - try @import("./bun.js/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), + try @import("./buntime/core/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), null, ); try bundle.runEnvLoader(bundle.options.env.disable_default_env_files); @@ -496,7 +496,7 @@ pub const Run = struct { bun.api.napi.fixDeadCodeElimination(); bun.webcore.BakeResponse.fixDeadCodeElimination(); bun.crash_handler.fixDeadCodeElimination(); - @import("./bun.js/bindings/JSSecrets.zig").fixDeadCodeElimination(); + @import("./buntime/api/secrets/JSSecrets.zig").fixDeadCodeElimination(); vm.globalExit(); } @@ -551,7 +551,7 @@ const VirtualMachine = jsc.VirtualMachine; const string = []const u8; -const CPUProfiler = @import("./bun.js/bindings/BunCPUProfiler.zig"); +const CPUProfiler = @import("./buntime/api/inspector/BunCPUProfiler.zig"); const options = @import("./options.zig"); const std = @import("std"); const Command = @import("./cli.zig").Command; diff --git a/src/bun.js/api/ffi-stdatomic.h b/src/bun.js/api/ffi-stdatomic.h deleted file mode 100644 index 7ac662816be1..000000000000 --- a/src/bun.js/api/ffi-stdatomic.h +++ /dev/null @@ -1,180 +0,0 @@ -/* This file is derived from clang's stdatomic.h */ - -/*===---- stdatomic.h - Standard header for atomic types and operations -----=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#ifndef _STDATOMIC_H -#define _STDATOMIC_H - -#include -#include -#include - -#define __ATOMIC_RELAXED 0 -#define __ATOMIC_CONSUME 1 -#define __ATOMIC_ACQUIRE 2 -#define __ATOMIC_RELEASE 3 -#define __ATOMIC_ACQ_REL 4 -#define __ATOMIC_SEQ_CST 5 - -/* Memory ordering */ -typedef enum { - memory_order_relaxed = __ATOMIC_RELAXED, - memory_order_consume = __ATOMIC_CONSUME, - memory_order_acquire = __ATOMIC_ACQUIRE, - memory_order_release = __ATOMIC_RELEASE, - memory_order_acq_rel = __ATOMIC_ACQ_REL, - memory_order_seq_cst = __ATOMIC_SEQ_CST, -} memory_order; - -/* Atomic typedefs */ -typedef _Atomic(_Bool) atomic_bool; -typedef _Atomic(char) atomic_char; -typedef _Atomic(signed char) atomic_schar; -typedef _Atomic(unsigned char) atomic_uchar; -typedef _Atomic(short) atomic_short; -typedef _Atomic(unsigned short) atomic_ushort; -typedef _Atomic(int) atomic_int; -typedef _Atomic(unsigned int) atomic_uint; -typedef _Atomic(long) atomic_long; -typedef _Atomic(unsigned long) atomic_ulong; -typedef _Atomic(long long) atomic_llong; -typedef _Atomic(unsigned long long) atomic_ullong; -typedef _Atomic(uint_least16_t) atomic_char16_t; -typedef _Atomic(uint_least32_t) atomic_char32_t; -typedef _Atomic(wchar_t) atomic_wchar_t; -typedef _Atomic(int_least8_t) atomic_int_least8_t; -typedef _Atomic(uint_least8_t) atomic_uint_least8_t; -typedef _Atomic(int_least16_t) atomic_int_least16_t; -typedef _Atomic(uint_least16_t) atomic_uint_least16_t; -typedef _Atomic(int_least32_t) atomic_int_least32_t; -typedef _Atomic(uint_least32_t) atomic_uint_least32_t; -typedef _Atomic(int_least64_t) atomic_int_least64_t; -typedef _Atomic(uint_least64_t) atomic_uint_least64_t; -typedef _Atomic(int_fast8_t) atomic_int_fast8_t; -typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t; -typedef _Atomic(int_fast16_t) atomic_int_fast16_t; -typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t; -typedef _Atomic(int_fast32_t) atomic_int_fast32_t; -typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t; -typedef _Atomic(int_fast64_t) atomic_int_fast64_t; -typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t; -typedef _Atomic(intptr_t) atomic_intptr_t; -typedef _Atomic(uintptr_t) atomic_uintptr_t; -typedef _Atomic(size_t) atomic_size_t; -typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t; -typedef _Atomic(intmax_t) atomic_intmax_t; -typedef _Atomic(uintmax_t) atomic_uintmax_t; - -/* Atomic flag */ -typedef struct { - atomic_bool value; -} atomic_flag; - -#define ATOMIC_FLAG_INIT {0} -#define ATOMIC_VAR_INIT(value) (value) - -#define atomic_flag_test_and_set_explicit(object, order) \ - __atomic_test_and_set((void *)(&((object)->value)), order) -#define atomic_flag_test_and_set(object) \ - atomic_flag_test_and_set_explicit(object, __ATOMIC_SEQ_CST) - -#define atomic_flag_clear_explicit(object, order) \ - __atomic_clear((bool *)(&((object)->value)), order) -#define atomic_flag_clear(object) \ - atomic_flag_clear_explicit(object, __ATOMIC_SEQ_CST) - -/* Generic routines */ -#define atomic_init(object, desired) \ - atomic_store_explicit(object, desired, __ATOMIC_RELAXED) - -#define atomic_store_explicit(object, desired, order) \ - ({ \ - __typeof__(object) ptr = (object); \ - __typeof__(*ptr) tmp = (desired); \ - __atomic_store(ptr, &tmp, (order)); \ - }) -#define atomic_store(object, desired) \ - atomic_store_explicit(object, desired, __ATOMIC_SEQ_CST) - -#define atomic_load_explicit(object, order) \ - ({ \ - __typeof__(object) ptr = (object); \ - __typeof__(*ptr) tmp; \ - __atomic_load(ptr, &tmp, (order)); \ - tmp; \ - }) -#define atomic_load(object) atomic_load_explicit(object, __ATOMIC_SEQ_CST) - -#define atomic_exchange_explicit(object, desired, order) \ - ({ \ - __typeof__(object) ptr = (object); \ - __typeof__(*ptr) val = (desired); \ - __typeof__(*ptr) tmp; \ - __atomic_exchange(ptr, &val, &tmp, (order)); \ - tmp; \ - }) -#define atomic_exchange(object, desired) \ - atomic_exchange_explicit(object, desired, __ATOMIC_SEQ_CST) - -#define atomic_compare_exchange_strong_explicit(object, expected, desired, \ - success, failure) \ - ({ \ - __typeof__(object) ptr = (object); \ - __typeof__(*ptr) tmp = desired; \ - __atomic_compare_exchange(ptr, expected, &tmp, 0, success, failure); \ - }) -#define atomic_compare_exchange_strong(object, expected, desired) \ - atomic_compare_exchange_strong_explicit(object, expected, desired, \ - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) - -#define atomic_compare_exchange_weak_explicit(object, expected, desired, \ - success, failure) \ - ({ \ - __typeof__(object) ptr = (object); \ - __typeof__(*ptr) tmp = desired; \ - __atomic_compare_exchange(ptr, expected, &tmp, 1, success, failure); \ - }) -#define atomic_compare_exchange_weak(object, expected, desired) \ - atomic_compare_exchange_weak_explicit(object, expected, desired, \ - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) - -#define atomic_fetch_add(object, operand) \ - __atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_add_explicit __atomic_fetch_add - -#define atomic_fetch_sub(object, operand) \ - __atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_sub_explicit __atomic_fetch_sub - -#define atomic_fetch_or(object, operand) \ - __atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_or_explicit __atomic_fetch_or - -#define atomic_fetch_xor(object, operand) \ - __atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_xor_explicit __atomic_fetch_xor - -#define atomic_fetch_and(object, operand) \ - __atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_and_explicit __atomic_fetch_and - -extern void atomic_thread_fence(memory_order); -extern void __atomic_thread_fence(memory_order); -#define atomic_thread_fence(order) __atomic_thread_fence(order) -extern void atomic_signal_fence(memory_order); -extern void __atomic_signal_fence(memory_order); -#define atomic_signal_fence(order) __atomic_signal_fence(order) -extern bool __atomic_is_lock_free(size_t size, void *ptr); -#define atomic_is_lock_free(OBJ) __atomic_is_lock_free(sizeof(*(OBJ)), (OBJ)) - -extern bool __atomic_test_and_set(void *, memory_order); -extern void __atomic_clear(bool *, memory_order); - -#endif /* _STDATOMIC_H */ diff --git a/src/bun.js/bindings/.clang-format-ignore b/src/bun.js/bindings/.clang-format-ignore deleted file mode 100644 index 2a91525822d7..000000000000 --- a/src/bun.js/bindings/.clang-format-ignore +++ /dev/null @@ -1,2 +0,0 @@ -*.lut.h -sqlite/sqlite3_local.h \ No newline at end of file diff --git a/src/bun.js/bindings/libuv/uv.h b/src/bun.js/bindings/libuv/uv.h deleted file mode 100644 index 938e998fdc54..000000000000 --- a/src/bun.js/bindings/libuv/uv.h +++ /dev/null @@ -1,1990 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* See https://github.com/libuv/libuv#documentation for documentation. */ - -#ifndef UV_H -#define UV_H -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED) -#error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both." -#endif - -#ifndef UV_EXTERN -#ifdef _WIN32 - /* Windows - set up dll import/export decorators. */ -# if defined(BUILDING_UV_SHARED) - /* Building shared library. */ -# define UV_EXTERN __declspec(dllexport) -# elif defined(USING_UV_SHARED) - /* Using shared library. */ -# define UV_EXTERN __declspec(dllimport) -# else - /* Building static library. */ -# define UV_EXTERN /* nothing */ -# endif -#elif __GNUC__ >= 4 -# define UV_EXTERN __attribute__((visibility("default"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */ -# define UV_EXTERN __global -#else -# define UV_EXTERN /* nothing */ -#endif -#endif /* UV_EXTERN */ - -#include "uv/errno.h" -#include "uv/version.h" -#include -#include -#include -#include - -/* Internal type, do not use. */ -struct uv__queue { - struct uv__queue* next; - struct uv__queue* prev; -}; - -#if defined(_WIN32) -# include "uv/win.h" -#else -# include "uv/unix.h" -#endif - -/* Expand this list if necessary. */ -#define UV_ERRNO_MAP(XX) \ - XX(E2BIG, "argument list too long") \ - XX(EACCES, "permission denied") \ - XX(EADDRINUSE, "address already in use") \ - XX(EADDRNOTAVAIL, "address not available") \ - XX(EAFNOSUPPORT, "address family not supported") \ - XX(EAGAIN, "resource temporarily unavailable") \ - XX(EAI_ADDRFAMILY, "address family not supported") \ - XX(EAI_AGAIN, "temporary failure") \ - XX(EAI_BADFLAGS, "bad ai_flags value") \ - XX(EAI_BADHINTS, "invalid value for hints") \ - XX(EAI_CANCELED, "request canceled") \ - XX(EAI_FAIL, "permanent failure") \ - XX(EAI_FAMILY, "ai_family not supported") \ - XX(EAI_MEMORY, "out of memory") \ - XX(EAI_NODATA, "no address") \ - XX(EAI_NONAME, "unknown node or service") \ - XX(EAI_OVERFLOW, "argument buffer overflow") \ - XX(EAI_PROTOCOL, "resolved protocol is unknown") \ - XX(EAI_SERVICE, "service not available for socket type") \ - XX(EAI_SOCKTYPE, "socket type not supported") \ - XX(EALREADY, "connection already in progress") \ - XX(EBADF, "bad file descriptor") \ - XX(EBUSY, "resource busy or locked") \ - XX(ECANCELED, "operation canceled") \ - XX(ECHARSET, "invalid Unicode character") \ - XX(ECONNABORTED, "software caused connection abort") \ - XX(ECONNREFUSED, "connection refused") \ - XX(ECONNRESET, "connection reset by peer") \ - XX(EDESTADDRREQ, "destination address required") \ - XX(EEXIST, "file already exists") \ - XX(EFAULT, "bad address in system call argument") \ - XX(EFBIG, "file too large") \ - XX(EHOSTUNREACH, "host is unreachable") \ - XX(EINTR, "interrupted system call") \ - XX(EINVAL, "invalid argument") \ - XX(EIO, "i/o error") \ - XX(EISCONN, "socket is already connected") \ - XX(EISDIR, "illegal operation on a directory") \ - XX(ELOOP, "too many symbolic links encountered") \ - XX(EMFILE, "too many open files") \ - XX(EMSGSIZE, "message too long") \ - XX(ENAMETOOLONG, "name too long") \ - XX(ENETDOWN, "network is down") \ - XX(ENETUNREACH, "network is unreachable") \ - XX(ENFILE, "file table overflow") \ - XX(ENOBUFS, "no buffer space available") \ - XX(ENODEV, "no such device") \ - XX(ENOENT, "no such file or directory") \ - XX(ENOMEM, "not enough memory") \ - XX(ENONET, "machine is not on the network") \ - XX(ENOPROTOOPT, "protocol not available") \ - XX(ENOSPC, "no space left on device") \ - XX(ENOSYS, "function not implemented") \ - XX(ENOTCONN, "socket is not connected") \ - XX(ENOTDIR, "not a directory") \ - XX(ENOTEMPTY, "directory not empty") \ - XX(ENOTSOCK, "socket operation on non-socket") \ - XX(ENOTSUP, "operation not supported on socket") \ - XX(EOVERFLOW, "value too large for defined data type") \ - XX(EPERM, "operation not permitted") \ - XX(EPIPE, "broken pipe") \ - XX(EPROTO, "protocol error") \ - XX(EPROTONOSUPPORT, "protocol not supported") \ - XX(EPROTOTYPE, "protocol wrong type for socket") \ - XX(ERANGE, "result too large") \ - XX(EROFS, "read-only file system") \ - XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ - XX(ESPIPE, "invalid seek") \ - XX(ESRCH, "no such process") \ - XX(ETIMEDOUT, "connection timed out") \ - XX(ETXTBSY, "text file is busy") \ - XX(EXDEV, "cross-device link not permitted") \ - XX(UNKNOWN, "unknown error") \ - XX(EOF, "end of file") \ - XX(ENXIO, "no such device or address") \ - XX(EMLINK, "too many links") \ - XX(EHOSTDOWN, "host is down") \ - XX(EREMOTEIO, "remote I/O error") \ - XX(ENOTTY, "inappropriate ioctl for device") \ - XX(EFTYPE, "inappropriate file type or format") \ - XX(EILSEQ, "illegal byte sequence") \ - XX(ESOCKTNOSUPPORT, "socket type not supported") \ - XX(ENODATA, "no data available") \ - XX(EUNATCH, "protocol driver not attached") \ - XX(ENOEXEC, "exec format error") \ - -#define UV_HANDLE_TYPE_MAP(XX) \ - XX(ASYNC, async) \ - XX(CHECK, check) \ - XX(FS_EVENT, fs_event) \ - XX(FS_POLL, fs_poll) \ - XX(HANDLE, handle) \ - XX(IDLE, idle) \ - XX(NAMED_PIPE, pipe) \ - XX(POLL, poll) \ - XX(PREPARE, prepare) \ - XX(PROCESS, process) \ - XX(STREAM, stream) \ - XX(TCP, tcp) \ - XX(TIMER, timer) \ - XX(TTY, tty) \ - XX(UDP, udp) \ - XX(SIGNAL, signal) \ - -#define UV_REQ_TYPE_MAP(XX) \ - XX(REQ, req) \ - XX(CONNECT, connect) \ - XX(WRITE, write) \ - XX(SHUTDOWN, shutdown) \ - XX(UDP_SEND, udp_send) \ - XX(FS, fs) \ - XX(WORK, work) \ - XX(GETADDRINFO, getaddrinfo) \ - XX(GETNAMEINFO, getnameinfo) \ - XX(RANDOM, random) \ - -typedef enum { -#define XX(code, _) UV_ ## code = UV__ ## code, - UV_ERRNO_MAP(XX) -#undef XX - UV_ERRNO_MAX = UV__EOF - 1 -} uv_errno_t; - -typedef enum { - UV_UNKNOWN_HANDLE = 0, -#define XX(uc, lc) UV_##uc, - UV_HANDLE_TYPE_MAP(XX) -#undef XX - UV_FILE, - UV_HANDLE_TYPE_MAX -} uv_handle_type; - -typedef enum { - UV_UNKNOWN_REQ = 0, -#define XX(uc, lc) UV_##uc, - UV_REQ_TYPE_MAP(XX) -#undef XX - UV_REQ_TYPE_PRIVATE - UV_REQ_TYPE_MAX -} uv_req_type; - - -/* Handle types. */ -typedef struct uv_loop_s uv_loop_t; -typedef struct uv_handle_s uv_handle_t; -typedef struct uv_dir_s uv_dir_t; -typedef struct uv_stream_s uv_stream_t; -typedef struct uv_tcp_s uv_tcp_t; -typedef struct uv_udp_s uv_udp_t; -typedef struct uv_pipe_s uv_pipe_t; -typedef struct uv_tty_s uv_tty_t; -typedef struct uv_poll_s uv_poll_t; -typedef struct uv_timer_s uv_timer_t; -typedef struct uv_prepare_s uv_prepare_t; -typedef struct uv_check_s uv_check_t; -typedef struct uv_idle_s uv_idle_t; -typedef struct uv_async_s uv_async_t; -typedef struct uv_process_s uv_process_t; -typedef struct uv_fs_event_s uv_fs_event_t; -typedef struct uv_fs_poll_s uv_fs_poll_t; -typedef struct uv_signal_s uv_signal_t; - -/* Request types. */ -typedef struct uv_req_s uv_req_t; -typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; -typedef struct uv_getnameinfo_s uv_getnameinfo_t; -typedef struct uv_shutdown_s uv_shutdown_t; -typedef struct uv_write_s uv_write_t; -typedef struct uv_connect_s uv_connect_t; -typedef struct uv_udp_send_s uv_udp_send_t; -typedef struct uv_fs_s uv_fs_t; -typedef struct uv_work_s uv_work_t; -typedef struct uv_random_s uv_random_t; - -/* None of the above. */ -typedef struct uv_env_item_s uv_env_item_t; -typedef struct uv_cpu_info_s uv_cpu_info_t; -typedef struct uv_interface_address_s uv_interface_address_t; -typedef struct uv_dirent_s uv_dirent_t; -typedef struct uv_passwd_s uv_passwd_t; -typedef struct uv_group_s uv_group_t; -typedef struct uv_utsname_s uv_utsname_t; -typedef struct uv_statfs_s uv_statfs_t; - -typedef struct uv_metrics_s uv_metrics_t; - -typedef enum { - UV_LOOP_BLOCK_SIGNAL = 0, - UV_METRICS_IDLE_TIME, - UV_LOOP_USE_IO_URING_SQPOLL -#define UV_LOOP_USE_IO_URING_SQPOLL UV_LOOP_USE_IO_URING_SQPOLL -} uv_loop_option; - -typedef enum { - UV_RUN_DEFAULT = 0, - UV_RUN_ONCE, - UV_RUN_NOWAIT -} uv_run_mode; - - -UV_EXTERN unsigned int uv_version(void); -UV_EXTERN const char* uv_version_string(void); - -typedef void* (*uv_malloc_func)(size_t size); -typedef void* (*uv_realloc_func)(void* ptr, size_t size); -typedef void* (*uv_calloc_func)(size_t count, size_t size); -typedef void (*uv_free_func)(void* ptr); - -UV_EXTERN void uv_library_shutdown(void); - -UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, - uv_realloc_func realloc_func, - uv_calloc_func calloc_func, - uv_free_func free_func); - -UV_EXTERN uv_loop_t* uv_default_loop(void); -UV_EXTERN int uv_loop_init(uv_loop_t* loop); -UV_EXTERN int uv_loop_close(uv_loop_t* loop); -/* - * NOTE: - * This function is DEPRECATED, users should - * allocate the loop manually and use uv_loop_init instead. - */ -UV_EXTERN uv_loop_t* uv_loop_new(void); -/* - * NOTE: - * This function is DEPRECATED. Users should use - * uv_loop_close and free the memory manually instead. - */ -UV_EXTERN void uv_loop_delete(uv_loop_t*); -UV_EXTERN size_t uv_loop_size(void); -UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); -UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); -UV_EXTERN int uv_loop_fork(uv_loop_t* loop); - -UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); -UV_EXTERN void uv_stop(uv_loop_t*); - -UV_EXTERN void uv_ref(uv_handle_t*); -UV_EXTERN void uv_unref(uv_handle_t*); -UV_EXTERN int uv_has_ref(const uv_handle_t*); - -UV_EXTERN void uv_update_time(uv_loop_t*); -UV_EXTERN uint64_t uv_now(const uv_loop_t*); - -UV_EXTERN int uv_backend_fd(const uv_loop_t*); -UV_EXTERN int uv_backend_timeout(const uv_loop_t*); - -typedef void (*uv_alloc_cb)(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf); -typedef void (*uv_read_cb)(uv_stream_t* stream, - ssize_t nread, - const uv_buf_t* buf); -typedef void (*uv_write_cb)(uv_write_t* req, int status); -typedef void (*uv_connect_cb)(uv_connect_t* req, int status); -typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); -typedef void (*uv_connection_cb)(uv_stream_t* server, int status); -typedef void (*uv_close_cb)(uv_handle_t* handle); -typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); -typedef void (*uv_timer_cb)(uv_timer_t* handle); -typedef void (*uv_async_cb)(uv_async_t* handle); -typedef void (*uv_prepare_cb)(uv_prepare_t* handle); -typedef void (*uv_check_cb)(uv_check_t* handle); -typedef void (*uv_idle_cb)(uv_idle_t* handle); -typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); -typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); -typedef void (*uv_fs_cb)(uv_fs_t* req); -typedef void (*uv_work_cb)(uv_work_t* req); -typedef void (*uv_after_work_cb)(uv_work_t* req, int status); -typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, - int status, - struct addrinfo* res); -typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, - int status, - const char* hostname, - const char* service); -typedef void (*uv_random_cb)(uv_random_t* req, - int status, - void* buf, - size_t buflen); - -typedef enum { - UV_CLOCK_MONOTONIC, - UV_CLOCK_REALTIME -} uv_clock_id; - -/* XXX(bnoordhuis) not 2038-proof, https://github.com/libuv/libuv/issues/3864 */ -typedef struct { - long tv_sec; - long tv_nsec; -} uv_timespec_t; - -typedef struct { - int64_t tv_sec; - int32_t tv_nsec; -} uv_timespec64_t; - -/* XXX(bnoordhuis) not 2038-proof, https://github.com/libuv/libuv/issues/3864 */ -typedef struct { - long tv_sec; - long tv_usec; -} uv_timeval_t; - -typedef struct { - int64_t tv_sec; - int32_t tv_usec; -} uv_timeval64_t; - -typedef struct { - uint64_t st_dev; - uint64_t st_mode; - uint64_t st_nlink; - uint64_t st_uid; - uint64_t st_gid; - uint64_t st_rdev; - uint64_t st_ino; - uint64_t st_size; - uint64_t st_blksize; - uint64_t st_blocks; - uint64_t st_flags; - uint64_t st_gen; - uv_timespec_t st_atim; - uv_timespec_t st_mtim; - uv_timespec_t st_ctim; - uv_timespec_t st_birthtim; -} uv_stat_t; - - -typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, - const char* filename, - int events, - int status); - -typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, - int status, - const uv_stat_t* prev, - const uv_stat_t* curr); - -typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); - - -typedef enum { - UV_LEAVE_GROUP = 0, - UV_JOIN_GROUP -} uv_membership; - - -UV_EXTERN int uv_translate_sys_error(int sys_errno); - -UV_EXTERN const char* uv_strerror(int err); -UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen); - -UV_EXTERN const char* uv_err_name(int err); -UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen); - - -#define UV_REQ_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_req_type type; \ - /* private */ \ - void* reserved[6]; \ - UV_REQ_PRIVATE_FIELDS \ - -/* Abstract base class of all requests. */ -struct uv_req_s { - UV_REQ_FIELDS -}; - - -/* Platform-specific request types. */ -UV_PRIVATE_REQ_TYPES - - -UV_EXTERN int uv_shutdown(uv_shutdown_t* req, - uv_stream_t* handle, - uv_shutdown_cb cb); - -struct uv_shutdown_s { - UV_REQ_FIELDS - uv_stream_t* handle; - uv_shutdown_cb cb; - UV_SHUTDOWN_PRIVATE_FIELDS -}; - - -#define UV_HANDLE_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_loop_t* loop; \ - uv_handle_type type; \ - /* private */ \ - uv_close_cb close_cb; \ - struct uv__queue handle_queue; \ - union { \ - int fd; \ - void* reserved[4]; \ - } u; \ - UV_HANDLE_PRIVATE_FIELDS \ - -/* The abstract base class of all handles. */ -struct uv_handle_s { - UV_HANDLE_FIELDS -}; - -UV_EXTERN size_t uv_handle_size(uv_handle_type type); -UV_EXTERN uv_handle_type uv_handle_get_type(const uv_handle_t* handle); -UV_EXTERN const char* uv_handle_type_name(uv_handle_type type); -UV_EXTERN void* uv_handle_get_data(const uv_handle_t* handle); -UV_EXTERN uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle); -UV_EXTERN void uv_handle_set_data(uv_handle_t* handle, void* data); - -UV_EXTERN size_t uv_req_size(uv_req_type type); -UV_EXTERN void* uv_req_get_data(const uv_req_t* req); -UV_EXTERN void uv_req_set_data(uv_req_t* req, void* data); -UV_EXTERN uv_req_type uv_req_get_type(const uv_req_t* req); -UV_EXTERN const char* uv_req_type_name(uv_req_type type); - -UV_EXTERN int uv_is_active(const uv_handle_t* handle); - -UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); - -/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ -UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); -UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); - -UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); - -UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); -UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); - -UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); - -UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); - -UV_EXTERN int uv_pipe(uv_file fds[2], int read_flags, int write_flags); -UV_EXTERN int uv_socketpair(int type, - int protocol, - uv_os_sock_t socket_vector[2], - int flags0, - int flags1); - -#define UV_STREAM_FIELDS \ - /* number of bytes queued for writing */ \ - size_t write_queue_size; \ - uv_alloc_cb alloc_cb; \ - uv_read_cb read_cb; \ - /* private */ \ - UV_STREAM_PRIVATE_FIELDS - -/* - * uv_stream_t is a subclass of uv_handle_t. - * - * uv_stream is an abstract class. - * - * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. - */ -struct uv_stream_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS -}; - -UV_EXTERN size_t uv_stream_get_write_queue_size(const uv_stream_t* stream); - -UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); -UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); - -UV_EXTERN int uv_read_start(uv_stream_t*, - uv_alloc_cb alloc_cb, - uv_read_cb read_cb); -UV_EXTERN int uv_read_stop(uv_stream_t*); - -UV_EXTERN int uv_write(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_write_cb cb); -UV_EXTERN int uv_write2(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle, - uv_write_cb cb); -UV_EXTERN int uv_try_write(uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs); -UV_EXTERN int uv_try_write2(uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle); - -/* uv_write_t is a subclass of uv_req_t. */ -struct uv_write_s { - UV_REQ_FIELDS - uv_write_cb cb; - uv_stream_t* send_handle; /* TODO: make private and unix-only in v2.x. */ - uv_stream_t* handle; - UV_WRITE_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_is_readable(const uv_stream_t* handle); -UV_EXTERN int uv_is_writable(const uv_stream_t* handle); - -UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); - -UV_EXTERN int uv_is_closing(const uv_handle_t* handle); - - -/* - * uv_tcp_t is a subclass of uv_stream_t. - * - * Represents a TCP stream or TCP server. - */ -struct uv_tcp_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TCP_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); -UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); -UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); -UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, - int enable, - unsigned int delay); -UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); - -enum uv_tcp_flags { - /* Used with uv_tcp_bind, when an IPv6 address is used. */ - UV_TCP_IPV6ONLY = 1, - - /* Enable SO_REUSEPORT socket option when binding the handle. - * This allows completely duplicate bindings by multiple processes - * or threads if they all set SO_REUSEPORT before binding the port. - * Incoming connections are distributed across the participating - * listener sockets. - * - * This flag is available only on Linux 3.9+, DragonFlyBSD 3.6+, - * FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now. - */ - UV_TCP_REUSEPORT = 2, -}; - -UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, - const struct sockaddr* addr, - unsigned int flags); -UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb); -UV_EXTERN int uv_tcp_connect(uv_connect_t* req, - uv_tcp_t* handle, - const struct sockaddr* addr, - uv_connect_cb cb); - -/* uv_connect_t is a subclass of uv_req_t. */ -struct uv_connect_s { - UV_REQ_FIELDS - uv_connect_cb cb; - uv_stream_t* handle; - UV_CONNECT_PRIVATE_FIELDS -}; - - -/* - * UDP support. - */ - -enum uv_udp_flags { - /* Disables dual stack mode. */ - UV_UDP_IPV6ONLY = 1, - /* - * Indicates message was truncated because read buffer was too small. The - * remainder was discarded by the OS. Used in uv_udp_recv_cb. - */ - UV_UDP_PARTIAL = 2, - /* - * Indicates if SO_REUSEADDR will be set when binding the handle. - * This sets the SO_REUSEPORT socket flag on the BSDs (except for - * DragonFlyBSD), OS X, and other platforms where SO_REUSEPORTs don't - * have the capability of load balancing, as the opposite of what - * UV_UDP_REUSEPORT would do. On other Unix platforms, it sets the - * SO_REUSEADDR flag. What that means is that multiple threads or - * processes can bind to the same address without error (provided - * they all set the flag) but only the last one to bind will receive - * any traffic, in effect "stealing" the port from the previous listener. - */ - UV_UDP_REUSEADDR = 4, - /* - * Indicates that the message was received by recvmmsg, so the buffer provided - * must not be freed by the recv_cb callback. - */ - UV_UDP_MMSG_CHUNK = 8, - /* - * Indicates that the buffer provided has been fully utilized by recvmmsg and - * that it should now be freed by the recv_cb callback. When this flag is set - * in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL. - */ - UV_UDP_MMSG_FREE = 16, - /* - * Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle. - * This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on - * Linux. This stops the Linux kernel from suppressing some ICMP error - * messages and enables full ICMP error reporting for faster failover. - * This flag is no-op on platforms other than Linux. - */ - UV_UDP_LINUX_RECVERR = 32, - /* - * Indicates if SO_REUSEPORT will be set when binding the handle. - * This sets the SO_REUSEPORT socket option on supported platforms. - * Unlike UV_UDP_REUSEADDR, this flag will make multiple threads or - * processes that are binding to the same address and port "share" - * the port, which means incoming datagrams are distributed across - * the receiving sockets among threads or processes. - * - * This flag is available only on Linux 3.9+, DragonFlyBSD 3.6+, - * FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now. - */ - UV_UDP_REUSEPORT = 64, - /* - * Indicates that recvmmsg should be used, if available. - */ - UV_UDP_RECVMMSG = 256 -}; - -typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); -typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, - ssize_t nread, - const uv_buf_t* buf, - const struct sockaddr* addr, - unsigned flags); - -/* uv_udp_t is a subclass of uv_handle_t. */ -struct uv_udp_s { - UV_HANDLE_FIELDS - /* read-only */ - /* - * Number of bytes queued for sending. This field strictly shows how much - * information is currently queued. - */ - size_t send_queue_size; - /* - * Number of send requests currently in the queue awaiting to be processed. - */ - size_t send_queue_count; - UV_UDP_PRIVATE_FIELDS -}; - -/* uv_udp_send_t is a subclass of uv_req_t. */ -struct uv_udp_send_s { - UV_REQ_FIELDS - uv_udp_t* handle; - uv_udp_send_cb cb; - UV_UDP_SEND_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); -UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); -UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_udp_bind(uv_udp_t* handle, - const struct sockaddr* addr, - unsigned int flags); -UV_EXTERN int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr); - -UV_EXTERN int uv_udp_getpeername(const uv_udp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, - const char* multicast_addr, - const char* interface_addr, - uv_membership membership); -UV_EXTERN int uv_udp_set_source_membership(uv_udp_t* handle, - const char* multicast_addr, - const char* interface_addr, - const char* source_addr, - uv_membership membership); -UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, - const char* interface_addr); -UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_send(uv_udp_send_t* req, - uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr, - uv_udp_send_cb send_cb); -UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr); -UV_EXTERN int uv_udp_try_send2(uv_udp_t* handle, - unsigned int count, - uv_buf_t* bufs[/*count*/], - unsigned int nbufs[/*count*/], - struct sockaddr* addrs[/*count*/], - unsigned int flags); -UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, - uv_alloc_cb alloc_cb, - uv_udp_recv_cb recv_cb); -UV_EXTERN int uv_udp_using_recvmmsg(const uv_udp_t* handle); -UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); -UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle); -UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle); - - -/* - * uv_tty_t is a subclass of uv_stream_t. - * - * Representing a stream for the console. - */ -struct uv_tty_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TTY_PRIVATE_FIELDS -}; - -typedef enum { - /* Initial/normal terminal mode */ - UV_TTY_MODE_NORMAL, - /* - * Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled). - * May become equivalent to UV_TTY_MODE_RAW_VT in future libuv versions. - */ - UV_TTY_MODE_RAW, - /* Binary-safe I/O mode for IPC (Unix-only) */ - UV_TTY_MODE_IO, - /* Raw input mode. On Windows ENABLE_VIRTUAL_TERMINAL_INPUT is also set. */ - UV_TTY_MODE_RAW_VT -} uv_tty_mode_t; - -typedef enum { - /* - * The console supports handling of virtual terminal sequences - * (Windows10 new console, ConEmu) - */ - UV_TTY_SUPPORTED, - /* The console cannot process the virtual terminal sequence. (Legacy - * console) - */ - UV_TTY_UNSUPPORTED -} uv_tty_vtermstate_t; - - -UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); -UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); -UV_EXTERN int uv_tty_reset_mode(void); -UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); -UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state); -UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state); - -#ifdef __cplusplus -extern "C++" { - -inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { - return uv_tty_set_mode(handle, static_cast(mode)); -} - -} -#endif - -UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); - -enum { - UV_PIPE_NO_TRUNCATE = 1u << 0 -}; - -/* - * uv_pipe_t is a subclass of uv_stream_t. - * - * Representing a pipe stream or pipe server. On Windows this is a Named - * Pipe. On Unix this is a Unix domain socket. - */ -struct uv_pipe_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - int ipc; /* non-zero if this pipe is used for passing handles */ - UV_PIPE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc); -UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); -UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); -UV_EXTERN int uv_pipe_bind2(uv_pipe_t* handle, - const char* name, - size_t namelen, - unsigned int flags); -UV_EXTERN void uv_pipe_connect(uv_connect_t* req, - uv_pipe_t* handle, - const char* name, - uv_connect_cb cb); -UV_EXTERN int uv_pipe_connect2(uv_connect_t* req, - uv_pipe_t* handle, - const char* name, - size_t namelen, - unsigned int flags, - uv_connect_cb cb); -UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); -UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); -UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); -UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags); - - -struct uv_poll_s { - UV_HANDLE_FIELDS - uv_poll_cb poll_cb; - UV_POLL_PRIVATE_FIELDS -}; - -enum uv_poll_event { - UV_READABLE = 1, - UV_WRITABLE = 2, - UV_DISCONNECT = 4, - UV_PRIORITIZED = 8 -}; - -UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); -UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, - uv_poll_t* handle, - uv_os_sock_t socket); -UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); -UV_EXTERN int uv_poll_stop(uv_poll_t* handle); - - -struct uv_prepare_s { - UV_HANDLE_FIELDS - UV_PREPARE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); -UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); -UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); - - -struct uv_check_s { - UV_HANDLE_FIELDS - UV_CHECK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); -UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); -UV_EXTERN int uv_check_stop(uv_check_t* check); - - -struct uv_idle_s { - UV_HANDLE_FIELDS - UV_IDLE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); -UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); -UV_EXTERN int uv_idle_stop(uv_idle_t* idle); - - -struct uv_async_s { - UV_HANDLE_FIELDS - UV_ASYNC_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_async_init(uv_loop_t*, - uv_async_t* async, - uv_async_cb async_cb); -UV_EXTERN int uv_async_send(uv_async_t* async); - - -/* - * uv_timer_t is a subclass of uv_handle_t. - * - * Used to get woken up at a specified time in the future. - */ -struct uv_timer_s { - UV_HANDLE_FIELDS - UV_TIMER_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); -UV_EXTERN int uv_timer_start(uv_timer_t* handle, - uv_timer_cb cb, - uint64_t timeout, - uint64_t repeat); -UV_EXTERN int uv_timer_stop(uv_timer_t* handle); -UV_EXTERN int uv_timer_again(uv_timer_t* handle); -UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); -UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); -UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle); - - -/* - * uv_getaddrinfo_t is a subclass of uv_req_t. - * - * Request object for uv_getaddrinfo. - */ -struct uv_getaddrinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ - UV_GETADDRINFO_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, - uv_getaddrinfo_t* req, - uv_getaddrinfo_cb getaddrinfo_cb, - const char* node, - const char* service, - const struct addrinfo* hints); -UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); - - -/* -* uv_getnameinfo_t is a subclass of uv_req_t. -* -* Request object for uv_getnameinfo. -*/ -struct uv_getnameinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* host and service are marked as private, but they really aren't. */ - UV_GETNAMEINFO_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, - uv_getnameinfo_t* req, - uv_getnameinfo_cb getnameinfo_cb, - const struct sockaddr* addr, - int flags); - - -/* uv_spawn() options. */ -typedef enum { - UV_IGNORE = 0x00, - UV_CREATE_PIPE = 0x01, - UV_INHERIT_FD = 0x02, - UV_INHERIT_STREAM = 0x04, - - /* - * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE - * determine the direction of flow, from the child process' perspective. Both - * flags may be specified to create a duplex data stream. - */ - UV_READABLE_PIPE = 0x10, - UV_WRITABLE_PIPE = 0x20, - - /* - * When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the - * handle in non-blocking mode in the child. This may cause loss of data, - * if the child is not designed to handle to encounter this mode, - * but can also be significantly more efficient. - */ - UV_NONBLOCK_PIPE = 0x40, - UV_OVERLAPPED_PIPE = 0x40 /* old name, for compatibility */ -} uv_stdio_flags; - -typedef struct uv_stdio_container_s { - uv_stdio_flags flags; - - union { - uv_stream_t* stream; - int fd; - } data; -} uv_stdio_container_t; - -typedef struct uv_process_options_s { - uv_exit_cb exit_cb; /* Called after the process exits. */ - const char* file; /* Path to program to execute. */ - /* - * Command line arguments. args[0] should be the path to the program. On - * Windows this uses CreateProcess which concatenates the arguments into a - * string this can cause some strange errors. See the note at - * windows_verbatim_arguments. - */ - char** args; - /* - * This will be set as the environ variable in the subprocess. If this is - * NULL then the parents environ will be used. - */ - char** env; - /* - * If non-null this represents a directory the subprocess should execute - * in. Stands for current working directory. - */ - const char* cwd; - /* - * Various flags that control how uv_spawn() behaves. See the definition of - * `enum uv_process_flags` below. - */ - unsigned int flags; - /* - * The `stdio` field points to an array of uv_stdio_container_t structs that - * describe the file descriptors that will be made available to the child - * process. The convention is that stdio[0] points to stdin, fd 1 is used for - * stdout, and fd 2 is stderr. - * - * Note that on windows file descriptors greater than 2 are available to the - * child process only if the child processes uses the MSVCRT runtime. - */ - int stdio_count; - uv_stdio_container_t* stdio; - /* - * Libuv can change the child process' user/group id. This happens only when - * the appropriate bits are set in the flags fields. This is not supported on - * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. - */ - uv_uid_t uid; - uv_gid_t gid; -} uv_process_options_t; - -/* - * These are the flags that can be used for the uv_process_options.flags field. - */ -enum uv_process_flags { - /* - * Set the child process' user id. The user id is supplied in the `uid` field - * of the options struct. This does not work on windows; setting this flag - * will cause uv_spawn() to fail. - */ - UV_PROCESS_SETUID = (1 << 0), - /* - * Set the child process' group id. The user id is supplied in the `gid` - * field of the options struct. This does not work on windows; setting this - * flag will cause uv_spawn() to fail. - */ - UV_PROCESS_SETGID = (1 << 1), - /* - * Do not wrap any arguments in quotes, or perform any other escaping, when - * converting the argument list into a command line string. This option is - * only meaningful on Windows systems. On Unix it is silently ignored. - */ - UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), - /* - * Spawn the child process in a detached state - this will make it a process - * group leader, and will effectively enable the child to keep running after - * the parent exits. Note that the child process will still keep the - * parent's event loop alive unless the parent process calls uv_unref() on - * the child's process handle. - */ - UV_PROCESS_DETACHED = (1 << 3), - /* - * Hide the subprocess window that would normally be created. This option is - * only meaningful on Windows systems. On Unix it is silently ignored. - */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4), - /* - * Hide the subprocess console window that would normally be created. This - * option is only meaningful on Windows systems. On Unix it is silently - * ignored. - */ - UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), - /* - * Hide the subprocess GUI window that would normally be created. This - * option is only meaningful on Windows systems. On Unix it is silently - * ignored. - */ - UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6), - /* - * On Windows, if the path to the program to execute, specified in - * uv_process_options_t's file field, has a directory component, - * search for the exact file name before trying variants with - * extensions like '.exe' or '.cmd'. - */ - UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME = (1 << 7) -}; - -/* - * uv_process_t is a subclass of uv_handle_t. - */ -struct uv_process_s { - UV_HANDLE_FIELDS - uv_exit_cb exit_cb; - int pid; - UV_PROCESS_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_spawn(uv_loop_t* loop, - uv_process_t* handle, - const uv_process_options_t* options); -UV_EXTERN int uv_process_kill(uv_process_t*, int signum); -UV_EXTERN int uv_kill(int pid, int signum); -UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*); - - -/* - * uv_work_t is a subclass of uv_req_t. - */ -struct uv_work_s { - UV_REQ_FIELDS - uv_loop_t* loop; - uv_work_cb work_cb; - uv_after_work_cb after_work_cb; - UV_WORK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_queue_work(uv_loop_t* loop, - uv_work_t* req, - uv_work_cb work_cb, - uv_after_work_cb after_work_cb); - -UV_EXTERN int uv_cancel(uv_req_t* req); - - -struct uv_cpu_times_s { - uint64_t user; /* milliseconds */ - uint64_t nice; /* milliseconds */ - uint64_t sys; /* milliseconds */ - uint64_t idle; /* milliseconds */ - uint64_t irq; /* milliseconds */ -}; - -struct uv_cpu_info_s { - char* model; - int speed; - struct uv_cpu_times_s cpu_times; -}; - -struct uv_interface_address_s { - char* name; - char phys_addr[6]; - int is_internal; - union { - struct sockaddr_in address4; - struct sockaddr_in6 address6; - } address; - union { - struct sockaddr_in netmask4; - struct sockaddr_in6 netmask6; - } netmask; -}; - -struct uv_passwd_s { - char* username; - unsigned long uid; - unsigned long gid; - char* shell; - char* homedir; -}; - -struct uv_group_s { - char* groupname; - unsigned long gid; - char** members; -}; - -struct uv_utsname_s { - char sysname[256]; - char release[256]; - char version[256]; - char machine[256]; - /* This struct does not contain the nodename and domainname fields present in - the utsname type. domainname is a GNU extension. Both fields are referred - to as meaningless in the docs. */ -}; - -struct uv_statfs_s { - uint64_t f_type; - uint64_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_spare[4]; -}; - -typedef enum { - UV_DIRENT_UNKNOWN, - UV_DIRENT_FILE, - UV_DIRENT_DIR, - UV_DIRENT_LINK, - UV_DIRENT_FIFO, - UV_DIRENT_SOCKET, - UV_DIRENT_CHAR, - UV_DIRENT_BLOCK -} uv_dirent_type_t; - -struct uv_dirent_s { - const char* name; - uv_dirent_type_t type; -}; - -UV_EXTERN char** uv_setup_args(int argc, char** argv); -UV_EXTERN int uv_get_process_title(char* buffer, size_t size); -UV_EXTERN int uv_set_process_title(const char* title); -UV_EXTERN int uv_resident_set_memory(size_t* rss); -UV_EXTERN int uv_uptime(double* uptime); -UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); -UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); - -typedef struct { - uv_timeval_t ru_utime; /* user CPU time used */ - uv_timeval_t ru_stime; /* system CPU time used */ - uint64_t ru_maxrss; /* maximum resident set size */ - uint64_t ru_ixrss; /* integral shared memory size */ - uint64_t ru_idrss; /* integral unshared data size */ - uint64_t ru_isrss; /* integral unshared stack size */ - uint64_t ru_minflt; /* page reclaims (soft page faults) */ - uint64_t ru_majflt; /* page faults (hard page faults) */ - uint64_t ru_nswap; /* swaps */ - uint64_t ru_inblock; /* block input operations */ - uint64_t ru_oublock; /* block output operations */ - uint64_t ru_msgsnd; /* IPC messages sent */ - uint64_t ru_msgrcv; /* IPC messages received */ - uint64_t ru_nsignals; /* signals received */ - uint64_t ru_nvcsw; /* voluntary context switches */ - uint64_t ru_nivcsw; /* involuntary context switches */ -} uv_rusage_t; - -UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); -UV_EXTERN int uv_getrusage_thread(uv_rusage_t* rusage); - -UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); -UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); -UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); -UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); -UV_EXTERN int uv_os_get_passwd2(uv_passwd_t* pwd, uv_uid_t uid); -UV_EXTERN int uv_os_get_group(uv_group_t* grp, uv_uid_t gid); -UV_EXTERN void uv_os_free_group(uv_group_t* grp); -UV_EXTERN uv_pid_t uv_os_getpid(void); -UV_EXTERN uv_pid_t uv_os_getppid(void); - -#if defined(__PASE__) -/* On IBM i PASE, the highest process priority is -10 */ -# define UV_PRIORITY_LOW 39 /* RUNPTY(99) */ -# define UV_PRIORITY_BELOW_NORMAL 15 /* RUNPTY(50) */ -# define UV_PRIORITY_NORMAL 0 /* RUNPTY(20) */ -# define UV_PRIORITY_ABOVE_NORMAL -4 /* RUNTY(12) */ -# define UV_PRIORITY_HIGH -7 /* RUNPTY(6) */ -# define UV_PRIORITY_HIGHEST -10 /* RUNPTY(1) */ -#else -# define UV_PRIORITY_LOW 19 -# define UV_PRIORITY_BELOW_NORMAL 10 -# define UV_PRIORITY_NORMAL 0 -# define UV_PRIORITY_ABOVE_NORMAL -7 -# define UV_PRIORITY_HIGH -14 -# define UV_PRIORITY_HIGHEST -20 -#endif - -UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); -UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); - -enum { - UV_THREAD_PRIORITY_HIGHEST = 2, - UV_THREAD_PRIORITY_ABOVE_NORMAL = 1, - UV_THREAD_PRIORITY_NORMAL = 0, - UV_THREAD_PRIORITY_BELOW_NORMAL = -1, - UV_THREAD_PRIORITY_LOWEST = -2, -}; - -UV_EXTERN int uv_thread_getpriority(uv_thread_t tid, int* priority); -UV_EXTERN int uv_thread_setpriority(uv_thread_t tid, int priority); - -UV_EXTERN unsigned int uv_available_parallelism(void); -UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); -UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); -UV_EXTERN int uv_cpumask_size(void); - -UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, - int* count); -UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, - int count); - -struct uv_env_item_s { - char* name; - char* value; -}; - -UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count); -UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count); -UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size); -UV_EXTERN int uv_os_setenv(const char* name, const char* value); -UV_EXTERN int uv_os_unsetenv(const char* name); - -#ifdef MAXHOSTNAMELEN -# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1) -#else - /* - Fallback for the maximum hostname size, including the null terminator. The - Windows gethostname() documentation states that 256 bytes will always be - large enough to hold the null-terminated hostname. - */ -# define UV_MAXHOSTNAMESIZE 256 -#endif - -UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); - -UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); - -struct uv_metrics_s { - uint64_t loop_count; - uint64_t events; - uint64_t events_waiting; - /* private */ - uint64_t* reserved[13]; -}; - -UV_EXTERN int uv_metrics_info(uv_loop_t* loop, uv_metrics_t* metrics); -UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop); - -typedef enum { - UV_FS_UNKNOWN = -1, - UV_FS_CUSTOM, - UV_FS_OPEN, - UV_FS_CLOSE, - UV_FS_READ, - UV_FS_WRITE, - UV_FS_SENDFILE, - UV_FS_STAT, - UV_FS_LSTAT, - UV_FS_FSTAT, - UV_FS_FTRUNCATE, - UV_FS_UTIME, - UV_FS_FUTIME, - UV_FS_ACCESS, - UV_FS_CHMOD, - UV_FS_FCHMOD, - UV_FS_FSYNC, - UV_FS_FDATASYNC, - UV_FS_UNLINK, - UV_FS_RMDIR, - UV_FS_MKDIR, - UV_FS_MKDTEMP, - UV_FS_RENAME, - UV_FS_SCANDIR, - UV_FS_LINK, - UV_FS_SYMLINK, - UV_FS_READLINK, - UV_FS_CHOWN, - UV_FS_FCHOWN, - UV_FS_REALPATH, - UV_FS_COPYFILE, - UV_FS_LCHOWN, - UV_FS_OPENDIR, - UV_FS_READDIR, - UV_FS_CLOSEDIR, - UV_FS_STATFS, - UV_FS_MKSTEMP, - UV_FS_LUTIME -} uv_fs_type; - -struct uv_dir_s { - uv_dirent_t* dirents; - size_t nentries; - void* reserved[4]; - UV_DIR_PRIVATE_FIELDS -}; - -/* uv_fs_t is a subclass of uv_req_t. */ -struct uv_fs_s { - UV_REQ_FIELDS - uv_fs_type fs_type; - uv_loop_t* loop; - uv_fs_cb cb; - ssize_t result; - void* ptr; - const char* path; - uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ - UV_FS_PRIVATE_FIELDS -}; - -UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*); -UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*); -UV_EXTERN int uv_fs_get_system_error(const uv_fs_t*); -UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*); -UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*); -UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*); - -UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); -UV_EXTERN int uv_fs_close(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_open(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_read(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_write(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -/* - * This flag can be used with uv_fs_copyfile() to return an error if the - * destination already exists. - */ -#define UV_FS_COPYFILE_EXCL 0x0001 - -/* - * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. - * If copy-on-write is not supported, a fallback copy mechanism is used. - */ -#define UV_FS_COPYFILE_FICLONE 0x0002 - -/* - * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. - * If copy-on-write is not supported, an error is returned. - */ -#define UV_FS_COPYFILE_FICLONE_FORCE 0x0004 - -UV_EXTERN int uv_fs_copyfile(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, - uv_fs_t* req, - const char* tpl, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop, - uv_fs_t* req, - const char* tpl, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, - uv_dirent_t* ent); -UV_EXTERN int uv_fs_opendir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_readdir(uv_loop_t* loop, - uv_fs_t* req, - uv_dir_t* dir, - uv_fs_cb cb); -UV_EXTERN int uv_fs_closedir(uv_loop_t* loop, - uv_fs_t* req, - uv_dir_t* dir, - uv_fs_cb cb); -UV_EXTERN int uv_fs_stat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rename(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, - uv_fs_t* req, - uv_file out_fd, - uv_file in_fd, - int64_t in_offset, - size_t length, - uv_fs_cb cb); -UV_EXTERN int uv_fs_access(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -#define UV_FS_UTIME_NOW (INFINITY) -#define UV_FS_UTIME_OMIT (NAN) -UV_EXTERN int uv_fs_utime(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_futime(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lutime(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_link(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * path argument points to a directory. - */ -#define UV_FS_SYMLINK_DIR 0x0001 - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * the symlink is to be created using junction points. - */ -#define UV_FS_SYMLINK_JUNCTION 0x0002 - -UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chown(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lchown(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_statfs(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); - - -enum uv_fs_event { - UV_RENAME = 1, - UV_CHANGE = 2 -}; - - -struct uv_fs_event_s { - UV_HANDLE_FIELDS - /* private */ - char* path; - UV_FS_EVENT_PRIVATE_FIELDS -}; - - -/* - * uv_fs_stat() based polling file watcher. - */ -struct uv_fs_poll_s { - UV_HANDLE_FIELDS - /* Private, don't touch. */ - void* poll_ctx; -}; - -UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, - uv_fs_poll_cb poll_cb, - const char* path, - unsigned int interval); -UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, - char* buffer, - size_t* size); - - -struct uv_signal_s { - UV_HANDLE_FIELDS - uv_signal_cb signal_cb; - int signum; - UV_SIGNAL_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); -UV_EXTERN int uv_signal_start(uv_signal_t* handle, - uv_signal_cb signal_cb, - int signum); -UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle, - uv_signal_cb signal_cb, - int signum); -UV_EXTERN int uv_signal_stop(uv_signal_t* handle); - -UV_EXTERN void uv_loadavg(double avg[3]); - - -/* - * Flags to be passed to uv_fs_event_start(). - */ -enum uv_fs_event_flags { - /* - * By default, if the fs event watcher is given a directory name, we will - * watch for all events in that directory. This flags overrides this behavior - * and makes fs_event report only changes to the directory entry itself. This - * flag does not affect individual files watched. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_WATCH_ENTRY = 1, - - /* - * By default uv_fs_event will try to use a kernel interface such as inotify - * or kqueue to detect events. This may not work on remote filesystems such - * as NFS mounts. This flag makes fs_event fall back to calling stat() on a - * regular interval. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_STAT = 2, - - /* - * By default, event watcher, when watching directory, is not registering - * (is ignoring) changes in it's subdirectories. - * This flag will override this behaviour on platforms that support it. - */ - UV_FS_EVENT_RECURSIVE = 4 -}; - - -UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, - uv_fs_event_cb cb, - const char* path, - unsigned int flags); -UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, - char* buffer, - size_t* size); - -UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); -UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); - -UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); -UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); -UV_EXTERN int uv_ip_name(const struct sockaddr* src, char* dst, size_t size); - -UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); -UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); - - -struct uv_random_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* private */ - int status; - void* buf; - size_t buflen; - uv_random_cb cb; - struct uv__work work_req; -}; - -UV_EXTERN int uv_random(uv_loop_t* loop, - uv_random_t* req, - void *buf, - size_t buflen, - unsigned flags, /* For future extension; must be 0. */ - uv_random_cb cb); - -#if defined(IF_NAMESIZE) -# define UV_IF_NAMESIZE (IF_NAMESIZE + 1) -#elif defined(IFNAMSIZ) -# define UV_IF_NAMESIZE (IFNAMSIZ + 1) -#else -# define UV_IF_NAMESIZE (16 + 1) -#endif - -UV_EXTERN int uv_if_indextoname(unsigned int ifindex, - char* buffer, - size_t* size); -UV_EXTERN int uv_if_indextoiid(unsigned int ifindex, - char* buffer, - size_t* size); - -UV_EXTERN int uv_exepath(char* buffer, size_t* size); - -UV_EXTERN int uv_cwd(char* buffer, size_t* size); - -UV_EXTERN int uv_chdir(const char* dir); - -UV_EXTERN uint64_t uv_get_free_memory(void); -UV_EXTERN uint64_t uv_get_total_memory(void); -UV_EXTERN uint64_t uv_get_constrained_memory(void); -UV_EXTERN uint64_t uv_get_available_memory(void); - -UV_EXTERN int uv_clock_gettime(uv_clock_id clock_id, uv_timespec64_t* ts); -UV_EXTERN uint64_t uv_hrtime(void); -UV_EXTERN void uv_sleep(unsigned int msec); - -UV_EXTERN void uv_disable_stdio_inheritance(void); - -UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); -UV_EXTERN void uv_dlclose(uv_lib_t* lib); -UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); -UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); - -UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); -UV_EXTERN int uv_mutex_init_recursive(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); -UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); - -UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); - -UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); -UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); -UV_EXTERN void uv_sem_post(uv_sem_t* sem); -UV_EXTERN void uv_sem_wait(uv_sem_t* sem); -UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); - -UV_EXTERN int uv_cond_init(uv_cond_t* cond); -UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); -UV_EXTERN void uv_cond_signal(uv_cond_t* cond); -UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); - -UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); -UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); -UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); - -UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); -UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, - uint64_t timeout); - -UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); - -UV_EXTERN int uv_key_create(uv_key_t* key); -UV_EXTERN void uv_key_delete(uv_key_t* key); -UV_EXTERN void* uv_key_get(uv_key_t* key); -UV_EXTERN void uv_key_set(uv_key_t* key, void* value); - -UV_EXTERN int uv_gettimeofday(uv_timeval64_t* tv); - -typedef void (*uv_thread_cb)(void* arg); - -UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); -UV_EXTERN int uv_thread_detach(uv_thread_t* tid); - -typedef enum { - UV_THREAD_NO_FLAGS = 0x00, - UV_THREAD_HAS_STACK_SIZE = 0x01 -} uv_thread_create_flags; - -struct uv_thread_options_s { - unsigned int flags; - size_t stack_size; - /* More fields may be added at any time. */ -}; - -typedef struct uv_thread_options_s uv_thread_options_t; - -UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid, - const uv_thread_options_t* params, - uv_thread_cb entry, - void* arg); -UV_EXTERN int uv_thread_setaffinity(uv_thread_t* tid, - char* cpumask, - char* oldmask, - size_t mask_size); -UV_EXTERN int uv_thread_getaffinity(uv_thread_t* tid, - char* cpumask, - size_t mask_size); -UV_EXTERN int uv_thread_getcpu(void); -UV_EXTERN uv_thread_t uv_thread_self(void); -UV_EXTERN int uv_thread_join(uv_thread_t *tid); -UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); -UV_EXTERN int uv_thread_setname(const char* name); -UV_EXTERN int uv_thread_getname(uv_thread_t* tid, char* name, size_t size); - - -/* The presence of these unions force similar struct layout. */ -#define XX(_, name) uv_ ## name ## _t name; -union uv_any_handle { - UV_HANDLE_TYPE_MAP(XX) -}; - -union uv_any_req { - UV_REQ_TYPE_MAP(XX) -}; -#undef XX - - -struct uv_loop_s { - /* User data - use this for whatever. */ - void* data; - /* Loop reference counting. */ - unsigned int active_handles; - struct uv__queue handle_queue; - union { - void* unused; - unsigned int count; - } active_reqs; - /* Internal storage for future extensions. */ - void* internal_fields; - /* Internal flag to signal loop stop. */ - unsigned int stop_flag; - UV_LOOP_PRIVATE_FIELDS -}; - -UV_EXTERN void* uv_loop_get_data(const uv_loop_t*); -UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data); - -/* Unicode utilities needed for dealing with Windows. */ -UV_EXTERN size_t uv_utf16_length_as_wtf8(const uint16_t* utf16, - ssize_t utf16_len); -UV_EXTERN int uv_utf16_to_wtf8(const uint16_t* utf16, - ssize_t utf16_len, - char** wtf8_ptr, - size_t* wtf8_len_ptr); -UV_EXTERN ssize_t uv_wtf8_length_as_utf16(const char* wtf8); -UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8, - uint16_t* utf16, - size_t utf16_len); - -/* Don't export the private CPP symbols. */ -#undef UV_HANDLE_TYPE_PRIVATE -#undef UV_REQ_TYPE_PRIVATE -#undef UV_REQ_PRIVATE_FIELDS -#undef UV_STREAM_PRIVATE_FIELDS -#undef UV_TCP_PRIVATE_FIELDS -#undef UV_PREPARE_PRIVATE_FIELDS -#undef UV_CHECK_PRIVATE_FIELDS -#undef UV_IDLE_PRIVATE_FIELDS -#undef UV_ASYNC_PRIVATE_FIELDS -#undef UV_TIMER_PRIVATE_FIELDS -#undef UV_GETADDRINFO_PRIVATE_FIELDS -#undef UV_GETNAMEINFO_PRIVATE_FIELDS -#undef UV_FS_REQ_PRIVATE_FIELDS -#undef UV_WORK_PRIVATE_FIELDS -#undef UV_FS_EVENT_PRIVATE_FIELDS -#undef UV_SIGNAL_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS -#undef UV__ERR - -#ifdef __cplusplus -} -#endif -#endif /* UV_H */ diff --git a/src/bun.js/bindings/libuv/uv/darwin.h b/src/bun.js/bindings/libuv/uv/darwin.h deleted file mode 100644 index 06962bfda801..000000000000 --- a/src/bun.js/bindings/libuv/uv/darwin.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_DARWIN_H -#define UV_DARWIN_H - -#if defined(__APPLE__) && defined(__MACH__) -# include -# include -# include -# include -# define UV_PLATFORM_SEM_T semaphore_t -#endif - -#define UV_IO_PRIVATE_PLATFORM_FIELDS \ - int rcount; \ - int wcount; \ - -#define UV_PLATFORM_LOOP_FIELDS \ - uv_thread_t cf_thread; \ - void* _cf_reserved; \ - void* cf_state; \ - uv_mutex_t cf_mutex; \ - uv_sem_t cf_sem; \ - struct uv__queue cf_signals; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ - char* realpath; \ - int realpath_len; \ - int cf_flags; \ - uv_async_t* cf_cb; \ - struct uv__queue cf_events; \ - struct uv__queue cf_member; \ - int cf_error; \ - uv_mutex_t cf_mutex; \ - -#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ - void* select; \ - -#define UV_HAVE_KQUEUE 1 - -#endif /* UV_DARWIN_H */ diff --git a/src/bun.js/bindings/libuv/uv/tree.h b/src/bun.js/bindings/libuv/uv/tree.h deleted file mode 100644 index 06bba084f386..000000000000 --- a/src/bun.js/bindings/libuv/uv/tree.h +++ /dev/null @@ -1,521 +0,0 @@ -/*- - * Copyright 2002 Niels Provos - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef UV_TREE_H_ -#define UV_TREE_H_ - -#ifndef UV__UNUSED -# if __GNUC__ -# define UV__UNUSED __attribute__((unused)) -# else -# define UV__UNUSED -# endif -#endif - -/* - * This file defines data structures for red-black trees. - * A red-black tree is a binary search tree with the node color as an - * extra attribute. It fulfills a set of conditions: - * - every search path from the root to a leaf consists of the - * same number of black nodes, - * - each red node (except for the root) has a black parent, - * - each leaf node is black. - * - * Every operation on a red-black tree is bounded as O(lg n). - * The maximum height of a red-black tree is 2lg (n+1). - */ - -/* Macros that define a red-black tree */ -#define RB_HEAD(name, type) \ -struct name { \ - struct type *rbh_root; /* root of the tree */ \ -} - -#define RB_INITIALIZER(root) \ - { NULL } - -#define RB_INIT(root) do { \ - (root)->rbh_root = NULL; \ -} while (/*CONSTCOND*/ 0) - -#define RB_BLACK 0 -#define RB_RED 1 -#define RB_ENTRY(type) \ -struct { \ - struct type *rbe_left; /* left element */ \ - struct type *rbe_right; /* right element */ \ - struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ -} - -#define RB_LEFT(elm, field) (elm)->field.rbe_left -#define RB_RIGHT(elm, field) (elm)->field.rbe_right -#define RB_PARENT(elm, field) (elm)->field.rbe_parent -#define RB_COLOR(elm, field) (elm)->field.rbe_color -#define RB_ROOT(head) (head)->rbh_root -#define RB_EMPTY(head) (RB_ROOT(head) == NULL) - -#define RB_SET(elm, parent, field) do { \ - RB_PARENT(elm, field) = parent; \ - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ - RB_COLOR(elm, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - -#define RB_SET_BLACKRED(black, red, field) do { \ - RB_COLOR(black, field) = RB_BLACK; \ - RB_COLOR(red, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - -#ifndef RB_AUGMENT -#define RB_AUGMENT(x) do {} while (0) -#endif - -#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ - (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ - RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_LEFT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (/*CONSTCOND*/ 0) - -#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ - (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ - RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_RIGHT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (/*CONSTCOND*/ 0) - -/* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) -#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static) -#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ -attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ -attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ -attr struct type *name##_RB_REMOVE(struct name *, struct type *); \ -attr struct type *name##_RB_INSERT(struct name *, struct type *); \ -attr struct type *name##_RB_FIND(struct name *, struct type *); \ -attr struct type *name##_RB_NFIND(struct name *, struct type *); \ -attr struct type *name##_RB_NEXT(struct type *); \ -attr struct type *name##_RB_PREV(struct type *); \ -attr struct type *name##_RB_MINMAX(struct name *, int); \ - \ - -/* Main rb operation. - * Moves node close to the key of elm to top - */ -#define RB_GENERATE(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp,) -#define RB_GENERATE_STATIC(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static) -#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ -attr void \ -name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ -{ \ - struct type *parent, *gparent, *tmp; \ - while ((parent = RB_PARENT(elm, field)) != NULL && \ - RB_COLOR(parent, field) == RB_RED) { \ - gparent = RB_PARENT(parent, field); \ - if (parent == RB_LEFT(gparent, field)) { \ - tmp = RB_RIGHT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field); \ - elm = gparent; \ - continue; \ - } \ - if (RB_RIGHT(parent, field) == elm) { \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_RIGHT(head, gparent, tmp, field); \ - } else { \ - tmp = RB_LEFT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field); \ - elm = gparent; \ - continue; \ - } \ - if (RB_LEFT(parent, field) == elm) { \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_LEFT(head, gparent, tmp, field); \ - } \ - } \ - RB_COLOR(head->rbh_root, field) = RB_BLACK; \ -} \ - \ -attr void \ -name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, \ - struct type *elm) \ -{ \ - struct type *tmp; \ - while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \ - elm != RB_ROOT(head)) { \ - if (RB_LEFT(parent, field) == elm) { \ - tmp = RB_RIGHT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - tmp = RB_RIGHT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \ - struct type *oleft; \ - if ((oleft = RB_LEFT(tmp, field)) \ - != NULL) \ - RB_COLOR(oleft, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_RIGHT(head, tmp, oleft, field); \ - tmp = RB_RIGHT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_RIGHT(tmp, field)) \ - RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ - break; \ - } \ - } else { \ - tmp = RB_LEFT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - tmp = RB_LEFT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \ - struct type *oright; \ - if ((oright = RB_RIGHT(tmp, field)) \ - != NULL) \ - RB_COLOR(oright, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_LEFT(head, tmp, oright, field); \ - tmp = RB_LEFT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_LEFT(tmp, field)) \ - RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ - break; \ - } \ - } \ - } \ - if (elm) \ - RB_COLOR(elm, field) = RB_BLACK; \ -} \ - \ -attr struct type * \ -name##_RB_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *child, *parent, *old = elm; \ - int color; \ - if (RB_LEFT(elm, field) == NULL) \ - child = RB_RIGHT(elm, field); \ - else if (RB_RIGHT(elm, field) == NULL) \ - child = RB_LEFT(elm, field); \ - else { \ - struct type *left; \ - elm = RB_RIGHT(elm, field); \ - while ((left = RB_LEFT(elm, field)) != NULL) \ - elm = left; \ - child = RB_RIGHT(elm, field); \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ - if (RB_PARENT(elm, field) == old) \ - parent = elm; \ - (elm)->field = (old)->field; \ - if (RB_PARENT(old, field)) { \ - if (RB_LEFT(RB_PARENT(old, field), field) == old) \ - RB_LEFT(RB_PARENT(old, field), field) = elm; \ - else \ - RB_RIGHT(RB_PARENT(old, field), field) = elm; \ - RB_AUGMENT(RB_PARENT(old, field)); \ - } else \ - RB_ROOT(head) = elm; \ - RB_PARENT(RB_LEFT(old, field), field) = elm; \ - if (RB_RIGHT(old, field)) \ - RB_PARENT(RB_RIGHT(old, field), field) = elm; \ - if (parent) { \ - left = parent; \ - do { \ - RB_AUGMENT(left); \ - } while ((left = RB_PARENT(left, field)) != NULL); \ - } \ - goto color; \ - } \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ -color: \ - if (color == RB_BLACK) \ - name##_RB_REMOVE_COLOR(head, parent, child); \ - return (old); \ -} \ - \ -/* Inserts a node into the RB tree */ \ -attr struct type * \ -name##_RB_INSERT(struct name *head, struct type *elm) \ -{ \ - struct type *tmp; \ - struct type *parent = NULL; \ - int comp = 0; \ - tmp = RB_ROOT(head); \ - while (tmp) { \ - parent = tmp; \ - comp = (cmp)(elm, parent); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - RB_SET(elm, parent, field); \ - if (parent != NULL) { \ - if (comp < 0) \ - RB_LEFT(parent, field) = elm; \ - else \ - RB_RIGHT(parent, field) = elm; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = elm; \ - name##_RB_INSERT_COLOR(head, elm); \ - return (NULL); \ -} \ - \ -/* Finds the node with the same key as elm */ \ -attr struct type * \ -name##_RB_FIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - int comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (NULL); \ -} \ - \ -/* Finds the first node greater than or equal to the search key */ \ -attr struct type * \ -name##_RB_NFIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *res = NULL; \ - int comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) { \ - res = tmp; \ - tmp = RB_LEFT(tmp, field); \ - } \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (res); \ -} \ - \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_NEXT(struct type *elm) \ -{ \ - if (RB_RIGHT(elm, field)) { \ - elm = RB_RIGHT(elm, field); \ - while (RB_LEFT(elm, field)) \ - elm = RB_LEFT(elm, field); \ - } else { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - } \ - return (elm); \ -} \ - \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_PREV(struct type *elm) \ -{ \ - if (RB_LEFT(elm, field)) { \ - elm = RB_LEFT(elm, field); \ - while (RB_RIGHT(elm, field)) \ - elm = RB_RIGHT(elm, field); \ - } else { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - } \ - return (elm); \ -} \ - \ -attr struct type * \ -name##_RB_MINMAX(struct name *head, int val) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *parent = NULL; \ - while (tmp) { \ - parent = tmp; \ - if (val < 0) \ - tmp = RB_LEFT(tmp, field); \ - else \ - tmp = RB_RIGHT(tmp, field); \ - } \ - return (parent); \ -} - -#define RB_NEGINF -1 -#define RB_INF 1 - -#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) -#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) -#define RB_FIND(name, x, y) name##_RB_FIND(x, y) -#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) -#define RB_NEXT(name, x) name##_RB_NEXT(x) -#define RB_PREV(name, x) name##_RB_PREV(x) -#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) -#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) - -#define RB_FOREACH(x, name, head) \ - for ((x) = RB_MIN(name, head); \ - (x) != NULL; \ - (x) = name##_RB_NEXT(x)) - -#define RB_FOREACH_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_SAFE(x, name, head, y) \ - for ((x) = RB_MIN(name, head); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_REVERSE(x, name, head) \ - for ((x) = RB_MAX(name, head); \ - (x) != NULL; \ - (x) = name##_RB_PREV(x)) - -#define RB_FOREACH_REVERSE_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ - for ((x) = RB_MAX(name, head); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) - -#endif /* UV_TREE_H_ */ diff --git a/src/bun.js/bindings/libuv/uv/unix.h b/src/bun.js/bindings/libuv/uv/unix.h deleted file mode 100644 index 7c972026f688..000000000000 --- a/src/bun.js/bindings/libuv/uv/unix.h +++ /dev/null @@ -1,512 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_UNIX_H -#define UV_UNIX_H - -#include -#include -#include -#include - -#include -#include -#include -#include -#include /* MAXHOSTNAMELEN on Solaris */ - -#include -#include - -#if !defined(__MVS__) -#include -#include /* MAXHOSTNAMELEN on Linux and the BSDs */ -#endif -#include -#include - -#include "uv/threadpool.h" - -#if defined(__linux__) -# include "uv/linux.h" -#elif defined (__MVS__) -# include "uv/os390.h" -#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */ -# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */ -#elif defined(_AIX) -# include "uv/aix.h" -#elif defined(__sun) -# include "uv/sunos.h" -#elif defined(__APPLE__) -# include "uv/darwin.h" -#elif defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__OpenBSD__) || \ - defined(__NetBSD__) -# include "uv/bsd.h" -#elif defined(__CYGWIN__) || \ - defined(__MSYS__) || \ - defined(__HAIKU__) || \ - defined(__QNX__) || \ - defined(__GNU__) -# include "uv/posix.h" -#endif - -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif - -#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS -# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -struct uv__io_s; -struct uv_loop_s; - -typedef void (*uv__io_cb)(struct uv_loop_s* loop, - struct uv__io_s* w, - unsigned int events); -typedef struct uv__io_s uv__io_t; - -struct uv__io_s { - uv__io_cb cb; - struct uv__queue pending_queue; - struct uv__queue watcher_queue; - unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ - unsigned int events; /* Current event mask. */ - int fd; - UV_IO_PRIVATE_PLATFORM_FIELDS -}; - -#ifndef UV_PLATFORM_SEM_T -# define UV_PLATFORM_SEM_T sem_t -#endif - -#ifndef UV_PLATFORM_LOOP_FIELDS -# define UV_PLATFORM_LOOP_FIELDS /* empty */ -#endif - -#ifndef UV_PLATFORM_FS_EVENT_FIELDS -# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ -#endif - -#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS -# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -/* Note: May be cast to struct iovec. See writev(2). */ -typedef struct uv_buf_t { - char* base; - size_t len; -} uv_buf_t; - -typedef int uv_file; -typedef int uv_os_sock_t; -typedef int uv_os_fd_t; -typedef pid_t uv_pid_t; - -#define UV_ONCE_INIT PTHREAD_ONCE_INIT - -typedef pthread_once_t uv_once_t; -typedef pthread_t uv_thread_t; -typedef pthread_mutex_t uv_mutex_t; -typedef pthread_rwlock_t uv_rwlock_t; -typedef UV_PLATFORM_SEM_T uv_sem_t; -typedef pthread_cond_t uv_cond_t; -typedef pthread_key_t uv_key_t; - -/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ -#if defined(_AIX) || \ - defined(__OpenBSD__) || \ - !defined(PTHREAD_BARRIER_SERIAL_THREAD) -/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ -struct _uv_barrier { - uv_mutex_t mutex; - uv_cond_t cond; - unsigned threshold; - unsigned in; - unsigned out; -}; - -typedef struct { - struct _uv_barrier* b; -# if defined(PTHREAD_BARRIER_SERIAL_THREAD) - /* TODO(bnoordhuis) Remove padding in v2. */ - char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; -# endif -} uv_barrier_t; -#else -typedef pthread_barrier_t uv_barrier_t; -#endif - -/* Platform-specific definitions for uv_spawn support. */ -typedef gid_t uv_gid_t; -typedef uid_t uv_uid_t; - -typedef struct dirent uv__dirent_t; - -#define UV_DIR_PRIVATE_FIELDS \ - DIR* dir; - -#if defined(DT_UNKNOWN) -# define HAVE_DIRENT_TYPES -# if defined(DT_REG) -# define UV__DT_FILE DT_REG -# else -# define UV__DT_FILE -1 -# endif -# if defined(DT_DIR) -# define UV__DT_DIR DT_DIR -# else -# define UV__DT_DIR -2 -# endif -# if defined(DT_LNK) -# define UV__DT_LINK DT_LNK -# else -# define UV__DT_LINK -3 -# endif -# if defined(DT_FIFO) -# define UV__DT_FIFO DT_FIFO -# else -# define UV__DT_FIFO -4 -# endif -# if defined(DT_SOCK) -# define UV__DT_SOCKET DT_SOCK -# else -# define UV__DT_SOCKET -5 -# endif -# if defined(DT_CHR) -# define UV__DT_CHAR DT_CHR -# else -# define UV__DT_CHAR -6 -# endif -# if defined(DT_BLK) -# define UV__DT_BLOCK DT_BLK -# else -# define UV__DT_BLOCK -7 -# endif -#endif - -/* Platform-specific definitions for uv_dlopen support. */ -#define UV_DYNAMIC /* empty */ - -typedef struct { - void* handle; - char* errmsg; -} uv_lib_t; - -#define UV_LOOP_PRIVATE_FIELDS \ - unsigned long flags; \ - int backend_fd; \ - struct uv__queue pending_queue; \ - struct uv__queue watcher_queue; \ - uv__io_t** watchers; \ - unsigned int nwatchers; \ - unsigned int nfds; \ - struct uv__queue wq; \ - uv_mutex_t wq_mutex; \ - uv_async_t wq_async; \ - uv_rwlock_t cloexec_lock; \ - uv_handle_t* closing_handles; \ - struct uv__queue process_handles; \ - struct uv__queue prepare_handles; \ - struct uv__queue check_handles; \ - struct uv__queue idle_handles; \ - struct uv__queue async_handles; \ - void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \ - uv__io_t async_io_watcher; \ - int async_wfd; \ - struct { \ - void* min; \ - unsigned int nelts; \ - } timer_heap; \ - uint64_t timer_counter; \ - uint64_t time; \ - int signal_pipefd[2]; \ - uv__io_t signal_io_watcher; \ - uv_signal_t child_watcher; \ - int emfile_fd; \ - UV_PLATFORM_LOOP_FIELDS \ - -#define UV_REQ_TYPE_PRIVATE /* empty */ - -#define UV_REQ_PRIVATE_FIELDS /* empty */ - -#define UV_PRIVATE_REQ_TYPES /* empty */ - -#define UV_WRITE_PRIVATE_FIELDS \ - struct uv__queue queue; \ - unsigned int write_index; \ - uv_buf_t* bufs; \ - unsigned int nbufs; \ - int error; \ - uv_buf_t bufsml[4]; \ - -#define UV_CONNECT_PRIVATE_FIELDS \ - struct uv__queue queue; \ - -#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_SEND_PRIVATE_FIELDS \ - struct uv__queue queue; \ - union { \ - struct sockaddr addr; \ - struct sockaddr_storage storage; \ - } u; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - ssize_t status; \ - uv_udp_send_cb send_cb; \ - uv_buf_t bufsml[4]; \ - -#define UV_HANDLE_PRIVATE_FIELDS \ - uv_handle_t* next_closing; \ - unsigned int flags; \ - -#define UV_STREAM_PRIVATE_FIELDS \ - uv_connect_t *connect_req; \ - uv_shutdown_t *shutdown_req; \ - uv__io_t io_watcher; \ - struct uv__queue write_queue; \ - struct uv__queue write_completed_queue; \ - uv_connection_cb connection_cb; \ - int delayed_error; \ - int accepted_fd; \ - void* queued_fds; \ - UV_STREAM_PRIVATE_PLATFORM_FIELDS \ - -#define UV_TCP_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_PRIVATE_FIELDS \ - uv_alloc_cb alloc_cb; \ - uv_udp_recv_cb recv_cb; \ - uv__io_t io_watcher; \ - struct uv__queue write_queue; \ - struct uv__queue write_completed_queue; \ - -#define UV_PIPE_PRIVATE_FIELDS \ - const char* pipe_fname; /* NULL or strdup'ed */ - -#define UV_POLL_PRIVATE_FIELDS \ - uv__io_t io_watcher; - -#define UV_PREPARE_PRIVATE_FIELDS \ - uv_prepare_cb prepare_cb; \ - struct uv__queue queue; \ - -#define UV_CHECK_PRIVATE_FIELDS \ - uv_check_cb check_cb; \ - struct uv__queue queue; \ - -#define UV_IDLE_PRIVATE_FIELDS \ - uv_idle_cb idle_cb; \ - struct uv__queue queue; \ - -#define UV_ASYNC_PRIVATE_FIELDS \ - uv_async_cb async_cb; \ - struct uv__queue queue; \ - int pending; \ - -#define UV_TIMER_PRIVATE_FIELDS \ - uv_timer_cb timer_cb; \ - union { \ - void* heap[3]; \ - struct uv__queue queue; \ - } node; \ - uint64_t timeout; \ - uint64_t repeat; \ - uint64_t start_id; - -#define UV_GETADDRINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getaddrinfo_cb cb; \ - struct addrinfo* hints; \ - char* hostname; \ - char* service; \ - struct addrinfo* addrinfo; \ - int retcode; - -#define UV_GETNAMEINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getnameinfo_cb getnameinfo_cb; \ - struct sockaddr_storage storage; \ - int flags; \ - char host[NI_MAXHOST]; \ - char service[NI_MAXSERV]; \ - int retcode; - -#define UV_PROCESS_PRIVATE_FIELDS \ - struct uv__queue queue; \ - int status; \ - -#define UV_FS_PRIVATE_FIELDS \ - const char *new_path; \ - uv_file file; \ - int flags; \ - mode_t mode; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - off_t off; \ - uv_uid_t uid; \ - uv_gid_t gid; \ - double atime; \ - double mtime; \ - struct uv__work work_req; \ - uv_buf_t bufsml[4]; \ - -#define UV_WORK_PRIVATE_FIELDS \ - struct uv__work work_req; - -#define UV_TTY_PRIVATE_FIELDS \ - struct termios orig_termios; \ - int mode; - -#define UV_SIGNAL_PRIVATE_FIELDS \ - /* RB_ENTRY(uv_signal_s) tree_entry; */ \ - struct { \ - struct uv_signal_s* rbe_left; \ - struct uv_signal_s* rbe_right; \ - struct uv_signal_s* rbe_parent; \ - int rbe_color; \ - } tree_entry; \ - /* Use two counters here so we don have to fiddle with atomics. */ \ - unsigned int caught_signals; \ - unsigned int dispatched_signals; - -#define UV_FS_EVENT_PRIVATE_FIELDS \ - uv_fs_event_cb cb; \ - UV_PLATFORM_FS_EVENT_FIELDS \ - -/* fs open() flags supported on this platform: */ -#if defined(O_APPEND) -# define UV_FS_O_APPEND O_APPEND -#else -# define UV_FS_O_APPEND 0 -#endif -#if defined(O_CREAT) -# define UV_FS_O_CREAT O_CREAT -#else -# define UV_FS_O_CREAT 0 -#endif - -#if defined(__linux__) && defined(__arm__) -# define UV_FS_O_DIRECT 0x10000 -#elif defined(__linux__) && defined(__m68k__) -# define UV_FS_O_DIRECT 0x10000 -#elif defined(__linux__) && defined(__mips__) -# define UV_FS_O_DIRECT 0x08000 -#elif defined(__linux__) && defined(__powerpc__) -# define UV_FS_O_DIRECT 0x20000 -#elif defined(__linux__) && defined(__s390x__) -# define UV_FS_O_DIRECT 0x04000 -#elif defined(__linux__) && defined(__x86_64__) -# define UV_FS_O_DIRECT 0x04000 -#elif defined(__linux__) && defined(__loongarch__) -# define UV_FS_O_DIRECT 0x04000 -#elif defined(O_DIRECT) -# define UV_FS_O_DIRECT O_DIRECT -#else -# define UV_FS_O_DIRECT 0 -#endif - -#if defined(O_DIRECTORY) -# define UV_FS_O_DIRECTORY O_DIRECTORY -#else -# define UV_FS_O_DIRECTORY 0 -#endif -#if defined(O_DSYNC) -# define UV_FS_O_DSYNC O_DSYNC -#else -# define UV_FS_O_DSYNC 0 -#endif -#if defined(O_EXCL) -# define UV_FS_O_EXCL O_EXCL -#else -# define UV_FS_O_EXCL 0 -#endif -#if defined(O_EXLOCK) -# define UV_FS_O_EXLOCK O_EXLOCK -#else -# define UV_FS_O_EXLOCK 0 -#endif -#if defined(O_NOATIME) -# define UV_FS_O_NOATIME O_NOATIME -#else -# define UV_FS_O_NOATIME 0 -#endif -#if defined(O_NOCTTY) -# define UV_FS_O_NOCTTY O_NOCTTY -#else -# define UV_FS_O_NOCTTY 0 -#endif -#if defined(O_NOFOLLOW) -# define UV_FS_O_NOFOLLOW O_NOFOLLOW -#else -# define UV_FS_O_NOFOLLOW 0 -#endif -#if defined(O_NONBLOCK) -# define UV_FS_O_NONBLOCK O_NONBLOCK -#else -# define UV_FS_O_NONBLOCK 0 -#endif -#if defined(O_RDONLY) -# define UV_FS_O_RDONLY O_RDONLY -#else -# define UV_FS_O_RDONLY 0 -#endif -#if defined(O_RDWR) -# define UV_FS_O_RDWR O_RDWR -#else -# define UV_FS_O_RDWR 0 -#endif -#if defined(O_SYMLINK) -# define UV_FS_O_SYMLINK O_SYMLINK -#else -# define UV_FS_O_SYMLINK 0 -#endif -#if defined(O_SYNC) -# define UV_FS_O_SYNC O_SYNC -#else -# define UV_FS_O_SYNC 0 -#endif -#if defined(O_TRUNC) -# define UV_FS_O_TRUNC O_TRUNC -#else -# define UV_FS_O_TRUNC 0 -#endif -#if defined(O_WRONLY) -# define UV_FS_O_WRONLY O_WRONLY -#else -# define UV_FS_O_WRONLY 0 -#endif - -/* fs open() flags supported on other platforms: */ -#define UV_FS_O_FILEMAP 0 -#define UV_FS_O_RANDOM 0 -#define UV_FS_O_SHORT_LIVED 0 -#define UV_FS_O_SEQUENTIAL 0 -#define UV_FS_O_TEMPORARY 0 - -#endif /* UV_UNIX_H */ diff --git a/src/bun.js/bindings/libuv/uv/win.h b/src/bun.js/bindings/libuv/uv/win.h deleted file mode 100644 index a88bf29e9ff5..000000000000 --- a/src/bun.js/bindings/libuv/uv/win.h +++ /dev/null @@ -1,698 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0A00 -#endif - -#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define SSIZE_MAX INTPTR_MAX -# define _SSIZE_T_ -# define _SSIZE_T_DEFINED -#endif - -#include - -#ifndef LOCALE_INVARIANT -# define LOCALE_INVARIANT 0x007f -#endif - -#include -/* Disable the typedef in mstcpip.h of MinGW. */ -#define _TCP_INITIAL_RTO_PARAMETERS _TCP_INITIAL_RTO_PARAMETERS__AVOID -#define TCP_INITIAL_RTO_PARAMETERS TCP_INITIAL_RTO_PARAMETERS__AVOID -#define PTCP_INITIAL_RTO_PARAMETERS PTCP_INITIAL_RTO_PARAMETERS__AVOID -#include -#undef _TCP_INITIAL_RTO_PARAMETERS -#undef TCP_INITIAL_RTO_PARAMETERS -#undef PTCP_INITIAL_RTO_PARAMETERS -#include - -#include -#include -#include -#include -#include - -#include "uv/tree.h" -#include "uv/threadpool.h" - -#define MAX_PIPENAME_LEN 256 - -#ifndef S_IFLNK -# define S_IFLNK 0xA000 -#endif - -/* Define missing in Windows Kit Include\{VERSION}\ucrt\sys\stat.h */ -#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined(S_IFIFO) -# define S_IFIFO _S_IFIFO -#endif - -/* Additional signals supported by uv_signal and or uv_kill. The CRT defines - * the following signals already: - * - * #define SIGINT 2 - * #define SIGILL 4 - * #define SIGABRT_COMPAT 6 - * #define SIGFPE 8 - * #define SIGSEGV 11 - * #define SIGTERM 15 - * #define SIGBREAK 21 - * #define SIGABRT 22 - * - * The additional signals have values that are common on other Unix - * variants (Linux and Darwin) - */ -#define SIGHUP 1 -#define SIGQUIT 3 -#define SIGKILL 9 -#define SIGWINCH 28 - -/* Redefine NSIG to take SIGWINCH into consideration */ -#if defined(NSIG) && NSIG <= SIGWINCH -# undef NSIG -#endif -#ifndef NSIG -# define NSIG SIGWINCH + 1 -#endif - -/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like - * platforms. However MinGW doesn't define it, so we do. */ -#ifndef SIGABRT_COMPAT -# define SIGABRT_COMPAT 6 -#endif - -/* - * Guids and typedefs for winsock extension functions - * Mingw32 doesn't have these :-( - */ -#ifndef WSAID_ACCEPTEX -# define WSAID_ACCEPTEX \ - {0xb5367df1, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - -# define WSAID_CONNECTEX \ - {0x25a207b9, 0xddf3, 0x4660, \ - {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}} - -# define WSAID_GETACCEPTEXSOCKADDRS \ - {0xb5367df2, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - -# define WSAID_DISCONNECTEX \ - {0x7fda2e11, 0x8630, 0x436f, \ - {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}} - -# define WSAID_TRANSMITFILE \ - {0xb5367df0, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - - typedef BOOL (PASCAL *LPFN_ACCEPTEX) - (SOCKET sListenSocket, - SOCKET sAcceptSocket, - PVOID lpOutputBuffer, - DWORD dwReceiveDataLength, - DWORD dwLocalAddressLength, - DWORD dwRemoteAddressLength, - LPDWORD lpdwBytesReceived, - LPOVERLAPPED lpOverlapped); - - typedef BOOL (PASCAL *LPFN_CONNECTEX) - (SOCKET s, - const struct sockaddr* name, - int namelen, - PVOID lpSendBuffer, - DWORD dwSendDataLength, - LPDWORD lpdwBytesSent, - LPOVERLAPPED lpOverlapped); - - typedef void (PASCAL *LPFN_GETACCEPTEXSOCKADDRS) - (PVOID lpOutputBuffer, - DWORD dwReceiveDataLength, - DWORD dwLocalAddressLength, - DWORD dwRemoteAddressLength, - LPSOCKADDR* LocalSockaddr, - LPINT LocalSockaddrLength, - LPSOCKADDR* RemoteSockaddr, - LPINT RemoteSockaddrLength); - - typedef BOOL (PASCAL *LPFN_DISCONNECTEX) - (SOCKET hSocket, - LPOVERLAPPED lpOverlapped, - DWORD dwFlags, - DWORD reserved); - - typedef BOOL (PASCAL *LPFN_TRANSMITFILE) - (SOCKET hSocket, - HANDLE hFile, - DWORD nNumberOfBytesToWrite, - DWORD nNumberOfBytesPerSend, - LPOVERLAPPED lpOverlapped, - LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, - DWORD dwFlags); - - typedef PVOID RTL_SRWLOCK; - typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; -#endif - -typedef int (WSAAPI* LPFN_WSARECV) - (SOCKET socket, - LPWSABUF buffers, - DWORD buffer_count, - LPDWORD bytes, - LPDWORD flags, - LPWSAOVERLAPPED overlapped, - LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); - -typedef int (WSAAPI* LPFN_WSARECVFROM) - (SOCKET socket, - LPWSABUF buffers, - DWORD buffer_count, - LPDWORD bytes, - LPDWORD flags, - struct sockaddr* addr, - LPINT addr_len, - LPWSAOVERLAPPED overlapped, - LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); - -#ifndef _NTDEF_ - typedef LONG NTSTATUS; - typedef NTSTATUS *PNTSTATUS; -#endif - -#ifndef RTL_CONDITION_VARIABLE_INIT - typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; -#endif - -typedef struct _AFD_POLL_HANDLE_INFO { - HANDLE Handle; - ULONG Events; - NTSTATUS Status; -} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; - -typedef struct _AFD_POLL_INFO { - LARGE_INTEGER Timeout; - ULONG NumberOfHandles; - ULONG Exclusive; - AFD_POLL_HANDLE_INFO Handles[1]; -} AFD_POLL_INFO, *PAFD_POLL_INFO; - -#define UV_MSAFD_PROVIDER_COUNT 4 - - -/** - * It should be possible to cast uv_buf_t[] to WSABUF[] - * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx - */ -typedef struct uv_buf_t { - ULONG len; - char* base; -} uv_buf_t; - -typedef int uv_file; -typedef SOCKET uv_os_sock_t; -typedef HANDLE uv_os_fd_t; -typedef int uv_pid_t; - -typedef HANDLE uv_thread_t; - -typedef HANDLE uv_sem_t; - -typedef CRITICAL_SECTION uv_mutex_t; - -/* This condition variable implementation is based on the SetEvent solution - * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html - * We could not use the SignalObjectAndWait solution (section 3.4) because - * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and - * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. - */ - -typedef union { - CONDITION_VARIABLE cond_var; - struct { - unsigned int waiters_count; - CRITICAL_SECTION waiters_count_lock; - HANDLE signal_event; - HANDLE broadcast_event; - } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */ -} uv_cond_t; - -typedef struct { - SRWLOCK read_write_lock_; - /* TODO: retained for ABI compatibility; remove me in v2.x */ -#ifdef _WIN64 - unsigned char padding_[72]; -#else - unsigned char padding_[44]; -#endif -} uv_rwlock_t; - -typedef struct { - unsigned threshold; - unsigned in; - uv_mutex_t mutex; - /* TODO: in v2 make this a uv_cond_t, without unused_ */ - CONDITION_VARIABLE cond; - unsigned out; -} uv_barrier_t; - -typedef struct { - DWORD tls_index; -} uv_key_t; - -#define UV_ONCE_INIT { 0, NULL } - -typedef struct uv_once_s { - unsigned char unused; - INIT_ONCE init_once; -} uv_once_t; - -/* Platform-specific definitions for uv_spawn support. */ -typedef unsigned char uv_uid_t; -typedef unsigned char uv_gid_t; - -typedef struct uv__dirent_s { - int d_type; - char d_name[1]; -} uv__dirent_t; - -#define UV_DIR_PRIVATE_FIELDS \ - HANDLE dir_handle; \ - WIN32_FIND_DATAW find_data; \ - BOOL need_find_call; - -#define HAVE_DIRENT_TYPES -#define UV__DT_DIR UV_DIRENT_DIR -#define UV__DT_FILE UV_DIRENT_FILE -#define UV__DT_LINK UV_DIRENT_LINK -#define UV__DT_FIFO UV_DIRENT_FIFO -#define UV__DT_SOCKET UV_DIRENT_SOCKET -#define UV__DT_CHAR UV_DIRENT_CHAR -#define UV__DT_BLOCK UV_DIRENT_BLOCK - -/* Platform-specific definitions for uv_dlopen support. */ -#define UV_DYNAMIC FAR WINAPI -typedef struct { - HMODULE handle; - char* errmsg; -} uv_lib_t; - -#define UV_LOOP_PRIVATE_FIELDS \ - /* The loop's I/O completion port */ \ - HANDLE iocp; \ - /* The current time according to the event loop. in msecs. */ \ - uint64_t time; \ - /* Tail of a single-linked circular queue of pending reqs. If the queue */ \ - /* is empty, tail_ is NULL. If there is only one item, */ \ - /* tail_->next_req == tail_ */ \ - uv_req_t* pending_reqs_tail; \ - /* Head of a single-linked list of closed handles */ \ - uv_handle_t* endgame_handles; \ - /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \ - void* timer_heap; \ - /* Lists of active loop (prepare / check / idle) watchers */ \ - uv_prepare_t* prepare_handles; \ - uv_check_t* check_handles; \ - uv_idle_t* idle_handles; \ - /* This pointer will refer to the prepare/check/idle handle whose */ \ - /* callback is scheduled to be called next. This is needed to allow */ \ - /* safe removal from one of the lists above while that list being */ \ - /* iterated over. */ \ - uv_prepare_t* next_prepare_handle; \ - uv_check_t* next_check_handle; \ - uv_idle_t* next_idle_handle; \ - /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \ - SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \ - /* No longer used. */ \ - unsigned int active_tcp_streams; \ - /* No longer used. */ \ - unsigned int active_udp_streams; \ - /* Counter to started timer */ \ - uint64_t timer_counter; \ - /* Threadpool */ \ - struct uv__queue wq; \ - uv_mutex_t wq_mutex; \ - uv_async_t wq_async; - -#define UV_REQ_TYPE_PRIVATE \ - /* TODO: remove the req suffix */ \ - UV_ACCEPT, \ - UV_FS_EVENT_REQ, \ - UV_POLL_REQ, \ - UV_PROCESS_EXIT, \ - UV_READ, \ - UV_UDP_RECV, \ - UV_WAKEUP, \ - UV_SIGNAL_REQ, - -#define UV_REQ_PRIVATE_FIELDS \ - union { \ - /* Used by I/O operations */ \ - struct { \ - OVERLAPPED overlapped; \ - size_t queued_bytes; \ - } io; \ - /* in v2, we can move these to the UV_CONNECT_PRIVATE_FIELDS */ \ - struct { \ - ULONG_PTR result; /* overlapped.Internal is reused to hold the result */\ - HANDLE pipeHandle; \ - DWORD duplex_flags; \ - WCHAR* name; \ - } connect; \ - } u; \ - struct uv_req_s* next_req; - -#define UV_WRITE_PRIVATE_FIELDS \ - int coalesced; \ - uv_buf_t write_buffer; \ - HANDLE event_handle; \ - HANDLE wait_handle; - -#define UV_CONNECT_PRIVATE_FIELDS \ - /* empty */ - -#define UV_SHUTDOWN_PRIVATE_FIELDS \ - /* empty */ - -#define UV_UDP_SEND_PRIVATE_FIELDS \ - /* empty */ - -#define UV_PRIVATE_REQ_TYPES \ - typedef struct uv_pipe_accept_s { \ - UV_REQ_FIELDS \ - HANDLE pipeHandle; \ - struct uv_pipe_accept_s* next_pending; \ - } uv_pipe_accept_t; \ - \ - typedef struct uv_tcp_accept_s { \ - UV_REQ_FIELDS \ - SOCKET accept_socket; \ - char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ - HANDLE event_handle; \ - HANDLE wait_handle; \ - struct uv_tcp_accept_s* next_pending; \ - } uv_tcp_accept_t; \ - \ - typedef struct uv_read_s { \ - UV_REQ_FIELDS \ - HANDLE event_handle; \ - HANDLE wait_handle; \ - } uv_read_t; - -#define uv_stream_connection_fields \ - unsigned int write_reqs_pending; \ - uv_shutdown_t* shutdown_req; - -#define uv_stream_server_fields \ - uv_connection_cb connection_cb; - -#define UV_STREAM_PRIVATE_FIELDS \ - unsigned int reqs_pending; \ - int activecnt; \ - uv_read_t read_req; \ - union { \ - struct { uv_stream_connection_fields } conn; \ - struct { uv_stream_server_fields } serv; \ - } stream; - -#define uv_tcp_server_fields \ - uv_tcp_accept_t* accept_reqs; \ - unsigned int processed_accepts; \ - uv_tcp_accept_t* pending_accepts; \ - LPFN_ACCEPTEX func_acceptex; - -#define uv_tcp_connection_fields \ - uv_buf_t read_buffer; \ - LPFN_CONNECTEX func_connectex; - -#define UV_TCP_PRIVATE_FIELDS \ - SOCKET socket; \ - int delayed_error; \ - union { \ - struct { uv_tcp_server_fields } serv; \ - struct { uv_tcp_connection_fields } conn; \ - } tcp; - -#define UV_UDP_PRIVATE_FIELDS \ - SOCKET socket; \ - unsigned int reqs_pending; \ - int activecnt; \ - uv_req_t recv_req; \ - uv_buf_t recv_buffer; \ - struct sockaddr_storage recv_from; \ - int recv_from_len; \ - uv_udp_recv_cb recv_cb; \ - uv_alloc_cb alloc_cb; \ - LPFN_WSARECV func_wsarecv; \ - LPFN_WSARECVFROM func_wsarecvfrom; - -#define uv_pipe_server_fields \ - int pending_instances; \ - uv_pipe_accept_t* accept_reqs; \ - uv_pipe_accept_t* pending_accepts; - -#define uv_pipe_connection_fields \ - uv_timer_t* eof_timer; \ - uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ - DWORD ipc_remote_pid; \ - union { \ - uint32_t payload_remaining; \ - uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ - } ipc_data_frame; \ - struct uv__queue ipc_xfer_queue; \ - int ipc_xfer_queue_length; \ - uv_write_t* non_overlapped_writes_tail; \ - CRITICAL_SECTION readfile_thread_lock; \ - volatile HANDLE readfile_thread_handle; - -#define UV_PIPE_PRIVATE_FIELDS \ - HANDLE handle; \ - WCHAR* name; \ - union { \ - struct { uv_pipe_server_fields } serv; \ - struct { uv_pipe_connection_fields } conn; \ - } pipe; - -/* TODO: put the parser states in a union - TTY handles are always half-duplex - * so read-state can safely overlap write-state. */ -#define UV_TTY_PRIVATE_FIELDS \ - HANDLE handle; \ - union { \ - struct { \ - /* Used for readable TTY handles */ \ - union { \ - /* TODO: remove me in v2.x. */ \ - HANDLE unused_; \ - int mode; \ - } mode; \ - uv_buf_t read_line_buffer; \ - HANDLE read_raw_wait; \ - /* Fields used for translating win keystrokes into vt100 characters */ \ - char last_key[8]; \ - unsigned char last_key_offset; \ - unsigned char last_key_len; \ - WCHAR last_utf16_high_surrogate; \ - INPUT_RECORD last_input_record; \ - } rd; \ - struct { \ - /* Used for writable TTY handles */ \ - /* utf8-to-utf16 conversion state */ \ - unsigned int utf8_codepoint; \ - unsigned char utf8_bytes_left; \ - /* eol conversion state */ \ - unsigned char previous_eol; \ - /* ansi parser state */ \ - unsigned short ansi_parser_state; \ - unsigned char ansi_csi_argc; \ - unsigned short ansi_csi_argv[4]; \ - COORD saved_position; \ - WORD saved_attributes; \ - } wr; \ - } tty; - -#define UV_POLL_PRIVATE_FIELDS \ - SOCKET socket; \ - /* Used in fast mode */ \ - SOCKET peer_socket; \ - AFD_POLL_INFO afd_poll_info_1; \ - AFD_POLL_INFO afd_poll_info_2; \ - /* Used in fast and slow mode. */ \ - uv_req_t poll_req_1; \ - uv_req_t poll_req_2; \ - unsigned char submitted_events_1; \ - unsigned char submitted_events_2; \ - unsigned char mask_events_1; \ - unsigned char mask_events_2; \ - unsigned char events; - -#define UV_TIMER_PRIVATE_FIELDS \ - union { \ - void* heap[3]; \ - struct uv__queue queue; \ - } node; \ - int unused; \ - uint64_t timeout; \ - uint64_t repeat; \ - uint64_t start_id; \ - uv_timer_cb timer_cb; - -#define UV_ASYNC_PRIVATE_FIELDS \ - struct uv_req_s async_req; \ - uv_async_cb async_cb; \ - /* char to avoid alignment issues */ \ - char volatile async_sent; - -#define UV_PREPARE_PRIVATE_FIELDS \ - uv_prepare_t* prepare_prev; \ - uv_prepare_t* prepare_next; \ - uv_prepare_cb prepare_cb; - -#define UV_CHECK_PRIVATE_FIELDS \ - uv_check_t* check_prev; \ - uv_check_t* check_next; \ - uv_check_cb check_cb; - -#define UV_IDLE_PRIVATE_FIELDS \ - uv_idle_t* idle_prev; \ - uv_idle_t* idle_next; \ - uv_idle_cb idle_cb; - -#define UV_HANDLE_PRIVATE_FIELDS \ - uv_handle_t* endgame_next; \ - unsigned int flags; - -#define UV_GETADDRINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getaddrinfo_cb getaddrinfo_cb; \ - void* alloc; \ - WCHAR* node; \ - WCHAR* service; \ - /* The addrinfoW field is used to store a pointer to the hints, and */ \ - /* later on to store the result of GetAddrInfoW. The final result will */ \ - /* be converted to struct addrinfo* and stored in the addrinfo field. */ \ - struct addrinfoW* addrinfow; \ - struct addrinfo* addrinfo; \ - int retcode; - -#define UV_GETNAMEINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getnameinfo_cb getnameinfo_cb; \ - struct sockaddr_storage storage; \ - int flags; \ - char host[NI_MAXHOST]; \ - char service[NI_MAXSERV]; \ - int retcode; - -#define UV_PROCESS_PRIVATE_FIELDS \ - struct uv_process_exit_s { \ - UV_REQ_FIELDS \ - } exit_req; \ - void* unused; /* TODO: retained for ABI compat; remove this in v2.x. */ \ - int exit_signal; \ - HANDLE wait_handle; \ - HANDLE process_handle; \ - volatile char exit_cb_pending; - -#define UV_FS_PRIVATE_FIELDS \ - struct uv__work work_req; \ - int flags; \ - DWORD sys_errno_; \ - union { \ - /* TODO: remove me in 0.9. */ \ - WCHAR* pathw; \ - int fd; \ - } file; \ - union { \ - struct { \ - int mode; \ - WCHAR* new_pathw; \ - int file_flags; \ - int fd_out; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - int64_t offset; \ - uv_buf_t bufsml[4]; \ - } info; \ - struct { \ - double atime; \ - double mtime; \ - } time; \ - } fs; - -#define UV_WORK_PRIVATE_FIELDS \ - struct uv__work work_req; - -#define UV_FS_EVENT_PRIVATE_FIELDS \ - struct uv_fs_event_req_s { \ - UV_REQ_FIELDS \ - } req; \ - HANDLE dir_handle; \ - int req_pending; \ - uv_fs_event_cb cb; \ - WCHAR* filew; \ - WCHAR* short_filew; \ - WCHAR* dirw; \ - char* buffer; - -#define UV_SIGNAL_PRIVATE_FIELDS \ - RB_ENTRY(uv_signal_s) tree_entry; \ - struct uv_req_s signal_req; \ - unsigned long pending_signum; - -#ifndef F_OK -#define F_OK 0 -#endif -#ifndef R_OK -#define R_OK 4 -#endif -#ifndef W_OK -#define W_OK 2 -#endif -#ifndef X_OK -#define X_OK 1 -#endif - -/* fs open() flags supported on this platform: */ -#define UV_FS_O_APPEND _O_APPEND -#define UV_FS_O_CREAT _O_CREAT -#define UV_FS_O_EXCL _O_EXCL -#define UV_FS_O_FILEMAP 0x20000000 -#define UV_FS_O_RANDOM _O_RANDOM -#define UV_FS_O_RDONLY _O_RDONLY -#define UV_FS_O_RDWR _O_RDWR -#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL -#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED -#define UV_FS_O_TEMPORARY _O_TEMPORARY -#define UV_FS_O_TRUNC _O_TRUNC -#define UV_FS_O_WRONLY _O_WRONLY - -/* fs open() flags supported on other platforms (or mapped on this platform): */ -#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ -#define UV_FS_O_DIRECTORY 0 -#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ -#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ -#define UV_FS_O_NOATIME 0 -#define UV_FS_O_NOCTTY 0 -#define UV_FS_O_NOFOLLOW 0 -#define UV_FS_O_NONBLOCK 0 -#define UV_FS_O_SYMLINK 0 -#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --git a/src/bun.js/bindings/v8/AGENTS.md b/src/bun.js/bindings/v8/AGENTS.md deleted file mode 120000 index 681311eb9cf4..000000000000 --- a/src/bun.js/bindings/v8/AGENTS.md +++ /dev/null @@ -1 +0,0 @@ -CLAUDE.md \ No newline at end of file diff --git a/src/bun.zig b/src/bun.zig index ca572ae8af4d..804dfcfb977d 100644 --- a/src/bun.zig +++ b/src/bun.zig @@ -198,19 +198,19 @@ pub const meta = @import("./meta.zig"); pub const base64 = @import("./base64/base64.zig"); pub const path = @import("./resolver/resolve_path.zig"); pub const resolver = @import("./resolver/resolver.zig"); -pub const DirIterator = @import("./bun.js/node/dir_iterator.zig"); +pub const DirIterator = @import("./buntime/node/dir_iterator.zig"); pub const PackageJSON = @import("./resolver/package_json.zig").PackageJSON; pub const fmt = @import("./fmt.zig"); // This file is gennerated, but cant be placed in the build/debug/codegen // folder because zig will complain about outside-of-module stuff /// All functions and interfaces provided from Bun's `bindgen` utility. -pub const gen = @import("./bun.js/bindings/GeneratedBindings.zig"); +pub const gen = @import("./buntime/jsc/generated/GeneratedBindings.zig"); comptime { // This file is gennerated, but cant be placed in the build/debug/codegen // folder because zig will complain about outside-of-module stuff - _ = &@import("./bun.js/bindings/GeneratedJS2Native.zig"); + _ = &@import("./buntime/jsc/generated/GeneratedJS2Native.zig"); _ = &gen; // reference bindings } @@ -231,7 +231,7 @@ pub const bits = @import("./bits.zig"); pub const css = @import("./css/css_parser.zig"); pub const SmallList = css.SmallList; pub const csrf = @import("./csrf.zig"); -pub const validators = @import("./bun.js/node/util/validators.zig"); +pub const validators = @import("./buntime/node/util/validators.zig"); pub const shell = @import("./shell/shell.zig"); @@ -731,7 +731,7 @@ pub const LOLHTML = @import("./deps/lol-html.zig"); pub const clap = @import("./deps/zig-clap/clap.zig"); pub const analytics = @import("./analytics.zig"); pub const zlib = @import("./zlib.zig"); -pub const simdutf = @import("./bun.js/bindings/bun-simdutf.zig"); +pub const simdutf = @import("./string/bun-simdutf.zig"); pub var start_time: i128 = 0; @@ -1099,12 +1099,12 @@ pub const PackageManager = install.PackageManager; pub const RunCommand = @import("./cli/run_command.zig").RunCommand; pub const fs = @import("./fs.zig"); -pub const transpiler = @import("./transpiler.zig"); +pub const transpiler = @import("./transpiler/transpiler.zig"); pub const Transpiler = transpiler.Transpiler; pub const which = @import("./which.zig").which; -pub const js_parser = @import("./js_parser.zig"); -pub const js_printer = @import("./js_printer.zig"); -pub const js_lexer = @import("./js_lexer.zig"); +pub const js_parser = @import("./transpiler/js_parser.zig"); +pub const js_printer = @import("./transpiler/js_printer.zig"); +pub const js_lexer = @import("./transpiler/js_lexer.zig"); pub const ast = @import("./ast.zig"); pub const interchange = @import("./interchange.zig"); @@ -1380,7 +1380,7 @@ pub fn asByteSlice(buffer: anytype) []const u8 { } comptime { - _ = @import("./bun.js/node/buffer.zig").BufferVectorized.fill; + _ = @import("./buntime/node/buffer.zig").BufferVectorized.fill; _ = @import("./cli/upgrade_command.zig").Version; } @@ -2102,7 +2102,7 @@ pub fn initArgv(allocator: std.mem.Allocator) !void { } } -pub const spawn = @import("./bun.js/api/bun/spawn.zig").PosixSpawn; +pub const spawn = @import("./buntime/api/bun/spawn.zig").PosixSpawn; pub fn isRegularFile(mode: anytype) bool { return S.ISREG(@intCast(mode)); @@ -3304,7 +3304,7 @@ pub const timespec = extern struct { } }; -pub const UUID = @import("./bun.js/uuid.zig"); +pub const UUID = @import("./buntime/web/webcrypto/uuid.zig"); /// An abstract number of element in a sequence. The sequence has a first element. /// This type should be used instead of integer because 2 contradicting traditions can diff --git a/src/bundler/LinkerContext.zig b/src/bundler/LinkerContext.zig index 0e54ee3d5bc4..6e9adafed208 100644 --- a/src/bundler/LinkerContext.zig +++ b/src/bundler/LinkerContext.zig @@ -2661,8 +2661,8 @@ pub const ParseTask = bun.bundle_v2.ParseTask; const string = []const u8; const NodeFallbackModules = @import("../node_fallbacks.zig"); -const js_printer = @import("../js_printer.zig"); -const lex = @import("../js_lexer.zig"); +const js_printer = @import("../transpiler/js_printer.zig"); +const lex = @import("../transpiler/js_lexer.zig"); const linker = @import("../linker.zig"); const runtime = @import("../runtime.zig"); const std = @import("std"); diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index af6199fe6809..8455c3a7deb4 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -4501,10 +4501,10 @@ pub fn allocatorHasPointer(allocator: std.mem.Allocator) bool { } pub const std = @import("std"); -pub const lex = @import("../js_lexer.zig"); +pub const lex = @import("../transpiler/js_lexer.zig"); pub const Logger = @import("../logger.zig"); pub const Part = js_ast.Part; -pub const js_printer = @import("../js_printer.zig"); +pub const js_printer = @import("../transpiler/js_printer.zig"); pub const js_ast = bun.ast; pub const linker = @import("../linker.zig"); pub const SourceMap = bun.SourceMap; diff --git a/src/bun.js/JSONLineBuffer.zig b/src/buntime/JSONLineBuffer.zig similarity index 100% rename from src/bun.js/JSONLineBuffer.zig rename to src/buntime/JSONLineBuffer.zig diff --git a/src/bun.js/STREAMS.md b/src/buntime/STREAMS.md similarity index 99% rename from src/bun.js/STREAMS.md rename to src/buntime/STREAMS.md index 8199e29a87e3..e9cb5aba05f9 100644 --- a/src/bun.js/STREAMS.md +++ b/src/buntime/STREAMS.md @@ -40,7 +40,7 @@ Identifying the _source_ of a `ReadableStream` at the native level unlocks many - **Identification:** A C++ binding, `ReadableStreamTag__tagged` (from `ReadableStream.zig`), is the primary entry point for this identification. When native code needs to consume a stream (e.g., when sending a `Response` body), it calls this function on the JS `ReadableStream` object to determine its origin. ```zig -// src/bun.js/webcore/ReadableStream.zig +// src/buntime/web/streams/ReadableStream.zig pub const Tag = enum(i32) { JavaScript = 0, // A generic, user-defined stream. This is the "slow path". Blob = 1, // An in-memory blob. Fast path available. diff --git a/src/bun.js/api.zig b/src/buntime/api.zig similarity index 94% rename from src/bun.js/api.zig rename to src/buntime/api.zig index 1d5f106b8874..9ed761215129 100644 --- a/src/bun.js/api.zig +++ b/src/buntime/api.zig @@ -32,7 +32,7 @@ pub const YAMLObject = @import("./api/YAMLObject.zig"); pub const Timer = @import("./api/Timer.zig"); pub const FFIObject = @import("./api/FFIObject.zig"); pub const BuildArtifact = @import("./api/JSBundler.zig").BuildArtifact; -pub const BuildMessage = @import("./BuildMessage.zig").BuildMessage; +pub const BuildMessage = @import("./api/error/BuildMessage.zig").BuildMessage; pub const dns = @import("./api/bun/dns.zig"); pub const FFI = @import("./api/ffi.zig").FFI; pub const HTMLRewriter = @import("./api/html_rewriter.zig"); @@ -46,7 +46,7 @@ pub const NativeBrotli = @import("./node/zlib/NativeBrotli.zig"); pub const NativeZlib = @import("./node/zlib/NativeZlib.zig"); pub const Postgres = @import("../sql/postgres.zig"); pub const MySQL = @import("../sql/mysql.zig"); -pub const ResolveMessage = @import("./ResolveMessage.zig").ResolveMessage; +pub const ResolveMessage = @import("./api/error/ResolveMessage.zig").ResolveMessage; pub const Shell = @import("../shell/shell.zig"); pub const UDPSocket = @import("./api/bun/udp_socket.zig").UDPSocket; pub const Valkey = @import("../valkey/js_valkey.zig").JSValkeyClient; diff --git a/src/bun.js/api/BunObject.bind.ts b/src/buntime/api/BunObject.bind.ts similarity index 100% rename from src/bun.js/api/BunObject.bind.ts rename to src/buntime/api/BunObject.bind.ts diff --git a/src/bun.js/api/BunObject.classes.ts b/src/buntime/api/BunObject.classes.ts similarity index 100% rename from src/bun.js/api/BunObject.classes.ts rename to src/buntime/api/BunObject.classes.ts diff --git a/src/bun.js/api/BunObject.zig b/src/buntime/api/BunObject.zig similarity index 99% rename from src/bun.js/api/BunObject.zig rename to src/buntime/api/BunObject.zig index 831c4c50088b..ac3351a43c1a 100644 --- a/src/bun.js/api/BunObject.zig +++ b/src/buntime/api/BunObject.zig @@ -23,7 +23,7 @@ pub const BunObject = struct { pub const gzipSync = toJSCallback(JSZlib.gzipSync); pub const indexOfLine = toJSCallback(Bun.indexOfLine); pub const inflateSync = toJSCallback(JSZlib.inflateSync); - pub const jest = toJSCallback(@import("../test/jest.zig").Jest.call); + pub const jest = toJSCallback(@import("../../test_runner/jest.zig").Jest.call); pub const listen = toJSCallback(host_fn.wrapStaticMethod(api.Listener, "listen", false)); pub const mmap = toJSCallback(Bun.mmapFile); pub const nanoseconds = toJSCallback(Bun.nanoseconds); diff --git a/src/bun.js/api/FFI.h b/src/buntime/api/FFI.h similarity index 99% rename from src/bun.js/api/FFI.h rename to src/buntime/api/FFI.h index bdd032dc0a04..50e452694b62 100644 --- a/src/bun.js/api/FFI.h +++ b/src/buntime/api/FFI.h @@ -1,6 +1,6 @@ // This file is part of Bun! // You can find the original source: -// https://github.com/oven-sh/bun/blob/main/src/bun.js/api/FFI.h +// https://github.com/oven-sh/bun/blob/main/src/buntime/api/FFI.h // // clang-format off // This file is only compatible with 64 bit CPUs diff --git a/src/bun.js/api/FFIObject.zig b/src/buntime/api/FFIObject.zig similarity index 100% rename from src/bun.js/api/FFIObject.zig rename to src/buntime/api/FFIObject.zig diff --git a/src/bun.js/api/Glob.classes.ts b/src/buntime/api/Glob.classes.ts similarity index 100% rename from src/bun.js/api/Glob.classes.ts rename to src/buntime/api/Glob.classes.ts diff --git a/src/bun.js/api/HashObject.zig b/src/buntime/api/HashObject.zig similarity index 100% rename from src/bun.js/api/HashObject.zig rename to src/buntime/api/HashObject.zig diff --git a/src/bun.js/api/JSBundler.classes.ts b/src/buntime/api/JSBundler.classes.ts similarity index 100% rename from src/bun.js/api/JSBundler.classes.ts rename to src/buntime/api/JSBundler.classes.ts diff --git a/src/bun.js/api/JSBundler.zig b/src/buntime/api/JSBundler.zig similarity index 100% rename from src/bun.js/api/JSBundler.zig rename to src/buntime/api/JSBundler.zig diff --git a/src/bun.js/api/JSTranspiler.zig b/src/buntime/api/JSTranspiler.zig similarity index 100% rename from src/bun.js/api/JSTranspiler.zig rename to src/buntime/api/JSTranspiler.zig diff --git a/src/bun.js/api/ParsedShellScript.classes.ts b/src/buntime/api/ParsedShellScript.classes.ts similarity index 100% rename from src/bun.js/api/ParsedShellScript.classes.ts rename to src/buntime/api/ParsedShellScript.classes.ts diff --git a/src/bun.js/api/ResumableSink.classes.ts b/src/buntime/api/ResumableSink.classes.ts similarity index 100% rename from src/bun.js/api/ResumableSink.classes.ts rename to src/buntime/api/ResumableSink.classes.ts diff --git a/src/bun.js/api/Shell.classes.ts b/src/buntime/api/Shell.classes.ts similarity index 100% rename from src/bun.js/api/Shell.classes.ts rename to src/buntime/api/Shell.classes.ts diff --git a/src/bun.js/api/TOMLObject.zig b/src/buntime/api/TOMLObject.zig similarity index 100% rename from src/bun.js/api/TOMLObject.zig rename to src/buntime/api/TOMLObject.zig diff --git a/src/bun.js/api/Terminal.classes.ts b/src/buntime/api/Terminal.classes.ts similarity index 100% rename from src/bun.js/api/Terminal.classes.ts rename to src/buntime/api/Terminal.classes.ts diff --git a/src/bun.js/api/Timer.zig b/src/buntime/api/Timer.zig similarity index 100% rename from src/bun.js/api/Timer.zig rename to src/buntime/api/Timer.zig diff --git a/src/bun.js/api/Timer/DateHeaderTimer.zig b/src/buntime/api/Timer/DateHeaderTimer.zig similarity index 100% rename from src/bun.js/api/Timer/DateHeaderTimer.zig rename to src/buntime/api/Timer/DateHeaderTimer.zig diff --git a/src/bun.js/api/Timer/EventLoopDelayMonitor.zig b/src/buntime/api/Timer/EventLoopDelayMonitor.zig similarity index 100% rename from src/bun.js/api/Timer/EventLoopDelayMonitor.zig rename to src/buntime/api/Timer/EventLoopDelayMonitor.zig diff --git a/src/bun.js/api/Timer/EventLoopTimer.zig b/src/buntime/api/Timer/EventLoopTimer.zig similarity index 100% rename from src/bun.js/api/Timer/EventLoopTimer.zig rename to src/buntime/api/Timer/EventLoopTimer.zig diff --git a/src/bun.js/api/Timer/ImmediateObject.zig b/src/buntime/api/Timer/ImmediateObject.zig similarity index 98% rename from src/bun.js/api/Timer/ImmediateObject.zig rename to src/buntime/api/Timer/ImmediateObject.zig index f0fb9daa91be..37bef958b30a 100644 --- a/src/bun.js/api/Timer/ImmediateObject.zig +++ b/src/buntime/api/Timer/ImmediateObject.zig @@ -93,7 +93,7 @@ pub fn dispose(self: *Self, globalThis: *JSGlobalObject, _: *jsc.CallFrame) bun. return .js_undefined; } -const Debugger = @import("../../Debugger.zig"); +const Debugger = @import("../inspector/Debugger.zig"); const bun = @import("bun"); const EventLoopTimer = bun.api.Timer.EventLoopTimer; diff --git a/src/bun.js/api/Timer/TimeoutObject.zig b/src/buntime/api/Timer/TimeoutObject.zig similarity index 98% rename from src/bun.js/api/Timer/TimeoutObject.zig rename to src/buntime/api/Timer/TimeoutObject.zig index fb344d057945..e88cf7afec0b 100644 --- a/src/bun.js/api/Timer/TimeoutObject.zig +++ b/src/buntime/api/Timer/TimeoutObject.zig @@ -123,7 +123,7 @@ pub fn dispose(self: *Self, globalThis: *JSGlobalObject, _: *jsc.CallFrame) bun. return .js_undefined; } -const Debugger = @import("../../Debugger.zig"); +const Debugger = @import("../inspector/Debugger.zig"); const bun = @import("bun"); const EventLoopTimer = bun.api.Timer.EventLoopTimer; diff --git a/src/bun.js/api/Timer/TimerObjectInternals.zig b/src/buntime/api/Timer/TimerObjectInternals.zig similarity index 99% rename from src/bun.js/api/Timer/TimerObjectInternals.zig rename to src/buntime/api/Timer/TimerObjectInternals.zig index dc5502bc17be..2892e671517c 100644 --- a/src/bun.js/api/Timer/TimerObjectInternals.zig +++ b/src/buntime/api/Timer/TimerObjectInternals.zig @@ -473,7 +473,7 @@ pub fn deinit(this: *TimerObjectInternals) void { } } -const Debugger = @import("../../Debugger.zig"); +const Debugger = @import("../inspector/Debugger.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/api/Timer/WTFTimer.zig b/src/buntime/api/Timer/WTFTimer.zig similarity index 100% rename from src/bun.js/api/Timer/WTFTimer.zig rename to src/buntime/api/Timer/WTFTimer.zig diff --git a/src/bun.js/api/UnsafeObject.zig b/src/buntime/api/UnsafeObject.zig similarity index 100% rename from src/bun.js/api/UnsafeObject.zig rename to src/buntime/api/UnsafeObject.zig diff --git a/src/bun.js/api/YAMLObject.zig b/src/buntime/api/YAMLObject.zig similarity index 100% rename from src/bun.js/api/YAMLObject.zig rename to src/buntime/api/YAMLObject.zig diff --git a/src/bun.js/api/bun/Terminal.zig b/src/buntime/api/bun/Terminal.zig similarity index 100% rename from src/bun.js/api/bun/Terminal.zig rename to src/buntime/api/bun/Terminal.zig diff --git a/src/bun.js/bindings/ares_build.h b/src/buntime/api/bun/ares_build.h similarity index 100% rename from src/bun.js/bindings/ares_build.h rename to src/buntime/api/bun/ares_build.h diff --git a/src/bun.js/api/bun/dns.zig b/src/buntime/api/bun/dns.zig similarity index 100% rename from src/bun.js/api/bun/dns.zig rename to src/buntime/api/bun/dns.zig diff --git a/src/bun.js/api/bun/h2_frame_parser.zig b/src/buntime/api/bun/h2_frame_parser.zig similarity index 100% rename from src/bun.js/api/bun/h2_frame_parser.zig rename to src/buntime/api/bun/h2_frame_parser.zig diff --git a/src/bun.js/api/bun/js_bun_spawn_bindings.zig b/src/buntime/api/bun/js_bun_spawn_bindings.zig similarity index 99% rename from src/bun.js/api/bun/js_bun_spawn_bindings.zig rename to src/buntime/api/bun/js_bun_spawn_bindings.zig index 45c33a5a19e4..3b821049b27a 100644 --- a/src/bun.js/api/bun/js_bun_spawn_bindings.zig +++ b/src/buntime/api/bun/js_bun_spawn_bindings.zig @@ -1099,7 +1099,7 @@ pub fn appendEnvpFromJS(globalThis: *jsc.JSGlobalObject, object: *jsc.JSObject, const log = Output.scoped(.Subprocess, .hidden); extern "C" const BUN_DEFAULT_PATH_FOR_SPAWN: [*:0]const u8; -const IPC = @import("../../ipc.zig"); +const IPC = @import("../ipc/ipc.zig"); const Terminal = @import("./Terminal.zig"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/bun.js/api/bun/lshpack.zig b/src/buntime/api/bun/lshpack.zig similarity index 97% rename from src/bun.js/api/bun/lshpack.zig rename to src/buntime/api/bun/lshpack.zig index 1415f3d59065..ec168ba32341 100644 --- a/src/bun.js/api/bun/lshpack.zig +++ b/src/buntime/api/bun/lshpack.zig @@ -7,7 +7,7 @@ const lshpack_header = extern struct { hpack_index: u16 = 255, }; -/// wrapper implemented at src/bun.js/bindings/c-bindings.cpp +/// wrapper implemented at src/buntime/bindings/c-bindings.cpp pub const HPACK = extern struct { self: *anyopaque, diff --git a/src/bun.js/api/bun/process.zig b/src/buntime/api/bun/process.zig similarity index 100% rename from src/bun.js/api/bun/process.zig rename to src/buntime/api/bun/process.zig diff --git a/src/bun.js/api/bun/socket.zig b/src/buntime/api/bun/socket.zig similarity index 100% rename from src/bun.js/api/bun/socket.zig rename to src/buntime/api/bun/socket.zig diff --git a/src/bun.js/api/bun/socket/Handlers.zig b/src/buntime/api/bun/socket/Handlers.zig similarity index 100% rename from src/bun.js/api/bun/socket/Handlers.zig rename to src/buntime/api/bun/socket/Handlers.zig diff --git a/src/bun.js/api/bun/socket/Listener.zig b/src/buntime/api/bun/socket/Listener.zig similarity index 100% rename from src/bun.js/api/bun/socket/Listener.zig rename to src/buntime/api/bun/socket/Listener.zig diff --git a/src/bun.js/api/bun/socket/SocketAddress.zig b/src/buntime/api/bun/socket/SocketAddress.zig similarity index 100% rename from src/bun.js/api/bun/socket/SocketAddress.zig rename to src/buntime/api/bun/socket/SocketAddress.zig diff --git a/src/bun.js/api/bun/socket/SocketConfig.bindv2.ts b/src/buntime/api/bun/socket/SocketConfig.bindv2.ts similarity index 100% rename from src/bun.js/api/bun/socket/SocketConfig.bindv2.ts rename to src/buntime/api/bun/socket/SocketConfig.bindv2.ts diff --git a/src/bun.js/api/bun/socket/WindowsNamedPipeContext.zig b/src/buntime/api/bun/socket/WindowsNamedPipeContext.zig similarity index 100% rename from src/bun.js/api/bun/socket/WindowsNamedPipeContext.zig rename to src/buntime/api/bun/socket/WindowsNamedPipeContext.zig diff --git a/src/bun.js/api/bun/socket/tls_socket_functions.zig b/src/buntime/api/bun/socket/tls_socket_functions.zig similarity index 100% rename from src/bun.js/api/bun/socket/tls_socket_functions.zig rename to src/buntime/api/bun/socket/tls_socket_functions.zig diff --git a/src/bun.js/bindings/spawn.cpp b/src/buntime/api/bun/spawn.cpp similarity index 100% rename from src/bun.js/bindings/spawn.cpp rename to src/buntime/api/bun/spawn.cpp diff --git a/src/bun.js/api/bun/spawn.zig b/src/buntime/api/bun/spawn.zig similarity index 100% rename from src/bun.js/api/bun/spawn.zig rename to src/buntime/api/bun/spawn.zig diff --git a/src/bun.js/api/bun/spawn/stdio.zig b/src/buntime/api/bun/spawn/stdio.zig similarity index 100% rename from src/bun.js/api/bun/spawn/stdio.zig rename to src/buntime/api/bun/spawn/stdio.zig diff --git a/src/bun.js/api/bun/ssl_wrapper.zig b/src/buntime/api/bun/ssl_wrapper.zig similarity index 100% rename from src/bun.js/api/bun/ssl_wrapper.zig rename to src/buntime/api/bun/ssl_wrapper.zig diff --git a/src/bun.js/api/bun/subprocess.zig b/src/buntime/api/bun/subprocess.zig similarity index 99% rename from src/bun.js/api/bun/subprocess.zig rename to src/buntime/api/bun/subprocess.zig index b9b2e03918f9..c08a047d0990 100644 --- a/src/bun.js/api/bun/subprocess.zig +++ b/src/buntime/api/bun/subprocess.zig @@ -917,7 +917,7 @@ pub const MaxBuf = bun.io.MaxBuf; pub const spawnSync = js_bun_spawn_bindings.spawnSync; pub const spawn = js_bun_spawn_bindings.spawn; -const IPC = @import("../../ipc.zig"); +const IPC = @import("../ipc/ipc.zig"); const Terminal = @import("./Terminal.zig"); const js_bun_spawn_bindings = @import("./js_bun_spawn_bindings.zig"); const node_cluster_binding = @import("../../node/node_cluster_binding.zig"); diff --git a/src/bun.js/api/bun/subprocess/Readable.zig b/src/buntime/api/bun/subprocess/Readable.zig similarity index 100% rename from src/bun.js/api/bun/subprocess/Readable.zig rename to src/buntime/api/bun/subprocess/Readable.zig diff --git a/src/bun.js/api/bun/subprocess/ResourceUsage.zig b/src/buntime/api/bun/subprocess/ResourceUsage.zig similarity index 100% rename from src/bun.js/api/bun/subprocess/ResourceUsage.zig rename to src/buntime/api/bun/subprocess/ResourceUsage.zig diff --git a/src/bun.js/api/bun/subprocess/StaticPipeWriter.zig b/src/buntime/api/bun/subprocess/StaticPipeWriter.zig similarity index 100% rename from src/bun.js/api/bun/subprocess/StaticPipeWriter.zig rename to src/buntime/api/bun/subprocess/StaticPipeWriter.zig diff --git a/src/bun.js/api/bun/subprocess/SubprocessPipeReader.zig b/src/buntime/api/bun/subprocess/SubprocessPipeReader.zig similarity index 100% rename from src/bun.js/api/bun/subprocess/SubprocessPipeReader.zig rename to src/buntime/api/bun/subprocess/SubprocessPipeReader.zig diff --git a/src/bun.js/api/bun/subprocess/Writable.zig b/src/buntime/api/bun/subprocess/Writable.zig similarity index 100% rename from src/bun.js/api/bun/subprocess/Writable.zig rename to src/buntime/api/bun/subprocess/Writable.zig diff --git a/src/bun.js/api/bun/udp_socket.zig b/src/buntime/api/bun/udp_socket.zig similarity index 100% rename from src/bun.js/api/bun/udp_socket.zig rename to src/buntime/api/bun/udp_socket.zig diff --git a/src/bun.js/api/bun/x509.zig b/src/buntime/api/bun/x509.zig similarity index 100% rename from src/bun.js/api/bun/x509.zig rename to src/buntime/api/bun/x509.zig diff --git a/src/bun.js/bindings/ConsoleObject.cpp b/src/buntime/api/console/ConsoleObject.cpp similarity index 100% rename from src/bun.js/bindings/ConsoleObject.cpp rename to src/buntime/api/console/ConsoleObject.cpp diff --git a/src/bun.js/bindings/ConsoleObject.h b/src/buntime/api/console/ConsoleObject.h similarity index 100% rename from src/bun.js/bindings/ConsoleObject.h rename to src/buntime/api/console/ConsoleObject.h diff --git a/src/bun.js/ConsoleObject.zig b/src/buntime/api/console/ConsoleObject.zig similarity index 99% rename from src/bun.js/ConsoleObject.zig rename to src/buntime/api/console/ConsoleObject.zig index 491689ecc438..a5ba47215fa0 100644 --- a/src/bun.js/ConsoleObject.zig +++ b/src/buntime/api/console/ConsoleObject.zig @@ -1064,7 +1064,7 @@ pub const Formatter = struct { // For detecting circular references pub const Visited = struct { - const ObjectPool = @import("../pool.zig").ObjectPool; + const ObjectPool = @import("../../../pool.zig").ObjectPool; pub const Map = std.AutoHashMap(JSValue, void); pub const Pool = ObjectPool( Map, @@ -3798,8 +3798,8 @@ comptime { const string = []const u8; const std = @import("std"); -const CLI = @import("../cli.zig").Command; -const JestPrettyFormat = @import("./test/pretty_format.zig").JestPrettyFormat; +const CLI = @import("../../../cli.zig").Command; +const JestPrettyFormat = @import("../../../test_runner/pretty_format.zig").JestPrettyFormat; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/bindings/UtilInspect.cpp b/src/buntime/api/console/UtilInspect.cpp similarity index 100% rename from src/bun.js/bindings/UtilInspect.cpp rename to src/buntime/api/console/UtilInspect.cpp diff --git a/src/bun.js/bindings/UtilInspect.h b/src/buntime/api/console/UtilInspect.h similarity index 100% rename from src/bun.js/bindings/UtilInspect.h rename to src/buntime/api/console/UtilInspect.h diff --git a/src/bun.js/webcore/prompt.zig b/src/buntime/api/console/prompt.zig similarity index 100% rename from src/bun.js/webcore/prompt.zig rename to src/buntime/api/console/prompt.zig diff --git a/src/bun.js/bindings/Cookie.cpp b/src/buntime/api/cookie/Cookie.cpp similarity index 100% rename from src/bun.js/bindings/Cookie.cpp rename to src/buntime/api/cookie/Cookie.cpp diff --git a/src/bun.js/bindings/Cookie.h b/src/buntime/api/cookie/Cookie.h similarity index 100% rename from src/bun.js/bindings/Cookie.h rename to src/buntime/api/cookie/Cookie.h diff --git a/src/bun.js/bindings/CookieMap.cpp b/src/buntime/api/cookie/CookieMap.cpp similarity index 100% rename from src/bun.js/bindings/CookieMap.cpp rename to src/buntime/api/cookie/CookieMap.cpp diff --git a/src/bun.js/bindings/CookieMap.h b/src/buntime/api/cookie/CookieMap.h similarity index 100% rename from src/bun.js/bindings/CookieMap.h rename to src/buntime/api/cookie/CookieMap.h diff --git a/src/bun.js/webcore/CookieMap.zig b/src/buntime/api/cookie/CookieMap.zig similarity index 100% rename from src/bun.js/webcore/CookieMap.zig rename to src/buntime/api/cookie/CookieMap.zig diff --git a/src/bun.js/bindings/webcore/JSCookie.cpp b/src/buntime/api/cookie/JSCookie.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSCookie.cpp rename to src/buntime/api/cookie/JSCookie.cpp diff --git a/src/bun.js/bindings/webcore/JSCookie.h b/src/buntime/api/cookie/JSCookie.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCookie.h rename to src/buntime/api/cookie/JSCookie.h diff --git a/src/bun.js/bindings/webcore/JSCookieMap.cpp b/src/buntime/api/cookie/JSCookieMap.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSCookieMap.cpp rename to src/buntime/api/cookie/JSCookieMap.cpp diff --git a/src/bun.js/bindings/webcore/JSCookieMap.h b/src/buntime/api/cookie/JSCookieMap.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCookieMap.h rename to src/buntime/api/cookie/JSCookieMap.h diff --git a/src/bun.js/api/crypto.classes.ts b/src/buntime/api/crypto.classes.ts similarity index 100% rename from src/bun.js/api/crypto.classes.ts rename to src/buntime/api/crypto.classes.ts diff --git a/src/bun.js/api/crypto.zig b/src/buntime/api/crypto.zig similarity index 100% rename from src/bun.js/api/crypto.zig rename to src/buntime/api/crypto.zig diff --git a/src/bun.js/api/crypto/CryptoHasher.zig b/src/buntime/api/crypto/CryptoHasher.zig similarity index 100% rename from src/bun.js/api/crypto/CryptoHasher.zig rename to src/buntime/api/crypto/CryptoHasher.zig diff --git a/src/bun.js/api/crypto/EVP.zig b/src/buntime/api/crypto/EVP.zig similarity index 100% rename from src/bun.js/api/crypto/EVP.zig rename to src/buntime/api/crypto/EVP.zig diff --git a/src/bun.js/api/crypto/HMAC.zig b/src/buntime/api/crypto/HMAC.zig similarity index 100% rename from src/bun.js/api/crypto/HMAC.zig rename to src/buntime/api/crypto/HMAC.zig diff --git a/src/bun.js/api/crypto/PBKDF2.zig b/src/buntime/api/crypto/PBKDF2.zig similarity index 100% rename from src/bun.js/api/crypto/PBKDF2.zig rename to src/buntime/api/crypto/PBKDF2.zig diff --git a/src/bun.js/api/crypto/PasswordObject.zig b/src/buntime/api/crypto/PasswordObject.zig similarity index 100% rename from src/bun.js/api/crypto/PasswordObject.zig rename to src/buntime/api/crypto/PasswordObject.zig diff --git a/src/bun.js/BuildMessage.zig b/src/buntime/api/error/BuildMessage.zig similarity index 98% rename from src/bun.js/BuildMessage.zig rename to src/buntime/api/error/BuildMessage.zig index 8855b9ef380d..7f74e73d0ff9 100644 --- a/src/bun.js/BuildMessage.zig +++ b/src/buntime/api/error/BuildMessage.zig @@ -190,7 +190,7 @@ pub const BuildMessage = struct { const string = []const u8; const std = @import("std"); -const Resolver = @import("../resolver//resolver.zig").Resolver; +const Resolver = @import("../../../resolver/resolver.zig").Resolver; const bun = @import("bun"); const default_allocator = bun.default_allocator; diff --git a/src/bun.js/bindings/CallSite.cpp b/src/buntime/api/error/CallSite.cpp similarity index 100% rename from src/bun.js/bindings/CallSite.cpp rename to src/buntime/api/error/CallSite.cpp diff --git a/src/bun.js/bindings/CallSite.h b/src/buntime/api/error/CallSite.h similarity index 100% rename from src/bun.js/bindings/CallSite.h rename to src/buntime/api/error/CallSite.h diff --git a/src/bun.js/bindings/CallSitePrototype.cpp b/src/buntime/api/error/CallSitePrototype.cpp similarity index 100% rename from src/bun.js/bindings/CallSitePrototype.cpp rename to src/buntime/api/error/CallSitePrototype.cpp diff --git a/src/bun.js/bindings/CallSitePrototype.h b/src/buntime/api/error/CallSitePrototype.h similarity index 100% rename from src/bun.js/bindings/CallSitePrototype.h rename to src/buntime/api/error/CallSitePrototype.h diff --git a/src/bun.js/bindings/DOMException.cpp b/src/buntime/api/error/DOMException.cpp similarity index 100% rename from src/bun.js/bindings/DOMException.cpp rename to src/buntime/api/error/DOMException.cpp diff --git a/src/bun.js/bindings/DOMException.h b/src/buntime/api/error/DOMException.h similarity index 100% rename from src/bun.js/bindings/DOMException.h rename to src/buntime/api/error/DOMException.h diff --git a/src/bun.js/bindings/DeferredError.zig b/src/buntime/api/error/DeferredError.zig similarity index 94% rename from src/bun.js/bindings/DeferredError.zig rename to src/buntime/api/error/DeferredError.zig index 17c3e0987e32..28bb72bde09d 100644 --- a/src/bun.js/bindings/DeferredError.zig +++ b/src/buntime/api/error/DeferredError.zig @@ -27,7 +27,7 @@ pub const DeferredError = struct { }; const bun = @import("bun"); -const ZigString = @import("./ZigString.zig").ZigString; +const ZigString = @import("../../jsc/interop/ZigString.zig").ZigString; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/bun.js/bindings/webcore/ErrorCallback.cpp b/src/buntime/api/error/ErrorCallback.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ErrorCallback.cpp rename to src/buntime/api/error/ErrorCallback.cpp diff --git a/src/bun.js/bindings/webcore/ErrorCallback.h b/src/buntime/api/error/ErrorCallback.h similarity index 100% rename from src/bun.js/bindings/webcore/ErrorCallback.h rename to src/buntime/api/error/ErrorCallback.h diff --git a/src/bun.js/bindings/webcore/ErrorCallback.idl b/src/buntime/api/error/ErrorCallback.idl similarity index 100% rename from src/bun.js/bindings/webcore/ErrorCallback.idl rename to src/buntime/api/error/ErrorCallback.idl diff --git a/src/bun.js/bindings/ErrorCode.cpp b/src/buntime/api/error/ErrorCode.cpp similarity index 100% rename from src/bun.js/bindings/ErrorCode.cpp rename to src/buntime/api/error/ErrorCode.cpp diff --git a/src/bun.js/bindings/ErrorCode.h b/src/buntime/api/error/ErrorCode.h similarity index 100% rename from src/bun.js/bindings/ErrorCode.h rename to src/buntime/api/error/ErrorCode.h diff --git a/src/bun.js/bindings/ErrorCode.ts b/src/buntime/api/error/ErrorCode.ts similarity index 100% rename from src/bun.js/bindings/ErrorCode.ts rename to src/buntime/api/error/ErrorCode.ts diff --git a/src/bun.js/bindings/ErrorCode.zig b/src/buntime/api/error/ErrorCode.zig similarity index 100% rename from src/bun.js/bindings/ErrorCode.zig rename to src/buntime/api/error/ErrorCode.zig diff --git a/src/bun.js/bindings/ErrorStackFrame.cpp b/src/buntime/api/error/ErrorStackFrame.cpp similarity index 100% rename from src/bun.js/bindings/ErrorStackFrame.cpp rename to src/buntime/api/error/ErrorStackFrame.cpp diff --git a/src/bun.js/bindings/ErrorStackFrame.h b/src/buntime/api/error/ErrorStackFrame.h similarity index 100% rename from src/bun.js/bindings/ErrorStackFrame.h rename to src/buntime/api/error/ErrorStackFrame.h diff --git a/src/bun.js/bindings/ErrorStackTrace.cpp b/src/buntime/api/error/ErrorStackTrace.cpp similarity index 100% rename from src/bun.js/bindings/ErrorStackTrace.cpp rename to src/buntime/api/error/ErrorStackTrace.cpp diff --git a/src/bun.js/bindings/ErrorStackTrace.h b/src/buntime/api/error/ErrorStackTrace.h similarity index 100% rename from src/bun.js/bindings/ErrorStackTrace.h rename to src/buntime/api/error/ErrorStackTrace.h diff --git a/src/bun.js/bindings/Errorable.zig b/src/buntime/api/error/Errorable.zig similarity index 100% rename from src/bun.js/bindings/Errorable.zig rename to src/buntime/api/error/Errorable.zig diff --git a/src/bun.js/bindings/webcore/ExceptionDetails.h b/src/buntime/api/error/ExceptionDetails.h similarity index 100% rename from src/bun.js/bindings/webcore/ExceptionDetails.h rename to src/buntime/api/error/ExceptionDetails.h diff --git a/src/bun.js/bindings/FormatStackTraceForJS.cpp b/src/buntime/api/error/FormatStackTraceForJS.cpp similarity index 100% rename from src/bun.js/bindings/FormatStackTraceForJS.cpp rename to src/buntime/api/error/FormatStackTraceForJS.cpp diff --git a/src/bun.js/bindings/FormatStackTraceForJS.h b/src/buntime/api/error/FormatStackTraceForJS.h similarity index 100% rename from src/bun.js/bindings/FormatStackTraceForJS.h rename to src/buntime/api/error/FormatStackTraceForJS.h diff --git a/src/bun.js/bindings/webcore/JSDOMException.cpp b/src/buntime/api/error/JSDOMException.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMException.cpp rename to src/buntime/api/error/JSDOMException.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMException.h b/src/buntime/api/error/JSDOMException.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMException.h rename to src/buntime/api/error/JSDOMException.h diff --git a/src/bun.js/bindings/webcore/JSErrorCallback.cpp b/src/buntime/api/error/JSErrorCallback.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorCallback.cpp rename to src/buntime/api/error/JSErrorCallback.cpp diff --git a/src/bun.js/bindings/webcore/JSErrorCallback.h b/src/buntime/api/error/JSErrorCallback.h similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorCallback.h rename to src/buntime/api/error/JSErrorCallback.h diff --git a/src/bun.js/bindings/JSErrorCode.zig b/src/buntime/api/error/JSErrorCode.zig similarity index 96% rename from src/bun.js/bindings/JSErrorCode.zig rename to src/buntime/api/error/JSErrorCode.zig index d62090bf9344..135ba52c9736 100644 --- a/src/bun.js/bindings/JSErrorCode.zig +++ b/src/buntime/api/error/JSErrorCode.zig @@ -17,7 +17,7 @@ pub const JSErrorCode = enum(u8) { _, }; -// keep in sync with ExceptionCode in src/bun.js/bindings/ExceptionCode.h +// keep in sync with ExceptionCode in src/buntime/bindings/ExceptionCode.h pub const DOMExceptionCode = enum(u8) { // DOMException error names (https://webidl.spec.whatwg.org/#idl-DOMException-error-names). // Those need to be kept in sync with the array in DOMException.cpp. diff --git a/src/bun.js/bindings/webcore/JSErrorHandler.cpp b/src/buntime/api/error/JSErrorHandler.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorHandler.cpp rename to src/buntime/api/error/JSErrorHandler.cpp diff --git a/src/bun.js/bindings/webcore/JSErrorHandler.h b/src/buntime/api/error/JSErrorHandler.h similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorHandler.h rename to src/buntime/api/error/JSErrorHandler.h diff --git a/src/bun.js/ResolveMessage.zig b/src/buntime/api/error/ResolveMessage.zig similarity index 99% rename from src/bun.js/ResolveMessage.zig rename to src/buntime/api/error/ResolveMessage.zig index c7707cb6938c..482778810a52 100644 --- a/src/bun.js/ResolveMessage.zig +++ b/src/buntime/api/error/ResolveMessage.zig @@ -231,7 +231,7 @@ pub const ResolveMessage = struct { const string = []const u8; -const Resolver = @import("../resolver//resolver.zig"); +const Resolver = @import("../../../resolver/resolver.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/bindings/SystemError.zig b/src/buntime/api/error/SystemError.zig similarity index 100% rename from src/bun.js/bindings/SystemError.zig rename to src/buntime/api/error/SystemError.zig diff --git a/src/bun.js/bindings/ZigErrorType.zig b/src/buntime/api/error/ZigErrorType.zig similarity index 100% rename from src/bun.js/bindings/ZigErrorType.zig rename to src/buntime/api/error/ZigErrorType.zig diff --git a/src/bun.js/bindings/ZigException.cpp b/src/buntime/api/error/ZigException.cpp similarity index 100% rename from src/bun.js/bindings/ZigException.cpp rename to src/buntime/api/error/ZigException.cpp diff --git a/src/bun.js/bindings/ZigException.zig b/src/buntime/api/error/ZigException.zig similarity index 99% rename from src/bun.js/bindings/ZigException.zig rename to src/buntime/api/error/ZigException.zig index 0adb68a4bf68..874255eeee5f 100644 --- a/src/bun.js/bindings/ZigException.zig +++ b/src/buntime/api/error/ZigException.zig @@ -167,7 +167,7 @@ pub const ZigException = extern struct { const string = []const u8; const std = @import("std"); -const ZigURL = @import("../../url.zig").URL; +const ZigURL = @import("../../../url.zig").URL; const bun = @import("bun"); const String = bun.String; diff --git a/src/bun.js/bindings/ZigStackFrame.zig b/src/buntime/api/error/ZigStackFrame.zig similarity index 99% rename from src/bun.js/bindings/ZigStackFrame.zig rename to src/buntime/api/error/ZigStackFrame.zig index d7da652b6773..75f2c9b5a2f8 100644 --- a/src/bun.js/bindings/ZigStackFrame.zig +++ b/src/buntime/api/error/ZigStackFrame.zig @@ -239,7 +239,7 @@ pub const ZigStackFrame = extern struct { }; const std = @import("std"); -const ZigURL = @import("../../url.zig").URL; +const ZigURL = @import("../../../url.zig").URL; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/bun.js/bindings/ZigStackFrameCode.zig b/src/buntime/api/error/ZigStackFrameCode.zig similarity index 100% rename from src/bun.js/bindings/ZigStackFrameCode.zig rename to src/buntime/api/error/ZigStackFrameCode.zig diff --git a/src/bun.js/bindings/ZigStackFramePosition.zig b/src/buntime/api/error/ZigStackFramePosition.zig similarity index 100% rename from src/bun.js/bindings/ZigStackFramePosition.zig rename to src/buntime/api/error/ZigStackFramePosition.zig diff --git a/src/bun.js/bindings/ZigStackTrace.zig b/src/buntime/api/error/ZigStackTrace.zig similarity index 99% rename from src/bun.js/bindings/ZigStackTrace.zig rename to src/buntime/api/error/ZigStackTrace.zig index 8435853c24e7..c31fb7431100 100644 --- a/src/bun.js/bindings/ZigStackTrace.zig +++ b/src/buntime/api/error/ZigStackTrace.zig @@ -139,7 +139,7 @@ pub const ZigStackTrace = extern struct { }; const std = @import("std"); -const ZigURL = @import("../../url.zig").URL; +const ZigURL = @import("../../../url.zig").URL; const bun = @import("bun"); const api = bun.schema.api; diff --git a/src/bun.js/api/ffi-stdalign.h b/src/buntime/api/ffi-stdalign.h similarity index 100% rename from src/bun.js/api/ffi-stdalign.h rename to src/buntime/api/ffi-stdalign.h diff --git a/src/bun.js/api/ffi-stdarg.h b/src/buntime/api/ffi-stdarg.h similarity index 100% rename from src/bun.js/api/ffi-stdarg.h rename to src/buntime/api/ffi-stdarg.h diff --git a/src/buntime/api/ffi-stdatomic.h b/src/buntime/api/ffi-stdatomic.h new file mode 100644 index 000000000000..0a86d4d1ee44 --- /dev/null +++ b/src/buntime/api/ffi-stdatomic.h @@ -0,0 +1,180 @@ +/* This file is derived from clang's stdatomic.h */ + +/*===---- stdatomic.h - Standard header for atomic types and operations -----=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef _STDATOMIC_H +#define _STDATOMIC_H + +#include +#include +#include + +#define __ATOMIC_RELAXED 0 +#define __ATOMIC_CONSUME 1 +#define __ATOMIC_ACQUIRE 2 +#define __ATOMIC_RELEASE 3 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_SEQ_CST 5 + +/* Memory ordering */ +typedef enum { + memory_order_relaxed = __ATOMIC_RELAXED, + memory_order_consume = __ATOMIC_CONSUME, + memory_order_acquire = __ATOMIC_ACQUIRE, + memory_order_release = __ATOMIC_RELEASE, + memory_order_acq_rel = __ATOMIC_ACQ_REL, + memory_order_seq_cst = __ATOMIC_SEQ_CST, +} memory_order; + +/* Atomic typedefs */ +typedef _Atomic(_Bool) atomic_bool; +typedef _Atomic(char) atomic_char; +typedef _Atomic(signed char) atomic_schar; +typedef _Atomic(unsigned char) atomic_uchar; +typedef _Atomic(short) atomic_short; +typedef _Atomic(unsigned short) atomic_ushort; +typedef _Atomic(int) atomic_int; +typedef _Atomic(unsigned int) atomic_uint; +typedef _Atomic(long) atomic_long; +typedef _Atomic(unsigned long) atomic_ulong; +typedef _Atomic(long long) atomic_llong; +typedef _Atomic(unsigned long long) atomic_ullong; +typedef _Atomic(uint_least16_t) atomic_char16_t; +typedef _Atomic(uint_least32_t) atomic_char32_t; +typedef _Atomic(wchar_t) atomic_wchar_t; +typedef _Atomic(int_least8_t) atomic_int_least8_t; +typedef _Atomic(uint_least8_t) atomic_uint_least8_t; +typedef _Atomic(int_least16_t) atomic_int_least16_t; +typedef _Atomic(uint_least16_t) atomic_uint_least16_t; +typedef _Atomic(int_least32_t) atomic_int_least32_t; +typedef _Atomic(uint_least32_t) atomic_uint_least32_t; +typedef _Atomic(int_least64_t) atomic_int_least64_t; +typedef _Atomic(uint_least64_t) atomic_uint_least64_t; +typedef _Atomic(int_fast8_t) atomic_int_fast8_t; +typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t; +typedef _Atomic(int_fast16_t) atomic_int_fast16_t; +typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t; +typedef _Atomic(int_fast32_t) atomic_int_fast32_t; +typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t; +typedef _Atomic(int_fast64_t) atomic_int_fast64_t; +typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t; +typedef _Atomic(intptr_t) atomic_intptr_t; +typedef _Atomic(uintptr_t) atomic_uintptr_t; +typedef _Atomic(size_t) atomic_size_t; +typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t; +typedef _Atomic(intmax_t) atomic_intmax_t; +typedef _Atomic(uintmax_t) atomic_uintmax_t; + +/* Atomic flag */ +typedef struct { + atomic_bool value; +} atomic_flag; + +#define ATOMIC_FLAG_INIT { 0 } +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_flag_test_and_set_explicit(object, order) \ + __atomic_test_and_set((void*)(&((object)->value)), order) +#define atomic_flag_test_and_set(object) \ + atomic_flag_test_and_set_explicit(object, __ATOMIC_SEQ_CST) + +#define atomic_flag_clear_explicit(object, order) \ + __atomic_clear((bool*)(&((object)->value)), order) +#define atomic_flag_clear(object) \ + atomic_flag_clear_explicit(object, __ATOMIC_SEQ_CST) + +/* Generic routines */ +#define atomic_init(object, desired) \ + atomic_store_explicit(object, desired, __ATOMIC_RELAXED) + +#define atomic_store_explicit(object, desired, order) \ + ({ \ + __typeof__(object) ptr = (object); \ + __typeof__(*ptr) tmp = (desired); \ + __atomic_store(ptr, &tmp, (order)); \ + }) +#define atomic_store(object, desired) \ + atomic_store_explicit(object, desired, __ATOMIC_SEQ_CST) + +#define atomic_load_explicit(object, order) \ + ({ \ + __typeof__(object) ptr = (object); \ + __typeof__(*ptr) tmp; \ + __atomic_load(ptr, &tmp, (order)); \ + tmp; \ + }) +#define atomic_load(object) atomic_load_explicit(object, __ATOMIC_SEQ_CST) + +#define atomic_exchange_explicit(object, desired, order) \ + ({ \ + __typeof__(object) ptr = (object); \ + __typeof__(*ptr) val = (desired); \ + __typeof__(*ptr) tmp; \ + __atomic_exchange(ptr, &val, &tmp, (order)); \ + tmp; \ + }) +#define atomic_exchange(object, desired) \ + atomic_exchange_explicit(object, desired, __ATOMIC_SEQ_CST) + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, \ + success, failure) \ + ({ \ + __typeof__(object) ptr = (object); \ + __typeof__(*ptr) tmp = desired; \ + __atomic_compare_exchange(ptr, expected, &tmp, 0, success, failure); \ + }) +#define atomic_compare_exchange_strong(object, expected, desired) \ + atomic_compare_exchange_strong_explicit(object, expected, desired, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, \ + success, failure) \ + ({ \ + __typeof__(object) ptr = (object); \ + __typeof__(*ptr) tmp = desired; \ + __atomic_compare_exchange(ptr, expected, &tmp, 1, success, failure); \ + }) +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_weak_explicit(object, expected, desired, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) + +#define atomic_fetch_add(object, operand) \ + __atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_add_explicit __atomic_fetch_add + +#define atomic_fetch_sub(object, operand) \ + __atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_sub_explicit __atomic_fetch_sub + +#define atomic_fetch_or(object, operand) \ + __atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_or_explicit __atomic_fetch_or + +#define atomic_fetch_xor(object, operand) \ + __atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_xor_explicit __atomic_fetch_xor + +#define atomic_fetch_and(object, operand) \ + __atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_and_explicit __atomic_fetch_and + +extern void atomic_thread_fence(memory_order); +extern void __atomic_thread_fence(memory_order); +#define atomic_thread_fence(order) __atomic_thread_fence(order) +extern void atomic_signal_fence(memory_order); +extern void __atomic_signal_fence(memory_order); +#define atomic_signal_fence(order) __atomic_signal_fence(order) +extern bool __atomic_is_lock_free(size_t size, void* ptr); +#define atomic_is_lock_free(OBJ) __atomic_is_lock_free(sizeof(*(OBJ)), (OBJ)) + +extern bool __atomic_test_and_set(void*, memory_order); +extern void __atomic_clear(bool*, memory_order); + +#endif /* _STDATOMIC_H */ diff --git a/src/bun.js/api/ffi-stdbool.h b/src/buntime/api/ffi-stdbool.h similarity index 100% rename from src/bun.js/api/ffi-stdbool.h rename to src/buntime/api/ffi-stdbool.h diff --git a/src/bun.js/api/ffi-stddef.h b/src/buntime/api/ffi-stddef.h similarity index 86% rename from src/bun.js/api/ffi-stddef.h rename to src/buntime/api/ffi-stddef.h index 6356a5c81003..6be7533832ed 100644 --- a/src/bun.js/api/ffi-stddef.h +++ b/src/buntime/api/ffi-stddef.h @@ -10,20 +10,20 @@ typedef __SIZE_TYPE__ uintptr_t; #if __STDC_VERSION__ >= 201112L typedef union { - long long __ll; - long double __ld; + long long __ll; + long double __ld; } max_align_t; #endif #ifndef NULL -#define NULL ((void *)0) +#define NULL ((void*)0) #endif #undef offsetof -#define offsetof(type, field) ((size_t) & ((type *)0)->field) +#define offsetof(type, field) ((size_t)&((type*)0)->field) #if defined __i386__ || defined __x86_64__ -void *alloca(size_t size); +void* alloca(size_t size); #endif #endif diff --git a/src/bun.js/api/ffi-stdnoreturn.h b/src/buntime/api/ffi-stdnoreturn.h similarity index 100% rename from src/bun.js/api/ffi-stdnoreturn.h rename to src/buntime/api/ffi-stdnoreturn.h diff --git a/src/bun.js/api/ffi-tgmath.h b/src/buntime/api/ffi-tgmath.h similarity index 79% rename from src/bun.js/api/ffi-tgmath.h rename to src/buntime/api/ffi-tgmath.h index 85d81222cb02..0e5f7b3af40a 100644 --- a/src/bun.js/api/ffi-tgmath.h +++ b/src/buntime/api/ffi-tgmath.h @@ -8,16 +8,16 @@ #include #ifndef __cplusplus -#define __tgmath_real(x, F) \ - _Generic((x), float: F##f, long double: F##l, default: F)(x) -#define __tgmath_real_2_1(x, y, F) \ - _Generic((x), float: F##f, long double: F##l, default: F)(x, y) -#define __tgmath_real_2(x, y, F) \ - _Generic((x) + (y), float: F##f, long double: F##l, default: F)(x, y) -#define __tgmath_real_3_2(x, y, z, F) \ - _Generic((x) + (y), float: F##f, long double: F##l, default: F)(x, y, z) -#define __tgmath_real_3(x, y, z, F) \ - _Generic((x) + (y) + (z), float: F##f, long double: F##l, default: F)(x, y, z) +#define __tgmath_real(x, F) \ + _Generic((x), float: F##f, long double: F##l, default: F)(x) +#define __tgmath_real_2_1(x, y, F) \ + _Generic((x), float: F##f, long double: F##l, default: F)(x, y) +#define __tgmath_real_2(x, y, F) \ + _Generic((x) + (y), float: F##f, long double: F##l, default: F)(x, y) +#define __tgmath_real_3_2(x, y, z, F) \ + _Generic((x) + (y), float: F##f, long double: F##l, default: F)(x, y, z) +#define __tgmath_real_3(x, y, z, F) \ + _Generic((x) + (y) + (z), float: F##f, long double: F##l, default: F)(x, y, z) /* Functions defined in both and (7.22p4) */ #define acos(z) __tgmath_real(z, acos) diff --git a/src/bun.js/api/ffi.classes.ts b/src/buntime/api/ffi.classes.ts similarity index 100% rename from src/bun.js/api/ffi.classes.ts rename to src/buntime/api/ffi.classes.ts diff --git a/src/bun.js/api/ffi.zig b/src/buntime/api/ffi.zig similarity index 99% rename from src/bun.js/api/ffi.zig rename to src/buntime/api/ffi.zig index 24a12e6929c8..8e31be511501 100644 --- a/src/bun.js/api/ffi.zig +++ b/src/buntime/api/ffi.zig @@ -2403,7 +2403,7 @@ const CompilerRT = struct { }; } - const Sizes = @import("../bindings/sizes.zig"); + const Sizes = @import("../jsc/interop/sizes.zig"); const offsets = Offsets.get(); state.defineSymbolsComptime(.{ .Bun_FFI_PointerOffsetToArgumentsList = Sizes.Bun_FFI_PointerOffsetToArgumentsList, diff --git a/src/bun.js/bindings/DLHandleMap.h b/src/buntime/api/ffi/DLHandleMap.h similarity index 100% rename from src/bun.js/bindings/DLHandleMap.h rename to src/buntime/api/ffi/DLHandleMap.h diff --git a/src/bun.js/bindings/FFI.zig b/src/buntime/api/ffi/FFI.zig similarity index 99% rename from src/bun.js/bindings/FFI.zig rename to src/buntime/api/ffi/FFI.zig index 35c0425916ab..3d703ecf15ca 100644 --- a/src/bun.js/bindings/FFI.zig +++ b/src/buntime/api/ffi/FFI.zig @@ -133,7 +133,7 @@ pub const __nonnull = @compileError("unable to translate macro: undefined identi pub const __null_unspecified = @compileError("unable to translate macro: undefined identifier `_Null_unspecified`"); // (no file):323:9 pub const __nullable = @compileError("unable to translate macro: undefined identifier `_Nullable`"); // (no file):324:9 pub const __weak = @compileError("unable to translate macro: undefined identifier `__attribute__`"); // (no file):382:9 -pub const LOAD_ARGUMENTS_FROM_CALL_FRAME = @compileError("unable to translate macro: undefined identifier `argsPtr`"); // /Users/jarred/Code/bun/src/bun.js/api/FFI.h:95:9 +pub const LOAD_ARGUMENTS_FROM_CALL_FRAME = @compileError("unable to translate macro: undefined identifier `argsPtr`"); // /Users/jarred/Code/bun/src/buntime/api/FFI.h:95:9 pub const __llvm__ = @as(c_int, 1); pub const __clang__ = @as(c_int, 1); pub const __clang_major__ = @as(c_int, 13); diff --git a/src/bun.js/bindings/JSFFIFunction.cpp b/src/buntime/api/ffi/JSFFIFunction.cpp similarity index 100% rename from src/bun.js/bindings/JSFFIFunction.cpp rename to src/buntime/api/ffi/JSFFIFunction.cpp diff --git a/src/bun.js/bindings/JSFFIFunction.h b/src/buntime/api/ffi/JSFFIFunction.h similarity index 100% rename from src/bun.js/bindings/JSFFIFunction.h rename to src/buntime/api/ffi/JSFFIFunction.h diff --git a/src/bun.js/bindings/ffi.cpp b/src/buntime/api/ffi/ffi.cpp similarity index 100% rename from src/bun.js/bindings/ffi.cpp rename to src/buntime/api/ffi/ffi.cpp diff --git a/src/bun.js/api/filesystem_router.classes.ts b/src/buntime/api/filesystem_router.classes.ts similarity index 100% rename from src/bun.js/api/filesystem_router.classes.ts rename to src/buntime/api/filesystem_router.classes.ts diff --git a/src/bun.js/api/filesystem_router.zig b/src/buntime/api/filesystem_router.zig similarity index 100% rename from src/bun.js/api/filesystem_router.zig rename to src/buntime/api/filesystem_router.zig diff --git a/src/bun.js/api/glob.zig b/src/buntime/api/glob.zig similarity index 100% rename from src/bun.js/api/glob.zig rename to src/buntime/api/glob.zig diff --git a/src/bun.js/api/h2.classes.ts b/src/buntime/api/h2.classes.ts similarity index 100% rename from src/bun.js/api/h2.classes.ts rename to src/buntime/api/h2.classes.ts diff --git a/src/bun.js/api/html_rewriter.classes.ts b/src/buntime/api/html_rewriter.classes.ts similarity index 100% rename from src/bun.js/api/html_rewriter.classes.ts rename to src/buntime/api/html_rewriter.classes.ts diff --git a/src/bun.js/api/html_rewriter.zig b/src/buntime/api/html_rewriter.zig similarity index 100% rename from src/bun.js/api/html_rewriter.zig rename to src/buntime/api/html_rewriter.zig diff --git a/src/bun.js/bindings/BunCPUProfiler.cpp b/src/buntime/api/inspector/BunCPUProfiler.cpp similarity index 100% rename from src/bun.js/bindings/BunCPUProfiler.cpp rename to src/buntime/api/inspector/BunCPUProfiler.cpp diff --git a/src/bun.js/bindings/BunCPUProfiler.h b/src/buntime/api/inspector/BunCPUProfiler.h similarity index 100% rename from src/bun.js/bindings/BunCPUProfiler.h rename to src/buntime/api/inspector/BunCPUProfiler.h diff --git a/src/bun.js/bindings/BunCPUProfiler.zig b/src/buntime/api/inspector/BunCPUProfiler.zig similarity index 100% rename from src/bun.js/bindings/BunCPUProfiler.zig rename to src/buntime/api/inspector/BunCPUProfiler.zig diff --git a/src/bun.js/bindings/BunDebugger.cpp b/src/buntime/api/inspector/BunDebugger.cpp similarity index 100% rename from src/bun.js/bindings/BunDebugger.cpp rename to src/buntime/api/inspector/BunDebugger.cpp diff --git a/src/bun.js/bindings/BunInjectedScriptHost.cpp b/src/buntime/api/inspector/BunInjectedScriptHost.cpp similarity index 100% rename from src/bun.js/bindings/BunInjectedScriptHost.cpp rename to src/buntime/api/inspector/BunInjectedScriptHost.cpp diff --git a/src/bun.js/bindings/BunInjectedScriptHost.h b/src/buntime/api/inspector/BunInjectedScriptHost.h similarity index 100% rename from src/bun.js/bindings/BunInjectedScriptHost.h rename to src/buntime/api/inspector/BunInjectedScriptHost.h diff --git a/src/bun.js/bindings/BunInspector.cpp b/src/buntime/api/inspector/BunInspector.cpp similarity index 100% rename from src/bun.js/bindings/BunInspector.cpp rename to src/buntime/api/inspector/BunInspector.cpp diff --git a/src/bun.js/Debugger.zig b/src/buntime/api/inspector/Debugger.zig similarity index 98% rename from src/bun.js/Debugger.zig rename to src/buntime/api/inspector/Debugger.zig index 596d1b21e862..1fae2b596521 100644 --- a/src/bun.js/Debugger.zig +++ b/src/buntime/api/inspector/Debugger.zig @@ -432,10 +432,10 @@ pub const LifecycleAgent = struct { }; pub const DebuggerId = bun.GenericIndex(i32, Debugger); -pub const BunFrontendDevServerAgent = @import("./api/server/InspectorBunFrontendDevServerAgent.zig").BunFrontendDevServerAgent; -pub const HTTPServerAgent = @import("./bindings/HTTPServerAgent.zig"); +pub const BunFrontendDevServerAgent = @import("../server/InspectorBunFrontendDevServerAgent.zig").BunFrontendDevServerAgent; +pub const HTTPServerAgent = @import("../server/HTTPServerAgent.zig"); -const DotEnv = @import("../env_loader.zig"); +const DotEnv = @import("../../../env_loader.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp b/src/buntime/api/inspector/InspectorBunFrontendDevServerAgent.cpp similarity index 100% rename from src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp rename to src/buntime/api/inspector/InspectorBunFrontendDevServerAgent.cpp diff --git a/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.h b/src/buntime/api/inspector/InspectorBunFrontendDevServerAgent.h similarity index 100% rename from src/bun.js/bindings/InspectorBunFrontendDevServerAgent.h rename to src/buntime/api/inspector/InspectorBunFrontendDevServerAgent.h diff --git a/src/bun.js/bindings/InspectorHTTPServerAgent.cpp b/src/buntime/api/inspector/InspectorHTTPServerAgent.cpp similarity index 100% rename from src/bun.js/bindings/InspectorHTTPServerAgent.cpp rename to src/buntime/api/inspector/InspectorHTTPServerAgent.cpp diff --git a/src/bun.js/bindings/InspectorHTTPServerAgent.h b/src/buntime/api/inspector/InspectorHTTPServerAgent.h similarity index 100% rename from src/bun.js/bindings/InspectorHTTPServerAgent.h rename to src/buntime/api/inspector/InspectorHTTPServerAgent.h diff --git a/src/bun.js/bindings/InspectorLifecycleAgent.cpp b/src/buntime/api/inspector/InspectorLifecycleAgent.cpp similarity index 100% rename from src/bun.js/bindings/InspectorLifecycleAgent.cpp rename to src/buntime/api/inspector/InspectorLifecycleAgent.cpp diff --git a/src/bun.js/bindings/InspectorLifecycleAgent.h b/src/buntime/api/inspector/InspectorLifecycleAgent.h similarity index 100% rename from src/bun.js/bindings/InspectorLifecycleAgent.h rename to src/buntime/api/inspector/InspectorLifecycleAgent.h diff --git a/src/bun.js/bindings/InspectorTestReporterAgent.cpp b/src/buntime/api/inspector/InspectorTestReporterAgent.cpp similarity index 100% rename from src/bun.js/bindings/InspectorTestReporterAgent.cpp rename to src/buntime/api/inspector/InspectorTestReporterAgent.cpp diff --git a/src/bun.js/bindings/InspectorTestReporterAgent.h b/src/buntime/api/inspector/InspectorTestReporterAgent.h similarity index 100% rename from src/bun.js/bindings/InspectorTestReporterAgent.h rename to src/buntime/api/inspector/InspectorTestReporterAgent.h diff --git a/src/bun.js/bindings/debug-helpers.h b/src/buntime/api/inspector/debug-helpers.h similarity index 100% rename from src/bun.js/bindings/debug-helpers.h rename to src/buntime/api/inspector/debug-helpers.h diff --git a/src/bun.js/bindings/generated_perf_trace_events.h b/src/buntime/api/inspector/generated_perf_trace_events.h similarity index 100% rename from src/bun.js/bindings/generated_perf_trace_events.h rename to src/buntime/api/inspector/generated_perf_trace_events.h diff --git a/src/bun.js/bindings/linux_perf_tracing.cpp b/src/buntime/api/inspector/linux_perf_tracing.cpp similarity index 100% rename from src/bun.js/bindings/linux_perf_tracing.cpp rename to src/buntime/api/inspector/linux_perf_tracing.cpp diff --git a/src/bun.js/bindings/IPC.cpp b/src/buntime/api/ipc/IPC.cpp similarity index 100% rename from src/bun.js/bindings/IPC.cpp rename to src/buntime/api/ipc/IPC.cpp diff --git a/src/bun.js/ipc.zig b/src/buntime/api/ipc/ipc.zig similarity index 99% rename from src/bun.js/ipc.zig rename to src/buntime/api/ipc/ipc.zig index 2cfe41a4da54..688c6f24c5d1 100644 --- a/src/bun.js/ipc.zig +++ b/src/buntime/api/ipc/ipc.zig @@ -1494,9 +1494,9 @@ pub fn ipcParse(globalObject: *jsc.JSGlobalObject, target: jsc.JSValue, serializ const string = []const u8; -const node_cluster_binding = @import("./node/node_cluster_binding.zig"); +const node_cluster_binding = @import("../../node/node_cluster_binding.zig"); const std = @import("std"); -const JSONLineBuffer = @import("./JSONLineBuffer.zig").JSONLineBuffer; +const JSONLineBuffer = @import("../../JSONLineBuffer.zig").JSONLineBuffer; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/api/libtcc1.a.macos-aarch64 b/src/buntime/api/libtcc1.a.macos-aarch64 similarity index 100% rename from src/bun.js/api/libtcc1.a.macos-aarch64 rename to src/buntime/api/libtcc1.a.macos-aarch64 diff --git a/src/bun.js/api/libtcc1.c b/src/buntime/api/libtcc1.c similarity index 100% rename from src/bun.js/api/libtcc1.c rename to src/buntime/api/libtcc1.c diff --git a/src/bun.js/bindings/BunPlugin.cpp b/src/buntime/api/plugin/BunPlugin.cpp similarity index 100% rename from src/bun.js/bindings/BunPlugin.cpp rename to src/buntime/api/plugin/BunPlugin.cpp diff --git a/src/bun.js/bindings/BunPlugin.h b/src/buntime/api/plugin/BunPlugin.h similarity index 100% rename from src/bun.js/bindings/BunPlugin.h rename to src/buntime/api/plugin/BunPlugin.h diff --git a/src/bun.js/bindings/JSBundler+BunPlugin-impl.h b/src/buntime/api/plugin/JSBundler+BunPlugin-impl.h similarity index 100% rename from src/bun.js/bindings/JSBundler+BunPlugin-impl.h rename to src/buntime/api/plugin/JSBundler+BunPlugin-impl.h diff --git a/src/bun.js/bindings/JSBundlerPlugin.cpp b/src/buntime/api/plugin/JSBundlerPlugin.cpp similarity index 100% rename from src/bun.js/bindings/JSBundlerPlugin.cpp rename to src/buntime/api/plugin/JSBundlerPlugin.cpp diff --git a/src/bun.js/bindings/JSBundlerPlugin.h b/src/buntime/api/plugin/JSBundlerPlugin.h similarity index 100% rename from src/bun.js/bindings/JSBundlerPlugin.h rename to src/buntime/api/plugin/JSBundlerPlugin.h diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/buntime/api/process/BunProcess.cpp similarity index 99% rename from src/bun.js/bindings/BunProcess.cpp rename to src/buntime/api/process/BunProcess.cpp index f0e77d579c55..ddc3f757cebe 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/buntime/api/process/BunProcess.cpp @@ -49,7 +49,7 @@ #include "EventLoopTask.h" #include -#include +#include "SerializedScriptValue.h" #include "ProcessBindingTTYWrap.h" #include "wtf/text/ASCIILiteral.h" #include "wtf/text/StringToIntegerConversion.h" @@ -205,7 +205,7 @@ static JSValue constructVersions(VM& vm, JSObject* processObject) // https://github.com/oven-sh/bun/issues/7921 // BoringSSL is a fork of OpenSSL 1.1.0, so we can report OpenSSL 1.1.0 object->putDirect(vm, JSC::Identifier::fromString(vm, "openssl"_s), JSC::jsOwnedString(vm, String("1.1.0"_s))); - // keep in sync with src/bun.js/bindings/node/http/llhttp/README.md + // keep in sync with src/buntime/bindings/node/http/llhttp/README.md object->putDirect(vm, JSC::Identifier::fromString(vm, "llhttp"_s), JSC::jsOwnedString(vm, String("9.3.0"_s))); object->putDirect(vm, JSC::Identifier::fromString(vm, "libarchive"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_LIBARCHIVE)), 0); object->putDirect(vm, JSC::Identifier::fromString(vm, "mimalloc"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_MIMALLOC)), 0); diff --git a/src/bun.js/bindings/BunProcess.h b/src/buntime/api/process/BunProcess.h similarity index 100% rename from src/bun.js/bindings/BunProcess.h rename to src/buntime/api/process/BunProcess.h diff --git a/src/bun.js/bindings/BunProcessReportObjectWindows.cpp b/src/buntime/api/process/BunProcessReportObjectWindows.cpp similarity index 100% rename from src/bun.js/bindings/BunProcessReportObjectWindows.cpp rename to src/buntime/api/process/BunProcessReportObjectWindows.cpp diff --git a/src/bun.js/bindings/JSEnvironmentVariableMap.cpp b/src/buntime/api/process/JSEnvironmentVariableMap.cpp similarity index 100% rename from src/bun.js/bindings/JSEnvironmentVariableMap.cpp rename to src/buntime/api/process/JSEnvironmentVariableMap.cpp diff --git a/src/bun.js/bindings/JSEnvironmentVariableMap.h b/src/buntime/api/process/JSEnvironmentVariableMap.h similarity index 100% rename from src/bun.js/bindings/JSEnvironmentVariableMap.h rename to src/buntime/api/process/JSEnvironmentVariableMap.h diff --git a/src/bun.js/ProcessAutoKiller.zig b/src/buntime/api/process/ProcessAutoKiller.zig similarity index 100% rename from src/bun.js/ProcessAutoKiller.zig rename to src/buntime/api/process/ProcessAutoKiller.zig diff --git a/src/bun.js/bindings/ProcessBindingBuffer.cpp b/src/buntime/api/process/ProcessBindingBuffer.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingBuffer.cpp rename to src/buntime/api/process/ProcessBindingBuffer.cpp diff --git a/src/bun.js/bindings/ProcessBindingBuffer.h b/src/buntime/api/process/ProcessBindingBuffer.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingBuffer.h rename to src/buntime/api/process/ProcessBindingBuffer.h diff --git a/src/bun.js/bindings/ProcessBindingConstants.cpp b/src/buntime/api/process/ProcessBindingConstants.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingConstants.cpp rename to src/buntime/api/process/ProcessBindingConstants.cpp diff --git a/src/bun.js/bindings/ProcessBindingConstants.h b/src/buntime/api/process/ProcessBindingConstants.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingConstants.h rename to src/buntime/api/process/ProcessBindingConstants.h diff --git a/src/bun.js/bindings/ProcessBindingFs.cpp b/src/buntime/api/process/ProcessBindingFs.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingFs.cpp rename to src/buntime/api/process/ProcessBindingFs.cpp diff --git a/src/bun.js/bindings/ProcessBindingFs.h b/src/buntime/api/process/ProcessBindingFs.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingFs.h rename to src/buntime/api/process/ProcessBindingFs.h diff --git a/src/bun.js/bindings/ProcessBindingHTTPParser.cpp b/src/buntime/api/process/ProcessBindingHTTPParser.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingHTTPParser.cpp rename to src/buntime/api/process/ProcessBindingHTTPParser.cpp diff --git a/src/bun.js/bindings/ProcessBindingHTTPParser.h b/src/buntime/api/process/ProcessBindingHTTPParser.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingHTTPParser.h rename to src/buntime/api/process/ProcessBindingHTTPParser.h diff --git a/src/bun.js/bindings/ProcessBindingNatives.cpp b/src/buntime/api/process/ProcessBindingNatives.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingNatives.cpp rename to src/buntime/api/process/ProcessBindingNatives.cpp diff --git a/src/bun.js/bindings/ProcessBindingNatives.h b/src/buntime/api/process/ProcessBindingNatives.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingNatives.h rename to src/buntime/api/process/ProcessBindingNatives.h diff --git a/src/bun.js/bindings/ProcessBindingTTYWrap.cpp b/src/buntime/api/process/ProcessBindingTTYWrap.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingTTYWrap.cpp rename to src/buntime/api/process/ProcessBindingTTYWrap.cpp diff --git a/src/bun.js/bindings/ProcessBindingTTYWrap.h b/src/buntime/api/process/ProcessBindingTTYWrap.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingTTYWrap.h rename to src/buntime/api/process/ProcessBindingTTYWrap.h diff --git a/src/bun.js/bindings/ProcessBindingUV.cpp b/src/buntime/api/process/ProcessBindingUV.cpp similarity index 100% rename from src/bun.js/bindings/ProcessBindingUV.cpp rename to src/buntime/api/process/ProcessBindingUV.cpp diff --git a/src/bun.js/bindings/ProcessBindingUV.h b/src/buntime/api/process/ProcessBindingUV.h similarity index 100% rename from src/bun.js/bindings/ProcessBindingUV.h rename to src/buntime/api/process/ProcessBindingUV.h diff --git a/src/bun.js/bindings/ProcessIdentifier.cpp b/src/buntime/api/process/ProcessIdentifier.cpp similarity index 100% rename from src/bun.js/bindings/ProcessIdentifier.cpp rename to src/buntime/api/process/ProcessIdentifier.cpp diff --git a/src/bun.js/bindings/ProcessIdentifier.h b/src/buntime/api/process/ProcessIdentifier.h similarity index 100% rename from src/bun.js/bindings/ProcessIdentifier.h rename to src/buntime/api/process/ProcessIdentifier.h diff --git a/src/bun.js/bindings/bun-spawn.cpp b/src/buntime/api/process/bun-spawn.cpp similarity index 100% rename from src/bun.js/bindings/bun-spawn.cpp rename to src/buntime/api/process/bun-spawn.cpp diff --git a/src/bun.js/bindings/JSS3File.cpp b/src/buntime/api/s3/JSS3File.cpp similarity index 100% rename from src/bun.js/bindings/JSS3File.cpp rename to src/buntime/api/s3/JSS3File.cpp diff --git a/src/bun.js/bindings/JSS3File.h b/src/buntime/api/s3/JSS3File.h similarity index 100% rename from src/bun.js/bindings/JSS3File.h rename to src/buntime/api/s3/JSS3File.h diff --git a/src/bun.js/api/S3Client.classes.ts b/src/buntime/api/s3/S3Client.classes.ts similarity index 96% rename from src/bun.js/api/S3Client.classes.ts rename to src/buntime/api/s3/S3Client.classes.ts index bc90261204ca..06ecddab9fa7 100644 --- a/src/bun.js/api/S3Client.classes.ts +++ b/src/buntime/api/s3/S3Client.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../../codegen/class-definitions"; +import { define } from "../../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/webcore/S3Client.zig b/src/buntime/api/s3/S3Client.zig similarity index 100% rename from src/bun.js/webcore/S3Client.zig rename to src/buntime/api/s3/S3Client.zig diff --git a/src/bun.js/bindings/S3Error.cpp b/src/buntime/api/s3/S3Error.cpp similarity index 100% rename from src/bun.js/bindings/S3Error.cpp rename to src/buntime/api/s3/S3Error.cpp diff --git a/src/bun.js/bindings/S3Error.h b/src/buntime/api/s3/S3Error.h similarity index 100% rename from src/bun.js/bindings/S3Error.h rename to src/buntime/api/s3/S3Error.h diff --git a/src/bun.js/webcore/S3File.zig b/src/buntime/api/s3/S3File.zig similarity index 100% rename from src/bun.js/webcore/S3File.zig rename to src/buntime/api/s3/S3File.zig diff --git a/src/bun.js/api/S3Stat.classes.ts b/src/buntime/api/s3/S3Stat.classes.ts similarity index 88% rename from src/bun.js/api/S3Stat.classes.ts rename to src/buntime/api/s3/S3Stat.classes.ts index e2339a014ef1..087e984eb9b7 100644 --- a/src/bun.js/api/S3Stat.classes.ts +++ b/src/buntime/api/s3/S3Stat.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../../codegen/class-definitions"; +import { define } from "../../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/webcore/S3Stat.zig b/src/buntime/api/s3/S3Stat.zig similarity index 100% rename from src/bun.js/webcore/S3Stat.zig rename to src/buntime/api/s3/S3Stat.zig diff --git a/src/bun.js/bindings/JSSecrets.cpp b/src/buntime/api/secrets/JSSecrets.cpp similarity index 100% rename from src/bun.js/bindings/JSSecrets.cpp rename to src/buntime/api/secrets/JSSecrets.cpp diff --git a/src/bun.js/bindings/JSSecrets.zig b/src/buntime/api/secrets/JSSecrets.zig similarity index 100% rename from src/bun.js/bindings/JSSecrets.zig rename to src/buntime/api/secrets/JSSecrets.zig diff --git a/src/bun.js/bindings/Secrets.h b/src/buntime/api/secrets/Secrets.h similarity index 100% rename from src/bun.js/bindings/Secrets.h rename to src/buntime/api/secrets/Secrets.h diff --git a/src/bun.js/bindings/SecretsDarwin.cpp b/src/buntime/api/secrets/SecretsDarwin.cpp similarity index 100% rename from src/bun.js/bindings/SecretsDarwin.cpp rename to src/buntime/api/secrets/SecretsDarwin.cpp diff --git a/src/bun.js/bindings/SecretsLinux.cpp b/src/buntime/api/secrets/SecretsLinux.cpp similarity index 100% rename from src/bun.js/bindings/SecretsLinux.cpp rename to src/buntime/api/secrets/SecretsLinux.cpp diff --git a/src/bun.js/bindings/SecretsWindows.cpp b/src/buntime/api/secrets/SecretsWindows.cpp similarity index 100% rename from src/bun.js/bindings/SecretsWindows.cpp rename to src/buntime/api/secrets/SecretsWindows.cpp diff --git a/src/bun.js/api/server.classes.ts b/src/buntime/api/server.classes.ts similarity index 100% rename from src/bun.js/api/server.classes.ts rename to src/buntime/api/server.classes.ts diff --git a/src/bun.js/api/server.zig b/src/buntime/api/server.zig similarity index 100% rename from src/bun.js/api/server.zig rename to src/buntime/api/server.zig diff --git a/src/bun.js/api/server/AnyRequestContext.zig b/src/buntime/api/server/AnyRequestContext.zig similarity index 100% rename from src/bun.js/api/server/AnyRequestContext.zig rename to src/buntime/api/server/AnyRequestContext.zig diff --git a/src/bun.js/bindings/BunHttp2CommonStrings.cpp b/src/buntime/api/server/BunHttp2CommonStrings.cpp similarity index 100% rename from src/bun.js/bindings/BunHttp2CommonStrings.cpp rename to src/buntime/api/server/BunHttp2CommonStrings.cpp diff --git a/src/bun.js/bindings/BunHttp2CommonStrings.h b/src/buntime/api/server/BunHttp2CommonStrings.h similarity index 100% rename from src/bun.js/bindings/BunHttp2CommonStrings.h rename to src/buntime/api/server/BunHttp2CommonStrings.h diff --git a/src/bun.js/api/server/FileRoute.zig b/src/buntime/api/server/FileRoute.zig similarity index 100% rename from src/bun.js/api/server/FileRoute.zig rename to src/buntime/api/server/FileRoute.zig diff --git a/src/bun.js/api/server/HTMLBundle.zig b/src/buntime/api/server/HTMLBundle.zig similarity index 100% rename from src/bun.js/api/server/HTMLBundle.zig rename to src/buntime/api/server/HTMLBundle.zig diff --git a/src/bun.js/bindings/HTTPServerAgent.zig b/src/buntime/api/server/HTTPServerAgent.zig similarity index 100% rename from src/bun.js/bindings/HTTPServerAgent.zig rename to src/buntime/api/server/HTTPServerAgent.zig diff --git a/src/bun.js/api/server/HTTPStatusText.zig b/src/buntime/api/server/HTTPStatusText.zig similarity index 100% rename from src/bun.js/api/server/HTTPStatusText.zig rename to src/buntime/api/server/HTTPStatusText.zig diff --git a/src/bun.js/api/server/InspectorBunFrontendDevServerAgent.zig b/src/buntime/api/server/InspectorBunFrontendDevServerAgent.zig similarity index 100% rename from src/bun.js/api/server/InspectorBunFrontendDevServerAgent.zig rename to src/buntime/api/server/InspectorBunFrontendDevServerAgent.zig diff --git a/src/bun.js/bindings/JSBunRequest.cpp b/src/buntime/api/server/JSBunRequest.cpp similarity index 100% rename from src/bun.js/bindings/JSBunRequest.cpp rename to src/buntime/api/server/JSBunRequest.cpp diff --git a/src/bun.js/bindings/JSBunRequest.h b/src/buntime/api/server/JSBunRequest.h similarity index 100% rename from src/bun.js/bindings/JSBunRequest.h rename to src/buntime/api/server/JSBunRequest.h diff --git a/src/bun.js/bindings/JSSocketAddressDTO.cpp b/src/buntime/api/server/JSSocketAddressDTO.cpp similarity index 100% rename from src/bun.js/bindings/JSSocketAddressDTO.cpp rename to src/buntime/api/server/JSSocketAddressDTO.cpp diff --git a/src/bun.js/bindings/JSSocketAddressDTO.h b/src/buntime/api/server/JSSocketAddressDTO.h similarity index 100% rename from src/bun.js/bindings/JSSocketAddressDTO.h rename to src/buntime/api/server/JSSocketAddressDTO.h diff --git a/src/bun.js/api/server/NodeHTTPResponse.zig b/src/buntime/api/server/NodeHTTPResponse.zig similarity index 100% rename from src/bun.js/api/server/NodeHTTPResponse.zig rename to src/buntime/api/server/NodeHTTPResponse.zig diff --git a/src/bun.js/api/server/RequestContext.zig b/src/buntime/api/server/RequestContext.zig similarity index 100% rename from src/bun.js/api/server/RequestContext.zig rename to src/buntime/api/server/RequestContext.zig diff --git a/src/bun.js/api/server/SSLConfig.bindv2.ts b/src/buntime/api/server/SSLConfig.bindv2.ts similarity index 100% rename from src/bun.js/api/server/SSLConfig.bindv2.ts rename to src/buntime/api/server/SSLConfig.bindv2.ts diff --git a/src/bun.js/api/server/SSLConfig.zig b/src/buntime/api/server/SSLConfig.zig similarity index 100% rename from src/bun.js/api/server/SSLConfig.zig rename to src/buntime/api/server/SSLConfig.zig diff --git a/src/bun.js/api/server/ServerConfig.zig b/src/buntime/api/server/ServerConfig.zig similarity index 100% rename from src/bun.js/api/server/ServerConfig.zig rename to src/buntime/api/server/ServerConfig.zig diff --git a/src/bun.js/bindings/ServerRouteList.cpp b/src/buntime/api/server/ServerRouteList.cpp similarity index 100% rename from src/bun.js/bindings/ServerRouteList.cpp rename to src/buntime/api/server/ServerRouteList.cpp diff --git a/src/bun.js/bindings/ServerRouteList.h b/src/buntime/api/server/ServerRouteList.h similarity index 100% rename from src/bun.js/bindings/ServerRouteList.h rename to src/buntime/api/server/ServerRouteList.h diff --git a/src/bun.js/api/server/ServerWebSocket.zig b/src/buntime/api/server/ServerWebSocket.zig similarity index 100% rename from src/bun.js/api/server/ServerWebSocket.zig rename to src/buntime/api/server/ServerWebSocket.zig diff --git a/src/bun.js/api/server/StaticRoute.zig b/src/buntime/api/server/StaticRoute.zig similarity index 100% rename from src/bun.js/api/server/StaticRoute.zig rename to src/buntime/api/server/StaticRoute.zig diff --git a/src/bun.js/api/server/WebSocketServerContext.zig b/src/buntime/api/server/WebSocketServerContext.zig similarity index 100% rename from src/bun.js/api/server/WebSocketServerContext.zig rename to src/buntime/api/server/WebSocketServerContext.zig diff --git a/src/bun.js/bindings/uws_bindings.cpp b/src/buntime/api/server/uws_bindings.cpp similarity index 100% rename from src/bun.js/bindings/uws_bindings.cpp rename to src/buntime/api/server/uws_bindings.cpp diff --git a/src/bun.js/bindings/ShellBindings.cpp b/src/buntime/api/shell/ShellBindings.cpp similarity index 100% rename from src/bun.js/bindings/ShellBindings.cpp rename to src/buntime/api/shell/ShellBindings.cpp diff --git a/src/bun.js/api/sockets.classes.ts b/src/buntime/api/sockets.classes.ts similarity index 100% rename from src/bun.js/api/sockets.classes.ts rename to src/buntime/api/sockets.classes.ts diff --git a/src/bun.js/api/sourcemap.classes.ts b/src/buntime/api/sourcemap.classes.ts similarity index 100% rename from src/bun.js/api/sourcemap.classes.ts rename to src/buntime/api/sourcemap.classes.ts diff --git a/src/bun.js/api/sql.classes.ts b/src/buntime/api/sql.classes.ts similarity index 100% rename from src/bun.js/api/sql.classes.ts rename to src/buntime/api/sql.classes.ts diff --git a/src/bun.js/bindings/SQLClient.cpp b/src/buntime/api/sql/SQLClient.cpp similarity index 100% rename from src/bun.js/bindings/SQLClient.cpp rename to src/buntime/api/sql/SQLClient.cpp diff --git a/src/bun.js/bindings/sqlite/CMakeLists.txt b/src/buntime/api/sqlite/CMakeLists.txt similarity index 100% rename from src/bun.js/bindings/sqlite/CMakeLists.txt rename to src/buntime/api/sqlite/CMakeLists.txt diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/buntime/api/sqlite/JSSQLStatement.cpp similarity index 100% rename from src/bun.js/bindings/sqlite/JSSQLStatement.cpp rename to src/buntime/api/sqlite/JSSQLStatement.cpp diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.h b/src/buntime/api/sqlite/JSSQLStatement.h similarity index 100% rename from src/bun.js/bindings/sqlite/JSSQLStatement.h rename to src/buntime/api/sqlite/JSSQLStatement.h diff --git a/src/bun.js/bindings/sqlite/lazy_sqlite3.h b/src/buntime/api/sqlite/lazy_sqlite3.h similarity index 100% rename from src/bun.js/bindings/sqlite/lazy_sqlite3.h rename to src/buntime/api/sqlite/lazy_sqlite3.h diff --git a/src/bun.js/bindings/sqlite/sqlite3.c b/src/buntime/api/sqlite/sqlite3.c similarity index 100% rename from src/bun.js/bindings/sqlite/sqlite3.c rename to src/buntime/api/sqlite/sqlite3.c diff --git a/src/bun.js/bindings/sqlite/sqlite3_error_codes.h b/src/buntime/api/sqlite/sqlite3_error_codes.h similarity index 99% rename from src/bun.js/bindings/sqlite/sqlite3_error_codes.h rename to src/buntime/api/sqlite/sqlite3_error_codes.h index 25f52630ed67..b54cf9c8d7a0 100644 --- a/src/bun.js/bindings/sqlite/sqlite3_error_codes.h +++ b/src/buntime/api/sqlite/sqlite3_error_codes.h @@ -760,4 +760,4 @@ MACRO(SQLITE_WARNING_AUTOINDEX) \ MACRO(SQLITE_AUTH_USER) \ MACRO(SQLITE_OK_LOAD_PERMANENTLY) \ - MACRO(SQLITE_OK_SYMLINK) \ No newline at end of file + MACRO(SQLITE_OK_SYMLINK) diff --git a/src/bun.js/bindings/sqlite/sqlite3_local.h b/src/buntime/api/sqlite/sqlite3_local.h similarity index 100% rename from src/bun.js/bindings/sqlite/sqlite3_local.h rename to src/buntime/api/sqlite/sqlite3_local.h diff --git a/src/bun.js/api/streams.classes.ts b/src/buntime/api/streams.classes.ts similarity index 100% rename from src/bun.js/api/streams.classes.ts rename to src/buntime/api/streams.classes.ts diff --git a/src/bun.js/api/streams.classes.zig b/src/buntime/api/streams.classes.zig similarity index 100% rename from src/bun.js/api/streams.classes.zig rename to src/buntime/api/streams.classes.zig diff --git a/src/bun.js/bindings/CodeCoverage.cpp b/src/buntime/api/test/CodeCoverage.cpp similarity index 100% rename from src/bun.js/bindings/CodeCoverage.cpp rename to src/buntime/api/test/CodeCoverage.cpp diff --git a/src/bun.js/bindings/FuzzilliREPRL.cpp b/src/buntime/api/test/FuzzilliREPRL.cpp similarity index 100% rename from src/bun.js/bindings/FuzzilliREPRL.cpp rename to src/buntime/api/test/FuzzilliREPRL.cpp diff --git a/src/bun.js/bindings/InternalForTesting.cpp b/src/buntime/api/test/InternalForTesting.cpp similarity index 100% rename from src/bun.js/bindings/InternalForTesting.cpp rename to src/buntime/api/test/InternalForTesting.cpp diff --git a/src/bun.js/bindings/InternalForTesting.h b/src/buntime/api/test/InternalForTesting.h similarity index 100% rename from src/bun.js/bindings/InternalForTesting.h rename to src/buntime/api/test/InternalForTesting.h diff --git a/src/bun.js/bindings/JSCTestingHelpers.cpp b/src/buntime/api/test/JSCTestingHelpers.cpp similarity index 100% rename from src/bun.js/bindings/JSCTestingHelpers.cpp rename to src/buntime/api/test/JSCTestingHelpers.cpp diff --git a/src/bun.js/bindings/JSCTestingHelpers.h b/src/buntime/api/test/JSCTestingHelpers.h similarity index 100% rename from src/bun.js/bindings/JSCTestingHelpers.h rename to src/buntime/api/test/JSCTestingHelpers.h diff --git a/src/bun.js/bindings/JSMockFunction.cpp b/src/buntime/api/test/JSMockFunction.cpp similarity index 100% rename from src/bun.js/bindings/JSMockFunction.cpp rename to src/buntime/api/test/JSMockFunction.cpp diff --git a/src/bun.js/bindings/JSMockFunction.h b/src/buntime/api/test/JSMockFunction.h similarity index 100% rename from src/bun.js/bindings/JSMockFunction.h rename to src/buntime/api/test/JSMockFunction.h diff --git a/src/bun.js/bindings/NoOpForTesting.cpp b/src/buntime/api/test/NoOpForTesting.cpp similarity index 100% rename from src/bun.js/bindings/NoOpForTesting.cpp rename to src/buntime/api/test/NoOpForTesting.cpp diff --git a/src/bun.js/bindings/NoOpForTesting.h b/src/buntime/api/test/NoOpForTesting.h similarity index 100% rename from src/bun.js/bindings/NoOpForTesting.h rename to src/buntime/api/test/NoOpForTesting.h diff --git a/src/bun.js/api/valkey.classes.ts b/src/buntime/api/valkey.classes.ts similarity index 100% rename from src/bun.js/api/valkey.classes.ts rename to src/buntime/api/valkey.classes.ts diff --git a/src/bun.js/api/welcome-page.html.gz b/src/buntime/api/welcome-page.html.gz similarity index 100% rename from src/bun.js/api/welcome-page.html.gz rename to src/buntime/api/welcome-page.html.gz diff --git a/src/bun.js/api/zlib.classes.ts b/src/buntime/api/zlib.classes.ts similarity index 100% rename from src/bun.js/api/zlib.classes.ts rename to src/buntime/api/zlib.classes.ts diff --git a/src/bun.js/bindings/libuv/README.md b/src/buntime/compat/libuv/README.md similarity index 100% rename from src/bun.js/bindings/libuv/README.md rename to src/buntime/compat/libuv/README.md diff --git a/src/bun.js/bindings/libuv/bun.lock b/src/buntime/compat/libuv/bun.lock similarity index 100% rename from src/bun.js/bindings/libuv/bun.lock rename to src/buntime/compat/libuv/bun.lock diff --git a/src/bun.js/bindings/libuv/generate_uv_posix_stubs.ts b/src/buntime/compat/libuv/generate_uv_posix_stubs.ts similarity index 100% rename from src/bun.js/bindings/libuv/generate_uv_posix_stubs.ts rename to src/buntime/compat/libuv/generate_uv_posix_stubs.ts diff --git a/src/bun.js/bindings/libuv/generate_uv_posix_stubs_constants.ts b/src/buntime/compat/libuv/generate_uv_posix_stubs_constants.ts similarity index 100% rename from src/bun.js/bindings/libuv/generate_uv_posix_stubs_constants.ts rename to src/buntime/compat/libuv/generate_uv_posix_stubs_constants.ts diff --git a/src/bun.js/bindings/libuv/package.json b/src/buntime/compat/libuv/package.json similarity index 100% rename from src/bun.js/bindings/libuv/package.json rename to src/buntime/compat/libuv/package.json diff --git a/src/bun.js/bindings/uv-posix-polyfills-darwin.c b/src/buntime/compat/libuv/uv-posix-polyfills-darwin.c similarity index 100% rename from src/bun.js/bindings/uv-posix-polyfills-darwin.c rename to src/buntime/compat/libuv/uv-posix-polyfills-darwin.c diff --git a/src/bun.js/bindings/uv-posix-polyfills-linux.c b/src/buntime/compat/libuv/uv-posix-polyfills-linux.c similarity index 100% rename from src/bun.js/bindings/uv-posix-polyfills-linux.c rename to src/buntime/compat/libuv/uv-posix-polyfills-linux.c diff --git a/src/bun.js/bindings/uv-posix-polyfills-posix.c b/src/buntime/compat/libuv/uv-posix-polyfills-posix.c similarity index 100% rename from src/bun.js/bindings/uv-posix-polyfills-posix.c rename to src/buntime/compat/libuv/uv-posix-polyfills-posix.c diff --git a/src/bun.js/bindings/uv-posix-polyfills.c b/src/buntime/compat/libuv/uv-posix-polyfills.c similarity index 100% rename from src/bun.js/bindings/uv-posix-polyfills.c rename to src/buntime/compat/libuv/uv-posix-polyfills.c diff --git a/src/bun.js/bindings/uv-posix-polyfills.h b/src/buntime/compat/libuv/uv-posix-polyfills.h similarity index 100% rename from src/bun.js/bindings/uv-posix-polyfills.h rename to src/buntime/compat/libuv/uv-posix-polyfills.h diff --git a/src/bun.js/bindings/uv-posix-stubs.c b/src/buntime/compat/libuv/uv-posix-stubs.c similarity index 100% rename from src/bun.js/bindings/uv-posix-stubs.c rename to src/buntime/compat/libuv/uv-posix-stubs.c diff --git a/src/buntime/compat/libuv/uv.h b/src/buntime/compat/libuv/uv.h new file mode 100644 index 000000000000..9eac5685a577 --- /dev/null +++ b/src/buntime/compat/libuv/uv.h @@ -0,0 +1,1956 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* See https://github.com/libuv/libuv#documentation for documentation. */ + +#ifndef UV_H +#define UV_H +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED) +#error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both." +#endif + +#ifndef UV_EXTERN +#ifdef _WIN32 +/* Windows - set up dll import/export decorators. */ +#if defined(BUILDING_UV_SHARED) +/* Building shared library. */ +#define UV_EXTERN __declspec(dllexport) +#elif defined(USING_UV_SHARED) +/* Using shared library. */ +#define UV_EXTERN __declspec(dllimport) +#else +/* Building static library. */ +#define UV_EXTERN /* nothing */ +#endif +#elif __GNUC__ >= 4 +#define UV_EXTERN __attribute__((visibility("default"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */ +#define UV_EXTERN __global +#else +#define UV_EXTERN /* nothing */ +#endif +#endif /* UV_EXTERN */ + +#include "uv/errno.h" +#include "uv/version.h" +#include +#include +#include +#include + +/* Internal type, do not use. */ +struct uv__queue { + struct uv__queue* next; + struct uv__queue* prev; +}; + +#if defined(_WIN32) +#include "uv/win.h" +#else +#include "uv/unix.h" +#endif + +/* Expand this list if necessary. */ +#define UV_ERRNO_MAP(XX) \ + XX(E2BIG, "argument list too long") \ + XX(EACCES, "permission denied") \ + XX(EADDRINUSE, "address already in use") \ + XX(EADDRNOTAVAIL, "address not available") \ + XX(EAFNOSUPPORT, "address family not supported") \ + XX(EAGAIN, "resource temporarily unavailable") \ + XX(EAI_ADDRFAMILY, "address family not supported") \ + XX(EAI_AGAIN, "temporary failure") \ + XX(EAI_BADFLAGS, "bad ai_flags value") \ + XX(EAI_BADHINTS, "invalid value for hints") \ + XX(EAI_CANCELED, "request canceled") \ + XX(EAI_FAIL, "permanent failure") \ + XX(EAI_FAMILY, "ai_family not supported") \ + XX(EAI_MEMORY, "out of memory") \ + XX(EAI_NODATA, "no address") \ + XX(EAI_NONAME, "unknown node or service") \ + XX(EAI_OVERFLOW, "argument buffer overflow") \ + XX(EAI_PROTOCOL, "resolved protocol is unknown") \ + XX(EAI_SERVICE, "service not available for socket type") \ + XX(EAI_SOCKTYPE, "socket type not supported") \ + XX(EALREADY, "connection already in progress") \ + XX(EBADF, "bad file descriptor") \ + XX(EBUSY, "resource busy or locked") \ + XX(ECANCELED, "operation canceled") \ + XX(ECHARSET, "invalid Unicode character") \ + XX(ECONNABORTED, "software caused connection abort") \ + XX(ECONNREFUSED, "connection refused") \ + XX(ECONNRESET, "connection reset by peer") \ + XX(EDESTADDRREQ, "destination address required") \ + XX(EEXIST, "file already exists") \ + XX(EFAULT, "bad address in system call argument") \ + XX(EFBIG, "file too large") \ + XX(EHOSTUNREACH, "host is unreachable") \ + XX(EINTR, "interrupted system call") \ + XX(EINVAL, "invalid argument") \ + XX(EIO, "i/o error") \ + XX(EISCONN, "socket is already connected") \ + XX(EISDIR, "illegal operation on a directory") \ + XX(ELOOP, "too many symbolic links encountered") \ + XX(EMFILE, "too many open files") \ + XX(EMSGSIZE, "message too long") \ + XX(ENAMETOOLONG, "name too long") \ + XX(ENETDOWN, "network is down") \ + XX(ENETUNREACH, "network is unreachable") \ + XX(ENFILE, "file table overflow") \ + XX(ENOBUFS, "no buffer space available") \ + XX(ENODEV, "no such device") \ + XX(ENOENT, "no such file or directory") \ + XX(ENOMEM, "not enough memory") \ + XX(ENONET, "machine is not on the network") \ + XX(ENOPROTOOPT, "protocol not available") \ + XX(ENOSPC, "no space left on device") \ + XX(ENOSYS, "function not implemented") \ + XX(ENOTCONN, "socket is not connected") \ + XX(ENOTDIR, "not a directory") \ + XX(ENOTEMPTY, "directory not empty") \ + XX(ENOTSOCK, "socket operation on non-socket") \ + XX(ENOTSUP, "operation not supported on socket") \ + XX(EOVERFLOW, "value too large for defined data type") \ + XX(EPERM, "operation not permitted") \ + XX(EPIPE, "broken pipe") \ + XX(EPROTO, "protocol error") \ + XX(EPROTONOSUPPORT, "protocol not supported") \ + XX(EPROTOTYPE, "protocol wrong type for socket") \ + XX(ERANGE, "result too large") \ + XX(EROFS, "read-only file system") \ + XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ + XX(ESPIPE, "invalid seek") \ + XX(ESRCH, "no such process") \ + XX(ETIMEDOUT, "connection timed out") \ + XX(ETXTBSY, "text file is busy") \ + XX(EXDEV, "cross-device link not permitted") \ + XX(UNKNOWN, "unknown error") \ + XX(EOF, "end of file") \ + XX(ENXIO, "no such device or address") \ + XX(EMLINK, "too many links") \ + XX(EHOSTDOWN, "host is down") \ + XX(EREMOTEIO, "remote I/O error") \ + XX(ENOTTY, "inappropriate ioctl for device") \ + XX(EFTYPE, "inappropriate file type or format") \ + XX(EILSEQ, "illegal byte sequence") \ + XX(ESOCKTNOSUPPORT, "socket type not supported") \ + XX(ENODATA, "no data available") \ + XX(EUNATCH, "protocol driver not attached") \ + XX(ENOEXEC, "exec format error") + +#define UV_HANDLE_TYPE_MAP(XX) \ + XX(ASYNC, async) \ + XX(CHECK, check) \ + XX(FS_EVENT, fs_event) \ + XX(FS_POLL, fs_poll) \ + XX(HANDLE, handle) \ + XX(IDLE, idle) \ + XX(NAMED_PIPE, pipe) \ + XX(POLL, poll) \ + XX(PREPARE, prepare) \ + XX(PROCESS, process) \ + XX(STREAM, stream) \ + XX(TCP, tcp) \ + XX(TIMER, timer) \ + XX(TTY, tty) \ + XX(UDP, udp) \ + XX(SIGNAL, signal) + +#define UV_REQ_TYPE_MAP(XX) \ + XX(REQ, req) \ + XX(CONNECT, connect) \ + XX(WRITE, write) \ + XX(SHUTDOWN, shutdown) \ + XX(UDP_SEND, udp_send) \ + XX(FS, fs) \ + XX(WORK, work) \ + XX(GETADDRINFO, getaddrinfo) \ + XX(GETNAMEINFO, getnameinfo) \ + XX(RANDOM, random) + +typedef enum { +#define XX(code, _) UV_##code = UV__##code, + UV_ERRNO_MAP(XX) +#undef XX + UV_ERRNO_MAX + = UV__EOF - 1 +} uv_errno_t; + +typedef enum { + UV_UNKNOWN_HANDLE = 0, +#define XX(uc, lc) UV_##uc, + UV_HANDLE_TYPE_MAP(XX) +#undef XX + UV_FILE, + UV_HANDLE_TYPE_MAX +} uv_handle_type; + +typedef enum { + UV_UNKNOWN_REQ = 0, +#define XX(uc, lc) UV_##uc, + UV_REQ_TYPE_MAP(XX) +#undef XX + UV_REQ_TYPE_PRIVATE + UV_REQ_TYPE_MAX +} uv_req_type; + +/* Handle types. */ +typedef struct uv_loop_s uv_loop_t; +typedef struct uv_handle_s uv_handle_t; +typedef struct uv_dir_s uv_dir_t; +typedef struct uv_stream_s uv_stream_t; +typedef struct uv_tcp_s uv_tcp_t; +typedef struct uv_udp_s uv_udp_t; +typedef struct uv_pipe_s uv_pipe_t; +typedef struct uv_tty_s uv_tty_t; +typedef struct uv_poll_s uv_poll_t; +typedef struct uv_timer_s uv_timer_t; +typedef struct uv_prepare_s uv_prepare_t; +typedef struct uv_check_s uv_check_t; +typedef struct uv_idle_s uv_idle_t; +typedef struct uv_async_s uv_async_t; +typedef struct uv_process_s uv_process_t; +typedef struct uv_fs_event_s uv_fs_event_t; +typedef struct uv_fs_poll_s uv_fs_poll_t; +typedef struct uv_signal_s uv_signal_t; + +/* Request types. */ +typedef struct uv_req_s uv_req_t; +typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; +typedef struct uv_getnameinfo_s uv_getnameinfo_t; +typedef struct uv_shutdown_s uv_shutdown_t; +typedef struct uv_write_s uv_write_t; +typedef struct uv_connect_s uv_connect_t; +typedef struct uv_udp_send_s uv_udp_send_t; +typedef struct uv_fs_s uv_fs_t; +typedef struct uv_work_s uv_work_t; +typedef struct uv_random_s uv_random_t; + +/* None of the above. */ +typedef struct uv_env_item_s uv_env_item_t; +typedef struct uv_cpu_info_s uv_cpu_info_t; +typedef struct uv_interface_address_s uv_interface_address_t; +typedef struct uv_dirent_s uv_dirent_t; +typedef struct uv_passwd_s uv_passwd_t; +typedef struct uv_group_s uv_group_t; +typedef struct uv_utsname_s uv_utsname_t; +typedef struct uv_statfs_s uv_statfs_t; + +typedef struct uv_metrics_s uv_metrics_t; + +typedef enum { + UV_LOOP_BLOCK_SIGNAL = 0, + UV_METRICS_IDLE_TIME, + UV_LOOP_USE_IO_URING_SQPOLL +#define UV_LOOP_USE_IO_URING_SQPOLL UV_LOOP_USE_IO_URING_SQPOLL +} uv_loop_option; + +typedef enum { + UV_RUN_DEFAULT = 0, + UV_RUN_ONCE, + UV_RUN_NOWAIT +} uv_run_mode; + +UV_EXTERN unsigned int uv_version(void); +UV_EXTERN const char* uv_version_string(void); + +typedef void* (*uv_malloc_func)(size_t size); +typedef void* (*uv_realloc_func)(void* ptr, size_t size); +typedef void* (*uv_calloc_func)(size_t count, size_t size); +typedef void (*uv_free_func)(void* ptr); + +UV_EXTERN void uv_library_shutdown(void); + +UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, + uv_realloc_func realloc_func, + uv_calloc_func calloc_func, + uv_free_func free_func); + +UV_EXTERN uv_loop_t* uv_default_loop(void); +UV_EXTERN int uv_loop_init(uv_loop_t* loop); +UV_EXTERN int uv_loop_close(uv_loop_t* loop); +/* + * NOTE: + * This function is DEPRECATED, users should + * allocate the loop manually and use uv_loop_init instead. + */ +UV_EXTERN uv_loop_t* uv_loop_new(void); +/* + * NOTE: + * This function is DEPRECATED. Users should use + * uv_loop_close and free the memory manually instead. + */ +UV_EXTERN void uv_loop_delete(uv_loop_t*); +UV_EXTERN size_t uv_loop_size(void); +UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); +UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); +UV_EXTERN int uv_loop_fork(uv_loop_t* loop); + +UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); +UV_EXTERN void uv_stop(uv_loop_t*); + +UV_EXTERN void uv_ref(uv_handle_t*); +UV_EXTERN void uv_unref(uv_handle_t*); +UV_EXTERN int uv_has_ref(const uv_handle_t*); + +UV_EXTERN void uv_update_time(uv_loop_t*); +UV_EXTERN uint64_t uv_now(const uv_loop_t*); + +UV_EXTERN int uv_backend_fd(const uv_loop_t*); +UV_EXTERN int uv_backend_timeout(const uv_loop_t*); + +typedef void (*uv_alloc_cb)(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); +typedef void (*uv_read_cb)(uv_stream_t* stream, + ssize_t nread, + const uv_buf_t* buf); +typedef void (*uv_write_cb)(uv_write_t* req, int status); +typedef void (*uv_connect_cb)(uv_connect_t* req, int status); +typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); +typedef void (*uv_connection_cb)(uv_stream_t* server, int status); +typedef void (*uv_close_cb)(uv_handle_t* handle); +typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); +typedef void (*uv_timer_cb)(uv_timer_t* handle); +typedef void (*uv_async_cb)(uv_async_t* handle); +typedef void (*uv_prepare_cb)(uv_prepare_t* handle); +typedef void (*uv_check_cb)(uv_check_t* handle); +typedef void (*uv_idle_cb)(uv_idle_t* handle); +typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); +typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); +typedef void (*uv_fs_cb)(uv_fs_t* req); +typedef void (*uv_work_cb)(uv_work_t* req); +typedef void (*uv_after_work_cb)(uv_work_t* req, int status); +typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, + int status, + struct addrinfo* res); +typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, + int status, + const char* hostname, + const char* service); +typedef void (*uv_random_cb)(uv_random_t* req, + int status, + void* buf, + size_t buflen); + +typedef enum { + UV_CLOCK_MONOTONIC, + UV_CLOCK_REALTIME +} uv_clock_id; + +/* XXX(bnoordhuis) not 2038-proof, https://github.com/libuv/libuv/issues/3864 */ +typedef struct { + long tv_sec; + long tv_nsec; +} uv_timespec_t; + +typedef struct { + int64_t tv_sec; + int32_t tv_nsec; +} uv_timespec64_t; + +/* XXX(bnoordhuis) not 2038-proof, https://github.com/libuv/libuv/issues/3864 */ +typedef struct { + long tv_sec; + long tv_usec; +} uv_timeval_t; + +typedef struct { + int64_t tv_sec; + int32_t tv_usec; +} uv_timeval64_t; + +typedef struct { + uint64_t st_dev; + uint64_t st_mode; + uint64_t st_nlink; + uint64_t st_uid; + uint64_t st_gid; + uint64_t st_rdev; + uint64_t st_ino; + uint64_t st_size; + uint64_t st_blksize; + uint64_t st_blocks; + uint64_t st_flags; + uint64_t st_gen; + uv_timespec_t st_atim; + uv_timespec_t st_mtim; + uv_timespec_t st_ctim; + uv_timespec_t st_birthtim; +} uv_stat_t; + +typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, + const char* filename, + int events, + int status); + +typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr); + +typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); + +typedef enum { + UV_LEAVE_GROUP = 0, + UV_JOIN_GROUP +} uv_membership; + +UV_EXTERN int uv_translate_sys_error(int sys_errno); + +UV_EXTERN const char* uv_strerror(int err); +UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen); + +UV_EXTERN const char* uv_err_name(int err); +UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen); + +#define UV_REQ_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_req_type type; \ + /* private */ \ + void* reserved[6]; \ + UV_REQ_PRIVATE_FIELDS + +/* Abstract base class of all requests. */ +struct uv_req_s { + UV_REQ_FIELDS +}; + +/* Platform-specific request types. */ +UV_PRIVATE_REQ_TYPES + +UV_EXTERN int uv_shutdown(uv_shutdown_t* req, + uv_stream_t* handle, + uv_shutdown_cb cb); + +struct uv_shutdown_s { + UV_REQ_FIELDS + uv_stream_t* handle; + uv_shutdown_cb cb; + UV_SHUTDOWN_PRIVATE_FIELDS +}; + +#define UV_HANDLE_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_loop_t* loop; \ + uv_handle_type type; \ + /* private */ \ + uv_close_cb close_cb; \ + struct uv__queue handle_queue; \ + union { \ + int fd; \ + void* reserved[4]; \ + } u; \ + UV_HANDLE_PRIVATE_FIELDS + +/* The abstract base class of all handles. */ +struct uv_handle_s { + UV_HANDLE_FIELDS +}; + +UV_EXTERN size_t uv_handle_size(uv_handle_type type); +UV_EXTERN uv_handle_type uv_handle_get_type(const uv_handle_t* handle); +UV_EXTERN const char* uv_handle_type_name(uv_handle_type type); +UV_EXTERN void* uv_handle_get_data(const uv_handle_t* handle); +UV_EXTERN uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle); +UV_EXTERN void uv_handle_set_data(uv_handle_t* handle, void* data); + +UV_EXTERN size_t uv_req_size(uv_req_type type); +UV_EXTERN void* uv_req_get_data(const uv_req_t* req); +UV_EXTERN void uv_req_set_data(uv_req_t* req, void* data); +UV_EXTERN uv_req_type uv_req_get_type(const uv_req_t* req); +UV_EXTERN const char* uv_req_type_name(uv_req_type type); + +UV_EXTERN int uv_is_active(const uv_handle_t* handle); + +UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); + +/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ +UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); +UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); + +UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); + +UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); +UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); + +UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); + +UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); + +UV_EXTERN int uv_pipe(uv_file fds[2], int read_flags, int write_flags); +UV_EXTERN int uv_socketpair(int type, + int protocol, + uv_os_sock_t socket_vector[2], + int flags0, + int flags1); + +#define UV_STREAM_FIELDS \ + /* number of bytes queued for writing */ \ + size_t write_queue_size; \ + uv_alloc_cb alloc_cb; \ + uv_read_cb read_cb; \ + /* private */ \ + UV_STREAM_PRIVATE_FIELDS + +/* + * uv_stream_t is a subclass of uv_handle_t. + * + * uv_stream is an abstract class. + * + * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. + */ +struct uv_stream_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS +}; + +UV_EXTERN size_t uv_stream_get_write_queue_size(const uv_stream_t* stream); + +UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); +UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); + +UV_EXTERN int uv_read_start(uv_stream_t*, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +UV_EXTERN int uv_read_stop(uv_stream_t*); + +UV_EXTERN int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb); +UV_EXTERN int uv_write2(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb); +UV_EXTERN int uv_try_write(uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs); +UV_EXTERN int uv_try_write2(uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle); + +/* uv_write_t is a subclass of uv_req_t. */ +struct uv_write_s { + UV_REQ_FIELDS + uv_write_cb cb; + uv_stream_t* send_handle; /* TODO: make private and unix-only in v2.x. */ + uv_stream_t* handle; + UV_WRITE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_is_readable(const uv_stream_t* handle); +UV_EXTERN int uv_is_writable(const uv_stream_t* handle); + +UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); + +UV_EXTERN int uv_is_closing(const uv_handle_t* handle); + +/* + * uv_tcp_t is a subclass of uv_stream_t. + * + * Represents a TCP stream or TCP server. + */ +struct uv_tcp_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TCP_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); +UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); +UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); +UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, + int enable, + unsigned int delay); +UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); + +enum uv_tcp_flags { + /* Used with uv_tcp_bind, when an IPv6 address is used. */ + UV_TCP_IPV6ONLY = 1, + + /* Enable SO_REUSEPORT socket option when binding the handle. + * This allows completely duplicate bindings by multiple processes + * or threads if they all set SO_REUSEPORT before binding the port. + * Incoming connections are distributed across the participating + * listener sockets. + * + * This flag is available only on Linux 3.9+, DragonFlyBSD 3.6+, + * FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now. + */ + UV_TCP_REUSEPORT = 2, +}; + +UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int flags); +UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb); +UV_EXTERN int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + uv_connect_cb cb); + +/* uv_connect_t is a subclass of uv_req_t. */ +struct uv_connect_s { + UV_REQ_FIELDS + uv_connect_cb cb; + uv_stream_t* handle; + UV_CONNECT_PRIVATE_FIELDS +}; + +/* + * UDP support. + */ + +enum uv_udp_flags { + /* Disables dual stack mode. */ + UV_UDP_IPV6ONLY = 1, + /* + * Indicates message was truncated because read buffer was too small. The + * remainder was discarded by the OS. Used in uv_udp_recv_cb. + */ + UV_UDP_PARTIAL = 2, + /* + * Indicates if SO_REUSEADDR will be set when binding the handle. + * This sets the SO_REUSEPORT socket flag on the BSDs (except for + * DragonFlyBSD), OS X, and other platforms where SO_REUSEPORTs don't + * have the capability of load balancing, as the opposite of what + * UV_UDP_REUSEPORT would do. On other Unix platforms, it sets the + * SO_REUSEADDR flag. What that means is that multiple threads or + * processes can bind to the same address without error (provided + * they all set the flag) but only the last one to bind will receive + * any traffic, in effect "stealing" the port from the previous listener. + */ + UV_UDP_REUSEADDR = 4, + /* + * Indicates that the message was received by recvmmsg, so the buffer provided + * must not be freed by the recv_cb callback. + */ + UV_UDP_MMSG_CHUNK = 8, + /* + * Indicates that the buffer provided has been fully utilized by recvmmsg and + * that it should now be freed by the recv_cb callback. When this flag is set + * in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL. + */ + UV_UDP_MMSG_FREE = 16, + /* + * Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle. + * This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on + * Linux. This stops the Linux kernel from suppressing some ICMP error + * messages and enables full ICMP error reporting for faster failover. + * This flag is no-op on platforms other than Linux. + */ + UV_UDP_LINUX_RECVERR = 32, + /* + * Indicates if SO_REUSEPORT will be set when binding the handle. + * This sets the SO_REUSEPORT socket option on supported platforms. + * Unlike UV_UDP_REUSEADDR, this flag will make multiple threads or + * processes that are binding to the same address and port "share" + * the port, which means incoming datagrams are distributed across + * the receiving sockets among threads or processes. + * + * This flag is available only on Linux 3.9+, DragonFlyBSD 3.6+, + * FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now. + */ + UV_UDP_REUSEPORT = 64, + /* + * Indicates that recvmmsg should be used, if available. + */ + UV_UDP_RECVMMSG = 256 +}; + +typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); +typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags); + +/* uv_udp_t is a subclass of uv_handle_t. */ +struct uv_udp_s { + UV_HANDLE_FIELDS + /* read-only */ + /* + * Number of bytes queued for sending. This field strictly shows how much + * information is currently queued. + */ + size_t send_queue_size; + /* + * Number of send requests currently in the queue awaiting to be processed. + */ + size_t send_queue_count; + UV_UDP_PRIVATE_FIELDS +}; + +/* uv_udp_send_t is a subclass of uv_req_t. */ +struct uv_udp_send_s { + UV_REQ_FIELDS + uv_udp_t* handle; + uv_udp_send_cb cb; + UV_UDP_SEND_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); +UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); +UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int flags); +UV_EXTERN int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr); + +UV_EXTERN int uv_udp_getpeername(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + uv_membership membership); +UV_EXTERN int uv_udp_set_source_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + const char* source_addr, + uv_membership membership); +UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, + const char* interface_addr); +UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + uv_udp_send_cb send_cb); +UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr); +UV_EXTERN int uv_udp_try_send2(uv_udp_t* handle, + unsigned int count, + uv_buf_t* bufs[/*count*/], + unsigned int nbufs[/*count*/], + struct sockaddr* addrs[/*count*/], + unsigned int flags); +UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb); +UV_EXTERN int uv_udp_using_recvmmsg(const uv_udp_t* handle); +UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); +UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle); +UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle); + +/* + * uv_tty_t is a subclass of uv_stream_t. + * + * Representing a stream for the console. + */ +struct uv_tty_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TTY_PRIVATE_FIELDS +}; + +typedef enum { + /* Initial/normal terminal mode */ + UV_TTY_MODE_NORMAL, + /* + * Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled). + * May become equivalent to UV_TTY_MODE_RAW_VT in future libuv versions. + */ + UV_TTY_MODE_RAW, + /* Binary-safe I/O mode for IPC (Unix-only) */ + UV_TTY_MODE_IO, + /* Raw input mode. On Windows ENABLE_VIRTUAL_TERMINAL_INPUT is also set. */ + UV_TTY_MODE_RAW_VT +} uv_tty_mode_t; + +typedef enum { + /* + * The console supports handling of virtual terminal sequences + * (Windows10 new console, ConEmu) + */ + UV_TTY_SUPPORTED, + /* The console cannot process the virtual terminal sequence. (Legacy + * console) + */ + UV_TTY_UNSUPPORTED +} uv_tty_vtermstate_t; + +UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); +UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); +UV_EXTERN int uv_tty_reset_mode(void); +UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); +UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state); +UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state); + +#ifdef __cplusplus +extern "C++" { + +inline int uv_tty_set_mode(uv_tty_t* handle, int mode) +{ + return uv_tty_set_mode(handle, static_cast(mode)); +} +} +#endif + +UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); + +enum { + UV_PIPE_NO_TRUNCATE = 1u << 0 +}; + +/* + * uv_pipe_t is a subclass of uv_stream_t. + * + * Representing a pipe stream or pipe server. On Windows this is a Named + * Pipe. On Unix this is a Unix domain socket. + */ +struct uv_pipe_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + int ipc; /* non-zero if this pipe is used for passing handles */ + UV_PIPE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc); +UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); +UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); +UV_EXTERN int uv_pipe_bind2(uv_pipe_t* handle, + const char* name, + size_t namelen, + unsigned int flags); +UV_EXTERN void uv_pipe_connect(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + uv_connect_cb cb); +UV_EXTERN int uv_pipe_connect2(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + size_t namelen, + unsigned int flags, + uv_connect_cb cb); +UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); +UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); +UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); +UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags); + +struct uv_poll_s { + UV_HANDLE_FIELDS + uv_poll_cb poll_cb; + UV_POLL_PRIVATE_FIELDS +}; + +enum uv_poll_event { + UV_READABLE = 1, + UV_WRITABLE = 2, + UV_DISCONNECT = 4, + UV_PRIORITIZED = 8 +}; + +UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); +UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, + uv_poll_t* handle, + uv_os_sock_t socket); +UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); +UV_EXTERN int uv_poll_stop(uv_poll_t* handle); + +struct uv_prepare_s { + UV_HANDLE_FIELDS + UV_PREPARE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); +UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); +UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); + +struct uv_check_s { + UV_HANDLE_FIELDS + UV_CHECK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); +UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); +UV_EXTERN int uv_check_stop(uv_check_t* check); + +struct uv_idle_s { + UV_HANDLE_FIELDS + UV_IDLE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); +UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); +UV_EXTERN int uv_idle_stop(uv_idle_t* idle); + +struct uv_async_s { + UV_HANDLE_FIELDS + UV_ASYNC_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_async_init(uv_loop_t*, + uv_async_t* async, + uv_async_cb async_cb); +UV_EXTERN int uv_async_send(uv_async_t* async); + +/* + * uv_timer_t is a subclass of uv_handle_t. + * + * Used to get woken up at a specified time in the future. + */ +struct uv_timer_s { + UV_HANDLE_FIELDS + UV_TIMER_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); +UV_EXTERN int uv_timer_start(uv_timer_t* handle, + uv_timer_cb cb, + uint64_t timeout, + uint64_t repeat); +UV_EXTERN int uv_timer_stop(uv_timer_t* handle); +UV_EXTERN int uv_timer_again(uv_timer_t* handle); +UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); +UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); +UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle); + +/* + * uv_getaddrinfo_t is a subclass of uv_req_t. + * + * Request object for uv_getaddrinfo. + */ +struct uv_getaddrinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ + UV_GETADDRINFO_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, + uv_getaddrinfo_t* req, + uv_getaddrinfo_cb getaddrinfo_cb, + const char* node, + const char* service, + const struct addrinfo* hints); +UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); + +/* + * uv_getnameinfo_t is a subclass of uv_req_t. + * + * Request object for uv_getnameinfo. + */ +struct uv_getnameinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* host and service are marked as private, but they really aren't. */ + UV_GETNAMEINFO_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags); + +/* uv_spawn() options. */ +typedef enum { + UV_IGNORE = 0x00, + UV_CREATE_PIPE = 0x01, + UV_INHERIT_FD = 0x02, + UV_INHERIT_STREAM = 0x04, + + /* + * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE + * determine the direction of flow, from the child process' perspective. Both + * flags may be specified to create a duplex data stream. + */ + UV_READABLE_PIPE = 0x10, + UV_WRITABLE_PIPE = 0x20, + + /* + * When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the + * handle in non-blocking mode in the child. This may cause loss of data, + * if the child is not designed to handle to encounter this mode, + * but can also be significantly more efficient. + */ + UV_NONBLOCK_PIPE = 0x40, + UV_OVERLAPPED_PIPE = 0x40 /* old name, for compatibility */ +} uv_stdio_flags; + +typedef struct uv_stdio_container_s { + uv_stdio_flags flags; + + union { + uv_stream_t* stream; + int fd; + } data; +} uv_stdio_container_t; + +typedef struct uv_process_options_s { + uv_exit_cb exit_cb; /* Called after the process exits. */ + const char* file; /* Path to program to execute. */ + /* + * Command line arguments. args[0] should be the path to the program. On + * Windows this uses CreateProcess which concatenates the arguments into a + * string this can cause some strange errors. See the note at + * windows_verbatim_arguments. + */ + char** args; + /* + * This will be set as the environ variable in the subprocess. If this is + * NULL then the parents environ will be used. + */ + char** env; + /* + * If non-null this represents a directory the subprocess should execute + * in. Stands for current working directory. + */ + const char* cwd; + /* + * Various flags that control how uv_spawn() behaves. See the definition of + * `enum uv_process_flags` below. + */ + unsigned int flags; + /* + * The `stdio` field points to an array of uv_stdio_container_t structs that + * describe the file descriptors that will be made available to the child + * process. The convention is that stdio[0] points to stdin, fd 1 is used for + * stdout, and fd 2 is stderr. + * + * Note that on windows file descriptors greater than 2 are available to the + * child process only if the child processes uses the MSVCRT runtime. + */ + int stdio_count; + uv_stdio_container_t* stdio; + /* + * Libuv can change the child process' user/group id. This happens only when + * the appropriate bits are set in the flags fields. This is not supported on + * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. + */ + uv_uid_t uid; + uv_gid_t gid; +} uv_process_options_t; + +/* + * These are the flags that can be used for the uv_process_options.flags field. + */ +enum uv_process_flags { + /* + * Set the child process' user id. The user id is supplied in the `uid` field + * of the options struct. This does not work on windows; setting this flag + * will cause uv_spawn() to fail. + */ + UV_PROCESS_SETUID = (1 << 0), + /* + * Set the child process' group id. The user id is supplied in the `gid` + * field of the options struct. This does not work on windows; setting this + * flag will cause uv_spawn() to fail. + */ + UV_PROCESS_SETGID = (1 << 1), + /* + * Do not wrap any arguments in quotes, or perform any other escaping, when + * converting the argument list into a command line string. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), + /* + * Spawn the child process in a detached state - this will make it a process + * group leader, and will effectively enable the child to keep running after + * the parent exits. Note that the child process will still keep the + * parent's event loop alive unless the parent process calls uv_unref() on + * the child's process handle. + */ + UV_PROCESS_DETACHED = (1 << 3), + /* + * Hide the subprocess window that would normally be created. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4), + /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), + /* + * Hide the subprocess GUI window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6), + /* + * On Windows, if the path to the program to execute, specified in + * uv_process_options_t's file field, has a directory component, + * search for the exact file name before trying variants with + * extensions like '.exe' or '.cmd'. + */ + UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME = (1 << 7) +}; + +/* + * uv_process_t is a subclass of uv_handle_t. + */ +struct uv_process_s { + UV_HANDLE_FIELDS + uv_exit_cb exit_cb; + int pid; + UV_PROCESS_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_spawn(uv_loop_t* loop, + uv_process_t* handle, + const uv_process_options_t* options); +UV_EXTERN int uv_process_kill(uv_process_t*, int signum); +UV_EXTERN int uv_kill(int pid, int signum); +UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*); + +/* + * uv_work_t is a subclass of uv_req_t. + */ +struct uv_work_s { + UV_REQ_FIELDS + uv_loop_t* loop; + uv_work_cb work_cb; + uv_after_work_cb after_work_cb; + UV_WORK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_queue_work(uv_loop_t* loop, + uv_work_t* req, + uv_work_cb work_cb, + uv_after_work_cb after_work_cb); + +UV_EXTERN int uv_cancel(uv_req_t* req); + +struct uv_cpu_times_s { + uint64_t user; /* milliseconds */ + uint64_t nice; /* milliseconds */ + uint64_t sys; /* milliseconds */ + uint64_t idle; /* milliseconds */ + uint64_t irq; /* milliseconds */ +}; + +struct uv_cpu_info_s { + char* model; + int speed; + struct uv_cpu_times_s cpu_times; +}; + +struct uv_interface_address_s { + char* name; + char phys_addr[6]; + int is_internal; + union { + struct sockaddr_in address4; + struct sockaddr_in6 address6; + } address; + union { + struct sockaddr_in netmask4; + struct sockaddr_in6 netmask6; + } netmask; +}; + +struct uv_passwd_s { + char* username; + unsigned long uid; + unsigned long gid; + char* shell; + char* homedir; +}; + +struct uv_group_s { + char* groupname; + unsigned long gid; + char** members; +}; + +struct uv_utsname_s { + char sysname[256]; + char release[256]; + char version[256]; + char machine[256]; + /* This struct does not contain the nodename and domainname fields present in + the utsname type. domainname is a GNU extension. Both fields are referred + to as meaningless in the docs. */ +}; + +struct uv_statfs_s { + uint64_t f_type; + uint64_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + uint64_t f_spare[4]; +}; + +typedef enum { + UV_DIRENT_UNKNOWN, + UV_DIRENT_FILE, + UV_DIRENT_DIR, + UV_DIRENT_LINK, + UV_DIRENT_FIFO, + UV_DIRENT_SOCKET, + UV_DIRENT_CHAR, + UV_DIRENT_BLOCK +} uv_dirent_type_t; + +struct uv_dirent_s { + const char* name; + uv_dirent_type_t type; +}; + +UV_EXTERN char** uv_setup_args(int argc, char** argv); +UV_EXTERN int uv_get_process_title(char* buffer, size_t size); +UV_EXTERN int uv_set_process_title(const char* title); +UV_EXTERN int uv_resident_set_memory(size_t* rss); +UV_EXTERN int uv_uptime(double* uptime); +UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); +UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); + +typedef struct { + uv_timeval_t ru_utime; /* user CPU time used */ + uv_timeval_t ru_stime; /* system CPU time used */ + uint64_t ru_maxrss; /* maximum resident set size */ + uint64_t ru_ixrss; /* integral shared memory size */ + uint64_t ru_idrss; /* integral unshared data size */ + uint64_t ru_isrss; /* integral unshared stack size */ + uint64_t ru_minflt; /* page reclaims (soft page faults) */ + uint64_t ru_majflt; /* page faults (hard page faults) */ + uint64_t ru_nswap; /* swaps */ + uint64_t ru_inblock; /* block input operations */ + uint64_t ru_oublock; /* block output operations */ + uint64_t ru_msgsnd; /* IPC messages sent */ + uint64_t ru_msgrcv; /* IPC messages received */ + uint64_t ru_nsignals; /* signals received */ + uint64_t ru_nvcsw; /* voluntary context switches */ + uint64_t ru_nivcsw; /* involuntary context switches */ +} uv_rusage_t; + +UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); +UV_EXTERN int uv_getrusage_thread(uv_rusage_t* rusage); + +UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); +UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); +UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); +UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); +UV_EXTERN int uv_os_get_passwd2(uv_passwd_t* pwd, uv_uid_t uid); +UV_EXTERN int uv_os_get_group(uv_group_t* grp, uv_uid_t gid); +UV_EXTERN void uv_os_free_group(uv_group_t* grp); +UV_EXTERN uv_pid_t uv_os_getpid(void); +UV_EXTERN uv_pid_t uv_os_getppid(void); + +#if defined(__PASE__) +/* On IBM i PASE, the highest process priority is -10 */ +#define UV_PRIORITY_LOW 39 /* RUNPTY(99) */ +#define UV_PRIORITY_BELOW_NORMAL 15 /* RUNPTY(50) */ +#define UV_PRIORITY_NORMAL 0 /* RUNPTY(20) */ +#define UV_PRIORITY_ABOVE_NORMAL -4 /* RUNTY(12) */ +#define UV_PRIORITY_HIGH -7 /* RUNPTY(6) */ +#define UV_PRIORITY_HIGHEST -10 /* RUNPTY(1) */ +#else +#define UV_PRIORITY_LOW 19 +#define UV_PRIORITY_BELOW_NORMAL 10 +#define UV_PRIORITY_NORMAL 0 +#define UV_PRIORITY_ABOVE_NORMAL -7 +#define UV_PRIORITY_HIGH -14 +#define UV_PRIORITY_HIGHEST -20 +#endif + +UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); +UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); + +enum { + UV_THREAD_PRIORITY_HIGHEST = 2, + UV_THREAD_PRIORITY_ABOVE_NORMAL = 1, + UV_THREAD_PRIORITY_NORMAL = 0, + UV_THREAD_PRIORITY_BELOW_NORMAL = -1, + UV_THREAD_PRIORITY_LOWEST = -2, +}; + +UV_EXTERN int uv_thread_getpriority(uv_thread_t tid, int* priority); +UV_EXTERN int uv_thread_setpriority(uv_thread_t tid, int priority); + +UV_EXTERN unsigned int uv_available_parallelism(void); +UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); +UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); +UV_EXTERN int uv_cpumask_size(void); + +UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, + int* count); +UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count); + +struct uv_env_item_s { + char* name; + char* value; +}; + +UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count); +UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count); +UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size); +UV_EXTERN int uv_os_setenv(const char* name, const char* value); +UV_EXTERN int uv_os_unsetenv(const char* name); + +#ifdef MAXHOSTNAMELEN +#define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1) +#else +/* + Fallback for the maximum hostname size, including the null terminator. The + Windows gethostname() documentation states that 256 bytes will always be + large enough to hold the null-terminated hostname. +*/ +#define UV_MAXHOSTNAMESIZE 256 +#endif + +UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); + +UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); + +struct uv_metrics_s { + uint64_t loop_count; + uint64_t events; + uint64_t events_waiting; + /* private */ + uint64_t* reserved[13]; +}; + +UV_EXTERN int uv_metrics_info(uv_loop_t* loop, uv_metrics_t* metrics); +UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop); + +typedef enum { + UV_FS_UNKNOWN = -1, + UV_FS_CUSTOM, + UV_FS_OPEN, + UV_FS_CLOSE, + UV_FS_READ, + UV_FS_WRITE, + UV_FS_SENDFILE, + UV_FS_STAT, + UV_FS_LSTAT, + UV_FS_FSTAT, + UV_FS_FTRUNCATE, + UV_FS_UTIME, + UV_FS_FUTIME, + UV_FS_ACCESS, + UV_FS_CHMOD, + UV_FS_FCHMOD, + UV_FS_FSYNC, + UV_FS_FDATASYNC, + UV_FS_UNLINK, + UV_FS_RMDIR, + UV_FS_MKDIR, + UV_FS_MKDTEMP, + UV_FS_RENAME, + UV_FS_SCANDIR, + UV_FS_LINK, + UV_FS_SYMLINK, + UV_FS_READLINK, + UV_FS_CHOWN, + UV_FS_FCHOWN, + UV_FS_REALPATH, + UV_FS_COPYFILE, + UV_FS_LCHOWN, + UV_FS_OPENDIR, + UV_FS_READDIR, + UV_FS_CLOSEDIR, + UV_FS_STATFS, + UV_FS_MKSTEMP, + UV_FS_LUTIME +} uv_fs_type; + +struct uv_dir_s { + uv_dirent_t* dirents; + size_t nentries; + void* reserved[4]; + UV_DIR_PRIVATE_FIELDS +}; + +/* uv_fs_t is a subclass of uv_req_t. */ +struct uv_fs_s { + UV_REQ_FIELDS + uv_fs_type fs_type; + uv_loop_t* loop; + uv_fs_cb cb; + ssize_t result; + void* ptr; + const char* path; + uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ + UV_FS_PRIVATE_FIELDS +}; + +UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*); +UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*); +UV_EXTERN int uv_fs_get_system_error(const uv_fs_t*); +UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*); +UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*); +UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*); + +UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); +UV_EXTERN int uv_fs_close(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_open(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_read(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +/* + * This flag can be used with uv_fs_copyfile() to return an error if the + * destination already exists. + */ +#define UV_FS_COPYFILE_EXCL 0x0001 + +/* + * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. + * If copy-on-write is not supported, a fallback copy mechanism is used. + */ +#define UV_FS_COPYFILE_FICLONE 0x0002 + +/* + * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. + * If copy-on-write is not supported, an error is returned. + */ +#define UV_FS_COPYFILE_FICLONE_FORCE 0x0004 + +UV_EXTERN int uv_fs_copyfile(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, + uv_dirent_t* ent); +UV_EXTERN int uv_fs_opendir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_readdir(uv_loop_t* loop, + uv_fs_t* req, + uv_dir_t* dir, + uv_fs_cb cb); +UV_EXTERN int uv_fs_closedir(uv_loop_t* loop, + uv_fs_t* req, + uv_dir_t* dir, + uv_fs_cb cb); +UV_EXTERN int uv_fs_stat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rename(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, + uv_fs_t* req, + uv_file out_fd, + uv_file in_fd, + int64_t in_offset, + size_t length, + uv_fs_cb cb); +UV_EXTERN int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +#define UV_FS_UTIME_NOW (INFINITY) +#define UV_FS_UTIME_OMIT (NAN) +UV_EXTERN int uv_fs_utime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_futime(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_lutime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_link(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * path argument points to a directory. + */ +#define UV_FS_SYMLINK_DIR 0x0001 + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * the symlink is to be created using junction points. + */ +#define UV_FS_SYMLINK_JUNCTION 0x0002 + +UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); +UV_EXTERN int uv_fs_lchown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); +UV_EXTERN int uv_fs_statfs(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); + +enum uv_fs_event { + UV_RENAME = 1, + UV_CHANGE = 2 +}; + +struct uv_fs_event_s { + UV_HANDLE_FIELDS + /* private */ + char* path; + UV_FS_EVENT_PRIVATE_FIELDS +}; + +/* + * uv_fs_stat() based polling file watcher. + */ +struct uv_fs_poll_s { + UV_HANDLE_FIELDS + /* Private, don't touch. */ + void* poll_ctx; +}; + +UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, + uv_fs_poll_cb poll_cb, + const char* path, + unsigned int interval); +UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, + char* buffer, + size_t* size); + +struct uv_signal_s { + UV_HANDLE_FIELDS + uv_signal_cb signal_cb; + int signum; + UV_SIGNAL_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); +UV_EXTERN int uv_signal_start(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_stop(uv_signal_t* handle); + +UV_EXTERN void uv_loadavg(double avg[3]); + +/* + * Flags to be passed to uv_fs_event_start(). + */ +enum uv_fs_event_flags { + /* + * By default, if the fs event watcher is given a directory name, we will + * watch for all events in that directory. This flags overrides this behavior + * and makes fs_event report only changes to the directory entry itself. This + * flag does not affect individual files watched. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_WATCH_ENTRY = 1, + + /* + * By default uv_fs_event will try to use a kernel interface such as inotify + * or kqueue to detect events. This may not work on remote filesystems such + * as NFS mounts. This flag makes fs_event fall back to calling stat() on a + * regular interval. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_STAT = 2, + + /* + * By default, event watcher, when watching directory, is not registering + * (is ignoring) changes in it's subdirectories. + * This flag will override this behaviour on platforms that support it. + */ + UV_FS_EVENT_RECURSIVE = 4 +}; + +UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags); +UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, + char* buffer, + size_t* size); + +UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); +UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); + +UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); +UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); +UV_EXTERN int uv_ip_name(const struct sockaddr* src, char* dst, size_t size); + +UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); +UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); + +struct uv_random_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* private */ + int status; + void* buf; + size_t buflen; + uv_random_cb cb; + struct uv__work work_req; +}; + +UV_EXTERN int uv_random(uv_loop_t* loop, + uv_random_t* req, + void* buf, + size_t buflen, + unsigned flags, /* For future extension; must be 0. */ + uv_random_cb cb); + +#if defined(IF_NAMESIZE) +#define UV_IF_NAMESIZE (IF_NAMESIZE + 1) +#elif defined(IFNAMSIZ) +#define UV_IF_NAMESIZE (IFNAMSIZ + 1) +#else +#define UV_IF_NAMESIZE (16 + 1) +#endif + +UV_EXTERN int uv_if_indextoname(unsigned int ifindex, + char* buffer, + size_t* size); +UV_EXTERN int uv_if_indextoiid(unsigned int ifindex, + char* buffer, + size_t* size); + +UV_EXTERN int uv_exepath(char* buffer, size_t* size); + +UV_EXTERN int uv_cwd(char* buffer, size_t* size); + +UV_EXTERN int uv_chdir(const char* dir); + +UV_EXTERN uint64_t uv_get_free_memory(void); +UV_EXTERN uint64_t uv_get_total_memory(void); +UV_EXTERN uint64_t uv_get_constrained_memory(void); +UV_EXTERN uint64_t uv_get_available_memory(void); + +UV_EXTERN int uv_clock_gettime(uv_clock_id clock_id, uv_timespec64_t* ts); +UV_EXTERN uint64_t uv_hrtime(void); +UV_EXTERN void uv_sleep(unsigned int msec); + +UV_EXTERN void uv_disable_stdio_inheritance(void); + +UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); +UV_EXTERN void uv_dlclose(uv_lib_t* lib); +UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); +UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); + +UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); +UV_EXTERN int uv_mutex_init_recursive(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); +UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); + +UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); + +UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); +UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); +UV_EXTERN void uv_sem_post(uv_sem_t* sem); +UV_EXTERN void uv_sem_wait(uv_sem_t* sem); +UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); + +UV_EXTERN int uv_cond_init(uv_cond_t* cond); +UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); +UV_EXTERN void uv_cond_signal(uv_cond_t* cond); +UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); + +UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); +UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); +UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); + +UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); +UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, + uint64_t timeout); + +UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); + +UV_EXTERN int uv_key_create(uv_key_t* key); +UV_EXTERN void uv_key_delete(uv_key_t* key); +UV_EXTERN void* uv_key_get(uv_key_t* key); +UV_EXTERN void uv_key_set(uv_key_t* key, void* value); + +UV_EXTERN int uv_gettimeofday(uv_timeval64_t* tv); + +typedef void (*uv_thread_cb)(void* arg); + +UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); +UV_EXTERN int uv_thread_detach(uv_thread_t* tid); + +typedef enum { + UV_THREAD_NO_FLAGS = 0x00, + UV_THREAD_HAS_STACK_SIZE = 0x01 +} uv_thread_create_flags; + +struct uv_thread_options_s { + unsigned int flags; + size_t stack_size; + /* More fields may be added at any time. */ +}; + +typedef struct uv_thread_options_s uv_thread_options_t; + +UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid, + const uv_thread_options_t* params, + uv_thread_cb entry, + void* arg); +UV_EXTERN int uv_thread_setaffinity(uv_thread_t* tid, + char* cpumask, + char* oldmask, + size_t mask_size); +UV_EXTERN int uv_thread_getaffinity(uv_thread_t* tid, + char* cpumask, + size_t mask_size); +UV_EXTERN int uv_thread_getcpu(void); +UV_EXTERN uv_thread_t uv_thread_self(void); +UV_EXTERN int uv_thread_join(uv_thread_t* tid); +UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); +UV_EXTERN int uv_thread_setname(const char* name); +UV_EXTERN int uv_thread_getname(uv_thread_t* tid, char* name, size_t size); + +/* The presence of these unions force similar struct layout. */ +#define XX(_, name) uv_##name##_t name; +union uv_any_handle { + UV_HANDLE_TYPE_MAP(XX) +}; + +union uv_any_req { + UV_REQ_TYPE_MAP(XX) +}; +#undef XX + +struct uv_loop_s { + /* User data - use this for whatever. */ + void* data; + /* Loop reference counting. */ + unsigned int active_handles; + struct uv__queue handle_queue; + union { + void* unused; + unsigned int count; + } active_reqs; + /* Internal storage for future extensions. */ + void* internal_fields; + /* Internal flag to signal loop stop. */ + unsigned int stop_flag; + UV_LOOP_PRIVATE_FIELDS +}; + +UV_EXTERN void* uv_loop_get_data(const uv_loop_t*); +UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data); + +/* Unicode utilities needed for dealing with Windows. */ +UV_EXTERN size_t uv_utf16_length_as_wtf8(const uint16_t* utf16, + ssize_t utf16_len); +UV_EXTERN int uv_utf16_to_wtf8(const uint16_t* utf16, + ssize_t utf16_len, + char** wtf8_ptr, + size_t* wtf8_len_ptr); +UV_EXTERN ssize_t uv_wtf8_length_as_utf16(const char* wtf8); +UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8, + uint16_t* utf16, + size_t utf16_len); + +/* Don't export the private CPP symbols. */ +#undef UV_HANDLE_TYPE_PRIVATE +#undef UV_REQ_TYPE_PRIVATE +#undef UV_REQ_PRIVATE_FIELDS +#undef UV_STREAM_PRIVATE_FIELDS +#undef UV_TCP_PRIVATE_FIELDS +#undef UV_PREPARE_PRIVATE_FIELDS +#undef UV_CHECK_PRIVATE_FIELDS +#undef UV_IDLE_PRIVATE_FIELDS +#undef UV_ASYNC_PRIVATE_FIELDS +#undef UV_TIMER_PRIVATE_FIELDS +#undef UV_GETADDRINFO_PRIVATE_FIELDS +#undef UV_GETNAMEINFO_PRIVATE_FIELDS +#undef UV_FS_REQ_PRIVATE_FIELDS +#undef UV_WORK_PRIVATE_FIELDS +#undef UV_FS_EVENT_PRIVATE_FIELDS +#undef UV_SIGNAL_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS +#undef UV__ERR + +#ifdef __cplusplus +} +#endif +#endif /* UV_H */ diff --git a/src/bun.js/bindings/libuv/uv/aix.h b/src/buntime/compat/libuv/uv/aix.h similarity index 75% rename from src/bun.js/bindings/libuv/uv/aix.h rename to src/buntime/compat/libuv/uv/aix.h index 7dc992fa6d74..5a5c4cc67e16 100644 --- a/src/bun.js/bindings/libuv/uv/aix.h +++ b/src/buntime/compat/libuv/uv/aix.h @@ -22,11 +22,11 @@ #ifndef UV_AIX_H #define UV_AIX_H -#define UV_PLATFORM_LOOP_FIELDS \ - int fs_fd; \ +#define UV_PLATFORM_LOOP_FIELDS \ + int fs_fd; -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ - char *dir_filename; \ +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; \ + char* dir_filename; #endif /* UV_AIX_H */ diff --git a/src/bun.js/bindings/libuv/uv/bsd.h b/src/buntime/compat/libuv/uv/bsd.h similarity index 75% rename from src/bun.js/bindings/libuv/uv/bsd.h rename to src/buntime/compat/libuv/uv/bsd.h index 2d72b3d77113..fd4585c1d848 100644 --- a/src/bun.js/bindings/libuv/uv/bsd.h +++ b/src/buntime/compat/libuv/uv/bsd.h @@ -22,12 +22,12 @@ #ifndef UV_BSD_H #define UV_BSD_H -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; -#define UV_IO_PRIVATE_PLATFORM_FIELDS \ - int rcount; \ - int wcount; \ +#define UV_IO_PRIVATE_PLATFORM_FIELDS \ + int rcount; \ + int wcount; #define UV_HAVE_KQUEUE 1 diff --git a/src/buntime/compat/libuv/uv/darwin.h b/src/buntime/compat/libuv/uv/darwin.h new file mode 100644 index 000000000000..471609b32336 --- /dev/null +++ b/src/buntime/compat/libuv/uv/darwin.h @@ -0,0 +1,61 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_DARWIN_H +#define UV_DARWIN_H + +#if defined(__APPLE__) && defined(__MACH__) +#include +#include +#include +#include +#define UV_PLATFORM_SEM_T semaphore_t +#endif + +#define UV_IO_PRIVATE_PLATFORM_FIELDS \ + int rcount; \ + int wcount; + +#define UV_PLATFORM_LOOP_FIELDS \ + uv_thread_t cf_thread; \ + void* _cf_reserved; \ + void* cf_state; \ + uv_mutex_t cf_mutex; \ + uv_sem_t cf_sem; \ + struct uv__queue cf_signals; + +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; \ + char* realpath; \ + int realpath_len; \ + int cf_flags; \ + uv_async_t* cf_cb; \ + struct uv__queue cf_events; \ + struct uv__queue cf_member; \ + int cf_error; \ + uv_mutex_t cf_mutex; + +#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ + void* select; + +#define UV_HAVE_KQUEUE 1 + +#endif /* UV_DARWIN_H */ diff --git a/src/bun.js/bindings/libuv/uv/errno.h b/src/buntime/compat/libuv/uv/errno.h similarity index 50% rename from src/bun.js/bindings/libuv/uv/errno.h rename to src/buntime/compat/libuv/uv/errno.h index ac00778cfc59..4a27a0861453 100644 --- a/src/bun.js/bindings/libuv/uv/errno.h +++ b/src/buntime/compat/libuv/uv/errno.h @@ -24,384 +24,384 @@ #include #if EDOM > 0 -# define UV__ERR(x) (-(x)) +#define UV__ERR(x) (-(x)) #else -# define UV__ERR(x) (x) +#define UV__ERR(x) (x) #endif -#define UV__EOF (-4095) +#define UV__EOF (-4095) #define UV__UNKNOWN (-4094) -#define UV__EAI_ADDRFAMILY (-3000) -#define UV__EAI_AGAIN (-3001) -#define UV__EAI_BADFLAGS (-3002) -#define UV__EAI_CANCELED (-3003) -#define UV__EAI_FAIL (-3004) -#define UV__EAI_FAMILY (-3005) -#define UV__EAI_MEMORY (-3006) -#define UV__EAI_NODATA (-3007) -#define UV__EAI_NONAME (-3008) -#define UV__EAI_OVERFLOW (-3009) -#define UV__EAI_SERVICE (-3010) -#define UV__EAI_SOCKTYPE (-3011) -#define UV__EAI_BADHINTS (-3013) -#define UV__EAI_PROTOCOL (-3014) +#define UV__EAI_ADDRFAMILY (-3000) +#define UV__EAI_AGAIN (-3001) +#define UV__EAI_BADFLAGS (-3002) +#define UV__EAI_CANCELED (-3003) +#define UV__EAI_FAIL (-3004) +#define UV__EAI_FAMILY (-3005) +#define UV__EAI_MEMORY (-3006) +#define UV__EAI_NODATA (-3007) +#define UV__EAI_NONAME (-3008) +#define UV__EAI_OVERFLOW (-3009) +#define UV__EAI_SERVICE (-3010) +#define UV__EAI_SOCKTYPE (-3011) +#define UV__EAI_BADHINTS (-3013) +#define UV__EAI_PROTOCOL (-3014) /* Only map to the system errno on non-Windows platforms. It's apparently * a fairly common practice for Windows programmers to redefine errno codes. */ #if defined(E2BIG) && !defined(_WIN32) -# define UV__E2BIG UV__ERR(E2BIG) +#define UV__E2BIG UV__ERR(E2BIG) #else -# define UV__E2BIG (-4093) +#define UV__E2BIG (-4093) #endif #if defined(EACCES) && !defined(_WIN32) -# define UV__EACCES UV__ERR(EACCES) +#define UV__EACCES UV__ERR(EACCES) #else -# define UV__EACCES (-4092) +#define UV__EACCES (-4092) #endif #if defined(EADDRINUSE) && !defined(_WIN32) -# define UV__EADDRINUSE UV__ERR(EADDRINUSE) +#define UV__EADDRINUSE UV__ERR(EADDRINUSE) #else -# define UV__EADDRINUSE (-4091) +#define UV__EADDRINUSE (-4091) #endif #if defined(EADDRNOTAVAIL) && !defined(_WIN32) -# define UV__EADDRNOTAVAIL UV__ERR(EADDRNOTAVAIL) +#define UV__EADDRNOTAVAIL UV__ERR(EADDRNOTAVAIL) #else -# define UV__EADDRNOTAVAIL (-4090) +#define UV__EADDRNOTAVAIL (-4090) #endif #if defined(EAFNOSUPPORT) && !defined(_WIN32) -# define UV__EAFNOSUPPORT UV__ERR(EAFNOSUPPORT) +#define UV__EAFNOSUPPORT UV__ERR(EAFNOSUPPORT) #else -# define UV__EAFNOSUPPORT (-4089) +#define UV__EAFNOSUPPORT (-4089) #endif #if defined(EAGAIN) && !defined(_WIN32) -# define UV__EAGAIN UV__ERR(EAGAIN) +#define UV__EAGAIN UV__ERR(EAGAIN) #else -# define UV__EAGAIN (-4088) +#define UV__EAGAIN (-4088) #endif #if defined(EALREADY) && !defined(_WIN32) -# define UV__EALREADY UV__ERR(EALREADY) +#define UV__EALREADY UV__ERR(EALREADY) #else -# define UV__EALREADY (-4084) +#define UV__EALREADY (-4084) #endif #if defined(EBADF) && !defined(_WIN32) -# define UV__EBADF UV__ERR(EBADF) +#define UV__EBADF UV__ERR(EBADF) #else -# define UV__EBADF (-4083) +#define UV__EBADF (-4083) #endif #if defined(EBUSY) && !defined(_WIN32) -# define UV__EBUSY UV__ERR(EBUSY) +#define UV__EBUSY UV__ERR(EBUSY) #else -# define UV__EBUSY (-4082) +#define UV__EBUSY (-4082) #endif #if defined(ECANCELED) && !defined(_WIN32) -# define UV__ECANCELED UV__ERR(ECANCELED) +#define UV__ECANCELED UV__ERR(ECANCELED) #else -# define UV__ECANCELED (-4081) +#define UV__ECANCELED (-4081) #endif #if defined(ECHARSET) && !defined(_WIN32) -# define UV__ECHARSET UV__ERR(ECHARSET) +#define UV__ECHARSET UV__ERR(ECHARSET) #else -# define UV__ECHARSET (-4080) +#define UV__ECHARSET (-4080) #endif #if defined(ECONNABORTED) && !defined(_WIN32) -# define UV__ECONNABORTED UV__ERR(ECONNABORTED) +#define UV__ECONNABORTED UV__ERR(ECONNABORTED) #else -# define UV__ECONNABORTED (-4079) +#define UV__ECONNABORTED (-4079) #endif #if defined(ECONNREFUSED) && !defined(_WIN32) -# define UV__ECONNREFUSED UV__ERR(ECONNREFUSED) +#define UV__ECONNREFUSED UV__ERR(ECONNREFUSED) #else -# define UV__ECONNREFUSED (-4078) +#define UV__ECONNREFUSED (-4078) #endif #if defined(ECONNRESET) && !defined(_WIN32) -# define UV__ECONNRESET UV__ERR(ECONNRESET) +#define UV__ECONNRESET UV__ERR(ECONNRESET) #else -# define UV__ECONNRESET (-4077) +#define UV__ECONNRESET (-4077) #endif #if defined(EDESTADDRREQ) && !defined(_WIN32) -# define UV__EDESTADDRREQ UV__ERR(EDESTADDRREQ) +#define UV__EDESTADDRREQ UV__ERR(EDESTADDRREQ) #else -# define UV__EDESTADDRREQ (-4076) +#define UV__EDESTADDRREQ (-4076) #endif #if defined(EEXIST) && !defined(_WIN32) -# define UV__EEXIST UV__ERR(EEXIST) +#define UV__EEXIST UV__ERR(EEXIST) #else -# define UV__EEXIST (-4075) +#define UV__EEXIST (-4075) #endif #if defined(EFAULT) && !defined(_WIN32) -# define UV__EFAULT UV__ERR(EFAULT) +#define UV__EFAULT UV__ERR(EFAULT) #else -# define UV__EFAULT (-4074) +#define UV__EFAULT (-4074) #endif #if defined(EHOSTUNREACH) && !defined(_WIN32) -# define UV__EHOSTUNREACH UV__ERR(EHOSTUNREACH) +#define UV__EHOSTUNREACH UV__ERR(EHOSTUNREACH) #else -# define UV__EHOSTUNREACH (-4073) +#define UV__EHOSTUNREACH (-4073) #endif #if defined(EINTR) && !defined(_WIN32) -# define UV__EINTR UV__ERR(EINTR) +#define UV__EINTR UV__ERR(EINTR) #else -# define UV__EINTR (-4072) +#define UV__EINTR (-4072) #endif #if defined(EINVAL) && !defined(_WIN32) -# define UV__EINVAL UV__ERR(EINVAL) +#define UV__EINVAL UV__ERR(EINVAL) #else -# define UV__EINVAL (-4071) +#define UV__EINVAL (-4071) #endif #if defined(EIO) && !defined(_WIN32) -# define UV__EIO UV__ERR(EIO) +#define UV__EIO UV__ERR(EIO) #else -# define UV__EIO (-4070) +#define UV__EIO (-4070) #endif #if defined(EISCONN) && !defined(_WIN32) -# define UV__EISCONN UV__ERR(EISCONN) +#define UV__EISCONN UV__ERR(EISCONN) #else -# define UV__EISCONN (-4069) +#define UV__EISCONN (-4069) #endif #if defined(EISDIR) && !defined(_WIN32) -# define UV__EISDIR UV__ERR(EISDIR) +#define UV__EISDIR UV__ERR(EISDIR) #else -# define UV__EISDIR (-4068) +#define UV__EISDIR (-4068) #endif #if defined(ELOOP) && !defined(_WIN32) -# define UV__ELOOP UV__ERR(ELOOP) +#define UV__ELOOP UV__ERR(ELOOP) #else -# define UV__ELOOP (-4067) +#define UV__ELOOP (-4067) #endif #if defined(EMFILE) && !defined(_WIN32) -# define UV__EMFILE UV__ERR(EMFILE) +#define UV__EMFILE UV__ERR(EMFILE) #else -# define UV__EMFILE (-4066) +#define UV__EMFILE (-4066) #endif #if defined(EMSGSIZE) && !defined(_WIN32) -# define UV__EMSGSIZE UV__ERR(EMSGSIZE) +#define UV__EMSGSIZE UV__ERR(EMSGSIZE) #else -# define UV__EMSGSIZE (-4065) +#define UV__EMSGSIZE (-4065) #endif #if defined(ENAMETOOLONG) && !defined(_WIN32) -# define UV__ENAMETOOLONG UV__ERR(ENAMETOOLONG) +#define UV__ENAMETOOLONG UV__ERR(ENAMETOOLONG) #else -# define UV__ENAMETOOLONG (-4064) +#define UV__ENAMETOOLONG (-4064) #endif #if defined(ENETDOWN) && !defined(_WIN32) -# define UV__ENETDOWN UV__ERR(ENETDOWN) +#define UV__ENETDOWN UV__ERR(ENETDOWN) #else -# define UV__ENETDOWN (-4063) +#define UV__ENETDOWN (-4063) #endif #if defined(ENETUNREACH) && !defined(_WIN32) -# define UV__ENETUNREACH UV__ERR(ENETUNREACH) +#define UV__ENETUNREACH UV__ERR(ENETUNREACH) #else -# define UV__ENETUNREACH (-4062) +#define UV__ENETUNREACH (-4062) #endif #if defined(ENFILE) && !defined(_WIN32) -# define UV__ENFILE UV__ERR(ENFILE) +#define UV__ENFILE UV__ERR(ENFILE) #else -# define UV__ENFILE (-4061) +#define UV__ENFILE (-4061) #endif #if defined(ENOBUFS) && !defined(_WIN32) -# define UV__ENOBUFS UV__ERR(ENOBUFS) +#define UV__ENOBUFS UV__ERR(ENOBUFS) #else -# define UV__ENOBUFS (-4060) +#define UV__ENOBUFS (-4060) #endif #if defined(ENODEV) && !defined(_WIN32) -# define UV__ENODEV UV__ERR(ENODEV) +#define UV__ENODEV UV__ERR(ENODEV) #else -# define UV__ENODEV (-4059) +#define UV__ENODEV (-4059) #endif #if defined(ENOENT) && !defined(_WIN32) -# define UV__ENOENT UV__ERR(ENOENT) +#define UV__ENOENT UV__ERR(ENOENT) #else -# define UV__ENOENT (-4058) +#define UV__ENOENT (-4058) #endif #if defined(ENOMEM) && !defined(_WIN32) -# define UV__ENOMEM UV__ERR(ENOMEM) +#define UV__ENOMEM UV__ERR(ENOMEM) #else -# define UV__ENOMEM (-4057) +#define UV__ENOMEM (-4057) #endif #if defined(ENONET) && !defined(_WIN32) -# define UV__ENONET UV__ERR(ENONET) +#define UV__ENONET UV__ERR(ENONET) #else -# define UV__ENONET (-4056) +#define UV__ENONET (-4056) #endif #if defined(ENOSPC) && !defined(_WIN32) -# define UV__ENOSPC UV__ERR(ENOSPC) +#define UV__ENOSPC UV__ERR(ENOSPC) #else -# define UV__ENOSPC (-4055) +#define UV__ENOSPC (-4055) #endif #if defined(ENOSYS) && !defined(_WIN32) -# define UV__ENOSYS UV__ERR(ENOSYS) +#define UV__ENOSYS UV__ERR(ENOSYS) #else -# define UV__ENOSYS (-4054) +#define UV__ENOSYS (-4054) #endif #if defined(ENOTCONN) && !defined(_WIN32) -# define UV__ENOTCONN UV__ERR(ENOTCONN) +#define UV__ENOTCONN UV__ERR(ENOTCONN) #else -# define UV__ENOTCONN (-4053) +#define UV__ENOTCONN (-4053) #endif #if defined(ENOTDIR) && !defined(_WIN32) -# define UV__ENOTDIR UV__ERR(ENOTDIR) +#define UV__ENOTDIR UV__ERR(ENOTDIR) #else -# define UV__ENOTDIR (-4052) +#define UV__ENOTDIR (-4052) #endif #if defined(ENOTEMPTY) && !defined(_WIN32) -# define UV__ENOTEMPTY UV__ERR(ENOTEMPTY) +#define UV__ENOTEMPTY UV__ERR(ENOTEMPTY) #else -# define UV__ENOTEMPTY (-4051) +#define UV__ENOTEMPTY (-4051) #endif #if defined(ENOTSOCK) && !defined(_WIN32) -# define UV__ENOTSOCK UV__ERR(ENOTSOCK) +#define UV__ENOTSOCK UV__ERR(ENOTSOCK) #else -# define UV__ENOTSOCK (-4050) +#define UV__ENOTSOCK (-4050) #endif #if defined(ENOTSUP) && !defined(_WIN32) -# define UV__ENOTSUP UV__ERR(ENOTSUP) +#define UV__ENOTSUP UV__ERR(ENOTSUP) #else -# define UV__ENOTSUP (-4049) +#define UV__ENOTSUP (-4049) #endif #if defined(EPERM) && !defined(_WIN32) -# define UV__EPERM UV__ERR(EPERM) +#define UV__EPERM UV__ERR(EPERM) #else -# define UV__EPERM (-4048) +#define UV__EPERM (-4048) #endif #if defined(EPIPE) && !defined(_WIN32) -# define UV__EPIPE UV__ERR(EPIPE) +#define UV__EPIPE UV__ERR(EPIPE) #else -# define UV__EPIPE (-4047) +#define UV__EPIPE (-4047) #endif #if defined(EPROTO) && !defined(_WIN32) -# define UV__EPROTO UV__ERR(EPROTO) +#define UV__EPROTO UV__ERR(EPROTO) #else -# define UV__EPROTO (-4046) +#define UV__EPROTO (-4046) #endif #if defined(EPROTONOSUPPORT) && !defined(_WIN32) -# define UV__EPROTONOSUPPORT UV__ERR(EPROTONOSUPPORT) +#define UV__EPROTONOSUPPORT UV__ERR(EPROTONOSUPPORT) #else -# define UV__EPROTONOSUPPORT (-4045) +#define UV__EPROTONOSUPPORT (-4045) #endif #if defined(EPROTOTYPE) && !defined(_WIN32) -# define UV__EPROTOTYPE UV__ERR(EPROTOTYPE) +#define UV__EPROTOTYPE UV__ERR(EPROTOTYPE) #else -# define UV__EPROTOTYPE (-4044) +#define UV__EPROTOTYPE (-4044) #endif #if defined(EROFS) && !defined(_WIN32) -# define UV__EROFS UV__ERR(EROFS) +#define UV__EROFS UV__ERR(EROFS) #else -# define UV__EROFS (-4043) +#define UV__EROFS (-4043) #endif #if defined(ESHUTDOWN) && !defined(_WIN32) -# define UV__ESHUTDOWN UV__ERR(ESHUTDOWN) +#define UV__ESHUTDOWN UV__ERR(ESHUTDOWN) #else -# define UV__ESHUTDOWN (-4042) +#define UV__ESHUTDOWN (-4042) #endif #if defined(ESPIPE) && !defined(_WIN32) -# define UV__ESPIPE UV__ERR(ESPIPE) +#define UV__ESPIPE UV__ERR(ESPIPE) #else -# define UV__ESPIPE (-4041) +#define UV__ESPIPE (-4041) #endif #if defined(ESRCH) && !defined(_WIN32) -# define UV__ESRCH UV__ERR(ESRCH) +#define UV__ESRCH UV__ERR(ESRCH) #else -# define UV__ESRCH (-4040) +#define UV__ESRCH (-4040) #endif #if defined(ETIMEDOUT) && !defined(_WIN32) -# define UV__ETIMEDOUT UV__ERR(ETIMEDOUT) +#define UV__ETIMEDOUT UV__ERR(ETIMEDOUT) #else -# define UV__ETIMEDOUT (-4039) +#define UV__ETIMEDOUT (-4039) #endif #if defined(ETXTBSY) && !defined(_WIN32) -# define UV__ETXTBSY UV__ERR(ETXTBSY) +#define UV__ETXTBSY UV__ERR(ETXTBSY) #else -# define UV__ETXTBSY (-4038) +#define UV__ETXTBSY (-4038) #endif #if defined(EXDEV) && !defined(_WIN32) -# define UV__EXDEV UV__ERR(EXDEV) +#define UV__EXDEV UV__ERR(EXDEV) #else -# define UV__EXDEV (-4037) +#define UV__EXDEV (-4037) #endif #if defined(EFBIG) && !defined(_WIN32) -# define UV__EFBIG UV__ERR(EFBIG) +#define UV__EFBIG UV__ERR(EFBIG) #else -# define UV__EFBIG (-4036) +#define UV__EFBIG (-4036) #endif #if defined(ENOPROTOOPT) && !defined(_WIN32) -# define UV__ENOPROTOOPT UV__ERR(ENOPROTOOPT) +#define UV__ENOPROTOOPT UV__ERR(ENOPROTOOPT) #else -# define UV__ENOPROTOOPT (-4035) +#define UV__ENOPROTOOPT (-4035) #endif #if defined(ERANGE) && !defined(_WIN32) -# define UV__ERANGE UV__ERR(ERANGE) +#define UV__ERANGE UV__ERR(ERANGE) #else -# define UV__ERANGE (-4034) +#define UV__ERANGE (-4034) #endif #if defined(ENXIO) && !defined(_WIN32) -# define UV__ENXIO UV__ERR(ENXIO) +#define UV__ENXIO UV__ERR(ENXIO) #else -# define UV__ENXIO (-4033) +#define UV__ENXIO (-4033) #endif #if defined(EMLINK) && !defined(_WIN32) -# define UV__EMLINK UV__ERR(EMLINK) +#define UV__EMLINK UV__ERR(EMLINK) #else -# define UV__EMLINK (-4032) +#define UV__EMLINK (-4032) #endif /* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is @@ -409,51 +409,47 @@ * icky to hard-code it. */ #if defined(EHOSTDOWN) && !defined(_WIN32) -# define UV__EHOSTDOWN UV__ERR(EHOSTDOWN) -#elif defined(__APPLE__) || \ - defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) -# define UV__EHOSTDOWN (-64) +#define UV__EHOSTDOWN UV__ERR(EHOSTDOWN) +#elif defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#define UV__EHOSTDOWN (-64) #else -# define UV__EHOSTDOWN (-4031) +#define UV__EHOSTDOWN (-4031) #endif #if defined(EREMOTEIO) && !defined(_WIN32) -# define UV__EREMOTEIO UV__ERR(EREMOTEIO) +#define UV__EREMOTEIO UV__ERR(EREMOTEIO) #else -# define UV__EREMOTEIO (-4030) +#define UV__EREMOTEIO (-4030) #endif #if defined(ENOTTY) && !defined(_WIN32) -# define UV__ENOTTY UV__ERR(ENOTTY) +#define UV__ENOTTY UV__ERR(ENOTTY) #else -# define UV__ENOTTY (-4029) +#define UV__ENOTTY (-4029) #endif #if defined(EFTYPE) && !defined(_WIN32) -# define UV__EFTYPE UV__ERR(EFTYPE) +#define UV__EFTYPE UV__ERR(EFTYPE) #else -# define UV__EFTYPE (-4028) +#define UV__EFTYPE (-4028) #endif #if defined(EILSEQ) && !defined(_WIN32) -# define UV__EILSEQ UV__ERR(EILSEQ) +#define UV__EILSEQ UV__ERR(EILSEQ) #else -# define UV__EILSEQ (-4027) +#define UV__EILSEQ (-4027) #endif #if defined(EOVERFLOW) && !defined(_WIN32) -# define UV__EOVERFLOW UV__ERR(EOVERFLOW) +#define UV__EOVERFLOW UV__ERR(EOVERFLOW) #else -# define UV__EOVERFLOW (-4026) +#define UV__EOVERFLOW (-4026) #endif #if defined(ESOCKTNOSUPPORT) && !defined(_WIN32) -# define UV__ESOCKTNOSUPPORT UV__ERR(ESOCKTNOSUPPORT) +#define UV__ESOCKTNOSUPPORT UV__ERR(ESOCKTNOSUPPORT) #else -# define UV__ESOCKTNOSUPPORT (-4025) +#define UV__ESOCKTNOSUPPORT (-4025) #endif /* FreeBSD defines ENODATA in /usr/include/c++/v1/errno.h which is only visible @@ -461,23 +457,23 @@ * libuv in a C++ project. */ #if defined(ENODATA) && !defined(_WIN32) -# define UV__ENODATA UV__ERR(ENODATA) +#define UV__ENODATA UV__ERR(ENODATA) #elif defined(__FreeBSD__) -# define UV__ENODATA (-9919) +#define UV__ENODATA (-9919) #else -# define UV__ENODATA (-4024) +#define UV__ENODATA (-4024) #endif #if defined(EUNATCH) && !defined(_WIN32) -# define UV__EUNATCH UV__ERR(EUNATCH) +#define UV__EUNATCH UV__ERR(EUNATCH) #else -# define UV__EUNATCH (-4023) +#define UV__EUNATCH (-4023) #endif #if defined(ENOEXEC) && !defined(_WIN32) -# define UV__ENOEXEC UV__ERR(ENOEXEC) +#define UV__ENOEXEC UV__ERR(ENOEXEC) #else -# define UV__ENOEXEC (-4022) +#define UV__ENOEXEC (-4022) #endif #endif /* UV_ERRNO_H_ */ diff --git a/src/bun.js/bindings/libuv/uv/linux.h b/src/buntime/compat/libuv/uv/linux.h similarity index 68% rename from src/bun.js/bindings/libuv/uv/linux.h rename to src/buntime/compat/libuv/uv/linux.h index 9f22f8cf726c..3a3a111a96d0 100644 --- a/src/bun.js/bindings/libuv/uv/linux.h +++ b/src/buntime/compat/libuv/uv/linux.h @@ -22,13 +22,13 @@ #ifndef UV_LINUX_H #define UV_LINUX_H -#define UV_PLATFORM_LOOP_FIELDS \ - uv__io_t inotify_read_watcher; \ - void* inotify_watchers; \ - int inotify_fd; \ +#define UV_PLATFORM_LOOP_FIELDS \ + uv__io_t inotify_read_watcher; \ + void* inotify_watchers; \ + int inotify_fd; -#define UV_PLATFORM_FS_EVENT_FIELDS \ - struct uv__queue watchers; \ - int wd; \ +#define UV_PLATFORM_FS_EVENT_FIELDS \ + struct uv__queue watchers; \ + int wd; #endif /* UV_LINUX_H */ diff --git a/src/bun.js/bindings/libuv/uv/os390.h b/src/buntime/compat/libuv/uv/os390.h similarity index 79% rename from src/bun.js/bindings/libuv/uv/os390.h rename to src/buntime/compat/libuv/uv/os390.h index 0267d74cbd02..c68b71cf20c3 100644 --- a/src/bun.js/bindings/libuv/uv/os390.h +++ b/src/buntime/compat/libuv/uv/os390.h @@ -24,10 +24,10 @@ #define UV_PLATFORM_SEM_T long -#define UV_PLATFORM_LOOP_FIELDS \ - void* ep; \ +#define UV_PLATFORM_LOOP_FIELDS \ + void* ep; -#define UV_PLATFORM_FS_EVENT_FIELDS \ - char rfis_rftok[8]; \ +#define UV_PLATFORM_FS_EVENT_FIELDS \ + char rfis_rftok[8]; #endif /* UV_MVS_H */ diff --git a/src/bun.js/bindings/libuv/uv/posix.h b/src/buntime/compat/libuv/uv/posix.h similarity index 75% rename from src/bun.js/bindings/libuv/uv/posix.h rename to src/buntime/compat/libuv/uv/posix.h index 9a96634db0e3..8c75a3514636 100644 --- a/src/bun.js/bindings/libuv/uv/posix.h +++ b/src/buntime/compat/libuv/uv/posix.h @@ -22,10 +22,10 @@ #ifndef UV_POSIX_H #define UV_POSIX_H -#define UV_PLATFORM_LOOP_FIELDS \ - struct pollfd* poll_fds; \ - size_t poll_fds_used; \ - size_t poll_fds_size; \ - unsigned char poll_fds_iterating; \ +#define UV_PLATFORM_LOOP_FIELDS \ + struct pollfd* poll_fds; \ + size_t poll_fds_used; \ + size_t poll_fds_size; \ + unsigned char poll_fds_iterating; #endif /* UV_POSIX_H */ diff --git a/src/bun.js/bindings/libuv/uv/sunos.h b/src/buntime/compat/libuv/uv/sunos.h similarity index 75% rename from src/bun.js/bindings/libuv/uv/sunos.h rename to src/buntime/compat/libuv/uv/sunos.h index 042166424e50..3842047c509d 100644 --- a/src/bun.js/bindings/libuv/uv/sunos.h +++ b/src/buntime/compat/libuv/uv/sunos.h @@ -29,15 +29,15 @@ * add the fs_event fields even when this version of SunOS doesn't support * file watching. */ -#define UV_PLATFORM_LOOP_FIELDS \ - uv__io_t fs_event_watcher; \ - int fs_fd; \ +#define UV_PLATFORM_LOOP_FIELDS \ + uv__io_t fs_event_watcher; \ + int fs_fd; #if defined(PORT_SOURCE_FILE) -# define UV_PLATFORM_FS_EVENT_FIELDS \ - file_obj_t fo; \ - int fd; \ +#define UV_PLATFORM_FS_EVENT_FIELDS \ + file_obj_t fo; \ + int fd; #endif /* defined(PORT_SOURCE_FILE) */ diff --git a/src/bun.js/bindings/libuv/uv/threadpool.h b/src/buntime/compat/libuv/uv/threadpool.h similarity index 90% rename from src/bun.js/bindings/libuv/uv/threadpool.h rename to src/buntime/compat/libuv/uv/threadpool.h index 24ce916fda45..9cf8754b5234 100644 --- a/src/bun.js/bindings/libuv/uv/threadpool.h +++ b/src/buntime/compat/libuv/uv/threadpool.h @@ -28,10 +28,10 @@ #define UV_THREADPOOL_H_ struct uv__work { - void (*work)(struct uv__work *w); - void (*done)(struct uv__work *w, int status); - struct uv_loop_s* loop; - struct uv__queue wq; + void (*work)(struct uv__work* w); + void (*done)(struct uv__work* w, int status); + struct uv_loop_s* loop; + struct uv__queue wq; }; #endif /* UV_THREADPOOL_H_ */ diff --git a/src/buntime/compat/libuv/uv/tree.h b/src/buntime/compat/libuv/uv/tree.h new file mode 100644 index 000000000000..93e91376ba57 --- /dev/null +++ b/src/buntime/compat/libuv/uv/tree.h @@ -0,0 +1,512 @@ +/*- + * Copyright 2002 Niels Provos + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UV_TREE_H_ +#define UV_TREE_H_ + +#ifndef UV__UNUSED +#if __GNUC__ +#define UV__UNUSED __attribute__((unused)) +#else +#define UV__UNUSED +#endif +#endif + +/* + * This file defines data structures for red-black trees. + * A red-black tree is a binary search tree with the node color as an + * extra attribute. It fulfills a set of conditions: + * - every search path from the root to a leaf consists of the + * same number of black nodes, + * - each red node (except for the root) has a black parent, + * - each leaf node is black. + * + * Every operation on a red-black tree is bounded as O(lg n). + * The maximum height of a red-black tree is 2lg (n+1). + */ + +/* Macros that define a red-black tree */ +#define RB_HEAD(name, type) \ + struct name { \ + struct type* rbh_root; /* root of the tree */ \ + } + +#define RB_INITIALIZER(root) \ + { NULL } + +#define RB_INIT(root) \ + do { \ + (root)->rbh_root = NULL; \ + } while (/*CONSTCOND*/ 0) + +#define RB_BLACK 0 +#define RB_RED 1 +#define RB_ENTRY(type) \ + struct { \ + struct type* rbe_left; /* left element */ \ + struct type* rbe_right; /* right element */ \ + struct type* rbe_parent; /* parent element */ \ + int rbe_color; /* node color */ \ + } + +#define RB_LEFT(elm, field) (elm)->field.rbe_left +#define RB_RIGHT(elm, field) (elm)->field.rbe_right +#define RB_PARENT(elm, field) (elm)->field.rbe_parent +#define RB_COLOR(elm, field) (elm)->field.rbe_color +#define RB_ROOT(head) (head)->rbh_root +#define RB_EMPTY(head) (RB_ROOT(head) == NULL) + +#define RB_SET(elm, parent, field) \ + do { \ + RB_PARENT(elm, field) = parent; \ + RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ + RB_COLOR(elm, field) = RB_RED; \ + } while (/*CONSTCOND*/ 0) + +#define RB_SET_BLACKRED(black, red, field) \ + do { \ + RB_COLOR(black, field) = RB_BLACK; \ + RB_COLOR(red, field) = RB_RED; \ + } while (/*CONSTCOND*/ 0) + +#ifndef RB_AUGMENT +#define RB_AUGMENT(x) \ + do { \ + } while (0) +#endif + +#define RB_ROTATE_LEFT(head, elm, tmp, field) \ + do { \ + (tmp) = RB_RIGHT(elm, field); \ + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ + RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ + } \ + RB_AUGMENT(elm); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_LEFT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ + RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ + } while (/*CONSTCOND*/ 0) + +#define RB_ROTATE_RIGHT(head, elm, tmp, field) \ + do { \ + (tmp) = RB_LEFT(elm, field); \ + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ + RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ + } \ + RB_AUGMENT(elm); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_RIGHT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ + RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ + } while (/*CONSTCOND*/ 0) + +/* Generates prototypes and inline functions */ +#define RB_PROTOTYPE(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, ) +#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static) +#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ + attr void name##_RB_INSERT_COLOR(struct name*, struct type*); \ + attr void name##_RB_REMOVE_COLOR(struct name*, struct type*, struct type*); \ + attr struct type* name##_RB_REMOVE(struct name*, struct type*); \ + attr struct type* name##_RB_INSERT(struct name*, struct type*); \ + attr struct type* name##_RB_FIND(struct name*, struct type*); \ + attr struct type* name##_RB_NFIND(struct name*, struct type*); \ + attr struct type* name##_RB_NEXT(struct type*); \ + attr struct type* name##_RB_PREV(struct type*); \ + attr struct type* name##_RB_MINMAX(struct name*, int); + +/* Main rb operation. + * Moves node close to the key of elm to top + */ +#define RB_GENERATE(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp, ) +#define RB_GENERATE_STATIC(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static) +#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ + attr void \ + name##_RB_INSERT_COLOR(struct name* head, struct type* elm) \ + { \ + struct type *parent, *gparent, *tmp; \ + while ((parent = RB_PARENT(elm, field)) != NULL && RB_COLOR(parent, field) == RB_RED) { \ + gparent = RB_PARENT(parent, field); \ + if (parent == RB_LEFT(gparent, field)) { \ + tmp = RB_RIGHT(gparent, field); \ + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field); \ + elm = gparent; \ + continue; \ + } \ + if (RB_RIGHT(parent, field) == elm) { \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + tmp = parent; \ + parent = elm; \ + elm = tmp; \ + } \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_RIGHT(head, gparent, tmp, field); \ + } else { \ + tmp = RB_LEFT(gparent, field); \ + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field); \ + elm = gparent; \ + continue; \ + } \ + if (RB_LEFT(parent, field) == elm) { \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + tmp = parent; \ + parent = elm; \ + elm = tmp; \ + } \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_LEFT(head, gparent, tmp, field); \ + } \ + } \ + RB_COLOR(head->rbh_root, field) = RB_BLACK; \ + } \ + \ + attr void \ + name##_RB_REMOVE_COLOR(struct name* head, struct type* parent, \ + struct type* elm) \ + { \ + struct type* tmp; \ + while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && elm != RB_ROOT(head)) { \ + if (RB_LEFT(parent, field) == elm) { \ + tmp = RB_RIGHT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + tmp = RB_RIGHT(parent, field); \ + } \ + if ((RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ + } else { \ + if (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \ + struct type* oleft; \ + if ((oleft = RB_LEFT(tmp, field)) \ + != NULL) \ + RB_COLOR(oleft, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_RIGHT(head, tmp, oleft, field); \ + tmp = RB_RIGHT(parent, field); \ + } \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + if (RB_RIGHT(tmp, field)) \ + RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ + break; \ + } \ + } else { \ + tmp = RB_LEFT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + tmp = RB_LEFT(parent, field); \ + } \ + if ((RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ + } else { \ + if (RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \ + struct type* oright; \ + if ((oright = RB_RIGHT(tmp, field)) \ + != NULL) \ + RB_COLOR(oright, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_LEFT(head, tmp, oright, field); \ + tmp = RB_LEFT(parent, field); \ + } \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + if (RB_LEFT(tmp, field)) \ + RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ + break; \ + } \ + } \ + } \ + if (elm) \ + RB_COLOR(elm, field) = RB_BLACK; \ + } \ + \ + attr struct type* \ + name##_RB_REMOVE(struct name* head, struct type* elm) \ + { \ + struct type *child, *parent, *old = elm; \ + int color; \ + if (RB_LEFT(elm, field) == NULL) \ + child = RB_RIGHT(elm, field); \ + else if (RB_RIGHT(elm, field) == NULL) \ + child = RB_LEFT(elm, field); \ + else { \ + struct type* left; \ + elm = RB_RIGHT(elm, field); \ + while ((left = RB_LEFT(elm, field)) != NULL) \ + elm = left; \ + child = RB_RIGHT(elm, field); \ + parent = RB_PARENT(elm, field); \ + color = RB_COLOR(elm, field); \ + if (child) \ + RB_PARENT(child, field) = parent; \ + if (parent) { \ + if (RB_LEFT(parent, field) == elm) \ + RB_LEFT(parent, field) = child; \ + else \ + RB_RIGHT(parent, field) = child; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = child; \ + if (RB_PARENT(elm, field) == old) \ + parent = elm; \ + (elm)->field = (old)->field; \ + if (RB_PARENT(old, field)) { \ + if (RB_LEFT(RB_PARENT(old, field), field) == old) \ + RB_LEFT(RB_PARENT(old, field), field) = elm; \ + else \ + RB_RIGHT(RB_PARENT(old, field), field) = elm; \ + RB_AUGMENT(RB_PARENT(old, field)); \ + } else \ + RB_ROOT(head) = elm; \ + RB_PARENT(RB_LEFT(old, field), field) = elm; \ + if (RB_RIGHT(old, field)) \ + RB_PARENT(RB_RIGHT(old, field), field) = elm; \ + if (parent) { \ + left = parent; \ + do { \ + RB_AUGMENT(left); \ + } while ((left = RB_PARENT(left, field)) != NULL); \ + } \ + goto color; \ + } \ + parent = RB_PARENT(elm, field); \ + color = RB_COLOR(elm, field); \ + if (child) \ + RB_PARENT(child, field) = parent; \ + if (parent) { \ + if (RB_LEFT(parent, field) == elm) \ + RB_LEFT(parent, field) = child; \ + else \ + RB_RIGHT(parent, field) = child; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = child; \ + color: \ + if (color == RB_BLACK) \ + name##_RB_REMOVE_COLOR(head, parent, child); \ + return (old); \ + } \ + \ + /* Inserts a node into the RB tree */ \ + attr struct type* \ + name##_RB_INSERT(struct name* head, struct type* elm) \ + { \ + struct type* tmp; \ + struct type* parent = NULL; \ + int comp = 0; \ + tmp = RB_ROOT(head); \ + while (tmp) { \ + parent = tmp; \ + comp = (cmp)(elm, parent); \ + if (comp < 0) \ + tmp = RB_LEFT(tmp, field); \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + RB_SET(elm, parent, field); \ + if (parent != NULL) { \ + if (comp < 0) \ + RB_LEFT(parent, field) = elm; \ + else \ + RB_RIGHT(parent, field) = elm; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = elm; \ + name##_RB_INSERT_COLOR(head, elm); \ + return (NULL); \ + } \ + \ + /* Finds the node with the same key as elm */ \ + attr struct type* \ + name##_RB_FIND(struct name* head, struct type* elm) \ + { \ + struct type* tmp = RB_ROOT(head); \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) \ + tmp = RB_LEFT(tmp, field); \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (NULL); \ + } \ + \ + /* Finds the first node greater than or equal to the search key */ \ + attr struct type* \ + name##_RB_NFIND(struct name* head, struct type* elm) \ + { \ + struct type* tmp = RB_ROOT(head); \ + struct type* res = NULL; \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) { \ + res = tmp; \ + tmp = RB_LEFT(tmp, field); \ + } else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (res); \ + } \ + \ + /* ARGSUSED */ \ + attr struct type* \ + name##_RB_NEXT(struct type* elm) \ + { \ + if (RB_RIGHT(elm, field)) { \ + elm = RB_RIGHT(elm, field); \ + while (RB_LEFT(elm, field)) \ + elm = RB_LEFT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ + } \ + \ + /* ARGSUSED */ \ + attr struct type* \ + name##_RB_PREV(struct type* elm) \ + { \ + if (RB_LEFT(elm, field)) { \ + elm = RB_LEFT(elm, field); \ + while (RB_RIGHT(elm, field)) \ + elm = RB_RIGHT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ + } \ + \ + attr struct type* \ + name##_RB_MINMAX(struct name* head, int val) \ + { \ + struct type* tmp = RB_ROOT(head); \ + struct type* parent = NULL; \ + while (tmp) { \ + parent = tmp; \ + if (val < 0) \ + tmp = RB_LEFT(tmp, field); \ + else \ + tmp = RB_RIGHT(tmp, field); \ + } \ + return (parent); \ + } + +#define RB_NEGINF -1 +#define RB_INF 1 + +#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) +#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) +#define RB_FIND(name, x, y) name##_RB_FIND(x, y) +#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) +#define RB_NEXT(name, x) name##_RB_NEXT(x) +#define RB_PREV(name, x) name##_RB_PREV(x) +#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) +#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) + +#define RB_FOREACH(x, name, head) \ + for ((x) = RB_MIN(name, head); \ + (x) != NULL; \ + (x) = name##_RB_NEXT(x)) + +#define RB_FOREACH_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_SAFE(x, name, head, y) \ + for ((x) = RB_MIN(name, head); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE(x, name, head) \ + for ((x) = RB_MAX(name, head); \ + (x) != NULL; \ + (x) = name##_RB_PREV(x)) + +#define RB_FOREACH_REVERSE_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#endif /* UV_TREE_H_ */ diff --git a/src/buntime/compat/libuv/uv/unix.h b/src/buntime/compat/libuv/uv/unix.h new file mode 100644 index 000000000000..3dad451d13a3 --- /dev/null +++ b/src/buntime/compat/libuv/uv/unix.h @@ -0,0 +1,503 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_UNIX_H +#define UV_UNIX_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include /* MAXHOSTNAMELEN on Solaris */ + +#include +#include + +#if !defined(__MVS__) +#include +#include /* MAXHOSTNAMELEN on Linux and the BSDs */ +#endif +#include +#include + +#include "uv/threadpool.h" + +#if defined(__linux__) +#include "uv/linux.h" +#elif defined(__MVS__) +#include "uv/os390.h" +#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */ +#include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */ +#elif defined(_AIX) +#include "uv/aix.h" +#elif defined(__sun) +#include "uv/sunos.h" +#elif defined(__APPLE__) +#include "uv/darwin.h" +#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#include "uv/bsd.h" +#elif defined(__CYGWIN__) || defined(__MSYS__) || defined(__HAIKU__) || defined(__QNX__) || defined(__GNU__) +#include "uv/posix.h" +#endif + +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif + +#ifndef NI_MAXSERV +#define NI_MAXSERV 32 +#endif + +#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS +#define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +struct uv__io_s; +struct uv_loop_s; + +typedef void (*uv__io_cb)(struct uv_loop_s* loop, + struct uv__io_s* w, + unsigned int events); +typedef struct uv__io_s uv__io_t; + +struct uv__io_s { + uv__io_cb cb; + struct uv__queue pending_queue; + struct uv__queue watcher_queue; + unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ + unsigned int events; /* Current event mask. */ + int fd; + UV_IO_PRIVATE_PLATFORM_FIELDS +}; + +#ifndef UV_PLATFORM_SEM_T +#define UV_PLATFORM_SEM_T sem_t +#endif + +#ifndef UV_PLATFORM_LOOP_FIELDS +#define UV_PLATFORM_LOOP_FIELDS /* empty */ +#endif + +#ifndef UV_PLATFORM_FS_EVENT_FIELDS +#define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ +#endif + +#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS +#define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +/* Note: May be cast to struct iovec. See writev(2). */ +typedef struct uv_buf_t { + char* base; + size_t len; +} uv_buf_t; + +typedef int uv_file; +typedef int uv_os_sock_t; +typedef int uv_os_fd_t; +typedef pid_t uv_pid_t; + +#define UV_ONCE_INIT PTHREAD_ONCE_INIT + +typedef pthread_once_t uv_once_t; +typedef pthread_t uv_thread_t; +typedef pthread_mutex_t uv_mutex_t; +typedef pthread_rwlock_t uv_rwlock_t; +typedef UV_PLATFORM_SEM_T uv_sem_t; +typedef pthread_cond_t uv_cond_t; +typedef pthread_key_t uv_key_t; + +/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ +#if defined(_AIX) || defined(__OpenBSD__) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) +/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ +struct _uv_barrier { + uv_mutex_t mutex; + uv_cond_t cond; + unsigned threshold; + unsigned in; + unsigned out; +}; + +typedef struct { + struct _uv_barrier* b; +#if defined(PTHREAD_BARRIER_SERIAL_THREAD) + /* TODO(bnoordhuis) Remove padding in v2. */ + char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; +#endif +} uv_barrier_t; +#else +typedef pthread_barrier_t uv_barrier_t; +#endif + +/* Platform-specific definitions for uv_spawn support. */ +typedef gid_t uv_gid_t; +typedef uid_t uv_uid_t; + +typedef struct dirent uv__dirent_t; + +#define UV_DIR_PRIVATE_FIELDS \ + DIR* dir; + +#if defined(DT_UNKNOWN) +#define HAVE_DIRENT_TYPES +#if defined(DT_REG) +#define UV__DT_FILE DT_REG +#else +#define UV__DT_FILE -1 +#endif +#if defined(DT_DIR) +#define UV__DT_DIR DT_DIR +#else +#define UV__DT_DIR -2 +#endif +#if defined(DT_LNK) +#define UV__DT_LINK DT_LNK +#else +#define UV__DT_LINK -3 +#endif +#if defined(DT_FIFO) +#define UV__DT_FIFO DT_FIFO +#else +#define UV__DT_FIFO -4 +#endif +#if defined(DT_SOCK) +#define UV__DT_SOCKET DT_SOCK +#else +#define UV__DT_SOCKET -5 +#endif +#if defined(DT_CHR) +#define UV__DT_CHAR DT_CHR +#else +#define UV__DT_CHAR -6 +#endif +#if defined(DT_BLK) +#define UV__DT_BLOCK DT_BLK +#else +#define UV__DT_BLOCK -7 +#endif +#endif + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC /* empty */ + +typedef struct { + void* handle; + char* errmsg; +} uv_lib_t; + +#define UV_LOOP_PRIVATE_FIELDS \ + unsigned long flags; \ + int backend_fd; \ + struct uv__queue pending_queue; \ + struct uv__queue watcher_queue; \ + uv__io_t** watchers; \ + unsigned int nwatchers; \ + unsigned int nfds; \ + struct uv__queue wq; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; \ + uv_rwlock_t cloexec_lock; \ + uv_handle_t* closing_handles; \ + struct uv__queue process_handles; \ + struct uv__queue prepare_handles; \ + struct uv__queue check_handles; \ + struct uv__queue idle_handles; \ + struct uv__queue async_handles; \ + void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \ + uv__io_t async_io_watcher; \ + int async_wfd; \ + struct { \ + void* min; \ + unsigned int nelts; \ + } timer_heap; \ + uint64_t timer_counter; \ + uint64_t time; \ + int signal_pipefd[2]; \ + uv__io_t signal_io_watcher; \ + uv_signal_t child_watcher; \ + int emfile_fd; \ + UV_PLATFORM_LOOP_FIELDS + +#define UV_REQ_TYPE_PRIVATE /* empty */ + +#define UV_REQ_PRIVATE_FIELDS /* empty */ + +#define UV_PRIVATE_REQ_TYPES /* empty */ + +#define UV_WRITE_PRIVATE_FIELDS \ + struct uv__queue queue; \ + unsigned int write_index; \ + uv_buf_t* bufs; \ + unsigned int nbufs; \ + int error; \ + uv_buf_t bufsml[4]; + +#define UV_CONNECT_PRIVATE_FIELDS \ + struct uv__queue queue; + +#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + struct uv__queue queue; \ + union { \ + struct sockaddr addr; \ + struct sockaddr_storage storage; \ + } u; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + ssize_t status; \ + uv_udp_send_cb send_cb; \ + uv_buf_t bufsml[4]; + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* next_closing; \ + unsigned int flags; + +#define UV_STREAM_PRIVATE_FIELDS \ + uv_connect_t* connect_req; \ + uv_shutdown_t* shutdown_req; \ + uv__io_t io_watcher; \ + struct uv__queue write_queue; \ + struct uv__queue write_completed_queue; \ + uv_connection_cb connection_cb; \ + int delayed_error; \ + int accepted_fd; \ + void* queued_fds; \ + UV_STREAM_PRIVATE_PLATFORM_FIELDS + +#define UV_TCP_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_PRIVATE_FIELDS \ + uv_alloc_cb alloc_cb; \ + uv_udp_recv_cb recv_cb; \ + uv__io_t io_watcher; \ + struct uv__queue write_queue; \ + struct uv__queue write_completed_queue; + +#define UV_PIPE_PRIVATE_FIELDS \ + const char* pipe_fname; /* NULL or strdup'ed */ + +#define UV_POLL_PRIVATE_FIELDS \ + uv__io_t io_watcher; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_cb prepare_cb; \ + struct uv__queue queue; + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_cb check_cb; \ + struct uv__queue queue; + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_cb idle_cb; \ + struct uv__queue queue; + +#define UV_ASYNC_PRIVATE_FIELDS \ + uv_async_cb async_cb; \ + struct uv__queue queue; \ + int pending; + +#define UV_TIMER_PRIVATE_FIELDS \ + uv_timer_cb timer_cb; \ + union { \ + void* heap[3]; \ + struct uv__queue queue; \ + } node; \ + uint64_t timeout; \ + uint64_t repeat; \ + uint64_t start_id; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb cb; \ + struct addrinfo* hints; \ + char* hostname; \ + char* service; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + struct uv__queue queue; \ + int status; + +#define UV_FS_PRIVATE_FIELDS \ + const char* new_path; \ + uv_file file; \ + int flags; \ + mode_t mode; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + off_t off; \ + uv_uid_t uid; \ + uv_gid_t gid; \ + double atime; \ + double mtime; \ + struct uv__work work_req; \ + uv_buf_t bufsml[4]; + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_TTY_PRIVATE_FIELDS \ + struct termios orig_termios; \ + int mode; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + /* RB_ENTRY(uv_signal_s) tree_entry; */ \ + struct { \ + struct uv_signal_s* rbe_left; \ + struct uv_signal_s* rbe_right; \ + struct uv_signal_s* rbe_parent; \ + int rbe_color; \ + } tree_entry; \ + /* Use two counters here so we don have to fiddle with atomics. */ \ + unsigned int caught_signals; \ + unsigned int dispatched_signals; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + uv_fs_event_cb cb; \ + UV_PLATFORM_FS_EVENT_FIELDS + +/* fs open() flags supported on this platform: */ +#if defined(O_APPEND) +#define UV_FS_O_APPEND O_APPEND +#else +#define UV_FS_O_APPEND 0 +#endif +#if defined(O_CREAT) +#define UV_FS_O_CREAT O_CREAT +#else +#define UV_FS_O_CREAT 0 +#endif + +#if defined(__linux__) && defined(__arm__) +#define UV_FS_O_DIRECT 0x10000 +#elif defined(__linux__) && defined(__m68k__) +#define UV_FS_O_DIRECT 0x10000 +#elif defined(__linux__) && defined(__mips__) +#define UV_FS_O_DIRECT 0x08000 +#elif defined(__linux__) && defined(__powerpc__) +#define UV_FS_O_DIRECT 0x20000 +#elif defined(__linux__) && defined(__s390x__) +#define UV_FS_O_DIRECT 0x04000 +#elif defined(__linux__) && defined(__x86_64__) +#define UV_FS_O_DIRECT 0x04000 +#elif defined(__linux__) && defined(__loongarch__) +#define UV_FS_O_DIRECT 0x04000 +#elif defined(O_DIRECT) +#define UV_FS_O_DIRECT O_DIRECT +#else +#define UV_FS_O_DIRECT 0 +#endif + +#if defined(O_DIRECTORY) +#define UV_FS_O_DIRECTORY O_DIRECTORY +#else +#define UV_FS_O_DIRECTORY 0 +#endif +#if defined(O_DSYNC) +#define UV_FS_O_DSYNC O_DSYNC +#else +#define UV_FS_O_DSYNC 0 +#endif +#if defined(O_EXCL) +#define UV_FS_O_EXCL O_EXCL +#else +#define UV_FS_O_EXCL 0 +#endif +#if defined(O_EXLOCK) +#define UV_FS_O_EXLOCK O_EXLOCK +#else +#define UV_FS_O_EXLOCK 0 +#endif +#if defined(O_NOATIME) +#define UV_FS_O_NOATIME O_NOATIME +#else +#define UV_FS_O_NOATIME 0 +#endif +#if defined(O_NOCTTY) +#define UV_FS_O_NOCTTY O_NOCTTY +#else +#define UV_FS_O_NOCTTY 0 +#endif +#if defined(O_NOFOLLOW) +#define UV_FS_O_NOFOLLOW O_NOFOLLOW +#else +#define UV_FS_O_NOFOLLOW 0 +#endif +#if defined(O_NONBLOCK) +#define UV_FS_O_NONBLOCK O_NONBLOCK +#else +#define UV_FS_O_NONBLOCK 0 +#endif +#if defined(O_RDONLY) +#define UV_FS_O_RDONLY O_RDONLY +#else +#define UV_FS_O_RDONLY 0 +#endif +#if defined(O_RDWR) +#define UV_FS_O_RDWR O_RDWR +#else +#define UV_FS_O_RDWR 0 +#endif +#if defined(O_SYMLINK) +#define UV_FS_O_SYMLINK O_SYMLINK +#else +#define UV_FS_O_SYMLINK 0 +#endif +#if defined(O_SYNC) +#define UV_FS_O_SYNC O_SYNC +#else +#define UV_FS_O_SYNC 0 +#endif +#if defined(O_TRUNC) +#define UV_FS_O_TRUNC O_TRUNC +#else +#define UV_FS_O_TRUNC 0 +#endif +#if defined(O_WRONLY) +#define UV_FS_O_WRONLY O_WRONLY +#else +#define UV_FS_O_WRONLY 0 +#endif + +/* fs open() flags supported on other platforms: */ +#define UV_FS_O_FILEMAP 0 +#define UV_FS_O_RANDOM 0 +#define UV_FS_O_SHORT_LIVED 0 +#define UV_FS_O_SEQUENTIAL 0 +#define UV_FS_O_TEMPORARY 0 + +#endif /* UV_UNIX_H */ diff --git a/src/bun.js/bindings/libuv/uv/version.h b/src/buntime/compat/libuv/uv/version.h similarity index 91% rename from src/bun.js/bindings/libuv/uv/version.h rename to src/buntime/compat/libuv/uv/version.h index 77432f259588..2db20807de1c 100644 --- a/src/bun.js/bindings/libuv/uv/version.h +++ b/src/buntime/compat/libuv/uv/version.h @@ -22,7 +22,7 @@ #ifndef UV_VERSION_H #define UV_VERSION_H - /* +/* * Versions with the same major number are ABI stable. API is allowed to * evolve between minor releases, but only in a backwards compatible way. * Make sure you update the -soname directives in configure.ac @@ -36,8 +36,6 @@ #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" -#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) +#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | (UV_VERSION_MINOR << 8) | (UV_VERSION_PATCH)) #endif /* UV_VERSION_H */ diff --git a/src/buntime/compat/libuv/uv/win.h b/src/buntime/compat/libuv/uv/win.h new file mode 100644 index 000000000000..629b758cbb43 --- /dev/null +++ b/src/buntime/compat/libuv/uv/win.h @@ -0,0 +1,703 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0A00 +#endif + +#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +#define SSIZE_MAX INTPTR_MAX +#define _SSIZE_T_ +#define _SSIZE_T_DEFINED +#endif + +#include + +#ifndef LOCALE_INVARIANT +#define LOCALE_INVARIANT 0x007f +#endif + +#include +/* Disable the typedef in mstcpip.h of MinGW. */ +#define _TCP_INITIAL_RTO_PARAMETERS _TCP_INITIAL_RTO_PARAMETERS__AVOID +#define TCP_INITIAL_RTO_PARAMETERS TCP_INITIAL_RTO_PARAMETERS__AVOID +#define PTCP_INITIAL_RTO_PARAMETERS PTCP_INITIAL_RTO_PARAMETERS__AVOID +#include +#undef _TCP_INITIAL_RTO_PARAMETERS +#undef TCP_INITIAL_RTO_PARAMETERS +#undef PTCP_INITIAL_RTO_PARAMETERS +#include + +#include +#include +#include +#include +#include + +#include "uv/tree.h" +#include "uv/threadpool.h" + +#define MAX_PIPENAME_LEN 256 + +#ifndef S_IFLNK +#define S_IFLNK 0xA000 +#endif + +/* Define missing in Windows Kit Include\{VERSION}\ucrt\sys\stat.h */ +#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined(S_IFIFO) +#define S_IFIFO _S_IFIFO +#endif + +/* Additional signals supported by uv_signal and or uv_kill. The CRT defines + * the following signals already: + * + * #define SIGINT 2 + * #define SIGILL 4 + * #define SIGABRT_COMPAT 6 + * #define SIGFPE 8 + * #define SIGSEGV 11 + * #define SIGTERM 15 + * #define SIGBREAK 21 + * #define SIGABRT 22 + * + * The additional signals have values that are common on other Unix + * variants (Linux and Darwin) + */ +#define SIGHUP 1 +#define SIGQUIT 3 +#define SIGKILL 9 +#define SIGWINCH 28 + +/* Redefine NSIG to take SIGWINCH into consideration */ +#if defined(NSIG) && NSIG <= SIGWINCH +#undef NSIG +#endif +#ifndef NSIG +#define NSIG SIGWINCH + 1 +#endif + +/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like + * platforms. However MinGW doesn't define it, so we do. */ +#ifndef SIGABRT_COMPAT +#define SIGABRT_COMPAT 6 +#endif + +/* + * Guids and typedefs for winsock extension functions + * Mingw32 doesn't have these :-( + */ +#ifndef WSAID_ACCEPTEX +#define WSAID_ACCEPTEX \ + { 0xb5367df1, 0xcbac, 0x11cf, \ + { 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 } } + +#define WSAID_CONNECTEX \ + { 0x25a207b9, 0xddf3, 0x4660, \ + { 0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e } } + +#define WSAID_GETACCEPTEXSOCKADDRS \ + { 0xb5367df2, 0xcbac, 0x11cf, \ + { 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 } } + +#define WSAID_DISCONNECTEX \ + { 0x7fda2e11, 0x8630, 0x436f, \ + { 0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57 } } + +#define WSAID_TRANSMITFILE \ + { 0xb5367df0, 0xcbac, 0x11cf, \ + { 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 } } + +typedef BOOL(PASCAL* LPFN_ACCEPTEX)(SOCKET sListenSocket, + SOCKET sAcceptSocket, + PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPDWORD lpdwBytesReceived, + LPOVERLAPPED lpOverlapped); + +typedef BOOL(PASCAL* LPFN_CONNECTEX)(SOCKET s, + const struct sockaddr* name, + int namelen, + PVOID lpSendBuffer, + DWORD dwSendDataLength, + LPDWORD lpdwBytesSent, + LPOVERLAPPED lpOverlapped); + +typedef void(PASCAL* LPFN_GETACCEPTEXSOCKADDRS)(PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPSOCKADDR* LocalSockaddr, + LPINT LocalSockaddrLength, + LPSOCKADDR* RemoteSockaddr, + LPINT RemoteSockaddrLength); + +typedef BOOL(PASCAL* LPFN_DISCONNECTEX)(SOCKET hSocket, + LPOVERLAPPED lpOverlapped, + DWORD dwFlags, + DWORD reserved); + +typedef BOOL(PASCAL* LPFN_TRANSMITFILE)(SOCKET hSocket, + HANDLE hFile, + DWORD nNumberOfBytesToWrite, + DWORD nNumberOfBytesPerSend, + LPOVERLAPPED lpOverlapped, + LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, + DWORD dwFlags); + +typedef PVOID RTL_SRWLOCK; +typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif + +typedef int(WSAAPI* LPFN_WSARECV)(SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +typedef int(WSAAPI* LPFN_WSARECVFROM)(SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + struct sockaddr* addr, + LPINT addr_len, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +#ifndef _NTDEF_ +typedef LONG NTSTATUS; +typedef NTSTATUS* PNTSTATUS; +#endif + +#ifndef RTL_CONDITION_VARIABLE_INIT +typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; +#endif + +typedef struct _AFD_POLL_HANDLE_INFO { + HANDLE Handle; + ULONG Events; + NTSTATUS Status; +} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; + +typedef struct _AFD_POLL_INFO { + LARGE_INTEGER Timeout; + ULONG NumberOfHandles; + ULONG Exclusive; + AFD_POLL_HANDLE_INFO Handles[1]; +} AFD_POLL_INFO, *PAFD_POLL_INFO; + +#define UV_MSAFD_PROVIDER_COUNT 4 + +/** + * It should be possible to cast uv_buf_t[] to WSABUF[] + * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx + */ +typedef struct uv_buf_t { + ULONG len; + char* base; +} uv_buf_t; + +typedef int uv_file; +typedef SOCKET uv_os_sock_t; +typedef HANDLE uv_os_fd_t; +typedef int uv_pid_t; + +typedef HANDLE uv_thread_t; + +typedef HANDLE uv_sem_t; + +typedef CRITICAL_SECTION uv_mutex_t; + +/* This condition variable implementation is based on the SetEvent solution + * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + * We could not use the SignalObjectAndWait solution (section 3.4) because + * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and + * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. + */ + +typedef union { + CONDITION_VARIABLE cond_var; + struct { + unsigned int waiters_count; + CRITICAL_SECTION waiters_count_lock; + HANDLE signal_event; + HANDLE broadcast_event; + } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */ +} uv_cond_t; + +typedef struct { + SRWLOCK read_write_lock_; + /* TODO: retained for ABI compatibility; remove me in v2.x */ +#ifdef _WIN64 + unsigned char padding_[72]; +#else + unsigned char padding_[44]; +#endif +} uv_rwlock_t; + +typedef struct { + unsigned threshold; + unsigned in; + uv_mutex_t mutex; + /* TODO: in v2 make this a uv_cond_t, without unused_ */ + CONDITION_VARIABLE cond; + unsigned out; +} uv_barrier_t; + +typedef struct { + DWORD tls_index; +} uv_key_t; + +#define UV_ONCE_INIT { 0, NULL } + +typedef struct uv_once_s { + unsigned char unused; + INIT_ONCE init_once; +} uv_once_t; + +/* Platform-specific definitions for uv_spawn support. */ +typedef unsigned char uv_uid_t; +typedef unsigned char uv_gid_t; + +typedef struct uv__dirent_s { + int d_type; + char d_name[1]; +} uv__dirent_t; + +#define UV_DIR_PRIVATE_FIELDS \ + HANDLE dir_handle; \ + WIN32_FIND_DATAW find_data; \ + BOOL need_find_call; + +#define HAVE_DIRENT_TYPES +#define UV__DT_DIR UV_DIRENT_DIR +#define UV__DT_FILE UV_DIRENT_FILE +#define UV__DT_LINK UV_DIRENT_LINK +#define UV__DT_FIFO UV_DIRENT_FIFO +#define UV__DT_SOCKET UV_DIRENT_SOCKET +#define UV__DT_CHAR UV_DIRENT_CHAR +#define UV__DT_BLOCK UV_DIRENT_BLOCK + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC FAR WINAPI +typedef struct { + HMODULE handle; + char* errmsg; +} uv_lib_t; + +#define UV_LOOP_PRIVATE_FIELDS \ + /* The loop's I/O completion port */ \ + HANDLE iocp; \ + /* The current time according to the event loop. in msecs. */ \ + uint64_t time; \ + /* Tail of a single-linked circular queue of pending reqs. If the queue */ \ + /* is empty, tail_ is NULL. If there is only one item, */ \ + /* tail_->next_req == tail_ */ \ + uv_req_t* pending_reqs_tail; \ + /* Head of a single-linked list of closed handles */ \ + uv_handle_t* endgame_handles; \ + /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \ + void* timer_heap; \ + /* Lists of active loop (prepare / check / idle) watchers */ \ + uv_prepare_t* prepare_handles; \ + uv_check_t* check_handles; \ + uv_idle_t* idle_handles; \ + /* This pointer will refer to the prepare/check/idle handle whose */ \ + /* callback is scheduled to be called next. This is needed to allow */ \ + /* safe removal from one of the lists above while that list being */ \ + /* iterated over. */ \ + uv_prepare_t* next_prepare_handle; \ + uv_check_t* next_check_handle; \ + uv_idle_t* next_idle_handle; \ + /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \ + SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \ + /* No longer used. */ \ + unsigned int active_tcp_streams; \ + /* No longer used. */ \ + unsigned int active_udp_streams; \ + /* Counter to started timer */ \ + uint64_t timer_counter; \ + /* Threadpool */ \ + struct uv__queue wq; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; + +#define UV_REQ_TYPE_PRIVATE \ + /* TODO: remove the req suffix */ \ + UV_ACCEPT, \ + UV_FS_EVENT_REQ, \ + UV_POLL_REQ, \ + UV_PROCESS_EXIT, \ + UV_READ, \ + UV_UDP_RECV, \ + UV_WAKEUP, \ + UV_SIGNAL_REQ, + +#define UV_REQ_PRIVATE_FIELDS \ + union { \ + /* Used by I/O operations */ \ + struct { \ + OVERLAPPED overlapped; \ + size_t queued_bytes; \ + } io; \ + /* in v2, we can move these to the UV_CONNECT_PRIVATE_FIELDS */ \ + struct { \ + ULONG_PTR result; /* overlapped.Internal is reused to hold the result */ \ + HANDLE pipeHandle; \ + DWORD duplex_flags; \ + WCHAR* name; \ + } connect; \ + } u; \ + struct uv_req_s* next_req; + +#define UV_WRITE_PRIVATE_FIELDS \ + int coalesced; \ + uv_buf_t write_buffer; \ + HANDLE event_handle; \ + HANDLE wait_handle; + +#define UV_CONNECT_PRIVATE_FIELDS \ + /* empty */ + +#define UV_SHUTDOWN_PRIVATE_FIELDS \ + /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + /* empty */ + +#define UV_PRIVATE_REQ_TYPES \ + typedef struct uv_pipe_accept_s { \ + UV_REQ_FIELDS \ + HANDLE pipeHandle; \ + struct uv_pipe_accept_s* next_pending; \ + } uv_pipe_accept_t; \ + \ + typedef struct uv_tcp_accept_s { \ + UV_REQ_FIELDS \ + SOCKET accept_socket; \ + char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + struct uv_tcp_accept_s* next_pending; \ + } uv_tcp_accept_t; \ + \ + typedef struct uv_read_s { \ + UV_REQ_FIELDS \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + } uv_read_t; + +#define uv_stream_connection_fields \ + unsigned int write_reqs_pending; \ + uv_shutdown_t* shutdown_req; + +#define uv_stream_server_fields \ + uv_connection_cb connection_cb; + +#define UV_STREAM_PRIVATE_FIELDS \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_read_t read_req; \ + union { \ + struct { \ + uv_stream_connection_fields \ + } conn; \ + struct { \ + uv_stream_server_fields \ + } serv; \ + } stream; + +#define uv_tcp_server_fields \ + uv_tcp_accept_t* accept_reqs; \ + unsigned int processed_accepts; \ + uv_tcp_accept_t* pending_accepts; \ + LPFN_ACCEPTEX func_acceptex; + +#define uv_tcp_connection_fields \ + uv_buf_t read_buffer; \ + LPFN_CONNECTEX func_connectex; + +#define UV_TCP_PRIVATE_FIELDS \ + SOCKET socket; \ + int delayed_error; \ + union { \ + struct { \ + uv_tcp_server_fields \ + } serv; \ + struct { \ + uv_tcp_connection_fields \ + } conn; \ + } tcp; + +#define UV_UDP_PRIVATE_FIELDS \ + SOCKET socket; \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_req_t recv_req; \ + uv_buf_t recv_buffer; \ + struct sockaddr_storage recv_from; \ + int recv_from_len; \ + uv_udp_recv_cb recv_cb; \ + uv_alloc_cb alloc_cb; \ + LPFN_WSARECV func_wsarecv; \ + LPFN_WSARECVFROM func_wsarecvfrom; + +#define uv_pipe_server_fields \ + int pending_instances; \ + uv_pipe_accept_t* accept_reqs; \ + uv_pipe_accept_t* pending_accepts; + +#define uv_pipe_connection_fields \ + uv_timer_t* eof_timer; \ + uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ + DWORD ipc_remote_pid; \ + union { \ + uint32_t payload_remaining; \ + uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ + } ipc_data_frame; \ + struct uv__queue ipc_xfer_queue; \ + int ipc_xfer_queue_length; \ + uv_write_t* non_overlapped_writes_tail; \ + CRITICAL_SECTION readfile_thread_lock; \ + volatile HANDLE readfile_thread_handle; + +#define UV_PIPE_PRIVATE_FIELDS \ + HANDLE handle; \ + WCHAR* name; \ + union { \ + struct { \ + uv_pipe_server_fields \ + } serv; \ + struct { \ + uv_pipe_connection_fields \ + } conn; \ + } pipe; + +/* TODO: put the parser states in a union - TTY handles are always half-duplex + * so read-state can safely overlap write-state. */ +#define UV_TTY_PRIVATE_FIELDS \ + HANDLE handle; \ + union { \ + struct { \ + /* Used for readable TTY handles */ \ + union { \ + /* TODO: remove me in v2.x. */ \ + HANDLE unused_; \ + int mode; \ + } mode; \ + uv_buf_t read_line_buffer; \ + HANDLE read_raw_wait; \ + /* Fields used for translating win keystrokes into vt100 characters */ \ + char last_key[8]; \ + unsigned char last_key_offset; \ + unsigned char last_key_len; \ + WCHAR last_utf16_high_surrogate; \ + INPUT_RECORD last_input_record; \ + } rd; \ + struct { \ + /* Used for writable TTY handles */ \ + /* utf8-to-utf16 conversion state */ \ + unsigned int utf8_codepoint; \ + unsigned char utf8_bytes_left; \ + /* eol conversion state */ \ + unsigned char previous_eol; \ + /* ansi parser state */ \ + unsigned short ansi_parser_state; \ + unsigned char ansi_csi_argc; \ + unsigned short ansi_csi_argv[4]; \ + COORD saved_position; \ + WORD saved_attributes; \ + } wr; \ + } tty; + +#define UV_POLL_PRIVATE_FIELDS \ + SOCKET socket; \ + /* Used in fast mode */ \ + SOCKET peer_socket; \ + AFD_POLL_INFO afd_poll_info_1; \ + AFD_POLL_INFO afd_poll_info_2; \ + /* Used in fast and slow mode. */ \ + uv_req_t poll_req_1; \ + uv_req_t poll_req_2; \ + unsigned char submitted_events_1; \ + unsigned char submitted_events_2; \ + unsigned char mask_events_1; \ + unsigned char mask_events_2; \ + unsigned char events; + +#define UV_TIMER_PRIVATE_FIELDS \ + union { \ + void* heap[3]; \ + struct uv__queue queue; \ + } node; \ + int unused; \ + uint64_t timeout; \ + uint64_t repeat; \ + uint64_t start_id; \ + uv_timer_cb timer_cb; + +#define UV_ASYNC_PRIVATE_FIELDS \ + struct uv_req_s async_req; \ + uv_async_cb async_cb; \ + /* char to avoid alignment issues */ \ + char volatile async_sent; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_t* prepare_prev; \ + uv_prepare_t* prepare_next; \ + uv_prepare_cb prepare_cb; + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_t* check_prev; \ + uv_check_t* check_next; \ + uv_check_cb check_cb; + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_t* idle_prev; \ + uv_idle_t* idle_next; \ + uv_idle_cb idle_cb; + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* endgame_next; \ + unsigned int flags; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb getaddrinfo_cb; \ + void* alloc; \ + WCHAR* node; \ + WCHAR* service; \ + /* The addrinfoW field is used to store a pointer to the hints, and */ \ + /* later on to store the result of GetAddrInfoW. The final result will */ \ + /* be converted to struct addrinfo* and stored in the addrinfo field. */ \ + struct addrinfoW* addrinfow; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + struct uv_process_exit_s { \ + UV_REQ_FIELDS \ + } exit_req; \ + void* unused; /* TODO: retained for ABI compat; remove this in v2.x. */ \ + int exit_signal; \ + HANDLE wait_handle; \ + HANDLE process_handle; \ + volatile char exit_cb_pending; + +#define UV_FS_PRIVATE_FIELDS \ + struct uv__work work_req; \ + int flags; \ + DWORD sys_errno_; \ + union { \ + /* TODO: remove me in 0.9. */ \ + WCHAR* pathw; \ + int fd; \ + } file; \ + union { \ + struct { \ + int mode; \ + WCHAR* new_pathw; \ + int file_flags; \ + int fd_out; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + int64_t offset; \ + uv_buf_t bufsml[4]; \ + } info; \ + struct { \ + double atime; \ + double mtime; \ + } time; \ + } fs; + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + struct uv_fs_event_req_s { \ + UV_REQ_FIELDS \ + } req; \ + HANDLE dir_handle; \ + int req_pending; \ + uv_fs_event_cb cb; \ + WCHAR* filew; \ + WCHAR* short_filew; \ + WCHAR* dirw; \ + char* buffer; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + RB_ENTRY(uv_signal_s) \ + tree_entry; \ + struct uv_req_s signal_req; \ + unsigned long pending_signum; + +#ifndef F_OK +#define F_OK 0 +#endif +#ifndef R_OK +#define R_OK 4 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef X_OK +#define X_OK 1 +#endif + +/* fs open() flags supported on this platform: */ +#define UV_FS_O_APPEND _O_APPEND +#define UV_FS_O_CREAT _O_CREAT +#define UV_FS_O_EXCL _O_EXCL +#define UV_FS_O_FILEMAP 0x20000000 +#define UV_FS_O_RANDOM _O_RANDOM +#define UV_FS_O_RDONLY _O_RDONLY +#define UV_FS_O_RDWR _O_RDWR +#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL +#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED +#define UV_FS_O_TEMPORARY _O_TEMPORARY +#define UV_FS_O_TRUNC _O_TRUNC +#define UV_FS_O_WRONLY _O_WRONLY + +/* fs open() flags supported on other platforms (or mapped on this platform): */ +#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ +#define UV_FS_O_DIRECTORY 0 +#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ +#define UV_FS_O_NOATIME 0 +#define UV_FS_O_NOCTTY 0 +#define UV_FS_O_NOFOLLOW 0 +#define UV_FS_O_NONBLOCK 0 +#define UV_FS_O_SYMLINK 0 +#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --git a/src/bun.js/bindings/NapiClass.cpp b/src/buntime/compat/napi/NapiClass.cpp similarity index 100% rename from src/bun.js/bindings/NapiClass.cpp rename to src/buntime/compat/napi/NapiClass.cpp diff --git a/src/bun.js/bindings/NapiRef.cpp b/src/buntime/compat/napi/NapiRef.cpp similarity index 100% rename from src/bun.js/bindings/NapiRef.cpp rename to src/buntime/compat/napi/NapiRef.cpp diff --git a/src/bun.js/bindings/NapiWeakValue.cpp b/src/buntime/compat/napi/NapiWeakValue.cpp similarity index 100% rename from src/bun.js/bindings/NapiWeakValue.cpp rename to src/buntime/compat/napi/NapiWeakValue.cpp diff --git a/src/bun.js/bindings/napi.cpp b/src/buntime/compat/napi/napi.cpp similarity index 99% rename from src/bun.js/bindings/napi.cpp rename to src/buntime/compat/napi/napi.cpp index 447287be0e88..176ec698235f 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/buntime/compat/napi/napi.cpp @@ -2160,7 +2160,7 @@ extern "C" napi_status napi_get_value_int64(napi_env env, napi_value value, int6 NAPI_RETURN_SUCCESS(env); } -// must match src/bun.js/node/types.zig#Encoding, which matches WebCore::BufferEncodingType +// must match src/buntime/node/types.zig#Encoding, which matches WebCore::BufferEncodingType enum class NapiStringEncoding : uint8_t { utf8 = static_cast(WebCore::BufferEncodingType::utf8), utf16 = static_cast(WebCore::BufferEncodingType::utf16le), diff --git a/src/bun.js/bindings/napi.h b/src/buntime/compat/napi/napi.h similarity index 100% rename from src/bun.js/bindings/napi.h rename to src/buntime/compat/napi/napi.h diff --git a/src/bun.js/bindings/napi_external.cpp b/src/buntime/compat/napi/napi_external.cpp similarity index 100% rename from src/bun.js/bindings/napi_external.cpp rename to src/buntime/compat/napi/napi_external.cpp diff --git a/src/bun.js/bindings/napi_external.h b/src/buntime/compat/napi/napi_external.h similarity index 100% rename from src/bun.js/bindings/napi_external.h rename to src/buntime/compat/napi/napi_external.h diff --git a/src/bun.js/bindings/napi_finalizer.cpp b/src/buntime/compat/napi/napi_finalizer.cpp similarity index 100% rename from src/bun.js/bindings/napi_finalizer.cpp rename to src/buntime/compat/napi/napi_finalizer.cpp diff --git a/src/bun.js/bindings/napi_finalizer.h b/src/buntime/compat/napi/napi_finalizer.h similarity index 100% rename from src/bun.js/bindings/napi_finalizer.h rename to src/buntime/compat/napi/napi_finalizer.h diff --git a/src/bun.js/bindings/napi_handle_scope.cpp b/src/buntime/compat/napi/napi_handle_scope.cpp similarity index 100% rename from src/bun.js/bindings/napi_handle_scope.cpp rename to src/buntime/compat/napi/napi_handle_scope.cpp diff --git a/src/bun.js/bindings/napi_handle_scope.h b/src/buntime/compat/napi/napi_handle_scope.h similarity index 100% rename from src/bun.js/bindings/napi_handle_scope.h rename to src/buntime/compat/napi/napi_handle_scope.h diff --git a/src/bun.js/bindings/napi_macros.h b/src/buntime/compat/napi/napi_macros.h similarity index 100% rename from src/bun.js/bindings/napi_macros.h rename to src/buntime/compat/napi/napi_macros.h diff --git a/src/bun.js/bindings/napi_type_tag.cpp b/src/buntime/compat/napi/napi_type_tag.cpp similarity index 100% rename from src/bun.js/bindings/napi_type_tag.cpp rename to src/buntime/compat/napi/napi_type_tag.cpp diff --git a/src/bun.js/bindings/napi_type_tag.h b/src/buntime/compat/napi/napi_type_tag.h similarity index 100% rename from src/bun.js/bindings/napi_type_tag.h rename to src/buntime/compat/napi/napi_type_tag.h diff --git a/src/buntime/compat/v8/AGENTS.md b/src/buntime/compat/v8/AGENTS.md new file mode 100644 index 000000000000..523877245bef --- /dev/null +++ b/src/buntime/compat/v8/AGENTS.md @@ -0,0 +1,326 @@ +# V8 C++ API Implementation Guide + +This directory contains Bun's implementation of the V8 C++ API on top of JavaScriptCore. This allows native Node.js modules that use V8 APIs to work with Bun. + +## Architecture Overview + +Bun implements V8 APIs by creating a compatibility layer that: + +- Maps V8's `Local` handles to JSC's `JSValue` system +- Uses handle scopes to manage memory lifetimes similar to V8 +- Provides V8-compatible object layouts that inline V8 functions can read +- Manages tagged pointers for efficient value representation + +For detailed background, see the blog series: + +- [Part 1: Introduction and challenges](https://bun.com/blog/how-bun-supports-v8-apis-without-using-v8-part-1.md) +- [Part 2: Memory layout and object representation](https://bun.com/blog/how-bun-supports-v8-apis-without-using-v8-part-2.md) +- [Part 3: Garbage collection and primitives](https://bun.com/blog/how-bun-supports-v8-apis-without-using-v8-part-3.md) + +## Directory Structure + +``` +src/buntime/compat/v8/ +├── v8.h # Main header with V8_UNIMPLEMENTED macro +├── v8_*.h # V8 compatibility headers +├── V8*.h # V8 class headers (Number, String, Object, etc.) +├── V8*.cpp # V8 class implementations +├── shim/ # Internal implementation details +│ ├── Handle.h # Handle and ObjectLayout implementation +│ ├── HandleScopeBuffer.h # Handle scope memory management +│ ├── TaggedPointer.h # V8-style tagged pointer implementation +│ ├── Map.h # V8 Map objects for inline function compatibility +│ ├── GlobalInternals.h # V8 global state management +│ ├── InternalFieldObject.h # Objects with internal fields +│ └── Oddball.h # Primitive values (undefined, null, true, false) +├── node.h # Node.js module registration compatibility +└── real_v8.h # Includes real V8 headers when needed +``` + +## Implementing New V8 APIs + +### 1. Create Header and Implementation Files + +Create `V8NewClass.h`: + +```cpp +#pragma once + +#include "v8.h" +#include "V8Local.h" +#include "V8Isolate.h" + +namespace v8 { + +class NewClass : public Data { +public: + BUN_EXPORT static Local New(Isolate* isolate, /* parameters */); + BUN_EXPORT /* return_type */ SomeMethod() const; + + // Add other methods as needed +}; + +} // namespace v8 +``` + +Create `V8NewClass.cpp`: + +```cpp +#include "V8NewClass.h" +#include "V8HandleScope.h" +#include "v8_compatibility_assertions.h" + +ASSERT_V8_TYPE_LAYOUT_MATCHES(v8::NewClass) + +namespace v8 { + +Local NewClass::New(Isolate* isolate, /* parameters */) +{ + // Implementation - typically: + // 1. Create JSC value + // 2. Get current handle scope + // 3. Create local handle + return isolate->currentHandleScope()->createLocal(isolate->vm(), /* JSC value */); +} + +/* return_type */ NewClass::SomeMethod() const +{ + // Implementation - typically: + // 1. Convert this Local to JSValue via localToJSValue() + // 2. Perform JSC operations + // 3. Return converted result + auto jsValue = localToJSValue(); + // ... JSC operations ... + return /* result */; +} + +} // namespace v8 +``` + +### 2. Add Symbol Exports + +For each new C++ method, you must add the mangled symbol names to multiple files: + +#### a. Add to `src/napi/napi.zig` + +Find the `V8API` struct (around line 1801) and add entries for both GCC/Clang and MSVC: + +```zig +const V8API = if (!bun.Environment.isWindows) struct { + // ... existing functions ... + pub extern fn _ZN2v88NewClass3NewEPNS_7IsolateE/* parameters */() *anyopaque; + pub extern fn _ZNK2v88NewClass10SomeMethodEv() *anyopaque; +} else struct { + // ... existing functions ... + pub extern fn @"?New@NewClass@v8@@SA?AV?$Local@VNewClass@v8@@@2@PEAVIsolate@2@/* parameters */@Z"() *anyopaque; + pub extern fn @"?SomeMethod@NewClass@v8@@QEBA/* return_type */XZ"() *anyopaque; +}; +``` + +**To get the correct mangled names:** + +For **GCC/Clang** (Unix): + +```bash +# Build your changes first +bun bd --help # This compiles your code + +# Extract symbols +nm build/CMakeFiles/bun-debug.dir/src/buntime/compat/v8/V8NewClass.cpp.o | grep "T _ZN2v8" +``` + +For **MSVC** (Windows): + +```powershell +# Use the provided PowerShell script in the comments: +dumpbin .\build\CMakeFiles\bun-debug.dir\src\buntime\compat\v8\V8NewClass.cpp.obj /symbols | where-object { $_.Contains(' v8::') } | foreach-object { (($_ -split "\|")[1] -split " ")[1] } | ForEach-Object { "extern fn @`"${_}`"() *anyopaque;" } +``` + +#### b. Add to Symbol Files + +Add to `src/symbols.txt` (without leading underscore): + +``` +_ZN2v88NewClass3NewEPNS_7IsolateE... +_ZNK2v88NewClass10SomeMethodEv +``` + +Add to `src/symbols.dyn` (with leading underscore and semicolons): + +``` +{ + __ZN2v88NewClass3NewEPNS_7IsolateE...; + __ZNK2v88NewClass10SomeMethodEv; +} +``` + +**Note:** `src/symbols.def` is Windows-only and typically doesn't contain V8 symbols. + +### 3. Add Tests + +Create tests in `test/v8/v8-module/main.cpp`: + +```cpp +void test_new_class_feature(const FunctionCallbackInfo &info) { + Isolate* isolate = info.GetIsolate(); + + // Test your new V8 API + Local obj = NewClass::New(isolate, /* parameters */); + auto result = obj->SomeMethod(); + + // Print results for comparison with Node.js + std::cout << "Result: " << result << std::endl; + + info.GetReturnValue().Set(Undefined(isolate)); +} +``` + +Add the test to the registration section: + +```cpp +void Init(Local exports, Local module, Local context) { + // ... existing functions ... + NODE_SET_METHOD(exports, "test_new_class_feature", test_new_class_feature); +} +``` + +Add test case to `test/v8/v8.test.ts`: + +```typescript +describe("NewClass", () => { + it("can use new feature", async () => { + await checkSameOutput("test_new_class_feature", []); + }); +}); +``` + +### 4. Handle Special Cases + +#### Objects with Internal Fields + +If implementing objects that need internal fields, extend `InternalFieldObject`: + +```cpp +// In your .h file +class MyObject : public InternalFieldObject { + // ... implementation +}; +``` + +#### Primitive Values + +For primitive values, ensure they work with the `Oddball` system in `shim/Oddball.h`. + +#### Template Classes + +For `ObjectTemplate` or `FunctionTemplate` implementations, see existing patterns in `V8ObjectTemplate.cpp` and `V8FunctionTemplate.cpp`. + +## Memory Management Guidelines + +### Handle Scopes + +- All V8 values must be created within an active handle scope +- Use `isolate->currentHandleScope()->createLocal()` to create handles +- Handle scopes automatically clean up when destroyed + +### JSC Integration + +- Use `localToJSValue()` to convert V8 handles to JSC values +- Use `JSC::WriteBarrier` for heap-allocated references +- Implement `visitChildren()` for custom heap objects + +### Tagged Pointers + +- Small integers (±2^31) are stored directly as Smis +- Objects use pointer tagging with map pointers +- Doubles are stored in object layouts with special maps + +## Testing Strategy + +### Comprehensive Testing + +The V8 test suite compares output between Node.js and Bun for the same C++ code: + +1. **Install Phase**: Sets up identical module builds for Node.js and Bun +2. **Build Phase**: Compiles native modules using node-gyp +3. **Test Phase**: Runs identical C++ functions and compares output + +### Test Categories + +- **Primitives**: undefined, null, booleans, numbers, strings +- **Objects**: creation, property access, internal fields +- **Arrays**: creation, length, iteration, element access +- **Functions**: callbacks, templates, argument handling +- **Memory**: handle scopes, garbage collection, external data +- **Advanced**: templates, inheritance, error handling + +### Adding New Tests + +1. Add C++ test function to `test/v8/v8-module/main.cpp` +2. Register function in the module exports +3. Add test case to `test/v8/v8.test.ts` using `checkSameOutput()` +4. Run with: `bun bd test test/v8/v8.test.ts -t "your test name"` + +## Debugging Tips + +### Build and Test + +```bash +# Build debug version (takes ~5 minutes) +bun bd --help + +# Run V8 tests +bun bd test test/v8/v8.test.ts + +# Run specific test +bun bd test test/v8/v8.test.ts -t "can create small integer" +``` + +### Common Issues + +**Symbol Not Found**: Ensure mangled names are correctly added to `napi.zig` and symbol files. + +**Segmentation Fault**: Usually indicates inline V8 functions are reading incorrect memory layouts. Check `Map` setup and `ObjectLayout` structure. + +**GC Issues**: Objects being freed prematurely. Ensure proper `WriteBarrier` usage and `visitChildren()` implementation. + +**Type Mismatches**: Use `v8_compatibility_assertions.h` macros to verify type layouts match V8 expectations. + +### Debug Logging + +Use `V8_UNIMPLEMENTED()` macro for functions not yet implemented: + +```cpp +void MyClass::NotYetImplemented() { + V8_UNIMPLEMENTED(); +} +``` + +## Advanced Topics + +### Inline Function Compatibility + +Many V8 functions are inline and compiled into native modules. The memory layout must exactly match what these functions expect: + +- Objects start with tagged pointer to `Map` +- Maps have instance type at offset 12 +- Handle scopes store tagged pointers +- Primitive values at fixed global offsets + +### Cross-Platform Considerations + +- Symbol mangling differs between GCC/Clang and MSVC +- Handle calling conventions (JSC uses System V on Unix) +- Ensure `BUN_EXPORT` visibility on all public functions +- Test on all target platforms via CI + +## Contributing + +When contributing V8 API implementations: + +1. **Follow existing patterns** in similar classes +2. **Add comprehensive tests** that compare with Node.js +3. **Update all symbol files** with correct mangled names +4. **Document any special behavior** or limitations + +For questions about V8 API implementation, refer to the blog series linked above or examine existing implementations in this directory. diff --git a/src/bun.js/bindings/v8/CLAUDE.md b/src/buntime/compat/v8/CLAUDE.md similarity index 96% rename from src/bun.js/bindings/v8/CLAUDE.md rename to src/buntime/compat/v8/CLAUDE.md index 265f37cbf330..523877245bef 100644 --- a/src/bun.js/bindings/v8/CLAUDE.md +++ b/src/buntime/compat/v8/CLAUDE.md @@ -20,7 +20,7 @@ For detailed background, see the blog series: ## Directory Structure ``` -src/bun.js/bindings/v8/ +src/buntime/compat/v8/ ├── v8.h # Main header with V8_UNIMPLEMENTED macro ├── v8_*.h # V8 compatibility headers ├── V8*.h # V8 class headers (Number, String, Object, etc.) @@ -126,14 +126,14 @@ For **GCC/Clang** (Unix): bun bd --help # This compiles your code # Extract symbols -nm build/CMakeFiles/bun-debug.dir/src/bun.js/bindings/v8/V8NewClass.cpp.o | grep "T _ZN2v8" +nm build/CMakeFiles/bun-debug.dir/src/buntime/compat/v8/V8NewClass.cpp.o | grep "T _ZN2v8" ``` For **MSVC** (Windows): ```powershell # Use the provided PowerShell script in the comments: -dumpbin .\build\CMakeFiles\bun-debug.dir\src\bun.js\bindings\v8\V8NewClass.cpp.obj /symbols | where-object { $_.Contains(' v8::') } | foreach-object { (($_ -split "\|")[1] -split " ")[1] } | ForEach-Object { "extern fn @`"${_}`"() *anyopaque;" } +dumpbin .\build\CMakeFiles\bun-debug.dir\src\buntime\compat\v8\V8NewClass.cpp.obj /symbols | where-object { $_.Contains(' v8::') } | foreach-object { (($_ -split "\|")[1] -split " ")[1] } | ForEach-Object { "extern fn @`"${_}`"() *anyopaque;" } ``` #### b. Add to Symbol Files diff --git a/src/bun.js/bindings/v8/V8Array.cpp b/src/buntime/compat/v8/V8Array.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Array.cpp rename to src/buntime/compat/v8/V8Array.cpp diff --git a/src/bun.js/bindings/v8/V8Array.h b/src/buntime/compat/v8/V8Array.h similarity index 100% rename from src/bun.js/bindings/v8/V8Array.h rename to src/buntime/compat/v8/V8Array.h diff --git a/src/bun.js/bindings/v8/V8Boolean.cpp b/src/buntime/compat/v8/V8Boolean.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Boolean.cpp rename to src/buntime/compat/v8/V8Boolean.cpp diff --git a/src/bun.js/bindings/v8/V8Boolean.h b/src/buntime/compat/v8/V8Boolean.h similarity index 100% rename from src/bun.js/bindings/v8/V8Boolean.h rename to src/buntime/compat/v8/V8Boolean.h diff --git a/src/bun.js/bindings/v8/V8Context.cpp b/src/buntime/compat/v8/V8Context.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Context.cpp rename to src/buntime/compat/v8/V8Context.cpp diff --git a/src/bun.js/bindings/v8/V8Context.h b/src/buntime/compat/v8/V8Context.h similarity index 100% rename from src/bun.js/bindings/v8/V8Context.h rename to src/buntime/compat/v8/V8Context.h diff --git a/src/bun.js/bindings/v8/V8Data.h b/src/buntime/compat/v8/V8Data.h similarity index 100% rename from src/bun.js/bindings/v8/V8Data.h rename to src/buntime/compat/v8/V8Data.h diff --git a/src/bun.js/bindings/v8/V8EscapableHandleScope.cpp b/src/buntime/compat/v8/V8EscapableHandleScope.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8EscapableHandleScope.cpp rename to src/buntime/compat/v8/V8EscapableHandleScope.cpp diff --git a/src/bun.js/bindings/v8/V8EscapableHandleScope.h b/src/buntime/compat/v8/V8EscapableHandleScope.h similarity index 100% rename from src/bun.js/bindings/v8/V8EscapableHandleScope.h rename to src/buntime/compat/v8/V8EscapableHandleScope.h diff --git a/src/bun.js/bindings/v8/V8EscapableHandleScopeBase.cpp b/src/buntime/compat/v8/V8EscapableHandleScopeBase.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8EscapableHandleScopeBase.cpp rename to src/buntime/compat/v8/V8EscapableHandleScopeBase.cpp diff --git a/src/bun.js/bindings/v8/V8EscapableHandleScopeBase.h b/src/buntime/compat/v8/V8EscapableHandleScopeBase.h similarity index 100% rename from src/bun.js/bindings/v8/V8EscapableHandleScopeBase.h rename to src/buntime/compat/v8/V8EscapableHandleScopeBase.h diff --git a/src/bun.js/bindings/v8/V8External.cpp b/src/buntime/compat/v8/V8External.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8External.cpp rename to src/buntime/compat/v8/V8External.cpp diff --git a/src/bun.js/bindings/v8/V8External.h b/src/buntime/compat/v8/V8External.h similarity index 100% rename from src/bun.js/bindings/v8/V8External.h rename to src/buntime/compat/v8/V8External.h diff --git a/src/bun.js/bindings/v8/V8Function.cpp b/src/buntime/compat/v8/V8Function.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Function.cpp rename to src/buntime/compat/v8/V8Function.cpp diff --git a/src/bun.js/bindings/v8/V8Function.h b/src/buntime/compat/v8/V8Function.h similarity index 100% rename from src/bun.js/bindings/v8/V8Function.h rename to src/buntime/compat/v8/V8Function.h diff --git a/src/bun.js/bindings/v8/V8FunctionCallbackInfo.cpp b/src/buntime/compat/v8/V8FunctionCallbackInfo.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8FunctionCallbackInfo.cpp rename to src/buntime/compat/v8/V8FunctionCallbackInfo.cpp diff --git a/src/bun.js/bindings/v8/V8FunctionCallbackInfo.h b/src/buntime/compat/v8/V8FunctionCallbackInfo.h similarity index 100% rename from src/bun.js/bindings/v8/V8FunctionCallbackInfo.h rename to src/buntime/compat/v8/V8FunctionCallbackInfo.h diff --git a/src/bun.js/bindings/v8/V8FunctionTemplate.cpp b/src/buntime/compat/v8/V8FunctionTemplate.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8FunctionTemplate.cpp rename to src/buntime/compat/v8/V8FunctionTemplate.cpp diff --git a/src/bun.js/bindings/v8/V8FunctionTemplate.h b/src/buntime/compat/v8/V8FunctionTemplate.h similarity index 100% rename from src/bun.js/bindings/v8/V8FunctionTemplate.h rename to src/buntime/compat/v8/V8FunctionTemplate.h diff --git a/src/bun.js/bindings/v8/V8HandleScope.cpp b/src/buntime/compat/v8/V8HandleScope.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8HandleScope.cpp rename to src/buntime/compat/v8/V8HandleScope.cpp diff --git a/src/bun.js/bindings/v8/V8HandleScope.h b/src/buntime/compat/v8/V8HandleScope.h similarity index 100% rename from src/bun.js/bindings/v8/V8HandleScope.h rename to src/buntime/compat/v8/V8HandleScope.h diff --git a/src/bun.js/bindings/v8/V8Isolate.cpp b/src/buntime/compat/v8/V8Isolate.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Isolate.cpp rename to src/buntime/compat/v8/V8Isolate.cpp diff --git a/src/bun.js/bindings/v8/V8Isolate.h b/src/buntime/compat/v8/V8Isolate.h similarity index 100% rename from src/bun.js/bindings/v8/V8Isolate.h rename to src/buntime/compat/v8/V8Isolate.h diff --git a/src/bun.js/bindings/v8/V8Local.cpp b/src/buntime/compat/v8/V8Local.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Local.cpp rename to src/buntime/compat/v8/V8Local.cpp diff --git a/src/bun.js/bindings/v8/V8Local.h b/src/buntime/compat/v8/V8Local.h similarity index 100% rename from src/bun.js/bindings/v8/V8Local.h rename to src/buntime/compat/v8/V8Local.h diff --git a/src/bun.js/bindings/v8/V8Maybe.cpp b/src/buntime/compat/v8/V8Maybe.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Maybe.cpp rename to src/buntime/compat/v8/V8Maybe.cpp diff --git a/src/bun.js/bindings/v8/V8Maybe.h b/src/buntime/compat/v8/V8Maybe.h similarity index 100% rename from src/bun.js/bindings/v8/V8Maybe.h rename to src/buntime/compat/v8/V8Maybe.h diff --git a/src/bun.js/bindings/v8/V8MaybeLocal.h b/src/buntime/compat/v8/V8MaybeLocal.h similarity index 100% rename from src/bun.js/bindings/v8/V8MaybeLocal.h rename to src/buntime/compat/v8/V8MaybeLocal.h diff --git a/src/bun.js/bindings/v8/V8Number.cpp b/src/buntime/compat/v8/V8Number.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Number.cpp rename to src/buntime/compat/v8/V8Number.cpp diff --git a/src/bun.js/bindings/v8/V8Number.h b/src/buntime/compat/v8/V8Number.h similarity index 100% rename from src/bun.js/bindings/v8/V8Number.h rename to src/buntime/compat/v8/V8Number.h diff --git a/src/bun.js/bindings/v8/V8Object.cpp b/src/buntime/compat/v8/V8Object.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Object.cpp rename to src/buntime/compat/v8/V8Object.cpp diff --git a/src/bun.js/bindings/v8/V8Object.h b/src/buntime/compat/v8/V8Object.h similarity index 100% rename from src/bun.js/bindings/v8/V8Object.h rename to src/buntime/compat/v8/V8Object.h diff --git a/src/bun.js/bindings/v8/V8ObjectTemplate.cpp b/src/buntime/compat/v8/V8ObjectTemplate.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8ObjectTemplate.cpp rename to src/buntime/compat/v8/V8ObjectTemplate.cpp diff --git a/src/bun.js/bindings/v8/V8ObjectTemplate.h b/src/buntime/compat/v8/V8ObjectTemplate.h similarity index 100% rename from src/bun.js/bindings/v8/V8ObjectTemplate.h rename to src/buntime/compat/v8/V8ObjectTemplate.h diff --git a/src/bun.js/bindings/v8/V8Primitive.h b/src/buntime/compat/v8/V8Primitive.h similarity index 100% rename from src/bun.js/bindings/v8/V8Primitive.h rename to src/buntime/compat/v8/V8Primitive.h diff --git a/src/bun.js/bindings/v8/V8Signature.h b/src/buntime/compat/v8/V8Signature.h similarity index 100% rename from src/bun.js/bindings/v8/V8Signature.h rename to src/buntime/compat/v8/V8Signature.h diff --git a/src/bun.js/bindings/v8/V8String.cpp b/src/buntime/compat/v8/V8String.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8String.cpp rename to src/buntime/compat/v8/V8String.cpp diff --git a/src/bun.js/bindings/v8/V8String.h b/src/buntime/compat/v8/V8String.h similarity index 100% rename from src/bun.js/bindings/v8/V8String.h rename to src/buntime/compat/v8/V8String.h diff --git a/src/bun.js/bindings/v8/V8Template.cpp b/src/buntime/compat/v8/V8Template.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Template.cpp rename to src/buntime/compat/v8/V8Template.cpp diff --git a/src/bun.js/bindings/v8/V8Template.h b/src/buntime/compat/v8/V8Template.h similarity index 100% rename from src/bun.js/bindings/v8/V8Template.h rename to src/buntime/compat/v8/V8Template.h diff --git a/src/bun.js/bindings/v8/V8Value.cpp b/src/buntime/compat/v8/V8Value.cpp similarity index 100% rename from src/bun.js/bindings/v8/V8Value.cpp rename to src/buntime/compat/v8/V8Value.cpp diff --git a/src/bun.js/bindings/v8/V8Value.h b/src/buntime/compat/v8/V8Value.h similarity index 100% rename from src/bun.js/bindings/v8/V8Value.h rename to src/buntime/compat/v8/V8Value.h diff --git a/src/bun.js/bindings/v8/node.cpp b/src/buntime/compat/v8/node.cpp similarity index 100% rename from src/bun.js/bindings/v8/node.cpp rename to src/buntime/compat/v8/node.cpp diff --git a/src/bun.js/bindings/v8/node.h b/src/buntime/compat/v8/node.h similarity index 100% rename from src/bun.js/bindings/v8/node.h rename to src/buntime/compat/v8/node.h diff --git a/src/bun.js/bindings/v8/real_v8.h b/src/buntime/compat/v8/real_v8.h similarity index 100% rename from src/bun.js/bindings/v8/real_v8.h rename to src/buntime/compat/v8/real_v8.h diff --git a/src/bun.js/bindings/v8/shim/Function.cpp b/src/buntime/compat/v8/shim/Function.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/Function.cpp rename to src/buntime/compat/v8/shim/Function.cpp diff --git a/src/bun.js/bindings/v8/shim/Function.h b/src/buntime/compat/v8/shim/Function.h similarity index 100% rename from src/bun.js/bindings/v8/shim/Function.h rename to src/buntime/compat/v8/shim/Function.h diff --git a/src/bun.js/bindings/v8/shim/FunctionTemplate.cpp b/src/buntime/compat/v8/shim/FunctionTemplate.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/FunctionTemplate.cpp rename to src/buntime/compat/v8/shim/FunctionTemplate.cpp diff --git a/src/bun.js/bindings/v8/shim/FunctionTemplate.h b/src/buntime/compat/v8/shim/FunctionTemplate.h similarity index 100% rename from src/bun.js/bindings/v8/shim/FunctionTemplate.h rename to src/buntime/compat/v8/shim/FunctionTemplate.h diff --git a/src/bun.js/bindings/v8/shim/GlobalInternals.cpp b/src/buntime/compat/v8/shim/GlobalInternals.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/GlobalInternals.cpp rename to src/buntime/compat/v8/shim/GlobalInternals.cpp diff --git a/src/bun.js/bindings/v8/shim/GlobalInternals.h b/src/buntime/compat/v8/shim/GlobalInternals.h similarity index 100% rename from src/bun.js/bindings/v8/shim/GlobalInternals.h rename to src/buntime/compat/v8/shim/GlobalInternals.h diff --git a/src/bun.js/bindings/v8/shim/Handle.cpp b/src/buntime/compat/v8/shim/Handle.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/Handle.cpp rename to src/buntime/compat/v8/shim/Handle.cpp diff --git a/src/bun.js/bindings/v8/shim/Handle.h b/src/buntime/compat/v8/shim/Handle.h similarity index 100% rename from src/bun.js/bindings/v8/shim/Handle.h rename to src/buntime/compat/v8/shim/Handle.h diff --git a/src/bun.js/bindings/v8/shim/HandleScopeBuffer.cpp b/src/buntime/compat/v8/shim/HandleScopeBuffer.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/HandleScopeBuffer.cpp rename to src/buntime/compat/v8/shim/HandleScopeBuffer.cpp diff --git a/src/bun.js/bindings/v8/shim/HandleScopeBuffer.h b/src/buntime/compat/v8/shim/HandleScopeBuffer.h similarity index 100% rename from src/bun.js/bindings/v8/shim/HandleScopeBuffer.h rename to src/buntime/compat/v8/shim/HandleScopeBuffer.h diff --git a/src/bun.js/bindings/v8/shim/InternalFieldObject.cpp b/src/buntime/compat/v8/shim/InternalFieldObject.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/InternalFieldObject.cpp rename to src/buntime/compat/v8/shim/InternalFieldObject.cpp diff --git a/src/bun.js/bindings/v8/shim/InternalFieldObject.h b/src/buntime/compat/v8/shim/InternalFieldObject.h similarity index 100% rename from src/bun.js/bindings/v8/shim/InternalFieldObject.h rename to src/buntime/compat/v8/shim/InternalFieldObject.h diff --git a/src/bun.js/bindings/v8/shim/Map.cpp b/src/buntime/compat/v8/shim/Map.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/Map.cpp rename to src/buntime/compat/v8/shim/Map.cpp diff --git a/src/bun.js/bindings/v8/shim/Map.h b/src/buntime/compat/v8/shim/Map.h similarity index 100% rename from src/bun.js/bindings/v8/shim/Map.h rename to src/buntime/compat/v8/shim/Map.h diff --git a/src/bun.js/bindings/v8/shim/ObjectTemplate.cpp b/src/buntime/compat/v8/shim/ObjectTemplate.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/ObjectTemplate.cpp rename to src/buntime/compat/v8/shim/ObjectTemplate.cpp diff --git a/src/bun.js/bindings/v8/shim/ObjectTemplate.h b/src/buntime/compat/v8/shim/ObjectTemplate.h similarity index 100% rename from src/bun.js/bindings/v8/shim/ObjectTemplate.h rename to src/buntime/compat/v8/shim/ObjectTemplate.h diff --git a/src/bun.js/bindings/v8/shim/Oddball.cpp b/src/buntime/compat/v8/shim/Oddball.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/Oddball.cpp rename to src/buntime/compat/v8/shim/Oddball.cpp diff --git a/src/bun.js/bindings/v8/shim/Oddball.h b/src/buntime/compat/v8/shim/Oddball.h similarity index 100% rename from src/bun.js/bindings/v8/shim/Oddball.h rename to src/buntime/compat/v8/shim/Oddball.h diff --git a/src/bun.js/bindings/v8/shim/TaggedPointer.cpp b/src/buntime/compat/v8/shim/TaggedPointer.cpp similarity index 100% rename from src/bun.js/bindings/v8/shim/TaggedPointer.cpp rename to src/buntime/compat/v8/shim/TaggedPointer.cpp diff --git a/src/bun.js/bindings/v8/shim/TaggedPointer.h b/src/buntime/compat/v8/shim/TaggedPointer.h similarity index 100% rename from src/bun.js/bindings/v8/shim/TaggedPointer.h rename to src/buntime/compat/v8/shim/TaggedPointer.h diff --git a/src/bun.js/bindings/v8-capture-stack-fixture.cjs b/src/buntime/compat/v8/v8-capture-stack-fixture.cjs similarity index 100% rename from src/bun.js/bindings/v8-capture-stack-fixture.cjs rename to src/buntime/compat/v8/v8-capture-stack-fixture.cjs diff --git a/src/bun.js/bindings/v8/v8.h b/src/buntime/compat/v8/v8.h similarity index 100% rename from src/bun.js/bindings/v8/v8.h rename to src/buntime/compat/v8/v8.h diff --git a/src/bun.js/bindings/v8/v8_api_internal.cpp b/src/buntime/compat/v8/v8_api_internal.cpp similarity index 100% rename from src/bun.js/bindings/v8/v8_api_internal.cpp rename to src/buntime/compat/v8/v8_api_internal.cpp diff --git a/src/bun.js/bindings/v8/v8_api_internal.h b/src/buntime/compat/v8/v8_api_internal.h similarity index 100% rename from src/bun.js/bindings/v8/v8_api_internal.h rename to src/buntime/compat/v8/v8_api_internal.h diff --git a/src/bun.js/bindings/v8/v8_compatibility_assertions.h b/src/buntime/compat/v8/v8_compatibility_assertions.h similarity index 100% rename from src/bun.js/bindings/v8/v8_compatibility_assertions.h rename to src/buntime/compat/v8/v8_compatibility_assertions.h diff --git a/src/bun.js/bindings/v8/v8_internal.cpp b/src/buntime/compat/v8/v8_internal.cpp similarity index 100% rename from src/bun.js/bindings/v8/v8_internal.cpp rename to src/buntime/compat/v8/v8_internal.cpp diff --git a/src/bun.js/bindings/v8/v8_internal.h b/src/buntime/compat/v8/v8_internal.h similarity index 100% rename from src/bun.js/bindings/v8/v8_internal.h rename to src/buntime/compat/v8/v8_internal.h diff --git a/src/bun.js/bindings/v8/v8config.h b/src/buntime/compat/v8/v8config.h similarity index 100% rename from src/bun.js/bindings/v8/v8config.h rename to src/buntime/compat/v8/v8config.h diff --git a/src/bun.js/bindings/windows/rescle-binding.cpp b/src/buntime/compat/windows/rescle-binding.cpp similarity index 100% rename from src/bun.js/bindings/windows/rescle-binding.cpp rename to src/buntime/compat/windows/rescle-binding.cpp diff --git a/src/bun.js/bindings/windows/rescle.cpp b/src/buntime/compat/windows/rescle.cpp similarity index 100% rename from src/bun.js/bindings/windows/rescle.cpp rename to src/buntime/compat/windows/rescle.cpp diff --git a/src/bun.js/bindings/windows/rescle.h b/src/buntime/compat/windows/rescle.h similarity index 100% rename from src/bun.js/bindings/windows/rescle.h rename to src/buntime/compat/windows/rescle.h diff --git a/src/bun.js/bindings/Algo/Tuple.h b/src/buntime/core/Algo/Tuple.h similarity index 100% rename from src/bun.js/bindings/Algo/Tuple.h rename to src/buntime/core/Algo/Tuple.h diff --git a/src/bun.js/Counters.zig b/src/buntime/core/Counters.zig similarity index 100% rename from src/bun.js/Counters.zig rename to src/buntime/core/Counters.zig diff --git a/src/bun.js/VirtualMachine.zig b/src/buntime/core/VirtualMachine.zig similarity index 99% rename from src/bun.js/VirtualMachine.zig rename to src/buntime/core/VirtualMachine.zig index e73dfa8ec572..269da017a401 100644 --- a/src/bun.js/VirtualMachine.zig +++ b/src/buntime/core/VirtualMachine.zig @@ -201,7 +201,7 @@ pub fn getDevServerAsyncLocalStorage(this: *VirtualMachine) !?jsc.JSValue { return jsvalue; } -pub const ProcessAutoKiller = @import("./ProcessAutoKiller.zig"); +pub const ProcessAutoKiller = @import("../api/process/ProcessAutoKiller.zig"); pub const OnUnhandledRejection = fn (*VirtualMachine, globalObject: *JSGlobalObject, JSValue) void; pub const OnException = fn (*ZigException) void; @@ -3532,7 +3532,7 @@ pub const IPCInstance = struct { data: IPC.SendQueue, has_disconnect_called: bool = false, - const node_cluster_binding = @import("./node/node_cluster_binding.zig"); + const node_cluster_binding = @import("../node/node_cluster_binding.zig"); pub fn ipc(this: *IPCInstance) ?*IPC.SendQueue { return &this.data; @@ -3702,17 +3702,17 @@ const string = []const u8; const Config = @import("./config.zig"); const Counters = @import("./Counters.zig"); -const Fs = @import("../fs.zig"); -const IPC = @import("./ipc.zig"); -const Resolver = @import("../resolver/resolver.zig"); -const Runtime = @import("../runtime.zig"); -const node_module_module = @import("./bindings/NodeModuleModule.zig"); +const Fs = @import("../../fs.zig"); +const IPC = @import("../api/ipc/ipc.zig"); +const Resolver = @import("../../resolver/resolver.zig"); +const Runtime = @import("../../runtime.zig"); +const node_module_module = @import("../module/NodeModuleModule.zig"); const std = @import("std"); -const PackageManager = @import("../install/install.zig").PackageManager; -const URL = @import("../url.zig").URL; +const PackageManager = @import("../../install/install.zig").PackageManager; +const URL = @import("../../url.zig").URL; const Allocator = std.mem.Allocator; -const CPUProfiler = @import("./bindings/BunCPUProfiler.zig"); +const CPUProfiler = @import("../api/inspector/BunCPUProfiler.zig"); const CPUProfilerConfig = CPUProfiler.CPUProfilerConfig; const bun = @import("bun"); diff --git a/src/bun.js/config.zig b/src/buntime/core/config.zig similarity index 100% rename from src/bun.js/config.zig rename to src/buntime/core/config.zig diff --git a/src/bun.js/hot_reloader.zig b/src/buntime/core/hot_reloader.zig similarity index 100% rename from src/bun.js/hot_reloader.zig rename to src/buntime/core/hot_reloader.zig diff --git a/src/bun.js/rare_data.zig b/src/buntime/core/rare_data.zig similarity index 97% rename from src/bun.js/rare_data.zig rename to src/buntime/core/rare_data.zig index 0315e60da3f7..b17349cdc031 100644 --- a/src/bun.js/rare_data.zig +++ b/src/buntime/core/rare_data.zig @@ -572,7 +572,7 @@ pub fn websocketDeflate(this: *RareData) *WebSocketDeflate.RareData { }; } -pub const SpawnSyncEventLoop = @import("./event_loop/SpawnSyncEventLoop.zig"); +pub const SpawnSyncEventLoop = @import("../event_loop/SpawnSyncEventLoop.zig"); pub fn spawnSyncEventLoop(this: *RareData, vm: *jsc.VirtualMachine) *SpawnSyncEventLoop { return this.#spawn_sync_event_loop.get() orelse brk: { @@ -583,13 +583,13 @@ pub fn spawnSyncEventLoop(this: *RareData, vm: *jsc.VirtualMachine) *SpawnSyncEv }; } -const IPC = @import("./ipc.zig"); -const UUID = @import("./uuid.zig"); -const WebSocketDeflate = @import("../http/websocket_client/WebSocketDeflate.zig"); +const IPC = @import("../api/ipc/ipc.zig"); +const UUID = @import("../web/webcrypto/uuid.zig"); +const WebSocketDeflate = @import("../../http/websocket_client/WebSocketDeflate.zig"); const std = @import("std"); -const EditorContext = @import("../open.zig").EditorContext; -const StatWatcherScheduler = @import("./node/node_fs_stat_watcher.zig").StatWatcherScheduler; -const ValkeyContext = @import("../valkey/valkey.zig").ValkeyContext; +const EditorContext = @import("../../open.zig").EditorContext; +const StatWatcherScheduler = @import("../node/node_fs_stat_watcher.zig").StatWatcherScheduler; +const ValkeyContext = @import("../../valkey/valkey.zig").ValkeyContext; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/bun.js/virtual_machine_exports.zig b/src/buntime/core/virtual_machine_exports.zig similarity index 99% rename from src/bun.js/virtual_machine_exports.zig rename to src/buntime/core/virtual_machine_exports.zig index 43a48740d63d..ba15006adaba 100644 --- a/src/bun.js/virtual_machine_exports.zig +++ b/src/buntime/core/virtual_machine_exports.zig @@ -222,7 +222,7 @@ pub fn Bun__setSyntheticAllocationLimitForTesting(globalObject: *JSGlobalObject, return JSValue.jsNumber(prev); } -const IPC = @import("./ipc.zig"); +const IPC = @import("../api/ipc/ipc.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/event_loop/AnyEventLoop.zig b/src/buntime/event_loop/AnyEventLoop.zig similarity index 100% rename from src/bun.js/event_loop/AnyEventLoop.zig rename to src/buntime/event_loop/AnyEventLoop.zig diff --git a/src/bun.js/event_loop/AnyTask.zig b/src/buntime/event_loop/AnyTask.zig similarity index 100% rename from src/bun.js/event_loop/AnyTask.zig rename to src/buntime/event_loop/AnyTask.zig diff --git a/src/bun.js/event_loop/AnyTaskWithExtraContext.zig b/src/buntime/event_loop/AnyTaskWithExtraContext.zig similarity index 100% rename from src/bun.js/event_loop/AnyTaskWithExtraContext.zig rename to src/buntime/event_loop/AnyTaskWithExtraContext.zig diff --git a/src/bun.js/bindings/BunJSCEventLoop.cpp b/src/buntime/event_loop/BunJSCEventLoop.cpp similarity index 100% rename from src/bun.js/bindings/BunJSCEventLoop.cpp rename to src/buntime/event_loop/BunJSCEventLoop.cpp diff --git a/src/bun.js/event_loop/ConcurrentPromiseTask.zig b/src/buntime/event_loop/ConcurrentPromiseTask.zig similarity index 100% rename from src/bun.js/event_loop/ConcurrentPromiseTask.zig rename to src/buntime/event_loop/ConcurrentPromiseTask.zig diff --git a/src/bun.js/event_loop/ConcurrentTask.zig b/src/buntime/event_loop/ConcurrentTask.zig similarity index 100% rename from src/bun.js/event_loop/ConcurrentTask.zig rename to src/buntime/event_loop/ConcurrentTask.zig diff --git a/src/bun.js/event_loop/CppTask.zig b/src/buntime/event_loop/CppTask.zig similarity index 100% rename from src/bun.js/event_loop/CppTask.zig rename to src/buntime/event_loop/CppTask.zig diff --git a/src/bun.js/event_loop/DeferredTaskQueue.zig b/src/buntime/event_loop/DeferredTaskQueue.zig similarity index 100% rename from src/bun.js/event_loop/DeferredTaskQueue.zig rename to src/buntime/event_loop/DeferredTaskQueue.zig diff --git a/src/bun.js/event_loop/EventLoopHandle.zig b/src/buntime/event_loop/EventLoopHandle.zig similarity index 100% rename from src/bun.js/event_loop/EventLoopHandle.zig rename to src/buntime/event_loop/EventLoopHandle.zig diff --git a/src/bun.js/bindings/EventLoopTask.h b/src/buntime/event_loop/EventLoopTask.h similarity index 100% rename from src/bun.js/bindings/EventLoopTask.h rename to src/buntime/event_loop/EventLoopTask.h diff --git a/src/bun.js/bindings/EventLoopTaskNoContext.cpp b/src/buntime/event_loop/EventLoopTaskNoContext.cpp similarity index 100% rename from src/bun.js/bindings/EventLoopTaskNoContext.cpp rename to src/buntime/event_loop/EventLoopTaskNoContext.cpp diff --git a/src/bun.js/bindings/EventLoopTaskNoContext.h b/src/buntime/event_loop/EventLoopTaskNoContext.h similarity index 100% rename from src/bun.js/bindings/EventLoopTaskNoContext.h rename to src/buntime/event_loop/EventLoopTaskNoContext.h diff --git a/src/bun.js/event_loop/GarbageCollectionController.zig b/src/buntime/event_loop/GarbageCollectionController.zig similarity index 100% rename from src/bun.js/event_loop/GarbageCollectionController.zig rename to src/buntime/event_loop/GarbageCollectionController.zig diff --git a/src/bun.js/event_loop/JSCScheduler.zig b/src/buntime/event_loop/JSCScheduler.zig similarity index 100% rename from src/bun.js/event_loop/JSCScheduler.zig rename to src/buntime/event_loop/JSCScheduler.zig diff --git a/src/bun.js/event_loop/ManagedTask.zig b/src/buntime/event_loop/ManagedTask.zig similarity index 100% rename from src/bun.js/event_loop/ManagedTask.zig rename to src/buntime/event_loop/ManagedTask.zig diff --git a/src/bun.js/event_loop/MiniEventLoop.zig b/src/buntime/event_loop/MiniEventLoop.zig similarity index 100% rename from src/bun.js/event_loop/MiniEventLoop.zig rename to src/buntime/event_loop/MiniEventLoop.zig diff --git a/src/bun.js/event_loop/PosixSignalHandle.zig b/src/buntime/event_loop/PosixSignalHandle.zig similarity index 100% rename from src/bun.js/event_loop/PosixSignalHandle.zig rename to src/buntime/event_loop/PosixSignalHandle.zig diff --git a/src/bun.js/event_loop/README.md b/src/buntime/event_loop/README.md similarity index 98% rename from src/bun.js/event_loop/README.md rename to src/buntime/event_loop/README.md index 78c5ee0228b1..ab6068e08396 100644 --- a/src/bun.js/event_loop/README.md +++ b/src/buntime/event_loop/README.md @@ -8,7 +8,7 @@ Bun's event loop is built on top of **uSockets** (a cross-platform event loop ba ## Core Components -### 1. Task Queue (`src/bun.js/event_loop/Task.zig`) +### 1. Task Queue (`src/buntime/event_loop/Task.zig`) A tagged pointer union containing various async task types (file I/O, network requests, timers, etc.). Tasks are queued by various subsystems and drained by the main event loop. @@ -25,11 +25,11 @@ This prevents infinite loops when `setImmediate` is called within a `setImmediat Thread-safe queue for tasks enqueued from worker threads or async operations. These are moved to the main task queue before processing. -### 4. Deferred Task Queue (`src/bun.js/event_loop/DeferredTaskQueue.zig`) +### 4. Deferred Task Queue (`src/buntime/event_loop/DeferredTaskQueue.zig`) For operations that should be batched and deferred until after microtasks drain (e.g., buffered HTTP response writes, file sink flushes). This avoids excessive system calls while maintaining responsiveness. -### 5. Process.nextTick Queue (`src/bun.js/bindings/JSNextTickQueue.cpp`) +### 5. Process.nextTick Queue (`src/buntime/node/process/JSNextTickQueue.cpp`) Node.js-compatible implementation of `process.nextTick()`, which runs before microtasks but after each task. diff --git a/src/bun.js/event_loop/SpawnSyncEventLoop.zig b/src/buntime/event_loop/SpawnSyncEventLoop.zig similarity index 100% rename from src/bun.js/event_loop/SpawnSyncEventLoop.zig rename to src/buntime/event_loop/SpawnSyncEventLoop.zig diff --git a/src/bun.js/event_loop/Task.zig b/src/buntime/event_loop/Task.zig similarity index 99% rename from src/bun.js/event_loop/Task.zig rename to src/buntime/event_loop/Task.zig index b27b500eb79e..8571ff5e7373 100644 --- a/src/bun.js/event_loop/Task.zig +++ b/src/buntime/event_loop/Task.zig @@ -496,7 +496,7 @@ pub fn tickQueueWithCount(this: *EventLoop, virtual_machine: *VirtualMachine, co any.runFromJSThread(); }, - .@"shell.builtin.yes.YesTask", .@"bun.js.api.Timer.ImmediateObject", .@"bun.js.api.Timer.TimeoutObject" => { + .@"shell.builtin.yes.YesTask", .@"buntime.api.Timer.ImmediateObject", .@"buntime.api.Timer.TimeoutObject" => { bun.Output.panic("Unexpected tag: {s}", .{@tagName(task.tag())}); }, _ => { @@ -528,7 +528,7 @@ const ProcessWaiterThreadTask = if (Environment.isPosix) bun.spawn.process.Waite const log = bun.Output.scoped(.Task, .hidden); -const Fetch = @import("../webcore/fetch.zig"); +const Fetch = @import("../web/fetch/fetch.zig"); const FetchTasklet = Fetch.FetchTasklet; const JSCScheduler = @import("./JSCScheduler.zig"); diff --git a/src/bun.js/event_loop/WorkTask.zig b/src/buntime/event_loop/WorkTask.zig similarity index 100% rename from src/bun.js/event_loop/WorkTask.zig rename to src/buntime/event_loop/WorkTask.zig diff --git a/src/bun.js/event_loop.zig b/src/buntime/event_loop/event_loop.zig similarity index 93% rename from src/bun.js/event_loop.zig rename to src/buntime/event_loop/event_loop.zig index cd017e7fb365..25f3f283db51 100644 --- a/src/bun.js/event_loop.zig +++ b/src/buntime/event_loop/event_loop.zig @@ -671,37 +671,37 @@ pub fn deinit(this: *EventLoop) void { this.next_immediate_tasks.clearAndFree(bun.default_allocator); } -pub const AnyEventLoop = @import("./event_loop/AnyEventLoop.zig").AnyEventLoop; -pub const ConcurrentPromiseTask = @import("./event_loop/ConcurrentPromiseTask.zig").ConcurrentPromiseTask; -pub const WorkTask = @import("./event_loop/WorkTask.zig").WorkTask; -pub const AnyTask = @import("./event_loop/AnyTask.zig"); -pub const ManagedTask = @import("./event_loop/ManagedTask.zig"); -pub const AnyTaskWithExtraContext = @import("./event_loop/AnyTaskWithExtraContext.zig"); -pub const CppTask = @import("./event_loop/CppTask.zig").CppTask; -pub const ConcurrentCppTask = @import("./event_loop/CppTask.zig").ConcurrentCppTask; -pub const JSCScheduler = @import("./event_loop/JSCScheduler.zig"); -pub const Task = @import("./event_loop/Task.zig").Task; -pub const ConcurrentTask = @import("./event_loop/ConcurrentTask.zig"); -pub const GarbageCollectionController = @import("./event_loop/GarbageCollectionController.zig"); -pub const DeferredTaskQueue = @import("./event_loop/DeferredTaskQueue.zig"); +pub const AnyEventLoop = @import("./AnyEventLoop.zig").AnyEventLoop; +pub const ConcurrentPromiseTask = @import("./ConcurrentPromiseTask.zig").ConcurrentPromiseTask; +pub const WorkTask = @import("./WorkTask.zig").WorkTask; +pub const AnyTask = @import("./AnyTask.zig"); +pub const ManagedTask = @import("./ManagedTask.zig"); +pub const AnyTaskWithExtraContext = @import("./AnyTaskWithExtraContext.zig"); +pub const CppTask = @import("./CppTask.zig").CppTask; +pub const ConcurrentCppTask = @import("./CppTask.zig").ConcurrentCppTask; +pub const JSCScheduler = @import("./JSCScheduler.zig"); +pub const Task = @import("./Task.zig").Task; +pub const ConcurrentTask = @import("./ConcurrentTask.zig"); +pub const GarbageCollectionController = @import("./GarbageCollectionController.zig"); +pub const DeferredTaskQueue = @import("./DeferredTaskQueue.zig"); pub const DeferredRepeatingTask = DeferredTaskQueue.DeferredRepeatingTask; -pub const PosixSignalHandle = @import("./event_loop/PosixSignalHandle.zig"); +pub const PosixSignalHandle = @import("./PosixSignalHandle.zig"); pub const PosixSignalTask = PosixSignalHandle.PosixSignalTask; -pub const MiniEventLoop = @import("./event_loop/MiniEventLoop.zig"); +pub const MiniEventLoop = @import("./MiniEventLoop.zig"); pub const MiniVM = MiniEventLoop.MiniVM; pub const JsVM = MiniEventLoop.JsVM; pub const EventLoopKind = MiniEventLoop.EventLoopKind; pub const AbstractVM = MiniEventLoop.AbstractVM; -pub const EventLoopHandle = @import("./event_loop/EventLoopHandle.zig").EventLoopHandle; -pub const EventLoopTask = @import("./event_loop/EventLoopHandle.zig").EventLoopTask; -pub const EventLoopTaskPtr = @import("./event_loop/EventLoopHandle.zig").EventLoopTaskPtr; +pub const EventLoopHandle = @import("./EventLoopHandle.zig").EventLoopHandle; +pub const EventLoopTask = @import("./EventLoopHandle.zig").EventLoopTask; +pub const EventLoopTaskPtr = @import("./EventLoopHandle.zig").EventLoopTaskPtr; -pub const WorkPool = @import("../work_pool.zig").WorkPool; -pub const WorkPoolTask = @import("../work_pool.zig").Task; +pub const WorkPool = @import("../../work_pool.zig").WorkPool; +pub const WorkPoolTask = @import("../../work_pool.zig").Task; const std = @import("std"); -const tickQueueWithCount = @import("./event_loop/Task.zig").tickQueueWithCount; +const tickQueueWithCount = @import("./Task.zig").tickQueueWithCount; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/headergen/sizegen.cpp b/src/buntime/headergen/sizegen.cpp similarity index 97% rename from src/bun.js/headergen/sizegen.cpp rename to src/buntime/headergen/sizegen.cpp index 83754cbb2e47..f68daa7e9bd7 100644 --- a/src/bun.js/headergen/sizegen.cpp +++ b/src/buntime/headergen/sizegen.cpp @@ -26,7 +26,7 @@ int main() { strftime(buf, 80, "%Y-%m-%d %H:%M:%s", timeinfo); - cout << "// Auto-generated by src/bun.js/headergen/sizegen.cpp at " << buf + cout << "// Auto-generated by src/buntime/headergen/sizegen.cpp at " << buf << ".\n"; cout << "// These are the byte sizes for the different object types with " "bindings in JavaScriptCore.\n"; diff --git a/src/bun.js/jsc.zig b/src/buntime/jsc.zig similarity index 57% rename from src/bun.js/jsc.zig rename to src/buntime/jsc.zig index b4f8cc51ab9e..9de6e967f52c 100644 --- a/src/bun.js/jsc.zig +++ b/src/buntime/jsc.zig @@ -12,7 +12,7 @@ else .c; /// Web Template Framework -pub const wtf = @import("./bindings/WTF.zig").WTF; +pub const wtf = @import("./jsc/interop/WTF.zig").WTF; /// Binding for JSCInitialize in ZigGlobalObject.cpp pub fn initialize(eval_mode: bool) void { @@ -21,12 +21,12 @@ pub fn initialize(eval_mode: bool) void { JSCInitialize(std.os.environ.ptr, std.os.environ.len, onJSCInvalidEnvVar, eval_mode); } -pub const JSValue = @import("./bindings/JSValue.zig").JSValue; +pub const JSValue = @import("./jsc/types/JSValue.zig").JSValue; // Host functions are the native function pointer type that can be used by a // JSC::JSFunction to call native code from JavaScript. To allow usage of `try` // for error handling, Bun provides toJSHostFn to wrap JSHostFnZig into JSHostFn. -pub const host_fn = @import("./jsc/host_fn.zig"); +pub const host_fn = @import("./jsc/interop/host_fn.zig"); pub const JSHostFn = host_fn.JSHostFn; pub const JSHostFnZig = host_fn.JSHostFnZig; pub const JSHostFnZigWithContext = host_fn.JSHostFnZigWithContext; @@ -39,94 +39,94 @@ pub const fromJSHostCall = host_fn.fromJSHostCall; pub const fromJSHostCallGeneric = host_fn.fromJSHostCallGeneric; // JSC Classes Bindings -pub const AnyPromise = @import("./bindings/AnyPromise.zig").AnyPromise; -pub const array_buffer = @import("./jsc/array_buffer.zig"); +pub const AnyPromise = @import("./jsc/types/AnyPromise.zig").AnyPromise; +pub const array_buffer = @import("./jsc/interop/array_buffer.zig"); pub const ArrayBuffer = array_buffer.ArrayBuffer; pub const MarkedArrayBuffer = array_buffer.MarkedArrayBuffer; pub const JSCArrayBuffer = array_buffer.JSCArrayBuffer; -pub const CachedBytecode = @import("./bindings/CachedBytecode.zig").CachedBytecode; -pub const CallFrame = @import("./bindings/CallFrame.zig").CallFrame; -pub const CommonAbortReason = @import("./bindings/CommonAbortReason.zig").CommonAbortReason; -pub const CommonStrings = @import("./bindings/CommonStrings.zig").CommonStrings; -pub const CustomGetterSetter = @import("./bindings/CustomGetterSetter.zig").CustomGetterSetter; -pub const DOMFormData = @import("./bindings/DOMFormData.zig").DOMFormData; -pub const DOMURL = @import("./bindings/DOMURL.zig").DOMURL; -pub const DecodedJSValue = @import("./bindings/DecodedJSValue.zig").DecodedJSValue; -pub const DeferredError = @import("./bindings/DeferredError.zig").DeferredError; -pub const GetterSetter = @import("./bindings/GetterSetter.zig").GetterSetter; -pub const JSArray = @import("./bindings/JSArray.zig").JSArray; -pub const JSArrayIterator = @import("./bindings/JSArrayIterator.zig").JSArrayIterator; -pub const JSCell = @import("./bindings/JSCell.zig").JSCell; -pub const JSFunction = @import("./bindings/JSFunction.zig").JSFunction; -pub const JSGlobalObject = @import("./bindings/JSGlobalObject.zig").JSGlobalObject; -pub const JSInternalPromise = @import("./bindings/JSInternalPromise.zig").JSInternalPromise; -pub const JSMap = @import("./bindings/JSMap.zig").JSMap; -pub const JSModuleLoader = @import("./bindings/JSModuleLoader.zig").JSModuleLoader; -pub const JSObject = @import("./bindings/JSObject.zig").JSObject; -pub const JSPromise = @import("./bindings/JSPromise.zig").JSPromise; -pub const JSPromiseRejectionOperation = @import("./bindings/JSPromiseRejectionOperation.zig").JSPromiseRejectionOperation; -pub const JSRef = @import("./bindings/JSRef.zig").JSRef; -pub const JSString = @import("./bindings/JSString.zig").JSString; -pub const JSUint8Array = @import("./bindings/JSUint8Array.zig").JSUint8Array; -pub const JSBigInt = @import("./bindings/JSBigInt.zig").JSBigInt; -pub const RefString = @import("./jsc/RefString.zig"); -pub const ScriptExecutionStatus = @import("./bindings/ScriptExecutionStatus.zig").ScriptExecutionStatus; -pub const SourceType = @import("./bindings/SourceType.zig").SourceType; -pub const Strong = @import("./Strong.zig"); -pub const SystemError = @import("./bindings/SystemError.zig").SystemError; -pub const URL = @import("./bindings/URL.zig").URL; -pub const URLSearchParams = @import("./bindings/URLSearchParams.zig").URLSearchParams; -pub const VM = @import("./bindings/VM.zig").VM; -pub const Weak = @import("./Weak.zig").Weak; -pub const WeakRefType = @import("./Weak.zig").WeakRefType; -pub const Exception = @import("./bindings/Exception.zig").Exception; -pub const SourceProvider = @import("./bindings/SourceProvider.zig").SourceProvider; -pub const CatchScope = @import("./bindings/CatchScope.zig").CatchScope; -pub const ExceptionValidationScope = @import("./bindings/CatchScope.zig").ExceptionValidationScope; -pub const MarkedArgumentBuffer = @import("./bindings/MarkedArgumentBuffer.zig").MarkedArgumentBuffer; -pub const RegularExpression = @import("./bindings/RegularExpression.zig").RegularExpression; +pub const CachedBytecode = @import("./module/CachedBytecode.zig").CachedBytecode; +pub const CallFrame = @import("./jsc/types/CallFrame.zig").CallFrame; +pub const CommonAbortReason = @import("./web/events/CommonAbortReason.zig").CommonAbortReason; +pub const CommonStrings = @import("./jsc/types/CommonStrings.zig").CommonStrings; +pub const CustomGetterSetter = @import("./jsc/types/CustomGetterSetter.zig").CustomGetterSetter; +pub const DOMFormData = @import("./web/blob/DOMFormData.zig").DOMFormData; +pub const DOMURL = @import("./web/url/DOMURL.zig").DOMURL; +pub const DecodedJSValue = @import("./jsc/types/DecodedJSValue.zig").DecodedJSValue; +pub const DeferredError = @import("./api/error/DeferredError.zig").DeferredError; +pub const GetterSetter = @import("./jsc/types/GetterSetter.zig").GetterSetter; +pub const JSArray = @import("./jsc/types/JSArray.zig").JSArray; +pub const JSArrayIterator = @import("./jsc/types/JSArrayIterator.zig").JSArrayIterator; +pub const JSCell = @import("./jsc/types/JSCell.zig").JSCell; +pub const JSFunction = @import("./jsc/types/JSFunction.zig").JSFunction; +pub const JSGlobalObject = @import("./jsc/types/JSGlobalObject.zig").JSGlobalObject; +pub const JSInternalPromise = @import("./jsc/types/JSInternalPromise.zig").JSInternalPromise; +pub const JSMap = @import("./jsc/types/JSMap.zig").JSMap; +pub const JSModuleLoader = @import("./module/JSModuleLoader.zig").JSModuleLoader; +pub const JSObject = @import("./jsc/types/JSObject.zig").JSObject; +pub const JSPromise = @import("./jsc/types/JSPromise.zig").JSPromise; +pub const JSPromiseRejectionOperation = @import("./jsc/types/JSPromiseRejectionOperation.zig").JSPromiseRejectionOperation; +pub const JSRef = @import("./jsc/types/JSRef.zig").JSRef; +pub const JSString = @import("./jsc/types/JSString.zig").JSString; +pub const JSUint8Array = @import("./jsc/interop/JSUint8Array.zig").JSUint8Array; +pub const JSBigInt = @import("./jsc/types/JSBigInt.zig").JSBigInt; +pub const RefString = @import("./jsc/gc/RefString.zig"); +pub const ScriptExecutionStatus = @import("./jsc/types/ScriptExecutionStatus.zig").ScriptExecutionStatus; +pub const SourceType = @import("./jsc/types/SourceType.zig").SourceType; +pub const Strong = @import("./jsc/gc/Strong.zig"); +pub const SystemError = @import("./api/error/SystemError.zig").SystemError; +pub const URL = @import("./web/url/URL.zig").URL; +pub const URLSearchParams = @import("./web/url/URLSearchParams.zig").URLSearchParams; +pub const VM = @import("./jsc/types/VM.zig").VM; +pub const Weak = @import("./jsc/gc/Weak.zig").Weak; +pub const WeakRefType = @import("./jsc/gc/Weak.zig").WeakRefType; +pub const Exception = @import("./jsc/interop/Exception.zig").Exception; +pub const SourceProvider = @import("./jsc/types/SourceProvider.zig").SourceProvider; +pub const CatchScope = @import("./jsc/types/CatchScope.zig").CatchScope; +pub const ExceptionValidationScope = @import("./jsc/types/CatchScope.zig").ExceptionValidationScope; +pub const MarkedArgumentBuffer = @import("./jsc/types/MarkedArgumentBuffer.zig").MarkedArgumentBuffer; +pub const RegularExpression = @import("./jsc/types/RegularExpression.zig").RegularExpression; // JavaScript-related -pub const Errorable = @import("./bindings/Errorable.zig").Errorable; -pub const ResolvedSource = @import("./bindings/ResolvedSource.zig").ResolvedSource; -pub const ErrorCode = @import("./bindings/ErrorCode.zig").ErrorCode; -pub const JSErrorCode = @import("./bindings/JSErrorCode.zig").JSErrorCode; -pub const ZigErrorType = @import("./bindings/ZigErrorType.zig").ZigErrorType; -pub const Debugger = @import("./Debugger.zig"); -pub const SavedSourceMap = @import("./SavedSourceMap.zig"); -pub const VirtualMachine = @import("./VirtualMachine.zig"); -pub const ModuleLoader = @import("./ModuleLoader.zig"); -pub const RareData = @import("./rare_data.zig"); -pub const EventType = @import("./bindings/EventType.zig").EventType; -pub const JSRuntimeType = @import("./bindings/JSRuntimeType.zig").JSRuntimeType; -pub const ZigStackFrameCode = @import("./bindings/ZigStackFrameCode.zig").ZigStackFrameCode; +pub const Errorable = @import("./api/error/Errorable.zig").Errorable; +pub const ResolvedSource = @import("./jsc/types/ResolvedSource.zig").ResolvedSource; +pub const ErrorCode = @import("./api/error/ErrorCode.zig").ErrorCode; +pub const JSErrorCode = @import("./api/error/JSErrorCode.zig").JSErrorCode; +pub const ZigErrorType = @import("./api/error/ZigErrorType.zig").ZigErrorType; +pub const Debugger = @import("./api/inspector/Debugger.zig"); +pub const SavedSourceMap = @import("./module/SavedSourceMap.zig"); +pub const VirtualMachine = @import("./core/VirtualMachine.zig"); +pub const ModuleLoader = @import("./module/ModuleLoader.zig"); +pub const RareData = @import("./core/rare_data.zig"); +pub const EventType = @import("./web/events/EventType.zig").EventType; +pub const JSRuntimeType = @import("./jsc/types/JSRuntimeType.zig").JSRuntimeType; +pub const ZigStackFrameCode = @import("./api/error/ZigStackFrameCode.zig").ZigStackFrameCode; pub const ErrorableResolvedSource = Errorable(ResolvedSource); pub const ErrorableZigString = Errorable(ZigString); pub const ErrorableJSValue = Errorable(JSValue); pub const ErrorableString = Errorable(bun.String); -pub const ZigStackTrace = @import("./bindings/ZigStackTrace.zig").ZigStackTrace; -pub const ZigStackFrame = @import("./bindings/ZigStackFrame.zig").ZigStackFrame; -pub const ZigStackFramePosition = @import("./bindings/ZigStackFramePosition.zig").ZigStackFramePosition; -pub const ZigException = @import("./bindings/ZigException.zig").ZigException; +pub const ZigStackTrace = @import("./api/error/ZigStackTrace.zig").ZigStackTrace; +pub const ZigStackFrame = @import("./api/error/ZigStackFrame.zig").ZigStackFrame; +pub const ZigStackFramePosition = @import("./api/error/ZigStackFramePosition.zig").ZigStackFramePosition; +pub const ZigException = @import("./api/error/ZigException.zig").ZigException; -pub const ConsoleObject = @import("./ConsoleObject.zig"); +pub const ConsoleObject = @import("./api/console/ConsoleObject.zig"); pub const Formatter = ConsoleObject.Formatter; -pub const hot_reloader = @import("./hot_reloader.zig"); +pub const hot_reloader = @import("./core/hot_reloader.zig"); -// TODO: move into bun.api -pub const Jest = @import("./test/jest.zig"); -pub const TestScope = @import("./test/jest.zig").TestScope; -pub const Expect = @import("./test/expect.zig"); -pub const Snapshot = @import("./test/snapshot.zig"); +// Test runner (moved to src/test_runner/) +pub const Jest = @import("../test_runner/jest.zig"); +pub const TestScope = @import("../test_runner/jest.zig").TestScope; +pub const Expect = @import("../test_runner/expect.zig"); +pub const Snapshot = @import("../test_runner/snapshot.zig"); -pub const js_property_iterator = @import("./bindings/JSPropertyIterator.zig"); +pub const js_property_iterator = @import("./jsc/types/JSPropertyIterator.zig"); pub const JSPropertyIterator = js_property_iterator.JSPropertyIterator; pub const JSPropertyIteratorOptions = js_property_iterator.JSPropertyIteratorOptions; -pub const EventLoop = @import("./event_loop.zig"); +pub const EventLoop = @import("./event_loop/event_loop.zig"); pub const AbstractVM = EventLoop.AbstractVM; pub const AnyEventLoop = EventLoop.AnyEventLoop; pub const AnyTask = EventLoop.AnyTask; @@ -154,11 +154,11 @@ pub const WorkPoolTask = EventLoop.WorkPoolTask; pub const WorkTask = EventLoop.WorkTask; /// Deprecated: Avoid using this in new code. -pub const C = @import("./javascript_core_c_api.zig"); +pub const C = @import("./jsc/interop/javascript_core_c_api.zig"); /// Deprecated: Remove all of these please. -pub const Sizes = @import("./bindings/sizes.zig"); +pub const Sizes = @import("./jsc/interop/sizes.zig"); /// Deprecated: Use `bun.String` -pub const ZigString = @import("./bindings/ZigString.zig").ZigString; +pub const ZigString = @import("./jsc/interop/ZigString.zig").ZigString; /// Deprecated: Use `bun.webcore` pub const WebCore = bun.webcore; /// Deprecated: Use `bun.api` @@ -182,8 +182,8 @@ pub inline fn markMemberBinding(comptime class: anytype, src: std.builtin.Source pub const Subprocess = bun.api.Subprocess; /// This file is generated by: -/// 1. `bun src/bun.js/scripts/generate-classes.ts` -/// 2. Scan for **/*.classes.ts files in src/bun.js/src +/// 1. `bun src/buntime/scripts/generate-classes.ts` +/// 2. Scan for **/*.classes.ts files in src/buntime/src /// 3. Generate a JS wrapper for each class in: /// - Zig: generated_classes.zig /// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp @@ -199,9 +199,9 @@ pub const Subprocess = bun.api.Subprocess; /// 5. `bun run build` /// pub const Codegen = @import("ZigGeneratedClasses"); -pub const GeneratedClassesList = @import("./bindings/generated_classes_list.zig").Classes; +pub const GeneratedClassesList = @import("./jsc/generated/generated_classes_list.zig").Classes; -pub const RuntimeTranspilerCache = @import("./RuntimeTranspilerCache.zig").RuntimeTranspilerCache; +pub const RuntimeTranspilerCache = @import("./module/RuntimeTranspilerCache.zig").RuntimeTranspilerCache; /// Track whether an object should keep the event loop alive pub const Ref = struct { diff --git a/src/bun.js/bindings/BunGCOutputConstraint.cpp b/src/buntime/jsc/gc/BunGCOutputConstraint.cpp similarity index 100% rename from src/bun.js/bindings/BunGCOutputConstraint.cpp rename to src/buntime/jsc/gc/BunGCOutputConstraint.cpp diff --git a/src/bun.js/bindings/BunGCOutputConstraint.h b/src/buntime/jsc/gc/BunGCOutputConstraint.h similarity index 100% rename from src/bun.js/bindings/BunGCOutputConstraint.h rename to src/buntime/jsc/gc/BunGCOutputConstraint.h diff --git a/src/bun.js/DeprecatedStrong.zig b/src/buntime/jsc/gc/DeprecatedStrong.zig similarity index 100% rename from src/bun.js/DeprecatedStrong.zig rename to src/buntime/jsc/gc/DeprecatedStrong.zig diff --git a/src/bun.js/bindings/GCDefferalContext.h b/src/buntime/jsc/gc/GCDefferalContext.h similarity index 100% rename from src/bun.js/bindings/GCDefferalContext.h rename to src/buntime/jsc/gc/GCDefferalContext.h diff --git a/src/bun.js/bindings/MarkingConstraint.cpp b/src/buntime/jsc/gc/MarkingConstraint.cpp similarity index 100% rename from src/bun.js/bindings/MarkingConstraint.cpp rename to src/buntime/jsc/gc/MarkingConstraint.cpp diff --git a/src/bun.js/bindings/MimallocWTFMalloc.h b/src/buntime/jsc/gc/MimallocWTFMalloc.h similarity index 100% rename from src/bun.js/bindings/MimallocWTFMalloc.h rename to src/buntime/jsc/gc/MimallocWTFMalloc.h diff --git a/src/bun.js/jsc/RefString.zig b/src/buntime/jsc/gc/RefString.zig similarity index 100% rename from src/bun.js/jsc/RefString.zig rename to src/buntime/jsc/gc/RefString.zig diff --git a/src/bun.js/Strong.zig b/src/buntime/jsc/gc/Strong.zig similarity index 100% rename from src/bun.js/Strong.zig rename to src/buntime/jsc/gc/Strong.zig diff --git a/src/bun.js/bindings/StrongRef.cpp b/src/buntime/jsc/gc/StrongRef.cpp similarity index 100% rename from src/bun.js/bindings/StrongRef.cpp rename to src/buntime/jsc/gc/StrongRef.cpp diff --git a/src/bun.js/bindings/StrongRef.h b/src/buntime/jsc/gc/StrongRef.h similarity index 100% rename from src/bun.js/bindings/StrongRef.h rename to src/buntime/jsc/gc/StrongRef.h diff --git a/src/bun.js/bindings/Weak.cpp b/src/buntime/jsc/gc/Weak.cpp similarity index 100% rename from src/bun.js/bindings/Weak.cpp rename to src/buntime/jsc/gc/Weak.cpp diff --git a/src/bun.js/Weak.zig b/src/buntime/jsc/gc/Weak.zig similarity index 100% rename from src/bun.js/Weak.zig rename to src/buntime/jsc/gc/Weak.zig diff --git a/src/bun.js/bindings/WebCoreOpaqueRoot.h b/src/buntime/jsc/gc/WebCoreOpaqueRoot.h similarity index 100% rename from src/bun.js/bindings/WebCoreOpaqueRoot.h rename to src/buntime/jsc/gc/WebCoreOpaqueRoot.h diff --git a/src/bun.js/bindings/WebCoreOpaqueRootInlines.h b/src/buntime/jsc/gc/WebCoreOpaqueRootInlines.h similarity index 100% rename from src/bun.js/bindings/WebCoreOpaqueRootInlines.h rename to src/buntime/jsc/gc/WebCoreOpaqueRootInlines.h diff --git a/src/bun.js/bindings/WriteBarrierList.h b/src/buntime/jsc/gc/WriteBarrierList.h similarity index 100% rename from src/bun.js/bindings/WriteBarrierList.h rename to src/buntime/jsc/gc/WriteBarrierList.h diff --git a/src/bun.js/bindings/bmalloc_heap_ref.h b/src/buntime/jsc/gc/bmalloc_heap_ref.h similarity index 100% rename from src/bun.js/bindings/bmalloc_heap_ref.h rename to src/buntime/jsc/gc/bmalloc_heap_ref.h diff --git a/src/buntime/jsc/generated/GeneratedBindings.zig b/src/buntime/jsc/generated/GeneratedBindings.zig new file mode 100644 index 000000000000..20d44c0c0fbf --- /dev/null +++ b/src/buntime/jsc/generated/GeneratedBindings.zig @@ -0,0 +1,407 @@ +/// Generated for "src/bake.zig" +pub const bake = struct {}; + +/// Generated for "src/bake/DevServer.zig" +pub const DevServer = struct { + pub const jsGetDeinitCountForTesting = @extern(*const JSHostFunctionType, .{ .name = "bindgen_DevServer_jsGetDeinitCountForTesting" }); + + pub fn createGetDeinitCountForTestingCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("getDeinitCountForTesting"), 0, jsGetDeinitCountForTesting, false, null); + } +}; + +/// Generated for "src/buntime/api/BunObject.zig" +pub const BunObject = struct { + pub const jsBraces = @extern(*const JSHostFunctionType, .{ .name = "bindgen_BunObject_jsBraces" }); + pub const jsGc = @extern(*const JSHostFunctionType, .{ .name = "bindgen_BunObject_jsGc" }); + pub const jsStringWidth = @extern(*const JSHostFunctionType, .{ .name = "bindgen_BunObject_jsStringWidth" }); + + pub fn createBracesCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("braces"), 3, jsBraces, false, null); + } + pub fn createGcCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("gc"), 2, jsGc, false, null); + } + pub fn createStringWidthCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("stringWidth"), 2, jsStringWidth, false, null); + } + + pub const BracesOptions = extern struct { + parse: bool, + tokenize: bool, + }; + pub const StringWidthOptions = extern struct { + ambiguous_is_narrow: bool, + count_ansi_escape_codes: bool, + }; +}; + +/// Generated for "src/buntime/jsc/interop/bindgen_test.zig" +pub const bindgen_test = struct { + pub const jsAdd = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Bindgen_test_jsAdd" }); + pub const jsRequiredAndOptionalArg = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Bindgen_test_jsRequiredAndOptionalArg" }); + + pub fn createAddCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("add"), 3, jsAdd, false, null); + } + pub fn createRequiredAndOptionalArgCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("requiredAndOptionalArg"), 4, jsRequiredAndOptionalArg, false, null); + } +}; + +/// Generated for "src/buntime/module/NodeModuleModule.zig" +pub const NodeModuleModule = struct { + pub const js_stat = @extern(*const JSHostFunctionType, .{ .name = "bindgen_NodeModuleModule_js_stat" }); + + pub fn create_statCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("_stat"), 1, js_stat, false, null); + } +}; + +/// Generated for "src/buntime/node/node_os.zig" +pub const node_os = struct { + pub const jsCpus = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsCpus" }); + pub const jsFreemem = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsFreemem" }); + pub const jsGetPriority = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsGetPriority" }); + pub const jsHomedir = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsHomedir" }); + pub const jsHostname = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsHostname" }); + pub const jsLoadavg = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsLoadavg" }); + pub const jsNetworkInterfaces = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsNetworkInterfaces" }); + pub const jsRelease = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsRelease" }); + pub const jsTotalmem = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsTotalmem" }); + pub const jsUptime = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsUptime" }); + pub const jsUserInfo = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsUserInfo" }); + pub const jsVersion = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsVersion" }); + pub const jsSetPriority = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Node_os_jsSetPriority" }); + + pub fn createCpusCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("cpus"), 1, jsCpus, false, null); + } + pub fn createFreememCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("freemem"), 0, jsFreemem, false, null); + } + pub fn createGetPriorityCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("getPriority"), 2, jsGetPriority, false, null); + } + pub fn createHomedirCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("homedir"), 1, jsHomedir, false, null); + } + pub fn createHostnameCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("hostname"), 1, jsHostname, false, null); + } + pub fn createLoadavgCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("loadavg"), 1, jsLoadavg, false, null); + } + pub fn createNetworkInterfacesCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("networkInterfaces"), 1, jsNetworkInterfaces, false, null); + } + pub fn createReleaseCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("release"), 0, jsRelease, false, null); + } + pub fn createTotalmemCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("totalmem"), 0, jsTotalmem, false, null); + } + pub fn createUptimeCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("uptime"), 1, jsUptime, false, null); + } + pub fn createUserInfoCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("userInfo"), 2, jsUserInfo, false, null); + } + pub fn createVersionCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("version"), 0, jsVersion, false, null); + } + pub fn createSetPriorityCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("setPriority"), 2, jsSetPriority, false, null); + } + + pub const UserInfoOptions = extern struct { + encoding: bun.String, + }; +}; + +/// Generated for "src/fmt.zig" +pub const fmt = struct { + pub const jsFmtString = @extern(*const JSHostFunctionType, .{ .name = "bindgen_Fmt_jsFmtString" }); + + pub fn createFmtStringCallback(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static("fmtString"), 3, jsFmtString, false, null); + } + + pub const Formatter = enum(u8) { + escape_powershell, + highlight_javascript, + }; +}; + +const binding_internals = struct { + const import_bake = @import("../../../bake.zig"); + const import_DevServer = @import("../../../bake/DevServer.zig"); + export fn bindgen_DevServer_dispatchGetDeinitCountForTesting1(global: *jsc.JSGlobalObject, out: *usize) bool { + if (!@hasDecl(import_DevServer, "getDeinitCountForTesting")) + @compileError("Missing binding declaration \"getDeinitCountForTesting\" in \"DevServer.zig\""); + out.* = @as(bun.JSError!usize, import_DevServer.getDeinitCountForTesting()) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const import_BunObject = @import("../../api/BunObject.zig"); + export fn bindgen_BunObject_dispatchBraces1(arg_global: *jsc.JSGlobalObject, arg_input: *const bun.String, arg_options: *const BunObject.BracesOptions) jsc.JSValue { + if (!@hasDecl(import_BunObject, "braces")) + @compileError("Missing binding declaration \"braces\" in \"BunObject.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_BunObject.braces, .{ + arg_global, + arg_input.*, + arg_options.*, + }); + } + export fn bindgen_BunObject_dispatchGc1(global: *jsc.JSGlobalObject, arg_force: *const bool, out: *usize) bool { + if (!@hasDecl(import_BunObject, "gc")) + @compileError("Missing binding declaration \"gc\" in \"BunObject.zig\""); + out.* = @as(bun.JSError!usize, import_BunObject.gc( + global.bunVM(), + arg_force.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_BunObject_dispatchStringWidth1(global: *jsc.JSGlobalObject, arg_str: *const bun.String, arg_opts: *const BunObject.StringWidthOptions, out: *usize) bool { + if (!@hasDecl(import_BunObject, "stringWidth")) + @compileError("Missing binding declaration \"stringWidth\" in \"BunObject.zig\""); + out.* = @as(bun.JSError!usize, import_BunObject.stringWidth( + arg_str.*, + arg_opts.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const import_bindgen_test = @import("../interop/bindgen_test.zig"); + export fn bindgen_Bindgen_test_dispatchAdd1(arg_global: *jsc.JSGlobalObject, arg_a: *const i32, arg_b: *const i32, out: *i32) bool { + if (!@hasDecl(import_bindgen_test, "add")) + @compileError("Missing binding declaration \"add\" in \"bindgen_test.zig\""); + out.* = @as(bun.JSError!i32, import_bindgen_test.add( + arg_global, + arg_a.*, + arg_b.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const BindgenTestRequiredAndOptionalArgArguments = extern struct { + b_set: bool, + d_set: bool, + d_value: u8, + b_value: usize, + }; + export fn bindgen_Bindgen_test_dispatchRequiredAndOptionalArg1(global: *jsc.JSGlobalObject, arg_a: *const bool, arg_c: *const i32, buf: *BindgenTestRequiredAndOptionalArgArguments, out: *i32) bool { + if (!@hasDecl(import_bindgen_test, "requiredAndOptionalArg")) + @compileError("Missing binding declaration \"requiredAndOptionalArg\" in \"bindgen_test.zig\""); + out.* = @as(bun.JSError!i32, import_bindgen_test.requiredAndOptionalArg( + arg_a.*, + if (buf.b_set) buf.b_value else null, + arg_c.*, + if (buf.d_set) buf.d_value else null, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const import_NodeModuleModule = @import("../../module/NodeModuleModule.zig"); + export fn bindgen_NodeModuleModule_dispatch_stat1(global: *jsc.JSGlobalObject, arg_str: *const bun.String, out: *i32) bool { + if (!@hasDecl(import_NodeModuleModule, "_stat")) + @compileError("Missing binding declaration \"_stat\" in \"NodeModuleModule.zig\""); + const arg_str_utf8 = arg_str.toUTF8(bun.default_allocator); + defer arg_str_utf8.deinit(); + out.* = @as(bun.JSError!i32, import_NodeModuleModule._stat( + arg_str_utf8.slice(), + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const import_node_os = @import("../../node/node_os.zig"); + export fn bindgen_Node_os_dispatchCpus1(arg_global: *jsc.JSGlobalObject) jsc.JSValue { + if (!@hasDecl(import_node_os, "cpus")) + @compileError("Missing binding declaration \"cpus\" in \"node_os.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_node_os.cpus, .{ + arg_global, + }); + } + export fn bindgen_Node_os_dispatchFreemem1(global: *jsc.JSGlobalObject, out: *u64) bool { + if (!@hasDecl(import_node_os, "freemem")) + @compileError("Missing binding declaration \"freemem\" in \"node_os.zig\""); + out.* = @as(bun.JSError!u64, import_node_os.freemem()) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchGetPriority1(arg_global: *jsc.JSGlobalObject, arg_pid: *const i32, out: *i32) bool { + if (!@hasDecl(import_node_os, "getPriority")) + @compileError("Missing binding declaration \"getPriority\" in \"node_os.zig\""); + out.* = @as(bun.JSError!i32, import_node_os.getPriority( + arg_global, + arg_pid.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchHomedir1(arg_global: *jsc.JSGlobalObject, out: *bun.String) bool { + if (!@hasDecl(import_node_os, "homedir")) + @compileError("Missing binding declaration \"homedir\" in \"node_os.zig\""); + out.* = @as(bun.JSError!bun.String, import_node_os.homedir( + arg_global, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchHostname1(arg_global: *jsc.JSGlobalObject) jsc.JSValue { + if (!@hasDecl(import_node_os, "hostname")) + @compileError("Missing binding declaration \"hostname\" in \"node_os.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_node_os.hostname, .{ + arg_global, + }); + } + export fn bindgen_Node_os_dispatchLoadavg1(arg_global: *jsc.JSGlobalObject) jsc.JSValue { + if (!@hasDecl(import_node_os, "loadavg")) + @compileError("Missing binding declaration \"loadavg\" in \"node_os.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_node_os.loadavg, .{ + arg_global, + }); + } + export fn bindgen_Node_os_dispatchNetworkInterfaces1(arg_global: *jsc.JSGlobalObject) jsc.JSValue { + if (!@hasDecl(import_node_os, "networkInterfaces")) + @compileError("Missing binding declaration \"networkInterfaces\" in \"node_os.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_node_os.networkInterfaces, .{ + arg_global, + }); + } + export fn bindgen_Node_os_dispatchRelease1(global: *jsc.JSGlobalObject, out: *bun.String) bool { + if (!@hasDecl(import_node_os, "release")) + @compileError("Missing binding declaration \"release\" in \"node_os.zig\""); + out.* = @as(bun.JSError!bun.String, import_node_os.release()) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchTotalmem1(global: *jsc.JSGlobalObject, out: *u64) bool { + if (!@hasDecl(import_node_os, "totalmem")) + @compileError("Missing binding declaration \"totalmem\" in \"node_os.zig\""); + out.* = @as(bun.JSError!u64, import_node_os.totalmem()) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchUptime1(arg_global: *jsc.JSGlobalObject, out: *f64) bool { + if (!@hasDecl(import_node_os, "uptime")) + @compileError("Missing binding declaration \"uptime\" in \"node_os.zig\""); + out.* = @as(bun.JSError!f64, import_node_os.uptime( + arg_global, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchUserInfo1(arg_global: *jsc.JSGlobalObject, arg_options: *const node_os.UserInfoOptions) jsc.JSValue { + if (!@hasDecl(import_node_os, "userInfo")) + @compileError("Missing binding declaration \"userInfo\" in \"node_os.zig\""); + return jsc.toJSHostCall(arg_global, @src(), import_node_os.userInfo, .{ + arg_global, + arg_options.*, + }); + } + export fn bindgen_Node_os_dispatchVersion1(global: *jsc.JSGlobalObject, out: *bun.String) bool { + if (!@hasDecl(import_node_os, "version")) + @compileError("Missing binding declaration \"version\" in \"node_os.zig\""); + out.* = @as(bun.JSError!bun.String, import_node_os.version()) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchSetPriority1(arg_global: *jsc.JSGlobalObject, arg_pid: *const i32, arg_priority: *const i32) bool { + if (!@hasDecl(import_node_os, "setPriority1")) + @compileError("Missing binding declaration \"setPriority1\" in \"node_os.zig\""); + @as(bun.JSError!void, import_node_os.setPriority1( + arg_global, + arg_pid.*, + arg_priority.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + export fn bindgen_Node_os_dispatchSetPriority2(arg_global: *jsc.JSGlobalObject, arg_priority: *const i32) bool { + if (!@hasDecl(import_node_os, "setPriority2")) + @compileError("Missing binding declaration \"setPriority2\" in \"node_os.zig\""); + @as(bun.JSError!void, import_node_os.setPriority2( + arg_global, + arg_priority.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } + const import_fmt = @import("../../../fmt.zig"); + export fn bindgen_Fmt_dispatchFmtString1(arg_global: *jsc.JSGlobalObject, arg_code: *const bun.String, arg_formatter: *const fmt.Formatter, out: *bun.String) bool { + if (!@hasDecl(import_fmt.js_bindings, "fmtString")) + @compileError("Missing binding declaration \"js_bindings.fmtString\" in \"fmt.zig\""); + const arg_code_utf8 = arg_code.toUTF8(bun.default_allocator); + defer arg_code_utf8.deinit(); + out.* = @as(bun.JSError!bun.String, import_fmt.js_bindings.fmtString( + arg_global, + arg_code_utf8.slice(), + arg_formatter.*, + )) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => arg_global.throwOutOfMemory() catch return false, + error.JSTerminated => return false, + }; + return true; + } +}; + +comptime { + if (bun.Environment.export_cpp_apis) { + for (@typeInfo(binding_internals).@"struct".decls) |decl| { + _ = &@field(binding_internals, decl.name); + } + } +} + +const bun = @import("bun"); + +const jsc = bun.jsc; +const JSHostFunctionType = jsc.JSHostFn; diff --git a/src/buntime/jsc/generated/GeneratedJS2Native.zig b/src/buntime/jsc/generated/GeneratedJS2Native.zig new file mode 100644 index 000000000000..4aef245d2c3a --- /dev/null +++ b/src/buntime/jsc/generated/GeneratedJS2Native.zig @@ -0,0 +1,342 @@ +//! This file is generated by src/codegen/generate-js2native.ts based on seen calls to the $zig() JS macro +export fn JS2Zig___src_buntime_node_node_assert_binding_zig__generate_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_assert_binding.zig").generate, .{global}); +} +export fn JS2Zig___src_sql_mysql_zig__createBinding_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../sql/mysql.zig").createBinding, .{global}); +} +export fn JS2Zig___src_sql_postgres_zig__createBinding_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../sql/postgres.zig").createBinding, .{global}); +} +export fn JS2Zig___src_buntime_node_node_crypto_binding_zig__createNodeCryptoBindingZig_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_crypto_binding.zig").createNodeCryptoBindingZig, .{global}); +} +export fn JS2Zig___src_buntime_node_node_fs_binding_zig__createBinding_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_fs_binding.zig").createBinding, .{global}); +} +export fn JS2Zig___src_buntime_api_bun_h__frame_parser_zig__H_FrameParserConstructor_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../api/bun/h2_frame_parser.zig").H2FrameParserConstructor, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__getDefaultAutoSelectFamily_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").getDefaultAutoSelectFamily, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__setDefaultAutoSelectFamily_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").setDefaultAutoSelectFamily, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__getDefaultAutoSelectFamilyAttemptTimeout_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").getDefaultAutoSelectFamilyAttemptTimeout, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__setDefaultAutoSelectFamilyAttemptTimeout_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").setDefaultAutoSelectFamilyAttemptTimeout, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__SocketAddress_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").SocketAddress, .{global}); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__BlockList_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_net_binding.zig").BlockList, .{global}); +} +export fn JS2Zig___src_buntime_node_node_os_zig__createNodeOsBinding_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_os.zig").createNodeOsBinding, .{global}); +} +export fn JS2Zig___src_buntime_node_node_zlib_binding_zig__NativeZlib_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_zlib_binding.zig").NativeZlib, .{global}); +} +export fn JS2Zig___src_buntime_node_node_zlib_binding_zig__NativeBrotli_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_zlib_binding.zig").NativeBrotli, .{global}); +} +export fn JS2Zig___src_buntime_node_node_zlib_binding_zig__NativeZstd_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../node/node_zlib_binding.zig").NativeZstd, .{global}); +} +export fn JS2Zig___src_crash_handler_zig__js_bindings_generate_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../crash_handler.zig").js_bindings.generate, .{global}); +} +export fn JS2Zig___src_cli_upgrade_command_zig__upgrade_js_bindings_generate_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../cli/upgrade_command.zig").upgrade_js_bindings.generate, .{global}); +} +export fn JS2Zig___src_install_install_binding_zig__bun_install_js_bindings_generate_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../install/install_binding.zig").bun_install_js_bindings.generate, .{global}); +} +export fn JS2Zig___src_install_npm_zig__PackageManifest_bindings_generate_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../install/npm.zig").PackageManifest.bindings.generate, .{global}); +} +export fn JS2Zig___src_bake_FrameworkRouter_zig__JSFrameworkRouter_getBindings_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../../../bake/FrameworkRouter.zig").JSFrameworkRouter.getBindings, .{global}); +} +export fn JS2Zig___src_buntime_jsc_interop_bindgen_test_zig__getBindgenTestFunctions_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { + return jsc.toJSHostCall(global, @src(), @import("../interop/bindgen_test.zig").getBindgenTestFunctions, .{global}); +} +export fn JS2Zig___src_buntime_api_ffi_zig__Bun__FFI__cc(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/ffi.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Bun__FFI__cc), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__sendHelperPrimary(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.sendHelperPrimary), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__sendHelperChild(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.sendHelperChild), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__onInternalMessageChild(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.onInternalMessageChild), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__channelIgnoreOneDisconnectEventListener(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.channelIgnoreOneDisconnectEventListener), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__onInternalMessagePrimary(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.onInternalMessagePrimary), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_http_binding_zig__setMaxHTTPHeaderSize(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_http_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.setMaxHTTPHeaderSize), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_http_binding_zig__getMaxHTTPHeaderSize(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_http_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.getMaxHTTPHeaderSize), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__extractedSplitNewLinesFastPathStringsOnly(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.extractedSplitNewLinesFastPathStringsOnly), .{ global, call_frame }); +} +export fn JS2Zig___src_string_zig__String_jsGetStringWidth(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../string.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.String.jsGetStringWidth), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__normalizeEncoding(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.normalizeEncoding), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_http_binding_zig__getBunServerAllClosedPromise(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_http_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.getBunServerAllClosedPromise), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__etimedoutErrorCode(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.etimedoutErrorCode), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__enobufsErrorCode(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.enobufsErrorCode), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_udp_socket_zig__UDPSocket_jsConnect(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/udp_socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.UDPSocket.jsConnect), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_udp_socket_zig__UDPSocket_jsDisconnect(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/udp_socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.UDPSocket.jsDisconnect), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_dns_zig__Resolver_getRuntimeDefaultResultOrderOption(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/dns.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Resolver.getRuntimeDefaultResultOrderOption), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_dns_zig__Resolver_newResolver(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/dns.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Resolver.newResolver), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_types_zig__jsAssertEncodingValid(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/types.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsAssertEncodingValid), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_h__frame_parser_zig__jsAssertSettings(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/h2_frame_parser.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsAssertSettings), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_h__frame_parser_zig__jsGetPackedSettings(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/h2_frame_parser.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsGetPackedSettings), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_h__frame_parser_zig__jsGetUnpackedSettings(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/h2_frame_parser.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsGetUnpackedSettings), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__newDetachedSocket(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_net_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.newDetachedSocket), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_net_binding_zig__doConnect(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_net_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.doConnect), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_Listener_zig__jsAddServerName(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket/Listener.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsAddServerName), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_zig__jsUpgradeDuplexToTLS(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsUpgradeDuplexToTLS), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_zig__jsIsNamedPipeSocket(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsIsNamedPipeSocket), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_zig__jsGetBufferedAmount(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsGetBufferedAmount), .{ global, call_frame }); +} +export fn JS2Zig___src_bun_zig__getUseSystemCA(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../bun.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.getUseSystemCA), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__internalErrorName(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.internalErrorName), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_util_binding_zig__parseEnv(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_util_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.parseEnv), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_util_parse_args_zig__parseArgs(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/util/parse_args.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.parseArgs), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_zlib_binding_zig__crc__(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_zlib_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.crc32), .{ global, call_frame }); +} +export fn JS2Zig___src_patch_zig__TestingAPIs_parse(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../patch.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.parse), .{ global, call_frame }); +} +export fn JS2Zig___src_patch_zig__TestingAPIs_apply(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../patch.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.apply), .{ global, call_frame }); +} +export fn JS2Zig___src_patch_zig__TestingAPIs_makeDiff(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../patch.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.makeDiff), .{ global, call_frame }); +} +export fn JS2Zig___src_shell_shell_zig__TestingAPIs_shellLex(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../shell/shell.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.shellLex), .{ global, call_frame }); +} +export fn JS2Zig___src_shell_shell_zig__TestingAPIs_shellParse(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../shell/shell.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.shellParse), .{ global, call_frame }); +} +export fn JS2Zig___src_string_escapeRegExp_zig__jsEscapeRegExp(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../string/escapeRegExp.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsEscapeRegExp), .{ global, call_frame }); +} +export fn JS2Zig___src_string_escapeRegExp_zig__jsEscapeRegExpForPackageNameMatching(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../string/escapeRegExp.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsEscapeRegExpForPackageNameMatching), .{ global, call_frame }); +} +export fn JS2Zig___src_shell_shell_zig__TestingAPIs_disabledOnThisPlatform(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../shell/shell.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.disabledOnThisPlatform), .{ global, call_frame }); +} +export fn JS2Zig___src_ini_zig__IniTestingAPIs_parse(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../ini.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.IniTestingAPIs.parse), .{ global, call_frame }); +} +export fn JS2Zig___src_ini_zig__IniTestingAPIs_loadNpmrcFromJS(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../ini.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.IniTestingAPIs.loadNpmrcFromJS), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__minifyTestWithOptions(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.minifyTestWithOptions), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__minifyErrorTestWithOptions(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.minifyErrorTestWithOptions), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__testWithOptions(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.testWithOptions), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__prefixTestWithOptions(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.prefixTestWithOptions), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__minifyTest(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.minifyTest), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__prefixTest(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.prefixTest), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig___test(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function._test), .{ global, call_frame }); +} +export fn JS2Zig___src_css_css_internals_zig__attrTest(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../css/css_internals.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.attrTest), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_fs_binding_zig__createMemfdForTesting(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_fs_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.createMemfdForTesting), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_core_virtual_machine_exports_zig__Bun__setSyntheticAllocationLimitForTesting(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../core/virtual_machine_exports.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Bun__setSyntheticAllocationLimitForTesting), .{ global, call_frame }); +} +export fn JS2Zig___src_install_dependency_zig__fromJS(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/dependency.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.fromJS), .{ global, call_frame }); +} +export fn JS2Zig___src_install_dependency_zig__Version_Tag_inferFromJS(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/dependency.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Version.Tag.inferFromJS), .{ global, call_frame }); +} +export fn JS2Zig___src_cli_pack_command_zig__bindings_jsReadTarball(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../cli/pack_command.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.bindings.jsReadTarball), .{ global, call_frame }); +} +export fn JS2Zig___src_install_npm_zig__Architecture_jsFunctionArchitectureIsMatch(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/npm.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.Architecture.jsFunctionArchitectureIsMatch), .{ global, call_frame }); +} +export fn JS2Zig___src_install_npm_zig__OperatingSystem_jsFunctionOperatingSystemIsMatch(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/npm.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.OperatingSystem.jsFunctionOperatingSystemIsMatch), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_zig__jsCreateSocketPair(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsCreateSocketPair), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_Timer_zig__internal_bindings_timerClockMs(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/Timer.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.internal_bindings.timerClockMs), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_core_Counters_zig__createCountersObject(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../core/Counters.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.createCountersObject), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_bun_socket_zig__jsSetSocketOptions(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/bun/socket.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.jsSetSocketOptions), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_core_event_loop_zig__getActiveTasks(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../event_loop/event_loop.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.getActiveTasks), .{ global, call_frame }); +} +export fn JS2Zig___src_install_hosted_git_info_zig__TestingAPIs_jsParseUrl(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/hosted_git_info.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.jsParseUrl), .{ global, call_frame }); +} +export fn JS2Zig___src_install_hosted_git_info_zig__TestingAPIs_jsFromUrl(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../../install/hosted_git_info.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.TestingAPIs.jsFromUrl), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_api_ipc_ipc_zig__emitHandleIPCMessage(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../api/ipc/ipc.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.emitHandleIPCMessage), .{ global, call_frame }); +} +export fn JS2Zig___src_buntime_node_node_cluster_binding_zig__setRef(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { + const function = @import("../../node/node_cluster_binding.zig"); + return @call(bun.callmod_inline, jsc.toJSHostFn(function.setRef), .{ global, call_frame }); +} +comptime { + @export(&bun.gen.fmt.createFmtStringCallback, .{ .name = "js2native_bindgen_fmt_fmtString" }); + @export(&bun.gen.DevServer.createGetDeinitCountForTestingCallback, .{ .name = "js2native_bindgen_DevServer_getDeinitCountForTesting" }); +} + +const bun = @import("bun"); +const jsc = bun.jsc; diff --git a/src/bun.js/bindings/JS2Native.cpp b/src/buntime/jsc/generated/JS2Native.cpp similarity index 100% rename from src/bun.js/bindings/JS2Native.cpp rename to src/buntime/jsc/generated/JS2Native.cpp diff --git a/src/bun.js/bindings/JS2Native.h b/src/buntime/jsc/generated/JS2Native.h similarity index 100% rename from src/bun.js/bindings/JS2Native.h rename to src/buntime/jsc/generated/JS2Native.h diff --git a/src/bun.js/bindings/codegen.zig b/src/buntime/jsc/generated/codegen.zig similarity index 100% rename from src/bun.js/bindings/codegen.zig rename to src/buntime/jsc/generated/codegen.zig diff --git a/src/bun.js/bindings/generated_classes_list.zig b/src/buntime/jsc/generated/generated_classes_list.zig similarity index 100% rename from src/bun.js/bindings/generated_classes_list.zig rename to src/buntime/jsc/generated/generated_classes_list.zig diff --git a/src/bun.js/bindings/js_classes.ts b/src/buntime/jsc/generated/js_classes.ts similarity index 100% rename from src/bun.js/bindings/js_classes.ts rename to src/buntime/jsc/generated/js_classes.ts diff --git a/src/bun.js/bindings/BunGlobalScope.cpp b/src/buntime/jsc/global/BunGlobalScope.cpp similarity index 100% rename from src/bun.js/bindings/BunGlobalScope.cpp rename to src/buntime/jsc/global/BunGlobalScope.cpp diff --git a/src/bun.js/bindings/BunGlobalScope.h b/src/buntime/jsc/global/BunGlobalScope.h similarity index 100% rename from src/bun.js/bindings/BunGlobalScope.h rename to src/buntime/jsc/global/BunGlobalScope.h diff --git a/src/bun.js/bindings/BunObject+exports.h b/src/buntime/jsc/global/BunObject+exports.h similarity index 100% rename from src/bun.js/bindings/BunObject+exports.h rename to src/buntime/jsc/global/BunObject+exports.h diff --git a/src/bun.js/bindings/BunObject.cpp b/src/buntime/jsc/global/BunObject.cpp similarity index 100% rename from src/bun.js/bindings/BunObject.cpp rename to src/buntime/jsc/global/BunObject.cpp diff --git a/src/bun.js/bindings/BunObject.h b/src/buntime/jsc/global/BunObject.h similarity index 100% rename from src/bun.js/bindings/BunObject.h rename to src/buntime/jsc/global/BunObject.h diff --git a/src/bun.js/bindings/BunWorkerGlobalScope.cpp b/src/buntime/jsc/global/BunWorkerGlobalScope.cpp similarity index 100% rename from src/bun.js/bindings/BunWorkerGlobalScope.cpp rename to src/buntime/jsc/global/BunWorkerGlobalScope.cpp diff --git a/src/bun.js/bindings/BunWorkerGlobalScope.h b/src/buntime/jsc/global/BunWorkerGlobalScope.h similarity index 100% rename from src/bun.js/bindings/BunWorkerGlobalScope.h rename to src/buntime/jsc/global/BunWorkerGlobalScope.h diff --git a/src/bun.js/bindings/DOMWrapperWorld-class.h b/src/buntime/jsc/global/DOMWrapperWorld-class.h similarity index 100% rename from src/bun.js/bindings/DOMWrapperWorld-class.h rename to src/buntime/jsc/global/DOMWrapperWorld-class.h diff --git a/src/bun.js/bindings/DOMWrapperWorld.cpp b/src/buntime/jsc/global/DOMWrapperWorld.cpp similarity index 100% rename from src/bun.js/bindings/DOMWrapperWorld.cpp rename to src/buntime/jsc/global/DOMWrapperWorld.cpp diff --git a/src/bun.js/bindings/DOMWrapperWorld.h b/src/buntime/jsc/global/DOMWrapperWorld.h similarity index 100% rename from src/bun.js/bindings/DOMWrapperWorld.h rename to src/buntime/jsc/global/DOMWrapperWorld.h diff --git a/src/bun.js/bindings/JSDOMGlobalObject.cpp b/src/buntime/jsc/global/JSDOMGlobalObject.cpp similarity index 100% rename from src/bun.js/bindings/JSDOMGlobalObject.cpp rename to src/buntime/jsc/global/JSDOMGlobalObject.cpp diff --git a/src/bun.js/bindings/JSDOMGlobalObject.h b/src/buntime/jsc/global/JSDOMGlobalObject.h similarity index 100% rename from src/bun.js/bindings/JSDOMGlobalObject.h rename to src/buntime/jsc/global/JSDOMGlobalObject.h diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/buntime/jsc/global/ScriptExecutionContext.cpp similarity index 100% rename from src/bun.js/bindings/ScriptExecutionContext.cpp rename to src/buntime/jsc/global/ScriptExecutionContext.cpp diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/buntime/jsc/global/ScriptExecutionContext.h similarity index 100% rename from src/bun.js/bindings/ScriptExecutionContext.h rename to src/buntime/jsc/global/ScriptExecutionContext.h diff --git a/src/bun.js/webcore/ScriptExecutionContext.zig b/src/buntime/jsc/global/ScriptExecutionContext.zig similarity index 100% rename from src/bun.js/webcore/ScriptExecutionContext.zig rename to src/buntime/jsc/global/ScriptExecutionContext.zig diff --git a/src/bun.js/bindings/ZigGeneratedCode.cpp b/src/buntime/jsc/global/ZigGeneratedCode.cpp similarity index 100% rename from src/bun.js/bindings/ZigGeneratedCode.cpp rename to src/buntime/jsc/global/ZigGeneratedCode.cpp diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/buntime/jsc/global/ZigGlobalObject.cpp similarity index 99% rename from src/bun.js/bindings/ZigGlobalObject.cpp rename to src/buntime/jsc/global/ZigGlobalObject.cpp index dbbe784ad0db..d8fccbacb52f 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/buntime/jsc/global/ZigGlobalObject.cpp @@ -83,7 +83,7 @@ #include "JSBroadcastChannel.h" #include "JSBuffer.h" #include "JSBufferList.h" -#include "webcore/JSMIMEBindings.h" +#include "JSMIMEBindings.h" #include "JSByteLengthQueuingStrategy.h" #include "JSCloseEvent.h" #include "JSCommonJSExtensions.h" @@ -103,8 +103,8 @@ #include "JSEventTarget.h" #include "JSFetchHeaders.h" #include "JSFFIFunction.h" -#include "webcore/JSMIMEParams.h" -#include "webcore/JSMIMEType.h" +#include "JSMIMEParams.h" +#include "JSMIMEType.h" #include "JSMessageChannel.h" #include "JSMessageEvent.h" #include "JSMessagePort.h" @@ -182,7 +182,7 @@ #include "JSSecretKeyObject.h" #include "JSPublicKeyObject.h" #include "JSPrivateKeyObject.h" -#include "webcore/JSMIMEParams.h" +#include "JSMIMEParams.h" #include "JSNodePerformanceHooksHistogram.h" #include "JSS3File.h" #include "S3Error.h" @@ -190,7 +190,7 @@ #include "NodeValidator.h" #include "ProcessBindingFs.h" #include "ProcessBindingHTTPParser.h" -#include "node/NodeTimers.h" +#include "NodeTimers.h" #include "JSConnectionsList.h" #include "JSHTTPParser.h" #include diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/buntime/jsc/global/ZigGlobalObject.h similarity index 100% rename from src/bun.js/bindings/ZigGlobalObject.h rename to src/buntime/jsc/global/ZigGlobalObject.h diff --git a/src/bun.js/bindings/ZigGlobalObject.lut.txt b/src/buntime/jsc/global/ZigGlobalObject.lut.txt similarity index 98% rename from src/bun.js/bindings/ZigGlobalObject.lut.txt rename to src/buntime/jsc/global/ZigGlobalObject.lut.txt index 9ccc124f252c..d0073d089843 100644 --- a/src/bun.js/bindings/ZigGlobalObject.lut.txt +++ b/src/buntime/jsc/global/ZigGlobalObject.lut.txt @@ -1,95 +1,95 @@ -// In a separate file because processing ZigGlobalObject.cpp takes 15+ seconds - -/* Source for ZigGlobalObject.lut.h -@begin bunGlobalObjectTable - addEventListener jsFunctionAddEventListener Function 2 - alert WebCore__alert Function 1 - atob functionATOB Function 1 - btoa functionBTOA Function 1 - clearImmediate functionClearImmediate Function 1 - clearInterval functionClearInterval Function 1 - clearTimeout functionClearTimeout Function 1 - confirm WebCore__confirm Function 1 - dispatchEvent jsFunctionDispatchEvent Function 1 - fetch constructBunFetchObject PropertyCallback - postMessage jsFunctionPostMessage Function 1 - prompt WebCore__prompt Function 1 - queueMicrotask functionQueueMicrotask Function 2 - removeEventListener jsFunctionRemoveEventListener Function 2 - reportError functionReportError Function 1 - setImmediate functionSetImmediate Function 1 - setInterval functionSetInterval Function 1 - setTimeout functionSetTimeout Function 1 - structuredClone WebCore::jsFunctionStructuredClone Function 2 - - global GlobalObject_getGlobalThis PropertyCallback - - Bun GlobalObject::m_bunObject CellProperty|DontDelete|ReadOnly - File GlobalObject::m_JSDOMFileConstructor CellProperty - crypto GlobalObject::m_cryptoObject CellProperty - navigator GlobalObject::m_navigatorObject CellProperty - performance GlobalObject::m_performanceObject CellProperty - process GlobalObject::m_processObject CellProperty - - Blob GlobalObject::m_JSBlob ClassStructure - Buffer GlobalObject::m_JSBufferClassStructure ClassStructure - BuildError GlobalObject::m_JSBuildMessage ClassStructure - BuildMessage GlobalObject::m_JSBuildMessage ClassStructure - Crypto GlobalObject::m_JSCrypto ClassStructure - HTMLRewriter GlobalObject::m_JSHTMLRewriter ClassStructure - Request GlobalObject::m_JSRequest ClassStructure - ResolveError GlobalObject::m_JSResolveMessage ClassStructure - ResolveMessage GlobalObject::m_JSResolveMessage ClassStructure - Response GlobalObject::m_JSResponse ClassStructure - TextDecoder GlobalObject::m_JSTextDecoder ClassStructure - - AbortController AbortControllerConstructorCallback PropertyCallback - AbortSignal AbortSignalConstructorCallback PropertyCallback - BroadcastChannel BroadcastChannelConstructorCallback PropertyCallback - ByteLengthQueuingStrategy ByteLengthQueuingStrategyConstructorCallback PropertyCallback - CloseEvent CloseEventConstructorCallback PropertyCallback - CompressionStream CompressionStreamConstructorCallback PropertyCallback - CountQueuingStrategy CountQueuingStrategyConstructorCallback PropertyCallback - CryptoKey CryptoKeyConstructorCallback PropertyCallback - CustomEvent CustomEventConstructorCallback PropertyCallback - DecompressionStream DecompressionStreamConstructorCallback PropertyCallback - DOMException DOMExceptionConstructorCallback PropertyCallback - ErrorEvent ErrorEventConstructorCallback PropertyCallback - Event EventConstructorCallback PropertyCallback - EventTarget EventTargetConstructorCallback PropertyCallback - FormData DOMFormDataConstructorCallback PropertyCallback - Headers FetchHeadersConstructorCallback PropertyCallback - MessageChannel MessageChannelConstructorCallback PropertyCallback - MessageEvent MessageEventConstructorCallback PropertyCallback - MessagePort MessagePortConstructorCallback PropertyCallback - Performance PerformanceConstructorCallback PropertyCallback - PerformanceEntry PerformanceEntryConstructorCallback PropertyCallback - PerformanceMark PerformanceMarkConstructorCallback PropertyCallback - PerformanceMeasure PerformanceMeasureConstructorCallback PropertyCallback - PerformanceObserver PerformanceObserverConstructorCallback PropertyCallback - PerformanceObserverEntryList PerformanceObserverEntryListConstructorCallback PropertyCallback - PerformanceResourceTiming PerformanceResourceTimingConstructorCallback PropertyCallback - PerformanceServerTiming PerformanceServerTimingConstructorCallback PropertyCallback - PerformanceTiming PerformanceTimingConstructorCallback PropertyCallback - ReadableByteStreamController ReadableByteStreamControllerConstructorCallback PropertyCallback - ReadableStream ReadableStreamConstructorCallback PropertyCallback - ReadableStreamBYOBReader ReadableStreamBYOBReaderConstructorCallback PropertyCallback - ReadableStreamBYOBRequest ReadableStreamBYOBRequestConstructorCallback PropertyCallback - ReadableStreamDefaultController ReadableStreamDefaultControllerConstructorCallback PropertyCallback - ReadableStreamDefaultReader ReadableStreamDefaultReaderConstructorCallback PropertyCallback - SubtleCrypto SubtleCryptoConstructorCallback PropertyCallback - TextDecoderStream TextDecoderStreamConstructorCallback PropertyCallback - TextEncoder TextEncoderConstructorCallback PropertyCallback - TextEncoderStream TextEncoderStreamConstructorCallback PropertyCallback - TransformStream TransformStreamConstructorCallback PropertyCallback - TransformStreamDefaultController TransformStreamDefaultControllerConstructorCallback PropertyCallback - URL DOMURLConstructorCallback DontEnum|PropertyCallback - URLPattern URLPatternConstructorCallback PropertyCallback - URLSearchParams URLSearchParamsConstructorCallback DontEnum|PropertyCallback - WebSocket WebSocketConstructorCallback PropertyCallback - Worker WorkerConstructorCallback PropertyCallback - WritableStream WritableStreamConstructorCallback PropertyCallback - WritableStreamDefaultController WritableStreamDefaultControllerConstructorCallback PropertyCallback - WritableStreamDefaultWriter WritableStreamDefaultWriterConstructorCallback PropertyCallback -@end -*/ +// In a separate file because processing ZigGlobalObject.cpp takes 15+ seconds + +/* Source for ZigGlobalObject.lut.h +@begin bunGlobalObjectTable + addEventListener jsFunctionAddEventListener Function 2 + alert WebCore__alert Function 1 + atob functionATOB Function 1 + btoa functionBTOA Function 1 + clearImmediate functionClearImmediate Function 1 + clearInterval functionClearInterval Function 1 + clearTimeout functionClearTimeout Function 1 + confirm WebCore__confirm Function 1 + dispatchEvent jsFunctionDispatchEvent Function 1 + fetch constructBunFetchObject PropertyCallback + postMessage jsFunctionPostMessage Function 1 + prompt WebCore__prompt Function 1 + queueMicrotask functionQueueMicrotask Function 2 + removeEventListener jsFunctionRemoveEventListener Function 2 + reportError functionReportError Function 1 + setImmediate functionSetImmediate Function 1 + setInterval functionSetInterval Function 1 + setTimeout functionSetTimeout Function 1 + structuredClone WebCore::jsFunctionStructuredClone Function 2 + + global GlobalObject_getGlobalThis PropertyCallback + + Bun GlobalObject::m_bunObject CellProperty|DontDelete|ReadOnly + File GlobalObject::m_JSDOMFileConstructor CellProperty + crypto GlobalObject::m_cryptoObject CellProperty + navigator GlobalObject::m_navigatorObject CellProperty + performance GlobalObject::m_performanceObject CellProperty + process GlobalObject::m_processObject CellProperty + + Blob GlobalObject::m_JSBlob ClassStructure + Buffer GlobalObject::m_JSBufferClassStructure ClassStructure + BuildError GlobalObject::m_JSBuildMessage ClassStructure + BuildMessage GlobalObject::m_JSBuildMessage ClassStructure + Crypto GlobalObject::m_JSCrypto ClassStructure + HTMLRewriter GlobalObject::m_JSHTMLRewriter ClassStructure + Request GlobalObject::m_JSRequest ClassStructure + ResolveError GlobalObject::m_JSResolveMessage ClassStructure + ResolveMessage GlobalObject::m_JSResolveMessage ClassStructure + Response GlobalObject::m_JSResponse ClassStructure + TextDecoder GlobalObject::m_JSTextDecoder ClassStructure + + AbortController AbortControllerConstructorCallback PropertyCallback + AbortSignal AbortSignalConstructorCallback PropertyCallback + BroadcastChannel BroadcastChannelConstructorCallback PropertyCallback + ByteLengthQueuingStrategy ByteLengthQueuingStrategyConstructorCallback PropertyCallback + CloseEvent CloseEventConstructorCallback PropertyCallback + CompressionStream CompressionStreamConstructorCallback PropertyCallback + CountQueuingStrategy CountQueuingStrategyConstructorCallback PropertyCallback + CryptoKey CryptoKeyConstructorCallback PropertyCallback + CustomEvent CustomEventConstructorCallback PropertyCallback + DecompressionStream DecompressionStreamConstructorCallback PropertyCallback + DOMException DOMExceptionConstructorCallback PropertyCallback + ErrorEvent ErrorEventConstructorCallback PropertyCallback + Event EventConstructorCallback PropertyCallback + EventTarget EventTargetConstructorCallback PropertyCallback + FormData DOMFormDataConstructorCallback PropertyCallback + Headers FetchHeadersConstructorCallback PropertyCallback + MessageChannel MessageChannelConstructorCallback PropertyCallback + MessageEvent MessageEventConstructorCallback PropertyCallback + MessagePort MessagePortConstructorCallback PropertyCallback + Performance PerformanceConstructorCallback PropertyCallback + PerformanceEntry PerformanceEntryConstructorCallback PropertyCallback + PerformanceMark PerformanceMarkConstructorCallback PropertyCallback + PerformanceMeasure PerformanceMeasureConstructorCallback PropertyCallback + PerformanceObserver PerformanceObserverConstructorCallback PropertyCallback + PerformanceObserverEntryList PerformanceObserverEntryListConstructorCallback PropertyCallback + PerformanceResourceTiming PerformanceResourceTimingConstructorCallback PropertyCallback + PerformanceServerTiming PerformanceServerTimingConstructorCallback PropertyCallback + PerformanceTiming PerformanceTimingConstructorCallback PropertyCallback + ReadableByteStreamController ReadableByteStreamControllerConstructorCallback PropertyCallback + ReadableStream ReadableStreamConstructorCallback PropertyCallback + ReadableStreamBYOBReader ReadableStreamBYOBReaderConstructorCallback PropertyCallback + ReadableStreamBYOBRequest ReadableStreamBYOBRequestConstructorCallback PropertyCallback + ReadableStreamDefaultController ReadableStreamDefaultControllerConstructorCallback PropertyCallback + ReadableStreamDefaultReader ReadableStreamDefaultReaderConstructorCallback PropertyCallback + SubtleCrypto SubtleCryptoConstructorCallback PropertyCallback + TextDecoderStream TextDecoderStreamConstructorCallback PropertyCallback + TextEncoder TextEncoderConstructorCallback PropertyCallback + TextEncoderStream TextEncoderStreamConstructorCallback PropertyCallback + TransformStream TransformStreamConstructorCallback PropertyCallback + TransformStreamDefaultController TransformStreamDefaultControllerConstructorCallback PropertyCallback + URL DOMURLConstructorCallback DontEnum|PropertyCallback + URLPattern URLPatternConstructorCallback PropertyCallback + URLSearchParams URLSearchParamsConstructorCallback DontEnum|PropertyCallback + WebSocket WebSocketConstructorCallback PropertyCallback + Worker WorkerConstructorCallback PropertyCallback + WritableStream WritableStreamConstructorCallback PropertyCallback + WritableStreamDefaultController WritableStreamDefaultControllerConstructorCallback PropertyCallback + WritableStreamDefaultWriter WritableStreamDefaultWriterConstructorCallback PropertyCallback +@end +*/ diff --git a/src/bun.js/bindings/ZigLazyStaticFunctions-inlines.h b/src/buntime/jsc/global/ZigLazyStaticFunctions-inlines.h similarity index 100% rename from src/bun.js/bindings/ZigLazyStaticFunctions-inlines.h rename to src/buntime/jsc/global/ZigLazyStaticFunctions-inlines.h diff --git a/src/bun.js/bindings/ZigLazyStaticFunctions.h b/src/buntime/jsc/global/ZigLazyStaticFunctions.h similarity index 100% rename from src/bun.js/bindings/ZigLazyStaticFunctions.h rename to src/buntime/jsc/global/ZigLazyStaticFunctions.h diff --git a/src/bun.js/bindings/ZigSourceProvider.cpp b/src/buntime/jsc/global/ZigSourceProvider.cpp similarity index 100% rename from src/bun.js/bindings/ZigSourceProvider.cpp rename to src/buntime/jsc/global/ZigSourceProvider.cpp diff --git a/src/bun.js/bindings/ZigSourceProvider.h b/src/buntime/jsc/global/ZigSourceProvider.h similarity index 100% rename from src/bun.js/bindings/ZigSourceProvider.h rename to src/buntime/jsc/global/ZigSourceProvider.h diff --git a/src/bun.js/bindings/ActiveDOMCallback.cpp b/src/buntime/jsc/interop/ActiveDOMCallback.cpp similarity index 98% rename from src/bun.js/bindings/ActiveDOMCallback.cpp rename to src/buntime/jsc/interop/ActiveDOMCallback.cpp index 1a0fb426f9a2..2f7936aef393 100644 --- a/src/bun.js/bindings/ActiveDOMCallback.cpp +++ b/src/buntime/jsc/interop/ActiveDOMCallback.cpp @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "webcore/config.h" +#include "config.h" #include "ActiveDOMCallback.h" #include "ScriptExecutionContext.h" diff --git a/src/bun.js/bindings/ActiveDOMCallback.h b/src/buntime/jsc/interop/ActiveDOMCallback.h similarity index 100% rename from src/bun.js/bindings/ActiveDOMCallback.h rename to src/buntime/jsc/interop/ActiveDOMCallback.h diff --git a/src/bun.js/bindings/webcore/ActiveDOMObject.cpp b/src/buntime/jsc/interop/ActiveDOMObject.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ActiveDOMObject.cpp rename to src/buntime/jsc/interop/ActiveDOMObject.cpp diff --git a/src/bun.js/bindings/webcore/ActiveDOMObject.h b/src/buntime/jsc/interop/ActiveDOMObject.h similarity index 100% rename from src/bun.js/bindings/webcore/ActiveDOMObject.h rename to src/buntime/jsc/interop/ActiveDOMObject.h diff --git a/src/bun.js/webcore/AutoFlusher.zig b/src/buntime/jsc/interop/AutoFlusher.zig similarity index 100% rename from src/bun.js/webcore/AutoFlusher.zig rename to src/buntime/jsc/interop/AutoFlusher.zig diff --git a/src/bun.js/bindings/Bindgen.h b/src/buntime/jsc/interop/Bindgen.h similarity index 100% rename from src/bun.js/bindings/Bindgen.h rename to src/buntime/jsc/interop/Bindgen.h diff --git a/src/bun.js/bindings/Bindgen/ExternTraits.h b/src/buntime/jsc/interop/Bindgen/ExternTraits.h similarity index 100% rename from src/bun.js/bindings/Bindgen/ExternTraits.h rename to src/buntime/jsc/interop/Bindgen/ExternTraits.h diff --git a/src/bun.js/bindings/Bindgen/ExternUnion.h b/src/buntime/jsc/interop/Bindgen/ExternUnion.h similarity index 100% rename from src/bun.js/bindings/Bindgen/ExternUnion.h rename to src/buntime/jsc/interop/Bindgen/ExternUnion.h diff --git a/src/bun.js/bindings/Bindgen/ExternVectorTraits.h b/src/buntime/jsc/interop/Bindgen/ExternVectorTraits.h similarity index 100% rename from src/bun.js/bindings/Bindgen/ExternVectorTraits.h rename to src/buntime/jsc/interop/Bindgen/ExternVectorTraits.h diff --git a/src/bun.js/bindings/Bindgen/IDLConvert.h b/src/buntime/jsc/interop/Bindgen/IDLConvert.h similarity index 100% rename from src/bun.js/bindings/Bindgen/IDLConvert.h rename to src/buntime/jsc/interop/Bindgen/IDLConvert.h diff --git a/src/bun.js/bindings/Bindgen/IDLConvertBase.h b/src/buntime/jsc/interop/Bindgen/IDLConvertBase.h similarity index 100% rename from src/bun.js/bindings/Bindgen/IDLConvertBase.h rename to src/buntime/jsc/interop/Bindgen/IDLConvertBase.h diff --git a/src/bun.js/bindings/Bindgen/IDLTypes.h b/src/buntime/jsc/interop/Bindgen/IDLTypes.h similarity index 100% rename from src/bun.js/bindings/Bindgen/IDLTypes.h rename to src/buntime/jsc/interop/Bindgen/IDLTypes.h diff --git a/src/bun.js/bindings/Bindgen/Macros.h b/src/buntime/jsc/interop/Bindgen/Macros.h similarity index 100% rename from src/bun.js/bindings/Bindgen/Macros.h rename to src/buntime/jsc/interop/Bindgen/Macros.h diff --git a/src/bun.js/bindings/BindgenCustomEnforceRange.h b/src/buntime/jsc/interop/BindgenCustomEnforceRange.h similarity index 100% rename from src/bun.js/bindings/BindgenCustomEnforceRange.h rename to src/buntime/jsc/interop/BindgenCustomEnforceRange.h diff --git a/src/bun.js/bindings/webcore/BufferSource.h b/src/buntime/jsc/interop/BufferSource.h similarity index 100% rename from src/bun.js/bindings/webcore/BufferSource.h rename to src/buntime/jsc/interop/BufferSource.h diff --git a/src/bun.js/bindings/BunClientData.cpp b/src/buntime/jsc/interop/BunClientData.cpp similarity index 100% rename from src/bun.js/bindings/BunClientData.cpp rename to src/buntime/jsc/interop/BunClientData.cpp diff --git a/src/bun.js/bindings/BunClientData.h b/src/buntime/jsc/interop/BunClientData.h similarity index 100% rename from src/bun.js/bindings/BunClientData.h rename to src/buntime/jsc/interop/BunClientData.h diff --git a/src/bun.js/bindings/BunIDLConvert.h b/src/buntime/jsc/interop/BunIDLConvert.h similarity index 100% rename from src/bun.js/bindings/BunIDLConvert.h rename to src/buntime/jsc/interop/BunIDLConvert.h diff --git a/src/bun.js/bindings/BunIDLConvertBase.h b/src/buntime/jsc/interop/BunIDLConvertBase.h similarity index 100% rename from src/bun.js/bindings/BunIDLConvertBase.h rename to src/buntime/jsc/interop/BunIDLConvertBase.h diff --git a/src/bun.js/bindings/BunIDLConvertBlob.h b/src/buntime/jsc/interop/BunIDLConvertBlob.h similarity index 100% rename from src/bun.js/bindings/BunIDLConvertBlob.h rename to src/buntime/jsc/interop/BunIDLConvertBlob.h diff --git a/src/bun.js/bindings/BunIDLConvertContext.h b/src/buntime/jsc/interop/BunIDLConvertContext.h similarity index 100% rename from src/bun.js/bindings/BunIDLConvertContext.h rename to src/buntime/jsc/interop/BunIDLConvertContext.h diff --git a/src/bun.js/bindings/BunIDLConvertNumbers.h b/src/buntime/jsc/interop/BunIDLConvertNumbers.h similarity index 100% rename from src/bun.js/bindings/BunIDLConvertNumbers.h rename to src/buntime/jsc/interop/BunIDLConvertNumbers.h diff --git a/src/bun.js/bindings/BunIDLHumanReadable.h b/src/buntime/jsc/interop/BunIDLHumanReadable.h similarity index 100% rename from src/bun.js/bindings/BunIDLHumanReadable.h rename to src/buntime/jsc/interop/BunIDLHumanReadable.h diff --git a/src/bun.js/bindings/BunIDLTypes.h b/src/buntime/jsc/interop/BunIDLTypes.h similarity index 100% rename from src/bun.js/bindings/BunIDLTypes.h rename to src/buntime/jsc/interop/BunIDLTypes.h diff --git a/src/bun.js/bindings/CPUFeatures.cpp b/src/buntime/jsc/interop/CPUFeatures.cpp similarity index 100% rename from src/bun.js/bindings/CPUFeatures.cpp rename to src/buntime/jsc/interop/CPUFeatures.cpp diff --git a/src/bun.js/bindings/CPUFeatures.zig b/src/buntime/jsc/interop/CPUFeatures.zig similarity index 100% rename from src/bun.js/bindings/CPUFeatures.zig rename to src/buntime/jsc/interop/CPUFeatures.zig diff --git a/src/bun.js/bindings/webcore/CallbackResult.h b/src/buntime/jsc/interop/CallbackResult.h similarity index 100% rename from src/bun.js/bindings/webcore/CallbackResult.h rename to src/buntime/jsc/interop/CallbackResult.h diff --git a/src/bun.js/bindings/CatchScopeBinding.cpp b/src/buntime/jsc/interop/CatchScopeBinding.cpp similarity index 100% rename from src/bun.js/bindings/CatchScopeBinding.cpp rename to src/buntime/jsc/interop/CatchScopeBinding.cpp diff --git a/src/bun.js/bindings/webcore/CommonAtomStrings.cpp b/src/buntime/jsc/interop/CommonAtomStrings.cpp similarity index 100% rename from src/bun.js/bindings/webcore/CommonAtomStrings.cpp rename to src/buntime/jsc/interop/CommonAtomStrings.cpp diff --git a/src/bun.js/bindings/webcore/CommonAtomStrings.h b/src/buntime/jsc/interop/CommonAtomStrings.h similarity index 100% rename from src/bun.js/bindings/webcore/CommonAtomStrings.h rename to src/buntime/jsc/interop/CommonAtomStrings.h diff --git a/src/bun.js/bindings/webcore/ContextDestructionObserver.cpp b/src/buntime/jsc/interop/ContextDestructionObserver.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ContextDestructionObserver.cpp rename to src/buntime/jsc/interop/ContextDestructionObserver.cpp diff --git a/src/bun.js/bindings/webcore/ContextDestructionObserver.h b/src/buntime/jsc/interop/ContextDestructionObserver.h similarity index 100% rename from src/bun.js/bindings/webcore/ContextDestructionObserver.h rename to src/buntime/jsc/interop/ContextDestructionObserver.h diff --git a/src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h b/src/buntime/jsc/interop/DOMClientIsoSubspaces.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h rename to src/buntime/jsc/interop/DOMClientIsoSubspaces.h diff --git a/src/bun.js/bindings/webcore/DOMConstructors.h b/src/buntime/jsc/interop/DOMConstructors.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMConstructors.h rename to src/buntime/jsc/interop/DOMConstructors.h diff --git a/src/bun.js/bindings/webcore/DOMHighResTimeStamp.h b/src/buntime/jsc/interop/DOMHighResTimeStamp.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMHighResTimeStamp.h rename to src/buntime/jsc/interop/DOMHighResTimeStamp.h diff --git a/src/bun.js/bindings/webcore/DOMIsoSubspaces.h b/src/buntime/jsc/interop/DOMIsoSubspaces.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMIsoSubspaces.h rename to src/buntime/jsc/interop/DOMIsoSubspaces.h diff --git a/src/bun.js/bindings/webcore/DOMJITCheckDOM.h b/src/buntime/jsc/interop/DOMJITCheckDOM.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITCheckDOM.h rename to src/buntime/jsc/interop/DOMJITCheckDOM.h diff --git a/src/bun.js/bindings/webcore/DOMJITHelpers.cpp b/src/buntime/jsc/interop/DOMJITHelpers.cpp similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITHelpers.cpp rename to src/buntime/jsc/interop/DOMJITHelpers.cpp diff --git a/src/bun.js/bindings/webcore/DOMJITHelpers.h b/src/buntime/jsc/interop/DOMJITHelpers.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITHelpers.h rename to src/buntime/jsc/interop/DOMJITHelpers.h diff --git a/src/bun.js/bindings/webcore/DOMJITIDLConvert.h b/src/buntime/jsc/interop/DOMJITIDLConvert.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITIDLConvert.h rename to src/buntime/jsc/interop/DOMJITIDLConvert.h diff --git a/src/bun.js/bindings/webcore/DOMJITIDLType.h b/src/buntime/jsc/interop/DOMJITIDLType.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITIDLType.h rename to src/buntime/jsc/interop/DOMJITIDLType.h diff --git a/src/bun.js/bindings/webcore/DOMJITIDLTypeFilter.h b/src/buntime/jsc/interop/DOMJITIDLTypeFilter.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMJITIDLTypeFilter.h rename to src/buntime/jsc/interop/DOMJITIDLTypeFilter.h diff --git a/src/bun.js/bindings/webcore/DOMPromiseProxy.h b/src/buntime/jsc/interop/DOMPromiseProxy.h similarity index 100% rename from src/bun.js/bindings/webcore/DOMPromiseProxy.h rename to src/buntime/jsc/interop/DOMPromiseProxy.h diff --git a/src/bun.js/bindings/DeleteCallbackDataTask.h b/src/buntime/jsc/interop/DeleteCallbackDataTask.h similarity index 100% rename from src/bun.js/bindings/DeleteCallbackDataTask.h rename to src/buntime/jsc/interop/DeleteCallbackDataTask.h diff --git a/src/bun.js/bindings/Exception.h b/src/buntime/jsc/interop/Exception.h similarity index 100% rename from src/bun.js/bindings/Exception.h rename to src/buntime/jsc/interop/Exception.h diff --git a/src/bun.js/bindings/Exception.zig b/src/buntime/jsc/interop/Exception.zig similarity index 88% rename from src/bun.js/bindings/Exception.zig rename to src/buntime/jsc/interop/Exception.zig index 7b45f2ff7c6a..e26b48a68c56 100644 --- a/src/bun.js/bindings/Exception.zig +++ b/src/buntime/jsc/interop/Exception.zig @@ -13,7 +13,7 @@ pub const Exception = opaque { }; const bun = @import("bun"); -const ZigStackTrace = @import("./ZigStackTrace.zig").ZigStackTrace; +const ZigStackTrace = @import("../../api/error/ZigStackTrace.zig").ZigStackTrace; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/bun.js/bindings/ExceptionCode.h b/src/buntime/jsc/interop/ExceptionCode.h similarity index 98% rename from src/bun.js/bindings/ExceptionCode.h rename to src/buntime/jsc/interop/ExceptionCode.h index 87a774118639..0167e0a10912 100644 --- a/src/bun.js/bindings/ExceptionCode.h +++ b/src/buntime/jsc/interop/ExceptionCode.h @@ -24,7 +24,7 @@ namespace WebCore { -// keep in sync with DOMExceptionCode in src/bun.js/bindings/JSErrorCode.Zig +// keep in sync with DOMExceptionCode in src/buntime/bindings/JSErrorCode.Zig enum ExceptionCode : uint8_t { // DOMException error names (https://webidl.spec.whatwg.org/#idl-DOMException-error-names). // Those need to be kept in sync with the array in DOMException.cpp. diff --git a/src/bun.js/bindings/ExceptionOr.h b/src/buntime/jsc/interop/ExceptionOr.h similarity index 100% rename from src/bun.js/bindings/ExceptionOr.h rename to src/buntime/jsc/interop/ExceptionOr.h diff --git a/src/bun.js/bindings/webcore/ExtendedDOMClientIsoSubspaces.h b/src/buntime/jsc/interop/ExtendedDOMClientIsoSubspaces.h similarity index 100% rename from src/bun.js/bindings/webcore/ExtendedDOMClientIsoSubspaces.h rename to src/buntime/jsc/interop/ExtendedDOMClientIsoSubspaces.h diff --git a/src/bun.js/bindings/webcore/ExtendedDOMIsoSubspaces.h b/src/buntime/jsc/interop/ExtendedDOMIsoSubspaces.h similarity index 100% rename from src/bun.js/bindings/webcore/ExtendedDOMIsoSubspaces.h rename to src/buntime/jsc/interop/ExtendedDOMIsoSubspaces.h diff --git a/src/bun.js/bindings/IDLTypes.h b/src/buntime/jsc/interop/IDLTypes.h similarity index 100% rename from src/bun.js/bindings/IDLTypes.h rename to src/buntime/jsc/interop/IDLTypes.h diff --git a/src/bun.js/bindings/JSBigIntBinding.cpp b/src/buntime/jsc/interop/JSBigIntBinding.cpp similarity index 100% rename from src/bun.js/bindings/JSBigIntBinding.cpp rename to src/buntime/jsc/interop/JSBigIntBinding.cpp diff --git a/src/bun.js/bindings/JSCInlines.h b/src/buntime/jsc/interop/JSCInlines.h similarity index 100% rename from src/bun.js/bindings/JSCInlines.h rename to src/buntime/jsc/interop/JSCInlines.h diff --git a/src/bun.js/bindings/JSCTaskScheduler.cpp b/src/buntime/jsc/interop/JSCTaskScheduler.cpp similarity index 100% rename from src/bun.js/bindings/JSCTaskScheduler.cpp rename to src/buntime/jsc/interop/JSCTaskScheduler.cpp diff --git a/src/bun.js/bindings/JSCTaskScheduler.h b/src/buntime/jsc/interop/JSCTaskScheduler.h similarity index 100% rename from src/bun.js/bindings/JSCTaskScheduler.h rename to src/buntime/jsc/interop/JSCTaskScheduler.h diff --git a/src/bun.js/bindings/webcore/JSCallbackData.cpp b/src/buntime/jsc/interop/JSCallbackData.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSCallbackData.cpp rename to src/buntime/jsc/interop/JSCallbackData.cpp diff --git a/src/bun.js/bindings/webcore/JSCallbackData.h b/src/buntime/jsc/interop/JSCallbackData.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCallbackData.h rename to src/buntime/jsc/interop/JSCallbackData.h diff --git a/src/bun.js/bindings/webcore/JSDOMAttribute.h b/src/buntime/jsc/interop/JSDOMAttribute.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMAttribute.h rename to src/buntime/jsc/interop/JSDOMAttribute.h diff --git a/src/bun.js/bindings/webcore/JSDOMBinding.h b/src/buntime/jsc/interop/JSDOMBinding-webcore.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBinding.h rename to src/buntime/jsc/interop/JSDOMBinding-webcore.h diff --git a/src/bun.js/bindings/JSDOMBinding.h b/src/buntime/jsc/interop/JSDOMBinding.h similarity index 100% rename from src/bun.js/bindings/JSDOMBinding.h rename to src/buntime/jsc/interop/JSDOMBinding.h diff --git a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp b/src/buntime/jsc/interop/JSDOMBindingInternalsBuiltins.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp rename to src/buntime/jsc/interop/JSDOMBindingInternalsBuiltins.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h b/src/buntime/jsc/interop/JSDOMBindingInternalsBuiltins.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.h rename to src/buntime/jsc/interop/JSDOMBindingInternalsBuiltins.h diff --git a/src/bun.js/bindings/webcore/JSDOMBuiltinConstructor.h b/src/buntime/jsc/interop/JSDOMBuiltinConstructor.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBuiltinConstructor.h rename to src/buntime/jsc/interop/JSDOMBuiltinConstructor.h diff --git a/src/bun.js/bindings/webcore/JSDOMBuiltinConstructorBase.cpp b/src/buntime/jsc/interop/JSDOMBuiltinConstructorBase.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBuiltinConstructorBase.cpp rename to src/buntime/jsc/interop/JSDOMBuiltinConstructorBase.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMBuiltinConstructorBase.h b/src/buntime/jsc/interop/JSDOMBuiltinConstructorBase.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMBuiltinConstructorBase.h rename to src/buntime/jsc/interop/JSDOMBuiltinConstructorBase.h diff --git a/src/bun.js/bindings/webcore/JSDOMCastThisValue.h b/src/buntime/jsc/interop/JSDOMCastThisValue.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMCastThisValue.h rename to src/buntime/jsc/interop/JSDOMCastThisValue.h diff --git a/src/bun.js/bindings/webcore/JSDOMConstructor.h b/src/buntime/jsc/interop/JSDOMConstructor.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructor.h rename to src/buntime/jsc/interop/JSDOMConstructor.h diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorBase.cpp b/src/buntime/jsc/interop/JSDOMConstructorBase.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructorBase.cpp rename to src/buntime/jsc/interop/JSDOMConstructorBase.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorBase.h b/src/buntime/jsc/interop/JSDOMConstructorBase.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructorBase.h rename to src/buntime/jsc/interop/JSDOMConstructorBase.h diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorCallable.h b/src/buntime/jsc/interop/JSDOMConstructorCallable.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructorCallable.h rename to src/buntime/jsc/interop/JSDOMConstructorCallable.h diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorNotCallable.h b/src/buntime/jsc/interop/JSDOMConstructorNotCallable.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructorNotCallable.h rename to src/buntime/jsc/interop/JSDOMConstructorNotCallable.h diff --git a/src/bun.js/bindings/webcore/JSDOMConstructorNotConstructable.h b/src/buntime/jsc/interop/JSDOMConstructorNotConstructable.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConstructorNotConstructable.h rename to src/buntime/jsc/interop/JSDOMConstructorNotConstructable.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvert.h b/src/buntime/jsc/interop/JSDOMConvert.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvert.h rename to src/buntime/jsc/interop/JSDOMConvert.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertAny.h b/src/buntime/jsc/interop/JSDOMConvertAny.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertAny.h rename to src/buntime/jsc/interop/JSDOMConvertAny.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertBase.h b/src/buntime/jsc/interop/JSDOMConvertBase.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertBase.h rename to src/buntime/jsc/interop/JSDOMConvertBase.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertBoolean.h b/src/buntime/jsc/interop/JSDOMConvertBoolean.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertBoolean.h rename to src/buntime/jsc/interop/JSDOMConvertBoolean.h diff --git a/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h b/src/buntime/jsc/interop/JSDOMConvertBufferSource+JSBuffer.h similarity index 100% rename from src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h rename to src/buntime/jsc/interop/JSDOMConvertBufferSource+JSBuffer.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h b/src/buntime/jsc/interop/JSDOMConvertBufferSource.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h rename to src/buntime/jsc/interop/JSDOMConvertBufferSource.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertCallbacks.h b/src/buntime/jsc/interop/JSDOMConvertCallbacks.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertCallbacks.h rename to src/buntime/jsc/interop/JSDOMConvertCallbacks.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertDate.cpp b/src/buntime/jsc/interop/JSDOMConvertDate.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertDate.cpp rename to src/buntime/jsc/interop/JSDOMConvertDate.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMConvertDate.h b/src/buntime/jsc/interop/JSDOMConvertDate.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertDate.h rename to src/buntime/jsc/interop/JSDOMConvertDate.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertDictionary.h b/src/buntime/jsc/interop/JSDOMConvertDictionary.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertDictionary.h rename to src/buntime/jsc/interop/JSDOMConvertDictionary.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h b/src/buntime/jsc/interop/JSDOMConvertEnumeration.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h rename to src/buntime/jsc/interop/JSDOMConvertEnumeration.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertInterface.h b/src/buntime/jsc/interop/JSDOMConvertInterface.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertInterface.h rename to src/buntime/jsc/interop/JSDOMConvertInterface.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertJSON.h b/src/buntime/jsc/interop/JSDOMConvertJSON.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertJSON.h rename to src/buntime/jsc/interop/JSDOMConvertJSON.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertNull.h b/src/buntime/jsc/interop/JSDOMConvertNull.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertNull.h rename to src/buntime/jsc/interop/JSDOMConvertNull.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertNullable.h b/src/buntime/jsc/interop/JSDOMConvertNullable.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertNullable.h rename to src/buntime/jsc/interop/JSDOMConvertNullable.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp b/src/buntime/jsc/interop/JSDOMConvertNumbers.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp rename to src/buntime/jsc/interop/JSDOMConvertNumbers.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMConvertNumbers.h b/src/buntime/jsc/interop/JSDOMConvertNumbers.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertNumbers.h rename to src/buntime/jsc/interop/JSDOMConvertNumbers.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertObject.h b/src/buntime/jsc/interop/JSDOMConvertObject.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertObject.h rename to src/buntime/jsc/interop/JSDOMConvertObject.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertOptional.h b/src/buntime/jsc/interop/JSDOMConvertOptional.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertOptional.h rename to src/buntime/jsc/interop/JSDOMConvertOptional.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertPromise.h b/src/buntime/jsc/interop/JSDOMConvertPromise.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertPromise.h rename to src/buntime/jsc/interop/JSDOMConvertPromise.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertRecord.h b/src/buntime/jsc/interop/JSDOMConvertRecord.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertRecord.h rename to src/buntime/jsc/interop/JSDOMConvertRecord.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h b/src/buntime/jsc/interop/JSDOMConvertScheduledAction.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h rename to src/buntime/jsc/interop/JSDOMConvertScheduledAction.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertSequences.h b/src/buntime/jsc/interop/JSDOMConvertSequences.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertSequences.h rename to src/buntime/jsc/interop/JSDOMConvertSequences.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp b/src/buntime/jsc/interop/JSDOMConvertStrings.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp rename to src/buntime/jsc/interop/JSDOMConvertStrings.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMConvertStrings.h b/src/buntime/jsc/interop/JSDOMConvertStrings.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertStrings.h rename to src/buntime/jsc/interop/JSDOMConvertStrings.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertUnion.h b/src/buntime/jsc/interop/JSDOMConvertUnion.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertUnion.h rename to src/buntime/jsc/interop/JSDOMConvertUnion.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertVariadic.h b/src/buntime/jsc/interop/JSDOMConvertVariadic.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertVariadic.h rename to src/buntime/jsc/interop/JSDOMConvertVariadic.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertWebGL.cpp b/src/buntime/jsc/interop/JSDOMConvertWebGL.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertWebGL.cpp rename to src/buntime/jsc/interop/JSDOMConvertWebGL.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMConvertWebGL.h b/src/buntime/jsc/interop/JSDOMConvertWebGL.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertWebGL.h rename to src/buntime/jsc/interop/JSDOMConvertWebGL.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertXPathNSResolver.h b/src/buntime/jsc/interop/JSDOMConvertXPathNSResolver.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertXPathNSResolver.h rename to src/buntime/jsc/interop/JSDOMConvertXPathNSResolver.h diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.cpp b/src/buntime/jsc/interop/JSDOMExceptionHandling.cpp similarity index 100% rename from src/bun.js/bindings/JSDOMExceptionHandling.cpp rename to src/buntime/jsc/interop/JSDOMExceptionHandling.cpp diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.h b/src/buntime/jsc/interop/JSDOMExceptionHandling.h similarity index 100% rename from src/bun.js/bindings/JSDOMExceptionHandling.h rename to src/buntime/jsc/interop/JSDOMExceptionHandling.h diff --git a/src/bun.js/bindings/webcore/JSDOMGlobalObjectInlines.h b/src/buntime/jsc/interop/JSDOMGlobalObjectInlines.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMGlobalObjectInlines.h rename to src/buntime/jsc/interop/JSDOMGlobalObjectInlines.h diff --git a/src/bun.js/bindings/webcore/JSDOMGuardedObject.cpp b/src/buntime/jsc/interop/JSDOMGuardedObject.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMGuardedObject.cpp rename to src/buntime/jsc/interop/JSDOMGuardedObject.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMGuardedObject.h b/src/buntime/jsc/interop/JSDOMGuardedObject.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMGuardedObject.h rename to src/buntime/jsc/interop/JSDOMGuardedObject.h diff --git a/src/bun.js/bindings/webcore/JSDOMIterator.cpp b/src/buntime/jsc/interop/JSDOMIterator.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMIterator.cpp rename to src/buntime/jsc/interop/JSDOMIterator.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMIterator.h b/src/buntime/jsc/interop/JSDOMIterator.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMIterator.h rename to src/buntime/jsc/interop/JSDOMIterator.h diff --git a/src/bun.js/bindings/webcore/JSDOMOperation.cpp b/src/buntime/jsc/interop/JSDOMOperation.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMOperation.cpp rename to src/buntime/jsc/interop/JSDOMOperation.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMOperation.h b/src/buntime/jsc/interop/JSDOMOperation.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMOperation.h rename to src/buntime/jsc/interop/JSDOMOperation.h diff --git a/src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h b/src/buntime/jsc/interop/JSDOMOperationReturningPromise.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h rename to src/buntime/jsc/interop/JSDOMOperationReturningPromise.h diff --git a/src/bun.js/bindings/webcore/JSDOMPromise.cpp b/src/buntime/jsc/interop/JSDOMPromise.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMPromise.cpp rename to src/buntime/jsc/interop/JSDOMPromise.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMPromise.h b/src/buntime/jsc/interop/JSDOMPromise.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMPromise.h rename to src/buntime/jsc/interop/JSDOMPromise.h diff --git a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp b/src/buntime/jsc/interop/JSDOMPromiseDeferred.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp rename to src/buntime/jsc/interop/JSDOMPromiseDeferred.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h b/src/buntime/jsc/interop/JSDOMPromiseDeferred.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h rename to src/buntime/jsc/interop/JSDOMPromiseDeferred.h diff --git a/src/bun.js/bindings/webcore/JSDOMWindow.h b/src/buntime/jsc/interop/JSDOMWindow.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMWindow.h rename to src/buntime/jsc/interop/JSDOMWindow.h diff --git a/src/bun.js/bindings/JSDOMWrapper.cpp b/src/buntime/jsc/interop/JSDOMWrapper.cpp similarity index 100% rename from src/bun.js/bindings/JSDOMWrapper.cpp rename to src/buntime/jsc/interop/JSDOMWrapper.cpp diff --git a/src/bun.js/bindings/JSDOMWrapper.h b/src/buntime/jsc/interop/JSDOMWrapper.h similarity index 100% rename from src/bun.js/bindings/JSDOMWrapper.h rename to src/buntime/jsc/interop/JSDOMWrapper.h diff --git a/src/bun.js/bindings/JSDOMWrapperCache.cpp b/src/buntime/jsc/interop/JSDOMWrapperCache.cpp similarity index 100% rename from src/bun.js/bindings/JSDOMWrapperCache.cpp rename to src/buntime/jsc/interop/JSDOMWrapperCache.cpp diff --git a/src/bun.js/bindings/JSDOMWrapperCache.h b/src/buntime/jsc/interop/JSDOMWrapperCache.h similarity index 100% rename from src/bun.js/bindings/JSDOMWrapperCache.h rename to src/buntime/jsc/interop/JSDOMWrapperCache.h diff --git a/src/bun.js/bindings/JSPropertyIterator.cpp b/src/buntime/jsc/interop/JSPropertyIterator.cpp similarity index 100% rename from src/bun.js/bindings/JSPropertyIterator.cpp rename to src/buntime/jsc/interop/JSPropertyIterator.cpp diff --git a/src/bun.js/bindings/JSUint8Array.zig b/src/buntime/jsc/interop/JSUint8Array.zig similarity index 100% rename from src/bun.js/bindings/JSUint8Array.zig rename to src/buntime/jsc/interop/JSUint8Array.zig diff --git a/src/bun.js/bindings/webcore/JSValueInWrappedObject.h b/src/buntime/jsc/interop/JSValueInWrappedObject.h similarity index 100% rename from src/bun.js/bindings/webcore/JSValueInWrappedObject.h rename to src/buntime/jsc/interop/JSValueInWrappedObject.h diff --git a/src/bun.js/bindings/webcore/JSWindowProxy.h b/src/buntime/jsc/interop/JSWindowProxy.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWindowProxy.h rename to src/buntime/jsc/interop/JSWindowProxy.h diff --git a/src/bun.js/bindings/JSWrappingFunction.cpp b/src/buntime/jsc/interop/JSWrappingFunction.cpp similarity index 100% rename from src/bun.js/bindings/JSWrappingFunction.cpp rename to src/buntime/jsc/interop/JSWrappingFunction.cpp diff --git a/src/bun.js/bindings/JSWrappingFunction.h b/src/buntime/jsc/interop/JSWrappingFunction.h similarity index 100% rename from src/bun.js/bindings/JSWrappingFunction.h rename to src/buntime/jsc/interop/JSWrappingFunction.h diff --git a/src/bun.js/bindings/MarkedArgumentBufferBinding.cpp b/src/buntime/jsc/interop/MarkedArgumentBufferBinding.cpp similarity index 100% rename from src/bun.js/bindings/MarkedArgumentBufferBinding.cpp rename to src/buntime/jsc/interop/MarkedArgumentBufferBinding.cpp diff --git a/src/bun.js/bindings/webcore/Node.h b/src/buntime/jsc/interop/Node.h similarity index 100% rename from src/bun.js/bindings/webcore/Node.h rename to src/buntime/jsc/interop/Node.h diff --git a/src/bun.js/bindings/ObjectBindings.cpp b/src/buntime/jsc/interop/ObjectBindings.cpp similarity index 100% rename from src/bun.js/bindings/ObjectBindings.cpp rename to src/buntime/jsc/interop/ObjectBindings.cpp diff --git a/src/bun.js/bindings/ObjectBindings.h b/src/buntime/jsc/interop/ObjectBindings.h similarity index 100% rename from src/bun.js/bindings/ObjectBindings.h rename to src/buntime/jsc/interop/ObjectBindings.h diff --git a/src/bun.js/bindings/webcore/PortIdentifier.h b/src/buntime/jsc/interop/PortIdentifier.h similarity index 100% rename from src/bun.js/bindings/webcore/PortIdentifier.h rename to src/buntime/jsc/interop/PortIdentifier.h diff --git a/src/bun.js/bindings/webcore/ScriptWrappable.h b/src/buntime/jsc/interop/ScriptWrappable.h similarity index 100% rename from src/bun.js/bindings/webcore/ScriptWrappable.h rename to src/buntime/jsc/interop/ScriptWrappable.h diff --git a/src/bun.js/bindings/webcore/ScriptWrappableInlines.h b/src/buntime/jsc/interop/ScriptWrappableInlines.h similarity index 100% rename from src/bun.js/bindings/webcore/ScriptWrappableInlines.h rename to src/buntime/jsc/interop/ScriptWrappableInlines.h diff --git a/src/bun.js/bindings/StringBuilder.zig b/src/buntime/jsc/interop/StringBuilder.zig similarity index 100% rename from src/bun.js/bindings/StringBuilder.zig rename to src/buntime/jsc/interop/StringBuilder.zig diff --git a/src/bun.js/bindings/webcore/TaskSource.h b/src/buntime/jsc/interop/TaskSource.h similarity index 100% rename from src/bun.js/bindings/webcore/TaskSource.h rename to src/buntime/jsc/interop/TaskSource.h diff --git a/src/bun.js/bindings/Uint8Array.cpp b/src/buntime/jsc/interop/Uint8Array.cpp similarity index 100% rename from src/bun.js/bindings/Uint8Array.cpp rename to src/buntime/jsc/interop/Uint8Array.cpp diff --git a/src/bun.js/bindings/WTF.zig b/src/buntime/jsc/interop/WTF.zig similarity index 100% rename from src/bun.js/bindings/WTF.zig rename to src/buntime/jsc/interop/WTF.zig diff --git a/src/bun.js/bindings/webcore/WebCoreJSClientData.h b/src/buntime/jsc/interop/WebCoreJSClientData.h similarity index 100% rename from src/bun.js/bindings/webcore/WebCoreJSClientData.h rename to src/buntime/jsc/interop/WebCoreJSClientData.h diff --git a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp b/src/buntime/jsc/interop/WebCoreTypedArrayController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp rename to src/buntime/jsc/interop/WebCoreTypedArrayController.cpp diff --git a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.h b/src/buntime/jsc/interop/WebCoreTypedArrayController.h similarity index 100% rename from src/bun.js/bindings/webcore/WebCoreTypedArrayController.h rename to src/buntime/jsc/interop/WebCoreTypedArrayController.h diff --git a/src/bun.js/bindings/ZigString.zig b/src/buntime/jsc/interop/ZigString.zig similarity index 100% rename from src/bun.js/bindings/ZigString.zig rename to src/buntime/jsc/interop/ZigString.zig diff --git a/src/bun.js/jsc/array_buffer.zig b/src/buntime/jsc/interop/array_buffer.zig similarity index 100% rename from src/bun.js/jsc/array_buffer.zig rename to src/buntime/jsc/interop/array_buffer.zig diff --git a/src/bun.js/bindgen.zig b/src/buntime/jsc/interop/bindgen.zig similarity index 100% rename from src/bun.js/bindgen.zig rename to src/buntime/jsc/interop/bindgen.zig diff --git a/src/bun.js/bindgen_test.bind.ts b/src/buntime/jsc/interop/bindgen_test.bind.ts similarity index 100% rename from src/bun.js/bindgen_test.bind.ts rename to src/buntime/jsc/interop/bindgen_test.bind.ts diff --git a/src/bun.js/bindgen_test.zig b/src/buntime/jsc/interop/bindgen_test.zig similarity index 100% rename from src/bun.js/bindgen_test.zig rename to src/buntime/jsc/interop/bindgen_test.zig diff --git a/src/bun.js/bindings/bindings.cpp b/src/buntime/jsc/interop/bindings.cpp similarity index 99% rename from src/bun.js/bindings/bindings.cpp rename to src/buntime/jsc/interop/bindings.cpp index 3a4130c9838b..615405c125d1 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/buntime/jsc/interop/bindings.cpp @@ -124,7 +124,7 @@ #include "JavaScriptCore/DateInstance.h" #include "JavaScriptCore/RegExpObject.h" #include "JavaScriptCore/PropertyNameArray.h" -#include "webcore/JSAbortSignal.h" +#include "JSAbortSignal.h" #include "JSAbortAlgorithm.h" #include "DOMFormData.h" @@ -4811,7 +4811,7 @@ JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObj return JSC::JSValue::encode(value); } -// This enum must match the zig enum in src/bun.js/bindings/JSValue.zig JSValue.BuiltinName +// This enum must match the zig enum in src/buntime/bindings/JSValue.zig JSValue.BuiltinName enum class BuiltinNamesMap : uint8_t { method, headers, diff --git a/src/bun.js/bindings/c-bindings.cpp b/src/buntime/jsc/interop/c-bindings.cpp similarity index 100% rename from src/bun.js/bindings/c-bindings.cpp rename to src/buntime/jsc/interop/c-bindings.cpp diff --git a/src/bun.js/bindings/webcore/config.h b/src/buntime/jsc/interop/config.h similarity index 100% rename from src/bun.js/bindings/webcore/config.h rename to src/buntime/jsc/interop/config.h diff --git a/src/bun.js/bindings/coroutine.cpp b/src/buntime/jsc/interop/coroutine.cpp similarity index 100% rename from src/bun.js/bindings/coroutine.cpp rename to src/buntime/jsc/interop/coroutine.cpp diff --git a/src/bun.js/jsc/dom_call.zig b/src/buntime/jsc/interop/dom_call.zig similarity index 100% rename from src/bun.js/jsc/dom_call.zig rename to src/buntime/jsc/interop/dom_call.zig diff --git a/src/bun.js/bindings/headers-cpp.h b/src/buntime/jsc/interop/headers-cpp.h similarity index 99% rename from src/bun.js/bindings/headers-cpp.h rename to src/buntime/jsc/interop/headers-cpp.h index 50e4c3d7c489..5d0aec64d1c8 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/buntime/jsc/interop/headers-cpp.h @@ -64,7 +64,7 @@ extern "C" const size_t JSC__JSModuleLoader_object_align_ = alignof(JSC::JSModul #ifndef INCLUDED_webcore_AbortSignal_h #define INCLUDED_webcore_AbortSignal_h -#include "webcore/AbortSignal.h" +#include "AbortSignal.h" #endif extern "C" const size_t WebCore__AbortSignal_object_size_ = sizeof(WebCore::AbortSignal); diff --git a/src/bun.js/bindings/headers-handwritten.h b/src/buntime/jsc/interop/headers-handwritten.h similarity index 100% rename from src/bun.js/bindings/headers-handwritten.h rename to src/buntime/jsc/interop/headers-handwritten.h diff --git a/src/bun.js/bindings/headers.h b/src/buntime/jsc/interop/headers.h similarity index 99% rename from src/bun.js/bindings/headers.h rename to src/buntime/jsc/interop/headers.h index 895bb4f07864..0ea85665d607 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/buntime/jsc/interop/headers.h @@ -20,7 +20,7 @@ #include "root.h" #include #include "headers-handwritten.h" -#include "webcore/WebSocketDeflate.h" +#include "WebSocketDeflate.h" namespace JSC { class JSGlobalObject; diff --git a/src/bun.js/bindings/helpers.cpp b/src/buntime/jsc/interop/helpers.cpp similarity index 100% rename from src/bun.js/bindings/helpers.cpp rename to src/buntime/jsc/interop/helpers.cpp diff --git a/src/bun.js/bindings/helpers.h b/src/buntime/jsc/interop/helpers.h similarity index 100% rename from src/bun.js/bindings/helpers.h rename to src/buntime/jsc/interop/helpers.h diff --git a/src/bun.js/jsc/host_fn.zig b/src/buntime/jsc/interop/host_fn.zig similarity index 100% rename from src/bun.js/jsc/host_fn.zig rename to src/buntime/jsc/interop/host_fn.zig diff --git a/src/bun.js/bindings/inlines.cpp b/src/buntime/jsc/interop/inlines.cpp similarity index 100% rename from src/bun.js/bindings/inlines.cpp rename to src/buntime/jsc/interop/inlines.cpp diff --git a/src/bun.js/javascript_core_c_api.zig b/src/buntime/jsc/interop/javascript_core_c_api.zig similarity index 100% rename from src/bun.js/javascript_core_c_api.zig rename to src/buntime/jsc/interop/javascript_core_c_api.zig diff --git a/src/bun.js/bindings/objects.cpp b/src/buntime/jsc/interop/objects.cpp similarity index 100% rename from src/bun.js/bindings/objects.cpp rename to src/buntime/jsc/interop/objects.cpp diff --git a/src/bun.js/bindings/objects.h b/src/buntime/jsc/interop/objects.h similarity index 100% rename from src/bun.js/bindings/objects.h rename to src/buntime/jsc/interop/objects.h diff --git a/src/bun.js/bindings/root.h b/src/buntime/jsc/interop/root.h similarity index 100% rename from src/bun.js/bindings/root.h rename to src/buntime/jsc/interop/root.h diff --git a/src/bun.js/bindings/sizes.zig b/src/buntime/jsc/interop/sizes.zig similarity index 100% rename from src/bun.js/bindings/sizes.zig rename to src/buntime/jsc/interop/sizes.zig diff --git a/src/bun.js/bindings/static_export.zig b/src/buntime/jsc/interop/static_export.zig similarity index 100% rename from src/bun.js/bindings/static_export.zig rename to src/buntime/jsc/interop/static_export.zig diff --git a/src/bun.js/bindings/workaround-missing-symbols.cpp b/src/buntime/jsc/interop/workaround-missing-symbols.cpp similarity index 100% rename from src/bun.js/bindings/workaround-missing-symbols.cpp rename to src/buntime/jsc/interop/workaround-missing-symbols.cpp diff --git a/src/bun.js/bindings/wtf-bindings.cpp b/src/buntime/jsc/interop/wtf-bindings.cpp similarity index 100% rename from src/bun.js/bindings/wtf-bindings.cpp rename to src/buntime/jsc/interop/wtf-bindings.cpp diff --git a/src/bun.js/bindings/wtf-bindings.h b/src/buntime/jsc/interop/wtf-bindings.h similarity index 100% rename from src/bun.js/bindings/wtf-bindings.h rename to src/buntime/jsc/interop/wtf-bindings.h diff --git a/src/bun.js/bindings/AnyPromise.zig b/src/buntime/jsc/types/AnyPromise.zig similarity index 100% rename from src/bun.js/bindings/AnyPromise.zig rename to src/buntime/jsc/types/AnyPromise.zig diff --git a/src/bun.js/bindings/CallFrame.zig b/src/buntime/jsc/types/CallFrame.zig similarity index 100% rename from src/bun.js/bindings/CallFrame.zig rename to src/buntime/jsc/types/CallFrame.zig diff --git a/src/bun.js/bindings/CatchScope.zig b/src/buntime/jsc/types/CatchScope.zig similarity index 100% rename from src/bun.js/bindings/CatchScope.zig rename to src/buntime/jsc/types/CatchScope.zig diff --git a/src/bun.js/bindings/CommonStrings.zig b/src/buntime/jsc/types/CommonStrings.zig similarity index 100% rename from src/bun.js/bindings/CommonStrings.zig rename to src/buntime/jsc/types/CommonStrings.zig diff --git a/src/bun.js/bindings/CustomGetterSetter.zig b/src/buntime/jsc/types/CustomGetterSetter.zig similarity index 100% rename from src/bun.js/bindings/CustomGetterSetter.zig rename to src/buntime/jsc/types/CustomGetterSetter.zig diff --git a/src/bun.js/bindings/DecodedJSValue.zig b/src/buntime/jsc/types/DecodedJSValue.zig similarity index 96% rename from src/bun.js/bindings/DecodedJSValue.zig rename to src/buntime/jsc/types/DecodedJSValue.zig index e22910254908..334f7e34c6aa 100644 --- a/src/bun.js/bindings/DecodedJSValue.zig +++ b/src/buntime/jsc/types/DecodedJSValue.zig @@ -45,5 +45,5 @@ comptime { } const bun = @import("bun"); -const ffi = @import("./FFI.zig"); +const ffi = @import("../../api/ffi/FFI.zig"); const jsc = bun.bun_js.jsc; diff --git a/src/bun.js/bindings/GetterSetter.zig b/src/buntime/jsc/types/GetterSetter.zig similarity index 100% rename from src/bun.js/bindings/GetterSetter.zig rename to src/buntime/jsc/types/GetterSetter.zig diff --git a/src/bun.js/bindings/JSArray.zig b/src/buntime/jsc/types/JSArray.zig similarity index 100% rename from src/bun.js/bindings/JSArray.zig rename to src/buntime/jsc/types/JSArray.zig diff --git a/src/bun.js/bindings/JSArrayIterator.zig b/src/buntime/jsc/types/JSArrayIterator.zig similarity index 100% rename from src/bun.js/bindings/JSArrayIterator.zig rename to src/buntime/jsc/types/JSArrayIterator.zig diff --git a/src/bun.js/bindings/JSBigInt.zig b/src/buntime/jsc/types/JSBigInt.zig similarity index 100% rename from src/bun.js/bindings/JSBigInt.zig rename to src/buntime/jsc/types/JSBigInt.zig diff --git a/src/bun.js/bindings/JSCell.zig b/src/buntime/jsc/types/JSCell.zig similarity index 100% rename from src/bun.js/bindings/JSCell.zig rename to src/buntime/jsc/types/JSCell.zig diff --git a/src/bun.js/bindings/JSFunction.zig b/src/buntime/jsc/types/JSFunction.zig similarity index 100% rename from src/bun.js/bindings/JSFunction.zig rename to src/buntime/jsc/types/JSFunction.zig diff --git a/src/bun.js/bindings/JSGlobalObject.zig b/src/buntime/jsc/types/JSGlobalObject.zig similarity index 99% rename from src/bun.js/bindings/JSGlobalObject.zig rename to src/buntime/jsc/types/JSGlobalObject.zig index fa2a09201889..daf6ff948f73 100644 --- a/src/bun.js/bindings/JSGlobalObject.zig +++ b/src/buntime/jsc/types/JSGlobalObject.zig @@ -989,7 +989,7 @@ pub const JSGlobalObject = opaque { const string = []const u8; -const napi = @import("../../napi/napi.zig"); +const napi = @import("../../../napi/napi.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/bindings/JSInternalPromise.zig b/src/buntime/jsc/types/JSInternalPromise.zig similarity index 100% rename from src/bun.js/bindings/JSInternalPromise.zig rename to src/buntime/jsc/types/JSInternalPromise.zig diff --git a/src/bun.js/bindings/JSMap.zig b/src/buntime/jsc/types/JSMap.zig similarity index 100% rename from src/bun.js/bindings/JSMap.zig rename to src/buntime/jsc/types/JSMap.zig diff --git a/src/bun.js/bindings/JSObject.zig b/src/buntime/jsc/types/JSObject.zig similarity index 100% rename from src/bun.js/bindings/JSObject.zig rename to src/buntime/jsc/types/JSObject.zig diff --git a/src/bun.js/bindings/JSPromise.zig b/src/buntime/jsc/types/JSPromise.zig similarity index 100% rename from src/bun.js/bindings/JSPromise.zig rename to src/buntime/jsc/types/JSPromise.zig diff --git a/src/bun.js/bindings/JSPromiseRejectionOperation.zig b/src/buntime/jsc/types/JSPromiseRejectionOperation.zig similarity index 100% rename from src/bun.js/bindings/JSPromiseRejectionOperation.zig rename to src/buntime/jsc/types/JSPromiseRejectionOperation.zig diff --git a/src/bun.js/bindings/JSPropertyIterator.zig b/src/buntime/jsc/types/JSPropertyIterator.zig similarity index 100% rename from src/bun.js/bindings/JSPropertyIterator.zig rename to src/buntime/jsc/types/JSPropertyIterator.zig diff --git a/src/bun.js/bindings/JSRef.zig b/src/buntime/jsc/types/JSRef.zig similarity index 100% rename from src/bun.js/bindings/JSRef.zig rename to src/buntime/jsc/types/JSRef.zig diff --git a/src/bun.js/bindings/JSRuntimeType.zig b/src/buntime/jsc/types/JSRuntimeType.zig similarity index 100% rename from src/bun.js/bindings/JSRuntimeType.zig rename to src/buntime/jsc/types/JSRuntimeType.zig diff --git a/src/bun.js/bindings/JSString.zig b/src/buntime/jsc/types/JSString.zig similarity index 98% rename from src/bun.js/bindings/JSString.zig rename to src/buntime/jsc/types/JSString.zig index 695f7229b7da..37995010d584 100644 --- a/src/bun.js/bindings/JSString.zig +++ b/src/buntime/jsc/types/JSString.zig @@ -93,7 +93,7 @@ pub const JSString = opaque { const std = @import("std"); const JSObject = @import("./JSObject.zig").JSObject; -const ZigString = @import("./ZigString.zig").ZigString; +const ZigString = @import("../interop/ZigString.zig").ZigString; const bun = @import("bun"); const JSError = bun.JSError; diff --git a/src/bun.js/bindings/JSType.zig b/src/buntime/jsc/types/JSType.zig similarity index 100% rename from src/bun.js/bindings/JSType.zig rename to src/buntime/jsc/types/JSType.zig diff --git a/src/bun.js/bindings/JSValue.zig b/src/buntime/jsc/types/JSValue.zig similarity index 99% rename from src/bun.js/bindings/JSValue.zig rename to src/buntime/jsc/types/JSValue.zig index 8d911d6ecced..d1cad330b43d 100644 --- a/src/bun.js/bindings/JSValue.zig +++ b/src/buntime/jsc/types/JSValue.zig @@ -1288,7 +1288,7 @@ pub const JSValue = enum(i64) { return JSC__JSValue__eqlCell(this, other); } - /// This must match the enum in C++ in src/bun.js/bindings/bindings.cpp BuiltinNamesMap + /// This must match the enum in C++ in src/buntime/bindings/bindings.cpp BuiltinNamesMap pub const BuiltinName = enum(u8) { method, headers, @@ -2399,9 +2399,9 @@ extern "c" fn Bun__JSValue__isAsyncContextFrame(value: JSValue) bool; const string = []const u8; -const FFI = @import("./FFI.zig"); +const FFI = @import("../../api/ffi/FFI.zig"); const std = @import("std"); -const JestPrettyFormat = @import("../test/pretty_format.zig").JestPrettyFormat; +const JestPrettyFormat = @import("../../../test_runner/pretty_format.zig").JestPrettyFormat; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/bindings/MarkedArgumentBuffer.zig b/src/buntime/jsc/types/MarkedArgumentBuffer.zig similarity index 100% rename from src/bun.js/bindings/MarkedArgumentBuffer.zig rename to src/buntime/jsc/types/MarkedArgumentBuffer.zig diff --git a/src/bun.js/bindings/RegularExpression.cpp b/src/buntime/jsc/types/RegularExpression.cpp similarity index 100% rename from src/bun.js/bindings/RegularExpression.cpp rename to src/buntime/jsc/types/RegularExpression.cpp diff --git a/src/bun.js/bindings/RegularExpression.zig b/src/buntime/jsc/types/RegularExpression.zig similarity index 100% rename from src/bun.js/bindings/RegularExpression.zig rename to src/buntime/jsc/types/RegularExpression.zig diff --git a/src/bun.js/bindings/ResolvedSource.zig b/src/buntime/jsc/types/ResolvedSource.zig similarity index 100% rename from src/bun.js/bindings/ResolvedSource.zig rename to src/buntime/jsc/types/ResolvedSource.zig diff --git a/src/bun.js/bindings/ScriptExecutionStatus.zig b/src/buntime/jsc/types/ScriptExecutionStatus.zig similarity index 100% rename from src/bun.js/bindings/ScriptExecutionStatus.zig rename to src/buntime/jsc/types/ScriptExecutionStatus.zig diff --git a/src/bun.js/bindings/SourceProvider.zig b/src/buntime/jsc/types/SourceProvider.zig similarity index 100% rename from src/bun.js/bindings/SourceProvider.zig rename to src/buntime/jsc/types/SourceProvider.zig diff --git a/src/bun.js/bindings/SourceType.zig b/src/buntime/jsc/types/SourceType.zig similarity index 100% rename from src/bun.js/bindings/SourceType.zig rename to src/buntime/jsc/types/SourceType.zig diff --git a/src/bun.js/bindings/VM.zig b/src/buntime/jsc/types/VM.zig similarity index 100% rename from src/bun.js/bindings/VM.zig rename to src/buntime/jsc/types/VM.zig diff --git a/src/bun.js/AsyncModule.zig b/src/buntime/module/AsyncModule.zig similarity index 98% rename from src/bun.js/AsyncModule.zig rename to src/buntime/module/AsyncModule.zig index 054a9d0c4eaf..6ceebc20e657 100644 --- a/src/bun.js/AsyncModule.zig +++ b/src/buntime/module/AsyncModule.zig @@ -310,7 +310,7 @@ pub const AsyncModule = struct { comptime { // Ensure VirtualMachine has a field named "modules" of the correct type // If this fails, the @fieldParentPtr in vm() above needs to be updated - const VM = @import("./VirtualMachine.zig"); + const VM = @import("../core/VirtualMachine.zig"); if (!@hasField(VM, "modules")) { @compileError("VirtualMachine must have a 'modules' field for AsyncModule.Queue.vm() to work"); } @@ -752,15 +752,15 @@ pub const AsyncModule = struct { ) void; }; -const Dependency = @import("../install/dependency.zig"); -const Fs = @import("../fs.zig"); -const options = @import("../options.zig"); +const Dependency = @import("../../install/dependency.zig"); +const Fs = @import("../../fs.zig"); +const options = @import("../../options.zig"); const std = @import("std"); -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; +const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; const dumpSource = @import("./RuntimeTranspilerStore.zig").dumpSource; -const Install = @import("../install/install.zig"); -const PackageManager = @import("../install/install.zig").PackageManager; +const Install = @import("../../install/install.zig"); +const PackageManager = @import("../../install/install.zig").PackageManager; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/bun.js/bindings/CachedBytecode.zig b/src/buntime/module/CachedBytecode.zig similarity index 100% rename from src/bun.js/bindings/CachedBytecode.zig rename to src/buntime/module/CachedBytecode.zig diff --git a/src/bun.js/bindings/CachedScript.h b/src/buntime/module/CachedScript.h similarity index 100% rename from src/bun.js/bindings/CachedScript.h rename to src/buntime/module/CachedScript.h diff --git a/src/bun.js/bindings/ExposeNodeModuleGlobals.cpp b/src/buntime/module/ExposeNodeModuleGlobals.cpp similarity index 100% rename from src/bun.js/bindings/ExposeNodeModuleGlobals.cpp rename to src/buntime/module/ExposeNodeModuleGlobals.cpp diff --git a/src/bun.js/HardcodedModule.zig b/src/buntime/module/HardcodedModule.zig similarity index 99% rename from src/bun.js/HardcodedModule.zig rename to src/buntime/module/HardcodedModule.zig index 698b400fb7d7..34f836106db5 100644 --- a/src/bun.js/HardcodedModule.zig +++ b/src/buntime/module/HardcodedModule.zig @@ -424,8 +424,8 @@ pub const HardcodedModule = enum { }; const bun = @import("bun"); -const options = @import("../options.zig"); +const options = @import("../../options.zig"); const std = @import("std"); -const ast = @import("../import_record.zig"); +const ast = @import("../../import_record.zig"); const ImportRecord = ast.ImportRecord; diff --git a/src/bun.js/bindings/ImportMetaObject.cpp b/src/buntime/module/ImportMetaObject.cpp similarity index 100% rename from src/bun.js/bindings/ImportMetaObject.cpp rename to src/buntime/module/ImportMetaObject.cpp diff --git a/src/bun.js/bindings/ImportMetaObject.h b/src/buntime/module/ImportMetaObject.h similarity index 100% rename from src/bun.js/bindings/ImportMetaObject.h rename to src/buntime/module/ImportMetaObject.h diff --git a/src/bun.js/bindings/InternalModuleRegistry.cpp b/src/buntime/module/InternalModuleRegistry.cpp similarity index 100% rename from src/bun.js/bindings/InternalModuleRegistry.cpp rename to src/buntime/module/InternalModuleRegistry.cpp diff --git a/src/bun.js/bindings/InternalModuleRegistry.h b/src/buntime/module/InternalModuleRegistry.h similarity index 97% rename from src/bun.js/bindings/InternalModuleRegistry.h rename to src/buntime/module/InternalModuleRegistry.h index 78bb39230741..b72495ca9d8a 100644 --- a/src/bun.js/bindings/InternalModuleRegistry.h +++ b/src/buntime/module/InternalModuleRegistry.h @@ -16,7 +16,7 @@ using namespace JSC; // // Modules come from two sources: // - some are written in JS (src/js, there is a readme file that explain those files more. -// - others are native code (src/bun.js/modules), see _NativeModule.h in there. +// - others are native code (src/buntime/modules), see _NativeModule.h in there. class InternalModuleRegistry : public JSInternalFieldObjectImpl { public: using Base = JSInternalFieldObjectImpl; diff --git a/src/bun.js/bindings/JSCommonJSExtensions.cpp b/src/buntime/module/JSCommonJSExtensions.cpp similarity index 100% rename from src/bun.js/bindings/JSCommonJSExtensions.cpp rename to src/buntime/module/JSCommonJSExtensions.cpp diff --git a/src/bun.js/bindings/JSCommonJSExtensions.h b/src/buntime/module/JSCommonJSExtensions.h similarity index 100% rename from src/bun.js/bindings/JSCommonJSExtensions.h rename to src/buntime/module/JSCommonJSExtensions.h diff --git a/src/bun.js/bindings/JSCommonJSModule.cpp b/src/buntime/module/JSCommonJSModule.cpp similarity index 100% rename from src/bun.js/bindings/JSCommonJSModule.cpp rename to src/buntime/module/JSCommonJSModule.cpp diff --git a/src/bun.js/bindings/JSCommonJSModule.h b/src/buntime/module/JSCommonJSModule.h similarity index 100% rename from src/bun.js/bindings/JSCommonJSModule.h rename to src/buntime/module/JSCommonJSModule.h diff --git a/src/bun.js/bindings/JSModuleLoader.zig b/src/buntime/module/JSModuleLoader.zig similarity index 95% rename from src/bun.js/bindings/JSModuleLoader.zig rename to src/buntime/module/JSModuleLoader.zig index e82b18eb6055..66d8d0d2aeb1 100644 --- a/src/bun.js/bindings/JSModuleLoader.zig +++ b/src/buntime/module/JSModuleLoader.zig @@ -45,7 +45,7 @@ pub const JSModuleLoader = opaque { } }; -const JSInternalPromise = @import("./JSInternalPromise.zig").JSInternalPromise; +const JSInternalPromise = @import("../jsc/types/JSInternalPromise.zig").JSInternalPromise; const bun = @import("bun"); const String = bun.String; diff --git a/src/bun.js/bindings/ModuleLoader.cpp b/src/buntime/module/ModuleLoader.cpp similarity index 100% rename from src/bun.js/bindings/ModuleLoader.cpp rename to src/buntime/module/ModuleLoader.cpp diff --git a/src/bun.js/bindings/ModuleLoader.h b/src/buntime/module/ModuleLoader.h similarity index 100% rename from src/bun.js/bindings/ModuleLoader.h rename to src/buntime/module/ModuleLoader.h diff --git a/src/bun.js/ModuleLoader.zig b/src/buntime/module/ModuleLoader.zig similarity index 99% rename from src/bun.js/ModuleLoader.zig rename to src/buntime/module/ModuleLoader.zig index 0ea84ff9b3df..117c1fc56005 100644 --- a/src/bun.js/ModuleLoader.zig +++ b/src/buntime/module/ModuleLoader.zig @@ -1,6 +1,6 @@ const ModuleLoader = @This(); -pub const node_fallbacks = @import("../node_fallbacks.zig"); +pub const node_fallbacks = @import("../../node_fallbacks.zig"); pub const AsyncModule = @import("./AsyncModule.zig").AsyncModule; pub const RuntimeTranspilerStore = @import("./RuntimeTranspilerStore.zig").RuntimeTranspilerStore; pub const HardcodedModule = @import("./HardcodedModule.zig").HardcodedModule; @@ -653,7 +653,7 @@ pub fn transpileSourceCode( } return ResolvedSource{ .allocator = null, - .source_code = bun.String.static(@embedFile("../js/wasi-runner.js")), + .source_code = bun.String.static(@embedFile("../../js/wasi-runner.js")), .specifier = input_specifier, .source_url = input_specifier.createIfDifferent(path.text), .tag = .esm, @@ -1347,18 +1347,18 @@ const debug = Output.scoped(.ModuleLoader, .hidden); const string = []const u8; -const Fs = @import("../fs.zig"); -const Runtime = @import("../runtime.zig"); -const ast = @import("../import_record.zig"); -const node_module_module = @import("./bindings/NodeModuleModule.zig"); +const Fs = @import("../../fs.zig"); +const Runtime = @import("../../runtime.zig"); +const ast = @import("../../import_record.zig"); +const node_module_module = @import("./NodeModuleModule.zig"); const std = @import("std"); const panic = std.debug.panic; -const options = @import("../options.zig"); +const options = @import("../../options.zig"); const ModuleType = options.ModuleType; -const MacroRemap = @import("../resolver/package_json.zig").MacroMap; -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; +const MacroRemap = @import("../../resolver/package_json.zig").MacroMap; +const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; const dumpSource = @import("./RuntimeTranspilerStore.zig").dumpSource; const dumpSourceString = @import("./RuntimeTranspilerStore.zig").dumpSourceString; diff --git a/src/bun.js/bindings/NodeModuleModule.bind.ts b/src/buntime/module/NodeModuleModule.bind.ts similarity index 100% rename from src/bun.js/bindings/NodeModuleModule.bind.ts rename to src/buntime/module/NodeModuleModule.bind.ts diff --git a/src/bun.js/bindings/NodeModuleModule.zig b/src/buntime/module/NodeModuleModule.zig similarity index 100% rename from src/bun.js/bindings/NodeModuleModule.zig rename to src/buntime/module/NodeModuleModule.zig diff --git a/src/bun.js/bindings/NodeVMModule.cpp b/src/buntime/module/NodeVMModule.cpp similarity index 100% rename from src/bun.js/bindings/NodeVMModule.cpp rename to src/buntime/module/NodeVMModule.cpp diff --git a/src/bun.js/bindings/NodeVMModule.h b/src/buntime/module/NodeVMModule.h similarity index 100% rename from src/bun.js/bindings/NodeVMModule.h rename to src/buntime/module/NodeVMModule.h diff --git a/src/bun.js/bindings/NodeVMSourceTextModule.cpp b/src/buntime/module/NodeVMSourceTextModule.cpp similarity index 100% rename from src/bun.js/bindings/NodeVMSourceTextModule.cpp rename to src/buntime/module/NodeVMSourceTextModule.cpp diff --git a/src/bun.js/bindings/NodeVMSourceTextModule.h b/src/buntime/module/NodeVMSourceTextModule.h similarity index 100% rename from src/bun.js/bindings/NodeVMSourceTextModule.h rename to src/buntime/module/NodeVMSourceTextModule.h diff --git a/src/bun.js/bindings/NodeVMSyntheticModule.cpp b/src/buntime/module/NodeVMSyntheticModule.cpp similarity index 100% rename from src/bun.js/bindings/NodeVMSyntheticModule.cpp rename to src/buntime/module/NodeVMSyntheticModule.cpp diff --git a/src/bun.js/bindings/NodeVMSyntheticModule.h b/src/buntime/module/NodeVMSyntheticModule.h similarity index 100% rename from src/bun.js/bindings/NodeVMSyntheticModule.h rename to src/buntime/module/NodeVMSyntheticModule.h diff --git a/src/bun.js/RuntimeTranspilerCache.zig b/src/buntime/module/RuntimeTranspilerCache.zig similarity index 100% rename from src/bun.js/RuntimeTranspilerCache.zig rename to src/buntime/module/RuntimeTranspilerCache.zig diff --git a/src/bun.js/RuntimeTranspilerStore.zig b/src/buntime/module/RuntimeTranspilerStore.zig similarity index 98% rename from src/bun.js/RuntimeTranspilerStore.zig rename to src/buntime/module/RuntimeTranspilerStore.zig index b43de4516ad8..9e10dff935b1 100644 --- a/src/bun.js/RuntimeTranspilerStore.zig +++ b/src/buntime/module/RuntimeTranspilerStore.zig @@ -596,17 +596,17 @@ pub const RuntimeTranspilerStore = struct { }; }; -const Fs = @import("../fs.zig"); -const node_fallbacks = @import("../node_fallbacks.zig"); +const Fs = @import("../../fs.zig"); +const node_fallbacks = @import("../../node_fallbacks.zig"); const std = @import("std"); const AsyncModule = @import("./AsyncModule.zig").AsyncModule; const HardcodedModule = @import("./HardcodedModule.zig").HardcodedModule; -const options = @import("../options.zig"); +const options = @import("../../options.zig"); const ModuleType = options.ModuleType; -const MacroRemap = @import("../resolver/package_json.zig").MacroMap; -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; +const MacroRemap = @import("../../resolver/package_json.zig").MacroMap; +const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/bun.js/SavedSourceMap.zig b/src/buntime/module/SavedSourceMap.zig similarity index 100% rename from src/bun.js/SavedSourceMap.zig rename to src/buntime/module/SavedSourceMap.zig diff --git a/src/bun.js/bindings/isBuiltinModule.cpp b/src/buntime/module/isBuiltinModule.cpp similarity index 100% rename from src/bun.js/bindings/isBuiltinModule.cpp rename to src/buntime/module/isBuiltinModule.cpp diff --git a/src/bun.js/bindings/isBuiltinModule.h b/src/buntime/module/isBuiltinModule.h similarity index 100% rename from src/bun.js/bindings/isBuiltinModule.h rename to src/buntime/module/isBuiltinModule.h diff --git a/src/bun.js/modules/AbortControllerModuleModule.h b/src/buntime/modules/AbortControllerModuleModule.h similarity index 100% rename from src/bun.js/modules/AbortControllerModuleModule.h rename to src/buntime/modules/AbortControllerModuleModule.h diff --git a/src/bun.js/modules/BunAppModule.h b/src/buntime/modules/BunAppModule.h similarity index 100% rename from src/bun.js/modules/BunAppModule.h rename to src/buntime/modules/BunAppModule.h diff --git a/src/bun.js/modules/BunJSCModule.h b/src/buntime/modules/BunJSCModule.h similarity index 100% rename from src/bun.js/modules/BunJSCModule.h rename to src/buntime/modules/BunJSCModule.h diff --git a/src/bun.js/modules/BunObjectModule.h b/src/buntime/modules/BunObjectModule.h similarity index 100% rename from src/bun.js/modules/BunObjectModule.h rename to src/buntime/modules/BunObjectModule.h diff --git a/src/bun.js/modules/BunTestModule.h b/src/buntime/modules/BunTestModule.h similarity index 100% rename from src/bun.js/modules/BunTestModule.h rename to src/buntime/modules/BunTestModule.h diff --git a/src/bun.js/modules/NodeBufferModule.h b/src/buntime/modules/NodeBufferModule.h similarity index 99% rename from src/bun.js/modules/NodeBufferModule.h rename to src/buntime/modules/NodeBufferModule.h index 67658152e0be..bd1acf715133 100644 --- a/src/bun.js/modules/NodeBufferModule.h +++ b/src/buntime/modules/NodeBufferModule.h @@ -2,7 +2,7 @@ #include "root.h" -#include "../bindings/JSBuffer.h" +#include "JSBuffer.h" #include "ErrorCode.h" #include "JavaScriptCore/PageCount.h" #include "NodeValidator.h" diff --git a/src/bun.js/modules/NodeConstantsModule.h b/src/buntime/modules/NodeConstantsModule.h similarity index 100% rename from src/bun.js/modules/NodeConstantsModule.h rename to src/buntime/modules/NodeConstantsModule.h diff --git a/src/bun.js/modules/NodeModuleModule.cpp b/src/buntime/modules/NodeModuleModule.cpp similarity index 100% rename from src/bun.js/modules/NodeModuleModule.cpp rename to src/buntime/modules/NodeModuleModule.cpp diff --git a/src/bun.js/modules/NodeModuleModule.h b/src/buntime/modules/NodeModuleModule.h similarity index 100% rename from src/bun.js/modules/NodeModuleModule.h rename to src/buntime/modules/NodeModuleModule.h diff --git a/src/bun.js/modules/NodeProcessModule.h b/src/buntime/modules/NodeProcessModule.h similarity index 100% rename from src/bun.js/modules/NodeProcessModule.h rename to src/buntime/modules/NodeProcessModule.h diff --git a/src/bun.js/modules/NodeStringDecoderModule.h b/src/buntime/modules/NodeStringDecoderModule.h similarity index 77% rename from src/bun.js/modules/NodeStringDecoderModule.h rename to src/buntime/modules/NodeStringDecoderModule.h index d4ffdc85a3e5..84f71bd2fc9e 100644 --- a/src/bun.js/modules/NodeStringDecoderModule.h +++ b/src/buntime/modules/NodeStringDecoderModule.h @@ -1,5 +1,5 @@ -#include "../bindings/JSStringDecoder.h" -#include "../bindings/ZigGlobalObject.h" +#include "JSStringDecoder.h" +#include "ZigGlobalObject.h" #include namespace Zig { diff --git a/src/bun.js/modules/NodeTTYModule.cpp b/src/buntime/modules/NodeTTYModule.cpp similarity index 100% rename from src/bun.js/modules/NodeTTYModule.cpp rename to src/buntime/modules/NodeTTYModule.cpp diff --git a/src/bun.js/modules/NodeTTYModule.h b/src/buntime/modules/NodeTTYModule.h similarity index 100% rename from src/bun.js/modules/NodeTTYModule.h rename to src/buntime/modules/NodeTTYModule.h diff --git a/src/bun.js/modules/NodeUtilTypesModule.cpp b/src/buntime/modules/NodeUtilTypesModule.cpp similarity index 100% rename from src/bun.js/modules/NodeUtilTypesModule.cpp rename to src/buntime/modules/NodeUtilTypesModule.cpp diff --git a/src/bun.js/modules/NodeUtilTypesModule.h b/src/buntime/modules/NodeUtilTypesModule.h similarity index 100% rename from src/bun.js/modules/NodeUtilTypesModule.h rename to src/buntime/modules/NodeUtilTypesModule.h diff --git a/src/bun.js/modules/ObjectModule.cpp b/src/buntime/modules/ObjectModule.cpp similarity index 100% rename from src/bun.js/modules/ObjectModule.cpp rename to src/buntime/modules/ObjectModule.cpp diff --git a/src/bun.js/modules/ObjectModule.h b/src/buntime/modules/ObjectModule.h similarity index 94% rename from src/bun.js/modules/ObjectModule.h rename to src/buntime/modules/ObjectModule.h index 9e4807a8c4d9..04c1b96b644f 100644 --- a/src/bun.js/modules/ObjectModule.h +++ b/src/buntime/modules/ObjectModule.h @@ -1,6 +1,6 @@ #pragma once -#include "../bindings/ZigGlobalObject.h" +#include "ZigGlobalObject.h" #include namespace Zig { diff --git a/src/bun.js/modules/UTF8ValidateModule.h b/src/buntime/modules/UTF8ValidateModule.h similarity index 100% rename from src/bun.js/modules/UTF8ValidateModule.h rename to src/buntime/modules/UTF8ValidateModule.h diff --git a/src/bun.js/modules/_NativeModule.h b/src/buntime/modules/_NativeModule.h similarity index 100% rename from src/bun.js/modules/_NativeModule.h rename to src/buntime/modules/_NativeModule.h diff --git a/src/bun.js/node.zig b/src/buntime/node.zig similarity index 100% rename from src/bun.js/node.zig rename to src/buntime/node.zig diff --git a/src/bun.js/node/Stat.zig b/src/buntime/node/Stat.zig similarity index 100% rename from src/bun.js/node/Stat.zig rename to src/buntime/node/Stat.zig diff --git a/src/bun.js/node/StatFS.zig b/src/buntime/node/StatFS.zig similarity index 100% rename from src/bun.js/node/StatFS.zig rename to src/buntime/node/StatFS.zig diff --git a/src/bun.js/node/assert/myers_diff.zig b/src/buntime/node/assert/myers_diff.zig similarity index 100% rename from src/bun.js/node/assert/myers_diff.zig rename to src/buntime/node/assert/myers_diff.zig diff --git a/src/bun.js/bindings/AsyncContextFrame.cpp b/src/buntime/node/async_hooks/AsyncContextFrame.cpp similarity index 100% rename from src/bun.js/bindings/AsyncContextFrame.cpp rename to src/buntime/node/async_hooks/AsyncContextFrame.cpp diff --git a/src/bun.js/bindings/AsyncContextFrame.h b/src/buntime/node/async_hooks/AsyncContextFrame.h similarity index 100% rename from src/bun.js/bindings/AsyncContextFrame.h rename to src/buntime/node/async_hooks/AsyncContextFrame.h diff --git a/src/bun.js/bindings/NodeAsyncHooks.cpp b/src/buntime/node/async_hooks/NodeAsyncHooks.cpp similarity index 100% rename from src/bun.js/bindings/NodeAsyncHooks.cpp rename to src/buntime/node/async_hooks/NodeAsyncHooks.cpp diff --git a/src/bun.js/bindings/NodeAsyncHooks.h b/src/buntime/node/async_hooks/NodeAsyncHooks.h similarity index 100% rename from src/bun.js/bindings/NodeAsyncHooks.h rename to src/buntime/node/async_hooks/NodeAsyncHooks.h diff --git a/src/bun.js/node/buffer.zig b/src/buntime/node/buffer.zig similarity index 100% rename from src/bun.js/node/buffer.zig rename to src/buntime/node/buffer.zig diff --git a/src/bun.js/bindings/BufferEncodingType.h b/src/buntime/node/buffer/BufferEncodingType.h similarity index 85% rename from src/bun.js/bindings/BufferEncodingType.h rename to src/buntime/node/buffer/BufferEncodingType.h index afe5589f0d9e..d6f23c94c553 100644 --- a/src/bun.js/bindings/BufferEncodingType.h +++ b/src/buntime/node/buffer/BufferEncodingType.h @@ -4,7 +4,7 @@ namespace WebCore { -// must match src/bun.js/node/types.zig#Encoding +// must match src/buntime/node/types.zig#Encoding enum class BufferEncodingType : uint8_t { utf8 = 0, ucs2 = 1, diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/buntime/node/buffer/JSBuffer.cpp similarity index 100% rename from src/bun.js/bindings/JSBuffer.cpp rename to src/buntime/node/buffer/JSBuffer.cpp diff --git a/src/bun.js/bindings/JSBuffer.h b/src/buntime/node/buffer/JSBuffer.h similarity index 100% rename from src/bun.js/bindings/JSBuffer.h rename to src/buntime/node/buffer/JSBuffer.h diff --git a/src/bun.js/bindings/JSBufferEncodingType.cpp b/src/buntime/node/buffer/JSBufferEncodingType.cpp similarity index 100% rename from src/bun.js/bindings/JSBufferEncodingType.cpp rename to src/buntime/node/buffer/JSBufferEncodingType.cpp diff --git a/src/bun.js/bindings/JSBufferEncodingType.h b/src/buntime/node/buffer/JSBufferEncodingType.h similarity index 100% rename from src/bun.js/bindings/JSBufferEncodingType.h rename to src/buntime/node/buffer/JSBufferEncodingType.h diff --git a/src/bun.js/bindings/JSBufferList.cpp b/src/buntime/node/buffer/JSBufferList.cpp similarity index 100% rename from src/bun.js/bindings/JSBufferList.cpp rename to src/buntime/node/buffer/JSBufferList.cpp diff --git a/src/bun.js/bindings/JSBufferList.h b/src/buntime/node/buffer/JSBufferList.h similarity index 100% rename from src/bun.js/bindings/JSBufferList.h rename to src/buntime/node/buffer/JSBufferList.h diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/buntime/node/buffer/JSStringDecoder.cpp similarity index 100% rename from src/bun.js/bindings/JSStringDecoder.cpp rename to src/buntime/node/buffer/JSStringDecoder.cpp diff --git a/src/bun.js/bindings/JSStringDecoder.h b/src/buntime/node/buffer/JSStringDecoder.h similarity index 100% rename from src/bun.js/bindings/JSStringDecoder.h rename to src/buntime/node/buffer/JSStringDecoder.h diff --git a/src/bun.js/bindings/NodeConstants.h b/src/buntime/node/constants/NodeConstants.h similarity index 100% rename from src/bun.js/bindings/NodeConstants.h rename to src/buntime/node/constants/NodeConstants.h diff --git a/src/bun.js/bindings/AsymmetricKeyValue.cpp b/src/buntime/node/crypto/AsymmetricKeyValue.cpp similarity index 100% rename from src/bun.js/bindings/AsymmetricKeyValue.cpp rename to src/buntime/node/crypto/AsymmetricKeyValue.cpp diff --git a/src/bun.js/bindings/AsymmetricKeyValue.h b/src/buntime/node/crypto/AsymmetricKeyValue.h similarity index 100% rename from src/bun.js/bindings/AsymmetricKeyValue.h rename to src/buntime/node/crypto/AsymmetricKeyValue.h diff --git a/src/bun.js/bindings/node/crypto/CryptoDhJob.cpp b/src/buntime/node/crypto/CryptoDhJob.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoDhJob.cpp rename to src/buntime/node/crypto/CryptoDhJob.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoDhJob.h b/src/buntime/node/crypto/CryptoDhJob.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoDhJob.h rename to src/buntime/node/crypto/CryptoDhJob.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp b/src/buntime/node/crypto/CryptoGenDhKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenDhKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h b/src/buntime/node/crypto/CryptoGenDhKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h rename to src/buntime/node/crypto/CryptoGenDhKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp b/src/buntime/node/crypto/CryptoGenDsaKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenDsaKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.h b/src/buntime/node/crypto/CryptoGenDsaKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.h rename to src/buntime/node/crypto/CryptoGenDsaKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp b/src/buntime/node/crypto/CryptoGenEcKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenEcKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.h b/src/buntime/node/crypto/CryptoGenEcKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.h rename to src/buntime/node/crypto/CryptoGenEcKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp b/src/buntime/node/crypto/CryptoGenKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.h b/src/buntime/node/crypto/CryptoGenKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenKeyPair.h rename to src/buntime/node/crypto/CryptoGenKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp b/src/buntime/node/crypto/CryptoGenNidKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenNidKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.h b/src/buntime/node/crypto/CryptoGenNidKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.h rename to src/buntime/node/crypto/CryptoGenNidKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp b/src/buntime/node/crypto/CryptoGenRsaKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp rename to src/buntime/node/crypto/CryptoGenRsaKeyPair.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.h b/src/buntime/node/crypto/CryptoGenRsaKeyPair.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.h rename to src/buntime/node/crypto/CryptoGenRsaKeyPair.h diff --git a/src/bun.js/bindings/node/crypto/CryptoHkdf.cpp b/src/buntime/node/crypto/CryptoHkdf.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoHkdf.cpp rename to src/buntime/node/crypto/CryptoHkdf.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoHkdf.h b/src/buntime/node/crypto/CryptoHkdf.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoHkdf.h rename to src/buntime/node/crypto/CryptoHkdf.h diff --git a/src/bun.js/bindings/node/crypto/CryptoKeygen.cpp b/src/buntime/node/crypto/CryptoKeygen.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoKeygen.cpp rename to src/buntime/node/crypto/CryptoKeygen.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoKeygen.h b/src/buntime/node/crypto/CryptoKeygen.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoKeygen.h rename to src/buntime/node/crypto/CryptoKeygen.h diff --git a/src/bun.js/bindings/node/crypto/CryptoKeys.cpp b/src/buntime/node/crypto/CryptoKeys.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoKeys.cpp rename to src/buntime/node/crypto/CryptoKeys.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoKeys.h b/src/buntime/node/crypto/CryptoKeys.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoKeys.h rename to src/buntime/node/crypto/CryptoKeys.h diff --git a/src/bun.js/bindings/node/crypto/CryptoPrimes.cpp b/src/buntime/node/crypto/CryptoPrimes.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoPrimes.cpp rename to src/buntime/node/crypto/CryptoPrimes.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoPrimes.h b/src/buntime/node/crypto/CryptoPrimes.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoPrimes.h rename to src/buntime/node/crypto/CryptoPrimes.h diff --git a/src/bun.js/bindings/node/crypto/CryptoSignJob.cpp b/src/buntime/node/crypto/CryptoSignJob.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoSignJob.cpp rename to src/buntime/node/crypto/CryptoSignJob.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoSignJob.h b/src/buntime/node/crypto/CryptoSignJob.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoSignJob.h rename to src/buntime/node/crypto/CryptoSignJob.h diff --git a/src/bun.js/bindings/node/crypto/CryptoUtil.cpp b/src/buntime/node/crypto/CryptoUtil.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoUtil.cpp rename to src/buntime/node/crypto/CryptoUtil.cpp diff --git a/src/bun.js/bindings/node/crypto/CryptoUtil.h b/src/buntime/node/crypto/CryptoUtil.h similarity index 100% rename from src/bun.js/bindings/node/crypto/CryptoUtil.h rename to src/buntime/node/crypto/CryptoUtil.h diff --git a/src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h b/src/buntime/node/crypto/DiffieHellmanFunctions.h similarity index 100% rename from src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h rename to src/buntime/node/crypto/DiffieHellmanFunctions.h diff --git a/src/bun.js/bindings/node/crypto/JSCipher.cpp b/src/buntime/node/crypto/JSCipher.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipher.cpp rename to src/buntime/node/crypto/JSCipher.cpp diff --git a/src/bun.js/bindings/node/crypto/JSCipher.h b/src/buntime/node/crypto/JSCipher.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipher.h rename to src/buntime/node/crypto/JSCipher.h diff --git a/src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp b/src/buntime/node/crypto/JSCipherConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp rename to src/buntime/node/crypto/JSCipherConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSCipherConstructor.h b/src/buntime/node/crypto/JSCipherConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipherConstructor.h rename to src/buntime/node/crypto/JSCipherConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp b/src/buntime/node/crypto/JSCipherPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp rename to src/buntime/node/crypto/JSCipherPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSCipherPrototype.h b/src/buntime/node/crypto/JSCipherPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSCipherPrototype.h rename to src/buntime/node/crypto/JSCipherPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellman.cpp b/src/buntime/node/crypto/JSDiffieHellman.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellman.cpp rename to src/buntime/node/crypto/JSDiffieHellman.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellman.h b/src/buntime/node/crypto/JSDiffieHellman.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellman.h rename to src/buntime/node/crypto/JSDiffieHellman.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp b/src/buntime/node/crypto/JSDiffieHellmanConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp rename to src/buntime/node/crypto/JSDiffieHellmanConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.h b/src/buntime/node/crypto/JSDiffieHellmanConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.h rename to src/buntime/node/crypto/JSDiffieHellmanConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.cpp b/src/buntime/node/crypto/JSDiffieHellmanGroup.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.cpp rename to src/buntime/node/crypto/JSDiffieHellmanGroup.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h b/src/buntime/node/crypto/JSDiffieHellmanGroup.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h rename to src/buntime/node/crypto/JSDiffieHellmanGroup.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp b/src/buntime/node/crypto/JSDiffieHellmanGroupConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp rename to src/buntime/node/crypto/JSDiffieHellmanGroupConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.h b/src/buntime/node/crypto/JSDiffieHellmanGroupConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.h rename to src/buntime/node/crypto/JSDiffieHellmanGroupConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupPrototype.cpp b/src/buntime/node/crypto/JSDiffieHellmanGroupPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupPrototype.cpp rename to src/buntime/node/crypto/JSDiffieHellmanGroupPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupPrototype.h b/src/buntime/node/crypto/JSDiffieHellmanGroupPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupPrototype.h rename to src/buntime/node/crypto/JSDiffieHellmanGroupPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanPrototype.cpp b/src/buntime/node/crypto/JSDiffieHellmanPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanPrototype.cpp rename to src/buntime/node/crypto/JSDiffieHellmanPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanPrototype.h b/src/buntime/node/crypto/JSDiffieHellmanPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSDiffieHellmanPrototype.h rename to src/buntime/node/crypto/JSDiffieHellmanPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSECDH.cpp b/src/buntime/node/crypto/JSECDH.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDH.cpp rename to src/buntime/node/crypto/JSECDH.cpp diff --git a/src/bun.js/bindings/node/crypto/JSECDH.h b/src/buntime/node/crypto/JSECDH.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDH.h rename to src/buntime/node/crypto/JSECDH.h diff --git a/src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp b/src/buntime/node/crypto/JSECDHConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp rename to src/buntime/node/crypto/JSECDHConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSECDHConstructor.h b/src/buntime/node/crypto/JSECDHConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDHConstructor.h rename to src/buntime/node/crypto/JSECDHConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp b/src/buntime/node/crypto/JSECDHPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp rename to src/buntime/node/crypto/JSECDHPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSECDHPrototype.h b/src/buntime/node/crypto/JSECDHPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSECDHPrototype.h rename to src/buntime/node/crypto/JSECDHPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSHash.cpp b/src/buntime/node/crypto/JSHash.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSHash.cpp rename to src/buntime/node/crypto/JSHash.cpp diff --git a/src/bun.js/bindings/node/crypto/JSHash.h b/src/buntime/node/crypto/JSHash.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSHash.h rename to src/buntime/node/crypto/JSHash.h diff --git a/src/bun.js/bindings/node/crypto/JSHmac.cpp b/src/buntime/node/crypto/JSHmac.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSHmac.cpp rename to src/buntime/node/crypto/JSHmac.cpp diff --git a/src/bun.js/bindings/node/crypto/JSHmac.h b/src/buntime/node/crypto/JSHmac.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSHmac.h rename to src/buntime/node/crypto/JSHmac.h diff --git a/src/bun.js/bindings/node/crypto/JSKeyObject.cpp b/src/buntime/node/crypto/JSKeyObject.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObject.cpp rename to src/buntime/node/crypto/JSKeyObject.cpp diff --git a/src/bun.js/bindings/node/crypto/JSKeyObject.h b/src/buntime/node/crypto/JSKeyObject.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObject.h rename to src/buntime/node/crypto/JSKeyObject.h diff --git a/src/bun.js/bindings/node/crypto/JSKeyObjectConstructor.cpp b/src/buntime/node/crypto/JSKeyObjectConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObjectConstructor.cpp rename to src/buntime/node/crypto/JSKeyObjectConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSKeyObjectConstructor.h b/src/buntime/node/crypto/JSKeyObjectConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObjectConstructor.h rename to src/buntime/node/crypto/JSKeyObjectConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSKeyObjectPrototype.cpp b/src/buntime/node/crypto/JSKeyObjectPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObjectPrototype.cpp rename to src/buntime/node/crypto/JSKeyObjectPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSKeyObjectPrototype.h b/src/buntime/node/crypto/JSKeyObjectPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSKeyObjectPrototype.h rename to src/buntime/node/crypto/JSKeyObjectPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.cpp b/src/buntime/node/crypto/JSPrivateKeyObject.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObject.cpp rename to src/buntime/node/crypto/JSPrivateKeyObject.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h b/src/buntime/node/crypto/JSPrivateKeyObject.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h rename to src/buntime/node/crypto/JSPrivateKeyObject.h diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObjectConstructor.cpp b/src/buntime/node/crypto/JSPrivateKeyObjectConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObjectConstructor.cpp rename to src/buntime/node/crypto/JSPrivateKeyObjectConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObjectConstructor.h b/src/buntime/node/crypto/JSPrivateKeyObjectConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObjectConstructor.h rename to src/buntime/node/crypto/JSPrivateKeyObjectConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObjectPrototype.cpp b/src/buntime/node/crypto/JSPrivateKeyObjectPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObjectPrototype.cpp rename to src/buntime/node/crypto/JSPrivateKeyObjectPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObjectPrototype.h b/src/buntime/node/crypto/JSPrivateKeyObjectPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPrivateKeyObjectPrototype.h rename to src/buntime/node/crypto/JSPrivateKeyObjectPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObject.cpp b/src/buntime/node/crypto/JSPublicKeyObject.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObject.cpp rename to src/buntime/node/crypto/JSPublicKeyObject.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObject.h b/src/buntime/node/crypto/JSPublicKeyObject.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObject.h rename to src/buntime/node/crypto/JSPublicKeyObject.h diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObjectConstructor.cpp b/src/buntime/node/crypto/JSPublicKeyObjectConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObjectConstructor.cpp rename to src/buntime/node/crypto/JSPublicKeyObjectConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObjectConstructor.h b/src/buntime/node/crypto/JSPublicKeyObjectConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObjectConstructor.h rename to src/buntime/node/crypto/JSPublicKeyObjectConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObjectPrototype.cpp b/src/buntime/node/crypto/JSPublicKeyObjectPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObjectPrototype.cpp rename to src/buntime/node/crypto/JSPublicKeyObjectPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObjectPrototype.h b/src/buntime/node/crypto/JSPublicKeyObjectPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSPublicKeyObjectPrototype.h rename to src/buntime/node/crypto/JSPublicKeyObjectPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObject.cpp b/src/buntime/node/crypto/JSSecretKeyObject.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObject.cpp rename to src/buntime/node/crypto/JSSecretKeyObject.cpp diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObject.h b/src/buntime/node/crypto/JSSecretKeyObject.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObject.h rename to src/buntime/node/crypto/JSSecretKeyObject.h diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObjectConstructor.cpp b/src/buntime/node/crypto/JSSecretKeyObjectConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObjectConstructor.cpp rename to src/buntime/node/crypto/JSSecretKeyObjectConstructor.cpp diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObjectConstructor.h b/src/buntime/node/crypto/JSSecretKeyObjectConstructor.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObjectConstructor.h rename to src/buntime/node/crypto/JSSecretKeyObjectConstructor.h diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObjectPrototype.cpp b/src/buntime/node/crypto/JSSecretKeyObjectPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObjectPrototype.cpp rename to src/buntime/node/crypto/JSSecretKeyObjectPrototype.cpp diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObjectPrototype.h b/src/buntime/node/crypto/JSSecretKeyObjectPrototype.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSecretKeyObjectPrototype.h rename to src/buntime/node/crypto/JSSecretKeyObjectPrototype.h diff --git a/src/bun.js/bindings/node/crypto/JSSign.cpp b/src/buntime/node/crypto/JSSign.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSign.cpp rename to src/buntime/node/crypto/JSSign.cpp diff --git a/src/bun.js/bindings/node/crypto/JSSign.h b/src/buntime/node/crypto/JSSign.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSSign.h rename to src/buntime/node/crypto/JSSign.h diff --git a/src/bun.js/bindings/node/crypto/JSVerify.cpp b/src/buntime/node/crypto/JSVerify.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/JSVerify.cpp rename to src/buntime/node/crypto/JSVerify.cpp diff --git a/src/bun.js/bindings/node/crypto/JSVerify.h b/src/buntime/node/crypto/JSVerify.h similarity index 100% rename from src/bun.js/bindings/node/crypto/JSVerify.h rename to src/buntime/node/crypto/JSVerify.h diff --git a/src/bun.js/bindings/JSX509Certificate.cpp b/src/buntime/node/crypto/JSX509Certificate.cpp similarity index 100% rename from src/bun.js/bindings/JSX509Certificate.cpp rename to src/buntime/node/crypto/JSX509Certificate.cpp diff --git a/src/bun.js/bindings/JSX509Certificate.h b/src/buntime/node/crypto/JSX509Certificate.h similarity index 100% rename from src/bun.js/bindings/JSX509Certificate.h rename to src/buntime/node/crypto/JSX509Certificate.h diff --git a/src/bun.js/bindings/JSX509CertificateConstructor.cpp b/src/buntime/node/crypto/JSX509CertificateConstructor.cpp similarity index 100% rename from src/bun.js/bindings/JSX509CertificateConstructor.cpp rename to src/buntime/node/crypto/JSX509CertificateConstructor.cpp diff --git a/src/bun.js/bindings/JSX509CertificateConstructor.h b/src/buntime/node/crypto/JSX509CertificateConstructor.h similarity index 100% rename from src/bun.js/bindings/JSX509CertificateConstructor.h rename to src/buntime/node/crypto/JSX509CertificateConstructor.h diff --git a/src/bun.js/bindings/JSX509CertificatePrototype.cpp b/src/buntime/node/crypto/JSX509CertificatePrototype.cpp similarity index 100% rename from src/bun.js/bindings/JSX509CertificatePrototype.cpp rename to src/buntime/node/crypto/JSX509CertificatePrototype.cpp diff --git a/src/bun.js/bindings/JSX509CertificatePrototype.h b/src/buntime/node/crypto/JSX509CertificatePrototype.h similarity index 100% rename from src/bun.js/bindings/JSX509CertificatePrototype.h rename to src/buntime/node/crypto/JSX509CertificatePrototype.h diff --git a/src/bun.js/bindings/node/crypto/KeyObject.cpp b/src/buntime/node/crypto/KeyObject.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/KeyObject.cpp rename to src/buntime/node/crypto/KeyObject.cpp diff --git a/src/bun.js/bindings/node/crypto/KeyObject.h b/src/buntime/node/crypto/KeyObject.h similarity index 100% rename from src/bun.js/bindings/node/crypto/KeyObject.h rename to src/buntime/node/crypto/KeyObject.h diff --git a/src/bun.js/bindings/node/crypto/KeyObjectData.h b/src/buntime/node/crypto/KeyObjectData.h similarity index 100% rename from src/bun.js/bindings/node/crypto/KeyObjectData.h rename to src/buntime/node/crypto/KeyObjectData.h diff --git a/src/bun.js/bindings/NodeTLS.cpp b/src/buntime/node/crypto/NodeTLS.cpp similarity index 100% rename from src/bun.js/bindings/NodeTLS.cpp rename to src/buntime/node/crypto/NodeTLS.cpp diff --git a/src/bun.js/bindings/NodeTLS.h b/src/buntime/node/crypto/NodeTLS.h similarity index 100% rename from src/bun.js/bindings/NodeTLS.h rename to src/buntime/node/crypto/NodeTLS.h diff --git a/src/bun.js/bindings/dh-primes.h b/src/buntime/node/crypto/dh-primes.h similarity index 100% rename from src/bun.js/bindings/dh-primes.h rename to src/buntime/node/crypto/dh-primes.h diff --git a/src/bun.js/bindings/ncrpyto_engine.cpp b/src/buntime/node/crypto/ncrpyto_engine.cpp similarity index 100% rename from src/bun.js/bindings/ncrpyto_engine.cpp rename to src/buntime/node/crypto/ncrpyto_engine.cpp diff --git a/src/bun.js/bindings/ncrypto.cpp b/src/buntime/node/crypto/ncrypto.cpp similarity index 100% rename from src/bun.js/bindings/ncrypto.cpp rename to src/buntime/node/crypto/ncrypto.cpp diff --git a/src/bun.js/bindings/ncrypto.h b/src/buntime/node/crypto/ncrypto.h similarity index 100% rename from src/bun.js/bindings/ncrypto.h rename to src/buntime/node/crypto/ncrypto.h diff --git a/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp b/src/buntime/node/crypto/node_crypto_binding.cpp similarity index 100% rename from src/bun.js/bindings/node/crypto/node_crypto_binding.cpp rename to src/buntime/node/crypto/node_crypto_binding.cpp diff --git a/src/bun.js/bindings/node/crypto/node_crypto_binding.h b/src/buntime/node/crypto/node_crypto_binding.h similarity index 100% rename from src/bun.js/bindings/node/crypto/node_crypto_binding.h rename to src/buntime/node/crypto/node_crypto_binding.h diff --git a/src/bun.js/node/dir_iterator.zig b/src/buntime/node/dir_iterator.zig similarity index 100% rename from src/bun.js/node/dir_iterator.zig rename to src/buntime/node/dir_iterator.zig diff --git a/src/bun.js/bindings/NodeDirent.cpp b/src/buntime/node/fs/NodeDirent.cpp similarity index 100% rename from src/bun.js/bindings/NodeDirent.cpp rename to src/buntime/node/fs/NodeDirent.cpp diff --git a/src/bun.js/bindings/NodeDirent.h b/src/buntime/node/fs/NodeDirent.h similarity index 100% rename from src/bun.js/bindings/NodeDirent.h rename to src/buntime/node/fs/NodeDirent.h diff --git a/src/bun.js/bindings/NodeFSStatBinding.cpp b/src/buntime/node/fs/NodeFSStatBinding.cpp similarity index 100% rename from src/bun.js/bindings/NodeFSStatBinding.cpp rename to src/buntime/node/fs/NodeFSStatBinding.cpp diff --git a/src/bun.js/bindings/NodeFSStatBinding.h b/src/buntime/node/fs/NodeFSStatBinding.h similarity index 100% rename from src/bun.js/bindings/NodeFSStatBinding.h rename to src/buntime/node/fs/NodeFSStatBinding.h diff --git a/src/bun.js/bindings/NodeFSStatFSBinding.cpp b/src/buntime/node/fs/NodeFSStatFSBinding.cpp similarity index 100% rename from src/bun.js/bindings/NodeFSStatFSBinding.cpp rename to src/buntime/node/fs/NodeFSStatFSBinding.cpp diff --git a/src/bun.js/bindings/NodeFSStatFSBinding.h b/src/buntime/node/fs/NodeFSStatFSBinding.h similarity index 100% rename from src/bun.js/bindings/NodeFSStatFSBinding.h rename to src/buntime/node/fs/NodeFSStatFSBinding.h diff --git a/src/bun.js/node/fs_events.zig b/src/buntime/node/fs_events.zig similarity index 100% rename from src/bun.js/node/fs_events.zig rename to src/buntime/node/fs_events.zig diff --git a/src/bun.js/bindings/node/http/JSConnectionsList.cpp b/src/buntime/node/http/JSConnectionsList.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsList.cpp rename to src/buntime/node/http/JSConnectionsList.cpp diff --git a/src/bun.js/bindings/node/http/JSConnectionsList.h b/src/buntime/node/http/JSConnectionsList.h similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsList.h rename to src/buntime/node/http/JSConnectionsList.h diff --git a/src/bun.js/bindings/node/http/JSConnectionsListConstructor.cpp b/src/buntime/node/http/JSConnectionsListConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsListConstructor.cpp rename to src/buntime/node/http/JSConnectionsListConstructor.cpp diff --git a/src/bun.js/bindings/node/http/JSConnectionsListConstructor.h b/src/buntime/node/http/JSConnectionsListConstructor.h similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsListConstructor.h rename to src/buntime/node/http/JSConnectionsListConstructor.h diff --git a/src/bun.js/bindings/node/http/JSConnectionsListPrototype.cpp b/src/buntime/node/http/JSConnectionsListPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsListPrototype.cpp rename to src/buntime/node/http/JSConnectionsListPrototype.cpp diff --git a/src/bun.js/bindings/node/http/JSConnectionsListPrototype.h b/src/buntime/node/http/JSConnectionsListPrototype.h similarity index 100% rename from src/bun.js/bindings/node/http/JSConnectionsListPrototype.h rename to src/buntime/node/http/JSConnectionsListPrototype.h diff --git a/src/bun.js/bindings/node/http/JSHTTPParser.cpp b/src/buntime/node/http/JSHTTPParser.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParser.cpp rename to src/buntime/node/http/JSHTTPParser.cpp diff --git a/src/bun.js/bindings/node/http/JSHTTPParser.h b/src/buntime/node/http/JSHTTPParser.h similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParser.h rename to src/buntime/node/http/JSHTTPParser.h diff --git a/src/bun.js/bindings/node/http/JSHTTPParserConstructor.cpp b/src/buntime/node/http/JSHTTPParserConstructor.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParserConstructor.cpp rename to src/buntime/node/http/JSHTTPParserConstructor.cpp diff --git a/src/bun.js/bindings/node/http/JSHTTPParserConstructor.h b/src/buntime/node/http/JSHTTPParserConstructor.h similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParserConstructor.h rename to src/buntime/node/http/JSHTTPParserConstructor.h diff --git a/src/bun.js/bindings/node/http/JSHTTPParserPrototype.cpp b/src/buntime/node/http/JSHTTPParserPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParserPrototype.cpp rename to src/buntime/node/http/JSHTTPParserPrototype.cpp diff --git a/src/bun.js/bindings/node/http/JSHTTPParserPrototype.h b/src/buntime/node/http/JSHTTPParserPrototype.h similarity index 100% rename from src/bun.js/bindings/node/http/JSHTTPParserPrototype.h rename to src/buntime/node/http/JSHTTPParserPrototype.h diff --git a/src/bun.js/bindings/node/JSNodeHTTPServerSocket.cpp b/src/buntime/node/http/JSNodeHTTPServerSocket.cpp similarity index 100% rename from src/bun.js/bindings/node/JSNodeHTTPServerSocket.cpp rename to src/buntime/node/http/JSNodeHTTPServerSocket.cpp diff --git a/src/bun.js/bindings/node/JSNodeHTTPServerSocket.h b/src/buntime/node/http/JSNodeHTTPServerSocket.h similarity index 100% rename from src/bun.js/bindings/node/JSNodeHTTPServerSocket.h rename to src/buntime/node/http/JSNodeHTTPServerSocket.h diff --git a/src/bun.js/bindings/node/JSNodeHTTPServerSocketPrototype.cpp b/src/buntime/node/http/JSNodeHTTPServerSocketPrototype.cpp similarity index 100% rename from src/bun.js/bindings/node/JSNodeHTTPServerSocketPrototype.cpp rename to src/buntime/node/http/JSNodeHTTPServerSocketPrototype.cpp diff --git a/src/bun.js/bindings/node/JSNodeHTTPServerSocketPrototype.h b/src/buntime/node/http/JSNodeHTTPServerSocketPrototype.h similarity index 100% rename from src/bun.js/bindings/node/JSNodeHTTPServerSocketPrototype.h rename to src/buntime/node/http/JSNodeHTTPServerSocketPrototype.h diff --git a/src/bun.js/bindings/NodeHTTP.cpp b/src/buntime/node/http/NodeHTTP.cpp similarity index 99% rename from src/bun.js/bindings/NodeHTTP.cpp rename to src/buntime/node/http/NodeHTTP.cpp index d315e752495e..e7ce0760b9b4 100644 --- a/src/bun.js/bindings/NodeHTTP.cpp +++ b/src/buntime/node/http/NodeHTTP.cpp @@ -21,8 +21,8 @@ #include #include #include "JSSocketAddressDTO.h" -#include "node/JSNodeHTTPServerSocket.h" -#include "node/JSNodeHTTPServerSocketPrototype.h" +#include "JSNodeHTTPServerSocket.h" +#include "JSNodeHTTPServerSocketPrototype.h" namespace Bun { using namespace JSC; diff --git a/src/bun.js/bindings/NodeHTTP.h b/src/buntime/node/http/NodeHTTP.h similarity index 100% rename from src/bun.js/bindings/NodeHTTP.h rename to src/buntime/node/http/NodeHTTP.h diff --git a/src/bun.js/bindings/node/http/NodeHTTPParser.cpp b/src/buntime/node/http/NodeHTTPParser.cpp similarity index 100% rename from src/bun.js/bindings/node/http/NodeHTTPParser.cpp rename to src/buntime/node/http/NodeHTTPParser.cpp diff --git a/src/bun.js/bindings/node/http/NodeHTTPParser.h b/src/buntime/node/http/NodeHTTPParser.h similarity index 100% rename from src/bun.js/bindings/node/http/NodeHTTPParser.h rename to src/buntime/node/http/NodeHTTPParser.h diff --git a/src/bun.js/bindings/node/http/llhttp/README.md b/src/buntime/node/http/llhttp/README.md similarity index 84% rename from src/bun.js/bindings/node/http/llhttp/README.md rename to src/buntime/node/http/llhttp/README.md index ce198c9deb13..22c7e6b4c1ad 100644 --- a/src/bun.js/bindings/node/http/llhttp/README.md +++ b/src/buntime/node/http/llhttp/README.md @@ -2,7 +2,7 @@ Sources are from [llhttp](https://github.com/nodejs/llhttp) 9.3.0 (36151b9a7d632 Keep this in sync with: -- `src/bun.js/bindings/ProcessBindingHTTPParser.cpp` +- `src/buntime/api/process/ProcessBindingHTTPParser.cpp` - `packages/bun-types/overrides.d.ts` ``` diff --git a/src/bun.js/bindings/node/http/llhttp/api.c b/src/buntime/node/http/llhttp/api.c similarity index 100% rename from src/bun.js/bindings/node/http/llhttp/api.c rename to src/buntime/node/http/llhttp/api.c diff --git a/src/bun.js/bindings/node/http/llhttp/api.h b/src/buntime/node/http/llhttp/api.h similarity index 100% rename from src/bun.js/bindings/node/http/llhttp/api.h rename to src/buntime/node/http/llhttp/api.h diff --git a/src/bun.js/bindings/node/http/llhttp/http.c b/src/buntime/node/http/llhttp/http.c similarity index 100% rename from src/bun.js/bindings/node/http/llhttp/http.c rename to src/buntime/node/http/llhttp/http.c diff --git a/src/bun.js/bindings/node/http/llhttp/llhttp.c b/src/buntime/node/http/llhttp/llhttp.c similarity index 100% rename from src/bun.js/bindings/node/http/llhttp/llhttp.c rename to src/buntime/node/http/llhttp/llhttp.c diff --git a/src/bun.js/bindings/node/http/llhttp/llhttp.h b/src/buntime/node/http/llhttp/llhttp.h similarity index 100% rename from src/bun.js/bindings/node/http/llhttp/llhttp.h rename to src/buntime/node/http/llhttp/llhttp.h diff --git a/src/bun.js/node/net/BlockList.zig b/src/buntime/node/net/BlockList.zig similarity index 100% rename from src/bun.js/node/net/BlockList.zig rename to src/buntime/node/net/BlockList.zig diff --git a/src/bun.js/node/node.classes.ts b/src/buntime/node/node.classes.ts similarity index 100% rename from src/bun.js/node/node.classes.ts rename to src/buntime/node/node.classes.ts diff --git a/src/bun.js/node/node_assert.zig b/src/buntime/node/node_assert.zig similarity index 100% rename from src/bun.js/node/node_assert.zig rename to src/buntime/node/node_assert.zig diff --git a/src/bun.js/node/node_assert_binding.zig b/src/buntime/node/node_assert_binding.zig similarity index 100% rename from src/bun.js/node/node_assert_binding.zig rename to src/buntime/node/node_assert_binding.zig diff --git a/src/bun.js/node/node_cluster_binding.zig b/src/buntime/node/node_cluster_binding.zig similarity index 100% rename from src/bun.js/node/node_cluster_binding.zig rename to src/buntime/node/node_cluster_binding.zig diff --git a/src/bun.js/node/node_crypto_binding.zig b/src/buntime/node/node_crypto_binding.zig similarity index 100% rename from src/bun.js/node/node_crypto_binding.zig rename to src/buntime/node/node_crypto_binding.zig diff --git a/src/bun.js/node/node_error_binding.zig b/src/buntime/node/node_error_binding.zig similarity index 100% rename from src/bun.js/node/node_error_binding.zig rename to src/buntime/node/node_error_binding.zig diff --git a/src/bun.js/node/node_fs.zig b/src/buntime/node/node_fs.zig similarity index 100% rename from src/bun.js/node/node_fs.zig rename to src/buntime/node/node_fs.zig diff --git a/src/bun.js/node/node_fs_binding.zig b/src/buntime/node/node_fs_binding.zig similarity index 100% rename from src/bun.js/node/node_fs_binding.zig rename to src/buntime/node/node_fs_binding.zig diff --git a/src/bun.js/node/node_fs_constant.zig b/src/buntime/node/node_fs_constant.zig similarity index 100% rename from src/bun.js/node/node_fs_constant.zig rename to src/buntime/node/node_fs_constant.zig diff --git a/src/bun.js/node/node_fs_stat_watcher.zig b/src/buntime/node/node_fs_stat_watcher.zig similarity index 100% rename from src/bun.js/node/node_fs_stat_watcher.zig rename to src/buntime/node/node_fs_stat_watcher.zig diff --git a/src/bun.js/node/node_fs_watcher.zig b/src/buntime/node/node_fs_watcher.zig similarity index 100% rename from src/bun.js/node/node_fs_watcher.zig rename to src/buntime/node/node_fs_watcher.zig diff --git a/src/bun.js/node/node_http_binding.zig b/src/buntime/node/node_http_binding.zig similarity index 100% rename from src/bun.js/node/node_http_binding.zig rename to src/buntime/node/node_http_binding.zig diff --git a/src/bun.js/node/node_net_binding.zig b/src/buntime/node/node_net_binding.zig similarity index 100% rename from src/bun.js/node/node_net_binding.zig rename to src/buntime/node/node_net_binding.zig diff --git a/src/bun.js/node/node_os.bind.ts b/src/buntime/node/node_os.bind.ts similarity index 100% rename from src/bun.js/node/node_os.bind.ts rename to src/buntime/node/node_os.bind.ts diff --git a/src/bun.js/node/node_os.zig b/src/buntime/node/node_os.zig similarity index 100% rename from src/bun.js/node/node_os.zig rename to src/buntime/node/node_os.zig diff --git a/src/bun.js/node/node_process.zig b/src/buntime/node/node_process.zig similarity index 100% rename from src/bun.js/node/node_process.zig rename to src/buntime/node/node_process.zig diff --git a/src/bun.js/node/node_util_binding.zig b/src/buntime/node/node_util_binding.zig similarity index 100% rename from src/bun.js/node/node_util_binding.zig rename to src/buntime/node/node_util_binding.zig diff --git a/src/bun.js/node/node_zlib_binding.zig b/src/buntime/node/node_zlib_binding.zig similarity index 100% rename from src/bun.js/node/node_zlib_binding.zig rename to src/buntime/node/node_zlib_binding.zig diff --git a/src/bun.js/node/nodejs_error_code.zig b/src/buntime/node/nodejs_error_code.zig similarity index 100% rename from src/bun.js/node/nodejs_error_code.zig rename to src/buntime/node/nodejs_error_code.zig diff --git a/src/bun.js/bindings/OsBinding.cpp b/src/buntime/node/os/OsBinding.cpp similarity index 100% rename from src/bun.js/bindings/OsBinding.cpp rename to src/buntime/node/os/OsBinding.cpp diff --git a/src/bun.js/node/os/constants.zig b/src/buntime/node/os/constants.zig similarity index 100% rename from src/bun.js/node/os/constants.zig rename to src/buntime/node/os/constants.zig diff --git a/src/bun.js/node/path.zig b/src/buntime/node/path.zig similarity index 100% rename from src/bun.js/node/path.zig rename to src/buntime/node/path.zig diff --git a/src/bun.js/bindings/Path.cpp b/src/buntime/node/path/Path.cpp similarity index 100% rename from src/bun.js/bindings/Path.cpp rename to src/buntime/node/path/Path.cpp diff --git a/src/bun.js/bindings/Path.h b/src/buntime/node/path/Path.h similarity index 100% rename from src/bun.js/bindings/Path.h rename to src/buntime/node/path/Path.h diff --git a/src/bun.js/bindings/PathInlines.h b/src/buntime/node/path/PathInlines.h similarity index 100% rename from src/bun.js/bindings/PathInlines.h rename to src/buntime/node/path/PathInlines.h diff --git a/src/bun.js/node/path_watcher.zig b/src/buntime/node/path_watcher.zig similarity index 100% rename from src/bun.js/node/path_watcher.zig rename to src/buntime/node/path_watcher.zig diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogram.cpp b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogram.cpp similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogram.cpp rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogram.cpp diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogram.h b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogram.h similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogram.h rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogram.h diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogramConstructor.cpp b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramConstructor.cpp similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogramConstructor.cpp rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramConstructor.cpp diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogramConstructor.h b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramConstructor.h similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogramConstructor.h rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramConstructor.h diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogramPrototype.cpp b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramPrototype.cpp similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogramPrototype.cpp rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramPrototype.cpp diff --git a/src/bun.js/bindings/JSNodePerformanceHooksHistogramPrototype.h b/src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramPrototype.h similarity index 100% rename from src/bun.js/bindings/JSNodePerformanceHooksHistogramPrototype.h rename to src/buntime/node/perf_hooks/JSNodePerformanceHooksHistogramPrototype.h diff --git a/src/bun.js/bindings/JSNextTickQueue.cpp b/src/buntime/node/process/JSNextTickQueue.cpp similarity index 100% rename from src/bun.js/bindings/JSNextTickQueue.cpp rename to src/buntime/node/process/JSNextTickQueue.cpp diff --git a/src/bun.js/bindings/JSNextTickQueue.h b/src/buntime/node/process/JSNextTickQueue.h similarity index 100% rename from src/bun.js/bindings/JSNextTickQueue.h rename to src/buntime/node/process/JSNextTickQueue.h diff --git a/src/bun.js/node/time_like.zig b/src/buntime/node/time_like.zig similarity index 100% rename from src/bun.js/node/time_like.zig rename to src/buntime/node/time_like.zig diff --git a/src/bun.js/bindings/NodeTimerObject.cpp b/src/buntime/node/timers/NodeTimerObject.cpp similarity index 100% rename from src/bun.js/bindings/NodeTimerObject.cpp rename to src/buntime/node/timers/NodeTimerObject.cpp diff --git a/src/bun.js/bindings/node/NodeTimers.cpp b/src/buntime/node/timers/NodeTimers.cpp similarity index 100% rename from src/bun.js/bindings/node/NodeTimers.cpp rename to src/buntime/node/timers/NodeTimers.cpp diff --git a/src/bun.js/bindings/node/NodeTimers.h b/src/buntime/node/timers/NodeTimers.h similarity index 100% rename from src/bun.js/bindings/node/NodeTimers.h rename to src/buntime/node/timers/NodeTimers.h diff --git a/src/bun.js/node/types.zig b/src/buntime/node/types.zig similarity index 99% rename from src/bun.js/node/types.zig rename to src/buntime/node/types.zig index abfc821b0789..89d743dd1179 100644 --- a/src/bun.js/node/types.zig +++ b/src/buntime/node/types.zig @@ -324,7 +324,7 @@ pub const StringOrBuffer = union(enum) { /// https://github.com/nodejs/node/blob/master/lib/buffer.js#L587 /// See `jsc.WebCore.encoding` for encoding and decoding functions. -/// must match src/bun.js/bindings/BufferEncodingType.h +/// must match src/buntime/bindings/BufferEncodingType.h pub const Encoding = enum(u8) { utf8, ucs2, diff --git a/src/bun.js/bindings/NodeValidator.cpp b/src/buntime/node/util/NodeValidator.cpp similarity index 100% rename from src/bun.js/bindings/NodeValidator.cpp rename to src/buntime/node/util/NodeValidator.cpp diff --git a/src/bun.js/bindings/NodeValidator.h b/src/buntime/node/util/NodeValidator.h similarity index 100% rename from src/bun.js/bindings/NodeValidator.h rename to src/buntime/node/util/NodeValidator.h diff --git a/src/bun.js/node/util/parse_args.zig b/src/buntime/node/util/parse_args.zig similarity index 100% rename from src/bun.js/node/util/parse_args.zig rename to src/buntime/node/util/parse_args.zig diff --git a/src/bun.js/node/util/parse_args_utils.zig b/src/buntime/node/util/parse_args_utils.zig similarity index 100% rename from src/bun.js/node/util/parse_args_utils.zig rename to src/buntime/node/util/parse_args_utils.zig diff --git a/src/bun.js/node/util/validators.zig b/src/buntime/node/util/validators.zig similarity index 100% rename from src/bun.js/node/util/validators.zig rename to src/buntime/node/util/validators.zig diff --git a/src/bun.js/bindings/NodeVM.cpp b/src/buntime/node/vm/NodeVM.cpp similarity index 100% rename from src/bun.js/bindings/NodeVM.cpp rename to src/buntime/node/vm/NodeVM.cpp diff --git a/src/bun.js/bindings/NodeVM.h b/src/buntime/node/vm/NodeVM.h similarity index 100% rename from src/bun.js/bindings/NodeVM.h rename to src/buntime/node/vm/NodeVM.h diff --git a/src/bun.js/bindings/NodeVMScript.cpp b/src/buntime/node/vm/NodeVMScript.cpp similarity index 100% rename from src/bun.js/bindings/NodeVMScript.cpp rename to src/buntime/node/vm/NodeVMScript.cpp diff --git a/src/bun.js/bindings/NodeVMScript.h b/src/buntime/node/vm/NodeVMScript.h similarity index 100% rename from src/bun.js/bindings/NodeVMScript.h rename to src/buntime/node/vm/NodeVMScript.h diff --git a/src/bun.js/bindings/NodeVMScriptFetcher.h b/src/buntime/node/vm/NodeVMScriptFetcher.h similarity index 100% rename from src/bun.js/bindings/NodeVMScriptFetcher.h rename to src/buntime/node/vm/NodeVMScriptFetcher.h diff --git a/src/bun.js/node/win_watcher.zig b/src/buntime/node/win_watcher.zig similarity index 100% rename from src/bun.js/node/win_watcher.zig rename to src/buntime/node/win_watcher.zig diff --git a/src/bun.js/node/zlib/NativeBrotli.zig b/src/buntime/node/zlib/NativeBrotli.zig similarity index 100% rename from src/bun.js/node/zlib/NativeBrotli.zig rename to src/buntime/node/zlib/NativeBrotli.zig diff --git a/src/bun.js/node/zlib/NativeZlib.zig b/src/buntime/node/zlib/NativeZlib.zig similarity index 100% rename from src/bun.js/node/zlib/NativeZlib.zig rename to src/buntime/node/zlib/NativeZlib.zig diff --git a/src/bun.js/node/zlib/NativeZstd.zig b/src/buntime/node/zlib/NativeZstd.zig similarity index 100% rename from src/bun.js/node/zlib/NativeZstd.zig rename to src/buntime/node/zlib/NativeZstd.zig diff --git a/src/bun.js/resolve_message.classes.ts b/src/buntime/resolve_message.classes.ts similarity index 100% rename from src/bun.js/resolve_message.classes.ts rename to src/buntime/resolve_message.classes.ts diff --git a/src/bun.js/webcore/Blob.zig b/src/buntime/web/blob/Blob.zig similarity index 99% rename from src/bun.js/webcore/Blob.zig rename to src/buntime/web/blob/Blob.zig index 62ec61b63524..444196285979 100644 --- a/src/bun.js/webcore/Blob.zig +++ b/src/buntime/web/blob/Blob.zig @@ -8,10 +8,10 @@ const Blob = @This(); const debug = Output.scoped(.Blob, .visible); -pub const Store = @import("./blob/Store.zig"); -pub const read_file = @import("./blob/read_file.zig"); -pub const write_file = @import("./blob/write_file.zig"); -pub const copy_file = @import("./blob/copy_file.zig"); +pub const Store = @import("./Store.zig"); +pub const read_file = @import("./read_file.zig"); +pub const write_file = @import("./write_file.zig"); +pub const copy_file = @import("./copy_file.zig"); pub fn new(blob: Blob) *Blob { const result = bun.new(Blob, blob); @@ -4802,8 +4802,8 @@ const NewReadFileHandler = read_file.NewReadFileHandler; const string = []const u8; -const Environment = @import("../../env.zig"); -const S3File = @import("./S3File.zig"); +const Environment = @import("../../../env.zig"); +const S3File = @import("../../api/s3/S3File.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun.js/webcore/ByteBlobLoader.zig b/src/buntime/web/blob/ByteBlobLoader.zig similarity index 100% rename from src/bun.js/webcore/ByteBlobLoader.zig rename to src/buntime/web/blob/ByteBlobLoader.zig diff --git a/src/bun.js/bindings/DOMFormData.cpp b/src/buntime/web/blob/DOMFormData.cpp similarity index 100% rename from src/bun.js/bindings/DOMFormData.cpp rename to src/buntime/web/blob/DOMFormData.cpp diff --git a/src/bun.js/bindings/DOMFormData.h b/src/buntime/web/blob/DOMFormData.h similarity index 100% rename from src/bun.js/bindings/DOMFormData.h rename to src/buntime/web/blob/DOMFormData.h diff --git a/src/bun.js/bindings/DOMFormData.zig b/src/buntime/web/blob/DOMFormData.zig similarity index 100% rename from src/bun.js/bindings/DOMFormData.zig rename to src/buntime/web/blob/DOMFormData.zig diff --git a/src/bun.js/webcore/FileReader.zig b/src/buntime/web/blob/FileReader.zig similarity index 100% rename from src/bun.js/webcore/FileReader.zig rename to src/buntime/web/blob/FileReader.zig diff --git a/src/bun.js/bindings/JSDOMFile.cpp b/src/buntime/web/blob/JSDOMFile.cpp similarity index 100% rename from src/bun.js/bindings/JSDOMFile.cpp rename to src/buntime/web/blob/JSDOMFile.cpp diff --git a/src/bun.js/bindings/JSDOMFile.h b/src/buntime/web/blob/JSDOMFile.h similarity index 100% rename from src/bun.js/bindings/JSDOMFile.h rename to src/buntime/web/blob/JSDOMFile.h diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.cpp b/src/buntime/web/blob/JSDOMFormData.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMFormData.cpp rename to src/buntime/web/blob/JSDOMFormData.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.h b/src/buntime/web/blob/JSDOMFormData.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMFormData.h rename to src/buntime/web/blob/JSDOMFormData.h diff --git a/src/bun.js/webcore/blob/Store.zig b/src/buntime/web/blob/Store.zig similarity index 100% rename from src/bun.js/webcore/blob/Store.zig rename to src/buntime/web/blob/Store.zig diff --git a/src/bun.js/bindings/blob.cpp b/src/buntime/web/blob/blob.cpp similarity index 100% rename from src/bun.js/bindings/blob.cpp rename to src/buntime/web/blob/blob.cpp diff --git a/src/bun.js/bindings/blob.h b/src/buntime/web/blob/blob.h similarity index 100% rename from src/bun.js/bindings/blob.h rename to src/buntime/web/blob/blob.h diff --git a/src/bun.js/webcore/blob/copy_file.zig b/src/buntime/web/blob/copy_file.zig similarity index 100% rename from src/bun.js/webcore/blob/copy_file.zig rename to src/buntime/web/blob/copy_file.zig diff --git a/src/bun.js/webcore/blob/read_file.zig b/src/buntime/web/blob/read_file.zig similarity index 100% rename from src/bun.js/webcore/blob/read_file.zig rename to src/buntime/web/blob/read_file.zig diff --git a/src/bun.js/webcore/blob/write_file.zig b/src/buntime/web/blob/write_file.zig similarity index 100% rename from src/bun.js/webcore/blob/write_file.zig rename to src/buntime/web/blob/write_file.zig diff --git a/src/bun.js/bindings/JSCompressionStream.cpp b/src/buntime/web/compression/JSCompressionStream.cpp similarity index 100% rename from src/bun.js/bindings/JSCompressionStream.cpp rename to src/buntime/web/compression/JSCompressionStream.cpp diff --git a/src/bun.js/bindings/JSCompressionStream.h b/src/buntime/web/compression/JSCompressionStream.h similarity index 100% rename from src/bun.js/bindings/JSCompressionStream.h rename to src/buntime/web/compression/JSCompressionStream.h diff --git a/src/bun.js/bindings/JSDecompressionStream.cpp b/src/buntime/web/compression/JSDecompressionStream.cpp similarity index 100% rename from src/bun.js/bindings/JSDecompressionStream.cpp rename to src/buntime/web/compression/JSDecompressionStream.cpp diff --git a/src/bun.js/bindings/JSDecompressionStream.h b/src/buntime/web/compression/JSDecompressionStream.h similarity index 100% rename from src/bun.js/bindings/JSDecompressionStream.h rename to src/buntime/web/compression/JSDecompressionStream.h diff --git a/src/bun.js/bindings/Base64Helpers.cpp b/src/buntime/web/encoding/Base64Helpers.cpp similarity index 100% rename from src/bun.js/bindings/Base64Helpers.cpp rename to src/buntime/web/encoding/Base64Helpers.cpp diff --git a/src/bun.js/bindings/Base64Helpers.h b/src/buntime/web/encoding/Base64Helpers.h similarity index 100% rename from src/bun.js/bindings/Base64Helpers.h rename to src/buntime/web/encoding/Base64Helpers.h diff --git a/src/bun.js/bindings/DecodeEscapeSequences.h b/src/buntime/web/encoding/DecodeEscapeSequences.h similarity index 100% rename from src/bun.js/bindings/DecodeEscapeSequences.h rename to src/buntime/web/encoding/DecodeEscapeSequences.h diff --git a/src/bun.js/webcore/EncodingLabel.zig b/src/buntime/web/encoding/EncodingLabel.zig similarity index 100% rename from src/bun.js/webcore/EncodingLabel.zig rename to src/buntime/web/encoding/EncodingLabel.zig diff --git a/src/bun.js/bindings/EncodingTables.cpp b/src/buntime/web/encoding/EncodingTables.cpp similarity index 100% rename from src/bun.js/bindings/EncodingTables.cpp rename to src/buntime/web/encoding/EncodingTables.cpp diff --git a/src/bun.js/bindings/EncodingTables.h b/src/buntime/web/encoding/EncodingTables.h similarity index 100% rename from src/bun.js/bindings/EncodingTables.h rename to src/buntime/web/encoding/EncodingTables.h diff --git a/src/bun.js/bindings/webcore/JSTextDecoderStream.cpp b/src/buntime/web/encoding/JSTextDecoderStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSTextDecoderStream.cpp rename to src/buntime/web/encoding/JSTextDecoderStream.cpp diff --git a/src/bun.js/bindings/webcore/JSTextDecoderStream.h b/src/buntime/web/encoding/JSTextDecoderStream.h similarity index 100% rename from src/bun.js/bindings/webcore/JSTextDecoderStream.h rename to src/buntime/web/encoding/JSTextDecoderStream.h diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.cpp b/src/buntime/web/encoding/JSTextEncoder.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSTextEncoder.cpp rename to src/buntime/web/encoding/JSTextEncoder.cpp diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.h b/src/buntime/web/encoding/JSTextEncoder.h similarity index 100% rename from src/bun.js/bindings/webcore/JSTextEncoder.h rename to src/buntime/web/encoding/JSTextEncoder.h diff --git a/src/bun.js/bindings/webcore/JSTextEncoderStream.cpp b/src/buntime/web/encoding/JSTextEncoderStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSTextEncoderStream.cpp rename to src/buntime/web/encoding/JSTextEncoderStream.cpp diff --git a/src/bun.js/bindings/webcore/JSTextEncoderStream.h b/src/buntime/web/encoding/JSTextEncoderStream.h similarity index 100% rename from src/bun.js/bindings/webcore/JSTextEncoderStream.h rename to src/buntime/web/encoding/JSTextEncoderStream.h diff --git a/src/bun.js/bindings/TextCodec.cpp b/src/buntime/web/encoding/TextCodec.cpp similarity index 100% rename from src/bun.js/bindings/TextCodec.cpp rename to src/buntime/web/encoding/TextCodec.cpp diff --git a/src/bun.js/bindings/TextCodec.h b/src/buntime/web/encoding/TextCodec.h similarity index 100% rename from src/bun.js/bindings/TextCodec.h rename to src/buntime/web/encoding/TextCodec.h diff --git a/src/bun.js/bindings/TextCodec.zig b/src/buntime/web/encoding/TextCodec.zig similarity index 100% rename from src/bun.js/bindings/TextCodec.zig rename to src/buntime/web/encoding/TextCodec.zig diff --git a/src/bun.js/bindings/TextCodecASCIIFastPath.h b/src/buntime/web/encoding/TextCodecASCIIFastPath.h similarity index 100% rename from src/bun.js/bindings/TextCodecASCIIFastPath.h rename to src/buntime/web/encoding/TextCodecASCIIFastPath.h diff --git a/src/bun.js/bindings/TextCodecCJK.cpp b/src/buntime/web/encoding/TextCodecCJK.cpp similarity index 100% rename from src/bun.js/bindings/TextCodecCJK.cpp rename to src/buntime/web/encoding/TextCodecCJK.cpp diff --git a/src/bun.js/bindings/TextCodecCJK.h b/src/buntime/web/encoding/TextCodecCJK.h similarity index 100% rename from src/bun.js/bindings/TextCodecCJK.h rename to src/buntime/web/encoding/TextCodecCJK.h diff --git a/src/bun.js/bindings/TextCodecReplacement.cpp b/src/buntime/web/encoding/TextCodecReplacement.cpp similarity index 100% rename from src/bun.js/bindings/TextCodecReplacement.cpp rename to src/buntime/web/encoding/TextCodecReplacement.cpp diff --git a/src/bun.js/bindings/TextCodecReplacement.h b/src/buntime/web/encoding/TextCodecReplacement.h similarity index 100% rename from src/bun.js/bindings/TextCodecReplacement.h rename to src/buntime/web/encoding/TextCodecReplacement.h diff --git a/src/bun.js/bindings/TextCodecSingleByte.cpp b/src/buntime/web/encoding/TextCodecSingleByte.cpp similarity index 100% rename from src/bun.js/bindings/TextCodecSingleByte.cpp rename to src/buntime/web/encoding/TextCodecSingleByte.cpp diff --git a/src/bun.js/bindings/TextCodecSingleByte.h b/src/buntime/web/encoding/TextCodecSingleByte.h similarity index 100% rename from src/bun.js/bindings/TextCodecSingleByte.h rename to src/buntime/web/encoding/TextCodecSingleByte.h diff --git a/src/bun.js/bindings/TextCodecUserDefined.cpp b/src/buntime/web/encoding/TextCodecUserDefined.cpp similarity index 100% rename from src/bun.js/bindings/TextCodecUserDefined.cpp rename to src/buntime/web/encoding/TextCodecUserDefined.cpp diff --git a/src/bun.js/bindings/TextCodecUserDefined.h b/src/buntime/web/encoding/TextCodecUserDefined.h similarity index 100% rename from src/bun.js/bindings/TextCodecUserDefined.h rename to src/buntime/web/encoding/TextCodecUserDefined.h diff --git a/src/bun.js/bindings/TextCodecWrapper.cpp b/src/buntime/web/encoding/TextCodecWrapper.cpp similarity index 100% rename from src/bun.js/bindings/TextCodecWrapper.cpp rename to src/buntime/web/encoding/TextCodecWrapper.cpp diff --git a/src/bun.js/webcore/TextDecoder.zig b/src/buntime/web/encoding/TextDecoder.zig similarity index 99% rename from src/bun.js/webcore/TextDecoder.zig rename to src/buntime/web/encoding/TextDecoder.zig index 0953a5a1c546..9d246a4e037a 100644 --- a/src/bun.js/webcore/TextDecoder.zig +++ b/src/buntime/web/encoding/TextDecoder.zig @@ -190,7 +190,7 @@ pub fn decodeWithoutTypeChecks(this: *TextDecoder, globalThis: *jsc.JSGlobalObje } fn decodeSlice(this: *TextDecoder, globalThis: *jsc.JSGlobalObject, buffer_slice: []const u8, comptime flush: bool) bun.JSError!JSValue { - const TextCodec = @import("../bindings/TextCodec.zig").TextCodec; + const TextCodec = @import("./TextCodec.zig").TextCodec; switch (this.encoding) { EncodingLabel.latin1 => { diff --git a/src/bun.js/bindings/webcore/TextEncoder.cpp b/src/buntime/web/encoding/TextEncoder.cpp similarity index 100% rename from src/bun.js/bindings/webcore/TextEncoder.cpp rename to src/buntime/web/encoding/TextEncoder.cpp diff --git a/src/bun.js/bindings/webcore/TextEncoder.h b/src/buntime/web/encoding/TextEncoder.h similarity index 100% rename from src/bun.js/bindings/webcore/TextEncoder.h rename to src/buntime/web/encoding/TextEncoder.h diff --git a/src/bun.js/webcore/TextEncoder.zig b/src/buntime/web/encoding/TextEncoder.zig similarity index 100% rename from src/bun.js/webcore/TextEncoder.zig rename to src/buntime/web/encoding/TextEncoder.zig diff --git a/src/bun.js/webcore/TextEncoderStreamEncoder.zig b/src/buntime/web/encoding/TextEncoderStreamEncoder.zig similarity index 100% rename from src/bun.js/webcore/TextEncoderStreamEncoder.zig rename to src/buntime/web/encoding/TextEncoderStreamEncoder.zig diff --git a/src/bun.js/bindings/TextEncoding.cpp b/src/buntime/web/encoding/TextEncoding.cpp similarity index 100% rename from src/bun.js/bindings/TextEncoding.cpp rename to src/buntime/web/encoding/TextEncoding.cpp diff --git a/src/bun.js/bindings/TextEncoding.h b/src/buntime/web/encoding/TextEncoding.h similarity index 100% rename from src/bun.js/bindings/TextEncoding.h rename to src/buntime/web/encoding/TextEncoding.h diff --git a/src/bun.js/bindings/TextEncodingRegistry.cpp b/src/buntime/web/encoding/TextEncodingRegistry.cpp similarity index 100% rename from src/bun.js/bindings/TextEncodingRegistry.cpp rename to src/buntime/web/encoding/TextEncodingRegistry.cpp diff --git a/src/bun.js/bindings/TextEncodingRegistry.h b/src/buntime/web/encoding/TextEncodingRegistry.h similarity index 100% rename from src/bun.js/bindings/TextEncodingRegistry.h rename to src/buntime/web/encoding/TextEncodingRegistry.h diff --git a/src/bun.js/bindings/UnencodableHandling.h b/src/buntime/web/encoding/UnencodableHandling.h similarity index 100% rename from src/bun.js/bindings/UnencodableHandling.h rename to src/buntime/web/encoding/UnencodableHandling.h diff --git a/src/bun.js/webcore/encoding.classes.ts b/src/buntime/web/encoding/encoding.classes.ts similarity index 94% rename from src/bun.js/webcore/encoding.classes.ts rename to src/buntime/web/encoding/encoding.classes.ts index b26078ccc1fa..8d5dbc660593 100644 --- a/src/bun.js/webcore/encoding.classes.ts +++ b/src/buntime/web/encoding/encoding.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../../codegen/class-definitions"; +import { define } from "../../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/webcore/encoding.zig b/src/buntime/web/encoding/encoding.zig similarity index 100% rename from src/bun.js/webcore/encoding.zig rename to src/buntime/web/encoding/encoding.zig diff --git a/src/bun.js/bindings/webcore/AbortAlgorithm.h b/src/buntime/web/events/AbortAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcore/AbortAlgorithm.h rename to src/buntime/web/events/AbortAlgorithm.h diff --git a/src/bun.js/bindings/webcore/AbortAlgorithm.idl b/src/buntime/web/events/AbortAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcore/AbortAlgorithm.idl rename to src/buntime/web/events/AbortAlgorithm.idl diff --git a/src/bun.js/bindings/webcore/AbortController.cpp b/src/buntime/web/events/AbortController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/AbortController.cpp rename to src/buntime/web/events/AbortController.cpp diff --git a/src/bun.js/bindings/webcore/AbortController.h b/src/buntime/web/events/AbortController.h similarity index 100% rename from src/bun.js/bindings/webcore/AbortController.h rename to src/buntime/web/events/AbortController.h diff --git a/src/bun.js/bindings/webcore/AbortController.idl b/src/buntime/web/events/AbortController.idl similarity index 100% rename from src/bun.js/bindings/webcore/AbortController.idl rename to src/buntime/web/events/AbortController.idl diff --git a/src/bun.js/bindings/webcore/AbortSignal.cpp b/src/buntime/web/events/AbortSignal.cpp similarity index 100% rename from src/bun.js/bindings/webcore/AbortSignal.cpp rename to src/buntime/web/events/AbortSignal.cpp diff --git a/src/bun.js/bindings/webcore/AbortSignal.h b/src/buntime/web/events/AbortSignal.h similarity index 100% rename from src/bun.js/bindings/webcore/AbortSignal.h rename to src/buntime/web/events/AbortSignal.h diff --git a/src/bun.js/bindings/webcore/AbortSignal.idl b/src/buntime/web/events/AbortSignal.idl similarity index 100% rename from src/bun.js/bindings/webcore/AbortSignal.idl rename to src/buntime/web/events/AbortSignal.idl diff --git a/src/bun.js/bindings/AbortSignal.zig b/src/buntime/web/events/AbortSignal.zig similarity index 100% rename from src/bun.js/bindings/AbortSignal.zig rename to src/buntime/web/events/AbortSignal.zig diff --git a/src/bun.js/bindings/webcore/AddEventListenerOptions.h b/src/buntime/web/events/AddEventListenerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/AddEventListenerOptions.h rename to src/buntime/web/events/AddEventListenerOptions.h diff --git a/src/bun.js/bindings/webcore/BroadcastChannel.cpp b/src/buntime/web/events/BroadcastChannel.cpp similarity index 100% rename from src/bun.js/bindings/webcore/BroadcastChannel.cpp rename to src/buntime/web/events/BroadcastChannel.cpp diff --git a/src/bun.js/bindings/webcore/BroadcastChannel.h b/src/buntime/web/events/BroadcastChannel.h similarity index 100% rename from src/bun.js/bindings/webcore/BroadcastChannel.h rename to src/buntime/web/events/BroadcastChannel.h diff --git a/src/bun.js/bindings/webcore/BroadcastChannelIdentifier.h b/src/buntime/web/events/BroadcastChannelIdentifier.h similarity index 100% rename from src/bun.js/bindings/webcore/BroadcastChannelIdentifier.h rename to src/buntime/web/events/BroadcastChannelIdentifier.h diff --git a/src/bun.js/bindings/webcore/BroadcastChannelRegistry.h b/src/buntime/web/events/BroadcastChannelRegistry.h similarity index 100% rename from src/bun.js/bindings/webcore/BroadcastChannelRegistry.h rename to src/buntime/web/events/BroadcastChannelRegistry.h diff --git a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp b/src/buntime/web/events/BunBroadcastChannelRegistry.cpp similarity index 95% rename from src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp rename to src/buntime/web/events/BunBroadcastChannelRegistry.cpp index e8155aa9935e..f4f354fa3f84 100644 --- a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp +++ b/src/buntime/web/events/BunBroadcastChannelRegistry.cpp @@ -1,8 +1,8 @@ #include "config.h" #include "BunBroadcastChannelRegistry.h" -#include "webcore/BroadcastChannel.h" -#include "webcore/MessageWithMessagePorts.h" +#include "BroadcastChannel.h" +#include "MessageWithMessagePorts.h" #include namespace WebCore { diff --git a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h b/src/buntime/web/events/BunBroadcastChannelRegistry.h similarity index 100% rename from src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.h rename to src/buntime/web/events/BunBroadcastChannelRegistry.h diff --git a/src/bun.js/bindings/webcore/CloseEvent.cpp b/src/buntime/web/events/CloseEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/CloseEvent.cpp rename to src/buntime/web/events/CloseEvent.cpp diff --git a/src/bun.js/bindings/webcore/CloseEvent.h b/src/buntime/web/events/CloseEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/CloseEvent.h rename to src/buntime/web/events/CloseEvent.h diff --git a/src/bun.js/bindings/webcore/CloseEvent.idl b/src/buntime/web/events/CloseEvent.idl similarity index 100% rename from src/bun.js/bindings/webcore/CloseEvent.idl rename to src/buntime/web/events/CloseEvent.idl diff --git a/src/bun.js/bindings/CommonAbortReason.zig b/src/buntime/web/events/CommonAbortReason.zig similarity index 100% rename from src/bun.js/bindings/CommonAbortReason.zig rename to src/buntime/web/events/CommonAbortReason.zig diff --git a/src/bun.js/bindings/webcore/CustomEvent.cpp b/src/buntime/web/events/CustomEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/CustomEvent.cpp rename to src/buntime/web/events/CustomEvent.cpp diff --git a/src/bun.js/bindings/webcore/CustomEvent.h b/src/buntime/web/events/CustomEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/CustomEvent.h rename to src/buntime/web/events/CustomEvent.h diff --git a/src/bun.js/bindings/webcore/CustomEvent.idl b/src/buntime/web/events/CustomEvent.idl similarity index 100% rename from src/bun.js/bindings/webcore/CustomEvent.idl rename to src/buntime/web/events/CustomEvent.idl diff --git a/src/bun.js/bindings/webcore/CustomEventCustom.cpp b/src/buntime/web/events/CustomEventCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/CustomEventCustom.cpp rename to src/buntime/web/events/CustomEventCustom.cpp diff --git a/src/bun.js/bindings/webcore/ErrorEvent.cpp b/src/buntime/web/events/ErrorEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ErrorEvent.cpp rename to src/buntime/web/events/ErrorEvent.cpp diff --git a/src/bun.js/bindings/webcore/ErrorEvent.h b/src/buntime/web/events/ErrorEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/ErrorEvent.h rename to src/buntime/web/events/ErrorEvent.h diff --git a/src/bun.js/bindings/webcore/ErrorEvent.idl b/src/buntime/web/events/ErrorEvent.idl similarity index 100% rename from src/bun.js/bindings/webcore/ErrorEvent.idl rename to src/buntime/web/events/ErrorEvent.idl diff --git a/src/bun.js/bindings/webcore/Event.cpp b/src/buntime/web/events/Event.cpp similarity index 100% rename from src/bun.js/bindings/webcore/Event.cpp rename to src/buntime/web/events/Event.cpp diff --git a/src/bun.js/bindings/webcore/Event.h b/src/buntime/web/events/Event.h similarity index 100% rename from src/bun.js/bindings/webcore/Event.h rename to src/buntime/web/events/Event.h diff --git a/src/bun.js/bindings/webcore/Event.idl b/src/buntime/web/events/Event.idl similarity index 100% rename from src/bun.js/bindings/webcore/Event.idl rename to src/buntime/web/events/Event.idl diff --git a/src/bun.js/bindings/webcore/EventContext.cpp b/src/buntime/web/events/EventContext.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventContext.cpp rename to src/buntime/web/events/EventContext.cpp diff --git a/src/bun.js/bindings/webcore/EventContext.h b/src/buntime/web/events/EventContext.h similarity index 100% rename from src/bun.js/bindings/webcore/EventContext.h rename to src/buntime/web/events/EventContext.h diff --git a/src/bun.js/bindings/webcore/EventDispatcher.cpp b/src/buntime/web/events/EventDispatcher.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventDispatcher.cpp rename to src/buntime/web/events/EventDispatcher.cpp diff --git a/src/bun.js/bindings/webcore/EventDispatcher.h b/src/buntime/web/events/EventDispatcher.h similarity index 100% rename from src/bun.js/bindings/webcore/EventDispatcher.h rename to src/buntime/web/events/EventDispatcher.h diff --git a/src/bun.js/bindings/webcore/EventEmitter.cpp b/src/buntime/web/events/EventEmitter.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventEmitter.cpp rename to src/buntime/web/events/EventEmitter.cpp diff --git a/src/bun.js/bindings/webcore/EventEmitter.h b/src/buntime/web/events/EventEmitter.h similarity index 100% rename from src/bun.js/bindings/webcore/EventEmitter.h rename to src/buntime/web/events/EventEmitter.h diff --git a/src/bun.js/bindings/webcore/EventFactory.cpp b/src/buntime/web/events/EventFactory.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventFactory.cpp rename to src/buntime/web/events/EventFactory.cpp diff --git a/src/bun.js/bindings/webcore/EventHeaders.h b/src/buntime/web/events/EventHeaders.h similarity index 100% rename from src/bun.js/bindings/webcore/EventHeaders.h rename to src/buntime/web/events/EventHeaders.h diff --git a/src/bun.js/bindings/webcore/EventInit.h b/src/buntime/web/events/EventInit.h similarity index 100% rename from src/bun.js/bindings/webcore/EventInit.h rename to src/buntime/web/events/EventInit.h diff --git a/src/bun.js/bindings/webcore/EventInit.idl b/src/buntime/web/events/EventInit.idl similarity index 100% rename from src/bun.js/bindings/webcore/EventInit.idl rename to src/buntime/web/events/EventInit.idl diff --git a/src/bun.js/bindings/webcore/EventInterfaces.h b/src/buntime/web/events/EventInterfaces.h similarity index 100% rename from src/bun.js/bindings/webcore/EventInterfaces.h rename to src/buntime/web/events/EventInterfaces.h diff --git a/src/bun.js/bindings/webcore/EventListener.h b/src/buntime/web/events/EventListener.h similarity index 100% rename from src/bun.js/bindings/webcore/EventListener.h rename to src/buntime/web/events/EventListener.h diff --git a/src/bun.js/bindings/webcore/EventListener.idl b/src/buntime/web/events/EventListener.idl similarity index 100% rename from src/bun.js/bindings/webcore/EventListener.idl rename to src/buntime/web/events/EventListener.idl diff --git a/src/bun.js/bindings/webcore/EventListenerMap.cpp b/src/buntime/web/events/EventListenerMap.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventListenerMap.cpp rename to src/buntime/web/events/EventListenerMap.cpp diff --git a/src/bun.js/bindings/webcore/EventListenerMap.h b/src/buntime/web/events/EventListenerMap.h similarity index 100% rename from src/bun.js/bindings/webcore/EventListenerMap.h rename to src/buntime/web/events/EventListenerMap.h diff --git a/src/bun.js/bindings/webcore/EventListenerOptions.h b/src/buntime/web/events/EventListenerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/EventListenerOptions.h rename to src/buntime/web/events/EventListenerOptions.h diff --git a/src/bun.js/bindings/webcore/EventListenerOptions.idl b/src/buntime/web/events/EventListenerOptions.idl similarity index 100% rename from src/bun.js/bindings/webcore/EventListenerOptions.idl rename to src/buntime/web/events/EventListenerOptions.idl diff --git a/src/bun.js/bindings/webcore/EventModifierInit.h b/src/buntime/web/events/EventModifierInit.h similarity index 100% rename from src/bun.js/bindings/webcore/EventModifierInit.h rename to src/buntime/web/events/EventModifierInit.h diff --git a/src/bun.js/bindings/webcore/EventNames.cpp b/src/buntime/web/events/EventNames.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventNames.cpp rename to src/buntime/web/events/EventNames.cpp diff --git a/src/bun.js/bindings/webcore/EventNames.h b/src/buntime/web/events/EventNames.h similarity index 100% rename from src/bun.js/bindings/webcore/EventNames.h rename to src/buntime/web/events/EventNames.h diff --git a/src/bun.js/bindings/webcore/EventNames.in b/src/buntime/web/events/EventNames.in similarity index 100% rename from src/bun.js/bindings/webcore/EventNames.in rename to src/buntime/web/events/EventNames.in diff --git a/src/bun.js/bindings/webcore/EventOptions.h b/src/buntime/web/events/EventOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/EventOptions.h rename to src/buntime/web/events/EventOptions.h diff --git a/src/bun.js/bindings/webcore/EventPath.cpp b/src/buntime/web/events/EventPath.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventPath.cpp rename to src/buntime/web/events/EventPath.cpp diff --git a/src/bun.js/bindings/webcore/EventPath.h b/src/buntime/web/events/EventPath.h similarity index 100% rename from src/bun.js/bindings/webcore/EventPath.h rename to src/buntime/web/events/EventPath.h diff --git a/src/bun.js/bindings/webcore/EventSender.h b/src/buntime/web/events/EventSender.h similarity index 100% rename from src/bun.js/bindings/webcore/EventSender.h rename to src/buntime/web/events/EventSender.h diff --git a/src/bun.js/bindings/webcore/EventTarget.cpp b/src/buntime/web/events/EventTarget.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventTarget.cpp rename to src/buntime/web/events/EventTarget.cpp diff --git a/src/bun.js/bindings/webcore/EventTarget.h b/src/buntime/web/events/EventTarget.h similarity index 100% rename from src/bun.js/bindings/webcore/EventTarget.h rename to src/buntime/web/events/EventTarget.h diff --git a/src/bun.js/bindings/webcore/EventTarget.idl b/src/buntime/web/events/EventTarget.idl similarity index 100% rename from src/bun.js/bindings/webcore/EventTarget.idl rename to src/buntime/web/events/EventTarget.idl diff --git a/src/bun.js/bindings/webcore/EventTargetConcrete.cpp b/src/buntime/web/events/EventTargetConcrete.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventTargetConcrete.cpp rename to src/buntime/web/events/EventTargetConcrete.cpp diff --git a/src/bun.js/bindings/webcore/EventTargetConcrete.h b/src/buntime/web/events/EventTargetConcrete.h similarity index 100% rename from src/bun.js/bindings/webcore/EventTargetConcrete.h rename to src/buntime/web/events/EventTargetConcrete.h diff --git a/src/bun.js/bindings/webcore/EventTargetFactory.cpp b/src/buntime/web/events/EventTargetFactory.cpp similarity index 100% rename from src/bun.js/bindings/webcore/EventTargetFactory.cpp rename to src/buntime/web/events/EventTargetFactory.cpp diff --git a/src/bun.js/bindings/webcore/EventTargetHeaders.h b/src/buntime/web/events/EventTargetHeaders.h similarity index 100% rename from src/bun.js/bindings/webcore/EventTargetHeaders.h rename to src/buntime/web/events/EventTargetHeaders.h diff --git a/src/bun.js/bindings/webcore/EventTargetInterfaces.h b/src/buntime/web/events/EventTargetInterfaces.h similarity index 100% rename from src/bun.js/bindings/webcore/EventTargetInterfaces.h rename to src/buntime/web/events/EventTargetInterfaces.h diff --git a/src/bun.js/bindings/EventType.zig b/src/buntime/web/events/EventType.zig similarity index 100% rename from src/bun.js/bindings/EventType.zig rename to src/buntime/web/events/EventType.zig diff --git a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp b/src/buntime/web/events/IdentifierEventListenerMap.cpp similarity index 100% rename from src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp rename to src/buntime/web/events/IdentifierEventListenerMap.cpp diff --git a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.h b/src/buntime/web/events/IdentifierEventListenerMap.h similarity index 100% rename from src/bun.js/bindings/webcore/IdentifierEventListenerMap.h rename to src/buntime/web/events/IdentifierEventListenerMap.h diff --git a/src/bun.js/bindings/webcore/JSAbortAlgorithm.cpp b/src/buntime/web/events/JSAbortAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortAlgorithm.cpp rename to src/buntime/web/events/JSAbortAlgorithm.cpp diff --git a/src/bun.js/bindings/webcore/JSAbortAlgorithm.h b/src/buntime/web/events/JSAbortAlgorithm.h similarity index 98% rename from src/bun.js/bindings/webcore/JSAbortAlgorithm.h rename to src/buntime/web/events/JSAbortAlgorithm.h index 441bfe8cce2a..74cc2487d2c9 100644 --- a/src/bun.js/bindings/webcore/JSAbortAlgorithm.h +++ b/src/buntime/web/events/JSAbortAlgorithm.h @@ -40,7 +40,7 @@ class JSAbortAlgorithm final : public AbortAlgorithm { JSCallbackDataStrong* callbackData() { return m_data; } // Functions - CallbackResult handleEvent(JSValue) override; + CallbackResult handleEvent(JSC::JSValue) override; private: JSAbortAlgorithm(JSC::VM&, JSC::JSObject* callback); diff --git a/src/bun.js/bindings/webcore/JSAbortController.cpp b/src/buntime/web/events/JSAbortController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortController.cpp rename to src/buntime/web/events/JSAbortController.cpp diff --git a/src/bun.js/bindings/webcore/JSAbortController.h b/src/buntime/web/events/JSAbortController.h similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortController.h rename to src/buntime/web/events/JSAbortController.h diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.cpp b/src/buntime/web/events/JSAbortSignal.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortSignal.cpp rename to src/buntime/web/events/JSAbortSignal.cpp diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.h b/src/buntime/web/events/JSAbortSignal.h similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortSignal.h rename to src/buntime/web/events/JSAbortSignal.h diff --git a/src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp b/src/buntime/web/events/JSAbortSignalCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp rename to src/buntime/web/events/JSAbortSignalCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSAddEventListenerOptions.cpp b/src/buntime/web/events/JSAddEventListenerOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSAddEventListenerOptions.cpp rename to src/buntime/web/events/JSAddEventListenerOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSAddEventListenerOptions.h b/src/buntime/web/events/JSAddEventListenerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSAddEventListenerOptions.h rename to src/buntime/web/events/JSAddEventListenerOptions.h diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp b/src/buntime/web/events/JSBroadcastChannel.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSBroadcastChannel.cpp rename to src/buntime/web/events/JSBroadcastChannel.cpp diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.h b/src/buntime/web/events/JSBroadcastChannel.h similarity index 100% rename from src/bun.js/bindings/webcore/JSBroadcastChannel.h rename to src/buntime/web/events/JSBroadcastChannel.h diff --git a/src/bun.js/bindings/webcore/JSCloseEvent.cpp b/src/buntime/web/events/JSCloseEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSCloseEvent.cpp rename to src/buntime/web/events/JSCloseEvent.cpp diff --git a/src/bun.js/bindings/webcore/JSCloseEvent.h b/src/buntime/web/events/JSCloseEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCloseEvent.h rename to src/buntime/web/events/JSCloseEvent.h diff --git a/src/bun.js/bindings/webcore/JSCustomEvent.cpp b/src/buntime/web/events/JSCustomEvent.cpp similarity index 99% rename from src/bun.js/bindings/webcore/JSCustomEvent.cpp rename to src/buntime/web/events/JSCustomEvent.cpp index bff23a2b3a17..91ae85fa60eb 100644 --- a/src/bun.js/bindings/webcore/JSCustomEvent.cpp +++ b/src/buntime/web/events/JSCustomEvent.cpp @@ -47,7 +47,7 @@ #include #include #include -#include "../ErrorCode.h" +#include "ErrorCode.h" namespace WebCore { using namespace JSC; diff --git a/src/bun.js/bindings/webcore/JSCustomEvent.h b/src/buntime/web/events/JSCustomEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCustomEvent.h rename to src/buntime/web/events/JSCustomEvent.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertEventListener.h b/src/buntime/web/events/JSDOMConvertEventListener.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertEventListener.h rename to src/buntime/web/events/JSDOMConvertEventListener.h diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.cpp b/src/buntime/web/events/JSErrorEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorEvent.cpp rename to src/buntime/web/events/JSErrorEvent.cpp diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.h b/src/buntime/web/events/JSErrorEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorEvent.h rename to src/buntime/web/events/JSErrorEvent.h diff --git a/src/bun.js/bindings/webcore/JSErrorEventCustom.cpp b/src/buntime/web/events/JSErrorEventCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSErrorEventCustom.cpp rename to src/buntime/web/events/JSErrorEventCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSEvent.cpp b/src/buntime/web/events/JSEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEvent.cpp rename to src/buntime/web/events/JSEvent.cpp diff --git a/src/bun.js/bindings/webcore/JSEvent.h b/src/buntime/web/events/JSEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEvent.h rename to src/buntime/web/events/JSEvent.h diff --git a/src/bun.js/bindings/webcore/JSEventCustom.cpp b/src/buntime/web/events/JSEventCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventCustom.cpp rename to src/buntime/web/events/JSEventCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSEventCustom.h b/src/buntime/web/events/JSEventCustom.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventCustom.h rename to src/buntime/web/events/JSEventCustom.h diff --git a/src/bun.js/bindings/webcore/JSEventDOMJIT.cpp b/src/buntime/web/events/JSEventDOMJIT.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventDOMJIT.cpp rename to src/buntime/web/events/JSEventDOMJIT.cpp diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/buntime/web/events/JSEventEmitter.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventEmitter.cpp rename to src/buntime/web/events/JSEventEmitter.cpp diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.h b/src/buntime/web/events/JSEventEmitter.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventEmitter.h rename to src/buntime/web/events/JSEventEmitter.h diff --git a/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp b/src/buntime/web/events/JSEventEmitterCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp rename to src/buntime/web/events/JSEventEmitterCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSEventEmitterCustom.h b/src/buntime/web/events/JSEventEmitterCustom.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventEmitterCustom.h rename to src/buntime/web/events/JSEventEmitterCustom.h diff --git a/src/bun.js/bindings/webcore/JSEventInit.cpp b/src/buntime/web/events/JSEventInit.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventInit.cpp rename to src/buntime/web/events/JSEventInit.cpp diff --git a/src/bun.js/bindings/webcore/JSEventInit.h b/src/buntime/web/events/JSEventInit.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventInit.h rename to src/buntime/web/events/JSEventInit.h diff --git a/src/bun.js/bindings/webcore/JSEventListener.cpp b/src/buntime/web/events/JSEventListener.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventListener.cpp rename to src/buntime/web/events/JSEventListener.cpp diff --git a/src/bun.js/bindings/webcore/JSEventListener.h b/src/buntime/web/events/JSEventListener.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventListener.h rename to src/buntime/web/events/JSEventListener.h diff --git a/src/bun.js/bindings/webcore/JSEventListenerOptions.cpp b/src/buntime/web/events/JSEventListenerOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventListenerOptions.cpp rename to src/buntime/web/events/JSEventListenerOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSEventListenerOptions.h b/src/buntime/web/events/JSEventListenerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventListenerOptions.h rename to src/buntime/web/events/JSEventListenerOptions.h diff --git a/src/bun.js/bindings/webcore/JSEventModifierInit.cpp b/src/buntime/web/events/JSEventModifierInit.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventModifierInit.cpp rename to src/buntime/web/events/JSEventModifierInit.cpp diff --git a/src/bun.js/bindings/webcore/JSEventModifierInit.h b/src/buntime/web/events/JSEventModifierInit.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventModifierInit.h rename to src/buntime/web/events/JSEventModifierInit.h diff --git a/src/bun.js/bindings/webcore/JSEventTarget.cpp b/src/buntime/web/events/JSEventTarget.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventTarget.cpp rename to src/buntime/web/events/JSEventTarget.cpp diff --git a/src/bun.js/bindings/webcore/JSEventTarget.h b/src/buntime/web/events/JSEventTarget.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventTarget.h rename to src/buntime/web/events/JSEventTarget.h diff --git a/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp b/src/buntime/web/events/JSEventTargetCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSEventTargetCustom.cpp rename to src/buntime/web/events/JSEventTargetCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSEventTargetCustom.h b/src/buntime/web/events/JSEventTargetCustom.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventTargetCustom.h rename to src/buntime/web/events/JSEventTargetCustom.h diff --git a/src/bun.js/bindings/webcore/JSEventTargetNode.cpp b/src/buntime/web/events/JSEventTargetNode.cpp similarity index 98% rename from src/bun.js/bindings/webcore/JSEventTargetNode.cpp rename to src/buntime/web/events/JSEventTargetNode.cpp index fa4c3159c319..357a6f3dcdfe 100644 --- a/src/bun.js/bindings/webcore/JSEventTargetNode.cpp +++ b/src/buntime/web/events/JSEventTargetNode.cpp @@ -8,7 +8,7 @@ #include "JSEventTarget.h" #include "JavaScriptCore/JSArray.h" #include "wtf/text/MakeString.h" -#include "../ErrorCode.h" +#include "ErrorCode.h" namespace Bun { diff --git a/src/bun.js/bindings/webcore/JSEventTargetNode.h b/src/buntime/web/events/JSEventTargetNode.h similarity index 100% rename from src/bun.js/bindings/webcore/JSEventTargetNode.h rename to src/buntime/web/events/JSEventTargetNode.h diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.cpp b/src/buntime/web/events/JSMessageEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageEvent.cpp rename to src/buntime/web/events/JSMessageEvent.cpp diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.h b/src/buntime/web/events/JSMessageEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageEvent.h rename to src/buntime/web/events/JSMessageEvent.h diff --git a/src/bun.js/bindings/webcore/JSMessageEventCustom.cpp b/src/buntime/web/events/JSMessageEventCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageEventCustom.cpp rename to src/buntime/web/events/JSMessageEventCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSMessagePort.cpp b/src/buntime/web/events/JSMessagePort.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessagePort.cpp rename to src/buntime/web/events/JSMessagePort.cpp diff --git a/src/bun.js/bindings/webcore/JSMessagePort.h b/src/buntime/web/events/JSMessagePort.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMessagePort.h rename to src/buntime/web/events/JSMessagePort.h diff --git a/src/bun.js/bindings/webcore/JSMessagePortCustom.cpp b/src/buntime/web/events/JSMessagePortCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessagePortCustom.cpp rename to src/buntime/web/events/JSMessagePortCustom.cpp diff --git a/src/bun.js/bindings/webcore/MessageEvent.cpp b/src/buntime/web/events/MessageEvent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessageEvent.cpp rename to src/buntime/web/events/MessageEvent.cpp diff --git a/src/bun.js/bindings/webcore/MessageEvent.h b/src/buntime/web/events/MessageEvent.h similarity index 100% rename from src/bun.js/bindings/webcore/MessageEvent.h rename to src/buntime/web/events/MessageEvent.h diff --git a/src/bun.js/bindings/webcore/MessageEvent.idl b/src/buntime/web/events/MessageEvent.idl similarity index 100% rename from src/bun.js/bindings/webcore/MessageEvent.idl rename to src/buntime/web/events/MessageEvent.idl diff --git a/src/bun.js/bindings/webcore/MessagePort.cpp b/src/buntime/web/events/MessagePort.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessagePort.cpp rename to src/buntime/web/events/MessagePort.cpp diff --git a/src/bun.js/bindings/webcore/MessagePort.h b/src/buntime/web/events/MessagePort.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePort.h rename to src/buntime/web/events/MessagePort.h diff --git a/src/bun.js/bindings/webcore/MessagePortChannel.cpp b/src/buntime/web/events/MessagePortChannel.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannel.cpp rename to src/buntime/web/events/MessagePortChannel.cpp diff --git a/src/bun.js/bindings/webcore/MessagePortChannel.h b/src/buntime/web/events/MessagePortChannel.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannel.h rename to src/buntime/web/events/MessagePortChannel.h diff --git a/src/bun.js/bindings/webcore/MessagePortChannelProvider.cpp b/src/buntime/web/events/MessagePortChannelProvider.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelProvider.cpp rename to src/buntime/web/events/MessagePortChannelProvider.cpp diff --git a/src/bun.js/bindings/webcore/MessagePortChannelProvider.h b/src/buntime/web/events/MessagePortChannelProvider.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelProvider.h rename to src/buntime/web/events/MessagePortChannelProvider.h diff --git a/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp b/src/buntime/web/events/MessagePortChannelProviderImpl.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp rename to src/buntime/web/events/MessagePortChannelProviderImpl.cpp diff --git a/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.h b/src/buntime/web/events/MessagePortChannelProviderImpl.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.h rename to src/buntime/web/events/MessagePortChannelProviderImpl.h diff --git a/src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp b/src/buntime/web/events/MessagePortChannelRegistry.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp rename to src/buntime/web/events/MessagePortChannelRegistry.cpp diff --git a/src/bun.js/bindings/webcore/MessagePortChannelRegistry.h b/src/buntime/web/events/MessagePortChannelRegistry.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortChannelRegistry.h rename to src/buntime/web/events/MessagePortChannelRegistry.h diff --git a/src/bun.js/bindings/webcore/MessagePortIdentifier.h b/src/buntime/web/events/MessagePortIdentifier.h similarity index 100% rename from src/bun.js/bindings/webcore/MessagePortIdentifier.h rename to src/buntime/web/events/MessagePortIdentifier.h diff --git a/src/bun.js/bindings/webcore/MessageWithMessagePorts.h b/src/buntime/web/events/MessageWithMessagePorts.h similarity index 100% rename from src/bun.js/bindings/webcore/MessageWithMessagePorts.h rename to src/buntime/web/events/MessageWithMessagePorts.h diff --git a/src/bun.js/bindings/webcore/RegisteredEventListener.h b/src/buntime/web/events/RegisteredEventListener.h similarity index 100% rename from src/bun.js/bindings/webcore/RegisteredEventListener.h rename to src/buntime/web/events/RegisteredEventListener.h diff --git a/src/bun.js/bindings/webcore/TransferredMessagePort.h b/src/buntime/web/events/TransferredMessagePort.h similarity index 100% rename from src/bun.js/bindings/webcore/TransferredMessagePort.h rename to src/buntime/web/events/TransferredMessagePort.h diff --git a/src/bun.js/bindings/webcore/UIEventInit.h b/src/buntime/web/events/UIEventInit.h similarity index 100% rename from src/bun.js/bindings/webcore/UIEventInit.h rename to src/buntime/web/events/UIEventInit.h diff --git a/src/bun.js/bindings/webcore/FetchHeaders.cpp b/src/buntime/web/fetch/FetchHeaders.cpp similarity index 100% rename from src/bun.js/bindings/webcore/FetchHeaders.cpp rename to src/buntime/web/fetch/FetchHeaders.cpp diff --git a/src/bun.js/bindings/webcore/FetchHeaders.h b/src/buntime/web/fetch/FetchHeaders.h similarity index 100% rename from src/bun.js/bindings/webcore/FetchHeaders.h rename to src/buntime/web/fetch/FetchHeaders.h diff --git a/src/bun.js/bindings/webcore/FetchHeaders.idl b/src/buntime/web/fetch/FetchHeaders.idl similarity index 100% rename from src/bun.js/bindings/webcore/FetchHeaders.idl rename to src/buntime/web/fetch/FetchHeaders.idl diff --git a/src/bun.js/bindings/FetchHeaders.zig b/src/buntime/web/fetch/FetchHeaders.zig similarity index 100% rename from src/bun.js/bindings/FetchHeaders.zig rename to src/buntime/web/fetch/FetchHeaders.zig diff --git a/src/bun.js/webcore/fetch/FetchTasklet.zig b/src/buntime/web/fetch/FetchTasklet.zig similarity index 100% rename from src/bun.js/webcore/fetch/FetchTasklet.zig rename to src/buntime/web/fetch/FetchTasklet.zig diff --git a/src/bun.js/bindings/webcore/HTTPHeaderField.cpp b/src/buntime/web/fetch/HTTPHeaderField.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderField.cpp rename to src/buntime/web/fetch/HTTPHeaderField.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderField.h b/src/buntime/web/fetch/HTTPHeaderField.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderField.h rename to src/buntime/web/fetch/HTTPHeaderField.h diff --git a/src/bun.js/bindings/webcore/HTTPHeaderIdentifiers.cpp b/src/buntime/web/fetch/HTTPHeaderIdentifiers.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderIdentifiers.cpp rename to src/buntime/web/fetch/HTTPHeaderIdentifiers.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderIdentifiers.h b/src/buntime/web/fetch/HTTPHeaderIdentifiers.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderIdentifiers.h rename to src/buntime/web/fetch/HTTPHeaderIdentifiers.h diff --git a/src/bun.js/bindings/webcore/HTTPHeaderMap.cpp b/src/buntime/web/fetch/HTTPHeaderMap.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderMap.cpp rename to src/buntime/web/fetch/HTTPHeaderMap.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderMap.h b/src/buntime/web/fetch/HTTPHeaderMap.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderMap.h rename to src/buntime/web/fetch/HTTPHeaderMap.h diff --git a/src/bun.js/bindings/webcore/HTTPHeaderNames.cpp b/src/buntime/web/fetch/HTTPHeaderNames.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderNames.cpp rename to src/buntime/web/fetch/HTTPHeaderNames.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderNames.gperf b/src/buntime/web/fetch/HTTPHeaderNames.gperf similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderNames.gperf rename to src/buntime/web/fetch/HTTPHeaderNames.gperf diff --git a/src/bun.js/bindings/webcore/HTTPHeaderNames.h b/src/buntime/web/fetch/HTTPHeaderNames.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderNames.h rename to src/buntime/web/fetch/HTTPHeaderNames.h diff --git a/src/bun.js/bindings/webcore/HTTPHeaderNames.in b/src/buntime/web/fetch/HTTPHeaderNames.in similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderNames.in rename to src/buntime/web/fetch/HTTPHeaderNames.in diff --git a/src/bun.js/bindings/webcore/HTTPHeaderStrings.cpp b/src/buntime/web/fetch/HTTPHeaderStrings.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderStrings.cpp rename to src/buntime/web/fetch/HTTPHeaderStrings.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderValues.cpp b/src/buntime/web/fetch/HTTPHeaderValues.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderValues.cpp rename to src/buntime/web/fetch/HTTPHeaderValues.cpp diff --git a/src/bun.js/bindings/webcore/HTTPHeaderValues.h b/src/buntime/web/fetch/HTTPHeaderValues.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPHeaderValues.h rename to src/buntime/web/fetch/HTTPHeaderValues.h diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp b/src/buntime/web/fetch/JSFetchHeaders.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSFetchHeaders.cpp rename to src/buntime/web/fetch/JSFetchHeaders.cpp diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.h b/src/buntime/web/fetch/JSFetchHeaders.h similarity index 100% rename from src/bun.js/bindings/webcore/JSFetchHeaders.h rename to src/buntime/web/fetch/JSFetchHeaders.h diff --git a/src/bun.js/bindings/NodeFetch.cpp b/src/buntime/web/fetch/NodeFetch.cpp similarity index 100% rename from src/bun.js/bindings/NodeFetch.cpp rename to src/buntime/web/fetch/NodeFetch.cpp diff --git a/src/bun.js/bindings/NodeFetch.h b/src/buntime/web/fetch/NodeFetch.h similarity index 100% rename from src/bun.js/bindings/NodeFetch.h rename to src/buntime/web/fetch/NodeFetch.h diff --git a/src/bun.js/bindings/Undici.cpp b/src/buntime/web/fetch/Undici.cpp similarity index 100% rename from src/bun.js/bindings/Undici.cpp rename to src/buntime/web/fetch/Undici.cpp diff --git a/src/bun.js/bindings/Undici.h b/src/buntime/web/fetch/Undici.h similarity index 100% rename from src/bun.js/bindings/Undici.h rename to src/buntime/web/fetch/Undici.h diff --git a/src/bun.js/webcore/fetch.zig b/src/buntime/web/fetch/fetch.zig similarity index 99% rename from src/bun.js/webcore/fetch.zig rename to src/buntime/web/fetch/fetch.zig index 1d0a744b4543..007488b7b5fd 100644 --- a/src/bun.js/webcore/fetch.zig +++ b/src/buntime/web/fetch/fetch.zig @@ -58,7 +58,7 @@ pub const fetch_type_error_strings: JSTypeErrorEnum = brk: { break :brk errors; }; -pub const FetchTasklet = @import("./fetch/FetchTasklet.zig").FetchTasklet; +pub const FetchTasklet = @import("./FetchTasklet.zig").FetchTasklet; fn dataURLResponse( _data_url: DataURL, @@ -965,7 +965,7 @@ pub fn Bun__fetch_( if (url_type != .remote) { defer unix_socket_path.deinit(); var path_buf: bun.PathBuffer = undefined; - const PercentEncoding = @import("../../url.zig").PercentEncoding; + const PercentEncoding = @import("../../../url.zig").PercentEncoding; var path_buf2: bun.PathBuffer = undefined; var stream = std.io.fixedBufferStream(&path_buf2); var url_path_decoded = path_buf2[0 .. PercentEncoding.decode( @@ -1448,9 +1448,9 @@ fn setHeaders(headers: *?Headers, new_headers: []const picohttp.Header, allocato const string = []const u8; const std = @import("std"); -const DataURL = @import("../../resolver/data_url.zig").DataURL; -const Method = @import("../../http/Method.zig").Method; -const ZigURL = @import("../../url.zig").URL; +const DataURL = @import("../../../resolver/data_url.zig").DataURL; +const Method = @import("../../../http/Method.zig").Method; +const ZigURL = @import("../../../url.zig").URL; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/webcore/BakeResponse.zig b/src/buntime/web/http/BakeResponse.zig similarity index 99% rename from src/bun.js/webcore/BakeResponse.zig rename to src/buntime/web/http/BakeResponse.zig index c3f4cffb9b0a..d64f2ee4f44e 100644 --- a/src/bun.js/webcore/BakeResponse.zig +++ b/src/buntime/web/http/BakeResponse.zig @@ -6,7 +6,7 @@ pub fn fixDeadCodeElimination() void { extern "C" fn BakeResponse__createForSSR(globalObject: *JSGlobalObject, this: *Response, kind: u8) callconv(jsc.conv) jsc.JSValue; /// Corresponds to `JSBakeResponseKind` in -/// `src/bun.js/bindings/JSBakeResponse.h` +/// `src/buntime/bindings/JSBakeResponse.h` const SSRKind = enum(u8) { regular = 0, redirect = 1, diff --git a/src/bun.js/webcore/Body.zig b/src/buntime/web/http/Body.zig similarity index 100% rename from src/bun.js/webcore/Body.zig rename to src/buntime/web/http/Body.zig diff --git a/src/bun.js/bindings/webcore/HTTPParsers.cpp b/src/buntime/web/http/HTTPParsers.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HTTPParsers.cpp rename to src/buntime/web/http/HTTPParsers.cpp diff --git a/src/bun.js/bindings/webcore/HTTPParsers.h b/src/buntime/web/http/HTTPParsers.h similarity index 100% rename from src/bun.js/bindings/webcore/HTTPParsers.h rename to src/buntime/web/http/HTTPParsers.h diff --git a/src/bun.js/bindings/webcore/HeaderFieldTokenizer.cpp b/src/buntime/web/http/HeaderFieldTokenizer.cpp similarity index 100% rename from src/bun.js/bindings/webcore/HeaderFieldTokenizer.cpp rename to src/buntime/web/http/HeaderFieldTokenizer.cpp diff --git a/src/bun.js/bindings/webcore/HeaderFieldTokenizer.h b/src/buntime/web/http/HeaderFieldTokenizer.h similarity index 100% rename from src/bun.js/bindings/webcore/HeaderFieldTokenizer.h rename to src/buntime/web/http/HeaderFieldTokenizer.h diff --git a/src/bun.js/bindings/webcore/RFC7230.cpp b/src/buntime/web/http/RFC7230.cpp similarity index 100% rename from src/bun.js/bindings/webcore/RFC7230.cpp rename to src/buntime/web/http/RFC7230.cpp diff --git a/src/bun.js/bindings/webcore/RFC7230.h b/src/buntime/web/http/RFC7230.h similarity index 100% rename from src/bun.js/bindings/webcore/RFC7230.h rename to src/buntime/web/http/RFC7230.h diff --git a/src/bun.js/webcore/Request.zig b/src/buntime/web/http/Request.zig similarity index 99% rename from src/bun.js/webcore/Request.zig rename to src/buntime/web/http/Request.zig index 0a04f432454c..d205e68cf0bb 100644 --- a/src/bun.js/webcore/Request.zig +++ b/src/buntime/web/http/Request.zig @@ -1050,10 +1050,10 @@ pub fn setTimeout( const string = []const u8; -const Environment = @import("../../env.zig"); +const Environment = @import("../../../env.zig"); const std = @import("std"); -const FetchRedirect = @import("../../http/FetchRedirect.zig").FetchRedirect; -const Method = @import("../../http/Method.zig").Method; +const FetchRedirect = @import("../../../http/FetchRedirect.zig").FetchRedirect; +const Method = @import("../../../http/Method.zig").Method; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/bun.js/webcore/Response.zig b/src/buntime/web/http/Response.zig similarity index 99% rename from src/bun.js/webcore/Response.zig rename to src/buntime/web/http/Response.zig index 4c43c933bc44..8867bfc559a4 100644 --- a/src/bun.js/webcore/Response.zig +++ b/src/buntime/web/http/Response.zig @@ -899,7 +899,7 @@ inline fn emptyWithStatus(_: *jsc.JSGlobalObject, status: u16) Response { // TODO: move to http.zig. this has nothing to do with jsc or WebCore const std = @import("std"); -const Method = @import("../../http/Method.zig").Method; +const Method = @import("../../../http/Method.zig").Method; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/bun.js/webcore/response.classes.ts b/src/buntime/web/http/response.classes.ts similarity index 98% rename from src/bun.js/webcore/response.classes.ts rename to src/buntime/web/http/response.classes.ts index 2efa48a44de8..2db8d2d1cb8b 100644 --- a/src/bun.js/webcore/response.classes.ts +++ b/src/buntime/web/http/response.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../../codegen/class-definitions"; +import { define } from "../../../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.cpp b/src/buntime/web/messaging/JSMessageChannel.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageChannel.cpp rename to src/buntime/web/messaging/JSMessageChannel.cpp diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.h b/src/buntime/web/messaging/JSMessageChannel.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageChannel.h rename to src/buntime/web/messaging/JSMessageChannel.h diff --git a/src/bun.js/bindings/webcore/JSMessageChannelCustom.cpp b/src/buntime/web/messaging/JSMessageChannelCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMessageChannelCustom.cpp rename to src/buntime/web/messaging/JSMessageChannelCustom.cpp diff --git a/src/bun.js/bindings/webcore/MessageChannel.cpp b/src/buntime/web/messaging/MessageChannel.cpp similarity index 100% rename from src/bun.js/bindings/webcore/MessageChannel.cpp rename to src/buntime/web/messaging/MessageChannel.cpp diff --git a/src/bun.js/bindings/webcore/MessageChannel.h b/src/buntime/web/messaging/MessageChannel.h similarity index 100% rename from src/bun.js/bindings/webcore/MessageChannel.h rename to src/buntime/web/messaging/MessageChannel.h diff --git a/src/bun.js/bindings/webcore/JSMIMEBindings.cpp b/src/buntime/web/mime/JSMIMEBindings.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEBindings.cpp rename to src/buntime/web/mime/JSMIMEBindings.cpp diff --git a/src/bun.js/bindings/webcore/JSMIMEBindings.h b/src/buntime/web/mime/JSMIMEBindings.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEBindings.h rename to src/buntime/web/mime/JSMIMEBindings.h diff --git a/src/bun.js/bindings/webcore/JSMIMEParams.cpp b/src/buntime/web/mime/JSMIMEParams.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEParams.cpp rename to src/buntime/web/mime/JSMIMEParams.cpp diff --git a/src/bun.js/bindings/webcore/JSMIMEParams.h b/src/buntime/web/mime/JSMIMEParams.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEParams.h rename to src/buntime/web/mime/JSMIMEParams.h diff --git a/src/bun.js/bindings/webcore/JSMIMEType.cpp b/src/buntime/web/mime/JSMIMEType.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEType.cpp rename to src/buntime/web/mime/JSMIMEType.cpp diff --git a/src/bun.js/bindings/webcore/JSMIMEType.h b/src/buntime/web/mime/JSMIMEType.h similarity index 100% rename from src/bun.js/bindings/webcore/JSMIMEType.h rename to src/buntime/web/mime/JSMIMEType.h diff --git a/src/bun.js/bindings/webcore/JSPerformance.cpp b/src/buntime/web/performance/JSPerformance.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformance.cpp rename to src/buntime/web/performance/JSPerformance.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformance.h b/src/buntime/web/performance/JSPerformance.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformance.h rename to src/buntime/web/performance/JSPerformance.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp b/src/buntime/web/performance/JSPerformanceEntry.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceEntry.cpp rename to src/buntime/web/performance/JSPerformanceEntry.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntry.h b/src/buntime/web/performance/JSPerformanceEntry.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceEntry.h rename to src/buntime/web/performance/JSPerformanceEntry.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp b/src/buntime/web/performance/JSPerformanceEntryCustom.cpp similarity index 99% rename from src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp rename to src/buntime/web/performance/JSPerformanceEntryCustom.cpp index 944427d62794..c00b02b50598 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp +++ b/src/buntime/web/performance/JSPerformanceEntryCustom.cpp @@ -33,6 +33,7 @@ #include "JSPerformanceEntry.h" #include "JSDOMBinding.h" +#include "JSDOMWrapperCache.h" #include "JSPerformanceMark.h" #include "JSPerformanceMeasure.h" // #include "JSPerformanceNavigationTiming.h" diff --git a/src/bun.js/bindings/webcore/JSPerformanceMark.cpp b/src/buntime/web/performance/JSPerformanceMark.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMark.cpp rename to src/buntime/web/performance/JSPerformanceMark.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceMark.h b/src/buntime/web/performance/JSPerformanceMark.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMark.h rename to src/buntime/web/performance/JSPerformanceMark.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceMarkOptions.cpp b/src/buntime/web/performance/JSPerformanceMarkOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMarkOptions.cpp rename to src/buntime/web/performance/JSPerformanceMarkOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceMarkOptions.h b/src/buntime/web/performance/JSPerformanceMarkOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMarkOptions.h rename to src/buntime/web/performance/JSPerformanceMarkOptions.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp b/src/buntime/web/performance/JSPerformanceMeasure.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp rename to src/buntime/web/performance/JSPerformanceMeasure.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasure.h b/src/buntime/web/performance/JSPerformanceMeasure.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMeasure.h rename to src/buntime/web/performance/JSPerformanceMeasure.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasureOptions.cpp b/src/buntime/web/performance/JSPerformanceMeasureOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMeasureOptions.cpp rename to src/buntime/web/performance/JSPerformanceMeasureOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasureOptions.h b/src/buntime/web/performance/JSPerformanceMeasureOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceMeasureOptions.h rename to src/buntime/web/performance/JSPerformanceMeasureOptions.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp b/src/buntime/web/performance/JSPerformanceObserver.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserver.cpp rename to src/buntime/web/performance/JSPerformanceObserver.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserver.h b/src/buntime/web/performance/JSPerformanceObserver.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserver.h rename to src/buntime/web/performance/JSPerformanceObserver.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverCallback.cpp b/src/buntime/web/performance/JSPerformanceObserverCallback.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserverCallback.cpp rename to src/buntime/web/performance/JSPerformanceObserverCallback.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverCallback.h b/src/buntime/web/performance/JSPerformanceObserverCallback.h similarity index 98% rename from src/bun.js/bindings/webcore/JSPerformanceObserverCallback.h rename to src/buntime/web/performance/JSPerformanceObserverCallback.h index 5309a4053fe4..a9b6478eacfd 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserverCallback.h +++ b/src/buntime/web/performance/JSPerformanceObserverCallback.h @@ -22,6 +22,7 @@ #include "IDLTypes.h" #include "JSCallbackData.h" +#include "JSDOMGlobalObject.h" #include "PerformanceObserverCallback.h" #include diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverCustom.cpp b/src/buntime/web/performance/JSPerformanceObserverCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserverCustom.cpp rename to src/buntime/web/performance/JSPerformanceObserverCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp b/src/buntime/web/performance/JSPerformanceObserverEntryList.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp rename to src/buntime/web/performance/JSPerformanceObserverEntryList.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h b/src/buntime/web/performance/JSPerformanceObserverEntryList.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h rename to src/buntime/web/performance/JSPerformanceObserverEntryList.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp b/src/buntime/web/performance/JSPerformanceResourceTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp rename to src/buntime/web/performance/JSPerformanceResourceTiming.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h b/src/buntime/web/performance/JSPerformanceResourceTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h rename to src/buntime/web/performance/JSPerformanceResourceTiming.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp b/src/buntime/web/performance/JSPerformanceServerTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp rename to src/buntime/web/performance/JSPerformanceServerTiming.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.h b/src/buntime/web/performance/JSPerformanceServerTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceServerTiming.h rename to src/buntime/web/performance/JSPerformanceServerTiming.h diff --git a/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp b/src/buntime/web/performance/JSPerformanceTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceTiming.cpp rename to src/buntime/web/performance/JSPerformanceTiming.cpp diff --git a/src/bun.js/bindings/webcore/JSPerformanceTiming.h b/src/buntime/web/performance/JSPerformanceTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/JSPerformanceTiming.h rename to src/buntime/web/performance/JSPerformanceTiming.h diff --git a/src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp b/src/buntime/web/performance/NetworkLoadMetrics.cpp similarity index 100% rename from src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp rename to src/buntime/web/performance/NetworkLoadMetrics.cpp diff --git a/src/bun.js/bindings/webcore/NetworkLoadMetrics.h b/src/buntime/web/performance/NetworkLoadMetrics.h similarity index 100% rename from src/bun.js/bindings/webcore/NetworkLoadMetrics.h rename to src/buntime/web/performance/NetworkLoadMetrics.h diff --git a/src/bun.js/bindings/webcore/Performance.cpp b/src/buntime/web/performance/Performance.cpp similarity index 100% rename from src/bun.js/bindings/webcore/Performance.cpp rename to src/buntime/web/performance/Performance.cpp diff --git a/src/bun.js/bindings/webcore/Performance.h b/src/buntime/web/performance/Performance.h similarity index 100% rename from src/bun.js/bindings/webcore/Performance.h rename to src/buntime/web/performance/Performance.h diff --git a/src/bun.js/bindings/webcore/PerformanceEntry.cpp b/src/buntime/web/performance/PerformanceEntry.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceEntry.cpp rename to src/buntime/web/performance/PerformanceEntry.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceEntry.h b/src/buntime/web/performance/PerformanceEntry.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceEntry.h rename to src/buntime/web/performance/PerformanceEntry.h diff --git a/src/bun.js/bindings/webcore/PerformanceMark.cpp b/src/buntime/web/performance/PerformanceMark.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMark.cpp rename to src/buntime/web/performance/PerformanceMark.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceMark.h b/src/buntime/web/performance/PerformanceMark.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMark.h rename to src/buntime/web/performance/PerformanceMark.h diff --git a/src/bun.js/bindings/webcore/PerformanceMarkOptions.h b/src/buntime/web/performance/PerformanceMarkOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMarkOptions.h rename to src/buntime/web/performance/PerformanceMarkOptions.h diff --git a/src/bun.js/bindings/webcore/PerformanceMeasure.cpp b/src/buntime/web/performance/PerformanceMeasure.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMeasure.cpp rename to src/buntime/web/performance/PerformanceMeasure.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceMeasure.h b/src/buntime/web/performance/PerformanceMeasure.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMeasure.h rename to src/buntime/web/performance/PerformanceMeasure.h diff --git a/src/bun.js/bindings/webcore/PerformanceMeasureOptions.h b/src/buntime/web/performance/PerformanceMeasureOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceMeasureOptions.h rename to src/buntime/web/performance/PerformanceMeasureOptions.h diff --git a/src/bun.js/bindings/webcore/PerformanceObserver.cpp b/src/buntime/web/performance/PerformanceObserver.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceObserver.cpp rename to src/buntime/web/performance/PerformanceObserver.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceObserver.h b/src/buntime/web/performance/PerformanceObserver.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceObserver.h rename to src/buntime/web/performance/PerformanceObserver.h diff --git a/src/bun.js/bindings/webcore/PerformanceObserverCallback.h b/src/buntime/web/performance/PerformanceObserverCallback.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceObserverCallback.h rename to src/buntime/web/performance/PerformanceObserverCallback.h diff --git a/src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp b/src/buntime/web/performance/PerformanceObserverEntryList.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp rename to src/buntime/web/performance/PerformanceObserverEntryList.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceObserverEntryList.h b/src/buntime/web/performance/PerformanceObserverEntryList.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceObserverEntryList.h rename to src/buntime/web/performance/PerformanceObserverEntryList.h diff --git a/src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp b/src/buntime/web/performance/PerformanceResourceTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp rename to src/buntime/web/performance/PerformanceResourceTiming.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceResourceTiming.h b/src/buntime/web/performance/PerformanceResourceTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceResourceTiming.h rename to src/buntime/web/performance/PerformanceResourceTiming.h diff --git a/src/bun.js/bindings/webcore/PerformanceResourceTiming.idl b/src/buntime/web/performance/PerformanceResourceTiming.idl similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceResourceTiming.idl rename to src/buntime/web/performance/PerformanceResourceTiming.idl diff --git a/src/bun.js/bindings/webcore/PerformanceServerTiming.cpp b/src/buntime/web/performance/PerformanceServerTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceServerTiming.cpp rename to src/buntime/web/performance/PerformanceServerTiming.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceServerTiming.h b/src/buntime/web/performance/PerformanceServerTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceServerTiming.h rename to src/buntime/web/performance/PerformanceServerTiming.h diff --git a/src/bun.js/bindings/webcore/PerformanceServerTiming.idl b/src/buntime/web/performance/PerformanceServerTiming.idl similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceServerTiming.idl rename to src/buntime/web/performance/PerformanceServerTiming.idl diff --git a/src/bun.js/bindings/webcore/PerformanceTiming.cpp b/src/buntime/web/performance/PerformanceTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceTiming.cpp rename to src/buntime/web/performance/PerformanceTiming.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceTiming.h b/src/buntime/web/performance/PerformanceTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceTiming.h rename to src/buntime/web/performance/PerformanceTiming.h diff --git a/src/bun.js/bindings/webcore/PerformanceUserTiming.cpp b/src/buntime/web/performance/PerformanceUserTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceUserTiming.cpp rename to src/buntime/web/performance/PerformanceUserTiming.cpp diff --git a/src/bun.js/bindings/webcore/PerformanceUserTiming.h b/src/buntime/web/performance/PerformanceUserTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/PerformanceUserTiming.h rename to src/buntime/web/performance/PerformanceUserTiming.h diff --git a/src/bun.js/bindings/webcore/ResourceLoadTiming.h b/src/buntime/web/performance/ResourceLoadTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/ResourceLoadTiming.h rename to src/buntime/web/performance/ResourceLoadTiming.h diff --git a/src/bun.js/bindings/webcore/ResourceTiming.cpp b/src/buntime/web/performance/ResourceTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ResourceTiming.cpp rename to src/buntime/web/performance/ResourceTiming.cpp diff --git a/src/bun.js/bindings/webcore/ResourceTiming.h b/src/buntime/web/performance/ResourceTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/ResourceTiming.h rename to src/buntime/web/performance/ResourceTiming.h diff --git a/src/bun.js/bindings/webcore/ServerTiming.cpp b/src/buntime/web/performance/ServerTiming.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ServerTiming.cpp rename to src/buntime/web/performance/ServerTiming.cpp diff --git a/src/bun.js/bindings/webcore/ServerTiming.h b/src/buntime/web/performance/ServerTiming.h similarity index 100% rename from src/bun.js/bindings/webcore/ServerTiming.h rename to src/buntime/web/performance/ServerTiming.h diff --git a/src/bun.js/bindings/webcore/ServerTimingParser.cpp b/src/buntime/web/performance/ServerTimingParser.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ServerTimingParser.cpp rename to src/buntime/web/performance/ServerTimingParser.cpp diff --git a/src/bun.js/bindings/webcore/ServerTimingParser.h b/src/buntime/web/performance/ServerTimingParser.h similarity index 100% rename from src/bun.js/bindings/webcore/ServerTimingParser.h rename to src/buntime/web/performance/ServerTimingParser.h diff --git a/src/bun.js/bindings/webcore/JSDOMConvertSerializedScriptValue.h b/src/buntime/web/serialization/JSDOMConvertSerializedScriptValue.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMConvertSerializedScriptValue.h rename to src/buntime/web/serialization/JSDOMConvertSerializedScriptValue.h diff --git a/src/bun.js/bindings/webcore/JSStructuredSerializeOptions.cpp b/src/buntime/web/serialization/JSStructuredSerializeOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSStructuredSerializeOptions.cpp rename to src/buntime/web/serialization/JSStructuredSerializeOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSStructuredSerializeOptions.h b/src/buntime/web/serialization/JSStructuredSerializeOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSStructuredSerializeOptions.h rename to src/buntime/web/serialization/JSStructuredSerializeOptions.h diff --git a/src/bun.js/bindings/Serialization.cpp b/src/buntime/web/serialization/Serialization.cpp similarity index 100% rename from src/bun.js/bindings/Serialization.cpp rename to src/buntime/web/serialization/Serialization.cpp diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp b/src/buntime/web/serialization/SerializedScriptValue.cpp similarity index 100% rename from src/bun.js/bindings/webcore/SerializedScriptValue.cpp rename to src/buntime/web/serialization/SerializedScriptValue.cpp diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.h b/src/buntime/web/serialization/SerializedScriptValue.h similarity index 100% rename from src/bun.js/bindings/webcore/SerializedScriptValue.h rename to src/buntime/web/serialization/SerializedScriptValue.h diff --git a/src/bun.js/bindings/webcore/StructuredClone.cpp b/src/buntime/web/serialization/StructuredClone.cpp similarity index 100% rename from src/bun.js/bindings/webcore/StructuredClone.cpp rename to src/buntime/web/serialization/StructuredClone.cpp diff --git a/src/bun.js/bindings/webcore/StructuredClone.h b/src/buntime/web/serialization/StructuredClone.h similarity index 100% rename from src/bun.js/bindings/webcore/StructuredClone.h rename to src/buntime/web/serialization/StructuredClone.h diff --git a/src/bun.js/bindings/webcore/StructuredSerializeOptions.h b/src/buntime/web/serialization/StructuredSerializeOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/StructuredSerializeOptions.h rename to src/buntime/web/serialization/StructuredSerializeOptions.h diff --git a/src/bun.js/webcore/ArrayBufferSink.zig b/src/buntime/web/streams/ArrayBufferSink.zig similarity index 100% rename from src/bun.js/webcore/ArrayBufferSink.zig rename to src/buntime/web/streams/ArrayBufferSink.zig diff --git a/src/bun.js/webcore/ByteStream.zig b/src/buntime/web/streams/ByteStream.zig similarity index 100% rename from src/bun.js/webcore/ByteStream.zig rename to src/buntime/web/streams/ByteStream.zig diff --git a/src/bun.js/webcore/FileSink.zig b/src/buntime/web/streams/FileSink.zig similarity index 100% rename from src/bun.js/webcore/FileSink.zig rename to src/buntime/web/streams/FileSink.zig diff --git a/src/bun.js/bindings/webcore/InternalWritableStream.cpp b/src/buntime/web/streams/InternalWritableStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/InternalWritableStream.cpp rename to src/buntime/web/streams/InternalWritableStream.cpp diff --git a/src/bun.js/bindings/webcore/InternalWritableStream.h b/src/buntime/web/streams/InternalWritableStream.h similarity index 100% rename from src/bun.js/bindings/webcore/InternalWritableStream.h rename to src/buntime/web/streams/InternalWritableStream.h diff --git a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp b/src/buntime/web/streams/JSByteLengthQueuingStrategy.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp rename to src/buntime/web/streams/JSByteLengthQueuingStrategy.cpp diff --git a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.h b/src/buntime/web/streams/JSByteLengthQueuingStrategy.h similarity index 100% rename from src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.h rename to src/buntime/web/streams/JSByteLengthQueuingStrategy.h diff --git a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp b/src/buntime/web/streams/JSCountQueuingStrategy.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp rename to src/buntime/web/streams/JSCountQueuingStrategy.cpp diff --git a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.h b/src/buntime/web/streams/JSCountQueuingStrategy.h similarity index 100% rename from src/bun.js/bindings/webcore/JSCountQueuingStrategy.h rename to src/buntime/web/streams/JSCountQueuingStrategy.h diff --git a/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp b/src/buntime/web/streams/JSReadableByteStreamController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp rename to src/buntime/web/streams/JSReadableByteStreamController.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableByteStreamController.h b/src/buntime/web/streams/JSReadableByteStreamController.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableByteStreamController.h rename to src/buntime/web/streams/JSReadableByteStreamController.h diff --git a/src/bun.js/bindings/webcore/JSReadableStream.cpp b/src/buntime/web/streams/JSReadableStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStream.cpp rename to src/buntime/web/streams/JSReadableStream.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStream.h b/src/buntime/web/streams/JSReadableStream.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStream.h rename to src/buntime/web/streams/JSReadableStream.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp b/src/buntime/web/streams/JSReadableStreamBYOBReader.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp rename to src/buntime/web/streams/JSReadableStreamBYOBReader.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.h b/src/buntime/web/streams/JSReadableStreamBYOBReader.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.h rename to src/buntime/web/streams/JSReadableStreamBYOBReader.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp b/src/buntime/web/streams/JSReadableStreamBYOBRequest.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp rename to src/buntime/web/streams/JSReadableStreamBYOBRequest.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.h b/src/buntime/web/streams/JSReadableStreamBYOBRequest.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.h rename to src/buntime/web/streams/JSReadableStreamBYOBRequest.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp b/src/buntime/web/streams/JSReadableStreamDefaultController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp rename to src/buntime/web/streams/JSReadableStreamDefaultController.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.h b/src/buntime/web/streams/JSReadableStreamDefaultController.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamDefaultController.h rename to src/buntime/web/streams/JSReadableStreamDefaultController.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp b/src/buntime/web/streams/JSReadableStreamDefaultReader.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp rename to src/buntime/web/streams/JSReadableStreamDefaultReader.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.h b/src/buntime/web/streams/JSReadableStreamDefaultReader.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.h rename to src/buntime/web/streams/JSReadableStreamDefaultReader.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp b/src/buntime/web/streams/JSReadableStreamSink.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamSink.cpp rename to src/buntime/web/streams/JSReadableStreamSink.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSink.h b/src/buntime/web/streams/JSReadableStreamSink.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamSink.h rename to src/buntime/web/streams/JSReadableStreamSink.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp b/src/buntime/web/streams/JSReadableStreamSource.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamSource.cpp rename to src/buntime/web/streams/JSReadableStreamSource.cpp diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.h b/src/buntime/web/streams/JSReadableStreamSource.h similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamSource.h rename to src/buntime/web/streams/JSReadableStreamSource.h diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp b/src/buntime/web/streams/JSReadableStreamSourceCustom.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp rename to src/buntime/web/streams/JSReadableStreamSourceCustom.cpp diff --git a/src/bun.js/bindings/webcore/JSTransformStream.cpp b/src/buntime/web/streams/JSTransformStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSTransformStream.cpp rename to src/buntime/web/streams/JSTransformStream.cpp diff --git a/src/bun.js/bindings/webcore/JSTransformStream.h b/src/buntime/web/streams/JSTransformStream.h similarity index 100% rename from src/bun.js/bindings/webcore/JSTransformStream.h rename to src/buntime/web/streams/JSTransformStream.h diff --git a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp b/src/buntime/web/streams/JSTransformStreamDefaultController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp rename to src/buntime/web/streams/JSTransformStreamDefaultController.cpp diff --git a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.h b/src/buntime/web/streams/JSTransformStreamDefaultController.h similarity index 100% rename from src/bun.js/bindings/webcore/JSTransformStreamDefaultController.h rename to src/buntime/web/streams/JSTransformStreamDefaultController.h diff --git a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp b/src/buntime/web/streams/JSWasmStreamingCompiler.cpp similarity index 99% rename from src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp rename to src/buntime/web/streams/JSWasmStreamingCompiler.cpp index af3baa8a192a..6632d3e1c001 100644 --- a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp +++ b/src/buntime/web/streams/JSWasmStreamingCompiler.cpp @@ -5,6 +5,7 @@ #include "DOMIsoSubspaces.h" #include "JSDOMBinding.h" #include "JSDOMOperation.h" +#include "JSDOMWrapperCache.h" #include #include "ErrorCode.h" diff --git a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h b/src/buntime/web/streams/JSWasmStreamingCompiler.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h rename to src/buntime/web/streams/JSWasmStreamingCompiler.h diff --git a/src/bun.js/bindings/webcore/JSWritableStream.cpp b/src/buntime/web/streams/JSWritableStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStream.cpp rename to src/buntime/web/streams/JSWritableStream.cpp diff --git a/src/bun.js/bindings/webcore/JSWritableStream.h b/src/buntime/web/streams/JSWritableStream.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStream.h rename to src/buntime/web/streams/JSWritableStream.h diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp b/src/buntime/web/streams/JSWritableStreamDefaultController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp rename to src/buntime/web/streams/JSWritableStreamDefaultController.cpp diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.h b/src/buntime/web/streams/JSWritableStreamDefaultController.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamDefaultController.h rename to src/buntime/web/streams/JSWritableStreamDefaultController.h diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp b/src/buntime/web/streams/JSWritableStreamDefaultWriter.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp rename to src/buntime/web/streams/JSWritableStreamDefaultWriter.cpp diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.h b/src/buntime/web/streams/JSWritableStreamDefaultWriter.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.h rename to src/buntime/web/streams/JSWritableStreamDefaultWriter.h diff --git a/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp b/src/buntime/web/streams/JSWritableStreamSink.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamSink.cpp rename to src/buntime/web/streams/JSWritableStreamSink.cpp diff --git a/src/bun.js/bindings/webcore/JSWritableStreamSink.h b/src/buntime/web/streams/JSWritableStreamSink.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWritableStreamSink.h rename to src/buntime/web/streams/JSWritableStreamSink.h diff --git a/src/bun.js/bindings/webcore/ReadableStream.cpp b/src/buntime/web/streams/ReadableStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStream.cpp rename to src/buntime/web/streams/ReadableStream.cpp diff --git a/src/bun.js/bindings/webcore/ReadableStream.h b/src/buntime/web/streams/ReadableStream.h similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStream.h rename to src/buntime/web/streams/ReadableStream.h diff --git a/src/bun.js/webcore/ReadableStream.zig b/src/buntime/web/streams/ReadableStream.zig similarity index 100% rename from src/bun.js/webcore/ReadableStream.zig rename to src/buntime/web/streams/ReadableStream.zig diff --git a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp b/src/buntime/web/streams/ReadableStreamDefaultController.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp rename to src/buntime/web/streams/ReadableStreamDefaultController.cpp diff --git a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.h b/src/buntime/web/streams/ReadableStreamDefaultController.h similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamDefaultController.h rename to src/buntime/web/streams/ReadableStreamDefaultController.h diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.cpp b/src/buntime/web/streams/ReadableStreamSink.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamSink.cpp rename to src/buntime/web/streams/ReadableStreamSink.cpp diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.h b/src/buntime/web/streams/ReadableStreamSink.h similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamSink.h rename to src/buntime/web/streams/ReadableStreamSink.h diff --git a/src/bun.js/bindings/webcore/ReadableStreamSource.cpp b/src/buntime/web/streams/ReadableStreamSource.cpp similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamSource.cpp rename to src/buntime/web/streams/ReadableStreamSource.cpp diff --git a/src/bun.js/bindings/webcore/ReadableStreamSource.h b/src/buntime/web/streams/ReadableStreamSource.h similarity index 100% rename from src/bun.js/bindings/webcore/ReadableStreamSource.h rename to src/buntime/web/streams/ReadableStreamSource.h diff --git a/src/bun.js/webcore/ResumableSink.zig b/src/buntime/web/streams/ResumableSink.zig similarity index 99% rename from src/bun.js/webcore/ResumableSink.zig rename to src/buntime/web/streams/ResumableSink.zig index 1cd0c825a079..2d2e383d12cf 100644 --- a/src/bun.js/webcore/ResumableSink.zig +++ b/src/buntime/web/streams/ResumableSink.zig @@ -361,8 +361,8 @@ pub const ResumableS3UploadSink = ResumableSink(jsc.Codegen.JSResumableS3UploadS extern fn Bun__assignStreamIntoResumableSink(globalThis: *jsc.JSGlobalObject, stream: jsc.JSValue, sink: jsc.JSValue) jsc.JSValue; const std = @import("std"); -const FetchTasklet = @import("./fetch.zig").FetchTasklet; -const S3UploadStreamWrapper = @import("../../s3/client.zig").S3UploadStreamWrapper; +const FetchTasklet = @import("../fetch/fetch.zig").FetchTasklet; +const S3UploadStreamWrapper = @import("../../../s3/client.zig").S3UploadStreamWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/bun.js/bindings/Sink.h b/src/buntime/web/streams/Sink.h similarity index 100% rename from src/bun.js/bindings/Sink.h rename to src/buntime/web/streams/Sink.h diff --git a/src/bun.js/webcore/Sink.zig b/src/buntime/web/streams/Sink.zig similarity index 100% rename from src/bun.js/webcore/Sink.zig rename to src/buntime/web/streams/Sink.zig diff --git a/src/bun.js/bindings/StreamGlobals.h b/src/buntime/web/streams/StreamGlobals.h similarity index 100% rename from src/bun.js/bindings/StreamGlobals.h rename to src/buntime/web/streams/StreamGlobals.h diff --git a/src/bun.js/bindings/webcore/WritableStream.cpp b/src/buntime/web/streams/WritableStream.cpp similarity index 100% rename from src/bun.js/bindings/webcore/WritableStream.cpp rename to src/buntime/web/streams/WritableStream.cpp diff --git a/src/bun.js/bindings/webcore/WritableStream.h b/src/buntime/web/streams/WritableStream.h similarity index 100% rename from src/bun.js/bindings/webcore/WritableStream.h rename to src/buntime/web/streams/WritableStream.h diff --git a/src/bun.js/bindings/webcore/WritableStream.idl b/src/buntime/web/streams/WritableStream.idl similarity index 100% rename from src/bun.js/bindings/webcore/WritableStream.idl rename to src/buntime/web/streams/WritableStream.idl diff --git a/src/bun.js/bindings/webcore/WritableStreamSink.h b/src/buntime/web/streams/WritableStreamSink.h similarity index 100% rename from src/bun.js/bindings/webcore/WritableStreamSink.h rename to src/buntime/web/streams/WritableStreamSink.h diff --git a/src/bun.js/webcore/streams.zig b/src/buntime/web/streams/streams.zig similarity index 100% rename from src/bun.js/webcore/streams.zig rename to src/buntime/web/streams/streams.zig diff --git a/src/bun.js/bindings/DOMURL.cpp b/src/buntime/web/url/DOMURL.cpp similarity index 100% rename from src/bun.js/bindings/DOMURL.cpp rename to src/buntime/web/url/DOMURL.cpp diff --git a/src/bun.js/bindings/DOMURL.h b/src/buntime/web/url/DOMURL.h similarity index 100% rename from src/bun.js/bindings/DOMURL.h rename to src/buntime/web/url/DOMURL.h diff --git a/src/bun.js/bindings/DOMURL.zig b/src/buntime/web/url/DOMURL.zig similarity index 100% rename from src/bun.js/bindings/DOMURL.zig rename to src/buntime/web/url/DOMURL.zig diff --git a/src/bun.js/bindings/EncodeURIComponent.cpp b/src/buntime/web/url/EncodeURIComponent.cpp similarity index 100% rename from src/bun.js/bindings/EncodeURIComponent.cpp rename to src/buntime/web/url/EncodeURIComponent.cpp diff --git a/src/bun.js/bindings/EncodeURIComponent.h b/src/buntime/web/url/EncodeURIComponent.h similarity index 100% rename from src/bun.js/bindings/EncodeURIComponent.h rename to src/buntime/web/url/EncodeURIComponent.h diff --git a/src/bun.js/bindings/webcore/JSDOMURL.cpp b/src/buntime/web/url/JSDOMURL.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMURL.cpp rename to src/buntime/web/url/JSDOMURL.cpp diff --git a/src/bun.js/bindings/webcore/JSDOMURL.h b/src/buntime/web/url/JSDOMURL.h similarity index 100% rename from src/bun.js/bindings/webcore/JSDOMURL.h rename to src/buntime/web/url/JSDOMURL.h diff --git a/src/bun.js/bindings/webcore/JSURLPattern.cpp b/src/buntime/web/url/JSURLPattern.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPattern.cpp rename to src/buntime/web/url/JSURLPattern.cpp diff --git a/src/bun.js/bindings/webcore/JSURLPattern.h b/src/buntime/web/url/JSURLPattern.h similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPattern.h rename to src/buntime/web/url/JSURLPattern.h diff --git a/src/bun.js/bindings/webcore/JSURLPatternInit.cpp b/src/buntime/web/url/JSURLPatternInit.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternInit.cpp rename to src/buntime/web/url/JSURLPatternInit.cpp diff --git a/src/bun.js/bindings/webcore/JSURLPatternInit.h b/src/buntime/web/url/JSURLPatternInit.h similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternInit.h rename to src/buntime/web/url/JSURLPatternInit.h diff --git a/src/bun.js/bindings/webcore/JSURLPatternOptions.cpp b/src/buntime/web/url/JSURLPatternOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternOptions.cpp rename to src/buntime/web/url/JSURLPatternOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSURLPatternOptions.h b/src/buntime/web/url/JSURLPatternOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternOptions.h rename to src/buntime/web/url/JSURLPatternOptions.h diff --git a/src/bun.js/bindings/webcore/JSURLPatternResult.cpp b/src/buntime/web/url/JSURLPatternResult.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternResult.cpp rename to src/buntime/web/url/JSURLPatternResult.cpp diff --git a/src/bun.js/bindings/webcore/JSURLPatternResult.h b/src/buntime/web/url/JSURLPatternResult.h similarity index 100% rename from src/bun.js/bindings/webcore/JSURLPatternResult.h rename to src/buntime/web/url/JSURLPatternResult.h diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp b/src/buntime/web/url/JSURLSearchParams.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSURLSearchParams.cpp rename to src/buntime/web/url/JSURLSearchParams.cpp diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.h b/src/buntime/web/url/JSURLSearchParams.h similarity index 100% rename from src/bun.js/bindings/webcore/JSURLSearchParams.h rename to src/buntime/web/url/JSURLSearchParams.h diff --git a/src/bun.js/bindings/NodeURL.cpp b/src/buntime/web/url/NodeURL.cpp similarity index 100% rename from src/bun.js/bindings/NodeURL.cpp rename to src/buntime/web/url/NodeURL.cpp diff --git a/src/bun.js/bindings/NodeURL.h b/src/buntime/web/url/NodeURL.h similarity index 100% rename from src/bun.js/bindings/NodeURL.h rename to src/buntime/web/url/NodeURL.h diff --git a/src/bun.js/webcore/ObjectURLRegistry.zig b/src/buntime/web/url/ObjectURLRegistry.zig similarity index 100% rename from src/bun.js/webcore/ObjectURLRegistry.zig rename to src/buntime/web/url/ObjectURLRegistry.zig diff --git a/src/bun.js/bindings/URL.zig b/src/buntime/web/url/URL.zig similarity index 100% rename from src/bun.js/bindings/URL.zig rename to src/buntime/web/url/URL.zig diff --git a/src/bun.js/bindings/URLDecomposition.cpp b/src/buntime/web/url/URLDecomposition.cpp similarity index 100% rename from src/bun.js/bindings/URLDecomposition.cpp rename to src/buntime/web/url/URLDecomposition.cpp diff --git a/src/bun.js/bindings/URLDecomposition.h b/src/buntime/web/url/URLDecomposition.h similarity index 100% rename from src/bun.js/bindings/URLDecomposition.h rename to src/buntime/web/url/URLDecomposition.h diff --git a/src/bun.js/bindings/webcore/URLPattern.cpp b/src/buntime/web/url/URLPattern.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPattern.cpp rename to src/buntime/web/url/URLPattern.cpp diff --git a/src/bun.js/bindings/webcore/URLPattern.h b/src/buntime/web/url/URLPattern.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPattern.h rename to src/buntime/web/url/URLPattern.h diff --git a/src/bun.js/bindings/webcore/URLPattern.idl b/src/buntime/web/url/URLPattern.idl similarity index 100% rename from src/bun.js/bindings/webcore/URLPattern.idl rename to src/buntime/web/url/URLPattern.idl diff --git a/src/bun.js/bindings/webcore/URLPatternCanonical.cpp b/src/buntime/web/url/URLPatternCanonical.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternCanonical.cpp rename to src/buntime/web/url/URLPatternCanonical.cpp diff --git a/src/bun.js/bindings/webcore/URLPatternCanonical.h b/src/buntime/web/url/URLPatternCanonical.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternCanonical.h rename to src/buntime/web/url/URLPatternCanonical.h diff --git a/src/bun.js/bindings/webcore/URLPatternComponent.cpp b/src/buntime/web/url/URLPatternComponent.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternComponent.cpp rename to src/buntime/web/url/URLPatternComponent.cpp diff --git a/src/bun.js/bindings/webcore/URLPatternComponent.h b/src/buntime/web/url/URLPatternComponent.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternComponent.h rename to src/buntime/web/url/URLPatternComponent.h diff --git a/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp b/src/buntime/web/url/URLPatternConstructorStringParser.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp rename to src/buntime/web/url/URLPatternConstructorStringParser.cpp diff --git a/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.h b/src/buntime/web/url/URLPatternConstructorStringParser.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternConstructorStringParser.h rename to src/buntime/web/url/URLPatternConstructorStringParser.h diff --git a/src/bun.js/bindings/webcore/URLPatternInit.h b/src/buntime/web/url/URLPatternInit.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternInit.h rename to src/buntime/web/url/URLPatternInit.h diff --git a/src/bun.js/bindings/webcore/URLPatternInit.idl b/src/buntime/web/url/URLPatternInit.idl similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternInit.idl rename to src/buntime/web/url/URLPatternInit.idl diff --git a/src/bun.js/bindings/webcore/URLPatternOptions.h b/src/buntime/web/url/URLPatternOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternOptions.h rename to src/buntime/web/url/URLPatternOptions.h diff --git a/src/bun.js/bindings/webcore/URLPatternOptions.idl b/src/buntime/web/url/URLPatternOptions.idl similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternOptions.idl rename to src/buntime/web/url/URLPatternOptions.idl diff --git a/src/bun.js/bindings/webcore/URLPatternParser.cpp b/src/buntime/web/url/URLPatternParser.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternParser.cpp rename to src/buntime/web/url/URLPatternParser.cpp diff --git a/src/bun.js/bindings/webcore/URLPatternParser.h b/src/buntime/web/url/URLPatternParser.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternParser.h rename to src/buntime/web/url/URLPatternParser.h diff --git a/src/bun.js/bindings/webcore/URLPatternResult.h b/src/buntime/web/url/URLPatternResult.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternResult.h rename to src/buntime/web/url/URLPatternResult.h diff --git a/src/bun.js/bindings/webcore/URLPatternResult.idl b/src/buntime/web/url/URLPatternResult.idl similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternResult.idl rename to src/buntime/web/url/URLPatternResult.idl diff --git a/src/bun.js/bindings/webcore/URLPatternTokenizer.cpp b/src/buntime/web/url/URLPatternTokenizer.cpp similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternTokenizer.cpp rename to src/buntime/web/url/URLPatternTokenizer.cpp diff --git a/src/bun.js/bindings/webcore/URLPatternTokenizer.h b/src/buntime/web/url/URLPatternTokenizer.h similarity index 100% rename from src/bun.js/bindings/webcore/URLPatternTokenizer.h rename to src/buntime/web/url/URLPatternTokenizer.h diff --git a/src/bun.js/bindings/URLSearchParams.cpp b/src/buntime/web/url/URLSearchParams.cpp similarity index 100% rename from src/bun.js/bindings/URLSearchParams.cpp rename to src/buntime/web/url/URLSearchParams.cpp diff --git a/src/bun.js/bindings/URLSearchParams.h b/src/buntime/web/url/URLSearchParams.h similarity index 100% rename from src/bun.js/bindings/URLSearchParams.h rename to src/buntime/web/url/URLSearchParams.h diff --git a/src/bun.js/bindings/URLSearchParams.zig b/src/buntime/web/url/URLSearchParams.zig similarity index 96% rename from src/bun.js/bindings/URLSearchParams.zig rename to src/buntime/web/url/URLSearchParams.zig index 857067b4b763..fd3342771011 100644 --- a/src/bun.js/bindings/URLSearchParams.zig +++ b/src/buntime/web/url/URLSearchParams.zig @@ -39,8 +39,8 @@ pub const URLSearchParams = opaque { }; const bun = @import("bun"); -const ZigString = @import("./ZigString.zig").ZigString; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; +const ZigString = jsc.ZigString; diff --git a/src/bun.js/bindings/decodeURIComponentSIMD.cpp b/src/buntime/web/url/decodeURIComponentSIMD.cpp similarity index 100% rename from src/bun.js/bindings/decodeURIComponentSIMD.cpp rename to src/buntime/web/url/decodeURIComponentSIMD.cpp diff --git a/src/bun.js/bindings/decodeURIComponentSIMD.h b/src/buntime/web/url/decodeURIComponentSIMD.h similarity index 100% rename from src/bun.js/bindings/decodeURIComponentSIMD.h rename to src/buntime/web/url/decodeURIComponentSIMD.h diff --git a/src/bun.js/bindings/webcrypto/AesCbcCfbParams.idl b/src/buntime/web/webcrypto/AesCbcCfbParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/AesCbcCfbParams.idl rename to src/buntime/web/webcrypto/AesCbcCfbParams.idl diff --git a/src/bun.js/bindings/webcrypto/AesCtrParams.idl b/src/buntime/web/webcrypto/AesCtrParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/AesCtrParams.idl rename to src/buntime/web/webcrypto/AesCtrParams.idl diff --git a/src/bun.js/bindings/webcrypto/AesGcmParams.idl b/src/buntime/web/webcrypto/AesGcmParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/AesGcmParams.idl rename to src/buntime/web/webcrypto/AesGcmParams.idl diff --git a/src/bun.js/bindings/webcrypto/AesKeyParams.idl b/src/buntime/web/webcrypto/AesKeyParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/AesKeyParams.idl rename to src/buntime/web/webcrypto/AesKeyParams.idl diff --git a/src/bun.js/bindings/webcrypto/CommonCryptoDERUtilities.cpp b/src/buntime/web/webcrypto/CommonCryptoDERUtilities.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CommonCryptoDERUtilities.cpp rename to src/buntime/web/webcrypto/CommonCryptoDERUtilities.cpp diff --git a/src/bun.js/bindings/webcrypto/CommonCryptoDERUtilities.h b/src/buntime/web/webcrypto/CommonCryptoDERUtilities.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CommonCryptoDERUtilities.h rename to src/buntime/web/webcrypto/CommonCryptoDERUtilities.h diff --git a/src/bun.js/webcore/Crypto.zig b/src/buntime/web/webcrypto/Crypto.zig similarity index 98% rename from src/bun.js/webcore/Crypto.zig rename to src/buntime/web/webcrypto/Crypto.zig index 653b9a17beef..ad43e29d4477 100644 --- a/src/bun.js/webcore/Crypto.zig +++ b/src/buntime/web/webcrypto/Crypto.zig @@ -279,9 +279,9 @@ pub export fn CryptoObject__create(globalThis: *jsc.JSGlobalObject) jsc.JSValue const std = @import("std"); -const UUID = @import("../uuid.zig"); -const UUID5 = @import("../uuid.zig").UUID5; -const UUID7 = @import("../uuid.zig").UUID7; +const UUID = @import("./uuid.zig"); +const UUID5 = @import("./uuid.zig").UUID5; +const UUID7 = @import("./uuid.zig").UUID7; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/bun.js/bindings/webcrypto/CryptoAesKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoAesKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAesKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoAesKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAesKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoAesKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAesKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoAesKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp b/src/buntime/web/webcrypto/CryptoAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithm.h b/src/buntime/web/webcrypto/CryptoAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithm.h rename to src/buntime/web/webcrypto/CryptoAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CBC.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CBC.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.h b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CBC.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CBC.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CFB.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CFB.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.h b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CFB.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CFB.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CTR.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CTR.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.h b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CTR.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CTR.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_GCM.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_GCM.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.h b/src/buntime/web/webcrypto/CryptoAlgorithmAES_GCM.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_GCM.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_KW.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_KW.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.h b/src/buntime/web/webcrypto/CryptoAlgorithmAES_KW.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_KW.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesCbcCfbParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmAesCbcCfbParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAesCbcCfbParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAesCbcCfbParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesCtrParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmAesCtrParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAesCtrParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAesCtrParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmAesGcmParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAesGcmParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesKeyParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmAesKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmAesKeyParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmAesKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmECDH.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmECDH.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.h b/src/buntime/web/webcrypto/CryptoAlgorithmECDH.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.h rename to src/buntime/web/webcrypto/CryptoAlgorithmECDH.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDHOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmECDHOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDHOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmECDHOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmECDSA.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmECDSA.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.h b/src/buntime/web/webcrypto/CryptoAlgorithmECDSA.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.h rename to src/buntime/web/webcrypto/CryptoAlgorithmECDSA.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSAOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmECDSAOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSAOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmECDSAOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEcKeyParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmEcKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmEcKeyParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmEcKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEcdhKeyDeriveParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmEcdhKeyDeriveParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmEcdhKeyDeriveParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmEcdhKeyDeriveParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEcdsaParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmEcdsaParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmEcdsaParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmEcdsaParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmEd25519.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmEd25519.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.h b/src/buntime/web/webcrypto/CryptoAlgorithmEd25519.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.h rename to src/buntime/web/webcrypto/CryptoAlgorithmEd25519.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmHKDF.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmHKDF.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.h b/src/buntime/web/webcrypto/CryptoAlgorithmHKDF.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.h rename to src/buntime/web/webcrypto/CryptoAlgorithmHKDF.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDFOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmHKDFOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDFOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmHKDFOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmHMAC.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmHMAC.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.h b/src/buntime/web/webcrypto/CryptoAlgorithmHMAC.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.h rename to src/buntime/web/webcrypto/CryptoAlgorithmHMAC.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHkdfParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmHkdfParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHkdfParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmHkdfParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHmacKeyParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmHmacKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmHmacKeyParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmHmacKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmIdentifier.h b/src/buntime/web/webcrypto/CryptoAlgorithmIdentifier.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmIdentifier.h rename to src/buntime/web/webcrypto/CryptoAlgorithmIdentifier.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.h b/src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.h rename to src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2OpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2OpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2OpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmPBKDF2OpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmParameters.h b/src/buntime/web/webcrypto/CryptoAlgorithmParameters.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmParameters.h rename to src/buntime/web/webcrypto/CryptoAlgorithmParameters.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmParameters.idl b/src/buntime/web/webcrypto/CryptoAlgorithmParameters.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmParameters.idl rename to src/buntime/web/webcrypto/CryptoAlgorithmParameters.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPbkdf2Params.h b/src/buntime/web/webcrypto/CryptoAlgorithmPbkdf2Params.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmPbkdf2Params.h rename to src/buntime/web/webcrypto/CryptoAlgorithmPbkdf2Params.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.h b/src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.h b/src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEP.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEP.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEP.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEP.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEP.h b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEP.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEP.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEP.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSS.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSS.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.h b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSS.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSS.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSSOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSSOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSSOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRSA_PSSOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistry.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRegistry.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistry.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRegistry.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistry.h b/src/buntime/web/webcrypto/CryptoAlgorithmRegistry.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistry.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRegistry.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistryOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmRegistryOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistryOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmRegistryOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaHashedImportParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmRsaHashedImportParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaHashedImportParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRsaHashedImportParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaHashedKeyGenParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmRsaHashedKeyGenParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaHashedKeyGenParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRsaHashedKeyGenParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaKeyGenParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmRsaKeyGenParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaKeyGenParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRsaKeyGenParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmRsaOaepParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRsaOaepParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaPssParams.h b/src/buntime/web/webcrypto/CryptoAlgorithmRsaPssParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaPssParams.h rename to src/buntime/web/webcrypto/CryptoAlgorithmRsaPssParams.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmSHA1.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA1.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.h b/src/buntime/web/webcrypto/CryptoAlgorithmSHA1.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.h rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA1.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmSHA224.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA224.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.h b/src/buntime/web/webcrypto/CryptoAlgorithmSHA224.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.h rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA224.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmSHA256.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA256.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.h b/src/buntime/web/webcrypto/CryptoAlgorithmSHA256.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.h rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA256.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmSHA384.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA384.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.h b/src/buntime/web/webcrypto/CryptoAlgorithmSHA384.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.h rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA384.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmSHA512.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA512.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.h b/src/buntime/web/webcrypto/CryptoAlgorithmSHA512.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.h rename to src/buntime/web/webcrypto/CryptoAlgorithmSHA512.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp b/src/buntime/web/webcrypto/CryptoAlgorithmX25519.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp rename to src/buntime/web/webcrypto/CryptoAlgorithmX25519.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.h b/src/buntime/web/webcrypto/CryptoAlgorithmX25519.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.h rename to src/buntime/web/webcrypto/CryptoAlgorithmX25519.h diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519Params.h b/src/buntime/web/webcrypto/CryptoAlgorithmX25519Params.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519Params.h rename to src/buntime/web/webcrypto/CryptoAlgorithmX25519Params.h diff --git a/src/bun.js/bindings/webcrypto/CryptoDigest.cpp b/src/buntime/web/webcrypto/CryptoDigest.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoDigest.cpp rename to src/buntime/web/webcrypto/CryptoDigest.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoDigest.h b/src/buntime/web/webcrypto/CryptoDigest.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoDigest.h rename to src/buntime/web/webcrypto/CryptoDigest.h diff --git a/src/bun.js/bindings/webcrypto/CryptoEcKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoEcKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoEcKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoEcKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoEcKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoEcKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoEcKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoEcKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoHmacKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoHmacKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoHmacKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoHmacKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoHmacKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoHmacKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoHmacKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoHmacKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoKey.cpp b/src/buntime/web/webcrypto/CryptoKey.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKey.cpp rename to src/buntime/web/webcrypto/CryptoKey.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKey.h b/src/buntime/web/webcrypto/CryptoKey.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKey.h rename to src/buntime/web/webcrypto/CryptoKey.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKey.idl b/src/buntime/web/webcrypto/CryptoKey.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKey.idl rename to src/buntime/web/webcrypto/CryptoKey.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp b/src/buntime/web/webcrypto/CryptoKeyAES.cpp similarity index 99% rename from src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp rename to src/buntime/web/webcrypto/CryptoKeyAES.cpp index fccffe621985..1cd5b98d65a7 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp +++ b/src/buntime/web/webcrypto/CryptoKeyAES.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "CryptoKeyAES.h" -#include "../wtf-bindings.h" +#include "wtf-bindings.h" #if ENABLE(WEB_CRYPTO) #include "CryptoAesKeyAlgorithm.h" diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAES.h b/src/buntime/web/webcrypto/CryptoKeyAES.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyAES.h rename to src/buntime/web/webcrypto/CryptoKeyAES.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp b/src/buntime/web/webcrypto/CryptoKeyEC.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp rename to src/buntime/web/webcrypto/CryptoKeyEC.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyEC.h b/src/buntime/web/webcrypto/CryptoKeyEC.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyEC.h rename to src/buntime/web/webcrypto/CryptoKeyEC.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoKeyECOpenSSL.cpp similarity index 99% rename from src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoKeyECOpenSSL.cpp index 05a597f53fdd..f27c2930e602 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp +++ b/src/buntime/web/webcrypto/CryptoKeyECOpenSSL.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "CryptoKeyEC.h" -#include "../wtf-bindings.h" +#include "wtf-bindings.h" #if ENABLE(WEB_CRYPTO) diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyFormat.h b/src/buntime/web/webcrypto/CryptoKeyFormat.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyFormat.h rename to src/buntime/web/webcrypto/CryptoKeyFormat.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp b/src/buntime/web/webcrypto/CryptoKeyHMAC.cpp similarity index 99% rename from src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp rename to src/buntime/web/webcrypto/CryptoKeyHMAC.cpp index 5bde29b77e33..1fe2a6403cd0 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp +++ b/src/buntime/web/webcrypto/CryptoKeyHMAC.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "CryptoKeyHMAC.h" -#include "../wtf-bindings.h" +#include "wtf-bindings.h" #if ENABLE(WEB_CRYPTO) diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.h b/src/buntime/web/webcrypto/CryptoKeyHMAC.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyHMAC.h rename to src/buntime/web/webcrypto/CryptoKeyHMAC.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp b/src/buntime/web/webcrypto/CryptoKeyOKP.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp rename to src/buntime/web/webcrypto/CryptoKeyOKP.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKP.h b/src/buntime/web/webcrypto/CryptoKeyOKP.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyOKP.h rename to src/buntime/web/webcrypto/CryptoKeyOKP.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoKeyOKPOpenSSL.cpp similarity index 99% rename from src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoKeyOKPOpenSSL.cpp index de29f6f753a5..f6cfa6f51cdf 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp +++ b/src/buntime/web/webcrypto/CryptoKeyOKPOpenSSL.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "CryptoKeyOKP.h" -#include "../wtf-bindings.h" +#include "wtf-bindings.h" #if ENABLE(WEB_CRYPTO) #include "JsonWebKey.h" diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyPair.h b/src/buntime/web/webcrypto/CryptoKeyPair.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyPair.h rename to src/buntime/web/webcrypto/CryptoKeyPair.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyPair.idl b/src/buntime/web/webcrypto/CryptoKeyPair.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyPair.idl rename to src/buntime/web/webcrypto/CryptoKeyPair.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp b/src/buntime/web/webcrypto/CryptoKeyRSA.cpp similarity index 99% rename from src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp rename to src/buntime/web/webcrypto/CryptoKeyRSA.cpp index 9f69d617e987..dd7967215263 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp +++ b/src/buntime/web/webcrypto/CryptoKeyRSA.cpp @@ -28,7 +28,7 @@ #include "CryptoKeyRSAComponents.h" #include "JsonWebKey.h" -#include "../wtf-bindings.h" +#include "wtf-bindings.h" #include #if ENABLE(WEB_CRYPTO) diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.h b/src/buntime/web/webcrypto/CryptoKeyRSA.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRSA.h rename to src/buntime/web/webcrypto/CryptoKeyRSA.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp b/src/buntime/web/webcrypto/CryptoKeyRSAComponents.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp rename to src/buntime/web/webcrypto/CryptoKeyRSAComponents.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h b/src/buntime/web/webcrypto/CryptoKeyRSAComponents.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h rename to src/buntime/web/webcrypto/CryptoKeyRSAComponents.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp b/src/buntime/web/webcrypto/CryptoKeyRSAOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp rename to src/buntime/web/webcrypto/CryptoKeyRSAOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp b/src/buntime/web/webcrypto/CryptoKeyRaw.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp rename to src/buntime/web/webcrypto/CryptoKeyRaw.cpp diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.h b/src/buntime/web/webcrypto/CryptoKeyRaw.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyRaw.h rename to src/buntime/web/webcrypto/CryptoKeyRaw.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyType.h b/src/buntime/web/webcrypto/CryptoKeyType.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyType.h rename to src/buntime/web/webcrypto/CryptoKeyType.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyUsage.h b/src/buntime/web/webcrypto/CryptoKeyUsage.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyUsage.h rename to src/buntime/web/webcrypto/CryptoKeyUsage.h diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyUsage.idl b/src/buntime/web/webcrypto/CryptoKeyUsage.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoKeyUsage.idl rename to src/buntime/web/webcrypto/CryptoKeyUsage.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoRsaHashedKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoRsaHashedKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoRsaHashedKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoRsaHashedKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoRsaHashedKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoRsaHashedKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoRsaHashedKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoRsaHashedKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/CryptoRsaKeyAlgorithm.h b/src/buntime/web/webcrypto/CryptoRsaKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoRsaKeyAlgorithm.h rename to src/buntime/web/webcrypto/CryptoRsaKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/CryptoRsaKeyAlgorithm.idl b/src/buntime/web/webcrypto/CryptoRsaKeyAlgorithm.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/CryptoRsaKeyAlgorithm.idl rename to src/buntime/web/webcrypto/CryptoRsaKeyAlgorithm.idl diff --git a/src/bun.js/bindings/webcrypto/EcKeyParams.idl b/src/buntime/web/webcrypto/EcKeyParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/EcKeyParams.idl rename to src/buntime/web/webcrypto/EcKeyParams.idl diff --git a/src/bun.js/bindings/webcrypto/EcdhKeyDeriveParams.idl b/src/buntime/web/webcrypto/EcdhKeyDeriveParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/EcdhKeyDeriveParams.idl rename to src/buntime/web/webcrypto/EcdhKeyDeriveParams.idl diff --git a/src/bun.js/bindings/webcrypto/EcdsaParams.idl b/src/buntime/web/webcrypto/EcdsaParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/EcdsaParams.idl rename to src/buntime/web/webcrypto/EcdsaParams.idl diff --git a/src/bun.js/bindings/webcrypto/HkdfParams.idl b/src/buntime/web/webcrypto/HkdfParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/HkdfParams.idl rename to src/buntime/web/webcrypto/HkdfParams.idl diff --git a/src/bun.js/bindings/webcrypto/HmacKeyParams.idl b/src/buntime/web/webcrypto/HmacKeyParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/HmacKeyParams.idl rename to src/buntime/web/webcrypto/HmacKeyParams.idl diff --git a/src/bun.js/bindings/webcrypto/JSAesCbcCfbParams.cpp b/src/buntime/web/webcrypto/JSAesCbcCfbParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesCbcCfbParams.cpp rename to src/buntime/web/webcrypto/JSAesCbcCfbParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSAesCbcCfbParams.h b/src/buntime/web/webcrypto/JSAesCbcCfbParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesCbcCfbParams.h rename to src/buntime/web/webcrypto/JSAesCbcCfbParams.h diff --git a/src/bun.js/bindings/webcrypto/JSAesCtrParams.cpp b/src/buntime/web/webcrypto/JSAesCtrParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesCtrParams.cpp rename to src/buntime/web/webcrypto/JSAesCtrParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSAesCtrParams.h b/src/buntime/web/webcrypto/JSAesCtrParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesCtrParams.h rename to src/buntime/web/webcrypto/JSAesCtrParams.h diff --git a/src/bun.js/bindings/webcrypto/JSAesGcmParams.cpp b/src/buntime/web/webcrypto/JSAesGcmParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesGcmParams.cpp rename to src/buntime/web/webcrypto/JSAesGcmParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSAesGcmParams.h b/src/buntime/web/webcrypto/JSAesGcmParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesGcmParams.h rename to src/buntime/web/webcrypto/JSAesGcmParams.h diff --git a/src/bun.js/bindings/webcrypto/JSAesKeyParams.cpp b/src/buntime/web/webcrypto/JSAesKeyParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesKeyParams.cpp rename to src/buntime/web/webcrypto/JSAesKeyParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSAesKeyParams.h b/src/buntime/web/webcrypto/JSAesKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSAesKeyParams.h rename to src/buntime/web/webcrypto/JSAesKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoAesKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoAesKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoAesKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoAesKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoAesKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoAesKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoAesKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoAesKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoAlgorithmParameters.cpp b/src/buntime/web/webcrypto/JSCryptoAlgorithmParameters.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoAlgorithmParameters.cpp rename to src/buntime/web/webcrypto/JSCryptoAlgorithmParameters.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoAlgorithmParameters.h b/src/buntime/web/webcrypto/JSCryptoAlgorithmParameters.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoAlgorithmParameters.h rename to src/buntime/web/webcrypto/JSCryptoAlgorithmParameters.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoEcKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoEcKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoEcKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoEcKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoEcKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoEcKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoEcKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoEcKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoHmacKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoHmacKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoHmacKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoHmacKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoHmacKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoHmacKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoHmacKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoHmacKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp b/src/buntime/web/webcrypto/JSCryptoKey.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKey.cpp rename to src/buntime/web/webcrypto/JSCryptoKey.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.h b/src/buntime/web/webcrypto/JSCryptoKey.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKey.h rename to src/buntime/web/webcrypto/JSCryptoKey.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyPair.cpp b/src/buntime/web/webcrypto/JSCryptoKeyPair.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyPair.cpp rename to src/buntime/web/webcrypto/JSCryptoKeyPair.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyPair.h b/src/buntime/web/webcrypto/JSCryptoKeyPair.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyPair.h rename to src/buntime/web/webcrypto/JSCryptoKeyPair.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp b/src/buntime/web/webcrypto/JSCryptoKeyUsage.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp rename to src/buntime/web/webcrypto/JSCryptoKeyUsage.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.h b/src/buntime/web/webcrypto/JSCryptoKeyUsage.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.h rename to src/buntime/web/webcrypto/JSCryptoKeyUsage.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoRsaHashedKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoRsaHashedKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoRsaHashedKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoRsaHashedKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoRsaHashedKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoRsaHashedKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoRsaHashedKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoRsaHashedKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSCryptoRsaKeyAlgorithm.cpp b/src/buntime/web/webcrypto/JSCryptoRsaKeyAlgorithm.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoRsaKeyAlgorithm.cpp rename to src/buntime/web/webcrypto/JSCryptoRsaKeyAlgorithm.cpp diff --git a/src/bun.js/bindings/webcrypto/JSCryptoRsaKeyAlgorithm.h b/src/buntime/web/webcrypto/JSCryptoRsaKeyAlgorithm.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSCryptoRsaKeyAlgorithm.h rename to src/buntime/web/webcrypto/JSCryptoRsaKeyAlgorithm.h diff --git a/src/bun.js/bindings/webcrypto/JSEcKeyParams.cpp b/src/buntime/web/webcrypto/JSEcKeyParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcKeyParams.cpp rename to src/buntime/web/webcrypto/JSEcKeyParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSEcKeyParams.h b/src/buntime/web/webcrypto/JSEcKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcKeyParams.h rename to src/buntime/web/webcrypto/JSEcKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/JSEcdhKeyDeriveParams.cpp b/src/buntime/web/webcrypto/JSEcdhKeyDeriveParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcdhKeyDeriveParams.cpp rename to src/buntime/web/webcrypto/JSEcdhKeyDeriveParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSEcdhKeyDeriveParams.h b/src/buntime/web/webcrypto/JSEcdhKeyDeriveParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcdhKeyDeriveParams.h rename to src/buntime/web/webcrypto/JSEcdhKeyDeriveParams.h diff --git a/src/bun.js/bindings/webcrypto/JSEcdsaParams.cpp b/src/buntime/web/webcrypto/JSEcdsaParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcdsaParams.cpp rename to src/buntime/web/webcrypto/JSEcdsaParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSEcdsaParams.h b/src/buntime/web/webcrypto/JSEcdsaParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSEcdsaParams.h rename to src/buntime/web/webcrypto/JSEcdsaParams.h diff --git a/src/bun.js/bindings/webcrypto/JSHkdfParams.cpp b/src/buntime/web/webcrypto/JSHkdfParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSHkdfParams.cpp rename to src/buntime/web/webcrypto/JSHkdfParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSHkdfParams.h b/src/buntime/web/webcrypto/JSHkdfParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSHkdfParams.h rename to src/buntime/web/webcrypto/JSHkdfParams.h diff --git a/src/bun.js/bindings/webcrypto/JSHmacKeyParams.cpp b/src/buntime/web/webcrypto/JSHmacKeyParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSHmacKeyParams.cpp rename to src/buntime/web/webcrypto/JSHmacKeyParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSHmacKeyParams.h b/src/buntime/web/webcrypto/JSHmacKeyParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSHmacKeyParams.h rename to src/buntime/web/webcrypto/JSHmacKeyParams.h diff --git a/src/bun.js/bindings/webcrypto/JSJsonWebKey.cpp b/src/buntime/web/webcrypto/JSJsonWebKey.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSJsonWebKey.cpp rename to src/buntime/web/webcrypto/JSJsonWebKey.cpp diff --git a/src/bun.js/bindings/webcrypto/JSJsonWebKey.h b/src/buntime/web/webcrypto/JSJsonWebKey.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSJsonWebKey.h rename to src/buntime/web/webcrypto/JSJsonWebKey.h diff --git a/src/bun.js/bindings/webcrypto/JSPbkdf2Params.cpp b/src/buntime/web/webcrypto/JSPbkdf2Params.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSPbkdf2Params.cpp rename to src/buntime/web/webcrypto/JSPbkdf2Params.cpp diff --git a/src/bun.js/bindings/webcrypto/JSPbkdf2Params.h b/src/buntime/web/webcrypto/JSPbkdf2Params.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSPbkdf2Params.h rename to src/buntime/web/webcrypto/JSPbkdf2Params.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaHashedImportParams.cpp b/src/buntime/web/webcrypto/JSRsaHashedImportParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaHashedImportParams.cpp rename to src/buntime/web/webcrypto/JSRsaHashedImportParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaHashedImportParams.h b/src/buntime/web/webcrypto/JSRsaHashedImportParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaHashedImportParams.h rename to src/buntime/web/webcrypto/JSRsaHashedImportParams.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaHashedKeyGenParams.cpp b/src/buntime/web/webcrypto/JSRsaHashedKeyGenParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaHashedKeyGenParams.cpp rename to src/buntime/web/webcrypto/JSRsaHashedKeyGenParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaHashedKeyGenParams.h b/src/buntime/web/webcrypto/JSRsaHashedKeyGenParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaHashedKeyGenParams.h rename to src/buntime/web/webcrypto/JSRsaHashedKeyGenParams.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaKeyGenParams.cpp b/src/buntime/web/webcrypto/JSRsaKeyGenParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaKeyGenParams.cpp rename to src/buntime/web/webcrypto/JSRsaKeyGenParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaKeyGenParams.h b/src/buntime/web/webcrypto/JSRsaKeyGenParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaKeyGenParams.h rename to src/buntime/web/webcrypto/JSRsaKeyGenParams.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaOaepParams.cpp b/src/buntime/web/webcrypto/JSRsaOaepParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaOaepParams.cpp rename to src/buntime/web/webcrypto/JSRsaOaepParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaOaepParams.h b/src/buntime/web/webcrypto/JSRsaOaepParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaOaepParams.h rename to src/buntime/web/webcrypto/JSRsaOaepParams.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaOtherPrimesInfo.cpp b/src/buntime/web/webcrypto/JSRsaOtherPrimesInfo.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaOtherPrimesInfo.cpp rename to src/buntime/web/webcrypto/JSRsaOtherPrimesInfo.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaOtherPrimesInfo.h b/src/buntime/web/webcrypto/JSRsaOtherPrimesInfo.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaOtherPrimesInfo.h rename to src/buntime/web/webcrypto/JSRsaOtherPrimesInfo.h diff --git a/src/bun.js/bindings/webcrypto/JSRsaPssParams.cpp b/src/buntime/web/webcrypto/JSRsaPssParams.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaPssParams.cpp rename to src/buntime/web/webcrypto/JSRsaPssParams.cpp diff --git a/src/bun.js/bindings/webcrypto/JSRsaPssParams.h b/src/buntime/web/webcrypto/JSRsaPssParams.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSRsaPssParams.h rename to src/buntime/web/webcrypto/JSRsaPssParams.h diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp b/src/buntime/web/webcrypto/JSSubtleCrypto.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp rename to src/buntime/web/webcrypto/JSSubtleCrypto.cpp diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.h b/src/buntime/web/webcrypto/JSSubtleCrypto.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSSubtleCrypto.h rename to src/buntime/web/webcrypto/JSSubtleCrypto.h diff --git a/src/bun.js/bindings/webcrypto/JSX25519Params.cpp b/src/buntime/web/webcrypto/JSX25519Params.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/JSX25519Params.cpp rename to src/buntime/web/webcrypto/JSX25519Params.cpp diff --git a/src/bun.js/bindings/webcrypto/JSX25519Params.h b/src/buntime/web/webcrypto/JSX25519Params.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JSX25519Params.h rename to src/buntime/web/webcrypto/JSX25519Params.h diff --git a/src/bun.js/bindings/webcrypto/JsonWebKey.h b/src/buntime/web/webcrypto/JsonWebKey.h similarity index 100% rename from src/bun.js/bindings/webcrypto/JsonWebKey.h rename to src/buntime/web/webcrypto/JsonWebKey.h diff --git a/src/bun.js/bindings/webcrypto/JsonWebKey.idl b/src/buntime/web/webcrypto/JsonWebKey.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/JsonWebKey.idl rename to src/buntime/web/webcrypto/JsonWebKey.idl diff --git a/src/bun.js/bindings/webcrypto/OpenSSLCryptoUniquePtr.h b/src/buntime/web/webcrypto/OpenSSLCryptoUniquePtr.h similarity index 100% rename from src/bun.js/bindings/webcrypto/OpenSSLCryptoUniquePtr.h rename to src/buntime/web/webcrypto/OpenSSLCryptoUniquePtr.h diff --git a/src/bun.js/bindings/webcrypto/OpenSSLUtilities.cpp b/src/buntime/web/webcrypto/OpenSSLUtilities.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/OpenSSLUtilities.cpp rename to src/buntime/web/webcrypto/OpenSSLUtilities.cpp diff --git a/src/bun.js/bindings/webcrypto/OpenSSLUtilities.h b/src/buntime/web/webcrypto/OpenSSLUtilities.h similarity index 100% rename from src/bun.js/bindings/webcrypto/OpenSSLUtilities.h rename to src/buntime/web/webcrypto/OpenSSLUtilities.h diff --git a/src/bun.js/bindings/webcrypto/Pbkdf2Params.idl b/src/buntime/web/webcrypto/Pbkdf2Params.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/Pbkdf2Params.idl rename to src/buntime/web/webcrypto/Pbkdf2Params.idl diff --git a/src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp b/src/buntime/web/webcrypto/PhonyWorkQueue.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp rename to src/buntime/web/webcrypto/PhonyWorkQueue.cpp diff --git a/src/bun.js/bindings/webcrypto/PhonyWorkQueue.h b/src/buntime/web/webcrypto/PhonyWorkQueue.h similarity index 100% rename from src/bun.js/bindings/webcrypto/PhonyWorkQueue.h rename to src/buntime/web/webcrypto/PhonyWorkQueue.h diff --git a/src/bun.js/bindings/webcrypto/RsaHashedImportParams.idl b/src/buntime/web/webcrypto/RsaHashedImportParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaHashedImportParams.idl rename to src/buntime/web/webcrypto/RsaHashedImportParams.idl diff --git a/src/bun.js/bindings/webcrypto/RsaHashedKeyGenParams.idl b/src/buntime/web/webcrypto/RsaHashedKeyGenParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaHashedKeyGenParams.idl rename to src/buntime/web/webcrypto/RsaHashedKeyGenParams.idl diff --git a/src/bun.js/bindings/webcrypto/RsaKeyGenParams.idl b/src/buntime/web/webcrypto/RsaKeyGenParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaKeyGenParams.idl rename to src/buntime/web/webcrypto/RsaKeyGenParams.idl diff --git a/src/bun.js/bindings/webcrypto/RsaOaepParams.idl b/src/buntime/web/webcrypto/RsaOaepParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaOaepParams.idl rename to src/buntime/web/webcrypto/RsaOaepParams.idl diff --git a/src/bun.js/bindings/webcrypto/RsaOtherPrimesInfo.h b/src/buntime/web/webcrypto/RsaOtherPrimesInfo.h similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaOtherPrimesInfo.h rename to src/buntime/web/webcrypto/RsaOtherPrimesInfo.h diff --git a/src/bun.js/bindings/webcrypto/RsaOtherPrimesInfo.idl b/src/buntime/web/webcrypto/RsaOtherPrimesInfo.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaOtherPrimesInfo.idl rename to src/buntime/web/webcrypto/RsaOtherPrimesInfo.idl diff --git a/src/bun.js/bindings/webcrypto/RsaPssParams.idl b/src/buntime/web/webcrypto/RsaPssParams.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/RsaPssParams.idl rename to src/buntime/web/webcrypto/RsaPssParams.idl diff --git a/src/bun.js/bindings/webcrypto/SerializedCryptoKeyWrap.h b/src/buntime/web/webcrypto/SerializedCryptoKeyWrap.h similarity index 100% rename from src/bun.js/bindings/webcrypto/SerializedCryptoKeyWrap.h rename to src/buntime/web/webcrypto/SerializedCryptoKeyWrap.h diff --git a/src/bun.js/bindings/webcrypto/SerializedCryptoKeyWrapOpenSSL.cpp b/src/buntime/web/webcrypto/SerializedCryptoKeyWrapOpenSSL.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/SerializedCryptoKeyWrapOpenSSL.cpp rename to src/buntime/web/webcrypto/SerializedCryptoKeyWrapOpenSSL.cpp diff --git a/src/bun.js/bindings/webcrypto/SubtleCrypto.cpp b/src/buntime/web/webcrypto/SubtleCrypto.cpp similarity index 100% rename from src/bun.js/bindings/webcrypto/SubtleCrypto.cpp rename to src/buntime/web/webcrypto/SubtleCrypto.cpp diff --git a/src/bun.js/bindings/webcrypto/SubtleCrypto.h b/src/buntime/web/webcrypto/SubtleCrypto.h similarity index 100% rename from src/bun.js/bindings/webcrypto/SubtleCrypto.h rename to src/buntime/web/webcrypto/SubtleCrypto.h diff --git a/src/bun.js/bindings/webcrypto/SubtleCrypto.idl b/src/buntime/web/webcrypto/SubtleCrypto.idl similarity index 100% rename from src/bun.js/bindings/webcrypto/SubtleCrypto.idl rename to src/buntime/web/webcrypto/SubtleCrypto.idl diff --git a/src/bun.js/uuid.zig b/src/buntime/web/webcrypto/uuid.zig similarity index 100% rename from src/bun.js/uuid.zig rename to src/buntime/web/webcrypto/uuid.zig diff --git a/src/bun.js/bindings/webcore/JSWebSocket.cpp b/src/buntime/web/websocket/JSWebSocket.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWebSocket.cpp rename to src/buntime/web/websocket/JSWebSocket.cpp diff --git a/src/bun.js/bindings/webcore/JSWebSocket.h b/src/buntime/web/websocket/JSWebSocket.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWebSocket.h rename to src/buntime/web/websocket/JSWebSocket.h diff --git a/src/bun.js/bindings/webcore/WebSocket.cpp b/src/buntime/web/websocket/WebSocket.cpp similarity index 100% rename from src/bun.js/bindings/webcore/WebSocket.cpp rename to src/buntime/web/websocket/WebSocket.cpp diff --git a/src/bun.js/bindings/webcore/WebSocket.h b/src/buntime/web/websocket/WebSocket.h similarity index 100% rename from src/bun.js/bindings/webcore/WebSocket.h rename to src/buntime/web/websocket/WebSocket.h diff --git a/src/bun.js/bindings/webcore/WebSocket.idl b/src/buntime/web/websocket/WebSocket.idl similarity index 100% rename from src/bun.js/bindings/webcore/WebSocket.idl rename to src/buntime/web/websocket/WebSocket.idl diff --git a/src/bun.js/bindings/webcore/WebSocketDeflate.h b/src/buntime/web/websocket/WebSocketDeflate.h similarity index 100% rename from src/bun.js/bindings/webcore/WebSocketDeflate.h rename to src/buntime/web/websocket/WebSocketDeflate.h diff --git a/src/bun.js/bindings/webcore/WebSocketErrorCode.h b/src/buntime/web/websocket/WebSocketErrorCode.h similarity index 100% rename from src/bun.js/bindings/webcore/WebSocketErrorCode.h rename to src/buntime/web/websocket/WebSocketErrorCode.h diff --git a/src/bun.js/bindings/webcore/WebSocketIdentifier.h b/src/buntime/web/websocket/WebSocketIdentifier.h similarity index 100% rename from src/bun.js/bindings/webcore/WebSocketIdentifier.h rename to src/buntime/web/websocket/WebSocketIdentifier.h diff --git a/src/bun.js/bindings/webcore/JSServiceWorker.h b/src/buntime/web/workers/JSServiceWorker.h similarity index 100% rename from src/bun.js/bindings/webcore/JSServiceWorker.h rename to src/buntime/web/workers/JSServiceWorker.h diff --git a/src/bun.js/bindings/webcore/JSWorker.cpp b/src/buntime/web/workers/JSWorker.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWorker.cpp rename to src/buntime/web/workers/JSWorker.cpp diff --git a/src/bun.js/bindings/webcore/JSWorker.h b/src/buntime/web/workers/JSWorker.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWorker.h rename to src/buntime/web/workers/JSWorker.h diff --git a/src/bun.js/bindings/webcore/JSWorkerOptions.cpp b/src/buntime/web/workers/JSWorkerOptions.cpp similarity index 100% rename from src/bun.js/bindings/webcore/JSWorkerOptions.cpp rename to src/buntime/web/workers/JSWorkerOptions.cpp diff --git a/src/bun.js/bindings/webcore/JSWorkerOptions.h b/src/buntime/web/workers/JSWorkerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/JSWorkerOptions.h rename to src/buntime/web/workers/JSWorkerOptions.h diff --git a/src/bun.js/bindings/webcore/Worker.cpp b/src/buntime/web/workers/Worker.cpp similarity index 100% rename from src/bun.js/bindings/webcore/Worker.cpp rename to src/buntime/web/workers/Worker.cpp diff --git a/src/bun.js/bindings/webcore/Worker.h b/src/buntime/web/workers/Worker.h similarity index 100% rename from src/bun.js/bindings/webcore/Worker.h rename to src/buntime/web/workers/Worker.h diff --git a/src/bun.js/bindings/webcore/WorkerOptions.h b/src/buntime/web/workers/WorkerOptions.h similarity index 100% rename from src/bun.js/bindings/webcore/WorkerOptions.h rename to src/buntime/web/workers/WorkerOptions.h diff --git a/src/bun.js/web_worker.zig b/src/buntime/web/workers/web_worker.zig similarity index 99% rename from src/bun.js/web_worker.zig rename to src/buntime/web/workers/web_worker.zig index 7714d889d142..5904defd9604 100644 --- a/src/bun.js/web_worker.zig +++ b/src/buntime/web/workers/web_worker.zig @@ -642,7 +642,7 @@ comptime { } const std = @import("std"); -const WTFStringImpl = @import("../string.zig").WTFStringImpl; +const WTFStringImpl = @import("../../../string.zig").WTFStringImpl; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/bun.js/webcore.zig b/src/buntime/webcore.zig similarity index 52% rename from src/bun.js/webcore.zig rename to src/buntime/webcore.zig index 8dbf4a02e413..224ef4a375cc 100644 --- a/src/bun.js/webcore.zig +++ b/src/buntime/webcore.zig @@ -2,48 +2,48 @@ comptime { if (bun.Environment.export_cpp_apis) { - _ = &@import("./webcore/prompt.zig"); + _ = &@import("./api/console/prompt.zig"); } - _ = &@import("./webcore/TextEncoder.zig"); + _ = &@import("./web/encoding/TextEncoder.zig"); } -pub const DOMExceptionCode = @import("./bindings/JSErrorCode.zig").DOMExceptionCode; +pub const DOMExceptionCode = @import("./api/error/JSErrorCode.zig").DOMExceptionCode; // TODO: make this JSGlobalObject local for better security pub const ByteListPool = bun.ObjectPool(bun.ByteList, null, true, 8); -pub const Crypto = @import("./webcore/Crypto.zig"); -pub const AbortSignal = @import("./bindings/AbortSignal.zig").AbortSignal; -pub const WebWorker = @import("./web_worker.zig"); -pub const AutoFlusher = @import("./webcore/AutoFlusher.zig"); -pub const EncodingLabel = @import("./webcore/EncodingLabel.zig").EncodingLabel; -pub const Fetch = @import("./webcore/fetch.zig"); -pub const Response = @import("./webcore/Response.zig"); -pub const BakeResponse = @import("./webcore/BakeResponse.zig"); -pub const TextDecoder = @import("./webcore/TextDecoder.zig"); -pub const TextEncoder = @import("./webcore/TextEncoder.zig"); -pub const TextEncoderStreamEncoder = @import("./webcore/TextEncoderStreamEncoder.zig"); -pub const encoding = @import("./webcore/encoding.zig"); -pub const ReadableStream = @import("./webcore/ReadableStream.zig"); -pub const Blob = @import("./webcore/Blob.zig"); -pub const S3Stat = @import("./webcore/S3Stat.zig").S3Stat; -pub const ResumableFetchSink = @import("./webcore/ResumableSink.zig").ResumableFetchSink; -pub const ResumableS3UploadSink = @import("./webcore/ResumableSink.zig").ResumableS3UploadSink; -pub const ResumableSinkBackpressure = @import("./webcore/ResumableSink.zig").ResumableSinkBackpressure; -pub const S3Client = @import("./webcore/S3Client.zig").S3Client; -pub const Request = @import("./webcore/Request.zig"); -pub const Body = @import("./webcore/Body.zig"); -pub const CookieMap = @import("./webcore/CookieMap.zig").CookieMap; -pub const ObjectURLRegistry = @import("./webcore/ObjectURLRegistry.zig"); -pub const Sink = @import("./webcore/Sink.zig"); -pub const FileSink = @import("./webcore/FileSink.zig"); -pub const FetchHeaders = @import("./bindings/FetchHeaders.zig").FetchHeaders; -pub const ByteBlobLoader = @import("./webcore/ByteBlobLoader.zig"); -pub const ByteStream = @import("./webcore/ByteStream.zig"); -pub const FileReader = @import("./webcore/FileReader.zig"); -pub const ScriptExecutionContext = @import("./webcore/ScriptExecutionContext.zig"); - -pub const streams = @import("./webcore/streams.zig"); +pub const Crypto = @import("./web/webcrypto/Crypto.zig"); +pub const AbortSignal = @import("./web/events/AbortSignal.zig").AbortSignal; +pub const WebWorker = @import("./web/workers/web_worker.zig"); +pub const AutoFlusher = @import("./jsc/interop/AutoFlusher.zig"); +pub const EncodingLabel = @import("./web/encoding/EncodingLabel.zig").EncodingLabel; +pub const Fetch = @import("./web/fetch/fetch.zig"); +pub const Response = @import("./web/http/Response.zig"); +pub const BakeResponse = @import("./web/http/BakeResponse.zig"); +pub const TextDecoder = @import("./web/encoding/TextDecoder.zig"); +pub const TextEncoder = @import("./web/encoding/TextEncoder.zig"); +pub const TextEncoderStreamEncoder = @import("./web/encoding/TextEncoderStreamEncoder.zig"); +pub const encoding = @import("./web/encoding/encoding.zig"); +pub const ReadableStream = @import("./web/streams/ReadableStream.zig"); +pub const Blob = @import("./web/blob/Blob.zig"); +pub const S3Stat = @import("./api/s3/S3Stat.zig").S3Stat; +pub const ResumableFetchSink = @import("./web/streams/ResumableSink.zig").ResumableFetchSink; +pub const ResumableS3UploadSink = @import("./web/streams/ResumableSink.zig").ResumableS3UploadSink; +pub const ResumableSinkBackpressure = @import("./web/streams/ResumableSink.zig").ResumableSinkBackpressure; +pub const S3Client = @import("./api/s3/S3Client.zig").S3Client; +pub const Request = @import("./web/http/Request.zig"); +pub const Body = @import("./web/http/Body.zig"); +pub const CookieMap = @import("./api/cookie/CookieMap.zig").CookieMap; +pub const ObjectURLRegistry = @import("./web/url/ObjectURLRegistry.zig"); +pub const Sink = @import("./web/streams/Sink.zig"); +pub const FileSink = @import("./web/streams/FileSink.zig"); +pub const FetchHeaders = @import("./web/fetch/FetchHeaders.zig").FetchHeaders; +pub const ByteBlobLoader = @import("./web/blob/ByteBlobLoader.zig"); +pub const ByteStream = @import("./web/streams/ByteStream.zig"); +pub const FileReader = @import("./web/blob/FileReader.zig"); +pub const ScriptExecutionContext = @import("./jsc/global/ScriptExecutionContext.zig"); + +pub const streams = @import("./web/streams/streams.zig"); pub const NetworkSink = streams.NetworkSink; pub const HTTPResponseSink = streams.HTTPResponseSink; pub const HTTPSResponseSink = streams.HTTPSResponseSink; diff --git a/src/cli/exec_command.zig b/src/cli/exec_command.zig index 67b254ff477a..cda2b5bcdf08 100644 --- a/src/cli/exec_command.zig +++ b/src/cli/exec_command.zig @@ -5,7 +5,7 @@ pub const ExecCommand = struct { var bundle = try bun.Transpiler.init( ctx.allocator, ctx.log, - try @import("../bun.js/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), + try @import("../buntime/core/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), null, ); try bundle.runEnvLoader(bundle.options.env.disable_default_env_files); diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig index 04868c37f2d9..c404ed09b0b5 100644 --- a/src/cli/test_command.zig +++ b/src/cli/test_command.zig @@ -1999,7 +1999,7 @@ const string = []const u8; const DotEnv = @import("../env_loader.zig"); const Scanner = @import("./test/Scanner.zig"); -const bun_test = @import("../bun.js/test/bun_test.zig"); +const bun_test = @import("../test_runner/bun_test.zig"); const options = @import("../options.zig"); const resolve_path = @import("../resolver/resolve_path.zig"); const std = @import("std"); diff --git a/src/codegen/bindgen.ts b/src/codegen/bindgen.ts index 386823736f99..5562bf0d35d3 100644 --- a/src/codegen/bindgen.ts +++ b/src/codegen/bindgen.ts @@ -1202,7 +1202,9 @@ for (const type of typeHashToReachableType.values()) { for (const [filename, { functions, typedefs }] of files) { const namespaceVar = fileMap.get(filename)!; assert(namespaceVar, `namespaceVar not found for ${filename}, ${inspect(fileMap)}`); - zigInternal.line(`const import_${namespaceVar} = @import(${str(path.relative(src + "/bun.js", filename))});`); + zigInternal.line( + `const import_${namespaceVar} = @import(${str(path.relative(src + "/buntime/jsc/generated", path.join(src, filename)))});`, + ); zig.line(`/// Generated for "src/${filename}"`); zig.line(`pub const ${namespaceVar} = struct {`); @@ -1506,7 +1508,7 @@ writeIfNotChanged( path.join(codegenRoot, "GeneratedBindings.cpp"), [...headers].map(name => `#include ${str(name)}\n`).join("") + "\n" + cppInternal.buffer + "\n" + cpp.buffer, ); -writeIfNotChanged(path.join(src, "bun.js/bindings/GeneratedBindings.zig"), zig.buffer + zigInternal.buffer); +writeIfNotChanged(path.join(src, "buntime/jsc/generated/GeneratedBindings.zig"), zig.buffer + zigInternal.buffer); // Headers for (const [filename, { functions, typedefs }] of files) { diff --git a/src/codegen/bundle-modules.ts b/src/codegen/bundle-modules.ts index c282da4560bb..3af8d7a8dfaf 100644 --- a/src/codegen/bundle-modules.ts +++ b/src/codegen/bundle-modules.ts @@ -12,7 +12,7 @@ import fs from "fs"; import { mkdir, writeFile } from "fs/promises"; import { builtinModules } from "node:module"; import path from "path"; -import jsclasses from "./../bun.js/bindings/js_classes"; +import jsclasses from "./../buntime/jsc/generated/js_classes"; import { sliceSourceCode } from "./builtin-parser"; import { createAssertClientJS, createLogClientJS } from "./client-js"; import { getJS2NativeCPP, getJS2NativeZig } from "./generate-js2native"; @@ -474,14 +474,14 @@ ${Object.entries(nativeModuleEnumToId) writeIfNotChanged( path.join(CODEGEN_DIR, "NativeModuleImpl.h"), Object.values(nativeModuleEnums) - .map(value => `#include "../../bun.js/modules/${value}Module.h"`) + .map(value => `#include "../../buntime/modules/${value}Module.h"`) .join("\n") + "\n", ); writeIfNotChanged(path.join(CODEGEN_DIR, "GeneratedJS2Native.h"), getJS2NativeCPP()); // zig will complain if this file is outside of the module -const js2nativeZigPath = path.join(import.meta.dir, "../bun.js/bindings/GeneratedJS2Native.zig"); +const js2nativeZigPath = path.join(import.meta.dir, "../buntime/jsc/generated/GeneratedJS2Native.zig"); writeIfNotChanged(js2nativeZigPath, getJS2NativeZig(js2nativeZigPath)); const generatedDTSPath = path.join(CODEGEN_DIR, "generated.d.ts"); diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index 929585c97622..f667c095c2da 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1,6 +1,6 @@ // @ts-nocheck import path from "path"; -import jsclasses from "./../bun.js/bindings/js_classes"; +import jsclasses from "./../buntime/jsc/generated/js_classes"; import { InvalidThisBehavior, type ClassDefinition, type Field } from "./class-definitions"; import { camelCase, pascalCase, writeIfNotChanged } from "./helpers"; @@ -2727,8 +2727,8 @@ const ZIG_GENERATED_CLASSES_HEADER = ` /// bun run build /// /// This file is generated by: -/// 1. \`bun src/bun.js/scripts/generate-classes.ts\` -/// 2. Scan for **/*.classes.ts files in src/bun.js/src +/// 1. \`bun src/buntime/scripts/generate-classes.ts\` +/// 2. Scan for **/*.classes.ts files in src/buntime/src /// 3. Generate a JS wrapper for each class in: /// - Zig: generated_classes.zig /// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp diff --git a/src/codegen/generate-node-errors.ts b/src/codegen/generate-node-errors.ts index 9fee92799948..958c70d4c4cb 100644 --- a/src/codegen/generate-node-errors.ts +++ b/src/codegen/generate-node-errors.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import NodeErrors from "../bun.js/bindings/ErrorCode.ts"; +import NodeErrors from "../buntime/api/error/ErrorCode.ts"; import { writeIfNotChanged } from "./helpers.ts"; const outputDir = process.argv[2]; @@ -24,7 +24,7 @@ let zig = ``; enumHeader = ` // clang-format off // Generated by: src/codegen/generate-node-errors.ts -// Input: src/bun.js/bindings/ErrorCode.ts +// Input: src/buntime/api/error/ErrorCode.ts #pragma once #include @@ -149,7 +149,7 @@ let builtindts = await Bun.file(builtindtsPath).text(); let dts = ` // Generated by: src/codegen/generate-node-errors.ts -// Input: src/bun.js/bindings/ErrorCode.ts +// Input: src/buntime/api/error/ErrorCode.ts // Global error code functions for TypeScript `; diff --git a/src/codegen/internal-module-registry-scanner.ts b/src/codegen/internal-module-registry-scanner.ts index 512170ac0e52..1cd23620ec5b 100644 --- a/src/codegen/internal-module-registry-scanner.ts +++ b/src/codegen/internal-module-registry-scanner.ts @@ -35,7 +35,7 @@ export function createInternalModuleRegistry(basedir: string) { const nativeModuleEnumToId: Record = {}; // Native Module registry - const nativeModuleH = fs.readFileSync(path.join(basedir, "../bun.js/modules/_NativeModule.h"), "utf8"); + const nativeModuleH = fs.readFileSync(path.join(basedir, "../buntime/modules/_NativeModule.h"), "utf8"); for (const [_, idString, enumValue] of nativeModuleH.matchAll(/macro\((.*?),(.*?)\)/g)) { const processedIdString = JSON.parse(idString.trim().replace(/_s$/, "")); const processedEnumValue = enumValue.trim(); diff --git a/src/codegen/replacements.ts b/src/codegen/replacements.ts index a0b43be96873..d80eb243035e 100644 --- a/src/codegen/replacements.ts +++ b/src/codegen/replacements.ts @@ -1,6 +1,6 @@ import { LoaderKeys } from "../api/schema"; -import NodeErrors from "../bun.js/bindings/ErrorCode.ts"; -import jsclasses from "./../bun.js/bindings/js_classes"; +import NodeErrors from "../buntime/api/error/ErrorCode.ts"; +import jsclasses from "./../buntime/jsc/generated/js_classes"; import { sliceSourceCode } from "./builtin-parser"; import { registerNativeCall } from "./generate-js2native"; diff --git a/src/crash_handler.zig b/src/crash_handler.zig index d90241044402..5b26dc07f2e0 100644 --- a/src/crash_handler.zig +++ b/src/crash_handler.zig @@ -2288,7 +2288,7 @@ comptime { } } -const CPUFeatures = @import("./bun.js/bindings/CPUFeatures.zig"); +const CPUFeatures = @import("./buntime/jsc/interop/CPUFeatures.zig"); const builtin = @import("builtin"); const std = @import("std"); const windows = std.os.windows; diff --git a/src/deps/uws/UpgradedDuplex.zig b/src/deps/uws/UpgradedDuplex.zig index 8a850ac33315..82f864df0092 100644 --- a/src/deps/uws/UpgradedDuplex.zig +++ b/src/deps/uws/UpgradedDuplex.zig @@ -474,7 +474,7 @@ pub fn deinit(this: *UpgradedDuplex) void { const log = bun.Output.scoped(.UpgradedDuplex, .visible); -const SSLWrapper = @import("../../bun.js/api/bun/ssl_wrapper.zig").SSLWrapper; +const SSLWrapper = @import("../../buntime/api/bun/ssl_wrapper.zig").SSLWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/deps/uws/WindowsNamedPipe.zig b/src/deps/uws/WindowsNamedPipe.zig index 9a2eee1d9dd1..0ca125d94854 100644 --- a/src/deps/uws/WindowsNamedPipe.zig +++ b/src/deps/uws/WindowsNamedPipe.zig @@ -578,7 +578,7 @@ const WrapperType = SSLWrapper(*WindowsNamedPipe); const log = bun.Output.scoped(.WindowsNamedPipe, .visible); const std = @import("std"); -const SSLWrapper = @import("../../bun.js/api/bun/ssl_wrapper.zig").SSLWrapper; +const SSLWrapper = @import("../../buntime/api/bun/ssl_wrapper.zig").SSLWrapper; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/glob/GlobWalker.zig b/src/glob/GlobWalker.zig index 2fda733a469d..a2130c1bc1e1 100644 --- a/src/glob/GlobWalker.zig +++ b/src/glob/GlobWalker.zig @@ -1235,8 +1235,8 @@ pub fn GlobWalker_( if (pattern.syntax_hint == .Double) { // Stop the double wildcard if it matches the pattern afer it // Example: src/**/*.js - // - Matches: src/bun.js/ - // src/bun.js/foo/bar/baz.js + // - Matches: src/buntime/ + // src/buntime/foo/bar/baz.js if (!is_last and this.matchPatternImpl(next_pattern.?, entry_name)) { // But if the next pattern is the last // component, it should match and propagate the @@ -1683,7 +1683,7 @@ pub fn matchWildcardLiteral(literal: []const u8, path: []const u8) bool { return std.mem.eql(u8, literal, path); } -const DirIterator = @import("../bun.js/node/dir_iterator.zig"); +const DirIterator = @import("../buntime/node/dir_iterator.zig"); const ResolvePath = @import("../resolver/resolve_path.zig"); const bun = @import("bun"); diff --git a/src/http/ProxyTunnel.zig b/src/http/ProxyTunnel.zig index de197e4047f0..719d25d17126 100644 --- a/src/http/ProxyTunnel.zig +++ b/src/http/ProxyTunnel.zig @@ -378,7 +378,7 @@ fn deinit(this: *ProxyTunnel) void { const log = bun.Output.scoped(.http_proxy_tunnel, .visible); const HTTPCertError = @import("./HTTPCertError.zig"); -const SSLWrapper = @import("../bun.js/api/bun/ssl_wrapper.zig").SSLWrapper; +const SSLWrapper = @import("../buntime/api/bun/ssl_wrapper.zig").SSLWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/js/AGENTS.md b/src/js/AGENTS.md deleted file mode 120000 index 681311eb9cf4..000000000000 --- a/src/js/AGENTS.md +++ /dev/null @@ -1 +0,0 @@ -CLAUDE.md \ No newline at end of file diff --git a/src/js/AGENTS.md b/src/js/AGENTS.md new file mode 100644 index 000000000000..e34bbfc52601 --- /dev/null +++ b/src/js/AGENTS.md @@ -0,0 +1,106 @@ +# JavaScript Builtins in Bun + +Write JS builtins for Bun's Node.js compatibility and APIs. Run `bun bd` after changes. + +## Directory Structure + +- `builtins/` - Individual functions (`*CodeGenerator(vm)` in C++) +- `node/` - Node.js modules (`node:fs`, `node:path`) +- `bun/` - Bun modules (`bun:ffi`, `bun:sqlite`) +- `thirdparty/` - NPM replacements (`ws`, `node-fetch`) +- `internal/` - Internal modules + +## Writing Modules + +Modules are NOT ES modules: + +```typescript +const EventEmitter = require("node:events"); // String literals only +const { validateFunction } = require("internal/validators"); + +export default { + myFunction() { + if (!$isCallable(callback)) { + throw $ERR_INVALID_ARG_TYPE("cb", "function", callback); + } + }, +}; +``` + +## Writing Builtin Functions + +```typescript +export function initializeReadableStream( + this: ReadableStream, + underlyingSource, + strategy, +) { + if (!$isObject(underlyingSource)) { + throw new TypeError( + "ReadableStream constructor takes an object as first argument", + ); + } + $putByIdDirectPrivate(this, "state", $streamReadable); +} +``` + +C++ access: + +```cpp +object->putDirectBuiltinFunction(vm, globalObject, identifier, + readableStreamInitializeReadableStreamCodeGenerator(vm), 0); +``` + +## $ Globals and Special Syntax + +**CRITICAL**: Use `.$call` and `.$apply`, never `.call` or `.apply`: + +```typescript +// ✗ WRONG - User can tamper +callback.call(undefined, arg1); +fn.apply(undefined, args); + +// ✓ CORRECT - Tamper-proof +callback.$call(undefined, arg1); +fn.$apply(undefined, args); + +// $ prefix for private APIs +const arr = $Array.from(...); // Private globals +map.$set(key, value); // Private methods +const newArr = $newArrayWithSize(5); // JSC intrinsics +$debug("Module loaded:", name); // Debug (stripped in release) +$assert(condition, "message"); // Assertions (stripped in release) +``` + +**Platform detection**: `process.platform` and `process.arch` are inlined and dead-code eliminated + +## Validation and Errors + +```typescript +const { validateFunction } = require("internal/validators"); + +function myAPI(callback) { + if (!$isCallable(callback)) { + throw $ERR_INVALID_ARG_TYPE("callback", "function", callback); + } +} +``` + +## Build Process + +`Source TS/JS → Preprocessor → Bundler → C++ Headers` + +1. Assign numeric IDs (A-Z sorted) +2. Replace `$` with `__intrinsic__`, `require("x")` with `$requireId(n)` +3. Bundle, convert `export default` to `return` +4. Replace `__intrinsic__` with `@`, inline into C++ + +ModuleLoader.zig loads modules by numeric ID via `InternalModuleRegistry.cpp`. + +## Key Rules + +- Use `.$call`/`.$apply` not `.call`/`.apply` +- String literal `require()` only +- Export via `export default {}` +- Use JSC intrinsics for performance +- Run `bun bd` after changes diff --git a/src/js/node/dns.ts b/src/js/node/dns.ts index 03ea35aa8ba1..7d725125cf52 100644 --- a/src/js/node/dns.ts +++ b/src/js/node/dns.ts @@ -66,14 +66,14 @@ function setServers(servers) { } const getRuntimeDefaultResultOrderOption = $newZigFunction( - "bun.js/api/bun/dns.zig", + "buntime/api/bun/dns.zig", "Resolver.getRuntimeDefaultResultOrderOption", 0, ); function newResolver(options) { if (!newResolver.zig) { - newResolver.zig = $newZigFunction("bun.js/api/bun/dns.zig", "Resolver.newResolver", 1); + newResolver.zig = $newZigFunction("buntime/api/bun/dns.zig", "Resolver.newResolver", 1); } return newResolver.zig(options); } diff --git a/src/js/node/fs.ts b/src/js/node/fs.ts index ae9a97eb1cf1..178df3d02b94 100644 --- a/src/js/node/fs.ts +++ b/src/js/node/fs.ts @@ -732,7 +732,7 @@ const realpathSync: typeof import("node:fs").realpathSync = if (typeof options === "string") encoding = options; else encoding = options?.encoding; if (encoding) { - (assertEncodingForWindows ?? $newZigFunction("bun.js/node/types.zig", "jsAssertEncodingValid", 1))( + (assertEncodingForWindows ?? $newZigFunction("buntime/node/types.zig", "jsAssertEncodingValid", 1))( encoding, ); } @@ -854,7 +854,7 @@ const realpath: typeof import("node:fs").realpath = if (typeof options === "string") encoding = options; else encoding = options?.encoding; if (encoding) { - (assertEncodingForWindows ?? $newZigFunction("bun.js/node/types.zig", "jsAssertEncodingValid", 1))( + (assertEncodingForWindows ?? $newZigFunction("buntime/node/types.zig", "jsAssertEncodingValid", 1))( encoding, ); } diff --git a/src/js/private.d.ts b/src/js/private.d.ts index 7092f3f1d477..b64c7d1bb901 100644 --- a/src/js/private.d.ts +++ b/src/js/private.d.ts @@ -201,7 +201,7 @@ interface JSCommonJSModule { * codegen. Passing a template parameter will break codegen. Prefer `$cpp(...) * as Foo` instead. * - * Binding files are located in `src/bun.js/bindings` + * Binding files are located in `src/buntime/bindings` * * @see {@link $zig} for native zig bindings. * @see `src/codegen/replacements.ts` for the script that performs replacement of this funciton. @@ -220,7 +220,7 @@ declare function $cpp(filename: NativeFilenameCPP, symbol: string): T; * codegen. Passing a template parameter will break codegen. Prefer `$zig(...) * as Foo` instead. * - * Binding files are located in `src/bun.js/bindings` + * Binding files are located in `src/buntime/bindings` * * @see {@link $cpp} for native c++ bindings. * @see `src/codegen/replacements.ts` for the script that performs replacement of this funciton. diff --git a/src/logger.zig b/src/logger.zig index 1214403e0a05..0f0b8cf7527c 100644 --- a/src/logger.zig +++ b/src/logger.zig @@ -1368,7 +1368,7 @@ pub const Source = struct { } pub fn rangeOfIdentifier(this: *const Source, loc: Loc) Range { - const js_lexer = @import("./js_lexer.zig"); + const js_lexer = @import("./transpiler/js_lexer.zig"); return js_lexer.rangeOfIdentifier(this, loc); } diff --git a/src/main_test.zig b/src/main_test.zig index e6edd180bfa4..1ba876e00a42 100644 --- a/src/main_test.zig +++ b/src/main_test.zig @@ -194,7 +194,7 @@ comptime { _ = bun.bun_js.Bun__onRejectEntryPointResult; _ = bun.bun_js.Bun__onResolveEntryPointResult; - _ = &@import("./bun.js/node/buffer.zig").BufferVectorized; + _ = &@import("./buntime/node/buffer.zig").BufferVectorized; @import("./cli/upgrade_command.zig").@"export"(); @import("./cli/test_command.zig").@"export"(); } diff --git a/src/napi/napi.zig b/src/napi/napi.zig index 3f8447ed3ddc..342d083b0b66 100644 --- a/src/napi/napi.zig +++ b/src/napi/napi.zig @@ -2498,7 +2498,7 @@ pub fn fixDeadCodeElimination() void { std.mem.doNotOptimizeAway(&@field(posix_platform_specific_v8_apis, decl.name)); } - std.mem.doNotOptimizeAway(&@import("../bun.js/node/buffer.zig").BufferVectorized.fill); + std.mem.doNotOptimizeAway(&@import("../buntime/node/buffer.zig").BufferVectorized.fill); } pub const NapiFinalizerTask = struct { diff --git a/src/options.zig b/src/options.zig index 80fc687768f3..e983e386ba02 100644 --- a/src/options.zig +++ b/src/options.zig @@ -613,7 +613,7 @@ pub const WindowsOptions = struct { // The max integer value in this enum can only be appended to. // It has dependencies in several places: // - bun-native-bundler-plugin-api/bundler_plugin.h -// - src/bun.js/bindings/headers-handwritten.h +// - src/buntime/bindings/headers-handwritten.h pub const Loader = enum(u8) { jsx = 0, js = 1, diff --git a/src/pool.zig b/src/pool.zig index 37c5eddeca85..1bff31d8b236 100644 --- a/src/pool.zig +++ b/src/pool.zig @@ -247,7 +247,7 @@ pub fn ObjectPool( fn destroyNode(node: *LinkedList.Node) void { // TODO: Once a generic-allocator version of `BabyList` is added, change - // `ByteListPool` in `bun.js/webcore.zig` to use a managed default-allocator + // `ByteListPool` in `buntime/webcore.zig` to use a managed default-allocator // `ByteList` instead, and then get rid of the special-casing for `ByteList` // here. This will fix a memory leak. if (comptime Type != bun.ByteList) { diff --git a/src/renamer.zig b/src/renamer.zig index e2e3c991bc5a..5b793b8a4b1f 100644 --- a/src/renamer.zig +++ b/src/renamer.zig @@ -951,7 +951,7 @@ pub fn computeReservedNamesForScope( const string = []const u8; -const JSLexer = @import("./js_lexer.zig"); +const JSLexer = @import("./transpiler/js_lexer.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/s3/client.zig b/src/s3/client.zig index 6adf666a4ade..a828c77232b9 100644 --- a/src/s3/client.zig +++ b/src/s3/client.zig @@ -333,7 +333,7 @@ pub const S3UploadStreamWrapper = struct { const RefCount = bun.ptr.RefCount(@This(), "ref_count", deinit, .{}); pub const ref = RefCount.ref; pub const deref = RefCount.deref; - pub const ResumableSink = @import("../bun.js/webcore/ResumableSink.zig").ResumableS3UploadSink; + pub const ResumableSink = @import("../buntime/web/streams/ResumableSink.zig").ResumableS3UploadSink; const log = bun.Output.scoped(.S3UploadStream, .visible); ref_count: RefCount, diff --git a/src/shell/subproc.zig b/src/shell/subproc.zig index 0e28c43ec63b..095c0f1af50d 100644 --- a/src/shell/subproc.zig +++ b/src/shell/subproc.zig @@ -1,4 +1,4 @@ -// const IPC = @import("../bun.js/ipc.zig"); +// const IPC = @import("../buntime/ipc.zig"); pub const Stdio = util.Stdio; // pub const ShellSubprocess = NewShellSubprocess(.js); diff --git a/src/bun.js/bindings/BunCommonStrings.cpp b/src/string/BunCommonStrings.cpp similarity index 100% rename from src/bun.js/bindings/BunCommonStrings.cpp rename to src/string/BunCommonStrings.cpp diff --git a/src/bun.js/bindings/BunCommonStrings.h b/src/string/BunCommonStrings.h similarity index 100% rename from src/bun.js/bindings/BunCommonStrings.h rename to src/string/BunCommonStrings.h diff --git a/src/bun.js/bindings/BunString.cpp b/src/string/BunString.cpp similarity index 100% rename from src/bun.js/bindings/BunString.cpp rename to src/string/BunString.cpp diff --git a/src/bun.js/bindings/BunString.h b/src/string/BunString.h similarity index 100% rename from src/bun.js/bindings/BunString.h rename to src/string/BunString.h diff --git a/src/bun.js/bindings/ConcatCStrings.h b/src/string/ConcatCStrings.h similarity index 100% rename from src/bun.js/bindings/ConcatCStrings.h rename to src/string/ConcatCStrings.h diff --git a/src/bun.js/bindings/DoubleFormatter.cpp b/src/string/DoubleFormatter.cpp similarity index 100% rename from src/bun.js/bindings/DoubleFormatter.cpp rename to src/string/DoubleFormatter.cpp diff --git a/src/bun.js/bindings/MiString.h b/src/string/MiString.h similarity index 100% rename from src/bun.js/bindings/MiString.h rename to src/string/MiString.h diff --git a/src/string/MutableString.zig b/src/string/MutableString.zig index f1668f17e72e..331664a4f2bb 100644 --- a/src/string/MutableString.zig +++ b/src/string/MutableString.zig @@ -99,7 +99,7 @@ pub fn ensureValidIdentifier(str: string, allocator: Allocator) Allocator.Error! if (!iterator.next(&cursor)) return "_"; - const JSLexerTables = @import("../js_lexer_tables.zig"); + const JSLexerTables = @import("../transpiler/js_lexer_tables.zig"); // Common case: no gap necessary. No allocation necessary. needs_gap = !js_lexer.isIdentifierStart(cursor.c); diff --git a/src/bun.js/bindings/StringAdaptors.h b/src/string/StringAdaptors.h similarity index 100% rename from src/bun.js/bindings/StringAdaptors.h rename to src/string/StringAdaptors.h diff --git a/src/bun.js/bindings/StringBuilderBinding.cpp b/src/string/StringBuilderBinding.cpp similarity index 100% rename from src/bun.js/bindings/StringBuilderBinding.cpp rename to src/string/StringBuilderBinding.cpp diff --git a/src/bun.js/bindings/bun-simdutf.cpp b/src/string/bun-simdutf.cpp similarity index 100% rename from src/bun.js/bindings/bun-simdutf.cpp rename to src/string/bun-simdutf.cpp diff --git a/src/bun.js/bindings/bun-simdutf.zig b/src/string/bun-simdutf.zig similarity index 100% rename from src/bun.js/bindings/bun-simdutf.zig rename to src/string/bun-simdutf.zig diff --git a/src/bun.js/bindings/highway_strings.cpp b/src/string/highway_strings.cpp similarity index 100% rename from src/bun.js/bindings/highway_strings.cpp rename to src/string/highway_strings.cpp diff --git a/src/bun.js/bindings/stripANSI.cpp b/src/string/stripANSI.cpp similarity index 100% rename from src/bun.js/bindings/stripANSI.cpp rename to src/string/stripANSI.cpp diff --git a/src/bun.js/bindings/stripANSI.h b/src/string/stripANSI.h similarity index 100% rename from src/bun.js/bindings/stripANSI.h rename to src/string/stripANSI.h diff --git a/src/bun.js/test/Collection.zig b/src/test_runner/Collection.zig similarity index 100% rename from src/bun.js/test/Collection.zig rename to src/test_runner/Collection.zig diff --git a/src/bun.js/test/DoneCallback.zig b/src/test_runner/DoneCallback.zig similarity index 100% rename from src/bun.js/test/DoneCallback.zig rename to src/test_runner/DoneCallback.zig diff --git a/src/bun.js/test/Execution.zig b/src/test_runner/Execution.zig similarity index 99% rename from src/bun.js/test/Execution.zig rename to src/test_runner/Execution.zig index 065d79d2d68e..3ffe0e3a3aab 100644 --- a/src/bun.js/test/Execution.zig +++ b/src/test_runner/Execution.zig @@ -647,7 +647,7 @@ pub fn handleUncaughtException(this: *Execution, user_data: bun_test.BunTest.Ref const log = bun.Output.scoped(.jest, .visible); const std = @import("std"); -const test_command = @import("../../cli/test_command.zig"); +const test_command = @import("../cli/test_command.zig"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/bun.js/test/Order.zig b/src/test_runner/Order.zig similarity index 100% rename from src/bun.js/test/Order.zig rename to src/test_runner/Order.zig diff --git a/src/bun.js/test/ScopeFunctions.zig b/src/test_runner/ScopeFunctions.zig similarity index 100% rename from src/bun.js/test/ScopeFunctions.zig rename to src/test_runner/ScopeFunctions.zig diff --git a/src/bun.js/test/bun_test.zig b/src/test_runner/bun_test.zig similarity index 99% rename from src/bun.js/test/bun_test.zig rename to src/test_runner/bun_test.zig index c8879d623e0d..ed50688ecf3f 100644 --- a/src/bun.js/test/bun_test.zig +++ b/src/test_runner/bun_test.zig @@ -1037,7 +1037,7 @@ pub const Order = @import("./Order.zig"); const group = debug.group; const std = @import("std"); -const test_command = @import("../../cli/test_command.zig"); +const test_command = @import("../cli/test_command.zig"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/bun.js/test/debug.zig b/src/test_runner/debug.zig similarity index 100% rename from src/bun.js/test/debug.zig rename to src/test_runner/debug.zig diff --git a/src/bun.js/test/diff/diff_match_patch.zig b/src/test_runner/diff/diff_match_patch.zig similarity index 100% rename from src/bun.js/test/diff/diff_match_patch.zig rename to src/test_runner/diff/diff_match_patch.zig diff --git a/src/bun.js/test/diff/printDiff.zig b/src/test_runner/diff/printDiff.zig similarity index 100% rename from src/bun.js/test/diff/printDiff.zig rename to src/test_runner/diff/printDiff.zig diff --git a/src/bun.js/test/diff_format.zig b/src/test_runner/diff_format.zig similarity index 100% rename from src/bun.js/test/diff_format.zig rename to src/test_runner/diff_format.zig diff --git a/src/bun.js/test/expect.zig b/src/test_runner/expect.zig similarity index 100% rename from src/bun.js/test/expect.zig rename to src/test_runner/expect.zig diff --git a/src/bun.js/test/expect/toBe.zig b/src/test_runner/expect/toBe.zig similarity index 100% rename from src/bun.js/test/expect/toBe.zig rename to src/test_runner/expect/toBe.zig diff --git a/src/bun.js/test/expect/toBeArray.zig b/src/test_runner/expect/toBeArray.zig similarity index 100% rename from src/bun.js/test/expect/toBeArray.zig rename to src/test_runner/expect/toBeArray.zig diff --git a/src/bun.js/test/expect/toBeArrayOfSize.zig b/src/test_runner/expect/toBeArrayOfSize.zig similarity index 100% rename from src/bun.js/test/expect/toBeArrayOfSize.zig rename to src/test_runner/expect/toBeArrayOfSize.zig diff --git a/src/bun.js/test/expect/toBeBoolean.zig b/src/test_runner/expect/toBeBoolean.zig similarity index 100% rename from src/bun.js/test/expect/toBeBoolean.zig rename to src/test_runner/expect/toBeBoolean.zig diff --git a/src/bun.js/test/expect/toBeCloseTo.zig b/src/test_runner/expect/toBeCloseTo.zig similarity index 100% rename from src/bun.js/test/expect/toBeCloseTo.zig rename to src/test_runner/expect/toBeCloseTo.zig diff --git a/src/bun.js/test/expect/toBeDate.zig b/src/test_runner/expect/toBeDate.zig similarity index 100% rename from src/bun.js/test/expect/toBeDate.zig rename to src/test_runner/expect/toBeDate.zig diff --git a/src/bun.js/test/expect/toBeDefined.zig b/src/test_runner/expect/toBeDefined.zig similarity index 100% rename from src/bun.js/test/expect/toBeDefined.zig rename to src/test_runner/expect/toBeDefined.zig diff --git a/src/bun.js/test/expect/toBeEmpty.zig b/src/test_runner/expect/toBeEmpty.zig similarity index 100% rename from src/bun.js/test/expect/toBeEmpty.zig rename to src/test_runner/expect/toBeEmpty.zig diff --git a/src/bun.js/test/expect/toBeEmptyObject.zig b/src/test_runner/expect/toBeEmptyObject.zig similarity index 100% rename from src/bun.js/test/expect/toBeEmptyObject.zig rename to src/test_runner/expect/toBeEmptyObject.zig diff --git a/src/bun.js/test/expect/toBeEven.zig b/src/test_runner/expect/toBeEven.zig similarity index 100% rename from src/bun.js/test/expect/toBeEven.zig rename to src/test_runner/expect/toBeEven.zig diff --git a/src/bun.js/test/expect/toBeFalse.zig b/src/test_runner/expect/toBeFalse.zig similarity index 100% rename from src/bun.js/test/expect/toBeFalse.zig rename to src/test_runner/expect/toBeFalse.zig diff --git a/src/bun.js/test/expect/toBeFalsy.zig b/src/test_runner/expect/toBeFalsy.zig similarity index 100% rename from src/bun.js/test/expect/toBeFalsy.zig rename to src/test_runner/expect/toBeFalsy.zig diff --git a/src/bun.js/test/expect/toBeFinite.zig b/src/test_runner/expect/toBeFinite.zig similarity index 100% rename from src/bun.js/test/expect/toBeFinite.zig rename to src/test_runner/expect/toBeFinite.zig diff --git a/src/bun.js/test/expect/toBeFunction.zig b/src/test_runner/expect/toBeFunction.zig similarity index 100% rename from src/bun.js/test/expect/toBeFunction.zig rename to src/test_runner/expect/toBeFunction.zig diff --git a/src/bun.js/test/expect/toBeGreaterThan.zig b/src/test_runner/expect/toBeGreaterThan.zig similarity index 100% rename from src/bun.js/test/expect/toBeGreaterThan.zig rename to src/test_runner/expect/toBeGreaterThan.zig diff --git a/src/bun.js/test/expect/toBeGreaterThanOrEqual.zig b/src/test_runner/expect/toBeGreaterThanOrEqual.zig similarity index 100% rename from src/bun.js/test/expect/toBeGreaterThanOrEqual.zig rename to src/test_runner/expect/toBeGreaterThanOrEqual.zig diff --git a/src/bun.js/test/expect/toBeInstanceOf.zig b/src/test_runner/expect/toBeInstanceOf.zig similarity index 100% rename from src/bun.js/test/expect/toBeInstanceOf.zig rename to src/test_runner/expect/toBeInstanceOf.zig diff --git a/src/bun.js/test/expect/toBeInteger.zig b/src/test_runner/expect/toBeInteger.zig similarity index 100% rename from src/bun.js/test/expect/toBeInteger.zig rename to src/test_runner/expect/toBeInteger.zig diff --git a/src/bun.js/test/expect/toBeLessThan.zig b/src/test_runner/expect/toBeLessThan.zig similarity index 100% rename from src/bun.js/test/expect/toBeLessThan.zig rename to src/test_runner/expect/toBeLessThan.zig diff --git a/src/bun.js/test/expect/toBeLessThanOrEqual.zig b/src/test_runner/expect/toBeLessThanOrEqual.zig similarity index 100% rename from src/bun.js/test/expect/toBeLessThanOrEqual.zig rename to src/test_runner/expect/toBeLessThanOrEqual.zig diff --git a/src/bun.js/test/expect/toBeNaN.zig b/src/test_runner/expect/toBeNaN.zig similarity index 100% rename from src/bun.js/test/expect/toBeNaN.zig rename to src/test_runner/expect/toBeNaN.zig diff --git a/src/bun.js/test/expect/toBeNegative.zig b/src/test_runner/expect/toBeNegative.zig similarity index 100% rename from src/bun.js/test/expect/toBeNegative.zig rename to src/test_runner/expect/toBeNegative.zig diff --git a/src/bun.js/test/expect/toBeNil.zig b/src/test_runner/expect/toBeNil.zig similarity index 100% rename from src/bun.js/test/expect/toBeNil.zig rename to src/test_runner/expect/toBeNil.zig diff --git a/src/bun.js/test/expect/toBeNull.zig b/src/test_runner/expect/toBeNull.zig similarity index 100% rename from src/bun.js/test/expect/toBeNull.zig rename to src/test_runner/expect/toBeNull.zig diff --git a/src/bun.js/test/expect/toBeNumber.zig b/src/test_runner/expect/toBeNumber.zig similarity index 100% rename from src/bun.js/test/expect/toBeNumber.zig rename to src/test_runner/expect/toBeNumber.zig diff --git a/src/bun.js/test/expect/toBeObject.zig b/src/test_runner/expect/toBeObject.zig similarity index 100% rename from src/bun.js/test/expect/toBeObject.zig rename to src/test_runner/expect/toBeObject.zig diff --git a/src/bun.js/test/expect/toBeOdd.zig b/src/test_runner/expect/toBeOdd.zig similarity index 100% rename from src/bun.js/test/expect/toBeOdd.zig rename to src/test_runner/expect/toBeOdd.zig diff --git a/src/bun.js/test/expect/toBeOneOf.zig b/src/test_runner/expect/toBeOneOf.zig similarity index 100% rename from src/bun.js/test/expect/toBeOneOf.zig rename to src/test_runner/expect/toBeOneOf.zig diff --git a/src/bun.js/test/expect/toBePositive.zig b/src/test_runner/expect/toBePositive.zig similarity index 100% rename from src/bun.js/test/expect/toBePositive.zig rename to src/test_runner/expect/toBePositive.zig diff --git a/src/bun.js/test/expect/toBeString.zig b/src/test_runner/expect/toBeString.zig similarity index 100% rename from src/bun.js/test/expect/toBeString.zig rename to src/test_runner/expect/toBeString.zig diff --git a/src/bun.js/test/expect/toBeSymbol.zig b/src/test_runner/expect/toBeSymbol.zig similarity index 100% rename from src/bun.js/test/expect/toBeSymbol.zig rename to src/test_runner/expect/toBeSymbol.zig diff --git a/src/bun.js/test/expect/toBeTrue.zig b/src/test_runner/expect/toBeTrue.zig similarity index 100% rename from src/bun.js/test/expect/toBeTrue.zig rename to src/test_runner/expect/toBeTrue.zig diff --git a/src/bun.js/test/expect/toBeTruthy.zig b/src/test_runner/expect/toBeTruthy.zig similarity index 100% rename from src/bun.js/test/expect/toBeTruthy.zig rename to src/test_runner/expect/toBeTruthy.zig diff --git a/src/bun.js/test/expect/toBeTypeOf.zig b/src/test_runner/expect/toBeTypeOf.zig similarity index 100% rename from src/bun.js/test/expect/toBeTypeOf.zig rename to src/test_runner/expect/toBeTypeOf.zig diff --git a/src/bun.js/test/expect/toBeUndefined.zig b/src/test_runner/expect/toBeUndefined.zig similarity index 100% rename from src/bun.js/test/expect/toBeUndefined.zig rename to src/test_runner/expect/toBeUndefined.zig diff --git a/src/bun.js/test/expect/toBeValidDate.zig b/src/test_runner/expect/toBeValidDate.zig similarity index 100% rename from src/bun.js/test/expect/toBeValidDate.zig rename to src/test_runner/expect/toBeValidDate.zig diff --git a/src/bun.js/test/expect/toBeWithin.zig b/src/test_runner/expect/toBeWithin.zig similarity index 100% rename from src/bun.js/test/expect/toBeWithin.zig rename to src/test_runner/expect/toBeWithin.zig diff --git a/src/bun.js/test/expect/toContain.zig b/src/test_runner/expect/toContain.zig similarity index 100% rename from src/bun.js/test/expect/toContain.zig rename to src/test_runner/expect/toContain.zig diff --git a/src/bun.js/test/expect/toContainAllKeys.zig b/src/test_runner/expect/toContainAllKeys.zig similarity index 100% rename from src/bun.js/test/expect/toContainAllKeys.zig rename to src/test_runner/expect/toContainAllKeys.zig diff --git a/src/bun.js/test/expect/toContainAllValues.zig b/src/test_runner/expect/toContainAllValues.zig similarity index 100% rename from src/bun.js/test/expect/toContainAllValues.zig rename to src/test_runner/expect/toContainAllValues.zig diff --git a/src/bun.js/test/expect/toContainAnyKeys.zig b/src/test_runner/expect/toContainAnyKeys.zig similarity index 100% rename from src/bun.js/test/expect/toContainAnyKeys.zig rename to src/test_runner/expect/toContainAnyKeys.zig diff --git a/src/bun.js/test/expect/toContainAnyValues.zig b/src/test_runner/expect/toContainAnyValues.zig similarity index 100% rename from src/bun.js/test/expect/toContainAnyValues.zig rename to src/test_runner/expect/toContainAnyValues.zig diff --git a/src/bun.js/test/expect/toContainEqual.zig b/src/test_runner/expect/toContainEqual.zig similarity index 100% rename from src/bun.js/test/expect/toContainEqual.zig rename to src/test_runner/expect/toContainEqual.zig diff --git a/src/bun.js/test/expect/toContainKey.zig b/src/test_runner/expect/toContainKey.zig similarity index 100% rename from src/bun.js/test/expect/toContainKey.zig rename to src/test_runner/expect/toContainKey.zig diff --git a/src/bun.js/test/expect/toContainKeys.zig b/src/test_runner/expect/toContainKeys.zig similarity index 100% rename from src/bun.js/test/expect/toContainKeys.zig rename to src/test_runner/expect/toContainKeys.zig diff --git a/src/bun.js/test/expect/toContainValue.zig b/src/test_runner/expect/toContainValue.zig similarity index 100% rename from src/bun.js/test/expect/toContainValue.zig rename to src/test_runner/expect/toContainValue.zig diff --git a/src/bun.js/test/expect/toContainValues.zig b/src/test_runner/expect/toContainValues.zig similarity index 100% rename from src/bun.js/test/expect/toContainValues.zig rename to src/test_runner/expect/toContainValues.zig diff --git a/src/bun.js/test/expect/toEndWith.zig b/src/test_runner/expect/toEndWith.zig similarity index 100% rename from src/bun.js/test/expect/toEndWith.zig rename to src/test_runner/expect/toEndWith.zig diff --git a/src/bun.js/test/expect/toEqual.zig b/src/test_runner/expect/toEqual.zig similarity index 100% rename from src/bun.js/test/expect/toEqual.zig rename to src/test_runner/expect/toEqual.zig diff --git a/src/bun.js/test/expect/toEqualIgnoringWhitespace.zig b/src/test_runner/expect/toEqualIgnoringWhitespace.zig similarity index 100% rename from src/bun.js/test/expect/toEqualIgnoringWhitespace.zig rename to src/test_runner/expect/toEqualIgnoringWhitespace.zig diff --git a/src/bun.js/test/expect/toHaveBeenCalled.zig b/src/test_runner/expect/toHaveBeenCalled.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenCalled.zig rename to src/test_runner/expect/toHaveBeenCalled.zig diff --git a/src/bun.js/test/expect/toHaveBeenCalledOnce.zig b/src/test_runner/expect/toHaveBeenCalledOnce.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenCalledOnce.zig rename to src/test_runner/expect/toHaveBeenCalledOnce.zig diff --git a/src/bun.js/test/expect/toHaveBeenCalledTimes.zig b/src/test_runner/expect/toHaveBeenCalledTimes.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenCalledTimes.zig rename to src/test_runner/expect/toHaveBeenCalledTimes.zig diff --git a/src/bun.js/test/expect/toHaveBeenCalledWith.zig b/src/test_runner/expect/toHaveBeenCalledWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenCalledWith.zig rename to src/test_runner/expect/toHaveBeenCalledWith.zig diff --git a/src/bun.js/test/expect/toHaveBeenLastCalledWith.zig b/src/test_runner/expect/toHaveBeenLastCalledWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenLastCalledWith.zig rename to src/test_runner/expect/toHaveBeenLastCalledWith.zig diff --git a/src/bun.js/test/expect/toHaveBeenNthCalledWith.zig b/src/test_runner/expect/toHaveBeenNthCalledWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveBeenNthCalledWith.zig rename to src/test_runner/expect/toHaveBeenNthCalledWith.zig diff --git a/src/bun.js/test/expect/toHaveLastReturnedWith.zig b/src/test_runner/expect/toHaveLastReturnedWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveLastReturnedWith.zig rename to src/test_runner/expect/toHaveLastReturnedWith.zig diff --git a/src/bun.js/test/expect/toHaveLength.zig b/src/test_runner/expect/toHaveLength.zig similarity index 100% rename from src/bun.js/test/expect/toHaveLength.zig rename to src/test_runner/expect/toHaveLength.zig diff --git a/src/bun.js/test/expect/toHaveNthReturnedWith.zig b/src/test_runner/expect/toHaveNthReturnedWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveNthReturnedWith.zig rename to src/test_runner/expect/toHaveNthReturnedWith.zig diff --git a/src/bun.js/test/expect/toHaveProperty.zig b/src/test_runner/expect/toHaveProperty.zig similarity index 100% rename from src/bun.js/test/expect/toHaveProperty.zig rename to src/test_runner/expect/toHaveProperty.zig diff --git a/src/bun.js/test/expect/toHaveReturned.zig b/src/test_runner/expect/toHaveReturned.zig similarity index 100% rename from src/bun.js/test/expect/toHaveReturned.zig rename to src/test_runner/expect/toHaveReturned.zig diff --git a/src/bun.js/test/expect/toHaveReturnedTimes.zig b/src/test_runner/expect/toHaveReturnedTimes.zig similarity index 100% rename from src/bun.js/test/expect/toHaveReturnedTimes.zig rename to src/test_runner/expect/toHaveReturnedTimes.zig diff --git a/src/bun.js/test/expect/toHaveReturnedWith.zig b/src/test_runner/expect/toHaveReturnedWith.zig similarity index 100% rename from src/bun.js/test/expect/toHaveReturnedWith.zig rename to src/test_runner/expect/toHaveReturnedWith.zig diff --git a/src/bun.js/test/expect/toInclude.zig b/src/test_runner/expect/toInclude.zig similarity index 100% rename from src/bun.js/test/expect/toInclude.zig rename to src/test_runner/expect/toInclude.zig diff --git a/src/bun.js/test/expect/toIncludeRepeated.zig b/src/test_runner/expect/toIncludeRepeated.zig similarity index 100% rename from src/bun.js/test/expect/toIncludeRepeated.zig rename to src/test_runner/expect/toIncludeRepeated.zig diff --git a/src/bun.js/test/expect/toMatch.zig b/src/test_runner/expect/toMatch.zig similarity index 100% rename from src/bun.js/test/expect/toMatch.zig rename to src/test_runner/expect/toMatch.zig diff --git a/src/bun.js/test/expect/toMatchInlineSnapshot.zig b/src/test_runner/expect/toMatchInlineSnapshot.zig similarity index 100% rename from src/bun.js/test/expect/toMatchInlineSnapshot.zig rename to src/test_runner/expect/toMatchInlineSnapshot.zig diff --git a/src/bun.js/test/expect/toMatchObject.zig b/src/test_runner/expect/toMatchObject.zig similarity index 100% rename from src/bun.js/test/expect/toMatchObject.zig rename to src/test_runner/expect/toMatchObject.zig diff --git a/src/bun.js/test/expect/toMatchSnapshot.zig b/src/test_runner/expect/toMatchSnapshot.zig similarity index 100% rename from src/bun.js/test/expect/toMatchSnapshot.zig rename to src/test_runner/expect/toMatchSnapshot.zig diff --git a/src/bun.js/test/expect/toSatisfy.zig b/src/test_runner/expect/toSatisfy.zig similarity index 100% rename from src/bun.js/test/expect/toSatisfy.zig rename to src/test_runner/expect/toSatisfy.zig diff --git a/src/bun.js/test/expect/toStartWith.zig b/src/test_runner/expect/toStartWith.zig similarity index 100% rename from src/bun.js/test/expect/toStartWith.zig rename to src/test_runner/expect/toStartWith.zig diff --git a/src/bun.js/test/expect/toStrictEqual.zig b/src/test_runner/expect/toStrictEqual.zig similarity index 100% rename from src/bun.js/test/expect/toStrictEqual.zig rename to src/test_runner/expect/toStrictEqual.zig diff --git a/src/bun.js/test/expect/toThrow.zig b/src/test_runner/expect/toThrow.zig similarity index 100% rename from src/bun.js/test/expect/toThrow.zig rename to src/test_runner/expect/toThrow.zig diff --git a/src/bun.js/test/expect/toThrowErrorMatchingInlineSnapshot.zig b/src/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig similarity index 100% rename from src/bun.js/test/expect/toThrowErrorMatchingInlineSnapshot.zig rename to src/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig diff --git a/src/bun.js/test/expect/toThrowErrorMatchingSnapshot.zig b/src/test_runner/expect/toThrowErrorMatchingSnapshot.zig similarity index 100% rename from src/bun.js/test/expect/toThrowErrorMatchingSnapshot.zig rename to src/test_runner/expect/toThrowErrorMatchingSnapshot.zig diff --git a/src/bun.js/test/jest.classes.ts b/src/test_runner/jest.classes.ts similarity index 99% rename from src/bun.js/test/jest.classes.ts rename to src/test_runner/jest.classes.ts index ba97450f956e..782632e16cf2 100644 --- a/src/bun.js/test/jest.classes.ts +++ b/src/test_runner/jest.classes.ts @@ -1,4 +1,4 @@ -import { define } from "../../codegen/class-definitions"; +import { define } from "../codegen/class-definitions"; export default [ define({ diff --git a/src/bun.js/test/jest.zig b/src/test_runner/jest.zig similarity index 99% rename from src/bun.js/test/jest.zig rename to src/test_runner/jest.zig index 1acacb9994df..72a97bdff351 100644 --- a/src/bun.js/test/jest.zig +++ b/src/test_runner/jest.zig @@ -487,7 +487,7 @@ const string = []const u8; pub const bun_test = @import("./bun_test.zig"); const std = @import("std"); -const CommandLineReporter = @import("../../cli/test_command.zig").CommandLineReporter; +const CommandLineReporter = @import("../cli/test_command.zig").CommandLineReporter; const Snapshots = @import("./snapshot.zig").Snapshots; const expect = @import("./expect.zig"); diff --git a/src/bun.js/test/pretty_format.zig b/src/test_runner/pretty_format.zig similarity index 99% rename from src/bun.js/test/pretty_format.zig rename to src/test_runner/pretty_format.zig index 5b0860cc131a..161785a0c165 100644 --- a/src/bun.js/test/pretty_format.zig +++ b/src/test_runner/pretty_format.zig @@ -265,7 +265,7 @@ pub const JestPrettyFormat = struct { // For detecting circular references pub const Visited = struct { - const ObjectPool = @import("../../pool.zig").ObjectPool; + const ObjectPool = @import("../pool.zig").ObjectPool; pub const Map = std.AutoHashMap(JSValue, void); pub const Pool = ObjectPool( Map, diff --git a/src/bun.js/test/snapshot.zig b/src/test_runner/snapshot.zig similarity index 100% rename from src/bun.js/test/snapshot.zig rename to src/test_runner/snapshot.zig diff --git a/src/bun.js/test/test.zig b/src/test_runner/test.zig similarity index 100% rename from src/bun.js/test/test.zig rename to src/test_runner/test.zig diff --git a/src/bun.js/test/timers/FakeTimers.zig b/src/test_runner/timers/FakeTimers.zig similarity index 100% rename from src/bun.js/test/timers/FakeTimers.zig rename to src/test_runner/timers/FakeTimers.zig diff --git a/src/bun.js/test/timers/FakeTimersConfig.bindv2.ts b/src/test_runner/timers/FakeTimersConfig.bindv2.ts similarity index 100% rename from src/bun.js/test/timers/FakeTimersConfig.bindv2.ts rename to src/test_runner/timers/FakeTimersConfig.bindv2.ts diff --git a/src/js_lexer.zig b/src/transpiler/js_lexer.zig similarity index 99% rename from src/js_lexer.zig rename to src/transpiler/js_lexer.zig index 097350c8f58f..7d7ca0d642ac 100644 --- a/src/js_lexer.zig +++ b/src/transpiler/js_lexer.zig @@ -3383,7 +3383,7 @@ const InvalidEscapeSequenceFormatter = struct { const string = []const u8; -const FeatureFlags = @import("./feature_flags.zig"); +const FeatureFlags = @import("../feature_flags.zig"); const JSIdentifier = @import("./js_lexer/identifier.zig"); const tables = @import("./js_lexer_tables.zig"); diff --git a/src/js_lexer/identifier.zig b/src/transpiler/js_lexer/identifier.zig similarity index 100% rename from src/js_lexer/identifier.zig rename to src/transpiler/js_lexer/identifier.zig diff --git a/src/js_lexer_tables.zig b/src/transpiler/js_lexer_tables.zig similarity index 100% rename from src/js_lexer_tables.zig rename to src/transpiler/js_lexer_tables.zig diff --git a/src/js_parser.zig b/src/transpiler/js_parser.zig similarity index 97% rename from src/js_parser.zig rename to src/transpiler/js_parser.zig index 9a773b9d3129..a8d483a8fb93 100644 --- a/src/js_parser.zig +++ b/src/transpiler/js_parser.zig @@ -1201,21 +1201,21 @@ pub const ParseBindingOptions = struct { is_using_statement: bool = false, }; -pub const ConvertESMExportsForHmr = @import("./ast/ConvertESMExportsForHmr.zig"); -pub const ImportScanner = @import("./ast/ImportScanner.zig"); -pub const TypeScript = @import("./ast/TypeScript.zig"); -pub const fs = @import("./fs.zig"); -pub const options = @import("./options.zig"); -pub const renamer = @import("./renamer.zig"); -pub const KnownGlobal = @import("./ast/KnownGlobal.zig").KnownGlobal; -pub const Parser = @import("./ast/Parser.zig").Parser; -pub const SideEffects = @import("./ast/SideEffects.zig").SideEffects; -pub const foldStringAddition = @import("./ast/foldStringAddition.zig").foldStringAddition; -pub const isPackagePath = @import("./resolver/resolver.zig").isPackagePath; - -pub const Ref = @import("./ast/base.zig").Ref; - -pub const importRecord = @import("./import_record.zig"); +pub const ConvertESMExportsForHmr = @import("../ast/ConvertESMExportsForHmr.zig"); +pub const ImportScanner = @import("../ast/ImportScanner.zig"); +pub const TypeScript = @import("../ast/TypeScript.zig"); +pub const fs = @import("../fs.zig"); +pub const options = @import("../options.zig"); +pub const renamer = @import("../renamer.zig"); +pub const KnownGlobal = @import("../ast/KnownGlobal.zig").KnownGlobal; +pub const Parser = @import("../ast/Parser.zig").Parser; +pub const SideEffects = @import("../ast/SideEffects.zig").SideEffects; +pub const foldStringAddition = @import("../ast/foldStringAddition.zig").foldStringAddition; +pub const isPackagePath = @import("../resolver/resolver.zig").isPackagePath; + +pub const Ref = @import("../ast/base.zig").Ref; + +pub const importRecord = @import("../import_record.zig"); pub const ImportKind = importRecord.ImportKind; const ImportRecord = importRecord.ImportRecord; @@ -1223,7 +1223,7 @@ pub const RuntimeFeatures = _runtime.Runtime.Features; pub const RuntimeImports = _runtime.Runtime.Imports; pub const RuntimeNames = _runtime.Runtime.Names; -pub const NewParser_ = @import("./ast/P.zig").NewParser_; +pub const NewParser_ = @import("../ast/P.zig").NewParser_; pub const StringHashMap = bun.StringHashMap; pub const js_printer = bun.js_printer; @@ -1262,13 +1262,13 @@ const List = std.ArrayListUnmanaged; const ListManaged = std.array_list.Managed; const Allocator = std.mem.Allocator; -const _runtime = @import("./runtime.zig"); -const Define = @import("./defines.zig").Define; -const NewParser = @import("./ast/P.zig").NewParser; -const ObjectPool = @import("./pool.zig").ObjectPool; +const _runtime = @import("../runtime.zig"); +const Define = @import("../defines.zig").Define; +const NewParser = @import("../ast/P.zig").NewParser; +const ObjectPool = @import("../pool.zig").ObjectPool; -const Index = @import("./ast/base.zig").Index; -const RefCtx = @import("./ast/base.zig").RefCtx; +const Index = @import("../ast/base.zig").Index; +const RefCtx = @import("../ast/base.zig").RefCtx; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/js_printer.zig b/src/transpiler/js_printer.zig similarity index 99% rename from src/js_printer.zig rename to src/transpiler/js_printer.zig index 250aa4ddef44..088fbad15995 100644 --- a/src/js_printer.zig +++ b/src/transpiler/js_printer.zig @@ -6082,12 +6082,12 @@ pub fn printCommonJS( const string = []const u8; -const SourceMap = @import("./sourcemap/sourcemap.zig"); -const fs = @import("./fs.zig"); -const importRecord = @import("./import_record.zig"); -const options = @import("./options.zig"); -const rename = @import("./renamer.zig"); -const runtime = @import("./runtime.zig"); +const SourceMap = @import("../sourcemap/sourcemap.zig"); +const fs = @import("../fs.zig"); +const importRecord = @import("../import_record.zig"); +const options = @import("../options.zig"); +const rename = @import("../renamer.zig"); +const runtime = @import("../runtime.zig"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/transpiler.zig b/src/transpiler/transpiler.zig similarity index 98% rename from src/transpiler.zig rename to src/transpiler/transpiler.zig index 0c058e0f778c..9d5951f9f098 100644 --- a/src/transpiler.zig +++ b/src/transpiler/transpiler.zig @@ -1,8 +1,8 @@ -pub const options = @import("./options.zig"); +pub const options = @import("../options.zig"); pub const MacroJSValueType = jsc.JSValue; -pub const EntryPoints = @import("./bundler/entry_points.zig"); +pub const EntryPoints = @import("../bundler/entry_points.zig"); pub const ParseResult = struct { source: logger.Source, @@ -1572,23 +1572,23 @@ pub const ResolveQueue = bun.LinearFifo( const string = []const u8; -const DotEnv = @import("./env_loader.zig"); -const Fs = @import("./fs.zig"); -const MimeType = @import("./http/MimeType.zig"); -const NodeFallbackModules = @import("./node_fallbacks.zig"); -const Router = @import("./router.zig"); -const runtime = @import("./runtime.zig"); +const DotEnv = @import("../env_loader.zig"); +const Fs = @import("../fs.zig"); +const MimeType = @import("../http/MimeType.zig"); +const NodeFallbackModules = @import("../node_fallbacks.zig"); +const Router = @import("../router.zig"); +const runtime = @import("../runtime.zig"); const std = @import("std"); -const DataURL = @import("./resolver/data_url.zig").DataURL; -const MacroRemap = @import("./resolver/package_json.zig").MacroMap; -const PackageManager = @import("./install/install.zig").PackageManager; -const SystemTimer = @import("./system_timer.zig").Timer; -const URL = @import("./url.zig").URL; +const DataURL = @import("../resolver/data_url.zig").DataURL; +const MacroRemap = @import("../resolver/package_json.zig").MacroMap; +const PackageManager = @import("../install/install.zig").PackageManager; +const SystemTimer = @import("../system_timer.zig").Timer; +const URL = @import("../url.zig").URL; -const linker = @import("./linker.zig"); +const linker = @import("../linker.zig"); const Linker = linker.Linker; -const _resolver = @import("./resolver/resolver.zig"); +const _resolver = @import("../resolver/resolver.zig"); const DebugLogs = _resolver.DebugLogs; const Resolver = _resolver.Resolver; diff --git a/src/tsconfig.json b/src/tsconfig.json index 9fd93876cde8..cd8656c37831 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -10,5 +10,5 @@ }, "include": ["**/*.ts", "**/*.tsx"], // separate projects have extra settings that only apply in those scopes - "exclude": ["js", "bake", "init", "create", "bun.js/bindings/libuv"] + "exclude": ["js", "bake", "init", "create", "buntime/compat/libuv"] } diff --git a/src/unit_test.zig b/src/unit_test.zig index 928658fa0f9f..d1bd6b14f891 100644 --- a/src/unit_test.zig +++ b/src/unit_test.zig @@ -1,6 +1,6 @@ test { _ = @import("./shell/braces.zig"); - _ = @import("./bun.js/node/assert/myers_diff.zig"); + _ = @import("./buntime/node/assert/myers_diff.zig"); } test "basic string usage" { diff --git a/src/valkey/js_valkey.zig b/src/valkey/js_valkey.zig index 01bdd886d05d..d2df13b386d0 100644 --- a/src/valkey/js_valkey.zig +++ b/src/valkey/js_valkey.zig @@ -1656,7 +1656,7 @@ const debug = bun.Output.scoped(.RedisJS, .visible); const Command = @import("./ValkeyCommand.zig"); const std = @import("std"); const valkey = @import("./valkey.zig"); -const URL = @import("../bun.js/bindings/URL.zig").URL; +const URL = @import("../buntime/web/url/URL.zig").URL; const protocol = @import("./valkey_protocol.zig"); const RedisError = protocol.RedisError; diff --git a/src/windows.zig b/src/windows.zig index 1625ae89d08d..e26ba5a53d80 100644 --- a/src/windows.zig +++ b/src/windows.zig @@ -3784,7 +3784,7 @@ const watcherChildEnv: [:0]const u16 = bun.strings.toUTF16Literal("_BUN_WATCHER_ // this was randomly generated - we need to avoid using a common exit code that might be used by the script itself pub const watcher_reload_exit: DWORD = 3224497970; -pub const spawn = @import("./bun.js/api/bun/spawn.zig").PosixSpawn; +pub const spawn = @import("./buntime/api/bun/spawn.zig").PosixSpawn; pub fn isWatcherChild() bool { var buf: [1]u16 = undefined; diff --git a/test/internal/ban-words.test.ts b/test/internal/ban-words.test.ts index 1241adf0287b..f62a776a3d8f 100644 --- a/test/internal/ban-words.test.ts +++ b/test/internal/ban-words.test.ts @@ -145,7 +145,7 @@ describe("banned words", () => { }); describe("required words", () => { - const expectDir = "src/bun.js/test/expect"; + const expectDir = "src/buntime/test/expect"; const files = readdirSync(expectDir); for (const file of files) { if (!file.endsWith(".zig") || file.startsWith(".") || file === "toHaveReturnedTimes.zig") continue; diff --git a/test/js/bun/util/zstd.test.ts b/test/js/bun/util/zstd.test.ts index ce963ef833bc..fd4f287d161f 100644 --- a/test/js/bun/util/zstd.test.ts +++ b/test/js/bun/util/zstd.test.ts @@ -102,7 +102,7 @@ describe("Zstandard compression", async () => { "run:linux": 'docker run --rm -v "$PWD:/root/bun/" -w /root/bun ghcr.io/oven-sh/bun-development-docker-image', "css-properties": "bun run src/css/properties/generate_properties.ts", - "uv-posix-stubs": "bun run src/bun.js/bindings/libuv/generate_uv_posix_stubs.ts", + "uv-posix-stubs": "bun run src/buntime/bindings/libuv/generate_uv_posix_stubs.ts", "bump": "bun ./scripts/bump.ts", "typecheck": "tsc --noEmit && cd test && bun run typecheck", "fmt": "bun run prettier", diff --git a/test/napi/uv.test.ts b/test/napi/uv.test.ts index 319d481a0bd3..deb5033a6690 100644 --- a/test/napi/uv.test.ts +++ b/test/napi/uv.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeAll, describe, expect, test } from "bun:test"; import { bunEnv, bunExe, isWindows, makeTree, tempDirWithFiles } from "harness"; import path from "node:path"; -import { symbols, test_skipped } from "../../src/bun.js/bindings/libuv/generate_uv_posix_stubs_constants"; +import { symbols, test_skipped } from "../../src/buntime/compat/libuv/generate_uv_posix_stubs_constants"; import source from "./uv-stub-stuff/uv_impl.c"; const symbols_to_test = symbols.filter(s => !test_skipped.includes(s)); @@ -52,7 +52,7 @@ describe.if(!isWindows)("uv stubs", () => { process.chdir(tempdir); - const libuvDir = path.join(__dirname, "../../src/bun.js/bindings/libuv"); + const libuvDir = path.join(__dirname, "../../src/buntime/compat/libuv"); await Bun.$`cp -R ${libuvDir} ${path.join(tempdir, "libuv")}`; await Bun.$`${bunExe()} i && ${bunExe()} build:napi`.env(bunEnv).cwd(tempdir); diff --git a/test/napi/uv_stub.test.ts b/test/napi/uv_stub.test.ts index 8e635ed88709..5470b09e84e6 100644 --- a/test/napi/uv_stub.test.ts +++ b/test/napi/uv_stub.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeAll, describe, expect, test } from "bun:test"; import { bunEnv, bunExe, isWindows, makeTree, tempDirWithFiles } from "harness"; import path from "node:path"; -import { symbols, test_skipped } from "../../src/bun.js/bindings/libuv/generate_uv_posix_stubs_constants"; +import { symbols, test_skipped } from "../../src/buntime/compat/libuv/generate_uv_posix_stubs_constants"; import goodSource from "./uv-stub-stuff/good_plugin.c"; import source from "./uv-stub-stuff/plugin.c"; @@ -64,7 +64,7 @@ describe.if(!isWindows)("uv stubs", () => { process.chdir(tempdir); - const libuvDir = path.join(__dirname, "../../src/bun.js/bindings/libuv"); + const libuvDir = path.join(__dirname, "../../src/buntime/compat/libuv"); await Bun.$`cp -R ${libuvDir} ${path.join(tempdir, "libuv")}`; await Bun.$`${bunExe()} i && ${bunExe()} build:napi`.env(bunEnv).cwd(tempdir); console.log("tempdir:", tempdir);