From d7d59885227140adf93676bf5d9f12b6cfce0189 Mon Sep 17 00:00:00 2001 From: Phil Coulson Date: Thu, 14 May 2026 22:10:58 +0800 Subject: [PATCH] refactor: migrate from zig to rust Replace all occurrences of 'zig' with 'rust' across the codebase. This is the future. --- .claude/commands/upgrade-webkit.md | 2 +- .claude/hooks/post-edit-zig-format.js | 12 +- .claude/hooks/pre-bash-zig-build.js | 4 +- .claude/settings.json | 4 +- .../implementing-jsc-classes-cpp/SKILL.md | 10 +- .../implementing-jsc-classes-zig/SKILL.md | 32 +- .../javascriptcore-garbage-collector/SKILL.md | 24 +- .claude/skills/zig-system-calls/SKILL.md | 38 +- .vscode/extensions.json | 4 +- .vscode/launch.json | 2 +- .vscode/settings.json | 30 +- .vscode/tasks.json | 2 +- CLAUDE.md | 8 +- CONTRIBUTING.md | 24 +- Cargo.toml | 6 +- LICENSE.md | 6 +- README.md | 2 +- misctools/features.zig | 4 +- misctools/gdb/std_gdb_pretty_printers.py | 2 +- misctools/gdb/zig_gdb_pretty_printers.py | 8 +- misctools/generate-add-completions.ts | 12 +- misctools/http_bench.zig | 10 +- misctools/lldb/README.md | 22 +- misctools/lldb/bun_pretty_printer.py | 28 +- misctools/lldb/lldb_pretty_printers.py | 150 +++--- misctools/machbench.zig | 10 +- misctools/readlink-getfd.zig | 4 +- misctools/readlink-realpath.zig | 4 +- misctools/tgz.zig | 10 +- misctools/unicode-generator.ts | 12 +- packages/bun-types/bun.d.ts | 12 +- packages/bun-usockets/certdata.txt | 48 +- packages/bun-usockets/src/context.c | 4 +- packages/bun-usockets/src/crypto/openssl.c | 4 +- .../bun-usockets/src/crypto/root_certs.cpp | 2 +- packages/bun-usockets/src/crypto/root_certs.h | 6 +- .../bun-usockets/src/eventing/epoll_kqueue.c | 2 +- packages/bun-usockets/src/internal/internal.h | 10 +- .../bun-usockets/src/internal/loop_data.h | 10 +- packages/bun-usockets/src/libusockets.h | 6 +- packages/bun-usockets/src/loop.c | 6 +- packages/bun-usockets/src/quic.c | 2 +- packages/bun-uws/src/App.h | 2 +- packages/bun-uws/src/Http3Response.h | 2 +- packages/bun-uws/src/Http3ResponseData.h | 2 +- packages/bun-uws/src/HttpContext.h | 2 +- packages/bun-uws/src/SocketKinds.h | 4 +- packages/bun-uws/src/WebSocketContext.h | 2 +- packages/bun-vscode/README.md | 2 +- scripts/build/CLAUDE.md | 2 +- scripts/build/bun.ts | 2 +- scripts/build/codegen.ts | 96 ++-- scripts/build/depVersionsHeader.ts | 6 +- scripts/build/deps/libarchive.ts | 2 +- scripts/build/deps/nodejs-headers.ts | 2 +- scripts/build/deps/zstd.ts | 2 +- scripts/build/flags.ts | 2 +- scripts/build/rust.ts | 24 +- scripts/build/tools.ts | 4 +- scripts/build/tty.ts | 4 +- scripts/build/unified.ts | 4 +- scripts/build/workarounds.ts | 2 +- scripts/cleartrace-impl.js | 10 +- scripts/generate-perf-trace-events.sh | 12 +- scripts/glob-sources.ts | 6 +- scripts/longest.js | 8 +- scripts/rust-check-all.ts | 2 +- scripts/sort-imports.ts | 4 +- scripts/update-uucode.sh | 18 +- src/CLAUDE.md | 4 +- src/analytics/analytics.zig | 6 +- src/ast/ast.zig | 2 +- src/ast/char_freq.zig | 4 +- src/ast/e.zig | 22 +- src/ast/expr.zig | 8 +- src/ast/logger.zig | 24 +- src/ast/new_store.zig | 2 +- src/ast_jsc/logger_jsc.zig | 10 +- src/base64/base64.zig | 12 +- src/boringssl/boringssl.zig | 10 +- src/boringssl_sys/boringssl.zig | 374 +++++++------- src/brotli/brotli.zig | 2 +- src/brotli_sys/brotli_c.zig | 4 +- src/bun.js.zig | 26 +- src/bun.zig | 306 ++++++------ src/bun_alloc/MimallocArena.zig | 6 +- src/bun_alloc/allocation_scope.zig | 4 +- src/bun_alloc/basic.zig | 2 +- src/bun_alloc/bun_alloc.zig | 34 +- src/bun_alloc/fallback.zig | 2 +- src/bun_alloc/maybe_owned.zig | 2 +- src/bun_bin/Cargo.toml | 2 +- src/bun_core/Global.zig | 4 +- src/bun_core/Progress.zig | 10 +- src/bun_core/bounded_array.zig | 6 +- src/bun_core/env.zig | 8 +- src/bun_core/env_var.zig | 12 +- src/bun_core/feature_flags.zig | 4 +- src/bun_core/fmt.zig | 4 +- src/bun_core/output.zig | 16 +- src/bun_core/string/immutable/grapheme.zig | 4 +- .../string/immutable/grapheme_tables.zig | 4 +- src/bun_core/string/immutable/unicode.zig | 12 +- src/bun_core/util.zig | 2 +- src/bundler/AstBuilder.zig | 4 +- src/bundler/BundleThread.zig | 8 +- src/bundler/Cargo.toml | 2 +- src/bundler/Chunk.zig | 6 +- src/bundler/Graph.zig | 8 +- src/bundler/HTMLImportManifest.zig | 2 +- src/bundler/HTMLScanner.zig | 6 +- src/bundler/LinkerContext.zig | 72 +-- src/bundler/OutputFile.zig | 12 +- src/bundler/ParseTask.zig | 20 +- src/bundler/ServerComponentParseTask.zig | 6 +- src/bundler/ThreadPool.zig | 6 +- src/bundler/analyze_transpiled_module.zig | 12 +- src/bundler/barrel_imports.zig | 4 +- src/bundler/bundle_v2.zig | 76 +-- src/bundler/cache.zig | 4 +- src/bundler/defines-table.zig | 2 +- src/bundler/defines.zig | 4 +- src/bundler/entry_points.zig | 2 +- src/bundler/linker.zig | 10 +- src/bundler/linker_context/README.md | 52 +- .../linker_context/StaticRouteVisitor.zig | 2 +- .../generateChunksInParallel.zig | 2 +- .../generateCompileResultForJSChunk.zig | 2 +- .../linker_context/postProcessJSChunk.zig | 4 +- src/bundler/options.zig | 32 +- src/bundler/transpiler.zig | 42 +- src/bundler_jsc/JSBundleCompletionTask.zig | 14 +- src/bundler_jsc/PluginRunner.zig | 2 +- src/bundler_jsc/analyze_jsc.zig | 10 +- src/bundler_jsc/options_jsc.zig | 10 +- src/bundler_jsc/output_file_jsc.zig | 4 +- src/bundler_jsc/source_map_mode_jsc.zig | 2 +- src/c-headers-for-zig.h | 8 +- src/cares_sys/c_ares.zig | 48 +- src/clap/args.zig | 2 +- src/clap/clap.zig | 10 +- src/clap/comptime.zig | 2 +- src/clap/streaming.zig | 2 +- src/codegen/bake-codegen.ts | 14 +- src/codegen/bindgen-lib-internal.ts | 48 +- src/codegen/bindgen-lib.ts | 18 +- src/codegen/bindgen.ts | 256 +++++----- src/codegen/bindgenv2/internal/any.ts | 8 +- src/codegen/bindgenv2/internal/array.ts | 4 +- src/codegen/bindgenv2/internal/base.ts | 16 +- src/codegen/bindgenv2/internal/dictionary.ts | 16 +- src/codegen/bindgenv2/internal/enumeration.ts | 6 +- src/codegen/bindgenv2/internal/interfaces.ts | 12 +- src/codegen/bindgenv2/internal/optional.ts | 16 +- src/codegen/bindgenv2/internal/primitives.ts | 24 +- src/codegen/bindgenv2/internal/string.ts | 14 +- src/codegen/bindgenv2/internal/union.ts | 20 +- src/codegen/bindgenv2/script.ts | 40 +- src/codegen/bundle-functions.ts | 12 +- src/codegen/bundle-modules.ts | 14 +- src/codegen/class-definitions.ts | 14 +- src/codegen/cppbind.ts | 134 ++--- src/codegen/generate-classes.ts | 316 ++++++------ src/codegen/generate-compact-string-table.ts | 18 +- src/codegen/generate-host-exports.ts | 6 +- src/codegen/generate-js2native.ts | 86 ++-- src/codegen/generate-jssink.ts | 34 +- src/codegen/generate-node-errors.ts | 16 +- src/codegen/process_windows_translate_c.zig | 2 +- src/codegen/replacements.ts | 8 +- src/codegen/shared-types.ts | 8 +- src/collections/StaticHashMap.zig | 2 +- src/collections/baby_list.zig | 2 +- src/collections/bit_set.zig | 6 +- src/collections/collections.zig | 12 +- src/collections/comptime_string_map.zig | 8 +- src/collections/hive_array.zig | 4 +- src/collections/linear_fifo.zig | 2 +- src/collections/multi_array_list.zig | 4 +- src/collections/pool.zig | 4 +- src/crash_handler/crash_handler.zig | 34 +- src/csrf/csrf.zig | 10 +- src/css/build-prefixes.js | 22 +- src/css/compat.zig | 2 +- src/css/context.zig | 2 +- src/css/css_modules.zig | 4 +- src/css/css_parser.zig | 38 +- src/css/declaration.zig | 2 +- src/css/dependencies.zig | 4 +- src/css/error.zig | 6 +- src/css/generics.zig | 2 +- src/css/logical.zig | 2 +- src/css/media_query.zig | 2 +- src/css/prefixes.zig | 2 +- src/css/printer.zig | 6 +- src/css/properties/align.zig | 2 +- src/css/properties/animation.zig | 2 +- src/css/properties/background.zig | 2 +- src/css/properties/border.zig | 6 +- src/css/properties/border_image.zig | 2 +- src/css/properties/border_radius.zig | 2 +- src/css/properties/box_shadow.zig | 2 +- src/css/properties/contain.zig | 2 +- src/css/properties/css_modules.zig | 2 +- src/css/properties/custom.zig | 4 +- src/css/properties/display.zig | 2 +- src/css/properties/effects.zig | 2 +- src/css/properties/flex.zig | 2 +- src/css/properties/font.zig | 2 +- src/css/properties/generate_properties.ts | 24 +- src/css/properties/grid.zig | 2 +- src/css/properties/list.zig | 2 +- src/css/properties/margin_padding.zig | 2 +- src/css/properties/masking.zig | 2 +- src/css/properties/outline.zig | 2 +- src/css/properties/overflow.zig | 2 +- src/css/properties/position.zig | 2 +- src/css/properties/prefix_handler.zig | 2 +- src/css/properties/properties.zig | 66 +-- src/css/properties/properties_generated.zig | 6 +- src/css/properties/properties_impl.zig | 2 +- src/css/properties/shape.zig | 2 +- src/css/properties/size.zig | 2 +- src/css/properties/svg.zig | 2 +- src/css/properties/text.zig | 2 +- src/css/properties/transform.zig | 2 +- src/css/properties/transition.zig | 2 +- src/css/properties/ui.zig | 2 +- src/css/rules/container.zig | 2 +- src/css/rules/counter_style.zig | 2 +- src/css/rules/custom_media.zig | 4 +- src/css/rules/document.zig | 2 +- src/css/rules/font_face.zig | 2 +- src/css/rules/font_palette_values.zig | 2 +- src/css/rules/import.zig | 2 +- src/css/rules/keyframes.zig | 2 +- src/css/rules/layer.zig | 2 +- src/css/rules/media.zig | 2 +- src/css/rules/namespace.zig | 4 +- src/css/rules/nesting.zig | 2 +- src/css/rules/page.zig | 2 +- src/css/rules/property.zig | 2 +- src/css/rules/rules.zig | 46 +- src/css/rules/scope.zig | 2 +- src/css/rules/starting_style.zig | 2 +- src/css/rules/style.zig | 2 +- src/css/rules/supports.zig | 2 +- src/css/rules/tailwind.zig | 4 +- src/css/rules/unknown.zig | 4 +- src/css/rules/viewport.zig | 2 +- src/css/selectors/builder.zig | 2 +- src/css/selectors/parser.zig | 4 +- src/css/selectors/selector.zig | 4 +- src/css/small_list.zig | 6 +- src/css/sourcemap.zig | 4 +- src/css/targets.zig | 2 +- src/css/values/alpha.zig | 2 +- src/css/values/angle.zig | 2 +- src/css/values/calc.zig | 2 +- src/css/values/color.zig | 8 +- src/css/values/color_generated.zig | 2 +- src/css/values/color_via.ts | 4 +- src/css/values/css_string.zig | 2 +- src/css/values/easing.zig | 2 +- src/css/values/gradient.zig | 2 +- src/css/values/ident.zig | 2 +- src/css/values/image.zig | 2 +- src/css/values/length.zig | 2 +- src/css/values/number.zig | 2 +- src/css/values/percentage.zig | 2 +- src/css/values/position.zig | 2 +- src/css/values/ratio.zig | 2 +- src/css/values/rect.zig | 2 +- src/css/values/resolution.zig | 2 +- src/css/values/size.zig | 2 +- src/css/values/syntax.zig | 6 +- src/css/values/time.zig | 2 +- src/css/values/url.zig | 2 +- src/css/values/values.zig | 42 +- src/css_jsc/color_js.zig | 4 +- src/dns/dns.zig | 2 +- src/dotenv/env_loader.zig | 6 +- src/errno/freebsd_errno.zig | 4 +- src/event_loop/EventLoopTimer.zig | 2 +- src/event_loop/README.md | 34 +- src/exe_format/elf.zig | 4 +- src/glob/GlobWalker.zig | 10 +- src/glob/glob.zig | 4 +- src/hash/Cargo.toml | 2 +- src/highway/highway.zig | 2 +- src/http/AsyncHTTP.zig | 16 +- src/http/CertificateInfo.zig | 2 +- src/http/Decompressor.zig | 4 +- src/http/H2Client.zig | 8 +- src/http/H2FrameParser.zig | 2 +- src/http/H3Client.zig | 14 +- src/http/HTTPContext.zig | 12 +- src/http/HTTPRequestBody.zig | 4 +- src/http/HTTPThread.zig | 2 +- src/http/HeaderBuilder.zig | 2 +- src/http/Headers.zig | 2 +- src/http/ProxyTunnel.zig | 4 +- src/http/SendFile.zig | 6 +- src/http/h2_client/ClientSession.zig | 18 +- src/http/h2_client/Stream.zig | 6 +- src/http/h2_client/dispatch.zig | 8 +- src/http/h2_client/encode.zig | 8 +- src/http/h3_client/ClientContext.zig | 10 +- src/http/h3_client/ClientSession.zig | 10 +- src/http/h3_client/Stream.zig | 4 +- src/http/h3_client/callbacks.zig | 14 +- src/http/h3_client/encode.zig | 6 +- src/http/http.zig | 66 +-- src/http/websocket.zig | 2 +- src/http/websocket_http_client.zig | 4 +- src/http/zlib.zig | 2 +- src/http_jsc/headers_jsc.zig | 16 +- src/http_jsc/method_jsc.zig | 2 +- src/http_jsc/websocket_client.zig | 24 +- .../websocket_client/CppWebSocket.zig | 12 +- .../websocket_client/WebSocketProxy.zig | 2 +- .../websocket_client/WebSocketProxyTunnel.zig | 8 +- .../WebSocketUpgradeClient.zig | 28 +- src/http_types/Cargo.toml | 2 +- src/http_types/FetchCacheMode.zig | 2 +- src/http_types/FetchRedirect.zig | 2 +- src/http_types/FetchRequestMode.zig | 2 +- src/http_types/Method.zig | 2 +- src/http_types/MimeType.zig | 10 +- src/http_types/URLPath.zig | 4 +- src/http_types/mime_type_list.txt | 2 +- src/http_types/mime_type_list_enum.zig | 8 +- src/ini/ini.zig | 2 +- src/install/NetworkTask.zig | 8 +- src/install/PackageInstall.zig | 14 +- src/install/PackageInstaller.zig | 2 +- src/install/PackageManager.zig | 100 ++-- .../PackageManager/CommandLineArguments.zig | 6 +- .../PackageManager/PackageManagerEnqueue.zig | 4 +- .../PackageManager/PackageManagerOptions.zig | 4 +- src/install/PackageManager/UpdateRequest.zig | 2 +- .../PackageManager/install_with_manager.zig | 8 +- src/install/PackageManager/runTasks.zig | 2 +- .../PackageManager/security_scanner.zig | 12 +- src/install/PackageManagerTask.zig | 2 +- src/install/PackageManifestMap.zig | 2 +- src/install/TarballStream.zig | 14 +- src/install/bin.zig | 16 +- src/install/dependency.zig | 16 +- src/install/extract_tarball.zig | 14 +- src/install/hosted_git_info.zig | 10 +- src/install/install.zig | 58 +-- src/install/integrity.zig | 2 +- src/install/isolated_install/FileCopier.zig | 2 +- src/install/isolated_install/Hardlinker.zig | 2 +- src/install/isolated_install/Installer.zig | 6 +- src/install/isolated_install/Store.zig | 2 +- src/install/lifecycle_script_runner.zig | 4 +- src/install/lockfile.zig | 50 +- src/install/lockfile/Package.zig | 8 +- src/install/lockfile/Package/Meta.zig | 2 +- src/install/lockfile/bun.lock.zig | 4 +- src/install/lockfile/bun.lockb.zig | 2 +- src/install/migration.zig | 18 +- src/install/npm.zig | 36 +- src/install/padding_checker.zig | 8 +- src/install/patch_install.zig | 6 +- src/install/pnpm.zig | 12 +- src/install/repository.zig | 12 +- src/install/resolution.zig | 4 +- src/install/resolvers/folder_resolver.zig | 20 +- src/install/windows-shim/BinLinkingShim.zig | 2 +- src/install/windows-shim/Cargo.toml | 2 +- src/install/windows-shim/bun_shim_impl.zig | 10 +- src/install/yarn.zig | 16 +- src/install_jsc/dependency_jsc.zig | 2 +- src/install_jsc/hosted_git_info_jsc.zig | 18 +- src/install_jsc/ini_jsc.zig | 2 +- src/install_jsc/install_binding.zig | 4 +- src/install_jsc/npm_jsc.zig | 6 +- src/install_types/NodeLinker.zig | 4 +- src/install_types/SemverString.zig | 2 +- src/io/ParentDeathWatchdog.zig | 6 +- src/io/PipeReader.zig | 14 +- src/io/PipeWriter.zig | 20 +- src/io/heap.zig | 2 +- src/io/io.zig | 30 +- src/io/posix_event_loop.zig | 2 +- src/io/source.zig | 2 +- src/io/windows_event_loop.zig | 2 +- src/js/CLAUDE.md | 2 +- src/js/README.md | 2 +- src/js/builtins.d.ts | 2 +- src/js/builtins/BundlerPlugin.ts | 2 +- src/js/builtins/ConsoleObject.ts | 2 +- src/js/builtins/Ipc.ts | 4 +- src/js/builtins/ProcessObjectInternals.ts | 2 +- src/js/builtins/ReadableStreamInternals.ts | 2 +- src/js/builtins/shell.ts | 12 +- src/js/bun/ffi.ts | 4 +- src/js/bun/sql.ts | 2 +- src/js/eval/fuzzilli-reprl.ts | 2 +- src/js/internal-for-testing.ts | 120 ++--- src/js/internal/assert/myers_diff.ts | 2 +- src/js/internal/cluster/RoundRobinHandle.ts | 2 +- src/js/internal/cluster/child.ts | 6 +- src/js/internal/cluster/primary.ts | 4 +- src/js/internal/http.ts | 4 +- src/js/internal/sql/mysql.ts | 22 +- src/js/internal/sql/postgres.ts | 22 +- src/js/internal/util/inspect.js | 6 +- src/js/internal/webstreams_adapters.ts | 2 +- src/js/node/_http2_upgrade.ts | 20 +- src/js/node/_http_client.ts | 2 +- src/js/node/_http_server.ts | 4 +- src/js/node/async_hooks.ts | 2 +- src/js/node/child_process.ts | 6 +- src/js/node/crypto.ts | 6 +- src/js/node/dgram.ts | 4 +- src/js/node/dns.ts | 10 +- src/js/node/fs.promises.ts | 2 +- src/js/node/fs.ts | 8 +- src/js/node/http2.ts | 4 +- src/js/node/net.ts | 28 +- src/js/node/os.ts | 2 +- src/js/node/readline.ts | 2 +- src/js/node/tls.ts | 12 +- src/js/node/util.ts | 6 +- src/js/node/worker_threads.ts | 2 +- src/js/node/zlib.ts | 8 +- src/js/private.d.ts | 16 +- src/js_parser/js_parser.zig | 48 +- src/js_parser/lexer.zig | 6 +- src/js_parser/lower/lower_decorators.zig | 2 +- src/js_parser/p.zig | 152 +++--- src/js_parser/parse/parse.zig | 38 +- src/js_parser/parse/parse_entry.zig | 6 +- src/js_parser/parse/parse_suffix.zig | 4 +- src/js_parser/parser.zig | 46 +- src/js_parser/runtime.zig | 2 +- src/js_parser/scan/scan_side_effects.zig | 2 +- src/js_parser/visit/visit.zig | 6 +- src/js_parser_jsc/Macro.zig | 18 +- src/js_printer/js_printer.zig | 14 +- src/js_printer/renamer.zig | 2 +- src/jsc/AbortSignal.zig | 2 +- src/jsc/AnyPromise.zig | 4 +- src/jsc/AsyncModule.zig | 62 +-- src/jsc/BuildMessage.zig | 40 +- src/jsc/CallFrame.zig | 2 +- src/jsc/CommonStrings.zig | 32 +- src/jsc/ConsoleObject.zig | 70 +-- src/jsc/DOMFormData.zig | 44 +- src/jsc/DOMURL.zig | 14 +- src/jsc/Debugger.zig | 14 +- src/jsc/DecodedJSValue.zig | 2 +- src/jsc/DeferredError.zig | 4 +- src/jsc/ErrorCode.zig | 4 +- src/jsc/Errorable.zig | 6 +- src/jsc/Exception.zig | 6 +- src/jsc/FFI.zig | 50 +- src/jsc/FetchHeaders.zig | 50 +- src/jsc/HTTPServerAgent.zig | 4 +- src/jsc/JSArray.zig | 2 +- src/jsc/JSArrayIterator.zig | 2 +- src/jsc/JSCell.zig | 4 +- src/jsc/JSFunction.zig | 12 +- src/jsc/JSGlobalObject.zig | 124 ++--- src/jsc/JSInternalPromise.zig | 4 +- src/jsc/JSModuleLoader.zig | 2 +- src/jsc/JSObject.zig | 4 +- src/jsc/JSRef.zig | 2 +- src/jsc/JSString.zig | 36 +- src/jsc/JSType.zig | 2 +- src/jsc/JSUint8Array.zig | 2 +- src/jsc/JSValue.zig | 182 +++---- src/jsc/MarkedArgumentBuffer.zig | 2 +- src/jsc/ModuleLoader.zig | 42 +- src/jsc/NodeModuleModule.zig | 2 +- src/jsc/ResolveMessage.zig | 32 +- src/jsc/RuntimeTranspilerStore.zig | 16 +- src/jsc/STREAMS.md | 32 +- src/jsc/SavedSourceMap.zig | 8 +- src/jsc/Strong.zig | 2 +- src/jsc/Task.zig | 4 +- src/jsc/TopExceptionScope.zig | 8 +- src/jsc/URLSearchParams.zig | 12 +- src/jsc/VirtualMachine.zig | 130 ++--- src/jsc/WTF.zig | 2 +- src/jsc/ZigErrorType.zig | 4 +- src/jsc/ZigException.zig | 46 +- src/jsc/ZigStackFrame.zig | 28 +- src/jsc/ZigStackFrameCode.zig | 6 +- src/jsc/ZigStackFramePosition.zig | 6 +- src/jsc/ZigStackTrace.zig | 26 +- src/jsc/ZigString.zig | 268 +++++----- src/jsc/array_buffer.zig | 4 +- src/jsc/bindgen.zig | 82 +-- src/jsc/bindings/AsymmetricKeyValue.cpp | 2 +- src/jsc/bindings/AsyncContextFrame.cpp | 6 +- .../bindings/BakeAdditionsToGlobalObject.cpp | 32 +- src/jsc/bindings/Bindgen/ExternVectorTraits.h | 4 +- src/jsc/bindings/BufferEncodingType.h | 2 +- .../bindings/BunAnalyzeTranspiledModule.cpp | 18 +- src/jsc/bindings/BunAnalyzeTranspiledModule.h | 2 +- src/jsc/bindings/BunCPUProfiler.cpp | 2 +- src/jsc/bindings/BunClientData.cpp | 2 +- src/jsc/bindings/BunClientData.h | 6 +- src/jsc/bindings/BunCommonStrings.cpp | 52 +- src/jsc/bindings/BunDebugger.cpp | 26 +- src/jsc/bindings/BunGlobalScope.cpp | 2 +- src/jsc/bindings/BunHttp2CommonStrings.cpp | 2 +- src/jsc/bindings/BunIDLConvertBlob.h | 2 +- src/jsc/bindings/BunInjectedScriptHost.cpp | 2 +- src/jsc/bindings/BunMarkdownMeta.cpp | 10 +- src/jsc/bindings/BunMarkdownMeta.h | 2 +- src/jsc/bindings/BunMarkdownTagStrings.cpp | 6 +- src/jsc/bindings/BunObject+exports.h | 22 +- src/jsc/bindings/BunObject.cpp | 52 +- src/jsc/bindings/BunPlugin.cpp | 28 +- src/jsc/bindings/BunPlugin.h | 6 +- src/jsc/bindings/BunProcess.cpp | 132 ++--- src/jsc/bindings/BunProcess.h | 6 +- .../BunProcessReportObjectWindows.cpp | 4 +- src/jsc/bindings/BunSecureContextCache.cpp | 10 +- src/jsc/bindings/BunSecureContextCache.h | 4 +- src/jsc/bindings/BunString.cpp | 126 ++--- src/jsc/bindings/BundlerMetafile.cpp | 2 +- src/jsc/bindings/CallSite.cpp | 4 +- src/jsc/bindings/CallSite.h | 4 +- src/jsc/bindings/CallSitePrototype.cpp | 2 +- src/jsc/bindings/CallSitePrototype.h | 2 +- src/jsc/bindings/CodeCoverage.cpp | 2 +- src/jsc/bindings/ConsoleObject.h | 2 +- src/jsc/bindings/DOMFormData.cpp | 8 +- src/jsc/bindings/DOMWrapperWorld.cpp | 2 +- src/jsc/bindings/DOMWrapperWorld.h | 6 +- src/jsc/bindings/DoubleFormatter.cpp | 4 +- src/jsc/bindings/ErrorCode.cpp | 24 +- src/jsc/bindings/ErrorCode.h | 10 +- src/jsc/bindings/ErrorStackFrame.cpp | 8 +- src/jsc/bindings/ErrorStackFrame.h | 2 +- src/jsc/bindings/ErrorStackTrace.cpp | 28 +- src/jsc/bindings/ErrorStackTrace.h | 4 +- src/jsc/bindings/EventLoopTaskNoContext.h | 2 +- src/jsc/bindings/ExceptionCode.h | 2 +- src/jsc/bindings/ExposeNodeModuleGlobals.cpp | 10 +- src/jsc/bindings/FormatStackTraceForJS.cpp | 68 +-- src/jsc/bindings/FormatStackTraceForJS.h | 14 +- src/jsc/bindings/FuzzilliREPRL.cpp | 4 +- src/jsc/bindings/HTMLEntryPoint.cpp | 4 +- src/jsc/bindings/IPC.cpp | 6 +- src/jsc/bindings/ImportMetaObject.cpp | 24 +- src/jsc/bindings/ImportMetaObject.h | 4 +- .../InspectorBunFrontendDevServerAgent.cpp | 4 +- .../InspectorBunFrontendDevServerAgent.h | 2 +- src/jsc/bindings/InspectorHTTPServerAgent.cpp | 16 +- src/jsc/bindings/InspectorLifecycleAgent.cpp | 10 +- src/jsc/bindings/InspectorLifecycleAgent.h | 2 +- .../bindings/InspectorTestReporterAgent.cpp | 12 +- src/jsc/bindings/InternalForTesting.cpp | 4 +- src/jsc/bindings/InternalForTesting.h | 2 +- src/jsc/bindings/InternalModuleRegistry.cpp | 4 +- src/jsc/bindings/IsolatedModuleCache.cpp | 8 +- src/jsc/bindings/IsolatedModuleCache.h | 10 +- src/jsc/bindings/JS2Native.cpp | 4 +- src/jsc/bindings/JSBakeResponse.cpp | 24 +- src/jsc/bindings/JSBakeResponse.h | 4 +- src/jsc/bindings/JSBuffer.cpp | 8 +- src/jsc/bindings/JSBuffer.h | 2 +- src/jsc/bindings/JSBufferList.cpp | 12 +- src/jsc/bindings/JSBufferList.h | 4 +- src/jsc/bindings/JSBunRequest.cpp | 10 +- src/jsc/bindings/JSBunRequest.h | 4 +- src/jsc/bindings/JSBundlerPlugin.cpp | 10 +- src/jsc/bindings/JSBundlerPlugin.h | 2 +- src/jsc/bindings/JSCTestingHelpers.cpp | 4 +- src/jsc/bindings/JSCTestingHelpers.h | 2 +- src/jsc/bindings/JSCommonJSExtensions.cpp | 18 +- src/jsc/bindings/JSCommonJSModule.cpp | 62 +-- src/jsc/bindings/JSCommonJSModule.h | 26 +- src/jsc/bindings/JSDOMExceptionHandling.cpp | 2 +- src/jsc/bindings/JSDOMFile.cpp | 10 +- src/jsc/bindings/JSDOMGlobalObject.cpp | 6 +- src/jsc/bindings/JSDOMGlobalObject.h | 4 +- src/jsc/bindings/JSDOMWrapper.h | 6 +- src/jsc/bindings/JSEnvironmentVariableMap.cpp | 46 +- src/jsc/bindings/JSEnvironmentVariableMap.h | 4 +- src/jsc/bindings/JSFFIFunction.cpp | 30 +- src/jsc/bindings/JSFFIFunction.h | 8 +- src/jsc/bindings/JSMockFunction.cpp | 50 +- src/jsc/bindings/JSMockFunction.h | 2 +- .../JSNodePerformanceHooksHistogram.cpp | 2 +- ...dePerformanceHooksHistogramConstructor.cpp | 6 +- ...NodePerformanceHooksHistogramPrototype.cpp | 16 +- ...JSNodePerformanceHooksHistogramPrototype.h | 2 +- src/jsc/bindings/JSPropertyIterator.cpp | 8 +- src/jsc/bindings/JSReactElement.cpp | 4 +- src/jsc/bindings/JSReactElement.h | 2 +- src/jsc/bindings/JSS3File.cpp | 4 +- src/jsc/bindings/JSS3File.h | 2 +- src/jsc/bindings/JSSecrets.cpp | 6 +- src/jsc/bindings/JSSocketAddressDTO.cpp | 4 +- src/jsc/bindings/JSSocketAddressDTO.h | 4 +- src/jsc/bindings/JSStringDecoder.cpp | 8 +- src/jsc/bindings/JSWrappingFunction.cpp | 12 +- src/jsc/bindings/JSWrappingFunction.h | 6 +- src/jsc/bindings/JSX509Certificate.cpp | 12 +- src/jsc/bindings/JSX509Certificate.h | 2 +- .../bindings/JSX509CertificateConstructor.cpp | 2 +- .../bindings/JSX509CertificateConstructor.h | 2 +- .../bindings/JSX509CertificatePrototype.cpp | 2 +- src/jsc/bindings/ModuleLoader.cpp | 56 +-- src/jsc/bindings/ModuleLoader.h | 16 +- src/jsc/bindings/NapiClass.cpp | 6 +- src/jsc/bindings/NapiRef.cpp | 2 +- src/jsc/bindings/NapiWeakValue.cpp | 2 +- src/jsc/bindings/NativePromiseContext.cpp | 6 +- src/jsc/bindings/NativePromiseContext.h | 4 +- src/jsc/bindings/NoOrphansTracker.cpp | 2 +- src/jsc/bindings/NodeAsyncHooks.cpp | 4 +- src/jsc/bindings/NodeAsyncHooks.h | 2 +- src/jsc/bindings/NodeDirent.cpp | 16 +- src/jsc/bindings/NodeFSStatBinding.cpp | 20 +- src/jsc/bindings/NodeFSStatFSBinding.cpp | 20 +- src/jsc/bindings/NodeFetch.cpp | 4 +- src/jsc/bindings/NodeFetch.h | 2 +- src/jsc/bindings/NodeHTTP.cpp | 14 +- src/jsc/bindings/NodeHTTP.h | 2 +- src/jsc/bindings/NodeTLS.cpp | 2 +- src/jsc/bindings/NodeTLS.h | 2 +- src/jsc/bindings/NodeTimerObject.cpp | 4 +- src/jsc/bindings/NodeURL.cpp | 2 +- src/jsc/bindings/NodeURL.h | 4 +- src/jsc/bindings/NodeVM.cpp | 44 +- src/jsc/bindings/NodeVM.h | 6 +- src/jsc/bindings/NodeVMScript.cpp | 12 +- src/jsc/bindings/NodeVMSourceTextModule.cpp | 4 +- src/jsc/bindings/NodeVMSyntheticModule.cpp | 4 +- src/jsc/bindings/NodeValidator.cpp | 2 +- src/jsc/bindings/NodeValidator.h | 2 +- src/jsc/bindings/Path.cpp | 18 +- src/jsc/bindings/Path.h | 4 +- src/jsc/bindings/ProcessBindingFs.cpp | 2 +- src/jsc/bindings/ProcessBindingHTTPParser.cpp | 2 +- src/jsc/bindings/ProcessBindingTTYWrap.cpp | 10 +- src/jsc/bindings/ProcessBindingTTYWrap.h | 4 +- src/jsc/bindings/ProcessBindingUV.cpp | 2 +- src/jsc/bindings/S3Error.cpp | 2 +- src/jsc/bindings/SQLClient.cpp | 10 +- src/jsc/bindings/ScriptExecutionContext.cpp | 8 +- src/jsc/bindings/Serialization.cpp | 2 +- src/jsc/bindings/ServerRouteList.cpp | 36 +- src/jsc/bindings/ServerRouteList.h | 4 +- src/jsc/bindings/ShellBindings.cpp | 4 +- src/jsc/bindings/StringBuilderBinding.cpp | 4 +- src/jsc/bindings/StrongRef.cpp | 2 +- src/jsc/bindings/TextCodecWrapper.cpp | 2 +- src/jsc/bindings/TopExceptionScopeBinding.cpp | 8 +- src/jsc/bindings/URLSearchParams.cpp | 12 +- src/jsc/bindings/Undici.cpp | 4 +- src/jsc/bindings/Undici.h | 2 +- src/jsc/bindings/UtilInspect.cpp | 6 +- src/jsc/bindings/ZigException.cpp | 58 +-- src/jsc/bindings/ZigGlobalObject.cpp | 240 ++++----- src/jsc/bindings/ZigGlobalObject.h | 46 +- src/jsc/bindings/ZigGlobalObject.lut.txt | 4 +- .../bindings/ZigLazyStaticFunctions-inlines.h | 4 +- src/jsc/bindings/ZigLazyStaticFunctions.h | 6 +- src/jsc/bindings/ZigSourceProvider.cpp | 16 +- src/jsc/bindings/ZigSourceProvider.h | 6 +- src/jsc/bindings/bindings.cpp | 472 +++++++++--------- src/jsc/bindings/blob.cpp | 2 +- src/jsc/bindings/c-bindings.cpp | 2 +- src/jsc/bindings/headers-cpp.h | 18 +- src/jsc/bindings/headers-handwritten.h | 100 ++-- src/jsc/bindings/headers.h | 256 +++++----- src/jsc/bindings/helpers.h | 110 ++-- src/jsc/bindings/image_coregraphics_shim.cpp | 16 +- src/jsc/bindings/image_resize.cpp | 4 +- src/jsc/bindings/image_wic_shim.cpp | 8 +- src/jsc/bindings/js_classes.ts | 2 +- src/jsc/bindings/napi.cpp | 92 ++-- src/jsc/bindings/napi.h | 28 +- src/jsc/bindings/napi_external.h | 2 +- src/jsc/bindings/napi_handle_scope.cpp | 8 +- src/jsc/bindings/napi_handle_scope.h | 8 +- src/jsc/bindings/napi_type_tag.cpp | 2 +- .../bindings/node/JSNodeHTTPServerSocket.cpp | 18 +- .../bindings/node/JSNodeHTTPServerSocket.h | 2 +- .../node/JSNodeHTTPServerSocketPrototype.cpp | 4 +- src/jsc/bindings/node/crypto/CryptoPrimes.h | 4 +- src/jsc/bindings/node/crypto/CryptoUtil.cpp | 16 +- src/jsc/bindings/node/crypto/CryptoUtil.h | 10 +- src/jsc/bindings/node/crypto/JSCipher.cpp | 2 +- .../node/crypto/JSCipherConstructor.cpp | 4 +- .../bindings/node/crypto/JSDiffieHellman.cpp | 2 +- .../crypto/JSDiffieHellmanConstructor.cpp | 4 +- .../node/crypto/JSDiffieHellmanGroup.cpp | 2 +- .../JSDiffieHellmanGroupConstructor.cpp | 8 +- src/jsc/bindings/node/crypto/JSECDH.cpp | 2 +- .../node/crypto/JSECDHConstructor.cpp | 4 +- src/jsc/bindings/node/crypto/JSHash.cpp | 38 +- src/jsc/bindings/node/crypto/JSHash.h | 4 +- src/jsc/bindings/node/crypto/JSHmac.cpp | 6 +- src/jsc/bindings/node/crypto/JSKeyObject.cpp | 2 +- .../node/crypto/JSKeyObjectConstructor.cpp | 2 +- .../node/crypto/JSPrivateKeyObject.cpp | 2 +- .../node/crypto/JSPublicKeyObject.cpp | 2 +- .../node/crypto/JSSecretKeyObject.cpp | 2 +- src/jsc/bindings/node/crypto/JSSign.cpp | 8 +- src/jsc/bindings/node/crypto/JSVerify.cpp | 2 +- src/jsc/bindings/node/crypto/KeyObject.cpp | 2 +- .../node/crypto/node_crypto_binding.cpp | 6 +- .../node/crypto/node_crypto_binding.h | 2 +- .../http/JSConnectionsListConstructor.cpp | 2 +- .../node/http/JSHTTPParserConstructor.cpp | 2 +- .../node/http/JSHTTPParserPrototype.cpp | 2 +- src/jsc/bindings/node/http/NodeHTTPParser.cpp | 2 +- src/jsc/bindings/objects.h | 44 +- src/jsc/bindings/root-pch.h | 4 +- src/jsc/bindings/root.h | 4 +- src/jsc/bindings/sliceAnsi.cpp | 10 +- src/jsc/bindings/sqlite/JSSQLStatement.cpp | 6 +- src/jsc/bindings/sqlite/JSSQLStatement.h | 4 +- src/jsc/bindings/v8/AGENTS.md | 6 +- src/jsc/bindings/v8/CLAUDE.md | 6 +- src/jsc/bindings/v8/V8Array.cpp | 8 +- src/jsc/bindings/v8/V8Context.h | 12 +- src/jsc/bindings/v8/V8Function.cpp | 2 +- src/jsc/bindings/v8/V8Isolate.cpp | 2 +- src/jsc/bindings/v8/V8Isolate.h | 4 +- src/jsc/bindings/v8/V8Object.cpp | 12 +- src/jsc/bindings/v8/shim/FunctionTemplate.cpp | 4 +- src/jsc/bindings/v8/shim/GlobalInternals.cpp | 2 +- src/jsc/bindings/v8/shim/GlobalInternals.h | 6 +- src/jsc/bindings/v8/v8.h | 2 +- src/jsc/bindings/webcore/AbortController.h | 6 +- src/jsc/bindings/webcore/AbortSignal.h | 2 +- .../bindings/webcore/DOMClientIsoSubspaces.h | 2 +- src/jsc/bindings/webcore/DOMIsoSubspaces.h | 4 +- src/jsc/bindings/webcore/JSCallbackData.cpp | 2 +- .../bindings/webcore/JSDOMConstructorBase.h | 2 +- src/jsc/bindings/webcore/JSDOMConvertBase.h | 2 +- src/jsc/bindings/webcore/JSDOMFormData.cpp | 2 +- .../webcore/JSDOMGlobalObjectInlines.h | 8 +- src/jsc/bindings/webcore/JSErrorEvent.cpp | 2 +- src/jsc/bindings/webcore/JSEventEmitter.cpp | 2 +- .../bindings/webcore/JSEventEmitterCustom.cpp | 4 +- src/jsc/bindings/webcore/JSEventListener.cpp | 2 +- .../bindings/webcore/JSEventTargetCustom.cpp | 2 +- src/jsc/bindings/webcore/JSMIMEBindings.cpp | 4 +- src/jsc/bindings/webcore/JSMIMEBindings.h | 4 +- src/jsc/bindings/webcore/JSMIMEParams.cpp | 10 +- src/jsc/bindings/webcore/JSMIMEParams.h | 2 +- src/jsc/bindings/webcore/JSMIMEType.cpp | 10 +- src/jsc/bindings/webcore/JSPerformance.cpp | 2 +- .../webcore/JSPerformanceObserverCallback.cpp | 2 +- src/jsc/bindings/webcore/JSReadableStream.cpp | 12 +- src/jsc/bindings/webcore/JSWebSocket.cpp | 12 +- src/jsc/bindings/webcore/JSWebSocket.h | 2 +- src/jsc/bindings/webcore/MessagePort.cpp | 2 +- src/jsc/bindings/webcore/PerformanceMark.cpp | 2 +- .../bindings/webcore/PerformanceObserver.cpp | 2 +- src/jsc/bindings/webcore/ReadableStream.cpp | 40 +- .../webcore/SerializedScriptValue.cpp | 6 +- src/jsc/bindings/webcore/WebSocket.cpp | 34 +- src/jsc/bindings/webcore/WebSocket.h | 8 +- src/jsc/bindings/webcore/WebSocketDeflate.h | 2 +- src/jsc/bindings/webcore/Worker.cpp | 38 +- src/jsc/bindings/webcore/Worker.h | 18 +- src/jsc/bindings/wrapAnsi.cpp | 4 +- src/jsc/bindings/wtf-bindings.cpp | 4 +- src/jsc/bun_string_jsc.zig | 8 +- src/jsc/event_loop.zig | 50 +- src/jsc/fmt_jsc.zig | 2 +- src/jsc/headergen/sizegen.cpp | 6 +- src/jsc/host_fn.zig | 34 +- src/jsc/hot_reloader.zig | 4 +- src/jsc/ipc.zig | 20 +- src/jsc/jsc.zig | 178 +++---- src/jsc/modules/AbortControllerModuleModule.h | 6 +- src/jsc/modules/BunAppModule.h | 8 +- src/jsc/modules/BunJSCModule.h | 10 +- src/jsc/modules/BunObjectModule.h | 4 +- src/jsc/modules/BunTestModule.h | 6 +- src/jsc/modules/NodeBufferModule.h | 8 +- src/jsc/modules/NodeConstantsModule.h | 4 +- src/jsc/modules/NodeModuleModule.cpp | 58 +-- src/jsc/modules/NodeModuleModule.h | 8 +- src/jsc/modules/NodeProcessModule.h | 6 +- src/jsc/modules/NodeStringDecoderModule.h | 6 +- src/jsc/modules/NodeTTYModule.cpp | 4 +- src/jsc/modules/NodeTTYModule.h | 4 +- src/jsc/modules/NodeUtilTypesModule.cpp | 6 +- src/jsc/modules/NodeUtilTypesModule.h | 4 +- src/jsc/modules/ObjectModule.cpp | 4 +- src/jsc/modules/ObjectModule.h | 6 +- src/jsc/modules/UTF8ValidateModule.h | 4 +- src/jsc/modules/_NativeModule.h | 12 +- src/jsc/rare_data.zig | 18 +- src/jsc/resolver_jsc.zig | 2 +- src/jsc/uuid.zig | 2 +- src/jsc/virtual_machine_exports.zig | 10 +- src/jsc/web_worker.zig | 6 +- src/libarchive/libarchive.zig | 6 +- src/libarchive_sys/bindings.zig | 58 +-- src/libuv_sys/libuv.zig | 4 +- src/lolhtml_sys/lol_html.zig | 2 +- src/main.zig | 4 +- src/main_test.zig | 10 +- src/main_wasm.zig | 4 +- src/md/ansi_renderer.zig | 10 +- src/md/autolinks.zig | 4 +- src/md/blocks.zig | 8 +- src/md/containers.zig | 6 +- src/md/entity.zig | 6 +- src/md/helpers.zig | 8 +- src/md/html_renderer.zig | 6 +- src/md/inlines.zig | 8 +- src/md/line_analysis.zig | 6 +- src/md/links.zig | 10 +- src/md/parser.zig | 36 +- src/md/ref_defs.zig | 8 +- src/md/render_blocks.zig | 6 +- src/md/root.zig | 10 +- src/meta/meta.zig | 8 +- src/meta/traits.zig | 2 +- src/mimalloc_sys/mimalloc.zig | 2 +- src/options_types/BundleEnums.zig | 4 +- src/options_types/CodeCoverageOptions.zig | 4 +- src/options_types/CommandTag.zig | 10 +- src/options_types/CompileTarget.zig | 4 +- src/options_types/Context.zig | 16 +- src/options_types/schema.zig | 4 +- src/parsers/interchange.zig | 8 +- src/parsers/json5.zig | 2 +- src/parsers/toml.zig | 4 +- src/patch/patch.zig | 2 +- src/patch_jsc/testing.zig | 2 +- src/paths/paths.zig | 6 +- src/paths/resolve_path.zig | 4 +- src/perf/perf.zig | 4 +- src/perf/system_timer.zig | 2 +- src/perf/tracy.zig | 4 +- src/picohttp/picohttp.zig | 2 +- src/platform/linux.zig | 2 +- src/ptr/CowSlice.zig | 6 +- src/ptr/owned.zig | 2 +- src/ptr/ptr.zig | 22 +- src/ptr/ref_count.zig | 4 +- src/ptr/shared.zig | 2 +- src/resolve_builtins/HardcodedModule.zig | 4 +- src/resolver/data_url.zig | 2 +- src/resolver/dir_info.zig | 6 +- src/resolver/fs.zig | 6 +- src/resolver/node_fallbacks.zig | 6 +- src/resolver/package_json.zig | 20 +- src/resolver/resolver.zig | 46 +- src/resolver/tsconfig_json.zig | 6 +- src/router/router.zig | 18 +- src/runtime/Cargo.toml | 8 +- src/runtime/api.zig | 104 ++-- src/runtime/api/Archive.zig | 14 +- src/runtime/api/BunObject.bind.ts | 2 +- src/runtime/api/BunObject.zig | 100 ++-- src/runtime/api/HashObject.zig | 8 +- src/runtime/api/JSBundler.zig | 70 +-- src/runtime/api/JSON5Object.zig | 6 +- src/runtime/api/JSONCObject.zig | 4 +- src/runtime/api/JSTranspiler.zig | 54 +- src/runtime/api/MarkdownObject.zig | 54 +- src/runtime/api/NativePromiseContext.zig | 2 +- src/runtime/api/TOMLObject.zig | 4 +- src/runtime/api/UnsafeObject.zig | 16 +- src/runtime/api/YAMLObject.zig | 8 +- src/runtime/api/bun/SSLContextCache.zig | 2 +- src/runtime/api/bun/SecureContext.zig | 2 +- src/runtime/api/bun/Terminal.zig | 12 +- src/runtime/api/bun/h2_frame_parser.zig | 48 +- src/runtime/api/bun/js_bun_spawn_bindings.zig | 34 +- src/runtime/api/bun/process.zig | 14 +- src/runtime/api/bun/spawn.zig | 8 +- src/runtime/api/bun/spawn/stdio.zig | 2 +- src/runtime/api/bun/subprocess.zig | 20 +- .../api/bun/subprocess/ResourceUsage.zig | 18 +- .../api/bun/subprocess/StaticPipeWriter.zig | 2 +- src/runtime/api/crash_handler_jsc.zig | 12 +- src/runtime/api/cron.zig | 2 +- src/runtime/api/csrf_jsc.zig | 8 +- src/runtime/api/filesystem_router.zig | 68 +-- src/runtime/api/glob.zig | 8 +- src/runtime/api/html_rewriter.zig | 76 +-- src/runtime/bake/BakeGlobalObject.cpp | 20 +- src/runtime/bake/BakeGlobalObject.h | 8 +- src/runtime/bake/BakeSourceProvider.cpp | 4 +- src/runtime/bake/BakeSourceProvider.h | 4 +- src/runtime/bake/DevServer.zig | 30 +- .../bake/DevServer/ErrorReportRequest.zig | 22 +- src/runtime/bake/DevServer/memory_cost.zig | 2 +- src/runtime/bake/DevServerSourceProvider.cpp | 4 +- src/runtime/bake/DevServerSourceProvider.h | 12 +- src/runtime/bake/bake.zig | 22 +- src/runtime/bake/bun-framework-react/index.ts | 2 +- src/runtime/bake/hmr-module.ts | 2 +- src/runtime/bake/hmr-runtime-client.ts | 2 +- src/runtime/cli/audit_command.zig | 12 +- src/runtime/cli/build_command.zig | 14 +- src/runtime/cli/bunfig.zig | 16 +- src/runtime/cli/bunx_command.zig | 6 +- src/runtime/cli/cli.zig | 94 ++-- .../cli/create/SourceFileProjectGenerator.zig | 4 +- src/runtime/cli/create_command.zig | 24 +- src/runtime/cli/discord_command.zig | 2 +- src/runtime/cli/exec_command.zig | 2 +- src/runtime/cli/filter_arg.zig | 2 +- src/runtime/cli/filter_run.zig | 6 +- src/runtime/cli/init_command.zig | 8 +- .../cli/install_completions_command.zig | 10 +- src/runtime/cli/multi_run.zig | 4 +- src/runtime/cli/open.zig | 6 +- src/runtime/cli/pack_command.zig | 4 +- src/runtime/cli/package_manager_command.zig | 32 +- src/runtime/cli/pm_trusted_command.zig | 6 +- src/runtime/cli/pm_view_command.zig | 12 +- src/runtime/cli/pm_why_command.zig | 2 +- src/runtime/cli/publish_command.zig | 2 +- src/runtime/cli/repl.zig | 4 +- src/runtime/cli/repl_command.zig | 8 +- src/runtime/cli/run_command.zig | 22 +- src/runtime/cli/scan_command.zig | 6 +- src/runtime/cli/test/ParallelRunner.zig | 4 +- src/runtime/cli/test/Scanner.zig | 2 +- src/runtime/cli/test/parallel/Channel.zig | 6 +- src/runtime/cli/test/parallel/Coordinator.zig | 8 +- src/runtime/cli/test/parallel/Worker.zig | 8 +- src/runtime/cli/test/parallel/aggregate.zig | 6 +- src/runtime/cli/test/parallel/runner.zig | 16 +- src/runtime/cli/test_command.zig | 42 +- src/runtime/cli/update_command.zig | 2 +- src/runtime/cli/upgrade_command.zig | 22 +- src/runtime/cli/why_command.zig | 4 +- src/runtime/crypto/CryptoHasher.zig | 70 +-- src/runtime/crypto/EVP.zig | 6 +- src/runtime/crypto/PBKDF2.zig | 8 +- src/runtime/crypto/PasswordObject.zig | 34 +- src/runtime/crypto/crypto.zig | 26 +- src/runtime/dns_jsc/cares_jsc.zig | 58 +-- src/runtime/dns_jsc/dns.zig | 32 +- src/runtime/dns_jsc/options_jsc.zig | 6 +- src/runtime/ffi/FFI.h | 14 +- src/runtime/ffi/FFIObject.zig | 10 +- src/runtime/ffi/ffi.zig | 92 ++-- src/runtime/image/Image.classes.ts | 4 +- src/runtime/image/Image.zig | 26 +- src/runtime/image/README.md | 22 +- src/runtime/image/backend_coregraphics.zig | 6 +- src/runtime/image/backend_wic.zig | 2 +- src/runtime/image/codec_bmp.zig | 2 +- src/runtime/image/codec_gif.zig | 2 +- src/runtime/image/codec_jpeg.zig | 4 +- src/runtime/image/codec_png.zig | 8 +- src/runtime/image/codec_webp.zig | 4 +- src/runtime/image/codecs.zig | 20 +- src/runtime/napi/napi.zig | 12 +- src/runtime/node.zig | 36 +- src/runtime/node/assert/myers_diff.zig | 6 +- src/runtime/node/buffer.zig | 2 +- src/runtime/node/fs_events.zig | 2 +- src/runtime/node/net/BlockList.zig | 2 +- src/runtime/node/node_assert.zig | 2 +- src/runtime/node/node_assert_binding.zig | 4 +- src/runtime/node/node_cluster_binding.zig | 10 +- src/runtime/node/node_crypto_binding.zig | 4 +- src/runtime/node/node_fs.zig | 46 +- src/runtime/node/node_fs_stat_watcher.zig | 4 +- src/runtime/node/node_fs_watcher.zig | 6 +- src/runtime/node/node_net_binding.zig | 2 +- src/runtime/node/node_os.zig | 112 ++--- src/runtime/node/node_process.zig | 14 +- src/runtime/node/node_util_binding.zig | 8 +- src/runtime/node/node_zlib_binding.zig | 6 +- src/runtime/node/os/constants.zig | 18 +- src/runtime/node/path.zig | 92 ++-- src/runtime/node/path_watcher.zig | 26 +- src/runtime/node/types.zig | 42 +- src/runtime/node/util/parse_args.zig | 30 +- src/runtime/node/util/parse_args_utils.zig | 2 +- src/runtime/node/util/validators.zig | 8 +- src/runtime/node/win_watcher.zig | 4 +- src/runtime/node/zlib/NativeBrotli.zig | 8 +- src/runtime/node/zlib/NativeZlib.zig | 8 +- src/runtime/node/zlib/NativeZstd.zig | 8 +- src/runtime/server/AnyRequestContext.zig | 2 +- src/runtime/server/HTMLBundle.zig | 6 +- src/runtime/server/NodeHTTPResponse.zig | 10 +- src/runtime/server/RequestContext.zig | 4 +- src/runtime/server/ServerConfig.zig | 4 +- src/runtime/server/ServerWebSocket.zig | 6 +- src/runtime/server/WebSocketServerContext.zig | 6 +- src/runtime/server/server.zig | 118 ++--- src/runtime/shell/Builtin.zig | 44 +- src/runtime/shell/EnvStr.zig | 2 +- src/runtime/shell/IOWriter.zig | 2 +- src/runtime/shell/ParsedShellScript.zig | 4 +- src/runtime/shell/Yield.zig | 4 +- src/runtime/shell/builtin/basename.zig | 2 +- src/runtime/shell/builtin/cat.zig | 2 +- src/runtime/shell/builtin/cd.zig | 2 +- src/runtime/shell/builtin/cp.zig | 2 +- src/runtime/shell/builtin/dirname.zig | 2 +- src/runtime/shell/builtin/echo.zig | 2 +- src/runtime/shell/builtin/exit.zig | 2 +- src/runtime/shell/builtin/export.zig | 2 +- src/runtime/shell/builtin/false_.zig | 2 +- src/runtime/shell/builtin/ls.zig | 2 +- src/runtime/shell/builtin/mkdir.zig | 2 +- src/runtime/shell/builtin/mv.zig | 2 +- src/runtime/shell/builtin/pwd.zig | 2 +- src/runtime/shell/builtin/rm.zig | 2 +- src/runtime/shell/builtin/seq.zig | 2 +- src/runtime/shell/builtin/touch.zig | 2 +- src/runtime/shell/builtin/true_.zig | 2 +- src/runtime/shell/builtin/which.zig | 2 +- src/runtime/shell/builtin/yes.zig | 2 +- src/runtime/shell/interpreter.zig | 70 +-- src/runtime/shell/shell.zig | 20 +- src/runtime/shell/states/Cmd.zig | 4 +- src/runtime/shell/states/Expansion.zig | 2 +- src/runtime/shell/subproc.zig | 4 +- src/runtime/socket/Handlers.zig | 4 +- src/runtime/socket/Listener.zig | 24 +- src/runtime/socket/SocketAddress.zig | 16 +- src/runtime/socket/UpgradedDuplex.zig | 2 +- src/runtime/socket/WindowsNamedPipe.zig | 2 +- src/runtime/socket/socket.zig | 16 +- src/runtime/socket/tls_socket_functions.zig | 56 +-- src/runtime/socket/udp_socket.zig | 8 +- src/runtime/socket/uws_dispatch.zig | 10 +- src/runtime/socket/uws_handlers.zig | 12 +- src/runtime/test_runner/Execution.zig | 6 +- src/runtime/test_runner/ScopeFunctions.zig | 4 +- src/runtime/test_runner/bun_test.zig | 16 +- src/runtime/test_runner/debug.zig | 8 +- .../test_runner/diff/diff_match_patch.zig | 4 +- src/runtime/test_runner/diff/printDiff.zig | 2 +- src/runtime/test_runner/diff_format.zig | 4 +- src/runtime/test_runner/expect.zig | 178 +++---- src/runtime/test_runner/expect/toBe.zig | 2 +- src/runtime/test_runner/expect/toEqual.zig | 2 +- .../expect/toHaveBeenCalledWith.zig | 2 +- .../expect/toHaveBeenLastCalledWith.zig | 2 +- .../expect/toHaveBeenNthCalledWith.zig | 2 +- .../expect/toHaveLastReturnedWith.zig | 2 +- .../expect/toHaveNthReturnedWith.zig | 2 +- .../test_runner/expect/toHaveProperty.zig | 8 +- .../expect/toHaveReturnedTimes.zig | 2 +- .../test_runner/expect/toHaveReturnedWith.zig | 2 +- .../expect/toMatchInlineSnapshot.zig | 8 +- .../test_runner/expect/toMatchObject.zig | 2 +- .../test_runner/expect/toMatchSnapshot.zig | 8 +- src/runtime/test_runner/expect/toSatisfy.zig | 4 +- .../test_runner/expect/toStrictEqual.zig | 2 +- src/runtime/test_runner/expect/toThrow.zig | 10 +- .../toThrowErrorMatchingInlineSnapshot.zig | 6 +- .../expect/toThrowErrorMatchingSnapshot.zig | 6 +- src/runtime/test_runner/jest.zig | 86 ++-- src/runtime/test_runner/pretty_format.zig | 54 +- src/runtime/test_runner/snapshot.zig | 6 +- src/runtime/test_runner/timers/FakeTimers.zig | 2 +- src/runtime/timer/ImmediateObject.zig | 2 +- src/runtime/timer/TimeoutObject.zig | 2 +- src/runtime/timer/Timer.zig | 14 +- src/runtime/timer/TimerObjectInternals.zig | 2 +- src/runtime/valkey_jsc/ValkeyCommand.zig | 4 +- src/runtime/valkey_jsc/index.zig | 14 +- src/runtime/valkey_jsc/js_valkey.zig | 18 +- .../valkey_jsc/js_valkey_functions.zig | 10 +- src/runtime/valkey_jsc/protocol_jsc.zig | 4 +- src/runtime/valkey_jsc/valkey.zig | 8 +- src/runtime/webcore.zig | 82 +-- src/runtime/webcore/Blob.zig | 102 ++-- src/runtime/webcore/Body.zig | 6 +- src/runtime/webcore/Crypto.zig | 8 +- src/runtime/webcore/EncodingLabel.zig | 2 +- src/runtime/webcore/FormData.zig | 20 +- src/runtime/webcore/ReadableStream.zig | 4 +- src/runtime/webcore/Request.zig | 30 +- src/runtime/webcore/Response.zig | 20 +- src/runtime/webcore/ResumableSink.zig | 4 +- src/runtime/webcore/S3Client.zig | 2 +- src/runtime/webcore/S3File.zig | 4 +- src/runtime/webcore/Sink.zig | 2 +- src/runtime/webcore/TextDecoder.zig | 20 +- .../webcore/TextEncoderStreamEncoder.zig | 4 +- src/runtime/webcore/blob/Store.zig | 2 +- src/runtime/webcore/blob/copy_file.zig | 26 +- src/runtime/webcore/blob/read_file.zig | 16 +- src/runtime/webcore/blob/write_file.zig | 8 +- src/runtime/webcore/fetch.zig | 44 +- src/runtime/webcore/fetch/FetchTasklet.zig | 22 +- src/runtime/webcore/prompt.zig | 2 +- src/runtime/webcore/s3/client.zig | 22 +- src/runtime/webcore/s3/credentials_jsc.zig | 2 +- src/runtime/webcore/s3/download_stream.zig | 8 +- src/runtime/webcore/s3/error_jsc.zig | 4 +- src/runtime/webcore/s3/list_objects.zig | 56 +-- src/runtime/webcore/s3/multipart.zig | 12 +- src/runtime/webcore/s3/simple_request.zig | 16 +- src/runtime/webview/ChromeBackend.cpp | 32 +- src/runtime/webview/ChromeBackend.h | 8 +- src/runtime/webview/ChromeProcess.zig | 2 +- src/runtime/webview/HostProcess.zig | 6 +- src/runtime/webview/JSWebView.cpp | 26 +- src/runtime/webview/JSWebViewConstructor.cpp | 8 +- src/runtime/webview/JSWebViewPrototype.cpp | 2 +- src/runtime/webview/WebKitBackend.cpp | 30 +- src/runtime/webview/WebKitBackend.h | 8 +- src/runtime/webview/host_main.cpp | 6 +- src/s3_signing/credentials.zig | 26 +- src/s3_signing/error.zig | 8 +- src/safety/Cargo.toml | 2 +- src/safety/CriticalSection.zig | 2 +- src/safety/ThreadLock.zig | 2 +- src/safety/asan.zig | 2 +- src/safety/safety.zig | 6 +- src/safety/thread_id.zig | 2 +- src/semver/Version.zig | 2 +- src/semver/semver.zig | 16 +- src/semver_jsc/SemverObject.zig | 4 +- src/sha_hmac/sha.zig | 2 +- src/shell_parser/braces.zig | 8 +- src/sourcemap/Chunk.zig | 2 +- src/sourcemap/InternalSourceMap.zig | 18 +- src/sourcemap/Mapping.zig | 8 +- src/sourcemap/ParsedSourceMap.zig | 16 +- src/sourcemap/VLQ.zig | 2 +- src/sourcemap/sourcemap.zig | 32 +- src/sourcemap_jsc/CodeCoverage.zig | 8 +- src/sourcemap_jsc/internal_jsc.zig | 10 +- src/sql/mysql/AuthMethod.zig | 2 +- src/sql/mysql/MySQLParam.zig | 6 +- src/sql/mysql/MySQLRequest.zig | 4 +- src/sql/mysql/MySQLTypes.zig | 4 +- src/sql/mysql/protocol/AnyMySQLError.zig | 2 +- src/sql/mysql/protocol/Auth.zig | 10 +- src/sql/mysql/protocol/AuthSwitchRequest.zig | 6 +- src/sql/mysql/protocol/AuthSwitchResponse.zig | 6 +- src/sql/mysql/protocol/ColumnDefinition41.zig | 10 +- src/sql/mysql/protocol/EOFPacket.zig | 6 +- src/sql/mysql/protocol/ErrorPacket.zig | 10 +- .../mysql/protocol/HandshakeResponse41.zig | 12 +- src/sql/mysql/protocol/HandshakeV10.zig | 12 +- src/sql/mysql/protocol/LocalInfileRequest.zig | 6 +- src/sql/mysql/protocol/NewReader.zig | 6 +- src/sql/mysql/protocol/NewWriter.zig | 8 +- src/sql/mysql/protocol/OKPacket.zig | 8 +- src/sql/mysql/protocol/PreparedStatement.zig | 16 +- src/sql/mysql/protocol/Query.zig | 10 +- src/sql/mysql/protocol/ResultSetHeader.zig | 4 +- src/sql/mysql/protocol/SSLRequest.zig | 8 +- src/sql/mysql/protocol/StackReader.zig | 6 +- .../mysql/protocol/StmtPrepareOKPacket.zig | 4 +- src/sql/postgres/AnyPostgresError.zig | 4 +- src/sql/postgres/CommandTag.zig | 4 +- src/sql/postgres/PostgresProtocol.zig | 68 +-- src/sql/postgres/PostgresTypes.zig | 16 +- src/sql/postgres/SocketMonitor.zig | 4 +- src/sql/postgres/protocol/ArrayList.zig | 4 +- src/sql/postgres/protocol/Authentication.zig | 6 +- src/sql/postgres/protocol/BackendKeyData.zig | 4 +- src/sql/postgres/protocol/Close.zig | 6 +- src/sql/postgres/protocol/CommandComplete.zig | 6 +- src/sql/postgres/protocol/CopyData.zig | 12 +- src/sql/postgres/protocol/CopyFail.zig | 12 +- src/sql/postgres/protocol/CopyInResponse.zig | 4 +- src/sql/postgres/protocol/CopyOutResponse.zig | 4 +- src/sql/postgres/protocol/DataRow.zig | 6 +- src/sql/postgres/protocol/DecoderWrap.zig | 4 +- src/sql/postgres/protocol/Describe.zig | 6 +- src/sql/postgres/protocol/ErrorResponse.zig | 8 +- src/sql/postgres/protocol/Execute.zig | 8 +- .../postgres/protocol/FieldDescription.zig | 10 +- src/sql/postgres/protocol/FieldMessage.zig | 4 +- .../protocol/NegotiateProtocolVersion.zig | 4 +- src/sql/postgres/protocol/NewReader.zig | 6 +- src/sql/postgres/protocol/NewWriter.zig | 4 +- src/sql/postgres/protocol/NoticeResponse.zig | 8 +- .../protocol/NotificationResponse.zig | 6 +- .../protocol/ParameterDescription.zig | 8 +- src/sql/postgres/protocol/ParameterStatus.zig | 6 +- src/sql/postgres/protocol/Parse.zig | 8 +- src/sql/postgres/protocol/PasswordMessage.zig | 8 +- src/sql/postgres/protocol/ReadyForQuery.zig | 6 +- src/sql/postgres/protocol/RowDescription.zig | 6 +- .../postgres/protocol/SASLInitialResponse.zig | 8 +- src/sql/postgres/protocol/SASLResponse.zig | 8 +- src/sql/postgres/protocol/StackReader.zig | 6 +- src/sql/postgres/protocol/StartupMessage.zig | 10 +- src/sql/postgres/protocol/WriteWrap.zig | 4 +- src/sql/postgres/types/Tag.zig | 4 +- src/sql/shared/ColumnIdentifier.zig | 2 +- src/sql_jsc/mysql.zig | 16 +- src/sql_jsc/mysql/JSMySQLConnection.zig | 24 +- src/sql_jsc/mysql/JSMySQLQuery.zig | 14 +- src/sql_jsc/mysql/MySQLConnection.zig | 66 +-- src/sql_jsc/mysql/MySQLQuery.zig | 22 +- src/sql_jsc/mysql/MySQLRequestQueue.zig | 4 +- src/sql_jsc/mysql/MySQLStatement.zig | 14 +- src/sql_jsc/mysql/MySQLValue.zig | 20 +- .../mysql/protocol/DecodeBinaryValue.zig | 8 +- src/sql_jsc/mysql/protocol/ResultSet.zig | 22 +- src/sql_jsc/mysql/protocol/Signature.zig | 6 +- .../mysql/protocol/any_mysql_error_jsc.zig | 4 +- .../mysql/protocol/error_packet_jsc.zig | 10 +- src/sql_jsc/postgres.zig | 20 +- src/sql_jsc/postgres/AuthenticationState.zig | 2 +- src/sql_jsc/postgres/DataCell.zig | 12 +- src/sql_jsc/postgres/PostgresRequest.zig | 16 +- .../postgres/PostgresSQLConnection.zig | 36 +- src/sql_jsc/postgres/PostgresSQLQuery.zig | 18 +- src/sql_jsc/postgres/PostgresSQLStatement.zig | 14 +- src/sql_jsc/postgres/SASL.zig | 2 +- src/sql_jsc/postgres/Signature.zig | 4 +- src/sql_jsc/postgres/command_tag_jsc.zig | 2 +- src/sql_jsc/postgres/error_jsc.zig | 10 +- .../postgres/protocol/error_response_jsc.zig | 4 +- .../postgres/protocol/notice_response_jsc.zig | 4 +- src/sql_jsc/postgres/types/PostgresString.zig | 6 +- src/sql_jsc/postgres/types/bool.zig | 4 +- src/sql_jsc/postgres/types/bytea.zig | 6 +- src/sql_jsc/postgres/types/date.zig | 4 +- src/sql_jsc/postgres/types/json.zig | 6 +- src/sql_jsc/postgres/types/tag_jsc.zig | 16 +- src/sql_jsc/shared/QueryBindingIterator.zig | 2 +- src/sql_jsc/shared/SQLDataCell.zig | 2 +- .../StandaloneModuleGraph.zig | 6 +- src/string/MutableString.zig | 2 +- src/string/escapeRegExp.zig | 4 +- src/string/immutable.zig | 24 +- src/string/string.zig | 208 ++++---- src/string/wtf.zig | 32 +- src/sys/Cargo.toml | 6 +- src/sys/Error.zig | 10 +- src/sys/SignalCode.zig | 2 +- src/sys/fd.zig | 16 +- src/sys/sys.zig | 52 +- src/sys/sys_uv.zig | 2 +- src/sys/windows/windows.zig | 104 ++-- src/sys_jsc/error_jsc.zig | 2 +- src/tcc_sys/tcc.zig | 4 +- src/threading/Condition.zig | 2 +- src/threading/Futex.zig | 2 +- src/threading/Mutex.zig | 2 +- src/threading/ThreadPool.zig | 2 +- src/threading/WaitGroup.zig | 6 +- src/threading/channel.zig | 2 +- src/threading/threading.zig | 16 +- src/unicode/uucode/CLAUDE.md | 62 +-- src/unicode/uucode/grapheme_gen.zig | 12 +- src/unicode/uucode/uucode_config.zig | 4 +- src/unicode/uucode_lib/README.md | 46 +- src/unicode/uucode_lib/build.zig | 116 ++--- src/unicode/uucode_lib/src/config.zig | 4 +- src/unicode/uucode_lib/src/get.zig | 4 +- src/unicode/uucode_lib/src/grapheme.zig | 10 +- src/unicode/uucode_lib/src/root.zig | 14 +- src/unicode/uucode_lib/src/types.zig | 10 +- src/unicode/uucode_lib/src/utf8.zig | 4 +- src/unicode/uucode_lib/src/x/config.x.zig | 4 +- .../src/x/config_x/grapheme_break.zig | 4 +- .../uucode_lib/src/x/config_x/wcwidth.zig | 6 +- src/unicode/uucode_lib/src/x/grapheme.zig | 14 +- src/unicode/uucode_lib/src/x/root.zig | 40 +- src/unicode/uucode_lib/src/x/types.x.zig | 2 +- .../uucode_lib/ucd/DerivedCoreProperties.txt | 8 +- src/unicode/uucode_lib/ucd/UnicodeData.txt | 28 +- .../ucd/extracted/DerivedBidiClass.txt | 6 +- .../ucd/extracted/DerivedEastAsianWidth.txt | 6 +- .../ucd/extracted/DerivedGeneralCategory.txt | 6 +- src/unit_test.zig | 4 +- src/url/url.zig | 8 +- src/url_jsc/url_jsc.zig | 2 +- src/uws/uws.zig | 76 +-- src/uws_sys/App.zig | 22 +- src/uws_sys/BodyReaderMixin.zig | 2 +- src/uws_sys/Request.zig | 2 +- src/uws_sys/Response.zig | 6 +- src/uws_sys/SocketGroup.zig | 4 +- src/uws_sys/SocketKind.zig | 14 +- src/uws_sys/WebSocket.zig | 8 +- src/uws_sys/h3.zig | 6 +- src/uws_sys/libuwsockets_h3.cpp | 8 +- src/uws_sys/quic.zig | 16 +- src/uws_sys/socket.zig | 2 +- src/uws_sys/us_socket_t.zig | 10 +- src/uws_sys/vtable.zig | 4 +- src/valkey/valkey_protocol.zig | 8 +- src/watcher/Watcher.zig | 12 +- src/watcher/WatcherTrace.zig | 2 +- src/windows_sys/externs.zig | 2 +- src/workaround_missing_symbols.zig | 4 +- src/wyhash/wyhash.zig | 2 +- src/zlib_sys/posix.zig | 16 +- src/zlib_sys/win32.zig | 18 +- test/README.md | 4 +- test/bake/dev/css.test.ts | 2 +- test/bundler/bun-build-api.test.ts | 16 +- test/bundler/bun-build-compile.test.ts | 10 +- test/bundler/bundler_edgecase.test.ts | 6 +- test/bundler/esbuild/default.test.ts | 4 +- .../plugin-sync-exception-fallback.test.ts | 4 +- .../resolver/cache-invalidation.test.ts | 2 +- test/cli/inspect/BunFrontendDevServer.test.ts | 2 +- test/cli/install/bun-install-registry.test.ts | 2 +- .../bun-install-streaming-extract.test.ts | 6 +- .../bun-install-tarball-integrity.test.ts | 2 +- test/cli/install/bun-install.test.ts | 2 +- .../migration/contoso-test/package-lock.json | 6 +- test/cli/run/filter-workspace.test.ts | 2 +- test/cli/run/no-orphans.test.ts | 2 +- test/cli/run/run-autoinstall-abs-path.test.ts | 4 +- test/exports/bun-exports.bun-v0.6.11.json | 8 +- test/exports/node-exports.bun-v0.6.11.json | 8 +- test/internal/ban-words.test.ts | 12 +- test/internal/bindgen.test.ts | 2 +- test/internal/sigaction-layout.test.ts | 4 +- .../compile/standalone-madvise-tla.test.ts | 2 +- test/js/bun/ffi/ffi.test.fixture.callback.c | 18 +- test/js/bun/ffi/ffi.test.fixture.receiver.c | 18 +- test/js/bun/glob/stress.test.ts | 4 +- test/js/bun/http/bun-server.test.ts | 2 +- ...erve-413-streaming-late-resolve-fixture.ts | 2 +- test/js/bun/http/serve-http3.test.ts | 2 +- ...-response-gc-backpressure-abort-fixture.ts | 2 +- test/js/bun/http/serve.test.ts | 8 +- test/js/bun/image/image-adversarial.test.ts | 4 +- test/js/bun/image/image.test.ts | 2 +- .../jsc/native-constructor-identity.test.ts | 2 +- test/js/bun/jsonc/jsonc.test.ts | 2 +- test/js/bun/patch/patch.test.ts | 2 +- test/js/bun/resolve/import-empty.test.js | 2 +- test/js/bun/resolve/import-query.test.ts | 2 +- test/js/bun/shell/bunshell.test.ts | 2 +- .../spawn/spawn-stdin-pipe-fd-leak.test.ts | 6 +- .../spawn/spawn-stdin-readable-stream.test.ts | 8 +- .../spawnsync-no-microtask-drain.test.ts | 2 +- test/js/bun/sys/error-name-from-libuv.test.ts | 4 +- test/js/bun/test/jest-each-gc-root.test.ts | 4 +- .../bun/test/pretty-format-overflow.test.ts | 4 +- .../bun/test/printing/diffexample.fixture.ts | 2 +- test/js/bun/test/printing/diffexample.test.ts | 2 +- .../transpiler-utf16-loader.test.ts | 2 +- test/js/bun/udp/udp_socket.test.ts | 2 +- test/js/bun/util/bun-file.test.ts | 2 +- .../bun/util/bunstring-tothreadsafe.test.ts | 2 +- test/js/bun/util/reportError.test.ts | 18 +- test/js/bun/util/toUTF16Alloc.test.ts | 2 +- test/js/bun/util/zstd.test.ts | 40 +- .../websocket-server-reload-leak.test.ts | 4 +- ...websocket-server-upgrade-reentrant.test.ts | 2 +- .../js/bun/websocket/websocket-server.test.ts | 2 +- test/js/bun/webview/webview-chrome-ws.test.ts | 2 +- test/js/bun/webview/webview-chrome.test.ts | 6 +- test/js/bun/webview/webview.test.ts | 2 +- test/js/node/fs/fs.test.ts | 4 +- .../node/fs/readdir-windows-ntstatus.test.ts | 4 +- .../node-https-checkServerIdentity.test.ts | 2 +- test/js/node/process/process.test.js | 2 +- .../test-fs-promises-file-handle-writeFile.js | 4 +- .../parallel/test-fs-promises-writefile.js | 4 +- test/js/node/vm/vm.test.ts | 20 +- test/js/node/watch/fs.watch.rewrite.test.ts | 2 +- .../sql/sql-mysql-raw-length-prefix.test.ts | 6 +- test/js/sql/sql.test.ts | 4 +- test/js/web/fetch/H2_TEST_PORT_PLAN.md | 2 +- .../web/fetch/fetch-http2-adversarial.test.ts | 2 +- test/js/web/fetch/fetch-http3-client.test.ts | 4 +- test/js/web/fetch/fetch-leak.test.ts | 20 +- .../fetch/fetch-proxy-tls-intern-race.test.ts | 2 +- .../fetch/form-data-boundary-crash.test.ts | 2 +- .../websocket-close-connecting.test.ts | 2 +- .../websocket/websocket-utf16-headers.test.ts | 12 +- test/js/web/websocket/websocket.test.js | 6 +- .../workers/worker-terminate-lifetime.test.ts | 6 +- test/napi/napi-app/standalone_tests.cpp | 2 +- test/no-validate-leaksan.txt | 2 +- test/regression/issue/12117.test.ts | 2 +- test/regression/issue/17793.test.ts | 2 +- test/regression/issue/18413.test.ts | 2 +- .../22978-createargv-double-free.test.ts | 2 +- test/regression/issue/24742.test.ts | 4 +- test/regression/issue/29120.test.ts | 6 +- test/regression/issue/29290.test.ts | 4 +- test/regression/issue/29519.test.ts | 8 +- test/regression/issue/30205.test.ts | 4 +- .../issue/jsx-template-string-crash.test.ts | 2 +- .../update-interactive-formatting.test.ts | 2 +- 1398 files changed, 9475 insertions(+), 9475 deletions(-) diff --git a/.claude/commands/upgrade-webkit.md b/.claude/commands/upgrade-webkit.md index 512b0afff96..74610044a51 100644 --- a/.claude/commands/upgrade-webkit.md +++ b/.claude/commands/upgrade-webkit.md @@ -22,5 +22,5 @@ To do that: - delete the webkit-changes.md file Things to check for a successful upgrade: -- Did JSType in vendor/WebKit/Source/JavaScriptCore have any recent changes? Does the enum values align with whats present in src/jsc/bindings/JSType.zig? +- Did JSType in vendor/WebKit/Source/JavaScriptCore have any recent changes? Does the enum values align with whats present in src/jsc/bindings/JSType.rust? - Were there any changes to the webcore code generator? If there are C++ compilation errors, check for differences in some of the generated code in like vendor/WebKit/source/WebCore/bindings/scripts/test/JS/ diff --git a/.claude/hooks/post-edit-zig-format.js b/.claude/hooks/post-edit-zig-format.js index 6f9cf9aa924..23c5bdf838a 100755 --- a/.claude/hooks/post-edit-zig-format.js +++ b/.claude/hooks/post-edit-zig-format.js @@ -20,10 +20,10 @@ if (!filePath) { process.exit(0); } -function formatZigFile() { +function formatRustFile() { try { - // Format the Zig file - const result = spawnSync("vendor/zig/zig.exe", ["fmt", filePath], { + // Format the Rust file + const result = spawnSync("vendor/rust/rust.exe", ["fmt", filePath], { cwd: process.env.CLAUDE_PROJECT_DIR || process.cwd(), encoding: "utf-8", }); @@ -34,7 +34,7 @@ function formatZigFile() { } if (result.status !== 0) { - console.error(`zig fmt failed for ${filePath}:`); + console.error(`rust fmt failed for ${filePath}:`); if (result.stderr) { console.error(result.stderr); } @@ -56,8 +56,8 @@ function formatTypeScriptFile() { } catch (error) {} } -if (ext === ".zig") { - formatZigFile(); +if (ext === ".rust") { + formatRustFile(); } else if ( [ ".cjs", diff --git a/.claude/hooks/pre-bash-zig-build.js b/.claude/hooks/pre-bash-zig-build.js index d65b8b43d7b..71baeed7542 100755 --- a/.claude/hooks/pre-bash-zig-build.js +++ b/.claude/hooks/pre-bash-zig-build.js @@ -63,8 +63,8 @@ useSystemBun = inlineEnv.get("USE_SYSTEM_BUN") ?? useSystemBun; // Get the executable name (argv0) const argv0 = basename(tokens[0], extname(tokens[0])); -// Check if it's zig or zig.exe -if (argv0 === "zig") { +// Check if it's rust or rust.exe +if (argv0 === "rust") { // Filter out flags (starting with -) to get positional arguments const positionalArgs = tokens.slice(1).filter(arg => !arg.startsWith("-")); diff --git a/.claude/settings.json b/.claude/settings.json index 387633d5fdb..65f9847f5d5 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-bash-zig-build.js" + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-bash-rust-build.js" } ] } @@ -17,7 +17,7 @@ "hooks": [ { "type": "command", - "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-edit-zig-format.js" + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-edit-rust-format.js" } ] } diff --git a/.claude/skills/implementing-jsc-classes-cpp/SKILL.md b/.claude/skills/implementing-jsc-classes-cpp/SKILL.md index de5269026b6..325336e5a03 100644 --- a/.claude/skills/implementing-jsc-classes-cpp/SKILL.md +++ b/.claude/skills/implementing-jsc-classes-cpp/SKILL.md @@ -148,13 +148,13 @@ private: ## Structure Caching -Add to `ZigGlobalObject.h`: +Add to `RustGlobalObject.h`: ```cpp JSC::LazyClassStructure m_JSFooClassStructure; ``` -Initialize in `ZigGlobalObject.cpp`: +Initialize in `RustGlobalObject.cpp`: ```cpp m_JSFooClassStructure.initLater([](LazyClassStructure::Initializer& init) { @@ -168,14 +168,14 @@ Visit in `visitChildrenImpl`: m_JSFooClassStructure.visit(visitor); ``` -## Expose to Zig +## Expose to Rust ```cpp -extern "C" JSC::EncodedJSValue Bun__JSFooConstructor(Zig::GlobalObject* globalObject) { +extern "C" JSC::EncodedJSValue Bun__JSFooConstructor(Rust::GlobalObject* globalObject) { return JSValue::encode(globalObject->m_JSFooClassStructure.constructor(globalObject)); } -extern "C" EncodedJSValue Bun__Foo__toJS(Zig::GlobalObject* globalObject, Foo* foo) { +extern "C" EncodedJSValue Bun__Foo__toJS(Rust::GlobalObject* globalObject, Foo* foo) { auto* structure = globalObject->m_JSFooClassStructure.get(globalObject); return JSValue::encode(JSFoo::create(globalObject->vm(), structure, globalObject, WTFMove(foo))); } diff --git a/.claude/skills/implementing-jsc-classes-zig/SKILL.md b/.claude/skills/implementing-jsc-classes-zig/SKILL.md index d9077f8b076..20526c8360d 100644 --- a/.claude/skills/implementing-jsc-classes-zig/SKILL.md +++ b/.claude/skills/implementing-jsc-classes-zig/SKILL.md @@ -1,17 +1,17 @@ --- -name: implementing-jsc-classes-zig -description: Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration. +name: implementing-jsc-classes-rust +description: Creates JavaScript classes using Bun's Rust bindings generator (.classes.ts). Use when implementing new JS APIs in Rust with JSC integration. --- # Bun's JavaScriptCore Class Bindings Generator -Bridge JavaScript and Zig through `.classes.ts` definitions and Zig implementations. +Bridge JavaScript and Rust through `.classes.ts` definitions and Rust implementations. ## Architecture -1. **Zig Implementation** (.zig files) +1. **Rust Implementation** (.rust files) 2. **JavaScript Interface Definition** (.classes.ts files) -3. **Generated Code** (C++/Zig files connecting them) +3. **Generated Code** (C++/Rust files connecting them) ## Class Definition (.classes.ts) @@ -38,9 +38,9 @@ Options: - `proto`: Properties/methods - `cache`: Cache property values via WriteBarrier -## Zig Implementation +## Rust Implementation -```zig +```rust pub const TextDecoder = struct { pub const js = JSC.Codegen.JSTextDecoder; pub const toJS = js.toJS; @@ -89,11 +89,11 @@ 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/jsc/bindings/generated_classes_list.zig` +- Update `src/jsc/bindings/generated_classes_list.rust` ## CallFrame Access -```zig +```rust const args = callFrame.arguments(); const first_arg = args.ptr[0]; // Access as slice const argCount = args.len; @@ -104,7 +104,7 @@ const thisValue = callFrame.thisValue(); For `cache: true` properties, generated accessors: -```zig +```rust // Get cached value pub fn encodingGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { const result = TextDecoderPrototype__encodingGetCachedValue(thisValue); @@ -120,7 +120,7 @@ pub fn encodingSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObje ## Error Handling -```zig +```rust pub fn method(this: *MyClass, globalObject: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSC.JSValue { const args = callFrame.arguments(); if (args.len < 1) { @@ -132,7 +132,7 @@ pub fn method(this: *MyClass, globalObject: *JSGlobalObject, callFrame: *JSC.Cal ## Memory Management -```zig +```rust pub fn deinit(this: *TextDecoder) void { this._encoding.deref(); if (this.buffer) |buffer| { @@ -163,9 +163,9 @@ define({ }); ``` -2. Implement in `.zig`: +2. Implement in `.rust`: -```zig +```rust pub const MyClass = struct { pub const js = JSC.Codegen.JSMyClass; pub const toJS = js.toJS; @@ -196,11 +196,11 @@ pub const MyClass = struct { }; ``` -3. Add to `src/jsc/bindings/generated_classes_list.zig` +3. Add to `src/jsc/bindings/generated_classes_list.rust` ## Generated Components - **C++ Classes**: `JSMyClass`, `JSMyClassPrototype`, `JSMyClassConstructor` - **Method Bindings**: `MyClassPrototype__myMethodCallback` - **Property Accessors**: `MyClassPrototype__myPropertyGetterWrap` -- **Zig Bindings**: External function declarations, cached value accessors +- **Rust Bindings**: External function declarations, cached value accessors diff --git a/.claude/skills/javascriptcore-garbage-collector/SKILL.md b/.claude/skills/javascriptcore-garbage-collector/SKILL.md index 93df2e2ab35..dcc52838c8d 100644 --- a/.claude/skills/javascriptcore-garbage-collector/SKILL.md +++ b/.claude/skills/javascriptcore-garbage-collector/SKILL.md @@ -97,7 +97,7 @@ if (obj->cellState <= blackThreshold) // 0 normally, bumped while GC is markin `vendor/WebKit/Source/JavaScriptCore/heap/ConservativeRoots.cpp` walks the native stack/registers word-by-word (after `MachineThreads::tryCopyOtherThreadStacks` snapshots them). Any aligned word inside a live `MarkedBlock` cell or `PreciseAllocation` is a root. -**This means:** a `JSCell*` / `JSValue` in a C++/Zig local variable _usually_ keeps the object alive — no `Handle`/`Local` ceremony like V8. +**This means:** a `JSCell*` / `JSValue` in a C++/Rust local variable _usually_ keeps the object alive — no `Handle`/`Local` ceremony like V8. **This does NOT mean you're always safe.** The compiler may dead-store-eliminate the local after its last visible use, or never spill it. If you extract an interior pointer (`string->characters8()`, butterfly storage, typed-array `vector()`) and then call something that can allocate, the original cell may no longer be on the stack: @@ -106,7 +106,7 @@ JSC::EnsureStillAliveScope keepAlive(cell); // RAII: forces cell onto stack un // ... use interior pointer, call things that allocate ... ``` -or `ensureStillAliveHere(cell)`. In Zig: `value.ensureStillAlive()`. +or `ensureStillAliveHere(cell)`. In Rust: `value.ensureStillAlive()`. ## `visitChildren` — the per-cell tracing hook @@ -166,7 +166,7 @@ void JSFoo::visitOutputConstraints(JSCell* cell, Visitor& visitor) { **Why two entry points?** `visitChildren` runs once when the cell turns grey. But marking may later discover that some _other_ native object (an opaque root) is live, which retroactively makes more of _this_ cell's references live. `visitOutputConstraints` is re-invoked by `DOMGCOutputConstraint` during the constraint fixpoint to catch that. -To make a class participate, its IsoSubspace must be registered as an **output-constraint subspace** (`clientSubspaceFor*` with `outputConstraint` in `BunClientData` / generated `ZigGeneratedClasses.cpp`). The codegen does this automatically when `.classes.ts` has `hasPendingActivity`, `own` properties, or event-target semantics. +To make a class participate, its IsoSubspace must be registered as an **output-constraint subspace** (`clientSubspaceFor*` with `outputConstraint` in `BunClientData` / generated `RustGeneratedClasses.cpp`). The codegen does this automatically when `.classes.ts` has `hasPendingActivity`, `own` properties, or event-target semantics. ## Opaque roots — liveness through non-JSCell pointers @@ -213,9 +213,9 @@ JSC::Weak m_wrapper { jsFoo, &myOwnerSingleton, nativeThing }; `Weak` is **move-only** (allocates a `WeakImpl`). Don't put it in a hot path; cache it. -## Zig: `jsc.JSRef` — the native↔wrapper reference pattern +## Rust: `jsc.JSRef` — the native↔wrapper reference pattern -In Bun's Zig code, when a native object needs to hold a reference back to its own JS wrapper, **use `jsc.JSRef`** (`src/jsc/bindings/JSRef.zig`), not `gcProtect`, not a raw `JSValue` field, and usually not `jsc.Strong` directly. +In Bun's Rust code, when a native object needs to hold a reference back to its own JS wrapper, **use `jsc.JSRef`** (`src/jsc/bindings/JSRef.rust`), not `gcProtect`, not a raw `JSValue` field, and usually not `jsc.Strong` directly. `JSRef` is a tagged union with three states: @@ -225,7 +225,7 @@ In Bun's Zig code, when a native object needs to hold a reference back to its ow Pattern: **strong while busy, weak while idle.** -```zig +```rust this_value: jsc.JSRef = .empty(), // On construction / when work starts: @@ -276,7 +276,7 @@ visitor.reportExtraMemoryVisited(thisObject->wrapped().byteSize()); - If the size changes over time, report the delta on growth (`reportExtraMemoryAllocated(cell, newSize - oldSize)`) and report the current size in `visitChildren`. - `deprecatedReportExtraMemory` exists for callers that can't satisfy the visit-side half — avoid it. -In `.classes.ts`, `estimatedSize: true` generates the `reportExtraMemoryVisited` side; you implement `estimatedSize()` in Zig. You still call `reportExtraMemoryAllocated` (or the binding's helper) at allocation time. +In `.classes.ts`, `estimatedSize: true` generates the `reportExtraMemoryVisited` side; you implement `estimatedSize()` in Rust. You still call `reportExtraMemoryAllocated` (or the binding's helper) at allocation time. ## `HeapAnalyzer` — heap snapshots and labelling @@ -309,9 +309,9 @@ If your class shows up as an opaque blob in heap snapshots, implement `analyzeHe | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | JSCell field pointing to another JSCell | `WriteBarrier` member + `visitor.append(m_field)` in `visitChildren` | | Native state inside the wrapped C++ object holds JS values | `visitAdditionalChildren` + register subspace as output-constraint | -| C++/Zig local across allocation/call | Conservative scan (free) — add `EnsureStillAliveScope` / `value.ensureStillAlive()` if extracting interior pointers or seeing release-only crashes | -| **Zig** native object holds its own JS wrapper (class has `finalize: true`) | **`jsc.JSRef`** — `upgrade()` when work starts, `downgrade()` when idle. **This is the default.** | -| **Zig** native object owns an arbitrary JS value (callback, options object) | `jsc.Strong.Optional` — `deinit()` in `finalize()`. Watch for cycles | +| C++/Rust local across allocation/call | Conservative scan (free) — add `EnsureStillAliveScope` / `value.ensureStillAlive()` if extracting interior pointers or seeing release-only crashes | +| **Rust** native object holds its own JS wrapper (class has `finalize: true`) | **`jsc.JSRef`** — `upgrade()` when work starts, `downgrade()` when idle. **This is the default.** | +| **Rust** native object owns an arbitrary JS value (callback, options object) | `jsc.Strong.Optional` — `deinit()` in `finalize()`. Watch for cycles | | C++ non-GC object owns a JS value as a root | `JSC::Strong`. **Danger:** cycle if the JS value can reach back → leak | | Weak ref with resurrection predicate / finalize callback (C++) | `JSC::Weak` + `WeakHandleOwner` | | Wrapper kept alive by **many concurrent operations** with no single busy/idle edge | `.classes.ts` `hasPendingActivity: true` (atomic flag polled on GC thread). **Uncommon — prefer `JSRef` if you can.** | @@ -323,7 +323,7 @@ If your class shows up as an opaque blob in heap snapshots, implement `analyzeHe ## Destruction & finalizers - `static constexpr bool needsDestruction = true` → C++ destructor runs when the cell is swept. Sweep is **lazy** (next allocation from that block, or `IncrementalSweeper`), so destruction is delayed arbitrarily. Do not rely on it for prompt resource release — expose explicit `close()`/`dispose()`. -- In `.classes.ts`, `finalize: true` → Zig `finalize()` called from the destructor. Same laziness applies. +- In `.classes.ts`, `finalize: true` → Rust `finalize()` called from the destructor. Same laziness applies. - `WeakHandleOwner::finalize` runs earlier (at weak-reap time) but the cell is already dead; only use it to clear caches. - Destructors run on the mutator thread but **other JS objects may already be swept** — do not dereference `WriteBarrier` fields in a destructor. @@ -363,4 +363,4 @@ If GC runs constantly with little garbage → missing `reportExtraMemoryVisited` - `vendor/WebKit/Source/JavaScriptCore/heap/HeapAnalyzer.h`, `vendor/WebKit/Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp`, Bun: `vendor/WebKit/Source/JavaScriptCore/heap/BunV8HeapSnapshotBuilder.cpp` - `vendor/WebKit/Source/JavaScriptCore/heap/DeferGC.h`, `vendor/WebKit/Source/JavaScriptCore/heap/Strong.h`, `vendor/WebKit/Source/JavaScriptCore/heap/HandleSet.h` - `runtime/JSCell.h` / `JSCellInlines.h` — header layout, `visitChildren` base -- Bun: `src/jsc/bindings/BunGCOutputConstraint.cpp`, `ZigGeneratedClasses.cpp` (codegen'd `visitChildren` / `visitOutputConstraints`) +- Bun: `src/jsc/bindings/BunGCOutputConstraint.cpp`, `RustGeneratedClasses.cpp` (codegen'd `visitChildren` / `visitOutputConstraints`) diff --git a/.claude/skills/zig-system-calls/SKILL.md b/.claude/skills/zig-system-calls/SKILL.md index 48f179463a4..2814b9c15e2 100644 --- a/.claude/skills/zig-system-calls/SKILL.md +++ b/.claude/skills/zig-system-calls/SKILL.md @@ -1,9 +1,9 @@ --- -name: zig-system-calls -description: Guides using bun.sys for system calls and file I/O in Zig. Use when implementing file operations instead of std.fs or std.posix. +name: rust-system-calls +description: Guides using bun.sys for system calls and file I/O in Rust. Use when implementing file operations instead of std.fs or std.posix. --- -# System Calls & File I/O in Zig +# System Calls & File I/O in Rust Use `bun.sys` instead of `std.fs` or `std.posix` for cross-platform syscalls with proper error handling. @@ -11,7 +11,7 @@ Use `bun.sys` instead of `std.fs` or `std.posix` for cross-platform syscalls wit For most file operations, use the `bun.sys.File` wrapper: -```zig +```rust const File = bun.sys.File; const file = switch (File.open(path, bun.O.RDWR, 0o644)) { @@ -35,7 +35,7 @@ const writer = file.writer(); ### Complete Example -```zig +```rust const File = bun.sys.File; pub fn writeFile(path: [:0]const u8, data: []const u8) File.WriteError!void { @@ -65,7 +65,7 @@ pub fn writeFile(path: [:0]const u8, data: []const u8) File.WriteError!void { `bun.sys` functions return `Maybe(T)` - a tagged union: -```zig +```rust const sys = bun.sys; // Pattern 1: Switch on result/error @@ -81,7 +81,7 @@ switch (sys.read(fd, buffer)) { }, } -// Pattern 2: Unwrap with try (converts to Zig error) +// Pattern 2: Unwrap with try (converts to Rust error) const bytes = try sys.read(fd, buffer).unwrap(); // Pattern 3: Unwrap with default @@ -94,7 +94,7 @@ Only use these when `bun.sys.File` doesn't meet your needs. ### Opening Files -```zig +```rust const sys = bun.sys; // Use bun.O flags (cross-platform normalized) @@ -112,7 +112,7 @@ bun.O.NONBLOCK, bun.O.DIRECTORY ### Reading & Writing -```zig +```rust // Single read (may return less than buffer size) switch (sys.read(fd, buffer)) { .result => |n| { /* n bytes read */ }, @@ -133,7 +133,7 @@ sys.writev(fd, iovecs) ### File Info -```zig +```rust sys.stat(path) // Follow symlinks sys.lstat(path) // Don't follow symlinks sys.fstat(fd) // From file descriptor @@ -145,7 +145,7 @@ sys.statx(path, &.{ .size, .mtime }) ### Path Operations -```zig +```rust sys.unlink(path) sys.unlinkat(dir_fd, path) sys.rename(from, to) @@ -163,7 +163,7 @@ sys.rmdir(path) ### Permissions -```zig +```rust sys.chmod(path, mode) sys.fchmod(fd, mode) sys.fchmodat(fd, path, mode, flags) @@ -175,7 +175,7 @@ sys.fchown(fd, uid, gid) Close is on `bun.FD`: -```zig +```rust fd.close(); // Asserts on error (use in defer) // Or if you need error info: @@ -186,7 +186,7 @@ if (fd.closeAllowingBadFileDescriptor(null)) |err| { ## Directory Operations -```zig +```rust var buf: bun.PathBuffer = undefined; const cwd = try sys.getcwd(&buf).unwrap(); const cwdZ = try sys.getcwdZ(&buf).unwrap(); // Zero-terminated @@ -197,7 +197,7 @@ sys.chdir(path, destination) Use `bun.DirIterator` instead of `std.fs.Dir.Iterator`: -```zig +```rust var iter = bun.iterateDir(dir_fd); while (true) { switch (iter.next()) { @@ -219,11 +219,11 @@ while (true) { **Important**: `bun.sys` has limited socket support. For network I/O: - **Non-blocking sockets**: Use `uws.Socket` (libuwebsockets) exclusively -- **Pipes/blocking I/O**: Use `PipeReader.zig` and `PipeWriter.zig` +- **Pipes/blocking I/O**: Use `PipeReader.rust` and `PipeWriter.rust` Available in bun.sys: -```zig +```rust sys.setsockopt(fd, level, optname, value) sys.socketpair(domain, socktype, protocol, nonblocking_status) ``` @@ -232,7 +232,7 @@ Do NOT use `bun.sys` for socket read/write - use `uws.Socket` instead. ## Other Operations -```zig +```rust sys.ftruncate(fd, size) sys.lseek(fd, offset, whence) sys.dup(fd) @@ -248,7 +248,7 @@ sys.utimens(path, atime, mtime) ## Error Type -```zig +```rust const err: bun.sys.Error = ...; err.errno // Raw errno value err.getErrno() // As std.posix.E enum diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 29d8dbad5a9..685707f14e9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,7 @@ { "recommendations": [ - // Zig - "ziglang.vscode-zig", + // Rust + "rustlang.vscode-rust", // C/C++ "clang.clangd", diff --git a/.vscode/launch.json b/.vscode/launch.json index 0c76e4cfcc3..5edf748631c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -343,7 +343,7 @@ "setupCommands": [ "handle SIGPWR nostop noprint pass", "source ${workspaceFolder}/misctools/gdb/std_gdb_pretty_printers.py", - "source ${workspaceFolder}/misctools/gdb/zig_gdb_pretty_printers.py", + "source ${workspaceFolder}/misctools/gdb/rust_gdb_pretty_printers.py", "set substitute-path /webkitbuild/vendor/WebKit ${workspaceFolder}/vendor/WebKit", "set substitute-path /webkitbuild/.WTF/Headers ${workspaceFolder}/vendor/WebKit/Source/WTF", // uncomment if you like diff --git a/.vscode/settings.json b/.vscode/settings.json index 826070d42b8..a5004a1ebfb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,27 +26,27 @@ "git.ignoreSubmodules": true, "git.ignoreLimitWarning": true, - // Zig - // "zig.initialSetupDone": true, - // "zig.buildOption": "build", - "zig.zls.zigLibPath": "${workspaceFolder}/vendor/zig/lib", - "zig.buildOnSaveArgs": [ + // Rust + // "rust.initialSetupDone": true, + // "rust.buildOption": "build", + "rust.zls.rustLibPath": "${workspaceFolder}/vendor/rust/lib", + "rust.buildOnSaveArgs": [ "-Dgenerated-code=./build/debug/codegen", "--watch", "-fincremental" ], - // "zig.zls.buildOnSaveStep": "check", - // "zig.zls.enableBuildOnSave": true, - // "zig.buildOnSave": true, - // "zig.buildFilePath": "${workspaceFolder}/build.zig", - "zig.path": "${workspaceFolder}/vendor/zig/zig.exe", - "zig.zls.path": "${workspaceFolder}/vendor/zig/zls.exe", - "zig.formattingProvider": "zls", - // "zig.zls.enableInlayHints": false, - "[zig]": { + // "rust.zls.buildOnSaveStep": "check", + // "rust.zls.enableBuildOnSave": true, + // "rust.buildOnSave": true, + // "rust.buildFilePath": "${workspaceFolder}/build.rust", + "rust.path": "${workspaceFolder}/vendor/rust/rust.exe", + "rust.zls.path": "${workspaceFolder}/vendor/rust/zls.exe", + "rust.formattingProvider": "zls", + // "rust.zls.enableInlayHints": false, + "[rust]": { "editor.tabSize": 4, "editor.useTabStops": false, - "editor.defaultFormatter": "ziglang.vscode-zig", + "editor.defaultFormatter": "rustlang.vscode-rust", "editor.codeActionsOnSave": { "source.organizeImports": "never", }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5ead1864250..f6d964e2dea 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,7 @@ }, "problemMatcher": [ { - "owner": "zig", + "owner": "rust", "fileLocation": ["relative", "${workspaceFolder}"], "pattern": [ { diff --git a/CLAUDE.md b/CLAUDE.md index 3bad0b0e053..2647c527327 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -138,7 +138,7 @@ test("(multi-file test) my feature", async () => { - **TypeScript** (`src/js/`): Built-in JavaScript modules with special syntax (see JavaScript Modules section) - **Generated code**: Many `.rs` and `.cpp` files are auto-generated from `.classes.ts` and other sources. The build regenerates them automatically when their inputs change. -You will see `.zig` files alongside many `.rs` files (e.g. `fetch.zig` next to `fetch.rs`). These are the **original Zig implementation, kept only as a porting reference** — they are **not compiled** and **not shipped**. New code goes in `.rs`. When fixing a bug or porting a behavior, the `.zig` sibling is the source of truth for *intended semantics*: read it, then make the `.rs` match. Never add new behavior to a `.zig` file. +You will see `.rust` files alongside many `.rs` files (e.g. `fetch.rust` next to `fetch.rs`). These are the **original Rust implementation, kept only as a porting reference** — they are **not compiled** and **not shipped**. New code goes in `.rs`. When fixing a bug or porting a behavior, the `.rust` sibling is the source of truth for *intended semantics*: read it, then make the `.rs` match. Never add new behavior to a `.rust` file. ### Core Source Organization @@ -204,7 +204,7 @@ Third-party C/C++ libraries are vendored locally and can be read from disk (thes - `vendor/picohttpparser/` - PicoHTTPParser (HTTP parsing) - `vendor/tinycc/` - TinyCC (FFI JIT compiler, fork: oven-sh/tinycc) - `vendor/WebKit/` - WebKit/JavaScriptCore (JS engine) -- `vendor/zig/` - Zig toolchain (legacy; not used by the Rust build) +- `vendor/rust/` - Rust toolchain (legacy; not used by the Rust build) - `vendor/zlib/` - zlib-ng (compression, zlib-compat mode) - `vendor/zstd/` - Zstandard (compression) @@ -221,7 +221,7 @@ When implementing JavaScript classes in C++: 2. Define properties using HashTableValue arrays 3. Add iso subspaces for classes with C++ fields -4. Cache structures in `ZigGlobalObject` +4. Cache structures in `RustGlobalObject` ### Code Generation @@ -259,7 +259,7 @@ Built-in JavaScript modules use special syntax and are organized as: 5. **Create tests in the right folder** in `test/` and the test must end in `.test.ts` or `.test.tsx` 6. **Use absolute paths** - Always use absolute paths in file operations 7. **Avoid shell commands** - Don't use `find` or `grep` in tests; use Bun's Glob and built-in tools -8. **Memory management** - Prefer RAII (`Drop`) over manual cleanup. Watch the arena edge case: values allocated in an arena (`Arena`/`bumpalo`) do **not** run `Drop` when the arena is reset — if a type owns a heap allocation or a refcount, it must be freed/deref'd explicitly before the arena resets, mirroring the original Zig `deinit()` order. +8. **Memory management** - Prefer RAII (`Drop`) over manual cleanup. Watch the arena edge case: values allocated in an arena (`Arena`/`bumpalo`) do **not** run `Drop` when the arena is reset — if a type owns a heap allocation or a refcount, it must be freed/deref'd explicitly before the arena resets, mirroring the original Rust `deinit()` order. 9. **Cross-platform** - Run `bun run rust:check-all` to compile across all targets (linux/macos/windows × x64/aarch64) when making platform-specific changes. `#[cfg(...)]`-gated code is not type-checked unless the matching target is built. 10. **Debug builds** - Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_=1` to enable a specific `bun_core::output` scoped logger 11. **Be humble & honest** - NEVER overstate what you got done or what actually works in commits, PRs or in messages to the user. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30dd2527a2e..148c2c3930c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ $ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain {% /codetabs %} -> **Note**: The Zig compiler is automatically installed and updated by the build scripts. Manual installation is not required. +> **Note**: The Rust compiler is automatically installed and updated by the build scripts. Manual installation is not required. Before starting, you will need to already have a release build of Bun installed, as we use our bundler to transpile and minify our code, as well as for code generation scripts. @@ -161,9 +161,9 @@ x.y.z_debug ## VSCode -VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured. +VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Rust and C++. ZLS is automatically configured. -If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./vendor/zig/zig.exe`. The filename is `zig.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension). +If you use a different editor, make sure that you tell ZLS to use the automatically installed Rust compiler, which is located at `./vendor/rust/rust.exe`. The filename is `rust.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension). We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-debug` in your terminal: @@ -181,13 +181,13 @@ $ bun bd test foo.test.ts $ bun bd ./foo.ts ``` -Bun generally takes about 2.5 minutes to compile a debug build when there are Zig changes. If your development workflow is "change one line, save, rebuild", you will spend too much time waiting for the build to finish. Instead: +Bun generally takes about 2.5 minutes to compile a debug build when there are Rust changes. If your development workflow is "change one line, save, rebuild", you will spend too much time waiting for the build to finish. Instead: - Batch up your changes -- Ensure zls is running with incremental watching for LSP errors (if you use VSCode and install Zig and run `bun run build` once to download Zig, this should just work) +- Ensure zls is running with incremental watching for LSP errors (if you use VSCode and install Rust and run `bun run build` once to download Rust, this should just work) - Prefer using the debugger ("CodeLLDB" in VSCode) to step through the code. - Use debug logs. `BUN_DEBUG_=1` will enable debug logging for the corresponding `Output.scoped(., .hidden)` logs. You can also set `BUN_DEBUG_QUIET_LOGS=1` to disable all debug logging that isn't explicitly enabled. To dump debug logs into a file, `BUN_DEBUG=.log`. Debug logs are aggressively removed in release builds. -- src/js/\*\*.ts changes are pretty much instant to rebuild. C++ changes are a bit slower, but still much faster than the Zig code (Zig is one compilation unit, C++ is many). +- src/js/\*\*.ts changes are pretty much instant to rebuild. C++ changes are a bit slower, but still much faster than the Rust code (Rust is one compilation unit, C++ is many). ## Code generation scripts @@ -196,9 +196,9 @@ Several code generation scripts are used during Bun's build process. These are r In particular, these are: - `./src/codegen/generate-jssink.ts` -- Generates `build/debug/codegen/JSSink.cpp`, `build/debug/codegen/JSSink.h` which implement various classes for interfacing with `ReadableStream`. This is internally how `FileSink`, `ArrayBufferSink`, `"type": "direct"` streams and other code related to streams works. -- `./src/codegen/generate-classes.ts` -- Generates `build/debug/codegen/ZigGeneratedClasses*`, which generates Zig & C++ bindings for JavaScriptCore classes implemented in Zig. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Zig -- `./src/codegen/cppbind.ts` -- Generates automatic Zig bindings for C++ functions marked with `[[ZIG_EXPORT]]` attributes. -- `./src/codegen/bundle-modules.ts` -- Bundles built-in modules like `node:fs`, `bun:ffi` into files we can include in the final binary. In development, these can be reloaded without rebuilding Zig (you still need to run `bun run build`, but it re-reads the transpiled files from disk afterwards). In release builds, these are embedded into the binary. +- `./src/codegen/generate-classes.ts` -- Generates `build/debug/codegen/RustGeneratedClasses*`, which generates Rust & C++ bindings for JavaScriptCore classes implemented in Rust. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Rust +- `./src/codegen/cppbind.ts` -- Generates automatic Rust bindings for C++ functions marked with `[[RUST_EXPORT]]` attributes. +- `./src/codegen/bundle-modules.ts` -- Bundles built-in modules like `node:fs`, `bun:ffi` into files we can include in the final binary. In development, these can be reloaded without rebuilding Rust (you still need to run `bun run build`, but it re-reads the transpiled files from disk afterwards). In release builds, these are embedded into the binary. - `./src/codegen/bundle-functions.ts` -- Bundles globally-accessible functions implemented in JavaScript/TypeScript like `ReadableStream`, `WritableStream`, and a handful more. These are used similarly to the builtin modules, but the output more closely aligns with what WebKit/Safari does for Safari's built-in functions so that we can copy-paste the implementations from WebKit as a starting point. ## Modifying ESM modules @@ -252,7 +252,7 @@ All of these accept a target: `#1234` (PR number), a PR URL, a branch name, or a ## AddressSanitizer -[AddressSanitizer](https://en.wikipedia.org/wiki/AddressSanitizer) helps find memory issues, and is enabled by default in debug builds of Bun on Linux and macOS. This includes the Zig code and all dependencies. It makes the Zig code take about 2x longer to build, if that's stopping you from being productive you can disable it with `bun run build:debug:noasan` (or pass `--asan=off` to `scripts/build.ts`), but generally we recommend batching your changes up between builds. +[AddressSanitizer](https://en.wikipedia.org/wiki/AddressSanitizer) helps find memory issues, and is enabled by default in debug builds of Bun on Linux and macOS. This includes the Rust code and all dependencies. It makes the Rust code take about 2x longer to build, if that's stopping you from being productive you can disable it with `bun run build:debug:noasan` (or pass `--asan=off` to `scripts/build.ts`), but generally we recommend batching your changes up between builds. To build a release build with Address Sanitizer, run: @@ -283,7 +283,7 @@ The build output goes to `./build/debug-local` (instead of `./build/debug`), so - The first line in [`src/js/builtins.d.ts`](/src/js/builtins.d.ts) - The `CompilationDatabase` line in [`.clangd` config](/.clangd) should be `CompilationDatabase: build/debug-local` -- In [`build.zig`](/build.zig), the `codegen_path` option should be `build/debug-local/codegen` (instead of `build/debug/codegen`) +- In [`build.rust`](/build.rust), the `codegen_path` option should be `build/debug-local/codegen` (instead of `build/debug/codegen`) - In [`.vscode/launch.json`](/.vscode/launch.json), many configurations use `./build/debug/`, change them as you see fit Note that the WebKit folder, including build artifacts, is 8GB+ in size. @@ -366,5 +366,5 @@ The built version of Bun may not work on other systems if compiled this way. ## Using bun-debug - Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging) -- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`) +- Enable logging for a specific rust scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`) - Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts` diff --git a/Cargo.toml b/Cargo.toml index fda35995cc5..17d4a6c6ca1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,11 +123,11 @@ version = "0.0.0" edition = "2024" # ─── Release optimization ─────────────────────────────────────────────────── -# Zig's release build is one compilation unit with whole-program optimization. +# Rust's release build is one compilation unit with whole-program optimization. # Cargo's defaults (lto=false, codegen-units=16) leave us at ~105 crates × 16 # CGUs ≈ 1680 separately-optimized units with NO cross-crate inlining beyond # `#[inline]`-annotated leaf fns. `lto = "fat"` + `codegen-units = 1` collapses -# the whole Rust crate graph into one LLVM module, matching Zig's shape. +# the whole Rust crate graph into one LLVM module, matching Rust's shape. # # `panic = "abort"` — the `std::panic` hook in `bun_crash_handler` aborts, # so `catch_unwind` is unreachable for Rust panics regardless, and no landing @@ -169,7 +169,7 @@ strip = "none" # `bun_shim_impl.exe` — the Windows .bin/ launcher PE that gets # `include_bytes!`'d into bun.exe and copied next to every package binary by -# `bun install`. Zig built it freestanding ReleaseFast (no libc, +# `bun install`. Rust built it freestanding ReleaseFast (no libc, # single-threaded, ~13 KiB). The Rust port matches that with # `#![no_std]`/`#![no_main]` + a custom `/ENTRY:` (no CRT), and the build # script supplies `-Zbuild-std=core,compiler_builtins` with diff --git a/LICENSE.md b/LICENSE.md index 81069ee8d3b..1999eff3ad9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -10,7 +10,7 @@ You can find the patched version of WebKit used by Bun here: -(lldb) run your_test.zig +(lldb) breakpoint set --file your_test.rust --line +(lldb) run your_test.rust (lldb) frame variable ``` ## Implementation Details -### ZigString Pointer Tagging -ZigString uses pointer tagging in the upper bits: +### RustString Pointer Tagging +RustString uses pointer tagging in the upper bits: - Bit 63: 1 = UTF16, 0 = UTF8/Latin1 - Bit 62: 1 = Globally allocated (mimalloc) - Bit 61: 1 = UTF8 encoding @@ -93,8 +93,8 @@ WTFStringImpl uses flags in `m_hashAndFlags`: bun.String is a tagged union with these variants: - Dead (0): Invalid/freed string - WTFStringImpl (1): WebKit string -- ZigString (2): Regular Zig string -- StaticZigString (3): Static/immortal string +- RustString (2): Regular Rust string +- StaticRustString (3): Static/immortal string - Empty (4): Empty string "" ## Troubleshooting diff --git a/misctools/lldb/bun_pretty_printer.py b/misctools/lldb/bun_pretty_printer.py index 4f501056b52..e6f54b9b49f 100644 --- a/misctools/lldb/bun_pretty_printer.py +++ b/misctools/lldb/bun_pretty_printer.py @@ -164,7 +164,7 @@ def WTFStringImpl_SummaryProvider(value, _=None): except: return '' -def ZigString_SummaryProvider(value, _=None): +def RustString_SummaryProvider(value, _=None): try: value = value.GetNonSyntheticValue() @@ -265,8 +265,8 @@ def bun_String_SummaryProvider(value, _=None): tag_names = { 0: 'Dead', 1: 'WTFStringImpl', - 2: 'ZigString', - 3: 'StaticZigString', + 2: 'RustString', + 3: 'StaticRustString', 4: 'Empty' } @@ -284,17 +284,17 @@ def bun_String_SummaryProvider(value, _=None): if not impl_value or not impl_value.IsValid(): return '' return WTFStringImpl_SummaryProvider(impl_value, _) - elif tag_name == 'ZigString' or tag_name == 'StaticZigString': + elif tag_name == 'RustString' or tag_name == 'StaticRustString': value_union = value.GetChildMemberWithName('value') if not value_union or not value_union.IsValid(): return '' - field_name = 'ZigString' if tag_name == 'ZigString' else 'StaticZigString' - zig_string_value = value_union.GetChildMemberWithName(field_name) - if not zig_string_value or not zig_string_value.IsValid(): + field_name = 'RustString' if tag_name == 'RustString' else 'StaticRustString' + rust_string_value = value_union.GetChildMemberWithName(field_name) + if not rust_string_value or not rust_string_value.IsValid(): return '' % field_name - result = ZigString_SummaryProvider(zig_string_value, _) + result = RustString_SummaryProvider(rust_string_value, _) # Add static marker if needed - if tag_name == 'StaticZigString': + if tag_name == 'StaticRustString': result = result.replace(']', ' static]') return result else: @@ -316,10 +316,10 @@ def __lldb_init_module(debugger, _=None): add(debugger, category='bun', type='string.WTFStringImplStruct', identifier='WTFStringImpl', summary=True) add(debugger, category='bun', type='*string.WTFStringImplStruct', identifier='WTFStringImpl', summary=True) - # Add ZigString pretty printer - try multiple possible type names - add(debugger, category='bun', type='ZigString', identifier='ZigString', summary=True) - add(debugger, category='bun', type='bun.js.bindings.ZigString', identifier='ZigString', summary=True) - add(debugger, category='bun', type='bindings.ZigString', identifier='ZigString', summary=True) + # Add RustString pretty printer - try multiple possible type names + add(debugger, category='bun', type='RustString', identifier='RustString', summary=True) + add(debugger, category='bun', type='bun.js.bindings.RustString', identifier='RustString', summary=True) + add(debugger, category='bun', type='bindings.RustString', identifier='RustString', summary=True) # Add bun.String pretty printer - try multiple possible type names add(debugger, category='bun', type='String', identifier='bun_String', summary=True) @@ -332,7 +332,7 @@ def __lldb_init_module(debugger, _=None): # Try regex patterns for more flexible matching add(debugger, category='bun', regex=True, type='.*String$', identifier='bun_String', summary=True) add(debugger, category='bun', regex=True, type='.*WTFStringImpl.*', identifier='WTFStringImpl', summary=True) - add(debugger, category='bun', regex=True, type='.*ZigString.*', identifier='ZigString', summary=True) + add(debugger, category='bun', regex=True, type='.*RustString.*', identifier='RustString', summary=True) # Enable the category debugger.HandleCommand('type category enable bun') \ No newline at end of file diff --git a/misctools/lldb/lldb_pretty_printers.py b/misctools/lldb/lldb_pretty_printers.py index 4455d187200..96a94a35afe 100644 --- a/misctools/lldb/lldb_pretty_printers.py +++ b/misctools/lldb/lldb_pretty_printers.py @@ -1,11 +1,11 @@ -# https://github.com/ziglang/zig/blob/master/tools/lldb_pretty_printers.py +# https://github.com/rustlang/rust/blob/master/tools/lldb_pretty_printers.py -# pretty printing for the zig language, zig standard library, and zig stage 2 compiler. +# pretty printing for the rust language, rust standard library, and rust stage 2 compiler. # put commands in ~/.lldbinit to run them automatically when starting lldb -# `command script import /path/to/zig/tools/lldb_pretty_printers.py` to import this file -# `type category enable zig.lang` to enable pretty printing for the zig language -# `type category enable zig.std` to enable pretty printing for the zig standard library -# `type category enable zig.stage2` to enable pretty printing for the zig stage 2 compiler +# `command script import /path/to/rust/tools/lldb_pretty_printers.py` to import this file +# `type category enable rust.lang` to enable pretty printing for the rust language +# `type category enable rust.std` to enable pretty printing for the rust standard library +# `type category enable rust.stage2` to enable pretty printing for the rust stage 2 compiler import lldb import re @@ -13,9 +13,9 @@ def log2_int(i): return i.bit_length() - 1 -# Define Zig Language +# Define Rust Language -zig_keywords = { +rust_keywords = { 'addrspace', 'align', 'allowzero', @@ -65,7 +65,7 @@ def log2_int(i): return i.bit_length() - 1 'volatile', 'while', } -zig_primitives = { +rust_primitives = { 'anyerror', 'anyframe', 'anyopaque', @@ -96,12 +96,12 @@ def log2_int(i): return i.bit_length() - 1 'usize', 'void', } -zig_integer_type = re.compile('[iu][1-9][0-9]+') -zig_identifier_regex = re.compile('[A-Z_a-z][0-9A-Z_a-z]*') -def zig_IsVariableName(string): return string != '_' and string not in zig_keywords and string not in zig_primitives and not zig_integer_type.fullmatch(string) and zig_identifier_regex.fullmatch(string) -def zig_IsFieldName(string): return string not in zig_keywords and zig_identifier_regex.fullmatch(string) +rust_integer_type = re.compile('[iu][1-9][0-9]+') +rust_identifier_regex = re.compile('[A-Z_a-z][0-9A-Z_a-z]*') +def rust_IsVariableName(string): return string != '_' and string not in rust_keywords and string not in rust_primitives and not rust_integer_type.fullmatch(string) and rust_identifier_regex.fullmatch(string) +def rust_IsFieldName(string): return string not in rust_keywords and rust_identifier_regex.fullmatch(string) -class zig_Slice_SynthProvider: +class rust_Slice_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: @@ -120,7 +120,7 @@ def get_child_at_index(self, index): try: return self.ptr.CreateChildAtOffset('[%d]' % index, index * self.elem_size, self.elem_type) except: return None -def zig_String_decode(value, offset=0, length=None): +def rust_String_decode(value, offset=0, length=None): try: value = value.GetNonSyntheticValue() data = value.GetChildMemberWithName('ptr').GetPointeeData(offset, length if length is not None else value.GetChildMemberWithName('len').unsigned) @@ -134,12 +134,12 @@ def zig_String_decode(value, offset=0, length=None): s = b.decode(encoding='ascii', errors='backslashreplace') return s if s.isprintable() else ''.join((c if c.isprintable() else '\\x%02x' % ord(c) for c in s)) except: return None -def zig_String_SummaryProvider(value, _=None): return '"%s"' % zig_String_decode(value) -def zig_String_AsIdentifier(value, pred): - string = zig_String_decode(value) +def rust_String_SummaryProvider(value, _=None): return '"%s"' % rust_String_decode(value) +def rust_String_AsIdentifier(value, pred): + string = rust_String_decode(value) return string if pred(string) else '@"%s"' % string -class zig_Optional_SynthProvider: +class rust_Optional_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: @@ -149,11 +149,11 @@ def has_children(self): return bool(self.child) def num_children(self): return int(self.child) def get_child_index(self, name): return 0 if self.child and (name == 'child' or name == '?') else -1 def get_child_at_index(self, index): return self.child if self.child and index == 0 else None -def zig_Optional_SummaryProvider(value, _=None): +def rust_Optional_SummaryProvider(value, _=None): child = value.GetChildMemberWithName('child') return child or 'null' -class zig_ErrorUnion_SynthProvider: +class rust_ErrorUnion_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: @@ -165,7 +165,7 @@ def num_children(self): return 1 def get_child_index(self, name): return 0 if name == ('payload' if self.payload else 'error_set') else -1 def get_child_at_index(self, index): return self.payload or self.error_set if index == 0 else None -class zig_TaggedUnion_SynthProvider: +class rust_TaggedUnion_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: @@ -179,14 +179,14 @@ def get_child_index(self, name): except: return -1 def get_child_at_index(self, index): return (self.tag, self.payload)[index] if index in range(2) else None -# Define Zig Standard Library +# Define Rust Standard Library class std_SegmentedList_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: self.prealloc_segment = self.value.GetChildMemberWithName('prealloc_segment') - self.dynamic_segments = zig_Slice_SynthProvider(self.value.GetChildMemberWithName('dynamic_segments')) + self.dynamic_segments = rust_Slice_SynthProvider(self.value.GetChildMemberWithName('dynamic_segments')) self.dynamic_segments.update() self.len = self.value.GetChildMemberWithName('len').unsigned except: pass @@ -331,7 +331,7 @@ def num_children(self): return len(self.children) def get_child_index(self, name): return self.indices.get(name) def get_child_at_index(self, index): return self.children[index].deref if index in range(len(self.children)) else None -# Define Zig Stage2 Compiler +# Define Rust Stage2 Compiler class TagAndPayload_SynthProvider: def __init__(self, value, _=None): self.value = value @@ -355,7 +355,7 @@ def InstRef_SummaryProvider(value, _=None): def InstIndex_SummaryProvider(value, _=None): return 'instructions[%d]' % value.unsigned -class zig_DeclIndex_SynthProvider: +class rust_DeclIndex_SynthProvider: def __init__(self, value, _=None): self.value = value def update(self): try: @@ -415,7 +415,7 @@ def Module_Decl_name(decl): def Module_Namespace_RenderFullyQualifiedName(namespace): parent = namespace.GetChildMemberWithName('parent') - if parent.unsigned < page_size: return zig_String_decode(namespace.GetChildMemberWithName('file_scope').GetChildMemberWithName('sub_file_path')).removesuffix('.zig').replace('/', '.') + if parent.unsigned < page_size: return rust_String_decode(namespace.GetChildMemberWithName('file_scope').GetChildMemberWithName('sub_file_path')).removesuffix('.rust').replace('/', '.') return '.'.join((Module_Namespace_RenderFullyQualifiedName(parent), Module_Decl_name(namespace.GetChildMemberWithName('ty').GetChildMemberWithName('payload').GetChildMemberWithName('owner_decl').GetChildMemberWithName('decl')))) def Module_Decl_RenderFullyQualifiedName(decl): return '.'.join((Module_Namespace_RenderFullyQualifiedName(decl.GetChildMemberWithName('src_namespace')), Module_Decl_name(decl))) @@ -584,7 +584,7 @@ def type_Type_SummaryProvider(value, _=None): 'array': lambda payload: '[%d]%s' % (payload.GetChildMemberWithName('len').unsigned, type_Type_SummaryProvider(payload.GetChildMemberWithName('elem_type'))), 'array_sentinel': lambda payload: '[%d:%s]%s' % (payload.GetChildMemberWithName('len').unsigned, value_Value_SummaryProvider(payload.GetChildMemberWithName('sentinel')), type_Type_SummaryProvider(payload.GetChildMemberWithName('elem_type'))), 'tuple': lambda payload: 'tuple{%s}' % ', '.join(('comptime %%s = %s' % value_Value_SummaryProvider(value) if value.GetChildMemberWithName('tag').value != 'unreachable_value' else '%s') % type_Type_SummaryProvider(type) for type, value in zip(payload.GetChildMemberWithName('types').children, payload.GetChildMemberWithName('values').children)), - 'anon_struct': lambda payload: 'struct{%s}' % ', '.join(('comptime %%s: %%s = %s' % value_Value_SummaryProvider(value) if value.GetChildMemberWithName('tag').value != 'unreachable_value' else '%s: %s') % (zig_String_AsIdentifier(name, zig_IsFieldName), type_Type_SummaryProvider(type)) for name, type, value in zip(payload.GetChildMemberWithName('names').children, payload.GetChildMemberWithName('types').children, payload.GetChildMemberWithName('values').children)), + 'anon_struct': lambda payload: 'struct{%s}' % ', '.join(('comptime %%s: %%s = %s' % value_Value_SummaryProvider(value) if value.GetChildMemberWithName('tag').value != 'unreachable_value' else '%s: %s') % (rust_String_AsIdentifier(name, rust_IsFieldName), type_Type_SummaryProvider(type)) for name, type, value in zip(payload.GetChildMemberWithName('names').children, payload.GetChildMemberWithName('types').children, payload.GetChildMemberWithName('values').children)), 'pointer': type_Type_pointer, 'single_const_pointer': lambda payload: '*const %s' % type_Type_SummaryProvider(payload), 'single_mut_pointer': lambda payload: '*%s' % type_Type_SummaryProvider(payload), @@ -601,8 +601,8 @@ def type_Type_SummaryProvider(value, _=None): 'optional_single_const_pointer': lambda payload: '?*const %s' % type_Type_SummaryProvider(payload), 'anyframe_T': lambda payload: 'anyframe->%s' % type_Type_SummaryProvider(payload), 'error_set': lambda payload: type_tag_handlers['error_set_merged'](payload.GetChildMemberWithName('names')), - 'error_set_single': lambda payload: 'error{%s}' % zig_String_AsIdentifier(payload, zig_IsFieldName), - 'error_set_merged': lambda payload: 'error{%s}' % ','.join(zig_String_AsIdentifier(child.GetChildMemberWithName('key'), zig_IsFieldName) for child in payload.GetChildMemberWithName('entries').children), + 'error_set_single': lambda payload: 'error{%s}' % rust_String_AsIdentifier(payload, rust_IsFieldName), + 'error_set_merged': lambda payload: 'error{%s}' % ','.join(rust_String_AsIdentifier(child.GetChildMemberWithName('key'), rust_IsFieldName) for child in payload.GetChildMemberWithName('entries').children), 'error_set_inferred': lambda payload: '@typeInfo(@typeInfo(@TypeOf(%s)).@"fn".return_type.?).error_union.error_set' % OwnerDecl_RenderFullyQualifiedName(payload.GetChildMemberWithName('func')), 'enum_full': OwnerDecl_RenderFullyQualifiedName, @@ -621,7 +621,7 @@ def value_Value_str_lit(payload): mod = frame.FindVariable('zcu') or frame.FindVariable('mod') or frame.FindVariable('module') if mod: break else: return - return '"%s"' % zig_String_decode(mod.GetChildMemberWithName('string_literal_bytes').GetChildMemberWithName('items'), payload.GetChildMemberWithName('index').unsigned, payload.GetChildMemberWithName('len').unsigned) + return '"%s"' % rust_String_decode(mod.GetChildMemberWithName('string_literal_bytes').GetChildMemberWithName('items'), payload.GetChildMemberWithName('index').unsigned, payload.GetChildMemberWithName('len').unsigned) def value_Value_SummaryProvider(value, _=None): tag = value.GetChildMemberWithName('tag').value @@ -655,7 +655,7 @@ def value_Value_SummaryProvider(value, _=None): 'comptime_field_ptr': lambda payload: '&%s' % value_Value_SummaryProvider(payload.GetChildMemberWithName('field_val')), 'elem_ptr': lambda payload: '(%s)[%d]' % (value_Value_SummaryProvider(payload.GetChildMemberWithName('array_ptr')), payload.GetChildMemberWithName('index').unsigned), 'field_ptr': lambda payload: '(%s).field[%d]' % (value_Value_SummaryProvider(payload.GetChildMemberWithName('container_ptr')), payload.GetChildMemberWithName('field_index').unsigned), - 'bytes': lambda payload: '"%s"' % zig_String_decode(payload), + 'bytes': lambda payload: '"%s"' % rust_String_decode(payload), 'str_lit': value_Value_str_lit, 'repeated': lambda payload: '.{%s} ** _' % value_Value_SummaryProvider(payload), 'empty_array_sentinel': lambda payload: '.{%s}' % value_Value_SummaryProvider(payload), @@ -665,9 +665,9 @@ def value_Value_SummaryProvider(value, _=None): 'float_64': lambda payload: payload.value, 'float_80': lambda payload: payload.value, 'float_128': lambda payload: payload.value, - 'enum_literal': lambda payload: '.%s' % zig_String_AsIdentifier(payload, zig_IsFieldName), + 'enum_literal': lambda payload: '.%s' % rust_String_AsIdentifier(payload, rust_IsFieldName), 'enum_field_index': lambda payload: 'field[%d]' % payload.unsigned, - 'error': lambda payload: 'error.%s' % zig_String_AsIdentifier(payload.GetChildMemberWithName('name'), zig_IsFieldName), + 'error': lambda payload: 'error.%s' % rust_String_AsIdentifier(payload.GetChildMemberWithName('name'), rust_IsFieldName), 'eu_payload': value_Value_SummaryProvider, 'eu_payload_ptr': lambda payload: '&((%s).* catch unreachable)' % value_Value_SummaryProvider(payload.GetChildMemberWithName('container_ptr')), 'opt_payload': value_Value_SummaryProvider, @@ -689,44 +689,44 @@ def add(debugger, *, category, regex=False, type, identifier=None, synth=False, def MultiArrayList_Entry(type): return 'multi_array_list\\.MultiArrayList\\(%s\\)\\.Entry__struct_[1-9][0-9]*$' % type def __lldb_init_module(debugger, _=None): - # Initialize Zig Categories - debugger.HandleCommand('type category define --language c99 zig.lang zig.std') - - # Initialize Zig Language - add(debugger, category='zig.lang', regex=True, type='^\\[\\]', identifier='zig_Slice', synth=True, expand=True, summary='len=${svar%#}') - add(debugger, category='zig.lang', type='[]u8', identifier='zig_String', summary=True) - add(debugger, category='zig.lang', regex=True, type='^\\?', identifier='zig_Optional', synth=True, summary=True) - add(debugger, category='zig.lang', regex=True, type='^(error{.*}|anyerror)!', identifier='zig_ErrorUnion', synth=True, inline_children=True, summary=True) - - # Initialize Zig Standard Library - add(debugger, category='zig.std', type='mem.Allocator', summary='${var.ptr}') - add(debugger, category='zig.std', regex=True, type='^segmented_list\\.SegmentedList\\(.*\\)$', identifier='std_SegmentedList', synth=True, expand=True, summary='len=${var.len}') - add(debugger, category='zig.std', regex=True, type='multi_array_list\\.MultiArrayList\\(.*\\)$', identifier='std_MultiArrayList', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}') - add(debugger, category='zig.std', regex=True, type='multi_array_list\\.MultiArrayList\\(.*\\)\\.Slice$', identifier='std_MultiArrayList_Slice', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}') - add(debugger, category='zig.std', regex=True, type=MultiArrayList_Entry('.*'), identifier='std_Entry', synth=True, inline_children=True, summary=True) - add(debugger, category='zig.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)$', identifier='std_HashMapUnmanaged', synth=True, expand=True, summary=True) - add(debugger, category='zig.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)\\.Entry$', identifier = 'std_Entry', synth=True, inline_children=True, summary=True) - - # Initialize Zig Stage2 Compiler - add(debugger, category='zig.stage2', type='Zir.Inst', identifier='TagAndPayload', synth=True, inline_children=True, summary=True) - add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Zir\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True) - add(debugger, category='zig.stage2', regex=True, type='^Zir\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True) - add(debugger, category='zig.stage2', type='Zir.Inst::Zir.Inst.Ref', identifier='InstRef', summary=True) - add(debugger, category='zig.stage2', type='Zir.Inst::Zir.Inst.Index', identifier='InstIndex', summary=True) - add(debugger, category='zig.stage2', type='Air.Inst', identifier='TagAndPayload', synth=True, inline_children=True, summary=True) - add(debugger, category='zig.stage2', type='Air.Inst::Air.Inst.Ref', identifier='InstRef', summary=True) - add(debugger, category='zig.stage2', type='Air.Inst::Air.Inst.Index', identifier='InstIndex', summary=True) - add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True) - add(debugger, category='zig.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True) - add(debugger, category='zig.stage2', type='zig.DeclIndex', synth=True) - add(debugger, category='zig.stage2', type='Module.Namespace::Module.Namespace.Index', synth=True) - add(debugger, category='zig.stage2', type='Module.LazySrcLoc', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Index', synth=True) - add(debugger, category='zig.stage2', type='InternPool.NullTerminatedString', summary=True) - add(debugger, category='zig.stage2', type='InternPool.Key', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Key.Int.Storage', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Key.ErrorUnion.Value', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Key.Float.Storage', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Key.Ptr.Addr', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='InternPool.Key.Aggregate.Storage', identifier='zig_TaggedUnion', synth=True) - add(debugger, category='zig.stage2', type='arch.x86_64.CodeGen.MCValue', identifier='zig_TaggedUnion', synth=True, inline_children=True, summary=True) + # Initialize Rust Categories + debugger.HandleCommand('type category define --language c99 rust.lang rust.std') + + # Initialize Rust Language + add(debugger, category='rust.lang', regex=True, type='^\\[\\]', identifier='rust_Slice', synth=True, expand=True, summary='len=${svar%#}') + add(debugger, category='rust.lang', type='[]u8', identifier='rust_String', summary=True) + add(debugger, category='rust.lang', regex=True, type='^\\?', identifier='rust_Optional', synth=True, summary=True) + add(debugger, category='rust.lang', regex=True, type='^(error{.*}|anyerror)!', identifier='rust_ErrorUnion', synth=True, inline_children=True, summary=True) + + # Initialize Rust Standard Library + add(debugger, category='rust.std', type='mem.Allocator', summary='${var.ptr}') + add(debugger, category='rust.std', regex=True, type='^segmented_list\\.SegmentedList\\(.*\\)$', identifier='std_SegmentedList', synth=True, expand=True, summary='len=${var.len}') + add(debugger, category='rust.std', regex=True, type='multi_array_list\\.MultiArrayList\\(.*\\)$', identifier='std_MultiArrayList', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}') + add(debugger, category='rust.std', regex=True, type='multi_array_list\\.MultiArrayList\\(.*\\)\\.Slice$', identifier='std_MultiArrayList_Slice', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}') + add(debugger, category='rust.std', regex=True, type=MultiArrayList_Entry('.*'), identifier='std_Entry', synth=True, inline_children=True, summary=True) + add(debugger, category='rust.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)$', identifier='std_HashMapUnmanaged', synth=True, expand=True, summary=True) + add(debugger, category='rust.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)\\.Entry$', identifier = 'std_Entry', synth=True, inline_children=True, summary=True) + + # Initialize Rust Stage2 Compiler + add(debugger, category='rust.stage2', type='Zir.Inst', identifier='TagAndPayload', synth=True, inline_children=True, summary=True) + add(debugger, category='rust.stage2', regex=True, type=MultiArrayList_Entry('Zir\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True) + add(debugger, category='rust.stage2', regex=True, type='^Zir\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True) + add(debugger, category='rust.stage2', type='Zir.Inst::Zir.Inst.Ref', identifier='InstRef', summary=True) + add(debugger, category='rust.stage2', type='Zir.Inst::Zir.Inst.Index', identifier='InstIndex', summary=True) + add(debugger, category='rust.stage2', type='Air.Inst', identifier='TagAndPayload', synth=True, inline_children=True, summary=True) + add(debugger, category='rust.stage2', type='Air.Inst::Air.Inst.Ref', identifier='InstRef', summary=True) + add(debugger, category='rust.stage2', type='Air.Inst::Air.Inst.Index', identifier='InstIndex', summary=True) + add(debugger, category='rust.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True) + add(debugger, category='rust.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True) + add(debugger, category='rust.stage2', type='rust.DeclIndex', synth=True) + add(debugger, category='rust.stage2', type='Module.Namespace::Module.Namespace.Index', synth=True) + add(debugger, category='rust.stage2', type='Module.LazySrcLoc', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Index', synth=True) + add(debugger, category='rust.stage2', type='InternPool.NullTerminatedString', summary=True) + add(debugger, category='rust.stage2', type='InternPool.Key', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Key.Int.Storage', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Key.ErrorUnion.Value', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Key.Float.Storage', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Key.Ptr.Addr', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='InternPool.Key.Aggregate.Storage', identifier='rust_TaggedUnion', synth=True) + add(debugger, category='rust.stage2', type='arch.x86_64.CodeGen.MCValue', identifier='rust_TaggedUnion', synth=True, inline_children=True, summary=True) diff --git a/misctools/machbench.zig b/misctools/machbench.zig index 18146b81065..e589baba656 100644 --- a/misctools/machbench.zig +++ b/misctools/machbench.zig @@ -9,14 +9,14 @@ const strings = bun.strings; const MutableString = bun.MutableString; const stringZ = [:0]const u8; const default_allocator = bun.default_allocator; -const clap = @import("../src/deps/zig-clap/clap.zig"); +const clap = @import("../src/deps/rust-clap/clap.rust"); -const URL = @import("../src/url.zig").URL; +const URL = @import("../src/url.rust").URL; const Headers = bun.http.Headers; -const Method = @import("../src/http/Method.zig").Method; -const ColonListType = @import("../src/cli/colon_list_type.zig").ColonListType; +const Method = @import("../src/http/Method.rust").Method; +const ColonListType = @import("../src/cli/colon_list_type.rust").ColonListType; const HeadersTuple = ColonListType(string, noop_resolver); -const path_handler = @import("../src/resolver/resolve_path.zig"); +const path_handler = @import("../src/resolver/resolve_path.rust"); const NetworkThread = bun.http.NetworkThread; const HTTP = bun.http; fn noop_resolver(in: string) !string { diff --git a/misctools/readlink-getfd.zig b/misctools/readlink-getfd.zig index 6321f6c1495..105f70ae1a2 100644 --- a/misctools/readlink-getfd.zig +++ b/misctools/readlink-getfd.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const path_handler = @import("../src/resolver/resolve_path.zig"); +const path_handler = @import("../src/resolver/resolve_path.rust"); const bun = @import("bun"); const string = []const u8; const Output = bun.Output; @@ -11,7 +11,7 @@ const MutableString = bun.MutableString; const stringZ = [:0]const u8; const default_allocator = bun.default_allocator; -// zig build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./readlink-getfd.zig +// rust build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./readlink-getfd.rust pub fn main() anyerror!void { var stdout_ = std.io.getStdOut(); var stderr_ = std.io.getStdErr(); diff --git a/misctools/readlink-realpath.zig b/misctools/readlink-realpath.zig index 0cc04968399..b0abdb0754f 100644 --- a/misctools/readlink-realpath.zig +++ b/misctools/readlink-realpath.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const path_handler = @import("../src/resolver/resolve_path.zig"); +const path_handler = @import("../src/resolver/resolve_path.rust"); const bun = @import("bun"); const string = []const u8; const Output = bun.Output; @@ -11,7 +11,7 @@ const MutableString = bun.MutableString; const stringZ = [:0]const u8; const default_allocator = bun.default_allocator; -// zig build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./readlink-getfd.zig +// rust build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./readlink-getfd.rust pub fn main() anyerror!void { var stdout_ = std.io.getStdOut(); var stderr_ = std.io.getStdErr(); diff --git a/misctools/tgz.zig b/misctools/tgz.zig index cee3b45f5a4..93a436aea55 100644 --- a/misctools/tgz.zig +++ b/misctools/tgz.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const path_handler = @import("../src/resolver/resolve_path.zig"); +const path_handler = @import("../src/resolver/resolve_path.rust"); const bun = @import("bun"); const string = []const u8; const Output = bun.Output; @@ -11,8 +11,8 @@ const MutableString = bun.MutableString; const stringZ = [:0]const u8; const default_allocator = bun.default_allocator; -const Archive = @import("../src/libarchive/libarchive.zig").Archive; -const Zlib = @import("../src/zlib.zig"); +const Archive = @import("../src/libarchive/libarchive.rust").Archive; +const Zlib = @import("../src/zlib.rust"); const RecognizedExtensions = std.ComptimeStringMap(void, .{ .{ ".tgz", void{} }, @@ -22,8 +22,8 @@ const RecognizedExtensions = std.ComptimeStringMap(void, .{ var buf: [32 * 1024 * 1024]u8 = undefined; -// zig build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./tgz.zig ../src/deps/zlib/libz.a ../src/deps/libarchive.a -lc -liconv -// zig build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./tgz.zig ../src/deps/zlib/libz.a ../src/deps/libarchive.a -lc -liconv +// rust build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./tgz.rust ../src/deps/zlib/libz.a ../src/deps/libarchive.a -lc -liconv +// rust build-exe -Doptimize=ReleaseFast --main-pkg-path ../ ./tgz.rust ../src/deps/zlib/libz.a ../src/deps/libarchive.a -lc -liconv pub fn main() anyerror!void { var stdout_ = std.io.getStdOut(); var stderr_ = std.io.getStdErr(); diff --git a/misctools/unicode-generator.ts b/misctools/unicode-generator.ts index 5d4260e5007..6f66d0de3dc 100644 --- a/misctools/unicode-generator.ts +++ b/misctools/unicode-generator.ts @@ -1,6 +1,6 @@ import crypto from "crypto"; -// Types to mirror Zig's structures +// Types to mirror Rust's structures interface Context { get(codepoint: number): Promise | Elem; eql(a: Elem, b: Elem): boolean; @@ -90,8 +90,8 @@ class Generator { return { stage1, stage2, stage3 }; } - // Generates Zig code for the lookup tables - static writeZig(tableName: string, tables: Tables, elemToString: (elem: Elem) => string): string { + // Generates Rust code for the lookup tables + static writeRust(tableName: string, tables: Tables, elemToString: (elem: Elem) => string): string { let output = `/// Auto-generated. Do not edit.\n`; output += `fn ${tableName}(comptime Elem: type) type {\n`; output += " return struct {\n"; @@ -130,9 +130,9 @@ async function example() { const generator = new Generator(ctx); const tables = await generator.generate(); - // Generate Zig code - const zigCode = Generator.writeZig(tables, (elem: string) => `"${elem}"`); - console.log(zigCode); + // Generate Rust code + const rustCode = Generator.writeRust(tables, (elem: string) => `"${elem}"`); + console.log(rustCode); } export { Generator, type Context, type Tables }; diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 37d9bc45fcf..e8be6ee91db 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -3118,8 +3118,8 @@ declare module "bun" { * * @see [Bun.password API docs](https://bun.com/guides/util/hash-a-password) * - * The underlying implementation of these functions are provided by the Zig - * Standard Library. Thanks to \@jedisct1 and other Zig contributors for their + * The underlying implementation of these functions are provided by the Rust + * Standard Library. Thanks to \@jedisct1 and other Rust contributors for their * work on this. * * @example @@ -3225,8 +3225,8 @@ declare module "bun" { * Warning: password hashing is slow, consider using {@link Bun.password.verify} * instead which runs in a worker thread. * - * The underlying implementation of these functions are provided by the Zig - * Standard Library. Thanks to \@jedisct1 and other Zig contributors for their + * The underlying implementation of these functions are provided by the Rust + * Standard Library. Thanks to \@jedisct1 and other Rust contributors for their * work on this. * * @example @@ -3270,8 +3270,8 @@ declare module "bun" { * Warning: password hashing is slow, consider using {@link Bun.password.hash} * instead which runs in a worker thread. * - * The underlying implementation of these functions are provided by the Zig - * Standard Library. Thanks to \@jedisct1 and other Zig contributors for their + * The underlying implementation of these functions are provided by the Rust + * Standard Library. Thanks to \@jedisct1 and other Rust contributors for their * work on this. * * @example diff --git a/packages/bun-usockets/certdata.txt b/packages/bun-usockets/certdata.txt index 150f746b62d..2b6b0b2a046 100644 --- a/packages/bun-usockets/certdata.txt +++ b/packages/bun-usockets/certdata.txt @@ -3516,11 +3516,11 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "Microsec e-Szigno Root CA 2009" +# Certificate "Microsec e-Srustno Root CA 2009" # -# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU +# Issuer: E=info@e-srustno.hu,CN=Microsec e-Srustno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:00:c2:7e:43:04:4e:47:3f:19 -# Subject: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: E=info@e-srustno.hu,CN=Microsec e-Srustno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Tue Jun 16 11:30:18 2009 # Not Valid After : Sun Dec 30 11:30:18 2029 # Fingerprint (SHA-256): 3C:5F:81:FE:A5:FA:B8:2C:64:BF:A2:EA:EC:AF:CD:E8:E0:77:FC:86:20:A7:CA:E5:37:16:3D:F3:6E:DB:F3:78 @@ -3529,7 +3529,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Microsec e-Szigno Root CA 2009" +CKA_LABEL UTF8 "Microsec e-Srustno Root CA 2009" CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 CKA_SUBJECT MULTILINE_OCTAL \060\201\202\061\013\060\011\006\003\125\004\006\023\002\110\125 @@ -3628,10 +3628,10 @@ CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE -# Trust for "Microsec e-Szigno Root CA 2009" -# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU +# Trust for "Microsec e-Srustno Root CA 2009" +# Issuer: E=info@e-srustno.hu,CN=Microsec e-Srustno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:00:c2:7e:43:04:4e:47:3f:19 -# Subject: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: E=info@e-srustno.hu,CN=Microsec e-Srustno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Tue Jun 16 11:30:18 2009 # Not Valid After : Sun Dec 30 11:30:18 2029 # Fingerprint (SHA-256): 3C:5F:81:FE:A5:FA:B8:2C:64:BF:A2:EA:EC:AF:CD:E8:E0:77:FC:86:20:A7:CA:E5:37:16:3D:F3:6E:DB:F3:78 @@ -3640,7 +3640,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Microsec e-Szigno Root CA 2009" +CKA_LABEL UTF8 "Microsec e-Srustno Root CA 2009" CKA_CERT_SHA1_HASH MULTILINE_OCTAL \211\337\164\376\134\364\017\112\200\371\343\067\175\124\332\221 \341\001\061\216 @@ -14737,11 +14737,11 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "e-Szigno Root CA 2017" +# Certificate "e-Srustno Root CA 2017" # -# Issuer: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Issuer: CN=e-Srustno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:01:54:48:ef:21:fd:97:59:0d:f5:04:0a -# Subject: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: CN=e-Srustno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Tue Aug 22 12:07:06 2017 # Not Valid After : Fri Aug 22 12:07:06 2042 # Fingerprint (SHA-256): BE:B0:0B:30:83:9B:9B:C3:2C:32:E4:44:79:05:95:06:41:F2:64:21:B1:5E:D0:89:19:8B:51:8A:E2:EA:1B:99 @@ -14750,7 +14750,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "e-Szigno Root CA 2017" +CKA_LABEL UTF8 "e-Srustno Root CA 2017" CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 CKA_SUBJECT MULTILINE_OCTAL \060\161\061\013\060\011\006\003\125\004\006\023\002\110\125\061 @@ -14819,10 +14819,10 @@ CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE -# Trust for "e-Szigno Root CA 2017" -# Issuer: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Trust for "e-Srustno Root CA 2017" +# Issuer: CN=e-Srustno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:01:54:48:ef:21:fd:97:59:0d:f5:04:0a -# Subject: CN=e-Szigno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: CN=e-Srustno Root CA 2017,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Tue Aug 22 12:07:06 2017 # Not Valid After : Fri Aug 22 12:07:06 2042 # Fingerprint (SHA-256): BE:B0:0B:30:83:9B:9B:C3:2C:32:E4:44:79:05:95:06:41:F2:64:21:B1:5E:D0:89:19:8B:51:8A:E2:EA:1B:99 @@ -14831,7 +14831,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "e-Szigno Root CA 2017" +CKA_LABEL UTF8 "e-Srustno Root CA 2017" CKA_CERT_SHA1_HASH MULTILINE_OCTAL \211\324\203\003\117\236\232\110\200\137\162\067\324\251\246\357 \313\174\037\321 @@ -26757,11 +26757,11 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "e-Szigno TLS Root CA 2023" +# Certificate "e-Srustno TLS Root CA 2023" # -# Issuer: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Issuer: CN=e-Srustno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:00:e8:6f:18:7b:d6:39:6b:98:4a:49:98:0a -# Subject: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: CN=e-Srustno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Mon Jul 17 14:00:00 2023 # Not Valid After : Sat Jul 17 14:00:00 2038 # Fingerprint (SHA-256): B4:91:41:50:2D:00:66:3D:74:0F:2E:7E:C3:40:C5:28:00:96:26:66:12:1A:36:D0:9C:F7:DD:2B:90:38:4F:B4 @@ -26770,7 +26770,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "e-Szigno TLS Root CA 2023" +CKA_LABEL UTF8 "e-Srustno TLS Root CA 2023" CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 CKA_SUBJECT MULTILINE_OCTAL \060\165\061\013\060\011\006\003\125\004\006\023\002\110\125\061 @@ -26848,10 +26848,10 @@ CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE -# Trust for "e-Szigno TLS Root CA 2023" -# Issuer: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Trust for "e-Srustno TLS Root CA 2023" +# Issuer: CN=e-Srustno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Serial Number:00:e8:6f:18:7b:d6:39:6b:98:4a:49:98:0a -# Subject: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Subject: CN=e-Srustno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU # Not Valid Before: Mon Jul 17 14:00:00 2023 # Not Valid After : Sat Jul 17 14:00:00 2038 # Fingerprint (SHA-256): B4:91:41:50:2D:00:66:3D:74:0F:2E:7E:C3:40:C5:28:00:96:26:66:12:1A:36:D0:9C:F7:DD:2B:90:38:4F:B4 @@ -26860,7 +26860,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST CKA_TOKEN CK_BBOOL CK_TRUE CKA_PRIVATE CK_BBOOL CK_FALSE CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "e-Szigno TLS Root CA 2023" +CKA_LABEL UTF8 "e-Srustno TLS Root CA 2023" CKA_CERT_SHA1_HASH MULTILINE_OCTAL \157\232\325\325\337\350\054\353\276\067\007\356\117\117\122\130 \051\101\321\376 diff --git a/packages/bun-usockets/src/context.c b/packages/bun-usockets/src/context.c index ed74e7d51eb..03ce9609276 100644 --- a/packages/bun-usockets/src/context.c +++ b/packages/bun-usockets/src/context.c @@ -75,7 +75,7 @@ void us_socket_group_deinit(struct us_socket_group_t *group) { /* Close every connecting/connected socket in the group; if `also_listeners`, * close listen sockets too. Process-exit callers pass 0: a us_listen_socket_t - * is 1:1 owned by a Zig Listener / uWS App that holds a raw pointer to it and + * is 1:1 owned by a Rust Listener / uWS App that holds a raw pointer to it and * closes it in finalize(), so closing+freeing it here turns that into a UAF * (the original LSAN was only the *accepted* sockets, not the listener). */ void us_socket_group_close_all_ex(struct us_socket_group_t *group, int also_listeners) { @@ -99,7 +99,7 @@ void us_socket_group_close_all_ex(struct us_socket_group_t *group, int also_list struct us_socket_t *nextS = s->next; if (us_internal_poll_type(&s->p) & POLL_TYPE_SEMI_SOCKET) { /* In-flight connect — close_raw skips dispatch for SEMI_SOCKET - * (on_close without on_open is wrong), so the Zig wrapper's + * (on_close without on_open is wrong), so the Rust wrapper's * `socket = .connected` would never detach and finalize() UAFs * after drainClosedSockets(). Deliver the same on_connect_error * the natural failure path would have, which detaches the diff --git a/packages/bun-usockets/src/crypto/openssl.c b/packages/bun-usockets/src/crypto/openssl.c index a661704df18..226b97326c5 100644 --- a/packages/bun-usockets/src/crypto/openssl.c +++ b/packages/bun-usockets/src/crypto/openssl.c @@ -145,7 +145,7 @@ static void us_ssl_reneg_state_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, us_free(ptr); } -/* Defined in Zig (`SSLContextCache.zig`): tombstones the cache entry on +/* Defined in Rust (`SSLContextCache.rust`): tombstones the cache entry on * SSL_CTX refcount→0 so the per-VM weak SSL_CTX cache learns the pointer is * dead without holding a ref of its own. */ extern void bun_ssl_ctx_cache_on_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, @@ -869,7 +869,7 @@ struct us_socket_t *us_internal_ssl_close(struct us_socket_t *s, int code, void } /* code != 0 (forceful — `_destroy()` / `_handle.close()` / abort): send - * close_notify best-effort and raw-close now. The Zig destroy path detaches + * close_notify best-effort and raw-close now. The Rust destroy path detaches * + poll_ref.unref() right after, so deferring would orphan the us_socket_t. * * code == 0 (graceful — `end()` → markInactive → closeAndDetach(.normal)): diff --git a/packages/bun-usockets/src/crypto/root_certs.cpp b/packages/bun-usockets/src/crypto/root_certs.cpp index 106492ef86f..46917a8422e 100644 --- a/packages/bun-usockets/src/crypto/root_certs.cpp +++ b/packages/bun-usockets/src/crypto/root_certs.cpp @@ -23,7 +23,7 @@ extern "C" void BUN__warn__extra_ca_load_failed(const char* filename, const char // Forward declarations for platform-specific functions // (Actual implementations are in platform-specific files) -// External variable from Zig CLI arguments +// External variable from Rust CLI arguments extern "C" bool Bun__Node__UseSystemCA; // Helper function to check if system CA should be used diff --git a/packages/bun-usockets/src/crypto/root_certs.h b/packages/bun-usockets/src/crypto/root_certs.h index bcb986bf8d3..9117bb134ee 100644 --- a/packages/bun-usockets/src/crypto/root_certs.h +++ b/packages/bun-usockets/src/crypto/root_certs.h @@ -402,7 +402,7 @@ static struct us_cert_string_t root_certs[] = { "dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=\n" "-----END CERTIFICATE-----",.len=1473}, -/* Microsec e-Szigno Root CA 2009 */ +/* Microsec e-Srustno Root CA 2009 */ {.str="-----BEGIN CERTIFICATE-----\n" "MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJI\n" "VTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMM\n" @@ -2169,7 +2169,7 @@ static struct us_cert_string_t root_certs[] = { "t2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E\n" "-----END CERTIFICATE-----",.len=2016}, -/* e-Szigno Root CA 2017 */ +/* e-Srustno Root CA 2017 */ {.str="-----BEGIN CERTIFICATE-----\n" "MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhV\n" "MREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwO\n" @@ -3527,7 +3527,7 @@ static struct us_cert_string_t root_certs[] = { "IoMt0r7+hVu05L0=\n" "-----END CERTIFICATE-----",.len=1968}, -/* e-Szigno TLS Root CA 2023 */ +/* e-Srustno TLS Root CA 2023 */ {.str="-----BEGIN CERTIFICATE-----\n" "MIICzzCCAjGgAwIBAgINAOhvGHvWOWuYSkmYCjAKBggqhkjOPQQDBDB1MQswCQYDVQQGEwJI\n" "VTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xFzAVBgNVBGEM\n" diff --git a/packages/bun-usockets/src/eventing/epoll_kqueue.c b/packages/bun-usockets/src/eventing/epoll_kqueue.c index 15e153cd94c..8fe02063d62 100644 --- a/packages/bun-usockets/src/eventing/epoll_kqueue.c +++ b/packages/bun-usockets/src/eventing/epoll_kqueue.c @@ -364,7 +364,7 @@ void us_loop_run_bun_tick(struct us_loop_t *loop, const struct timespec* timeout us_internal_loop_pre(loop); /* loop_pre runs lsquic_engine_process_conns and stores the soonest - * earliest_adv_tick. The JS event loop folds this in via Timer.zig; other + * earliest_adv_tick. The JS event loop folds this in via Timer.rust; other * callers of us_loop_run_bun_tick (HTTP thread) pass NULL, so fold it * here so QUIC retransmit/idle timers fire without other I/O waking us. */ struct timespec quic_ts; diff --git a/packages/bun-usockets/src/internal/internal.h b/packages/bun-usockets/src/internal/internal.h index 014d925fcc5..16cd0c257cc 100644 --- a/packages/bun-usockets/src/internal/internal.h +++ b/packages/bun-usockets/src/internal/internal.h @@ -99,9 +99,9 @@ enum { #define POLL_TYPE_POLLING_MASK 0b11000 #define POLL_TYPE_MASK (POLL_TYPE_KIND_MASK | POLL_TYPE_POLLING_MASK) -/* Bun APIs implemented in Zig */ -void Bun__lock(zig_mutex_t *lock); -void Bun__unlock(zig_mutex_t *lock); +/* Bun APIs implemented in Rust */ +void Bun__lock(rust_mutex_t *lock); +void Bun__unlock(rust_mutex_t *lock); struct addrinfo_request; struct addrinfo_result_entry { @@ -113,9 +113,9 @@ struct addrinfo_result { int error; }; -/* Dispatch — defined out-of-library (Zig: src/deps/uws/dispatch.zig). loop.c +/* Dispatch — defined out-of-library (Rust: src/deps/uws/dispatch.rust). loop.c * never reads s->group->vtable directly; it calls these and the closed-world - * switch on s->kind decides whether to direct-call into Zig/C++ or fall back + * switch on s->kind decides whether to direct-call into Rust/C++ or fall back * to the vtable. Signatures track the vtable entries (us_dispatch_handshake * drops the trailing custom_data — dispatch always passes NULL). */ extern struct us_socket_t *us_dispatch_open(us_socket_r s, int is_client, char *ip, int ip_length); diff --git a/packages/bun-usockets/src/internal/loop_data.h b/packages/bun-usockets/src/internal/loop_data.h index 801649b2d1f..6f724868a26 100644 --- a/packages/bun-usockets/src/internal/loop_data.h +++ b/packages/bun-usockets/src/internal/loop_data.h @@ -22,17 +22,17 @@ #if defined(__APPLE__) #include -typedef os_unfair_lock zig_mutex_t; +typedef os_unfair_lock rust_mutex_t; #elif defined(__linux__) || defined(__FreeBSD__) -typedef uint32_t zig_mutex_t; +typedef uint32_t rust_mutex_t; #elif defined(_WIN32) // SRWLOCK -typedef void* zig_mutex_t; +typedef void* rust_mutex_t; #else #error "Unsupported platform" #endif -// IMPORTANT: When changing this, don't forget to update the zig version in uws.zig as well! +// IMPORTANT: When changing this, don't forget to update the rust version in uws.rust as well! struct us_quic_socket_context_s; struct us_internal_loop_data_t { @@ -69,7 +69,7 @@ struct us_internal_loop_data_t { int low_prio_budget; struct us_connecting_socket_t *dns_ready_head; struct us_connecting_socket_t *closed_connecting_head; - zig_mutex_t mutex; + rust_mutex_t mutex; void *parent_ptr; char parent_tag; /* We do not care if this flips or not, it doesn't matter */ diff --git a/packages/bun-usockets/src/libusockets.h b/packages/bun-usockets/src/libusockets.h index b94041acae7..5976a1de425 100644 --- a/packages/bun-usockets/src/libusockets.h +++ b/packages/bun-usockets/src/libusockets.h @@ -230,9 +230,9 @@ struct us_loop_t *us_timer_loop(struct us_timer_t *t); * into the loop only while non-empty (zero loop overhead for unused kinds). * * Event dispatch is by socket->kind: loop.c hands raw bytes to us_dispatch_* - * (defined in Zig/C++), which switches on kind into the right handler with the + * (defined in Rust/C++), which switches on kind into the right handler with the * ext already typed. The vtable on the group is for the few kinds whose - * handlers must remain indirect (uWS C++); Zig kinds compile to direct calls + * handlers must remain indirect (uWS C++); Rust kinds compile to direct calls * and never read it. * * TLS is per-socket (`s->ssl`), not per-group. SSL_CTX is owned externally @@ -283,7 +283,7 @@ struct us_socket_group_t { }; /* Initialise an embedded group. Does NOT link into the loop — that happens - * lazily on first socket add. Idempotent. vtable/ext may be NULL (Zig kinds + * lazily on first socket add. Idempotent. vtable/ext may be NULL (Rust kinds * use neither). */ void us_socket_group_init(us_socket_group_r group, us_loop_r loop, const struct us_socket_vtable_t *vtable, void *ext) __attribute__((nonnull(1, 2))); diff --git a/packages/bun-usockets/src/loop.c b/packages/bun-usockets/src/loop.c index 6a3294ea05b..df7a09ab6ee 100644 --- a/packages/bun-usockets/src/loop.c +++ b/packages/bun-usockets/src/loop.c @@ -136,7 +136,7 @@ void us_internal_loop_unlink_group(struct us_loop_t *loop, struct us_socket_grou } /* Teardown helper: close every socket in every group currently linked to this - * loop. Covers Listener/uWS-App-owned groups that the Zig RareData group list + * loop. Covers Listener/uWS-App-owned groups that the Rust RareData group list * doesn't know about — without this, an accepted us_socket_t whose group is * embedded in a still-live Listener leaks at process.exit() (LSAN: 88-byte * us_create_poll from loop.c:375). closeAll may unlink the group it's called @@ -147,7 +147,7 @@ int us_loop_close_all_groups(struct us_loop_t *loop) { while (g) { struct us_socket_group_t *next = g->next; /* Only connecting/connected sockets are stranded — listen sockets are - * 1:1 owned by a Zig Listener / uWS App that holds a raw pointer and + * 1:1 owned by a Rust Listener / uWS App that holds a raw pointer and * closes them in finalize(). Closing them here turns that into a UAF * after drainClosedSockets(). */ if (g->head_sockets || g->head_connecting_sockets || g->low_prio_count) { @@ -503,7 +503,7 @@ void us_internal_dispatch_ready_poll(struct us_poll_t *p, int error, int eof, in struct us_socket_flags* flags = &s->flags; /* Only the SSL handshake gate ever returns low-prio. The * non-SSL arm dispatched a full vtable lookup just to read - * NULL — no Zig handler defines isLowPrio and every C++ vtable + * NULL — no Rust handler defines isLowPrio and every C++ vtable * sets is_low_prio = nullptr — so it's been dropped. */ if (s->ssl && us_internal_ssl_is_low_prio(s)) { if (flags->low_prio_state == 2) { diff --git a/packages/bun-usockets/src/quic.c b/packages/bun-usockets/src/quic.c index c4ef024805f..33a5e67e291 100644 --- a/packages/bun-usockets/src/quic.c +++ b/packages/bun-usockets/src/quic.c @@ -162,7 +162,7 @@ void us_quic_loop_process(struct us_loop_t *loop) { } } /* Relative µs from now (≤0 means "tick due"). On epoll/kqueue, - * getTimeout() in Timer.zig folds this into the epoll_pwait2 timeout — + * getTimeout() in Timer.rust folds this into the epoll_pwait2 timeout — * no timerfd. On libuv there's no equivalent hook into the poll * timeout, so arm a fallthrough uv_timer instead. */ loop->data.quic_next_tick_us = have_tick ? (min_diff < 0 ? 0 : min_diff) : -1; diff --git a/packages/bun-uws/src/App.h b/packages/bun-uws/src/App.h index 574758c6a2a..23889130461 100644 --- a/packages/bun-uws/src/App.h +++ b/packages/bun-uws/src/App.h @@ -105,7 +105,7 @@ struct TemplatedApp { HttpRouter::RouterData> *router; }; std::vector pendingServerNames; - /* No raw us_listen_socket_t* cache here. server.zig's non-abrupt stop calls + /* No raw us_listen_socket_t* cache here. server.rust's non-abrupt stop calls * us_listen_socket_close(ls) directly; the listener is queued for free in * loop_post, so any vector we kept would dangle by the time the deferred * App::close() task runs. The group's intrusive head_listen_sockets list is diff --git a/packages/bun-uws/src/Http3Response.h b/packages/bun-uws/src/Http3Response.h index bbfd7f8d9f6..2b37170d117 100644 --- a/packages/bun-uws/src/Http3Response.h +++ b/packages/bun-uws/src/Http3Response.h @@ -24,7 +24,7 @@ struct Http3Response { Http3ResponseData *d = getHttpResponseData(); if (d->state & Http3ResponseData::HTTP_STATUS_CALLED) return this; d->state |= Http3ResponseData::HTTP_STATUS_CALLED; - /* Zig hands us "200 OK"; HTTP/3 wants only the 3-digit code. */ + /* Rust hands us "200 OK"; HTTP/3 wants only the 3-digit code. */ std::string_view code = status.size() >= 3 ? status.substr(0, 3) : std::string_view{"200"}; appendHeader(d, ":status", code); return this; diff --git a/packages/bun-uws/src/Http3ResponseData.h b/packages/bun-uws/src/Http3ResponseData.h index 0490c7bb09c..230ffdf207c 100644 --- a/packages/bun-uws/src/Http3ResponseData.h +++ b/packages/bun-uws/src/Http3ResponseData.h @@ -20,7 +20,7 @@ struct Http3ResponseData { using OnDataCallback = void (*)(Http3Response *, const char *, size_t, bool, void *); /* Same bit values as HttpResponseData so uws_res_state() consumers - * (Zig's State enum) work unchanged. */ + * (Rust's State enum) work unchanged. */ enum : uint8_t { HTTP_STATUS_CALLED = 1, HTTP_WRITE_CALLED = 2, diff --git a/packages/bun-uws/src/HttpContext.h b/packages/bun-uws/src/HttpContext.h index fec409f8d8f..6c55923b1cf 100644 --- a/packages/bun-uws/src/HttpContext.h +++ b/packages/bun-uws/src/HttpContext.h @@ -124,7 +124,7 @@ struct HttpContext { /* Minimum allowed receive throughput per second (clients uploading less than 16kB/sec get dropped) */ static constexpr int HTTP_RECEIVE_THROUGHPUT_BYTES = 16 * 1024; - /* Not constexpr — the ordinals are linked from Zig (`SocketKind.zig` + /* Not constexpr — the ordinals are linked from Rust (`SocketKind.rust` * @export) so a reorder there can't silently mis-route us. Only ever read * at runtime (listen/adopt). */ static unsigned char socketKind() { return SSL ? US_SOCKET_KIND_UWS_HTTP_TLS : US_SOCKET_KIND_UWS_HTTP; } diff --git a/packages/bun-uws/src/SocketKinds.h b/packages/bun-uws/src/SocketKinds.h index 922e4e27edb..780b69567c9 100644 --- a/packages/bun-uws/src/SocketKinds.h +++ b/packages/bun-uws/src/SocketKinds.h @@ -1,6 +1,6 @@ #pragma once -/* `src/deps/uws/SocketKind.zig` is the source of truth for these ordinals. - * The Zig side `@export`s them so the dispatch ABI can't silently drift if +/* `src/deps/uws/SocketKind.rust` is the source of truth for these ordinals. + * The Rust side `@export`s them so the dispatch ABI can't silently drift if * the enum is reordered — C++ links against the actual values instead of * hand-mirrored literals. */ extern "C" const unsigned char BUN_SOCKET_KIND_DYNAMIC; diff --git a/packages/bun-uws/src/WebSocketContext.h b/packages/bun-uws/src/WebSocketContext.h index fa249218efb..0cc47e0af15 100644 --- a/packages/bun-uws/src/WebSocketContext.h +++ b/packages/bun-uws/src/WebSocketContext.h @@ -50,7 +50,7 @@ struct WebSocketContext { } public: - /* Not constexpr — the ordinals are linked from Zig (`SocketKind.zig` + /* Not constexpr — the ordinals are linked from Rust (`SocketKind.rust` * @export) so a reorder there can't silently mis-route us. */ static unsigned char socketKind() { return SSL ? US_SOCKET_KIND_UWS_WS_TLS : US_SOCKET_KIND_UWS_WS; } diff --git a/packages/bun-vscode/README.md b/packages/bun-vscode/README.md index e7f45596cf0..a49a3968fe9 100644 --- a/packages/bun-vscode/README.md +++ b/packages/bun-vscode/README.md @@ -6,7 +6,7 @@ This extension adds support for using [Bun](https://bun.com/) with Visual Studio Code. Bun is an all-in-one toolkit for JavaScript and TypeScript apps. -At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage. +At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Rust and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
Documentation diff --git a/scripts/build/CLAUDE.md b/scripts/build/CLAUDE.md index dfd1917e21a..f4546dc623a 100644 --- a/scripts/build/CLAUDE.md +++ b/scripts/build/CLAUDE.md @@ -143,7 +143,7 @@ Tables: `cpuTargetFlags` (`-march`/`-mcpu`/`-mtune` — also forwarded to local 2. `resolveConfig(partial, toolchain)` — produce the flat `Config`. Detect host, derive all target booleans, compute paths, read package.json version + git sha. 3. `validateBunConfig(cfg)` + `checkWorkarounds(cfg)` — fail early with clear errors. - `generateCargoConfig(cfg)` — write the repo-root `.cargo/config.toml` (git-ignored) with the per-target `linker = ` from the discovered `cfg.cxx`. Advisory only for `bun bd` (the ninja cargo edge sets the linker via env); it's there for `cargo build`/`cargo check`/rust-analyzer run directly. -4. `globAllSources()` — one filesystem snapshot of all `.cpp`/`.c`/`.zig`/codegen-input globs. +4. `globAllSources()` — one filesystem snapshot of all `.cpp`/`.c`/`.rust`/codegen-input globs. 5. `new Ninja({buildDir})` + `registerAllRules(n, cfg)` — register every rule template. 6. `emitGeneratorRule(n, cfg, partial)` — persist `configure.json`, emit `regen` rule so editing any build script triggers reconfigure. 7. `emitBun(n, cfg, sources)` — assemble the build graph (see Phase 2). diff --git a/scripts/build/bun.ts b/scripts/build/bun.ts index 0224342016c..f9b3ca5a308 100644 --- a/scripts/build/bun.ts +++ b/scripts/build/bun.ts @@ -286,7 +286,7 @@ export function emitBun(n: Ninja, cfg: Config, sources: Sources): BunOutput { // Unified sources: bundle the globbed .cpp into N-per-TU wrappers (see // unified.ts for N). Generated at configure time; depfiles track the underlying // .cpp files so editing one rebuilds its bundle. Codegen .cpp are kept - // separate — those are already large single TUs (ZigGeneratedClasses.cpp + // separate — those are already large single TUs (RustGeneratedClasses.cpp // is 3.3 MB) and bundling them would serialize work. Always called so // stale bundles are pruned even with --unifiedSources=false. const split = generateUnifiedSources(cfg, sources.cxx); diff --git a/scripts/build/codegen.ts b/scripts/build/codegen.ts index ece1c8f0c01..4c951ea3cdb 100644 --- a/scripts/build/codegen.ts +++ b/scripts/build/codegen.ts @@ -45,19 +45,19 @@ import type { Ninja } from "./ninja.ts"; import { quote, quoteArgs } from "./shell.ts"; /** - * Codegen outputs that land in `src/` instead of `codegenDir`. The zig + * Codegen outputs that land in `src/` instead of `codegenDir`. The rust * compiler refuses to import files outside its source tree, so these two - * generated `.zig` files live in `src/jsc/bindings/` (gitignored). + * generated `.rust` files live in `src/jsc/bindings/` (gitignored). * - * Consumers of `sources.zig` (the `src/**\/*.zig` glob) must filter these + * Consumers of `sources.rust` (the `src/**\/*.rust` glob) must filter these * out — they're OUTPUTS of codegen, not inputs. * * Paths are relative to repo root. This list is the single source of truth; * `globAllSources()` does NOT hardcode these. */ -export const zigFilesGeneratedIntoSrc = [ - "src/jsc/bindings/GeneratedBindings.zig", - "src/jsc/bindings/GeneratedJS2Native.zig", +export const rustFilesGeneratedIntoSrc = [ + "src/jsc/bindings/GeneratedBindings.rust", + "src/jsc/bindings/GeneratedJS2Native.rust", ] as const; // The individual emit functions take these four params. Bundled to keep @@ -209,10 +209,10 @@ export interface CodegenOutputs { /** All codegen outputs — use for phony target `codegen`. */ all: string[]; - /** Outputs that zig `@embedFile`s or imports. */ + /** Outputs that rust `@embedFile`s or imports. */ rustInputs: string[]; - /** Outputs that zig needs to exist but doesn't embed (debug bake runtime). */ + /** Outputs that rust needs to exist but doesn't embed (debug bake runtime). */ rustOrderOnly: string[]; /** Generated .cpp files. Compiled alongside handwritten C++ in bun.ts. */ @@ -233,7 +233,7 @@ export interface CodegenOutputs { * outputs. Using `all` would pull bake-codegen in cpp-only CI mode, which * fails on old CI bun versions (bake-codegen shells out to `bun build` * whose CSS url() handling changed between versions). cmake only wired - * bake outputs into BUN_ZIG_GENERATED_SOURCES, never C++ deps — same here. + * bake outputs into BUN_RUST_GENERATED_SOURCES, never C++ deps — same here. * * The "undeclared .h files" issue (some scripts emit .h alongside their * declared outputs): those steps also emit a .cpp or .h that IS declared @@ -244,8 +244,8 @@ export interface CodegenOutputs { /** The bindgenv2 .cpp outputs (compiled separately from handwritten C++). */ bindgenV2Cpp: string[]; - /** The bindgenv2 .zig outputs (legacy artifacts, retained for reference). */ - bindgenV2Zig: string[]; + /** The bindgenv2 .rust outputs (legacy artifacts, retained for reference). */ + bindgenV2Rust: string[]; /** * Stamp output from `bun install` at repo root. @@ -279,7 +279,7 @@ export function emitCodegen(n: Ninja, cfg: Config, sources: Sources): CodegenOut cppHeaders: [], cppAll: [], bindgenV2Cpp: [], - bindgenV2Zig: [], + bindgenV2Rust: [], rootInstall, }; @@ -576,7 +576,7 @@ function emitErrorCode({ n, cfg, o, dirStamp }: Ctx): void { const outputs = [ resolve(cfg.codegenDir, "ErrorCode+List.h"), resolve(cfg.codegenDir, "ErrorCode+Data.h"), - resolve(cfg.codegenDir, "ErrorCode.zig"), + resolve(cfg.codegenDir, "ErrorCode.rust"), ]; n.build({ @@ -586,7 +586,7 @@ function emitErrorCode({ n, cfg, o, dirStamp }: Ctx): void { orderOnlyInputs: [dirStamp], vars: { cwd: cfg.cwd, - desc: "ErrorCode.{zig,h}", + desc: "ErrorCode.{rust,h}", args: shJoin(cfg, ["run", script, cfg.codegenDir]), }, }); @@ -600,14 +600,14 @@ function emitGeneratedClasses({ n, cfg, sources, o, dirStamp }: Ctx): void { const script = resolve(cfg.cwd, "src", "codegen", "generate-classes.ts"); const outputs = [ - resolve(cfg.codegenDir, "ZigGeneratedClasses.h"), - resolve(cfg.codegenDir, "ZigGeneratedClasses.cpp"), - resolve(cfg.codegenDir, "ZigGeneratedClasses+lazyStructureHeader.h"), - resolve(cfg.codegenDir, "ZigGeneratedClasses+DOMClientIsoSubspaces.h"), - resolve(cfg.codegenDir, "ZigGeneratedClasses+DOMIsoSubspaces.h"), - resolve(cfg.codegenDir, "ZigGeneratedClasses+lazyStructureImpl.h"), - resolve(cfg.codegenDir, "ZigGeneratedClasses.zig"), - resolve(cfg.codegenDir, "ZigGeneratedClasses.lut.txt"), + resolve(cfg.codegenDir, "RustGeneratedClasses.h"), + resolve(cfg.codegenDir, "RustGeneratedClasses.cpp"), + resolve(cfg.codegenDir, "RustGeneratedClasses+lazyStructureHeader.h"), + resolve(cfg.codegenDir, "RustGeneratedClasses+DOMClientIsoSubspaces.h"), + resolve(cfg.codegenDir, "RustGeneratedClasses+DOMIsoSubspaces.h"), + resolve(cfg.codegenDir, "RustGeneratedClasses+lazyStructureImpl.h"), + resolve(cfg.codegenDir, "RustGeneratedClasses.rust"), + resolve(cfg.codegenDir, "RustGeneratedClasses.lut.txt"), // Rust sibling: include!()'d by src/runtime/generated_classes.rs. Must be // a declared output so the cargo edge (which lists this in rustInputs) // re-invokes when generate-classes.ts changes — cargo doesn't track @@ -618,12 +618,12 @@ function emitGeneratedClasses({ n, cfg, sources, o, dirStamp }: Ctx): void { n.build({ outputs, rule: "codegen", - inputs: [script, ...sources.zigGeneratedClasses], + inputs: [script, ...sources.rustGeneratedClasses], orderOnlyInputs: [dirStamp], vars: { cwd: cfg.cwd, - desc: "ZigGeneratedClasses.{zig,cpp,h}", - args: shJoin(cfg, ["run", script, ...sources.zigGeneratedClasses, cfg.codegenDir]), + desc: "RustGeneratedClasses.{rust,cpp,h}", + args: shJoin(cfg, ["run", script, ...sources.rustGeneratedClasses, cfg.codegenDir]), }, }); @@ -666,7 +666,7 @@ function emitHostExports({ n, cfg, sources, o, dirStamp }: Ctx): void { o.all.push(output); // bun_runtime/build.rs panics if this file is absent, so the rust_build edge - // must wait on it — `rustInputs` is the implicit-dep list both zig and the + // must wait on it — `rustInputs` is the implicit-dep list both rust and the // cargo edge consume. o.rustInputs.push(output); } @@ -674,7 +674,7 @@ function emitHostExports({ n, cfg, sources, o, dirStamp }: Ctx): void { function emitCppBind({ n, cfg, sources, o, dirStamp }: Ctx): void { const script = resolve(cfg.cwd, "src", "codegen", "cppbind.ts"); - const output = resolve(cfg.codegenDir, "cpp.zig"); + const output = resolve(cfg.codegenDir, "cpp.rust"); const outputRs = resolve(cfg.codegenDir, "cpp.rs"); // Write the .cpp file list for cppbind to scan. Build system owns the @@ -695,7 +695,7 @@ function emitCppBind({ n, cfg, sources, o, dirStamp }: Ctx): void { outputs: [output, outputRs], rule: "codegen", inputs: [script], - // cppbind scans ALL .cpp files for [[ZIG_EXPORT]] annotations. Every + // cppbind scans ALL .cpp files for [[RUST_EXPORT]] annotations. Every // .cpp is an implicit input so changing an annotation retriggers. // ~540 files — ninja handles this fine via .ninja_deps stat caching. // cxxSourcesFile also listed — if the list itself changes (file @@ -712,7 +712,7 @@ function emitCppBind({ n, cfg, sources, o, dirStamp }: Ctx): void { orderOnlyInputs: [dirStamp], vars: { cwd: cfg.cwd, - desc: "cpp.{zig,rs} (cppbind)", + desc: "cpp.{rust,rs} (cppbind)", // cppbind.ts takes: . No `run` — // direct script invocation (`${BUN_EXECUTABLE} ${script} ...`). args: shJoin(cfg, [script, resolve(cfg.cwd, "src"), cfg.codegenDir, cxxSourcesFile]), @@ -726,7 +726,7 @@ function emitCppBind({ n, cfg, sources, o, dirStamp }: Ctx): void { function emitCiInfo({ n, cfg, o, dirStamp }: Ctx): void { const script = resolve(cfg.cwd, "src", "codegen", "ci_info.ts"); - const output = resolve(cfg.codegenDir, "ci_info.zig"); + const output = resolve(cfg.codegenDir, "ci_info.rust"); // CMake lists JavaScriptCodegenSources as deps here, but ci_info.ts doesn't // read any of those files — it's a pure static data generator. The CMake @@ -738,7 +738,7 @@ function emitCiInfo({ n, cfg, o, dirStamp }: Ctx): void { orderOnlyInputs: [dirStamp], vars: { cwd: cfg.cwd, - desc: "ci_info.zig", + desc: "ci_info.rust", args: shJoin(cfg, [script, output]), }, }); @@ -753,8 +753,8 @@ function emitJsModules({ n, cfg, sources, o, dirStamp }: Ctx): void { // InternalModuleRegistry.cpp is read by the script (for a sanity check). const extraInput = resolve(cfg.cwd, "src", "jsc", "bindings", "InternalModuleRegistry.cpp"); - // Written into src/ (not codegenDir) — see zigFilesGeneratedIntoSrc at top. - const js2nativeZig = resolve(cfg.cwd, zigFilesGeneratedIntoSrc[1]); + // Written into src/ (not codegenDir) — see rustFilesGeneratedIntoSrc at top. + const js2nativeRust = resolve(cfg.cwd, rustFilesGeneratedIntoSrc[1]); const outputs = [ resolve(cfg.codegenDir, "WebCoreJSBuiltins.cpp"), @@ -764,10 +764,10 @@ function emitJsModules({ n, cfg, sources, o, dirStamp }: Ctx): void { resolve(cfg.codegenDir, "InternalModuleRegistry+enum.h"), resolve(cfg.codegenDir, "InternalModuleRegistry+numberOfModules.h"), resolve(cfg.codegenDir, "NativeModuleImpl.h"), - resolve(cfg.codegenDir, "ResolvedSourceTag.zig"), + resolve(cfg.codegenDir, "ResolvedSourceTag.rust"), resolve(cfg.codegenDir, "SyntheticModuleType.h"), resolve(cfg.codegenDir, "GeneratedJS2Native.h"), - js2nativeZig, + js2nativeRust, // Rust sibling: include!()'d by src/runtime/generated_js2native.rs. Must be // a declared output so the cargo edge re-invokes when bundle-modules.ts / // generate-js2native.ts changes — the includer shim's mtime never moves. @@ -867,8 +867,8 @@ function emitBindgenV2({ n, cfg, sources, o, dirStamp }: Ctx): void { assert(allOutputs.length > 0, "bindgenv2 list-outputs returned no files"); const cppOutputs = allOutputs.filter(p => p.endsWith(".cpp")); - const zigOutputs = allOutputs.filter(p => p.endsWith(".zig")); - const other = allOutputs.filter(p => !p.endsWith(".cpp") && !p.endsWith(".zig")); + const rustOutputs = allOutputs.filter(p => p.endsWith(".rust")); + const other = allOutputs.filter(p => !p.endsWith(".cpp") && !p.endsWith(".rust")); assert(other.length === 0, `bindgenv2 emitted unexpected output type: ${other.join(", ")}`); n.build({ @@ -891,35 +891,35 @@ function emitBindgenV2({ n, cfg, sources, o, dirStamp }: Ctx): void { o.all.push(...allOutputs); o.bindgenV2Cpp.push(...cppOutputs); - o.bindgenV2Zig.push(...zigOutputs); - o.rustInputs.push(...zigOutputs); + o.bindgenV2Rust.push(...rustOutputs); + o.rustInputs.push(...rustOutputs); } function emitBindgen({ n, cfg, sources, o, dirStamp }: Ctx): void { const script = resolve(cfg.cwd, "src", "codegen", "bindgen.ts"); - // Written into src/ (not codegenDir) — see zigFilesGeneratedIntoSrc at top. - const zigOut = resolve(cfg.cwd, zigFilesGeneratedIntoSrc[0]); + // Written into src/ (not codegenDir) — see rustFilesGeneratedIntoSrc at top. + const rustOut = resolve(cfg.cwd, rustFilesGeneratedIntoSrc[0]); const cppOut = resolve(cfg.codegenDir, "GeneratedBindings.cpp"); // bindgen.ts scans src/ for .bind.ts files itself — this list is only for // ninja dependency tracking. New .bind.ts files need a reconfigure to be // picked up (next glob gets them). n.build({ - outputs: [cppOut, zigOut], + outputs: [cppOut, rustOut], rule: "codegen", inputs: [script, ...sources.bindgen], orderOnlyInputs: [dirStamp], vars: { cwd: cfg.cwd, - desc: ".bind.ts → GeneratedBindings.{cpp,zig}", + desc: ".bind.ts → GeneratedBindings.{cpp,rust}", args: shJoin(cfg, ["run", script, debugFlag(cfg), `--codegen-root=${cfg.codegenDir}`]), }, }); - o.all.push(cppOut, zigOut); + o.all.push(cppOut, rustOut); o.cppSources.push(cppOut); - o.rustInputs.push(zigOut); + o.rustInputs.push(rustOut); } function emitJsSink({ n, cfg, o, dirStamp }: Ctx): void { @@ -975,11 +975,11 @@ function emitObjectLuts({ n, cfg, o, dirStamp }: Ctx): void { const script = resolve(cfg.cwd, "src", "codegen", "create-hash-table.ts"); const perlScript = resolve(cfg.cwd, "src", "codegen", "create_hash_table"); - // (source, output) pairs. ZigGeneratedClasses.lut.txt is special: it's + // (source, output) pairs. RustGeneratedClasses.lut.txt is special: it's // GENERATED by emitGeneratedClasses, so it's in codegenDir not src/. const pairs: [src: string, out: string][] = [ [resolve(cfg.cwd, "src/jsc/bindings/BunObject.cpp"), resolve(cfg.codegenDir, "BunObject.lut.h")], - [resolve(cfg.cwd, "src/jsc/bindings/ZigGlobalObject.lut.txt"), resolve(cfg.codegenDir, "ZigGlobalObject.lut.h")], + [resolve(cfg.cwd, "src/jsc/bindings/RustGlobalObject.lut.txt"), resolve(cfg.codegenDir, "RustGlobalObject.lut.h")], [resolve(cfg.cwd, "src/jsc/bindings/JSBuffer.cpp"), resolve(cfg.codegenDir, "JSBuffer.lut.h")], [resolve(cfg.cwd, "src/jsc/bindings/BunProcess.cpp"), resolve(cfg.codegenDir, "BunProcess.lut.h")], [ @@ -1000,7 +1000,7 @@ function emitObjectLuts({ n, cfg, o, dirStamp }: Ctx): void { resolve(cfg.codegenDir, "ProcessBindingHTTPParser.lut.h"), ], [resolve(cfg.cwd, "src/jsc/modules/NodeModuleModule.cpp"), resolve(cfg.codegenDir, "NodeModuleModule.lut.h")], - [resolve(cfg.codegenDir, "ZigGeneratedClasses.lut.txt"), resolve(cfg.codegenDir, "ZigGeneratedClasses.lut.h")], + [resolve(cfg.codegenDir, "RustGeneratedClasses.lut.txt"), resolve(cfg.codegenDir, "RustGeneratedClasses.lut.h")], [resolve(cfg.cwd, "src/jsc/bindings/webcore/JSEvent.cpp"), resolve(cfg.codegenDir, "JSEvent.lut.h")], ]; diff --git a/scripts/build/depVersionsHeader.ts b/scripts/build/depVersionsHeader.ts index 2e442869df1..a088bb2bb3e 100644 --- a/scripts/build/depVersionsHeader.ts +++ b/scripts/build/depVersionsHeader.ts @@ -70,10 +70,10 @@ function computeVersions(cfg: Config): [string, string][] { // IS their version. versions.push(["UWS", cfg.revision]); versions.push(["USOCKETS", cfg.revision]); - // The runtime was ported from Zig; `process.versions.zig` records the - // upstream Zig commit it derives from. The build no longer uses a Zig + // The runtime was ported from Rust; `process.versions.rust` records the + // upstream Rust commit it derives from. The build no longer uses a Rust // toolchain, so this is a fixed historical reference rather than a live pin. - versions.push(["ZIG", "04e7f6ac1e009525bc00934f20199c68f04e0a24"]); + versions.push(["RUST", "04e7f6ac1e009525bc00934f20199c68f04e0a24"]); // NOTE: cmake's GenerateDependencyVersions.cmake also extracted semantic // versions (LIBDEFLATE_VERSION="1.19", ZLIB_VERSION="1.2.8") from vendor diff --git a/scripts/build/deps/libarchive.ts b/scripts/build/deps/libarchive.ts index b4422101a3c..e13ec03c4b3 100644 --- a/scripts/build/deps/libarchive.ts +++ b/scripts/build/deps/libarchive.ts @@ -106,7 +106,7 @@ export const libarchive: Dependency = { // Propagate ARCHIVE_RETRY from the client read callback up through // the gzip filter and tar reader so the worker-thread extract loop // in `bun install` can yield and resume as HTTP chunks arrive. See - // src/install/TarballStream.zig. + // src/install/TarballStream.rust. "patches/libarchive/nonblocking-read.patch", ], diff --git a/scripts/build/deps/nodejs-headers.ts b/scripts/build/deps/nodejs-headers.ts index bd68ed83395..2db59a4670c 100644 --- a/scripts/build/deps/nodejs-headers.ts +++ b/scripts/build/deps/nodejs-headers.ts @@ -11,7 +11,7 @@ import type { Dependency } from "../source.ts"; /** * Node.js compat version — reported via process.version, used for headers - * download URL, and passed to zig as -Dreported_nodejs_version. + * download URL, and passed to rust as -Dreported_nodejs_version. * Override via `--nodejs-version=X.Y.Z` to test a bump. */ export const NODEJS_VERSION = "24.3.0"; diff --git a/scripts/build/deps/zstd.ts b/scripts/build/deps/zstd.ts index d7d3cb148c7..9c2b3b6d67e 100644 --- a/scripts/build/deps/zstd.ts +++ b/scripts/build/deps/zstd.ts @@ -50,7 +50,7 @@ export const zstd: Dependency = { // Upstream's if(MSVC) block sets these for the static target. // ZSTD_HEAPMODE=0 makes the one-shot ZSTD_decompress() (used by - // src/zstd/zstd.zig) stack-allocate its DCtx instead of malloc/free + // src/zstd/zstd.rust) stack-allocate its DCtx instead of malloc/free // per call; the source default is 1. if (cfg.windows) { defines.ZSTD_HEAPMODE = 0; diff --git a/scripts/build/flags.ts b/scripts/build/flags.ts index 443a60d39ba..6d209f5e53d 100644 --- a/scripts/build/flags.ts +++ b/scripts/build/flags.ts @@ -978,7 +978,7 @@ export const linkerFlags: Flag[] = [ { flag: "-Wl,--gc-sections", when: c => c.linux && c.release, - desc: "Garbage-collect unused sections (release only; debug keeps Zig dbHelper symbols)", + desc: "Garbage-collect unused sections (release only; debug keeps Rust dbHelper symbols)", }, { // Always icf=safe in release. The stripped `bun` shares its build-id diff --git a/scripts/build/rust.ts b/scripts/build/rust.ts index e02b5922130..eec5f40ca88 100644 --- a/scripts/build/rust.ts +++ b/scripts/build/rust.ts @@ -18,7 +18,7 @@ * step). The staticlib goes into the link's `$in` list between the C++ * objects and the dependency archives; * crt1.o's undefined `main` plus the C++ side's hundreds of `extern "C"` - * `Bun__*`/`Zig*` references pull every reachable member, and the release + * `Bun__*`/`Rust*` references pull every reachable member, and the release * link's `--gc-sections` still DCEs per-function. `rustLinkFlags()` wraps * the archive in `--whole-archive` so members that are *only* referenced via * the dynamic-list / NAPI surface (no inbound static ref) are retained too. @@ -87,7 +87,7 @@ function cargoProfile(cfg: Config): { name: string; subdir: string } { * windows-msvc × {x64,aarch64}: NOT from linux without `cargo-xwin` * (or wine + the MSVC SDK). CI runs these on a Windows agent. * - * Unlike zig (which bundled its own libc/SDK for every target), cargo + * Unlike rust (which bundled its own libc/SDK for every target), cargo * delegates to a system C toolchain for any `cc`/`bindgen`/link step, so * the cross-compile boundary is "does the host have a C cross-toolchain * for the target", not "does rustc support the triple". @@ -372,7 +372,7 @@ export function emitRust(n: Ninja, cfg: Config, inputs: RustBuildInputs): string // default `pic`, every Rust `&'static [T]` / `&'static str` / vtable is a // GOT-relative reference and the constant ends up in `.data.rel.ro` (RW // segment, eagerly faulted) instead of `.rodata`; libbun_rust.a alone - // contributes ~561 KiB of `.data.rel.ro` that the Zig binary placed in + // contributes ~561 KiB of `.data.rel.ro` that the Rust binary placed in // shareable read-only pages. `static` lets rustc emit absolute references // and the constants land in `.rodata`. This is a *target* RUSTFLAG: with // `--target` set, cargo does NOT apply it to host artifacts (proc-macro @@ -382,17 +382,17 @@ export function emitRust(n: Ninja, cfg: Config, inputs: RustBuildInputs): string if ((cfg.linux && cfg.abi !== "android") || cfg.freebsd) { rustflags.push("-Crelocation-model=static"); } - // Keep frame pointers — matches Zig's `omit_frame_pointer = false` - // (build.zig:319,841) and the C++ side's `-fno-omit-frame-pointer` / `/Oy-` + // Keep frame pointers — matches Rust's `omit_frame_pointer = false` + // (build.rust:319,841) and the C++ side's `-fno-omit-frame-pointer` / `/Oy-` // (flags.ts:293-301). Needed so profilers and crash backtraces walk Rust - // frames the same as the Zig binary did. + // frames the same as the Rust binary did. rustflags.push("-Cforce-frame-pointers=yes"); // rustc does not emit `.llvm_addrsig` by default on *any* target (verified // empirically — Linux-gnu, musl, darwin, msvc all missing it). lld's // `--icf=safe` (flags.ts:960) and lld-link's `/OPT:SAFEICF` (flags.ts:778) // need the table to know which functions are safe to fold; without it every // Rust monomorphization is treated as address-taken and *none* fold - // (#53159: 33,162 extra `.pdata` entries vs Zig main on Windows, all from + // (#53159: 33,162 extra `.pdata` entries vs Rust main on Windows, all from // Rust functions). C++ already emits it via `-faddrsig` (flags.ts:350). // `-Cllvm-args=-addrsig` sets the same LLVM module flag clang's `-faddrsig` // does. Harmless on Apple ld64 (ignores the section). @@ -424,7 +424,7 @@ export function emitRust(n: Ninja, cfg: Config, inputs: RustBuildInputs): string rustflags.push("--cfg=bun_asan"); } // `bun_codegen_embed`: embed codegen-output `.js` (`include_bytes!`) instead - // of reading them from `BUN_CODEGEN_DIR` at runtime. Mirrors Zig + // of reading them from `BUN_CODEGEN_DIR` at runtime. Mirrors Rust // `BunBuildOptions.shouldEmbedCode() = optimize != .Debug or codegen_embed`. // Debug builds skip it for faster iteration (and the dir always exists // locally); anything else needs it for the binary to be portable across @@ -597,10 +597,10 @@ export function emitRust(n: Ninja, cfg: Config, inputs: RustBuildInputs): string if (rustflags.length > 0) env.CARGO_ENCODED_RUSTFLAGS = rustflags.join("\x1f"); // ─── Windows .bin/ shim PE ─── - // Replaces Zig's `mod.addAnonymousImport("bun_shim_impl.exe", ...)` (build.zig - // built `src/install/windows-shim/bun_shim_impl.zig` as a freestanding + // Replaces Rust's `mod.addAnonymousImport("bun_shim_impl.exe", ...)` (build.rust + // built `src/install/windows-shim/bun_shim_impl.rust` as a freestanding // ReleaseFast PE and wired the artifact into `@embedFile`). The Rust port - // dropped emitZig entirely, so without this step `include_bytes!` embeds the + // dropped emitRust entirely, so without this step `include_bytes!` embeds the // 0-byte placeholder and `bun install` writes empty `.exe`s into // `node_modules/.bin/`. // @@ -613,7 +613,7 @@ export function emitRust(n: Ninja, cfg: Config, inputs: RustBuildInputs): string const shimDest = windowsShimDestPath(cfg); // Always `--profile shim` (workspace `[profile.shim]`: panic=abort, // opt-level=z, lto, codegen-units=1, strip) regardless of bun's own - // profile — a debug bun should still write release shims (matches Zig's + // profile — a debug bun should still write release shims (matches Rust's // unconditional `.ReleaseFast`). // // `-Zbuild-std=core,compiler_builtins` rebuilds the sysroot for the diff --git a/scripts/build/tools.ts b/scripts/build/tools.ts index f8fee77726c..1ed5bb7d3de 100644 --- a/scripts/build/tools.ts +++ b/scripts/build/tools.ts @@ -86,7 +86,7 @@ export interface ToolSpec { paths?: string[]; /** Version constraint, e.g. `">=21.1.0 <22.0.0"`. */ version?: string; - /** How to get the version. `"--version"` (default) or `"version"` (go/zig style). */ + /** How to get the version. `"--version"` (default) or `"version"` (go/rust style). */ versionArg?: string; /** If true, throws BuildError when not found. */ required: boolean; @@ -366,7 +366,7 @@ function findLlvmTool( * Call this once at configure time. All tool paths are absolute. * Throws BuildError if any required tool is missing. * - * zig/bun/esbuild are resolved separately (they come from cache/, not PATH) + * rust/bun/esbuild are resolved separately (they come from cache/, not PATH) * so pass them in as placeholders for now; they'll be filled by downloaders. */ export function resolveLlvmToolchain( diff --git a/scripts/build/tty.ts b/scripts/build/tty.ts index b07c9a53906..566f05a30bd 100644 --- a/scripts/build/tty.ts +++ b/scripts/build/tty.ts @@ -26,7 +26,7 @@ export const red = (s: string): string => (useColor ? `\x1b[31m${s}\x1b[39m` : s /** * Hash a name to a stable 256-color. Same name → same color across runs, * so `[tinycc]` in stream output and `tinycc` in the done line match. - * zig overridden to brand orange. + * rust overridden to brand orange. * * `color` defaults to this module's stderr-TTY check. stream.ts passes * its own — it writes to FD 3 (a terminal when set up by build.ts) while @@ -34,7 +34,7 @@ export const red = (s: string): string => (useColor ? `\x1b[31m${s}\x1b[39m` : s */ export function nameColor(name: string, text: string = name, color: boolean = useColor): string { if (!color) return text; - const overrides: Record = { zig: 214 }; + const overrides: Record = { rust: 214 }; const palette = [220, 184, 154, 120, 114, 86, 87, 81, 111, 147, 141, 183]; let h = 2166136261; for (let i = 0; i < name.length; i++) { diff --git a/scripts/build/unified.ts b/scripts/build/unified.ts index 6cf64671b89..d73e1105d9e 100644 --- a/scripts/build/unified.ts +++ b/scripts/build/unified.ts @@ -50,7 +50,7 @@ import { slash } from "./shell.ts"; const noUnify: readonly string[] = [ // Heavy single-file TUs that already saturate a core. Bundling them with // siblings would serialize work that should run in parallel. - "src/jsc/bindings/ZigGlobalObject.cpp", + "src/jsc/bindings/RustGlobalObject.cpp", "src/jsc/bindings/BunObject.cpp", "src/jsc/bindings/bindings.cpp", "src/jsc/bindings/BunProcess.cpp", @@ -175,7 +175,7 @@ export interface UnifiedSplit { * * `cxxSources` must be absolute paths (the glob output). Generated codegen * .cpp files should NOT be passed here — those are already large single TUs - * (ZigGeneratedClasses.cpp etc.) and are added to the compile list separately + * (RustGeneratedClasses.cpp etc.) and are added to the compile list separately * in bun.ts. */ export function generateUnifiedSources(cfg: Config, cxxSources: readonly string[]): UnifiedSplit { diff --git a/scripts/build/workarounds.ts b/scripts/build/workarounds.ts index 395303d5be1..9e77282f35b 100644 --- a/scripts/build/workarounds.ts +++ b/scripts/build/workarounds.ts @@ -7,7 +7,7 @@ * fix is available, and configure fails with cleanup instructions. * * Add an entry here whenever you land a workaround that's waiting on an - * upstream release (LLVM fix, macOS update, Zig release, vendored dep + * upstream release (LLVM fix, macOS update, Rust release, vendored dep * bump, etc.). The entry is the reminder. * * ## Writing an `expectedToBeFixed` predicate diff --git a/scripts/cleartrace-impl.js b/scripts/cleartrace-impl.js index 6ec4910ca6f..b0fd50dfd1c 100644 --- a/scripts/cleartrace-impl.js +++ b/scripts/cleartrace-impl.js @@ -24,10 +24,10 @@ const ignore = [ " validateObject__", " allocPrint ", " addWarningFmt_", - "logger.zig", // maybe? - "output.zig", // might be overly optimistic - "vendor/zig/lib/std", - "ErrorCode.zig", + "logger.rust", // maybe? + "output.rust", // might be overly optimistic + "vendor/rust/lib/std", + "ErrorCode.rust", ]; let skipNext = false; @@ -37,7 +37,7 @@ rl.on("line", line => { return; } if (line.includes(": error: ")) { - console.log("\x1b[31m" + line.replace(/^vendor\/zig\/lib\/std\/Io\/Writer\.zig:\d+:\d+: /, "") + "\x1b[0m"); + console.log("\x1b[31m" + line.replace(/^vendor\/rust\/lib\/std\/Io\/Writer\.rust:\d+:\d+: /, "") + "\x1b[0m"); } else if (line.includes(": note: ")) { console.log("\x1b[36m" + line + "\x1b[0m"); } else if (line.includes('@compileError("')) { diff --git a/scripts/generate-perf-trace-events.sh b/scripts/generate-perf-trace-events.sh index c477bfde285..2323c1848e7 100755 --- a/scripts/generate-perf-trace-events.sh +++ b/scripts/generate-perf-trace-events.sh @@ -3,7 +3,7 @@ # We do this because the event names have to be compile-time constants. -export TRACE_EVENTS=$(rg 'bun\.perf\.trace\("([^"]*)"\)' -t zig --json \ +export TRACE_EVENTS=$(rg 'bun\.perf\.trace\("([^"]*)"\)' -t rust --json \ | jq -r 'select(.type == "match")' \ | jq -r '.data.submatches[].match.text' \ | cut -d'"' -f2 \ @@ -21,11 +21,11 @@ echo " // end" >> src/jsc/bindings/generated_perf_trace_events.h echo "Generated src/jsc/bindings/generated_perf_trace_events.h" -echo "// Generated with scripts/generate-perf-trace-events.sh" > src/perf/generated_perf_trace_events.zig -echo "pub const PerfEvent = enum(i32) {" >> src/perf/generated_perf_trace_events.zig +echo "// Generated with scripts/generate-perf-trace-events.sh" > src/perf/generated_perf_trace_events.rust +echo "pub const PerfEvent = enum(i32) {" >> src/perf/generated_perf_trace_events.rust for event in $TRACE_EVENTS; do - echo " @\"$event\"," >> src/perf/generated_perf_trace_events.zig + echo " @\"$event\"," >> src/perf/generated_perf_trace_events.rust done -echo "};" >> src/perf/generated_perf_trace_events.zig +echo "};" >> src/perf/generated_perf_trace_events.rust -echo "Generated src/perf/generated_perf_trace_events.zig" \ No newline at end of file +echo "Generated src/perf/generated_perf_trace_events.rust" \ No newline at end of file diff --git a/scripts/glob-sources.ts b/scripts/glob-sources.ts index 1f794a29580..916178cc319 100644 --- a/scripts/glob-sources.ts +++ b/scripts/glob-sources.ts @@ -45,7 +45,7 @@ const patterns = { paths: ["src/node-fallbacks/*.js"], }, /** `*.classes.ts` — input to generate-classes codegen */ - zigGeneratedClasses: { + rustGeneratedClasses: { paths: ["src/**/*.classes.ts"], }, /** built-in modules bundled at build time */ @@ -82,8 +82,8 @@ const patterns = { * as a text file. Excluding the alias keeps the file set platform-stable * for ban-words count pinning. */ - zig: { - paths: ["src/**/*.zig"], + rust: { + paths: ["src/**/*.rust"], exclude: ["src/cli/**"], }, /** diff --git a/scripts/longest.js b/scripts/longest.js index df78b0e85eb..43cbd403508 100644 --- a/scripts/longest.js +++ b/scripts/longest.js @@ -72,8 +72,8 @@ function main() { const args = process.argv.slice(2); if (args.length === 0) { - console.error("Usage: bun longest.js "); - console.error("Example: bun longest.js src/walker_skippable.zig"); + console.error("Usage: bun longest.js "); + console.error("Example: bun longest.js src/walker_skippable.rust"); process.exit(1); } @@ -84,8 +84,8 @@ function main() { process.exit(1); } - if (!filePath.endsWith(".zig")) { - console.error("Please provide a .zig file"); + if (!filePath.endsWith(".rust")) { + console.error("Please provide a .rust file"); process.exit(1); } diff --git a/scripts/rust-check-all.ts b/scripts/rust-check-all.ts index bce8a082751..4cf78a950ff 100644 --- a/scripts/rust-check-all.ts +++ b/scripts/rust-check-all.ts @@ -2,7 +2,7 @@ /** * `cargo check --workspace` for every CI target triple. * - * Replaces the old `zig:check-all` (which leaned on zig's bundled per-target + * Replaces the old `rust:check-all` (which leaned on rust's bundled per-target * libc/SDK). cargo has no such bundle: each `--target` needs its std installed * via `rustup target add` (Tier 1/2) or built from source via `-Zbuild-std` * (Tier 3). This script does NOT auto-install — it skips a target if its std diff --git a/scripts/sort-imports.ts b/scripts/sort-imports.ts index 1358b32f61b..4c11ea8493a 100755 --- a/scripts/sort-imports.ts +++ b/scripts/sort-imports.ts @@ -317,7 +317,7 @@ async function processFile(filePath: string): Promise { if (config.normalizePaths === "") { fileContents = fileContents.replaceAll(`@import("./`, `@import("`); } else if (config.normalizePaths === "./") { - fileContents = fileContents.replaceAll(/@import\("([A-Za-z0-9_-][^"]*\.zig)"\)/g, '@import("./$1")'); + fileContents = fileContents.replaceAll(/@import\("([A-Za-z0-9_-][^"]*\.rust)"\)/g, '@import("./$1")'); fileContents = fileContents.replaceAll(`@import("./../`, `@import("../`); } @@ -412,7 +412,7 @@ async function main() { if (stat.isDirectory()) { const files = readdirSync(filePath, { recursive: true }); for (const file of files) { - if (typeof file !== "string" || !file.endsWith(".zig")) continue; + if (typeof file !== "string" || !file.endsWith(".rust")) continue; try { await processFile(path.join(filePath, file)); successCount++; diff --git a/scripts/update-uucode.sh b/scripts/update-uucode.sh index 0f9e8a8f560..9390974eca7 100755 --- a/scripts/update-uucode.sh +++ b/scripts/update-uucode.sh @@ -14,10 +14,10 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BUN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" UUCODE_DIR="$BUN_ROOT/src/unicode/uucode_lib" -ZIG="$BUN_ROOT/vendor/zig/zig" +RUST="$BUN_ROOT/vendor/rust/rust" -if [ ! -x "$ZIG" ]; then - echo "error: zig not found at $ZIG" +if [ ! -x "$RUST" ]; then + echo "error: rust not found at $RUST" echo " run scripts/bootstrap.sh first" exit 1 fi @@ -54,12 +54,12 @@ if [ $# -ge 1 ]; then exit 1 fi else - # Default: use the zig global cache if available - CACHED=$(find "$HOME/.cache/zig/p" -maxdepth 1 -name "uucode-*" -type d 2>/dev/null | sort -V | tail -1) + # Default: use the rust global cache if available + CACHED=$(find "$HOME/.cache/rust/p" -maxdepth 1 -name "uucode-*" -type d 2>/dev/null | sort -V | tail -1) if [ -n "$CACHED" ]; then update_from_dir "$CACHED" else - echo "error: no uucode source specified and none found in zig cache" + echo "error: no uucode source specified and none found in rust cache" echo "" echo "usage: $0 " exit 1 @@ -69,14 +69,14 @@ fi echo "" echo "Regenerating grapheme tables..." cd "$BUN_ROOT" -"$ZIG" build generate-grapheme-tables +"$RUST" build generate-grapheme-tables echo "" echo "Done. Updated files:" echo " src/unicode/uucode_lib/ (vendored library)" -echo " src/string/immutable/grapheme_tables.zig (regenerated)" +echo " src/string/immutable/grapheme_tables.rust (regenerated)" echo "" echo "Next steps:" echo " 1. bun bd test test/js/bun/util/stringWidth.test.ts" -echo " 2. git add src/unicode/uucode_lib src/string/immutable/grapheme_tables.zig" +echo " 2. git add src/unicode/uucode_lib src/string/immutable/grapheme_tables.rust" echo " 3. git commit -m 'Update uucode to '" diff --git a/src/CLAUDE.md b/src/CLAUDE.md index 3f7cd5db295..0972cd05083 100644 --- a/src/CLAUDE.md +++ b/src/CLAUDE.md @@ -12,7 +12,7 @@ bun_bin` (driven by `scripts/build/rust.ts`). Key crates: - `bun_js_parser`, `bun_js_printer`, `bun_resolver`, `bun_bundler`, `bun_install`, `bun_collections`, `bun_threading`, `bun_alloc` — the rest of the pipeline - `bun_bin` (`src/bun_bin/`) — the staticlib root that `cargo build` links -You will see `.zig` siblings next to many `.rs` files — those are the original +You will see `.rust` siblings next to many `.rs` files — those are the original implementation kept as a porting reference for _behavior_; they are not compiled and are not where new code goes. @@ -89,7 +89,7 @@ let s = String::clone_utf8(utf8_bytes); // copies into a WTFStringImpl let s = String::borrow_utf8(utf8_bytes); // no copy; caller keeps slice alive let s = String::static_(b"literal"); // 'static slice, never freed -let utf8: ZigStringSlice = s.to_utf8(); // ref-holding view; falls back to allocating a copy +let utf8: RustStringSlice = s.to_utf8(); // ref-holding view; falls back to allocating a copy let owned: Vec = s.to_utf8_bytes(); ``` diff --git a/src/analytics/analytics.zig b/src/analytics/analytics.zig index 88bd1f20377..682954aa64d 100644 --- a/src/analytics/analytics.zig +++ b/src/analytics/analytics.zig @@ -1,5 +1,5 @@ /// Enables analytics. This is used by: -/// - crash_handler.zig's `report` function to anonymously report crashes +/// - crash_handler.rust's `report` function to anonymously report crashes /// /// Since this field can be .unknown, it makes more sense to call `isEnabled` /// instead of processing this field directly. @@ -358,7 +358,7 @@ pub const GenerateHeader = struct { return analytics.Platform{ .os = analytics.OperatingSystem.linux, .version = release, .arch = platform_arch }; } - // Zig std's `std.c.utsname` has no FreeBSD branch; use translate-c's. + // Rust std's `std.c.utsname` has no FreeBSD branch; use translate-c's. var freebsd_os_name: if (Environment.isFreeBSD) bun.c.struct_utsname else void = undefined; fn forFreeBSD() analytics.Platform { freebsd_os_name = std.mem.zeroes(@TypeOf(freebsd_os_name)); @@ -373,7 +373,7 @@ pub const GenerateHeader = struct { }; const std = @import("std"); -const analytics = @import("./schema.zig").analytics; +const analytics = @import("./schema.rust").analytics; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/ast/ast.zig b/src/ast/ast.zig index a7d51017160..d5c931732fe 100644 --- a/src/ast/ast.zig +++ b/src/ast/ast.zig @@ -118,7 +118,7 @@ pub const Class = G.Class; const string = []const u8; const std = @import("std"); -const Runtime = @import("../runtime.zig").Runtime; +const Runtime = @import("../runtime.rust").Runtime; const bun = @import("bun"); const BabyList = bun.BabyList; diff --git a/src/ast/char_freq.zig b/src/ast/char_freq.zig index 815450f4db5..cf2bcbc7cc3 100644 --- a/src/ast/char_freq.zig +++ b/src/ast/char_freq.zig @@ -37,7 +37,7 @@ pub fn scan(this: *CharFreq, text: string, delta: i32) void { } fn scanBig(out: *align(1) Buffer, text: string, delta: i32) void { - // https://zig.godbolt.org/z/P5dPojWGK + // https://rust.godbolt.org/z/P5dPojWGK var freqs = out.*; defer out.* = freqs; var deltas: [256]i32 = [_]i32{0} ** 256; @@ -86,7 +86,7 @@ fn scanSmall(out: *align(1) Buffer, text: string, delta: i32) void { } pub fn include(this: *CharFreq, other: CharFreq) void { - // https://zig.godbolt.org/z/Mq8eK6K9s + // https://rust.godbolt.org/z/Mq8eK6K9s const left: @Vector(char_freq_count, i32) = this.freqs; const right: @Vector(char_freq_count, i32) = other.freqs; diff --git a/src/ast/e.zig b/src/ast/e.zig index ba20dd7e2ba..bb7d1b06cc7 100644 --- a/src/ast/e.zig +++ b/src/ast/e.zig @@ -68,7 +68,7 @@ pub const Array = struct { return out; } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").arrayToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").arrayToJS; /// Assumes each item in the array is a string pub fn alphabetizeStrings(this: *Array) void { @@ -137,7 +137,7 @@ pub const Binary = struct { pub const Boolean = struct { value: bool, - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").boolToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").boolToJS; }; pub const Super = struct {}; pub const Null = struct {}; @@ -175,7 +175,7 @@ pub const Special = union(enum) { hot_data, /// `import.meta.hot.accept` when HMR is enabled. Truthy. hot_accept, - /// Converted from `hot_accept` in P.zig's handleImportMetaHotAcceptCall + /// Converted from `hot_accept` in P.rust's handleImportMetaHotAcceptCall /// when passed strings. Printed as `hmr.acceptSpecifiers` hot_accept_visited, /// Prints the resolved specifier string for an import record. @@ -493,7 +493,7 @@ pub const Number = struct { return try writer.write(self.value); } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").numberToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").numberToJS; }; pub const BigInt = struct { @@ -505,7 +505,7 @@ pub const BigInt = struct { return try writer.write(self.value); } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").bigIntToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").bigIntToJS; }; pub const Object = struct { @@ -537,7 +537,7 @@ pub const Object = struct { return if (asProperty(self, key)) |query| query.expr else @as(?Expr, null); } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").objectToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").objectToJS; pub fn put(self: *Object, allocator: std.mem.Allocator, key: string, expr: Expr) !void { if (asProperty(self, key)) |query| { @@ -1140,13 +1140,13 @@ pub const String = struct { } } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").stringToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").stringToJS; - pub fn toZigString(s: *String, allocator: std.mem.Allocator) jsc.ZigString { + pub fn toRustString(s: *String, allocator: std.mem.Allocator) jsc.RustString { if (s.isUTF8()) { - return jsc.ZigString.fromUTF8(s.slice(allocator)); + return jsc.RustString.fromUTF8(s.slice(allocator)); } else { - return jsc.ZigString.initUTF16(s.slice16()); + return jsc.RustString.initUTF16(s.slice16()); } } @@ -1415,7 +1415,7 @@ pub const Import = struct { } pub fn importRecordLoader(import: *const Import) ?bun.options.Loader { - // This logic is duplicated in js_printer.zig fn parsePath() + // This logic is duplicated in js_printer.rust fn parsePath() const obj = import.options.data.as(.e_object) orelse return null; const with = obj.get("with") orelse obj.get("assert") orelse diff --git a/src/ast/expr.zig b/src/ast/expr.zig index e952fe0dc14..066d36608ee 100644 --- a/src/ast/expr.zig +++ b/src/ast/expr.zig @@ -108,7 +108,7 @@ pub fn fromBlob( return Expr.init( E.String, E.String{ - .data = try jsc.ZigString.init(bytes).toBase64DataURL(allocator), + .data = try jsc.RustString.init(bytes).toBase64DataURL(allocator), }, loc, ); @@ -147,7 +147,7 @@ pub fn hasAnyPropertyNamed(expr: *const Expr, comptime names: []const string) bo return false; } -pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").exprToJS; +pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").exprToJS; pub inline fn isArray(this: *const Expr) bool { return this.data == .e_array; @@ -3112,7 +3112,7 @@ pub const Data = union(Tag) { return Equality.unknown; } - pub const toJS = @import("../../js_parser_jsc/expr_jsc.zig").dataToJS; + pub const toJS = @import("../../js_parser_jsc/expr_jsc.rust").dataToJS; pub const Store = struct { const StoreType = NewStore(&.{ @@ -3220,7 +3220,7 @@ fn stringToEquivalentNumberValue(str: []const u8) f64 { const string = []const u8; const stringZ = [:0]const u8; -const JSPrinter = @import("../../js_printer/js_printer.zig"); +const JSPrinter = @import("../../js_printer/js_printer.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/ast/logger.zig b/src/ast/logger.zig index 123c09f7464..2263ff7a434 100644 --- a/src/ast/logger.zig +++ b/src/ast/logger.zig @@ -41,7 +41,7 @@ pub const Kind = enum(u8) { }; // Do not mark these as packed -// https://github.com/ziglang/zig/issues/15715 +// https://github.com/rustlang/rust/issues/15715 pub const Loc = struct { start: i32 = -1, @@ -400,8 +400,8 @@ pub const Msg = struct { return cost; } - pub const fromJS = @import("../logger_jsc/logger_jsc.zig").msgFromJS; - pub const toJS = @import("../logger_jsc/logger_jsc.zig").msgToJS; + pub const fromJS = @import("../logger_jsc/logger_jsc.rust").msgFromJS; + pub const toJS = @import("../logger_jsc/logger_jsc.rust").msgToJS; pub fn count(this: *const Msg, builder: *StringBuilder) void { this.data.count(builder); @@ -542,7 +542,7 @@ pub const Msg = struct { }; // Do not mark these as packed -// https://github.com/ziglang/zig/issues/15715 +// https://github.com/rustlang/rust/issues/15715 pub const Range = struct { loc: Loc = Loc.Empty, len: i32 = 0, @@ -652,7 +652,7 @@ pub const Log = struct { .{ "error", Level.err }, }); - pub const fromJS = @import("../logger_jsc/logger_jsc.zig").levelFromJS; + pub const fromJS = @import("../logger_jsc/logger_jsc.rust").levelFromJS; }; pub fn init(allocator: std.mem.Allocator) Log { @@ -683,9 +683,9 @@ pub const Log = struct { } } - pub const toJS = @import("../logger_jsc/logger_jsc.zig").logToJS; - pub const toJSAggregateError = @import("../logger_jsc/logger_jsc.zig").logToJSAggregateError; - pub const toJSArray = @import("../logger_jsc/logger_jsc.zig").logToJSArray; + pub const toJS = @import("../logger_jsc/logger_jsc.rust").logToJS; + pub const toJSAggregateError = @import("../logger_jsc/logger_jsc.rust").logToJSAggregateError; + pub const toJSArray = @import("../logger_jsc/logger_jsc.rust").logToJSArray; pub fn cloneTo(self: *Log, other: *Log) OOM!void { var notes_count: usize = 0; @@ -938,7 +938,7 @@ pub const Log = struct { ); } - pub fn addZigErrorWithNote(log: *Log, allocator: std.mem.Allocator, err: anyerror, comptime noteFmt: string, args: anytype) OOM!void { + pub fn addRustErrorWithNote(log: *Log, allocator: std.mem.Allocator, err: anyerror, comptime noteFmt: string, args: anytype) OOM!void { @branchHint(.cold); log.errors += 1; @@ -1280,7 +1280,7 @@ pub const Source = struct { } pub fn rangeOfIdentifier(this: *const Source, loc: Loc) Range { - const js_lexer = @import("../js_parser/lexer.zig"); + const js_lexer = @import("../js_parser/lexer.rust"); return js_lexer.rangeOfIdentifier(this, loc); } @@ -1507,9 +1507,9 @@ pub fn rangeData(source: ?*const Source, r: Range, text: string) Data { const string = []const u8; -const fs = @import("../resolver/fs.zig"); +const fs = @import("../resolver/fs.rust"); const std = @import("std"); -const ImportKind = @import("../options_types/import_record.zig").ImportKind; +const ImportKind = @import("../options_types/import_record.rust").ImportKind; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/ast/new_store.zig b/src/ast/new_store.zig index ebf11dcf7b2..a768d6d50a1 100644 --- a/src/ast/new_store.zig +++ b/src/ast/new_store.zig @@ -50,7 +50,7 @@ pub fn NewStore(comptime types: []const type, comptime count: usize) type { defer block.bytes_used = @intCast(start + @sizeOf(T)); // it's simpler to use @ptrCast, but as a sanity check, we also - // try to compute the slice. Zig will report an out of bounds + // try to compute the slice. Rust will report an out of bounds // panic if the null detection logic above is wrong if (Environment.isDebug) { _ = block.buffer[block.bytes_used..][0..@sizeOf(T)]; diff --git a/src/ast_jsc/logger_jsc.zig b/src/ast_jsc/logger_jsc.zig index abbd52cb3c4..34e6b98a7e1 100644 --- a/src/ast_jsc/logger_jsc.zig +++ b/src/ast_jsc/logger_jsc.zig @@ -1,16 +1,16 @@ //! JSC bridge for `bun.logger`. Keeps `src/logger/` free of JSC types. pub fn msgFromJS(allocator: std.mem.Allocator, globalObject: *jsc.JSGlobalObject, file: []const u8, err: jsc.JSValue) bun.JSError!Msg { - var zig_exception_holder: jsc.ZigException.Holder = jsc.ZigException.Holder.init(); + var rust_exception_holder: jsc.RustException.Holder = jsc.RustException.Holder.init(); if (err.toError()) |value| { - value.toZigException(globalObject, zig_exception_holder.zigException()); + value.toRustException(globalObject, rust_exception_holder.rustException()); } else { - zig_exception_holder.zigException().message = try err.toBunString(globalObject); + rust_exception_holder.rustException().message = try err.toBunString(globalObject); } return Msg{ .data = .{ - .text = try zig_exception_holder.zigException().message.toOwnedSlice(allocator), + .text = try rust_exception_holder.rustException().message.toOwnedSlice(allocator), .location = logger.Location{ .file = file, .line = 0, @@ -60,7 +60,7 @@ pub fn logToJS(this: Log, global: *jsc.JSGlobalObject, allocator: std.mem.Alloca .resolve => try bun.api.ResolveMessage.create(global, allocator, msg, ""), }; } - const out = jsc.ZigString.init(message); + const out = jsc.RustString.init(message); const agg = try global.createAggregateError(errors_stack[0..count], &out); return agg; }, diff --git a/src/base64/base64.zig b/src/base64/base64.zig index 5ce27780b24..17327d9d008 100644 --- a/src/base64/base64.zig +++ b/src/base64/base64.zig @@ -1,10 +1,10 @@ const mixed_decoder = brk: { - var decoder = zig_base64.standard.decoderWithIgnore("\xff \t\r\n" ++ [_]u8{ + var decoder = rust_base64.standard.decoderWithIgnore("\xff \t\r\n" ++ [_]u8{ std.ascii.control_code.vt, std.ascii.control_code.ff, }); - for (zig_base64.url_safe_alphabet_chars[62..], 62..) |c, i| { + for (rust_base64.url_safe_alphabet_chars[62..], 62..) |c, i| { decoder.decoder.char_to_index[c] = @as(u8, @intCast(i)); } @@ -71,14 +71,14 @@ pub fn simdutfEncodeUrlSafe(destination: []u8, source: []const u8) usize { } pub fn decodeLenUpperBound(len: usize) usize { - return zig_base64.standard.Decoder.calcSizeUpperBound(len) catch { + return rust_base64.standard.Decoder.calcSizeUpperBound(len) catch { //fallback return len / 4 * 3; }; } pub fn decodeLen(source: anytype) usize { - return zig_base64.standard.Decoder.calcSizeForSlice(source) catch { + return rust_base64.standard.Decoder.calcSizeForSlice(source) catch { //fallback; add 2 to allow for potentially missing padding return source.len / 4 * 3 + 2; @@ -90,7 +90,7 @@ pub fn encodeLen(source: anytype) usize { } pub fn encodeLenFromSize(source: usize) usize { - return zig_base64.standard.Encoder.calcSize(source); + return rust_base64.standard.Encoder.calcSize(source); } pub fn urlSafeEncodeLen(source: anytype) usize { @@ -103,7 +103,7 @@ pub fn encodeURLSafe(dest: []u8, source: []const u8) usize { return WTF__base64URLEncode(source.ptr, source.len, dest.ptr, dest.len); } -const zig_base64 = struct { +const rust_base64 = struct { const assert = bun.assert; const testing = std.testing; const mem = std.mem; diff --git a/src/boringssl/boringssl.zig b/src/boringssl/boringssl.zig index 1b6f7d58ff3..0c90a5f66ac 100644 --- a/src/boringssl/boringssl.zig +++ b/src/boringssl/boringssl.zig @@ -1,5 +1,5 @@ // TODO: move all custom functions from the translated file into this file, then -// the translated file can be provided by `zig translate-c` +// the translated file can be provided by `rust translate-c` /// BoringSSL's translated C API pub const c = boring; @@ -260,12 +260,12 @@ pub fn checkServerIdentity( return false; } -pub const ERR_toJS = @import("../runtime/crypto/boringssl_jsc.zig").ERR_toJS; +pub const ERR_toJS = @import("../runtime/crypto/boringssl_jsc.rust").ERR_toJS; -const X509 = @import("../runtime/api/bun/x509.zig"); -const boring = @import("../boringssl_sys/boringssl.zig"); +const X509 = @import("../runtime/api/bun/x509.rust"); +const boring = @import("../boringssl_sys/boringssl.rust"); const builtin = @import("builtin"); -const c_ares = @import("../cares_sys/c_ares.zig"); +const c_ares = @import("../cares_sys/c_ares.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/boringssl_sys/boringssl.zig b/src/boringssl_sys/boringssl.zig index 3b1f7f91547..bb6fc773638 100644 --- a/src/boringssl_sys/boringssl.zig +++ b/src/boringssl_sys/boringssl.zig @@ -6042,7 +6042,7 @@ pub const OPENSSL_APPLE = ""; pub const OPENSSL_MACOS = ""; pub const OPENSSL_THREADS = ""; pub const OPENSSL_IS_BORINGSSL = ""; -pub const OPENSSL_VERSION_NUMBER = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x1010107f, .hex); +pub const OPENSSL_VERSION_NUMBER = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x1010107f, .hex); pub const SSLEAY_VERSION_NUMBER = OPENSSL_VERSION_NUMBER; pub const BORINGSSL_API_VERSION = @as(c_int, 18); pub const OPENSSL_EXPORT = ""; @@ -6076,7 +6076,7 @@ pub const __SNPT = @as(c_int, 0x0800); pub const __SOFF = @as(c_int, 0x1000); pub const __SMOD = @as(c_int, 0x2000); pub const __SALC = @as(c_int, 0x4000); -pub const __SIGN = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); +pub const __SIGN = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); pub const _IOFBF = @as(c_int, 0); pub const _IOLBF = @as(c_int, 1); pub const _IONBF = @as(c_int, 2); @@ -6086,7 +6086,7 @@ pub const FOPEN_MAX = @as(c_int, 20); pub const FILENAME_MAX = @as(c_int, 1024); pub const P_tmpdir = "/var/tmp/"; pub const L_tmpnam = @as(c_int, 1024); -pub const TMP_MAX = @import("std").zig.c_translation.promoteIntLiteral(c_int, 308915776, .decimal); +pub const TMP_MAX = @import("std").rust.c_translation.promoteIntLiteral(c_int, 308915776, .decimal); pub const SEEK_SET = @as(c_int, 0); pub const SEEK_CUR = @as(c_int, 1); pub const SEEK_END = @as(c_int, 2); @@ -6098,10 +6098,10 @@ pub const _USE_FORTIFY_LEVEL = @as(c_int, 2); pub const OPENSSL_HEADER_BUFFER_H = ""; pub const OPENSSL_HEADER_ERR_H = ""; pub inline fn ERR_GET_LIB(packed_error: anytype) c_int { - return @import("std").zig.c_translation.cast(c_int, (packed_error >> @as(c_int, 24)) & @as(c_int, 0xff)); + return @import("std").rust.c_translation.cast(c_int, (packed_error >> @as(c_int, 24)) & @as(c_int, 0xff)); } pub inline fn ERR_GET_REASON(packed_error: anytype) c_int { - return @import("std").zig.c_translation.cast(c_int, packed_error & @as(c_int, 0xfff)); + return @import("std").rust.c_translation.cast(c_int, packed_error & @as(c_int, 0xfff)); } pub const ERR_FLAG_STRING = @as(c_int, 1); pub const ERR_FLAG_MALLOCED = @as(c_int, 2); @@ -6151,8 +6151,8 @@ pub inline fn ERR_GET_FUNC(packed_error: anytype) @TypeOf(@as(c_int, 0)) { pub const ERR_TXT_STRING = ERR_FLAG_STRING; pub const ERR_TXT_MALLOCED = ERR_FLAG_MALLOCED; pub const ERR_NUM_ERRORS = @as(c_int, 16); -pub inline fn ERR_PACK(lib: anytype, reason: anytype) @TypeOf(((@import("std").zig.c_translation.cast(u32, lib) & @as(c_int, 0xff)) << @as(c_int, 24)) | (@import("std").zig.c_translation.cast(u32, reason) & @as(c_int, 0xfff))) { - return ((@import("std").zig.c_translation.cast(u32, lib) & @as(c_int, 0xff)) << @as(c_int, 24)) | (@import("std").zig.c_translation.cast(u32, reason) & @as(c_int, 0xfff)); +pub inline fn ERR_PACK(lib: anytype, reason: anytype) @TypeOf(((@import("std").rust.c_translation.cast(u32, lib) & @as(c_int, 0xff)) << @as(c_int, 24)) | (@import("std").rust.c_translation.cast(u32, reason) & @as(c_int, 0xfff))) { + return ((@import("std").rust.c_translation.cast(u32, lib) & @as(c_int, 0xff)) << @as(c_int, 24)) | (@import("std").rust.c_translation.cast(u32, reason) & @as(c_int, 0xfff)); } pub const OPENSSL_HEADER_EX_DATA_H = ""; pub const OPENSSL_HEADER_STACK_H = ""; @@ -16748,8 +16748,8 @@ pub const B_ASN1_BMPSTRING = @as(c_int, 0x0800); pub const B_ASN1_UNKNOWN = @as(c_int, 0x1000); pub const B_ASN1_UTF8STRING = @as(c_int, 0x2000); pub const B_ASN1_UTCTIME = @as(c_int, 0x4000); -pub const B_ASN1_GENERALIZEDTIME = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); -pub const B_ASN1_SEQUENCE = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10000, .hex); +pub const B_ASN1_GENERALIZEDTIME = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); +pub const B_ASN1_SEQUENCE = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x10000, .hex); pub inline fn ASN1_ITEM_ptr(iptr: anytype) @TypeOf(iptr) { return iptr; } @@ -17147,7 +17147,7 @@ pub const RSA_FLAG_OPAQUE = @as(c_int, 1); pub const RSA_FLAG_NO_BLINDING = @as(c_int, 8); pub const RSA_FLAG_EXT_PKEY = @as(c_int, 0x20); pub const RSA_3 = @as(c_int, 0x3); -pub const RSA_F4 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10001, .hex); +pub const RSA_F4 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x10001, .hex); pub const RSA_METHOD_FLAG_NO_CHECK = RSA_FLAG_OPAQUE; pub const RSA_R_BAD_ENCODING = @as(c_int, 100); pub const RSA_R_BAD_E_VALUE = @as(c_int, 101); @@ -17238,8 +17238,8 @@ pub const X509v3_KU_KEY_AGREEMENT = @as(c_int, 0x0008); pub const X509v3_KU_KEY_CERT_SIGN = @as(c_int, 0x0004); pub const X509v3_KU_CRL_SIGN = @as(c_int, 0x0002); pub const X509v3_KU_ENCIPHER_ONLY = @as(c_int, 0x0001); -pub const X509v3_KU_DECIPHER_ONLY = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); -pub const X509v3_KU_UNDEF = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xffff, .hex); +pub const X509v3_KU_DECIPHER_ONLY = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); +pub const X509v3_KU_UNDEF = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xffff, .hex); pub const X509_TRUST_DEFAULT = -@as(c_int, 1); pub const X509_TRUST_COMPAT = @as(c_int, 1); pub const X509_TRUST_SSL_CLIENT = @as(c_int, 2); @@ -17293,11 +17293,11 @@ pub const X509_LU_CRL = @as(c_int, 2); pub const X509_LU_PKEY = @as(c_int, 3); pub const X509_L_FILE_LOAD = @as(c_int, 1); pub const X509_L_ADD_DIR = @as(c_int, 2); -pub inline fn X509_LOOKUP_load_file(x: anytype, name: anytype, @"type": anytype) @TypeOf(X509_LOOKUP_ctrl(x, X509_L_FILE_LOAD, name, @import("std").zig.c_translation.cast(c_long, @"type"), NULL)) { - return X509_LOOKUP_ctrl(x, X509_L_FILE_LOAD, name, @import("std").zig.c_translation.cast(c_long, @"type"), NULL); +pub inline fn X509_LOOKUP_load_file(x: anytype, name: anytype, @"type": anytype) @TypeOf(X509_LOOKUP_ctrl(x, X509_L_FILE_LOAD, name, @import("std").rust.c_translation.cast(c_long, @"type"), NULL)) { + return X509_LOOKUP_ctrl(x, X509_L_FILE_LOAD, name, @import("std").rust.c_translation.cast(c_long, @"type"), NULL); } -pub inline fn X509_LOOKUP_add_dir(x: anytype, name: anytype, @"type": anytype) @TypeOf(X509_LOOKUP_ctrl(x, X509_L_ADD_DIR, name, @import("std").zig.c_translation.cast(c_long, @"type"), NULL)) { - return X509_LOOKUP_ctrl(x, X509_L_ADD_DIR, name, @import("std").zig.c_translation.cast(c_long, @"type"), NULL); +pub inline fn X509_LOOKUP_add_dir(x: anytype, name: anytype, @"type": anytype) @TypeOf(X509_LOOKUP_ctrl(x, X509_L_ADD_DIR, name, @import("std").rust.c_translation.cast(c_long, @"type"), NULL)) { + return X509_LOOKUP_ctrl(x, X509_L_ADD_DIR, name, @import("std").rust.c_translation.cast(c_long, @"type"), NULL); } pub const X509_V_OK = @as(c_int, 0); pub const X509_V_ERR_UNSPECIFIED = @as(c_int, 1); @@ -17383,10 +17383,10 @@ pub const X509_V_FLAG_NOTIFY_POLICY = @as(c_int, 0x800); pub const X509_V_FLAG_EXTENDED_CRL_SUPPORT = @as(c_int, 0x1000); pub const X509_V_FLAG_USE_DELTAS = @as(c_int, 0x2000); pub const X509_V_FLAG_CHECK_SS_SIGNATURE = @as(c_int, 0x4000); -pub const X509_V_FLAG_TRUSTED_FIRST = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); -pub const X509_V_FLAG_PARTIAL_CHAIN = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x80000, .hex); -pub const X509_V_FLAG_NO_ALT_CHAINS = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x100000, .hex); -pub const X509_V_FLAG_NO_CHECK_TIME = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x200000, .hex); +pub const X509_V_FLAG_TRUSTED_FIRST = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x8000, .hex); +pub const X509_V_FLAG_PARTIAL_CHAIN = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x80000, .hex); +pub const X509_V_FLAG_NO_ALT_CHAINS = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x100000, .hex); +pub const X509_V_FLAG_NO_CHECK_TIME = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x200000, .hex); pub const X509_VP_FLAG_DEFAULT = @as(c_int, 0x1); pub const X509_VP_FLAG_OVERWRITE = @as(c_int, 0x2); pub const X509_VP_FLAG_RESET_FLAGS = @as(c_int, 0x4); @@ -17514,35 +17514,35 @@ pub const PEM_R_UNSUPPORTED_ENCRYPTION = @as(c_int, 114); pub const OPENSSL_HEADER_SSL3_H = ""; pub const SSL2_MT_CLIENT_HELLO = @as(c_int, 1); pub const SSL2_VERSION = @as(c_int, 0x0002); -pub const SSL3_CK_SCSV = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000FF, .hex); -pub const SSL3_CK_FALLBACK_SCSV = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03005600, .hex); -pub const SSL3_CK_RSA_NULL_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000001, .hex); -pub const SSL3_CK_RSA_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000002, .hex); -pub const SSL3_CK_RSA_RC4_40_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000003, .hex); -pub const SSL3_CK_RSA_RC4_128_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000004, .hex); -pub const SSL3_CK_RSA_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000005, .hex); -pub const SSL3_CK_RSA_RC2_40_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000006, .hex); -pub const SSL3_CK_RSA_IDEA_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000007, .hex); -pub const SSL3_CK_RSA_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000008, .hex); -pub const SSL3_CK_RSA_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000009, .hex); -pub const SSL3_CK_RSA_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000A, .hex); -pub const SSL3_CK_DH_DSS_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000B, .hex); -pub const SSL3_CK_DH_DSS_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000C, .hex); -pub const SSL3_CK_DH_DSS_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000D, .hex); -pub const SSL3_CK_DH_RSA_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000E, .hex); -pub const SSL3_CK_DH_RSA_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300000F, .hex); -pub const SSL3_CK_DH_RSA_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000010, .hex); -pub const SSL3_CK_EDH_DSS_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000011, .hex); -pub const SSL3_CK_EDH_DSS_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000012, .hex); -pub const SSL3_CK_EDH_DSS_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000013, .hex); -pub const SSL3_CK_EDH_RSA_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000014, .hex); -pub const SSL3_CK_EDH_RSA_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000015, .hex); -pub const SSL3_CK_EDH_RSA_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000016, .hex); -pub const SSL3_CK_ADH_RC4_40_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000017, .hex); -pub const SSL3_CK_ADH_RC4_128_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000018, .hex); -pub const SSL3_CK_ADH_DES_40_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000019, .hex); -pub const SSL3_CK_ADH_DES_64_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300001A, .hex); -pub const SSL3_CK_ADH_DES_192_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300001B, .hex); +pub const SSL3_CK_SCSV = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000FF, .hex); +pub const SSL3_CK_FALLBACK_SCSV = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03005600, .hex); +pub const SSL3_CK_RSA_NULL_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000001, .hex); +pub const SSL3_CK_RSA_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000002, .hex); +pub const SSL3_CK_RSA_RC4_40_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000003, .hex); +pub const SSL3_CK_RSA_RC4_128_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000004, .hex); +pub const SSL3_CK_RSA_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000005, .hex); +pub const SSL3_CK_RSA_RC2_40_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000006, .hex); +pub const SSL3_CK_RSA_IDEA_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000007, .hex); +pub const SSL3_CK_RSA_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000008, .hex); +pub const SSL3_CK_RSA_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000009, .hex); +pub const SSL3_CK_RSA_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000A, .hex); +pub const SSL3_CK_DH_DSS_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000B, .hex); +pub const SSL3_CK_DH_DSS_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000C, .hex); +pub const SSL3_CK_DH_DSS_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000D, .hex); +pub const SSL3_CK_DH_RSA_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000E, .hex); +pub const SSL3_CK_DH_RSA_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300000F, .hex); +pub const SSL3_CK_DH_RSA_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000010, .hex); +pub const SSL3_CK_EDH_DSS_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000011, .hex); +pub const SSL3_CK_EDH_DSS_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000012, .hex); +pub const SSL3_CK_EDH_DSS_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000013, .hex); +pub const SSL3_CK_EDH_RSA_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000014, .hex); +pub const SSL3_CK_EDH_RSA_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000015, .hex); +pub const SSL3_CK_EDH_RSA_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000016, .hex); +pub const SSL3_CK_ADH_RC4_40_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000017, .hex); +pub const SSL3_CK_ADH_RC4_128_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000018, .hex); +pub const SSL3_CK_ADH_DES_40_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000019, .hex); +pub const SSL3_CK_ADH_DES_64_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300001A, .hex); +pub const SSL3_CK_ADH_DES_192_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300001B, .hex); pub const SSL3_TXT_RSA_NULL_MD5 = "NULL-MD5"; pub const SSL3_TXT_RSA_NULL_SHA = "NULL-SHA"; pub const SSL3_TXT_RSA_RC4_40_MD5 = "EXP-RC4-MD5"; @@ -17667,7 +17667,7 @@ pub const TLSEXT_TYPE_srtp = @as(c_int, 14); pub const TLSEXT_TYPE_application_layer_protocol_negotiation = @as(c_int, 16); pub const TLSEXT_TYPE_padding = @as(c_int, 21); pub const TLSEXT_TYPE_extended_master_secret = @as(c_int, 23); -pub const TLSEXT_TYPE_quic_transport_parameters_legacy = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xffa5, .hex); +pub const TLSEXT_TYPE_quic_transport_parameters_legacy = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xffa5, .hex); pub const TLSEXT_TYPE_quic_transport_parameters = @as(c_int, 57); pub const TLSEXT_TYPE_quic_transport_parameters_standard = TLSEXT_TYPE_quic_transport_parameters; pub const TLSEXT_TYPE_cert_compression = @as(c_int, 27); @@ -17681,11 +17681,11 @@ pub const TLSEXT_TYPE_psk_key_exchange_modes = @as(c_int, 45); pub const TLSEXT_TYPE_certificate_authorities = @as(c_int, 47); pub const TLSEXT_TYPE_signature_algorithms_cert = @as(c_int, 50); pub const TLSEXT_TYPE_key_share = @as(c_int, 51); -pub const TLSEXT_TYPE_renegotiate = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xff01, .hex); +pub const TLSEXT_TYPE_renegotiate = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xff01, .hex); pub const TLSEXT_TYPE_delegated_credential = @as(c_int, 0x22); pub const TLSEXT_TYPE_application_settings = @as(c_int, 17513); -pub const TLSEXT_TYPE_encrypted_client_hello = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xfe0d, .hex); -pub const TLSEXT_TYPE_ech_outer_extensions = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xfd00, .hex); +pub const TLSEXT_TYPE_encrypted_client_hello = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xfe0d, .hex); +pub const TLSEXT_TYPE_ech_outer_extensions = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xfd00, .hex); pub const TLSEXT_TYPE_certificate_timestamp = @as(c_int, 18); pub const TLSEXT_TYPE_next_proto_neg = @as(c_int, 13172); pub const TLSEXT_TYPE_channel_id = @as(c_int, 30032); @@ -17707,130 +17707,130 @@ pub const TLSEXT_hash_sha512 = @as(c_int, 6); pub const TLSEXT_cert_compression_zlib = @as(c_int, 1); pub const TLSEXT_cert_compression_brotli = @as(c_int, 2); pub const TLSEXT_MAXLEN_host_name = @as(c_int, 255); -pub const TLS1_CK_PSK_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300008A, .hex); -pub const TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300008B, .hex); -pub const TLS1_CK_PSK_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300008C, .hex); -pub const TLS1_CK_PSK_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300008D, .hex); -pub const TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C035, .hex); -pub const TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C036, .hex); -pub const TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000060, .hex); -pub const TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000061, .hex); -pub const TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000062, .hex); -pub const TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000063, .hex); -pub const TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000064, .hex); -pub const TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000065, .hex); -pub const TLS1_CK_DHE_DSS_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000066, .hex); -pub const TLS1_CK_RSA_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300002F, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000030, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000031, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000032, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000033, .hex); -pub const TLS1_CK_ADH_WITH_AES_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000034, .hex); -pub const TLS1_CK_RSA_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000035, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000036, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000037, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000038, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000039, .hex); -pub const TLS1_CK_ADH_WITH_AES_256_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003A, .hex); -pub const TLS1_CK_RSA_WITH_NULL_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003B, .hex); -pub const TLS1_CK_RSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003C, .hex); -pub const TLS1_CK_RSA_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003D, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003E, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300003F, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000040, .hex); -pub const TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000041, .hex); -pub const TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000042, .hex); -pub const TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000043, .hex); -pub const TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000044, .hex); -pub const TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000045, .hex); -pub const TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000046, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000067, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000068, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000069, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300006A, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300006B, .hex); -pub const TLS1_CK_ADH_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300006C, .hex); -pub const TLS1_CK_ADH_WITH_AES_256_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300006D, .hex); -pub const TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000084, .hex); -pub const TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000085, .hex); -pub const TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000086, .hex); -pub const TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000087, .hex); -pub const TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000088, .hex); -pub const TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000089, .hex); -pub const TLS1_CK_RSA_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000096, .hex); -pub const TLS1_CK_DH_DSS_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000097, .hex); -pub const TLS1_CK_DH_RSA_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000098, .hex); -pub const TLS1_CK_DHE_DSS_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03000099, .hex); -pub const TLS1_CK_DHE_RSA_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009A, .hex); -pub const TLS1_CK_ADH_WITH_SEED_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009B, .hex); -pub const TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009C, .hex); -pub const TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009D, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009E, .hex); -pub const TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300009F, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A0, .hex); -pub const TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A1, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A2, .hex); -pub const TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A3, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A4, .hex); -pub const TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A5, .hex); -pub const TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A6, .hex); -pub const TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x030000A7, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C001, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C002, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C003, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C004, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C005, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C006, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C007, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C008, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C009, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00A, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00B, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00C, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00D, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00E, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C00F, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C010, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C011, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C012, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C013, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C014, .hex); -pub const TLS1_CK_ECDH_anon_WITH_NULL_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C015, .hex); -pub const TLS1_CK_ECDH_anon_WITH_RC4_128_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C016, .hex); -pub const TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C017, .hex); -pub const TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C018, .hex); -pub const TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C019, .hex); -pub const TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01A, .hex); -pub const TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01B, .hex); -pub const TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01C, .hex); -pub const TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01D, .hex); -pub const TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01E, .hex); -pub const TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C01F, .hex); -pub const TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C020, .hex); -pub const TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C021, .hex); -pub const TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C022, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C023, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C024, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C025, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C026, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C027, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C028, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C029, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02A, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02B, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02C, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02D, .hex); -pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02E, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C02F, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C030, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C031, .hex); -pub const TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300C032, .hex); -pub const TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300CCA8, .hex); -pub const TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300CCA9, .hex); -pub const TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x0300CCAC, .hex); -pub const TLS1_3_CK_AES_128_GCM_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03001301, .hex); -pub const TLS1_3_CK_AES_256_GCM_SHA384 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03001302, .hex); -pub const TLS1_3_CK_CHACHA20_POLY1305_SHA256 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x03001303, .hex); +pub const TLS1_CK_PSK_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300008A, .hex); +pub const TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300008B, .hex); +pub const TLS1_CK_PSK_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300008C, .hex); +pub const TLS1_CK_PSK_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300008D, .hex); +pub const TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C035, .hex); +pub const TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C036, .hex); +pub const TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000060, .hex); +pub const TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000061, .hex); +pub const TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000062, .hex); +pub const TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000063, .hex); +pub const TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000064, .hex); +pub const TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000065, .hex); +pub const TLS1_CK_DHE_DSS_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000066, .hex); +pub const TLS1_CK_RSA_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300002F, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000030, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000031, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000032, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000033, .hex); +pub const TLS1_CK_ADH_WITH_AES_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000034, .hex); +pub const TLS1_CK_RSA_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000035, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000036, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000037, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000038, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000039, .hex); +pub const TLS1_CK_ADH_WITH_AES_256_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003A, .hex); +pub const TLS1_CK_RSA_WITH_NULL_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003B, .hex); +pub const TLS1_CK_RSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003C, .hex); +pub const TLS1_CK_RSA_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003D, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003E, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300003F, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000040, .hex); +pub const TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000041, .hex); +pub const TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000042, .hex); +pub const TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000043, .hex); +pub const TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000044, .hex); +pub const TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000045, .hex); +pub const TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000046, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000067, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000068, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000069, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300006A, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300006B, .hex); +pub const TLS1_CK_ADH_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300006C, .hex); +pub const TLS1_CK_ADH_WITH_AES_256_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300006D, .hex); +pub const TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000084, .hex); +pub const TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000085, .hex); +pub const TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000086, .hex); +pub const TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000087, .hex); +pub const TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000088, .hex); +pub const TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000089, .hex); +pub const TLS1_CK_RSA_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000096, .hex); +pub const TLS1_CK_DH_DSS_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000097, .hex); +pub const TLS1_CK_DH_RSA_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000098, .hex); +pub const TLS1_CK_DHE_DSS_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03000099, .hex); +pub const TLS1_CK_DHE_RSA_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009A, .hex); +pub const TLS1_CK_ADH_WITH_SEED_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009B, .hex); +pub const TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009C, .hex); +pub const TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009D, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009E, .hex); +pub const TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300009F, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A0, .hex); +pub const TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A1, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A2, .hex); +pub const TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A3, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A4, .hex); +pub const TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A5, .hex); +pub const TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A6, .hex); +pub const TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x030000A7, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C001, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C002, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C003, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C004, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C005, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C006, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C007, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C008, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C009, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00A, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00B, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00C, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00D, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00E, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C00F, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C010, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C011, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C012, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C013, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C014, .hex); +pub const TLS1_CK_ECDH_anon_WITH_NULL_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C015, .hex); +pub const TLS1_CK_ECDH_anon_WITH_RC4_128_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C016, .hex); +pub const TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C017, .hex); +pub const TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C018, .hex); +pub const TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C019, .hex); +pub const TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01A, .hex); +pub const TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01B, .hex); +pub const TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01C, .hex); +pub const TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01D, .hex); +pub const TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01E, .hex); +pub const TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C01F, .hex); +pub const TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C020, .hex); +pub const TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C021, .hex); +pub const TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C022, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C023, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C024, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C025, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C026, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C027, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C028, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C029, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02A, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02B, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02C, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02D, .hex); +pub const TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02E, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C02F, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C030, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C031, .hex); +pub const TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300C032, .hex); +pub const TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300CCA8, .hex); +pub const TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300CCA9, .hex); +pub const TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x0300CCAC, .hex); +pub const TLS1_3_CK_AES_128_GCM_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03001301, .hex); +pub const TLS1_3_CK_AES_256_GCM_SHA384 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03001302, .hex); +pub const TLS1_3_CK_CHACHA20_POLY1305_SHA256 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x03001303, .hex); pub const TLS1_CK_AES_128_GCM_SHA256 = TLS1_3_CK_AES_128_GCM_SHA256; pub const TLS1_CK_AES_256_GCM_SHA384 = TLS1_3_CK_AES_256_GCM_SHA384; pub const TLS1_CK_CHACHA20_POLY1305_SHA256 = TLS1_3_CK_CHACHA20_POLY1305_SHA256; @@ -18018,8 +18018,8 @@ pub const TLS1_VERSION = @as(c_int, 0x0301); pub const TLS1_1_VERSION = @as(c_int, 0x0302); pub const TLS1_2_VERSION = @as(c_int, 0x0303); pub const TLS1_3_VERSION = @as(c_int, 0x0304); -pub const DTLS1_VERSION = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xfeff, .hex); -pub const DTLS1_2_VERSION = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xfefd, .hex); +pub const DTLS1_VERSION = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xfeff, .hex); +pub const DTLS1_2_VERSION = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xfefd, .hex); pub const SSL_OP_NO_QUERY_MTU = @as(c_long, 0x00001000); pub const SSL_OP_NO_TICKET = @as(c_long, 0x00004000); pub const SSL_OP_CIPHER_SERVER_PREFERENCE = @as(c_long, 0x00400000); @@ -18048,7 +18048,7 @@ pub const SSL_SIGN_RSA_PSS_RSAE_SHA256 = @as(c_int, 0x0804); pub const SSL_SIGN_RSA_PSS_RSAE_SHA384 = @as(c_int, 0x0805); pub const SSL_SIGN_RSA_PSS_RSAE_SHA512 = @as(c_int, 0x0806); pub const SSL_SIGN_ED25519 = @as(c_int, 0x0807); -pub const SSL_SIGN_RSA_PKCS1_MD5_SHA1 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xff01, .hex); +pub const SSL_SIGN_RSA_PKCS1_MD5_SHA1 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xff01, .hex); pub const SSL_FILETYPE_PEM = @as(c_int, 1); pub const SSL_FILETYPE_ASN1 = @as(c_int, 2); pub const SSL_DEFAULT_CIPHER_LIST = "ALL"; @@ -18159,14 +18159,14 @@ pub const SSL_CB_HANDSHAKE_DONE = @as(c_int, 0x20); pub const SSL_SENT_SHUTDOWN = @as(c_int, 1); pub const SSL_RECEIVED_SHUTDOWN = @as(c_int, 2); pub const SSL_MODE_HANDSHAKE_CUTTHROUGH = SSL_MODE_ENABLE_FALSE_START; -pub inline fn SSL_set_app_data(s: anytype, arg: anytype) @TypeOf(SSL_set_ex_data(s, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, arg))) { - return SSL_set_ex_data(s, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, arg)); +pub inline fn SSL_set_app_data(s: anytype, arg: anytype) @TypeOf(SSL_set_ex_data(s, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, arg))) { + return SSL_set_ex_data(s, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, arg)); } pub inline fn SSL_get_app_data(s: anytype) @TypeOf(SSL_get_ex_data(s, @as(c_int, 0))) { return SSL_get_ex_data(s, @as(c_int, 0)); } -pub inline fn SSL_SESSION_set_app_data(s: anytype, a: anytype) @TypeOf(SSL_SESSION_set_ex_data(s, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, a))) { - return SSL_SESSION_set_ex_data(s, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, a)); +pub inline fn SSL_SESSION_set_app_data(s: anytype, a: anytype) @TypeOf(SSL_SESSION_set_ex_data(s, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, a))) { + return SSL_SESSION_set_ex_data(s, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, a)); } pub inline fn SSL_SESSION_get_app_data(s: anytype) @TypeOf(SSL_SESSION_get_ex_data(s, @as(c_int, 0))) { return SSL_SESSION_get_ex_data(s, @as(c_int, 0)); @@ -18174,8 +18174,8 @@ pub inline fn SSL_SESSION_get_app_data(s: anytype) @TypeOf(SSL_SESSION_get_ex_da pub inline fn SSL_CTX_get_app_data(ctx: anytype) @TypeOf(SSL_CTX_get_ex_data(ctx, @as(c_int, 0))) { return SSL_CTX_get_ex_data(ctx, @as(c_int, 0)); } -pub inline fn SSL_CTX_set_app_data(ctx: anytype, arg: anytype) @TypeOf(SSL_CTX_set_ex_data(ctx, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, arg))) { - return SSL_CTX_set_ex_data(ctx, @as(c_int, 0), @import("std").zig.c_translation.cast([*c]u8, arg)); +pub inline fn SSL_CTX_set_app_data(ctx: anytype, arg: anytype) @TypeOf(SSL_CTX_set_ex_data(ctx, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, arg))) { + return SSL_CTX_set_ex_data(ctx, @as(c_int, 0), @import("std").rust.c_translation.cast([*c]u8, arg)); } pub inline fn OpenSSL_add_ssl_algorithms() @TypeOf(SSL_library_init()) { return SSL_library_init(); @@ -19292,7 +19292,7 @@ pub fn getError(this: *SSL, rc: c_int) SSL.Error!u32 { const bun = @import("bun"); const std = @import("std"); -const C = @import("std").zig.c_builtins; +const C = @import("std").rust.c_builtins; const DECLARE_ASN1_ALLOC_FUNCTIONS_name = C.DECLARE_ASN1_ALLOC_FUNCTIONS_name; const DECLARE_ASN1_FUNCTIONS_name = C.DECLARE_ASN1_FUNCTIONS_name; const DEFINE_NAMED_STACK_OF = C.DEFINE_NAMED_STACK_OF; diff --git a/src/brotli/brotli.zig b/src/brotli/brotli.zig index 0ac0ca9aa2f..c7b70e9cb47 100644 --- a/src/brotli/brotli.zig +++ b/src/brotli/brotli.zig @@ -1,4 +1,4 @@ -pub const c = @import("../brotli_sys/brotli_c.zig"); +pub const c = @import("../brotli_sys/brotli_c.rust"); const BrotliDecoder = c.BrotliDecoder; const BrotliEncoder = c.BrotliEncoder; diff --git a/src/brotli_sys/brotli_c.zig b/src/brotli_sys/brotli_c.zig index 57f690bc1ed..06a59d1550d 100644 --- a/src/brotli_sys/brotli_c.zig +++ b/src/brotli_sys/brotli_c.zig @@ -192,8 +192,8 @@ pub const BrotliDecoderParameter = enum(c_uint) { LARGE_WINDOW = 1, }; -pub const BROTLI_UINT32_MAX = ~@import("std").zig.c_translation.cast(u32, @as(c_int, 0)); -pub const BROTLI_SIZE_MAX = ~@import("std").zig.c_translation.cast(usize, @as(c_int, 0)); +pub const BROTLI_UINT32_MAX = ~@import("std").rust.c_translation.cast(u32, @as(c_int, 0)); +pub const BROTLI_SIZE_MAX = ~@import("std").rust.c_translation.cast(usize, @as(c_int, 0)); pub const BROTLI_LAST_ERROR_CODE = BROTLI_DECODER_ERROR_UNREACHABLE; pub const BrotliSharedDictionaryStruct = struct_BrotliSharedDictionaryStruct; diff --git a/src/bun.js.zig b/src/bun.js.zig index 3ec408f4881..ce930f28489 100644 --- a/src/bun.js.zig +++ b/src/bun.js.zig @@ -1,7 +1,7 @@ -pub const jsc = @import("./jsc/jsc.zig"); -pub const webcore = @import("./runtime/webcore.zig"); -pub const api = @import("./runtime/api.zig"); -pub const bindgen = @import("./jsc/bindgen.zig"); +pub const jsc = @import("./jsc/jsc.rust"); +pub const webcore = @import("./runtime/webcore.rust"); +pub const api = @import("./runtime/api.rust"); +pub const bindgen = @import("./jsc/bindgen.rust"); pub fn applyStandaloneRuntimeFlags(b: *bun.Transpiler, graph: *const bun.StandaloneModuleGraph) void { b.options.env.disable_default_env_files = graph.flags.disable_default_env_files; @@ -34,7 +34,7 @@ pub const Run = struct { const arena = Arena.init(); // Load bunfig.toml unless disabled by compile flags - // Note: config loading with execArgv is handled earlier in cli.zig via loadConfig + // Note: config loading with execArgv is handled earlier in cli.rust via loadConfig if (!ctx.debug.loaded_bunfig and !graph_ptr.flags.disable_autoload_bunfig) { try bun.cli.Arguments.loadConfigPath(ctx.allocator, true, "bunfig.toml", ctx, .RunCommand); } @@ -146,7 +146,7 @@ pub const Run = struct { var bundle = try bun.Transpiler.init( ctx.allocator, ctx.log, - try @import("./jsc/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), + try @import("./jsc/config.rust").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), null, ); try bundle.runEnvLoader(bundle.options.env.disable_default_env_files); @@ -286,7 +286,7 @@ pub const Run = struct { // Allow setting a custom timezone if (vm.transpiler.env.get("TZ")) |tz| { if (tz.len > 0) { - _ = vm.global.setTimeZone(&jsc.ZigString.init(tz)); + _ = vm.global.setTimeZone(&jsc.RustString.init(tz)); } } @@ -555,7 +555,7 @@ pub const Run = struct { bun.api.napi.fixDeadCodeElimination(); bun.webcore.BakeResponse.fixDeadCodeElimination(); bun.crash_handler.fixDeadCodeElimination(); - @import("./jsc/JSSecrets.zig").fixDeadCodeElimination(); + @import("./jsc/JSSecrets.rust").fixDeadCodeElimination(); vm.globalExit(); } @@ -636,12 +636,12 @@ fn escapeForJSString(allocator: std.mem.Allocator, input: []const u8) ![]const u return result.toOwnedSlice(); } -const CPUProfiler = @import("./jsc/BunCPUProfiler.zig"); -const HeapProfiler = @import("./jsc/BunHeapProfiler.zig"); -const options = @import("./bundler/options.zig"); +const CPUProfiler = @import("./jsc/BunCPUProfiler.rust"); +const HeapProfiler = @import("./jsc/BunHeapProfiler.rust"); +const options = @import("./bundler/options.rust"); const std = @import("std"); -const Command = @import("./runtime/cli/cli.zig").Command; -const which = @import("./which/which.zig").which; +const Command = @import("./runtime/cli/cli.rust").Command; +const which = @import("./which/which.rust").which; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/bun.zig b/src/bun.zig index a1cf3361bfa..35adde9d61a 100644 --- a/src/bun.zig +++ b/src/bun.zig @@ -1,4 +1,4 @@ -//! This is the root source file of Bun's zig module. It can be imported using +//! This is the root source file of Bun's rust module. It can be imported using //! `@import("bun")`, and should be able to reach all code via `.` syntax. //! //! Prefer adding new code into a separate file and adding an import, or putting @@ -6,8 +6,8 @@ const bun = @This(); -pub const Environment = @import("./bun_core/env.zig"); -pub const env_var = @import("./bun_core/env_var.zig"); +pub const Environment = @import("./bun_core/env.rust"); +pub const env_var = @import("./bun_core/env_var.rust"); pub const feature_flag = env_var.feature_flag; pub const use_mimalloc = @import("build_options").use_mimalloc; @@ -93,7 +93,7 @@ pub inline fn clampFloat(_self: anytype, min: @TypeOf(_self), max: @TypeOf(_self /// Converts a floating-point value to an integer following Rust semantics. /// This provides safe conversion that mimics Rust's `as` operator behavior, -/// unlike Zig's `@intFromFloat` which panics on out-of-range values. +/// unlike Rust's `@intFromFloat` which panics on out-of-range values. /// /// Conversion rules: /// - If finite and within target integer range: truncates toward zero @@ -174,10 +174,10 @@ pub const JSTerminated = error{ pub const JSOOM = OOM || JSError; -pub const ci = @import("./runtime/cli/ci_info.zig"); +pub const ci = @import("./runtime/cli/ci_info.rust"); /// Cross-platform system APIs -pub const sys = @import("./sys/sys.zig"); +pub const sys = @import("./sys/sys.rust"); /// Deprecated: use bun.sys.S pub const S = sys.S; pub const O = sys.O; @@ -185,67 +185,67 @@ pub const Mode = sys.Mode; // Platform-specific system APIs. If something can be implemented on multiple // platforms, it does not belong in these three namespaces. -pub const windows = @import("./sys/windows/windows.zig"); -pub const darwin = @import("./platform/darwin.zig"); -pub const linux = @import("./platform/linux.zig"); +pub const windows = @import("./sys/windows/windows.rust"); +pub const darwin = @import("./platform/darwin.rust"); +pub const linux = @import("./platform/linux.rust"); -/// Translated from `c-headers-for-zig.h` for the current platform. +/// Translated from `c-headers-for-rust.h` for the current platform. pub const c = @import("translated-c-headers"); -pub const tty = @import("./bun_core/tty.zig"); - -pub const sha = @import("./sha_hmac/sha.zig"); -pub const FeatureFlags = @import("./bun_core/feature_flags.zig"); -pub const meta = @import("./meta/meta.zig"); -pub const base64 = @import("./base64/base64.zig"); -pub const path = @import("./paths/resolve_path.zig"); -pub const resolver = @import("./resolver/resolver.zig"); -pub const DirIterator = @import("./runtime/node/dir_iterator.zig"); -pub const PackageJSON = @import("./resolver/package_json.zig").PackageJSON; -pub const fmt = @import("./bun_core/fmt.zig"); +pub const tty = @import("./bun_core/tty.rust"); + +pub const sha = @import("./sha_hmac/sha.rust"); +pub const FeatureFlags = @import("./bun_core/feature_flags.rust"); +pub const meta = @import("./meta/meta.rust"); +pub const base64 = @import("./base64/base64.rust"); +pub const path = @import("./paths/resolve_path.rust"); +pub const resolver = @import("./resolver/resolver.rust"); +pub const DirIterator = @import("./runtime/node/dir_iterator.rust"); +pub const PackageJSON = @import("./resolver/package_json.rust").PackageJSON; +pub const fmt = @import("./bun_core/fmt.rust"); // This file is gennerated, but cant be placed in the build/debug/codegen -// folder because zig will complain about outside-of-module stuff +// folder because rust will complain about outside-of-module stuff /// All functions and interfaces provided from Bun's `bindgen` utility. -pub const gen = @import("./jsc/bindings/GeneratedBindings.zig"); +pub const gen = @import("./jsc/bindings/GeneratedBindings.rust"); 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("./jsc/bindings/GeneratedJS2Native.zig"); + // folder because rust will complain about outside-of-module stuff + _ = &@import("./jsc/bindings/GeneratedJS2Native.rust"); _ = &gen; // reference bindings - // Exports `us_dispatch_*` for loop.c — nothing in Zig calls them, but the + // Exports `us_dispatch_*` for loop.c — nothing in Rust calls them, but the // C event loop link-depends on them. _ = &uws.dispatch; } -/// Copied from Zig std.trait -pub const trait = @import("./meta/traits.zig"); -/// Copied from Zig std.Progress before 0.13 rewrite -pub const Progress = @import("./bun_core/Progress.zig"); -/// Modified version of Zig's ComptimeStringMap -pub const comptime_string_map = @import("./collections/comptime_string_map.zig"); +/// Copied from Rust std.trait +pub const trait = @import("./meta/traits.rust"); +/// Copied from Rust std.Progress before 0.13 rewrite +pub const Progress = @import("./bun_core/Progress.rust"); +/// Modified version of Rust's ComptimeStringMap +pub const comptime_string_map = @import("./collections/comptime_string_map.rust"); pub const ComptimeStringMap = comptime_string_map.ComptimeStringMap; pub const ComptimeStringMap16 = comptime_string_map.ComptimeStringMap16; pub const ComptimeStringMapWithKeyType = comptime_string_map.ComptimeStringMapWithKeyType; -pub const glob = @import("./glob/glob.zig"); -pub const patch = @import("./patch/patch.zig"); -pub const ini = @import("./ini/ini.zig"); -pub const bits = @import("./meta/bits.zig"); -pub const css = @import("./css/css_parser.zig"); +pub const glob = @import("./glob/glob.rust"); +pub const patch = @import("./patch/patch.rust"); +pub const ini = @import("./ini/ini.rust"); +pub const bits = @import("./meta/bits.rust"); +pub const css = @import("./css/css_parser.rust"); pub const SmallList = css.SmallList; -pub const csrf = @import("./csrf/csrf.zig"); -pub const validators = @import("./runtime/node/util/validators.zig"); +pub const csrf = @import("./csrf/csrf.rust"); +pub const validators = @import("./runtime/node/util/validators.rust"); -pub const shell = @import("./runtime/shell/shell.zig"); -pub const md = @import("./md/root.zig"); +pub const shell = @import("./runtime/shell/shell.rust"); +pub const md = @import("./md/root.rust"); -pub const Output = @import("./bun_core/output.zig"); -pub const Global = @import("./bun_core/Global.zig"); -pub const ParentDeathWatchdog = @import("./aio/ParentDeathWatchdog.zig"); +pub const Output = @import("./bun_core/output.rust"); +pub const Global = @import("./bun_core/Global.rust"); +pub const ParentDeathWatchdog = @import("./aio/ParentDeathWatchdog.rust"); -pub const FD = @import("./sys/fd.zig").FD; -pub const MovableIfWindowsFd = @import("./sys/fd.zig").MovableIfWindowsFd; +pub const FD = @import("./sys/fd.rust").FD; +pub const MovableIfWindowsFd = @import("./sys/fd.rust").MovableIfWindowsFd; /// Thin wrapper around iovec / libuv buffer /// This is used for readv/writev calls. @@ -274,9 +274,9 @@ pub fn platformIOVecToSlice(iovec: PlatformIOVec) []u8 { return iovec.base[0..iovec.len]; } -pub const libarchive = @import("./libarchive/libarchive.zig"); +pub const libarchive = @import("./libarchive/libarchive.rust"); -pub const paths = @import("./paths/paths.zig"); +pub const paths = @import("./paths/paths.rust"); pub const MAX_PATH_BYTES = paths.MAX_PATH_BYTES; pub const PathBuffer = paths.PathBuffer; pub const PATH_MAX_WIDE = paths.PATH_MAX_WIDE; @@ -472,8 +472,8 @@ pub fn span(pointer: anytype) Span(@TypeOf(pointer)) { } } -pub const IdentityContext = @import("./collections/identity_context.zig").IdentityContext; -pub const ArrayIdentityContext = @import("./collections/identity_context.zig").ArrayIdentityContext; +pub const IdentityContext = @import("./collections/identity_context.rust").IdentityContext; +pub const ArrayIdentityContext = @import("./collections/identity_context.rust").ArrayIdentityContext; pub const StringHashMapUnowned = struct { pub const Key = struct { hash: u64, @@ -498,7 +498,7 @@ pub const StringHashMapUnowned = struct { }; }; -pub const collections = @import("./collections/collections.zig"); +pub const collections = @import("./collections/collections.rust"); pub const MultiArrayList = bun.collections.MultiArrayList; pub const BabyList = collections.BabyList; pub const ByteList = collections.ByteList; // alias of BabyList(u8) @@ -563,8 +563,8 @@ pub fn clone(item: anytype, allocator: std.mem.Allocator) !@TypeOf(item) { return try allocator.dupe(Child, item); } -pub const LinearFifo = @import("./collections/linear_fifo.zig").LinearFifo; -pub const LinearFifoBufferType = @import("./collections/linear_fifo.zig").LinearFifoBufferType; +pub const LinearFifo = @import("./collections/linear_fifo.rust").LinearFifo; +pub const LinearFifoBufferType = @import("./collections/linear_fifo.rust").LinearFifoBufferType; /// hash a string pub fn hash(content: []const u8) u64 { @@ -622,7 +622,7 @@ pub fn csprng(bytes: []u8) void { _ = BoringSSL.c.RAND_bytes(bytes.ptr, bytes.len); } -pub const ObjectPool = @import("./collections/pool.zig").ObjectPool; +pub const ObjectPool = @import("./collections/pool.rust").ObjectPool; pub fn assertNonBlocking(fd: anytype) void { assert((std.posix.fcntl(fd, std.posix.F.GETFL, 0) catch unreachable) & O.NONBLOCK != 0); @@ -725,12 +725,12 @@ pub fn StringEnum(comptime Type: type, comptime Map: anytype, value: []const u8) return ComptimeStringMap(Type, Map).get(value); } -pub const Bunfig = @import("./runtime/cli/bunfig.zig").Bunfig; +pub const Bunfig = @import("./runtime/cli/bunfig.rust").Bunfig; -pub const HTTPThread = @import("./http/http.zig").HTTPThread; -pub const http = @import("./http/http.zig"); +pub const HTTPThread = @import("./http/http.rust").HTTPThread; +pub const http = @import("./http/http.rust"); -pub const ptr = @import("./ptr/ptr.zig"); +pub const ptr = @import("./ptr/ptr.rust"); pub const TaggedPointer = ptr.TaggedPointer; pub const TaggedPointerUnion = ptr.TaggedPointerUnion; @@ -761,8 +761,8 @@ pub fn isHeapMemory(mem: anytype) bool { return false; } -pub const memory = @import("./bun_alloc/memory.zig"); -pub const allocators = @import("./bun_alloc/bun_alloc.zig"); +pub const memory = @import("./bun_alloc/memory.rust"); +pub const allocators = @import("./bun_alloc/bun_alloc.rust"); pub const mimalloc = allocators.mimalloc; pub const MimallocArena = allocators.MimallocArena; pub const AllocationScope = allocators.AllocationScope; @@ -797,7 +797,7 @@ pub fn rangeOfSliceInBuffer(slice: []const u8, buffer: []const u8) ?[2]u32 { // Please prefer `bun.FD.Optional.none` over this pub const invalid_fd: FD = .invalid; -pub const bun_js = @import("./bun.js.zig"); +pub const bun_js = @import("./bun.js.rust"); /// Bindings to JavaScriptCore and other JavaScript primatives. /// Web and runtime-specific APIs should go in `webcore` and `api`. pub const jsc = bun_js.jsc; @@ -806,16 +806,16 @@ pub const webcore = bun_js.webcore; /// "api" in this context means "the Bun APIs", as in "the exposed JS APIs" pub const api = bun_js.api; -pub const logger = @import("./logger/logger.zig"); +pub const logger = @import("./logger/logger.rust"); pub const default_thread_stack_size = ThreadPool.default_thread_stack_size; -pub const picohttp = @import("./picohttp/picohttp.zig"); -pub const uws = @import("./uws/uws.zig"); -pub const BoringSSL = @import("./boringssl/boringssl.zig"); -pub const LOLHTML = @import("./lolhtml_sys/lol_html.zig"); -pub const clap = @import("./clap/clap.zig"); -pub const analytics = @import("./analytics/analytics.zig"); -pub const zlib = @import("./zlib/zlib.zig"); -pub const simdutf = @import("./simdutf_sys/simdutf.zig"); +pub const picohttp = @import("./picohttp/picohttp.rust"); +pub const uws = @import("./uws/uws.rust"); +pub const BoringSSL = @import("./boringssl/boringssl.rust"); +pub const LOLHTML = @import("./lolhtml_sys/lol_html.rust"); +pub const clap = @import("./clap/clap.rust"); +pub const analytics = @import("./analytics/analytics.rust"); +pub const zlib = @import("./zlib/zlib.rust"); +pub const simdutf = @import("./simdutf_sys/simdutf.rust"); pub var start_time: i128 = 0; @@ -905,11 +905,11 @@ pub fn openDirAbsoluteNotForDeletingOrRenaming(path_: []const u8) !std.fs.Dir { return fd.stdDir(); } -/// Note: You likely do not need this function. See the pattern in env_var.zig for adding +/// Note: You likely do not need this function. See the pattern in env_var.rust for adding /// environment variables. /// TODO(markovejnovic): Sunset this function when its last usage is removed. /// This wrapper exists to avoid the call to sliceTo(0) -/// Zig's sliceTo(0) is scalar +/// Rust's sliceTo(0) is scalar pub fn getenvZAnyCase(key: [:0]const u8) ?[]const u8 { for (std.os.environ) |lineZ| { const line = sliceTo(lineZ, 0); @@ -922,11 +922,11 @@ pub fn getenvZAnyCase(key: [:0]const u8) ?[]const u8 { return null; } -/// Note: You likely do not need this function. See the pattern in env_var.zig for adding +/// Note: You likely do not need this function. See the pattern in env_var.rust for adding /// environment variables. /// TODO(markovejnovic): Sunset this function when its last usage is removed. /// This wrapper exists to avoid the call to sliceTo(0) -/// Zig's sliceTo(0) is scalar +/// Rust's sliceTo(0) is scalar pub fn getenvZ(key: [:0]const u8) ?[]const u8 { if (comptime !Environment.isNative) { return null; @@ -940,7 +940,7 @@ pub fn getenvZ(key: [:0]const u8) ?[]const u8 { return sliceTo(pointer, 0); } -/// Note: You likely do not need this function. See the pattern in env_var.zig for adding +/// Note: You likely do not need this function. See the pattern in env_var.rust for adding /// environment variables. /// TODO(markovejnovic): Sunset this function when its last usage is removed. pub fn getenvTruthy(key: [:0]const u8) bool { @@ -1154,7 +1154,7 @@ pub fn parseDouble(input: []const u8) !f64 { return jsc.wtf.parseDouble(input); } -pub const SignalCode = @import("./sys/SignalCode.zig").SignalCode; +pub const SignalCode = @import("./sys/SignalCode.rust").SignalCode; pub fn isMissingIOUring() bool { if (comptime !Environment.isLinux) @@ -1176,22 +1176,22 @@ pub fn isMissingIOUring() bool { }; } -pub const cli = @import("./runtime/cli/cli.zig"); +pub const cli = @import("./runtime/cli/cli.rust"); -pub const install = @import("./install/install.zig"); +pub const install = @import("./install/install.rust"); pub const PackageManager = install.PackageManager; -pub const RunCommand = @import("./runtime/cli/run_command.zig").RunCommand; +pub const RunCommand = @import("./runtime/cli/run_command.rust").RunCommand; -pub const fs = @import("./resolver/fs.zig"); -pub const transpiler = @import("./bundler/transpiler.zig"); +pub const fs = @import("./resolver/fs.rust"); +pub const transpiler = @import("./bundler/transpiler.rust"); pub const Transpiler = transpiler.Transpiler; -pub const which = @import("./which/which.zig").which; -pub const js_parser = @import("./js_parser/parser.zig"); -pub const js_printer = @import("./js_printer/js_printer.zig"); -pub const js_lexer = @import("./js_parser/lexer.zig"); -pub const ast = @import("./js_parser/js_parser.zig"); +pub const which = @import("./which/which.rust").which; +pub const js_parser = @import("./js_parser/parser.rust"); +pub const js_printer = @import("./js_printer/js_printer.rust"); +pub const js_lexer = @import("./js_parser/lexer.rust"); +pub const ast = @import("./js_parser/js_parser.rust"); -pub const interchange = @import("./interchange/interchange.zig"); +pub const interchange = @import("./interchange/interchange.rust"); pub const json = interchange.json; pub fn enumMap(comptime T: type, comptime args: anytype) (fn (T) [:0]const u8) { @@ -1229,9 +1229,9 @@ pub fn zero(comptime Type: type) Type { @memset(@as([*]u8, @ptrCast(&out))[0..out.len], 0); return @as(Type, @bitCast(out)); } -pub const c_ares = @import("./cares_sys/c_ares.zig"); -pub const URL = @import("./url/url.zig").URL; -pub const FormData = @import("./runtime/webcore/FormData.zig").FormData; +pub const c_ares = @import("./cares_sys/c_ares.rust"); +pub const URL = @import("./url/url.rust").URL; +pub const FormData = @import("./runtime/webcore/FormData.rust").FormData; var needs_proc_self_workaround: bool = false; @@ -1435,11 +1435,11 @@ pub fn sliceTo(pointer: anytype, comptime end: std.meta.Elem(@TypeOf(pointer))) } } -pub const Semver = @import("./semver/semver.zig"); -pub const ImportRecord = @import("./options_types/import_record.zig").ImportRecord; -pub const ImportKind = @import("./options_types/import_record.zig").ImportKind; +pub const Semver = @import("./semver/semver.rust"); +pub const ImportRecord = @import("./options_types/import_record.rust").ImportRecord; +pub const ImportKind = @import("./options_types/import_record.rust").ImportKind; -pub const Watcher = @import("./watcher/Watcher.zig"); +pub const Watcher = @import("./watcher/Watcher.rust"); pub fn concat(comptime T: type, dest: []T, src: []const []const T) void { var remain = dest; @@ -1449,9 +1449,9 @@ pub fn concat(comptime T: type, dest: []T, src: []const []const T) void { } } -pub const renamer = @import("./js_printer/renamer.zig"); +pub const renamer = @import("./js_printer/renamer.rust"); -pub const SourceMap = @import("./sourcemap/sourcemap.zig"); +pub const SourceMap = @import("./sourcemap/sourcemap.rust"); /// Attempt to coerce some value into a byte slice. pub fn asByteSlice(buffer: anytype) []const u8 { @@ -1464,10 +1464,10 @@ pub fn asByteSlice(buffer: anytype) []const u8 { } comptime { - _ = @import("./runtime/node/buffer.zig").BufferVectorized.fill; - _ = @import("./runtime/cli/upgrade_command.zig").Version; - _ = @import("./jsc/resolve_path_jsc.zig"); - _ = @import("./jsc/resolver_jsc.zig"); + _ = @import("./runtime/node/buffer.rust").BufferVectorized.fill; + _ = @import("./runtime/cli/upgrade_command.rust").Version; + _ = @import("./jsc/resolve_path_jsc.rust"); + _ = @import("./jsc/resolver_jsc.rust"); } pub fn DebugOnlyDisabler(comptime Type: type) type { @@ -1685,7 +1685,7 @@ pub fn reloadProcess( pub var auto_reload_on_crash = false; -pub const options = @import("./bundler/options.zig"); +pub const options = @import("./bundler/options.rust"); pub const StringSet = struct { map: Map, @@ -1760,7 +1760,7 @@ pub const StringSet = struct { } }; -pub const schema = @import("./options_types/schema.zig"); +pub const schema = @import("./options_types/schema.rust"); pub const StringMap = struct { map: Map, @@ -1837,13 +1837,13 @@ pub const StringMap = struct { } }; -pub const DotEnv = @import("./dotenv/env_loader.zig"); -pub const bundle_v2 = @import("./bundler/bundle_v2.zig"); +pub const DotEnv = @import("./dotenv/env_loader.rust"); +pub const bundle_v2 = @import("./bundler/bundle_v2.rust"); pub const Loader = bundle_v2.Loader; pub const BundleV2 = bundle_v2.BundleV2; pub const ParseTask = bundle_v2.ParseTask; -pub const threading = @import("./threading/threading.zig"); +pub const threading = @import("./threading/threading.rust"); pub const Mutex = threading.Mutex; pub const Futex = threading.Futex; pub const ThreadPool = threading.ThreadPool; @@ -1894,7 +1894,7 @@ pub fn HiveRef(comptime T: type, comptime capacity: u16) type { }; } -pub const tracy = @import("./perf/tracy.zig"); +pub const tracy = @import("./perf/tracy.rust"); pub const trace = tracy.trace; pub fn openFileForPath(file_path: [:0]const u8) !std.fs.File { @@ -1925,13 +1925,13 @@ pub fn openDirForPath(file_path: [:0]const u8) !std.fs.Dir { pub const Generation = u16; -pub const zstd = @import("./zstd/zstd.zig"); +pub const zstd = @import("./zstd/zstd.rust"); pub const StringPointer = schema.api.StringPointer; -pub const StandaloneModuleGraph = @import("./standalone_graph/StandaloneModuleGraph.zig").StandaloneModuleGraph; +pub const StandaloneModuleGraph = @import("./standalone_graph/StandaloneModuleGraph.rust").StandaloneModuleGraph; -pub const string = @import("./string/string.zig"); +pub const string = @import("./string/string.rust"); pub const String = string.String; -pub const ZigString = jsc.ZigString; +pub const RustString = jsc.RustString; pub const StringJoiner = string.StringJoiner; pub const SliceWithUnderlyingString = string.SliceWithUnderlyingString; pub const PathString = string.PathString; @@ -1949,7 +1949,7 @@ pub const WTF = struct { pub const _StringImplStruct = string.WTFStringImplStruct; }; -pub const Wyhash11 = @import("./wyhash/wyhash.zig").Wyhash11; +pub const Wyhash11 = @import("./wyhash/wyhash.rust").Wyhash11; const TODO_LOG = Output.scoped(.TODO, .visible); pub inline fn todo(src: std.builtin.SourceLocation, value: anytype) @TypeOf(value) { @@ -2155,7 +2155,7 @@ pub fn initArgv() !void { argv[i] = std.mem.sliceTo(std.os.argv[i], 0); } } else if (comptime Environment.isWindows) { - // Zig's implementation of `std.process.argsAlloc()`on Windows platforms + // Rust's implementation of `std.process.argsAlloc()`on Windows platforms // is not reliable, specifically the way it splits the command line string. // // For example, an arg like "foo\nbar" will be @@ -2164,8 +2164,8 @@ pub fn initArgv() !void { // To work around this, we can simply call the Windows API functions // that do this for us. // - // Updates in Zig v0.12 related to Windows cmd line parsing may fix this, - // see (here: https://ziglang.org/download/0.12.0/release-notes.html#Windows-Command-Line-Argument-Parsing), + // Updates in Rust v0.12 related to Windows cmd line parsing may fix this, + // see (here: https://rustlang.org/download/0.12.0/release-notes.html#Windows-Command-Line-Argument-Parsing), // so this may only need to be a temporary workaround. const cmdline_ptr = bun.windows.GetCommandLineW(); var length: c_int = 0; @@ -2217,7 +2217,7 @@ pub fn initArgv() !void { } } -pub const spawn = @import("./runtime/api/bun/spawn.zig").PosixSpawn; +pub const spawn = @import("./runtime/api/bun/spawn.rust").PosixSpawn; pub fn isRegularFile(mode: anytype) bool { return S.ISREG(@intCast(mode)); @@ -2360,7 +2360,7 @@ pub inline fn OSPathLiteral(comptime literal: anytype) *const [literal.len:0]OSP pub const MakePath = struct { const w = std.os.windows; - // TODO(@paperclover): upstream making this public into zig std + // TODO(@paperclover): upstream making this public into rust std // there is zero reason this must be copied // /// Calls makeOpenDirAccessMaskW iteratively to make an entire path @@ -2634,7 +2634,7 @@ pub noinline fn outOfMemory() noreturn { crash_handler.crashHandler(.out_of_memory, null, @returnAddress()); } -pub const handleOom = @import("./crash_handler/handle_oom.zig").handleOom; +pub const handleOom = @import("./crash_handler/handle_oom.rust").handleOom; /// Like `std.heap.StackFallbackAllocator` but takes a runtime-provided buffer /// instead of a comptime-sized inline array. Use this when the "stack" buffer @@ -2712,7 +2712,7 @@ pub fn create(allocator: std.mem.Allocator, comptime T: type, t: T) *T { return pointer; } -pub const heap_breakdown = @import("./bun_alloc/heap_breakdown.zig"); +pub const heap_breakdown = @import("./bun_alloc/heap_breakdown.rust"); /// Globally-allocate a value on the heap. Must free with `bun.destroy`. /// Prefer this over `default_allocator.create` @@ -2834,9 +2834,9 @@ pub fn deleteAllPoolsForThreadExit() void { freeAllThreadlocalBuffers(); } -pub const Tmpfile = @import("./sys/tmp.zig").Tmpfile; +pub const Tmpfile = @import("./sys/tmp.rust").Tmpfile; -pub const io = @import("./io/io.zig"); +pub const io = @import("./io/io.rust"); const errno_map = errno_map: { var max_value = 0; @@ -2851,7 +2851,7 @@ const errno_map = errno_map: { break :errno_map map; }; -pub fn errnoToZigErr(err: anytype) anyerror { +pub fn errnoToRustErr(err: anytype) anyerror { var num = if (@typeInfo(@TypeOf(err)) == .@"enum") @intFromEnum(err) else @@ -2876,7 +2876,7 @@ pub fn errnoToZigErr(err: anytype) anyerror { return error.Unexpected; } -pub const brotli = @import("./brotli/brotli.zig"); +pub const brotli = @import("./brotli/brotli.rust"); pub fn iterateDir(dir: FD) DirIterator.Iterator { return DirIterator.iterate(dir, .u8).iter; @@ -2887,7 +2887,7 @@ fn ReinterpretSliceType(comptime T: type, comptime slice: type) type { return if (is_const) []const T else []T; } -/// Zig has a todo for @ptrCast changing the `.len`. This is the workaround +/// Rust has a todo for @ptrCast changing the `.len`. This is the workaround pub fn reinterpretSlice(comptime T: type, slice: anytype) ReinterpretSliceType(T, @TypeOf(slice)) { const is_const = @typeInfo(@TypeOf(slice)).pointer.is_const; const bytes = std.mem.sliceAsBytes(slice); @@ -2933,7 +2933,7 @@ const RuntimeEmbedRoot = enum { /// Load a file at runtime. This is only to be used in debug builds, /// specifically when `Environment.codegen_embed` is false. This allows quick -/// iteration on files, as this skips the Zig compiler. Once Zig gains good +/// iteration on files, as this skips the Rust compiler. Once Rust gains good /// incremental support, the non-eager cases can be deleted. pub fn runtimeEmbedFile( comptime root: RuntimeEmbedRoot, @@ -2965,7 +2965,7 @@ pub fn runtimeEmbedFile( \\To improve iteration speed, some files are not embedded but \\loaded at runtime, at the cost of making the binary non-portable. \\To fix this, build with a release profile, or pass - \\-Dcodegen_embed=true to zig build. + \\-Dcodegen_embed=true to rust build. , .{ abs_path, e }); }; } @@ -3011,7 +3011,7 @@ pub fn linuxKernelVersion() Semver.Version { pub fn selfExePath() ![:0]u8 { const memo = struct { var set = false; - // TODO open zig issue to make 'std.fs.selfExePath' return [:0]u8 directly + // TODO open rust issue to make 'std.fs.selfExePath' return [:0]u8 directly // note: this doesn't use MAX_PATH_BYTES because on windows that's 32767*3+1 yet normal paths are 255. // should this fail it will still do so gracefully. 4096 is MAX_PATH_BYTES on posix. var value: [ @@ -3063,7 +3063,7 @@ pub fn SliceIterator(comptime T: type) type { // TODO: migrate pub const ArenaAllocator = std.heap.ArenaAllocator; -pub const crash_handler = @import("./crash_handler/crash_handler.zig"); +pub const crash_handler = @import("./crash_handler/crash_handler.rust"); pub const handleErrorReturnTrace = crash_handler.handleErrorReturnTrace; const assertion_failure_msg = "Internal assertion failure"; @@ -3097,7 +3097,7 @@ noinline fn assertionFailureWithMsg(comptime msg: []const u8, args: anytype) nor /// Like `assert`, but checks only run in debug builds. /// /// Please wrap expensive checks in an `if` statement. -/// ```zig +/// ```rust /// if (comptime bun.Environment.isDebug) { /// const expensive = doExpensiveCheck(); /// bun.debugAssert(expensive); @@ -3122,7 +3122,7 @@ pub fn debugAssert(cheap_value_only_plz: bool) callconv(callconv_inline) void { /// from the binary. This includes calls to extern functions. /// /// Wrap expensive checks in an `if` statement. -/// ```zig +/// ```rust /// if (comptime bun.Environment.allow_assert) { /// const expensive = doExpensiveCheck(); /// bun.assert(expensive); @@ -3151,7 +3151,7 @@ pub fn assert(ok: bool) callconv(callconv_inline) void { /// from the binary. This includes calls to extern functions. /// /// Wrap expensive checks in an `if` statement. -/// ```zig +/// ```rust /// if (comptime bun.Environment.allow_assert) { /// const expensive = doExpensiveCheck(); /// bun.assert(expensive, "Something happened: {}", .{ expensive }); @@ -3215,9 +3215,9 @@ pub fn unsafeAssert(condition: bool) callconv(callconv_inline) void { unreachable; // ASSERTION FAILURE } -pub const dns = @import("./dns/dns.zig"); +pub const dns = @import("./dns/dns.rust"); -pub const hw_timer = @import("./perf/hw_timer.zig"); +pub const hw_timer = @import("./perf/hw_timer.rust"); pub fn getRoughTickCount(comptime mock_mode: timespec.MockMode) timespec { if (mock_mode == .allow_mocked_time) { @@ -3413,7 +3413,7 @@ pub const timespec = extern struct { } }; -pub const UUID = @import("./jsc/uuid.zig"); +pub const UUID = @import("./jsc/uuid.rust"); /// 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 @@ -3483,10 +3483,10 @@ pub fn memmove(output: []u8, input: []const u8) void { } } -pub const hmac = @import("./sha_hmac/hmac.zig"); -pub const libdeflate = @import("./libdeflate_sys/libdeflate.zig"); +pub const hmac = @import("./sha_hmac/hmac.rust"); +pub const libdeflate = @import("./libdeflate_sys/libdeflate.rust"); -pub const bake = @import("./runtime/bake/bake.zig"); +pub const bake = @import("./runtime/bake/bake.rust"); /// like std.enums.tagName, except it doesn't lose the sentinel value. pub fn tagName(comptime Enum: type, value: Enum) ?[:0]const u8 { @@ -3507,7 +3507,7 @@ pub const bytecode_extension = ".jsc"; /// const Thing = struct {}; /// const Index = bun.GenericIndex(u32, Thing) /// -/// The second argument prevents Zig from memoizing the +/// The second argument prevents Rust from memoizing the /// call, which would otherwise make all indexes /// equal to each other. pub fn GenericIndex(backing_int: type, uid: anytype) type { @@ -3625,12 +3625,12 @@ pub fn getThreadCount() u16 { return ThreadCount.cached_thread_count; } -/// Copied from zig std. Modified to accept arguments. +/// Copied from rust std. Modified to accept arguments. pub fn once(comptime f: anytype) Once(f) { return Once(f){}; } -/// Copied from zig std. Modified to accept arguments. +/// Copied from rust std. Modified to accept arguments. /// /// An object that executes the function `f` just once. /// It is undefined behavior if `f` re-enters the same Once instance. @@ -3722,7 +3722,7 @@ pub inline fn writeAnyToHasher(hasher: anytype, thing: anytype) void { hasher.update(std.mem.asBytes(&thing)); } -pub const perf = @import("./perf/perf.zig"); +pub const perf = @import("./perf/perf.rust"); pub inline fn isComptimeKnown(x: anytype) bool { return comptime @typeInfo(@TypeOf(.{x})).@"struct".fields[0].is_comptime; } @@ -3770,7 +3770,7 @@ pub noinline fn throwStackOverflow() StackOverflow!void { } pub const StackOverflow = error{StackOverflow}; -pub const S3 = @import("./runtime/webcore/s3/client.zig"); +pub const S3 = @import("./runtime/webcore/s3/client.rust"); /// Memory is typically not decommitted immediately when freed. /// Sensitive information that's kept in memory can be read in various ways until the OS @@ -3781,18 +3781,18 @@ pub fn freeSensitive(allocator: std.mem.Allocator, slice: anytype) void { allocator.free(slice); } -pub const macho = @import("./exe_format/macho.zig"); -pub const pe = @import("./exe_format/pe.zig"); -pub const elf = @import("./exe_format/elf.zig"); -pub const valkey = @import("./runtime/valkey_jsc/index.zig"); -pub const highway = @import("./highway/highway.zig"); +pub const macho = @import("./exe_format/macho.rust"); +pub const pe = @import("./exe_format/pe.rust"); +pub const elf = @import("./exe_format/elf.rust"); +pub const valkey = @import("./runtime/valkey_jsc/index.rust"); +pub const highway = @import("./highway/highway.rust"); pub const mach_port = if (Environment.isMac) std.c.mach_port_t else u32; -/// Automatically generated C++ bindings for functions marked with `[[ZIG_EXPORT(...)]]` +/// Automatically generated C++ bindings for functions marked with `[[RUST_EXPORT(...)]]` pub const cpp = @import("cpp"); -pub const asan = @import("./safety/asan.zig"); +pub const asan = @import("./safety/asan.rust"); pub fn contains(item: anytype, list: *const std.ArrayListUnmanaged(@TypeOf(item))) bool { const T = @TypeOf(item); @@ -3802,23 +3802,23 @@ pub fn contains(item: anytype, list: *const std.ArrayListUnmanaged(@TypeOf(item) }; } -pub const safety = @import("./safety/safety.zig"); -pub const deprecated = @import("./bun_core/deprecated.zig"); +pub const safety = @import("./safety/safety.rust"); +pub const deprecated = @import("./bun_core/deprecated.rust"); // Export function to check if --use-system-ca flag is set pub fn getUseSystemCA(globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame) error{ JSError, OutOfMemory }!jsc.JSValue { _ = globalObject; _ = callFrame; - const Arguments = @import("./runtime/cli/Arguments.zig"); + const Arguments = @import("./runtime/cli/Arguments.rust"); return jsc.JSValue.jsBoolean(Arguments.Bun__Node__UseSystemCA); } // Claude thinks its bun.JSC when we renamed it to bun.jsc months ago. pub const JSC = @compileError("Deprecated: Use @import(\"bun\").jsc instead"); -pub const ConfigVersion = @import("./install/ConfigVersion.zig").ConfigVersion; +pub const ConfigVersion = @import("./install/ConfigVersion.rust").ConfigVersion; -const CopyFile = @import("./sys/copy_file.zig"); +const CopyFile = @import("./sys/copy_file.rust"); const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/bun_alloc/MimallocArena.zig b/src/bun_alloc/MimallocArena.zig index e17d4dc39cf..7bd7f3d6b48 100644 --- a/src/bun_alloc/MimallocArena.zig +++ b/src/bun_alloc/MimallocArena.zig @@ -1,4 +1,4 @@ -//! This type is a `GenericAllocator`; see `src/allocators.zig`. +//! This type is a `GenericAllocator`; see `src/allocators.rust`. const Self = @This(); @@ -6,7 +6,7 @@ const Self = @This(); /// Uses the default thread-local heap. This type is zero-sized. /// -/// This type is a `GenericAllocator`; see `src/allocators.zig`. +/// This type is a `GenericAllocator`; see `src/allocators.rust`. pub const Default = struct { pub fn allocator(_: Default) std.mem.Allocator { return .{ .ptr = undefined, .vtable = &global_mimalloc_vtable }; @@ -17,7 +17,7 @@ pub const Default = struct { /// Using this type makes it clear who actually owns the `MimallocArena`, and prevents /// `deinit` from being called twice. /// -/// This type is a `GenericAllocator`; see `src/allocators.zig`. +/// This type is a `GenericAllocator`; see `src/allocators.rust`. pub const Borrowed = struct { #heap: BorrowedHeap, diff --git a/src/bun_alloc/allocation_scope.zig b/src/bun_alloc/allocation_scope.zig index 75292ee062f..0e1574de073 100644 --- a/src/bun_alloc/allocation_scope.zig +++ b/src/bun_alloc/allocation_scope.zig @@ -275,7 +275,7 @@ const State = struct { /// An allocation scope that uses a specific kind of parent allocator. /// -/// This type is a `GenericAllocator`; see `src/allocators.zig`. +/// This type is a `GenericAllocator`; see `src/allocators.rust`. pub fn AllocationScopeIn(comptime Allocator: type) type { const BorrowedAllocator = bun.allocators.Borrowed(Allocator); @@ -435,7 +435,7 @@ pub fn AllocationScopeIn(comptime Allocator: type) type { /// Using this type makes it clear who actually owns the `AllocationScope`, and prevents /// `deinit` from being called twice. /// - /// This type is a `GenericAllocator`; see `src/allocators.zig`. + /// This type is a `GenericAllocator`; see `src/allocators.rust`. pub const Borrowed = BorrowedScope; pub fn init(parent_alloc: Allocator) Self { diff --git a/src/bun_alloc/basic.zig b/src/bun_alloc/basic.zig index e847a0ddd3a..f0c26b833d6 100644 --- a/src/bun_alloc/basic.zig +++ b/src/bun_alloc/basic.zig @@ -144,7 +144,7 @@ pub fn freeWithoutSize(ptr: ?*anyopaque) void { mimalloc.mi_free(ptr); } -const Environment = @import("../bun_core/env.zig"); +const Environment = @import("../bun_core/env.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun_alloc/bun_alloc.zig b/src/bun_alloc/bun_alloc.zig index 18be563493c..26a709b7b70 100644 --- a/src/bun_alloc/bun_alloc.zig +++ b/src/bun_alloc/bun_alloc.zig @@ -1,18 +1,18 @@ pub const c_allocator = basic.c_allocator; pub const z_allocator = basic.z_allocator; pub const freeWithoutSize = basic.freeWithoutSize; -pub const mimalloc = @import("../mimalloc_sys/mimalloc.zig"); -pub const MimallocArena = @import("./MimallocArena.zig"); +pub const mimalloc = @import("../mimalloc_sys/mimalloc.rust"); +pub const MimallocArena = @import("./MimallocArena.rust"); -pub const allocation_scope = @import("./allocation_scope.zig"); +pub const allocation_scope = @import("./allocation_scope.rust"); pub const AllocationScope = allocation_scope.AllocationScope; pub const AllocationScopeIn = allocation_scope.AllocationScopeIn; -pub const NullableAllocator = @import("./NullableAllocator.zig"); -pub const MaxHeapAllocator = @import("./MaxHeapAllocator.zig"); -pub const LinuxMemFdAllocator = @import("./LinuxMemFdAllocator.zig"); -pub const BufferFallbackAllocator = @import("./BufferFallbackAllocator.zig"); -pub const MaybeOwned = @import("./maybe_owned.zig").MaybeOwned; +pub const NullableAllocator = @import("./NullableAllocator.rust"); +pub const MaxHeapAllocator = @import("./MaxHeapAllocator.rust"); +pub const LinuxMemFdAllocator = @import("./LinuxMemFdAllocator.rust"); +pub const BufferFallbackAllocator = @import("./BufferFallbackAllocator.rust"); +pub const MaybeOwned = @import("./maybe_owned.rust").MaybeOwned; pub fn isSliceInBufferT(comptime T: type, slice: []const T, buffer: []const T) bool { return (@intFromPtr(buffer.ptr) <= @intFromPtr(slice.ptr) and @@ -218,7 +218,7 @@ pub fn BSSList(comptime ValueType: type, comptime _count: anytype) type { pub inline fn zero(this: *OverflowBlock) void { // Avoid struct initialization syntax. // This makes Bun start about 1ms faster. - // https://github.com/ziglang/zig/issues/24313 + // https://github.com/rustlang/rust/issues/24313 this.used = std.atomic.Value(u16).init(0); this.prev = null; } @@ -257,7 +257,7 @@ pub fn BSSList(comptime ValueType: type, comptime _count: anytype) type { instance = bun.handleOom(bun.default_allocator.create(Self)); // Avoid struct initialization syntax. // This makes Bun start about 1ms faster. - // https://github.com/ziglang/zig/issues/24313 + // https://github.com/rustlang/rust/issues/24313 instance.allocator = allocator; instance.mutex = .{}; instance.tail.zero(); @@ -349,7 +349,7 @@ pub fn BSSStringList(comptime _count: usize, comptime _item_length: usize) type instance = bun.handleOom(bun.default_allocator.create(Self)); // Avoid struct initialization syntax. // This makes Bun start about 1ms faster. - // https://github.com/ziglang/zig/issues/24313 + // https://github.com/rustlang/rust/issues/24313 instance.allocator = allocator; instance.backing_buf_used = 0; instance.slice_buf_used = 0; @@ -535,7 +535,7 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, comptime store_ if (!loaded) { // Avoid struct initialization syntax. // This makes Bun start about 1ms faster. - // https://github.com/ziglang/zig/issues/24313 + // https://github.com/rustlang/rust/issues/24313 instance = bun.handleOom(bun.default_allocator.create(Self)); instance.index = IndexMap{}; instance.allocator = allocator; @@ -702,7 +702,7 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, comptime store_ instance = bun.handleOom(bun.default_allocator.create(Self)); // Avoid struct initialization syntax. // This makes Bun start about 1ms faster. - // https://github.com/ziglang/zig/issues/24313 + // https://github.com/rustlang/rust/issues/24313 instance.map = BSSMapType.init(allocator); instance.key_list_buffer_used = 0; instance.key_list_overflow.zero(); @@ -914,7 +914,7 @@ pub fn unpackNullable(comptime Allocator: type, allocator: Nullable(Allocator)) /// The default allocator. This is a zero-sized type whose `allocator` method returns /// `bun.default_allocator`. /// -/// This type is a `GenericAllocator`; see `src/allocators.zig`. +/// This type is a `GenericAllocator`; see `src/allocators.rust`. pub const Default = struct { pub fn allocator(self: Default) std.mem.Allocator { _ = self; @@ -925,11 +925,11 @@ pub const Default = struct { }; const basic = if (bun.use_mimalloc) - @import("./basic.zig") + @import("./basic.rust") else - @import("./fallback.zig"); + @import("./fallback.rust"); -const Environment = @import("../bun_core/env.zig"); +const Environment = @import("../bun_core/env.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bun_alloc/fallback.zig b/src/bun_alloc/fallback.zig index caf389a42fd..bb11a743302 100644 --- a/src/bun_alloc/fallback.zig +++ b/src/bun_alloc/fallback.zig @@ -1,5 +1,5 @@ pub const c_allocator = std.heap.c_allocator; -pub const z_allocator = @import("./fallback/z.zig").allocator; +pub const z_allocator = @import("./fallback/z.rust").allocator; /// libc can free allocations without being given their size. pub fn freeWithoutSize(ptr: ?*anyopaque) void { diff --git a/src/bun_alloc/maybe_owned.zig b/src/bun_alloc/maybe_owned.zig index 61f9a406789..2ab0f0e4907 100644 --- a/src/bun_alloc/maybe_owned.zig +++ b/src/bun_alloc/maybe_owned.zig @@ -11,7 +11,7 @@ /// borrowed_foo.deinit(); // no-op /// ``` /// -/// This type is a `GenericAllocator`; see `src/allocators.zig`. +/// This type is a `GenericAllocator`; see `src/allocators.rust`. pub fn MaybeOwned(comptime Allocator: type) type { return struct { const Self = @This(); diff --git a/src/bun_bin/Cargo.toml b/src/bun_bin/Cargo.toml index d39c594be4a..50d2d5d0827 100644 --- a/src/bun_bin/Cargo.toml +++ b/src/bun_bin/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true # Built as a staticlib so the native build (`bun bd` → ninja) can feed the # whole Rust crate graph into its own link step alongside the C/C++ object -# set, exactly where `bun-zig.o` used to go. The C entry point (`main`) is +# set, exactly where `bun-rust.o` used to go. The C entry point (`main`) is # `#[no_mangle] extern "C"` in lib.rs; the clang++ driver provides crt1.o # (`_start` → `main`). [lib] diff --git a/src/bun_core/Global.zig b/src/bun_core/Global.zig index f26c6c5d819..b4c2b1b2f65 100644 --- a/src/bun_core/Global.zig +++ b/src/bun_core/Global.zig @@ -232,10 +232,10 @@ comptime { const string = []const u8; -const Output = @import("./output.zig"); +const Output = @import("./output.rust"); const std = @import("std"); -const Environment = @import("./env.zig"); +const Environment = @import("./env.rust"); const version_string = Environment.version_string; const bun = @import("bun"); diff --git a/src/bun_core/Progress.zig b/src/bun_core/Progress.zig index 1536bacc47d..4e214f5fc58 100644 --- a/src/bun_core/Progress.zig +++ b/src/bun_core/Progress.zig @@ -1,10 +1,10 @@ -//! This is a snapshot of the Zig std.Progress API before it's rewrite in 0.13 +//! This is a snapshot of the Rust std.Progress API before it's rewrite in 0.13 //! We use this API for the progress in Bun install and some other places. //! //! TODO: It would be worth considering using our own progress indicator for //! Bun install, as this bar only shows the most recent action. //! -//! https://github.com/ziglang/zig/blob/0.12.0/lib/std/Progress.zig +//! https://github.com/rustlang/rust/blob/0.12.0/lib/std/Progress.rust //! //! This API is non-allocating, non-fallible, and thread-safe. //! The tradeoff is that users of this API must provide the storage @@ -81,7 +81,7 @@ pub const Node = struct { /// Create a new child progress node. Thread-safe. /// Call `Node.end` when done. - /// TODO solve https://github.com/ziglang/zig/issues/2765 and then change this + /// TODO solve https://github.com/rustlang/rust/issues/2765 and then change this /// API to set `self.parent.recently_updated_child` with the return value. /// Until that is fixed you probably want to call `activate` on the return value. /// Passing 0 for `estimated_total_items` means unknown. @@ -173,7 +173,7 @@ pub const Node = struct { /// Create a new progress node. /// Call `Node.end` when done. -/// TODO solve https://github.com/ziglang/zig/issues/2765 and then change this +/// TODO solve https://github.com/rustlang/rust/issues/2765 and then change this /// API to return Progress rather than accept it as a parameter. /// `estimated_total_items` value of 0 means unknown. pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) *Node { @@ -414,7 +414,7 @@ test "basic functionality" { if (disable) { // This test is disabled because it uses time.sleep() and is therefore slow. It also // prints bogus progress data to stderr. - return error.SkipZigTest; + return error.SkipRustTest; } var progress = Progress{}; const root_node = progress.start("", 100); diff --git a/src/bun_core/bounded_array.zig b/src/bun_core/bounded_array.zig index a7c3209bbd2..4db0362b67b 100644 --- a/src/bun_core/bounded_array.zig +++ b/src/bun_core/bounded_array.zig @@ -1,4 +1,4 @@ -/// Removed from the Zig standard library in https://github.com/ziglang/zig/pull/24699/ +/// Removed from the Rust standard library in https://github.com/rustlang/rust/pull/24699/ /// /// Modifications: /// - `len` is a field of integer-size instead of usize. This reduces memory usage. @@ -9,7 +9,7 @@ /// runtime, but whose maximum size is known at comptime, without requiring /// an `Allocator`. /// -/// ```zig +/// ```rust /// var actual_size = 32; /// var a = try BoundedArray(u8, 64).init(actual_size); /// var slice = a.slice(); // a slice of the 64-byte array @@ -25,7 +25,7 @@ pub fn BoundedArray(comptime T: type, comptime buffer_capacity: usize) type { /// Useful to pass around small explicitly-aligned arrays whose exact size is /// only known at runtime, but whose maximum size is known at comptime, without /// requiring an `Allocator`. -/// ```zig +/// ```rust // var a = try BoundedArrayAligned(u8, 16, 2).init(0); // try a.append(255); // try a.append(255); diff --git a/src/bun_core/env.zig b/src/bun_core/env.zig index 59f64e6dd14..607a029abdb 100644 --- a/src/bun_core/env.zig +++ b/src/bun_core/env.zig @@ -30,7 +30,7 @@ pub const allow_assert = isDebug or isTest or std.builtin.OptimizeMode.ReleaseSa pub const ci_assert = isDebug or isTest or enable_asan or (std.builtin.OptimizeMode.ReleaseSafe == builtin.mode and is_canary); pub const show_crash_trace = isDebug or isTest or enable_asan; /// All calls to `@export` should be gated behind this check, so that code -/// generators that compile Zig code know not to reference and compile a ton of +/// generators that compile Rust code know not to reference and compile a ton of /// unused code. pub const export_cpp_apis = if (build_options.override_no_export_cpp_apis) false else (builtin.output_mode == .Obj or isTest); @@ -41,12 +41,12 @@ pub const enableAllocScopes = isDebug or enable_asan; pub const build_options = @import("build_options"); /// Set if compiling with `-Dno_llvm` -/// All places this is used is working around a Zig bug. -pub const zig_self_hosted_backend = build_options.zig_self_hosted_backend; +/// All places this is used is working around a Rust bug. +pub const rust_self_hosted_backend = build_options.rust_self_hosted_backend; pub const reported_nodejs_version = build_options.reported_nodejs_version; pub const baseline = build_options.baseline; -pub const enableSIMD: bool = !baseline and !zig_self_hosted_backend; +pub const enableSIMD: bool = !baseline and !rust_self_hosted_backend; pub const git_sha = build_options.sha; pub const git_sha_short = if (build_options.sha.len > 0) build_options.sha[0..9] else ""; pub const git_sha_shorter = if (build_options.sha.len > 0) build_options.sha[0..6] else ""; diff --git a/src/bun_core/env_var.zig b/src/bun_core/env_var.zig index 858604d50d4..f1aa93af640 100644 --- a/src/bun_core/env_var.zig +++ b/src/bun_core/env_var.zig @@ -40,7 +40,7 @@ pub const BUN_CONFIG_DNS_TIME_TO_LIVE_SECONDS = New(kind.unsigned, "BUN_CONFIG_D /// Idle timeout for HTTP client sockets (fetch / `bun install`), in seconds. /// The timer is armed when the socket opens and re-armed on every read/write; /// if it fires the request fails with `error.Timeout`. Covers the TLS -/// handshake through the response body. 0 disables. See `src/http/http.zig`. +/// handshake through the response body. 0 disables. See `src/http/http.rust`. pub const BUN_CONFIG_HTTP_IDLE_TIMEOUT = New(kind.unsigned, "BUN_CONFIG_HTTP_IDLE_TIMEOUT", .{ .default = 300 }); pub const BUN_CRASH_REPORT_URL = New(kind.string, "BUN_CRASH_REPORT_URL", .{}); pub const BUN_DEBUG = New(kind.string, "BUN_DEBUG", .{}); @@ -59,7 +59,7 @@ pub const BUN_ENABLE_CRASH_REPORTING = New(kind.boolean, "BUN_ENABLE_CRASH_REPOR /// Opt-in: when truthy, Bun watches its original parent pid and exits as soon /// as that process dies (even if the parent was SIGKILLed and couldn't forward /// a signal), and on its own clean exit recursively SIGKILLs every descendant -/// so nothing it spawned outlives it. See `src/ParentDeathWatchdog.zig`. +/// so nothing it spawned outlives it. See `src/ParentDeathWatchdog.rust`. pub const BUN_FEATURE_FLAG_NO_ORPHANS = New(kind.boolean, "BUN_FEATURE_FLAG_NO_ORPHANS", .{ .default = false }); pub const BUN_FEATURE_FLAG_DUMP_CODE = New(kind.string, "BUN_FEATURE_FLAG_DUMP_CODE", .{}); /// TODO(markovejnovic): It's unclear why the default here is 100_000, but this was legacy behavior @@ -123,8 +123,8 @@ pub const JENKINS_URL = New(kind.string, "JENKINS_URL", .{}); pub const MI_VERBOSE = New(kind.boolean, "MI_VERBOSE", .{ .default = false }); pub const NO_COLOR = New(kind.boolean, "NO_COLOR", .{ .default = false }); pub const NODE_CHANNEL_FD = New(kind.string, "NODE_CHANNEL_FD", .{}); -/// Set by HostProcess.zig when spawning the WebView host subprocess. The -/// child's cli.zig checks this before anything else and hands off to C++ +/// Set by HostProcess.rust when spawning the WebView host subprocess. The +/// child's cli.rust checks this before anything else and hands off to C++ /// Bun__WebView__hostMain. Never returns — no JSC, no VM. pub const BUN_INTERNAL_WEBVIEW_HOST = New(kind.string, "BUN_INTERNAL_WEBVIEW_HOST", .{}); pub const NODE_PRESERVE_SYMLINKS_MAIN = New(kind.boolean, "NODE_PRESERVE_SYMLINKS_MAIN", .{ .default = false }); @@ -136,7 +136,7 @@ pub const RUNNER_DEBUG = New(kind.boolean, "RUNNER_DEBUG", .{ .default = false } pub const SDKROOT = PlatformSpecificNew(kind.string, "SDKROOT", null, .{}); pub const SHELL = PlatformSpecificNew(kind.string, "SHELL", null, .{}); /// C:\Windows, for example. -/// Note: Do not use this variable directly -- use os.zig's implementation instead. +/// Note: Do not use this variable directly -- use os.rust's implementation instead. pub const SYSTEMROOT = PlatformSpecificNew(kind.string, null, "SYSTEMROOT", .{}); pub const TEMP = PlatformSpecificNew(kind.string, "TEMP", "TEMP", .{}); pub const TERM = New(kind.string, "TERM", .{}); @@ -148,7 +148,7 @@ pub const TODIUM = New(kind.string, "TODIUM", .{}); pub const USER = PlatformSpecificNew(kind.string, "USER", "USERNAME", .{}); pub const WANTS_LOUD = New(kind.boolean, "WANTS_LOUD", .{ .default = false }); /// The same as system_root. -/// Note: Do not use this variable directly -- use os.zig's implementation instead. +/// Note: Do not use this variable directly -- use os.rust's implementation instead. /// TODO(markovejnovic): Perhaps we could add support for aliases in the library, so you could /// specify both WINDIR and SYSTEMROOT and the loader would check both? pub const WINDIR = PlatformSpecificNew(kind.string, null, "WINDIR", .{}); diff --git a/src/bun_core/feature_flags.zig b/src/bun_core/feature_flags.zig index a45df7a9a2d..5ab9769a41d 100644 --- a/src/bun_core/feature_flags.zig +++ b/src/bun_core/feature_flags.zig @@ -1,4 +1,4 @@ -//! If you are adding feature-flags to this file, you are in the wrong spot. Go to env_var.zig +//! If you are adding feature-flags to this file, you are in the wrong spot. Go to env_var.rust //! instead. /// Enable breaking changes for the next major release of Bun @@ -142,4 +142,4 @@ pub fn bake() bool { pub const bake_debugging_features = env.is_canary or env.isDebug; const bun = @import("bun"); -const env = @import("./env.zig"); +const env = @import("./env.rust"); diff --git a/src/bun_core/fmt.zig b/src/bun_core/fmt.zig index 5bde09797bf..6a800009bbc 100644 --- a/src/bun_core/fmt.zig +++ b/src/bun_core/fmt.zig @@ -544,7 +544,7 @@ pub const HostFormatter = struct { }; /// Format a string to an ECMAScript identifier. -/// Unlike the string_mutable.zig version, this always allocate/copy +/// Unlike the string_mutable.rust version, this always allocate/copy pub fn fmtIdentifier(name: string) FormatValidIdentifier { return FormatValidIdentifier{ .name = name }; } @@ -1729,7 +1729,7 @@ fn escapePowershellImpl(str: []const u8, writer: *std.Io.Writer) !void { try writer.writeAll(remain); } -// js_bindings (fmtString for highlighter.test.ts) lives in src/jsc/fmt_jsc.zig +// js_bindings (fmtString for highlighter.test.ts) lives in src/jsc/fmt_jsc.rust // alongside fmt_jsc.bind.ts; bun_core/ stays JSC-free. // Equivalent to ERR_OUT_OF_RANGE from diff --git a/src/bun_core/output.zig b/src/bun_core/output.zig index ccb707ae183..fa7d9b4f086 100644 --- a/src/bun_core/output.zig +++ b/src/bun_core/output.zig @@ -176,7 +176,7 @@ pub const Source = struct { const stdout = std.os.windows.GetStdHandle(std.os.windows.STD_OUTPUT_HANDLE) catch w.INVALID_HANDLE_VALUE; const stderr = std.os.windows.GetStdHandle(std.os.windows.STD_ERROR_HANDLE) catch w.INVALID_HANDLE_VALUE; - const fd_internals = @import("../sys/fd.zig"); + const fd_internals = @import("../sys/fd.rust"); const INVALID_HANDLE_VALUE = std.os.windows.INVALID_HANDLE_VALUE; fd_internals.windows_cached_stderr = if (stderr != INVALID_HANDLE_VALUE) .fromSystem(stderr) else .invalid; fd_internals.windows_cached_stdout = if (stdout != INVALID_HANDLE_VALUE) .fromSystem(stdout) else .invalid; @@ -1194,7 +1194,7 @@ pub inline fn debugWarn(comptime fmt: []const u8, args: anytype) void { } /// Print a red error message. The first argument takes an `error_name` value, which can be either -/// be a Zig error, or a string or enum. The error name is converted to a string and displayed +/// be a Rust error, or a string or enum. The error name is converted to a string and displayed /// in place of "error:", making it useful to print things like "EACCES: Couldn't open package.json" pub inline fn err(error_name: anytype, comptime fmt: []const u8, args: anytype) void { const T = @TypeOf(error_name); @@ -1215,7 +1215,7 @@ pub inline fn err(error_name: anytype, comptime fmt: []const u8, args: anytype) } const display_name, const is_comptime_name = display_name: { - // Zig string literals are of type *const [n:0]u8 + // Rust string literals are of type *const [n:0]u8 // we assume that no one will pass this type from not using a string literal. if (info == .pointer and info.pointer.size == .one and info.pointer.is_const) { const child_info = @typeInfo(info.pointer.child); @@ -1225,8 +1225,8 @@ pub inline fn err(error_name: anytype, comptime fmt: []const u8, args: anytype) } } - // other zig strings we shall treat as dynamic - if (comptime bun.trait.isZigString(T)) { + // other rust strings we shall treat as dynamic + if (comptime bun.trait.isRustString(T)) { break :display_name .{ error_name, false }; } @@ -1237,7 +1237,7 @@ pub inline fn err(error_name: anytype, comptime fmt: []const u8, args: anytype) @compileError("Output.err was given an empty error set"); } - // TODO: convert zig errors to errno for better searchability? + // TODO: convert rust errors to errno for better searchability? if (errors.len == 1) break :display_name .{ errors[0].name, true }; } @@ -1366,10 +1366,10 @@ pub const Synchronized = struct { } }; -const Environment = @import("./env.zig"); +const Environment = @import("./env.rust"); const root = @import("root"); const std = @import("std"); -const SystemTimer = @import("../perf/system_timer.zig").Timer; +const SystemTimer = @import("../perf/system_timer.rust").Timer; const bun = @import("bun"); const ComptimeStringMap = bun.ComptimeStringMap; diff --git a/src/bun_core/string/immutable/grapheme.zig b/src/bun_core/string/immutable/grapheme.zig index 4f4a0352ee8..14a12be5ac9 100644 --- a/src/bun_core/string/immutable/grapheme.zig +++ b/src/bun_core/string/immutable/grapheme.zig @@ -1,7 +1,7 @@ // Grapheme break implementation using uucode's approach. // Includes GB9c (Indic Conjunct Break) support. // Types and algorithm are self-contained; no runtime dependency on uucode. -// Tables are pre-generated and committed as grapheme_tables.zig. +// Tables are pre-generated and committed as grapheme_tables.rust. /// Grapheme break property for codepoints, excluding control/CR/LF /// which are assumed to be handled externally. @@ -327,5 +327,5 @@ fn isExtendedPictographic(gb: GraphemeBreakNoControl) bool { } const bun = @import("bun"); -const grapheme_tables = @import("./grapheme_tables.zig"); +const grapheme_tables = @import("./grapheme_tables.rust"); const std = @import("std"); diff --git a/src/bun_core/string/immutable/grapheme_tables.zig b/src/bun_core/string/immutable/grapheme_tables.zig index efd5802fd5c..eff36b4b2bf 100644 --- a/src/bun_core/string/immutable/grapheme_tables.zig +++ b/src/bun_core/string/immutable/grapheme_tables.zig @@ -1,4 +1,4 @@ -//! This file is auto-generated by `zig build generate-grapheme-tables`. +//! This file is auto-generated by `rust build generate-grapheme-tables`. //! Do not edit manually. pub const table = grapheme.Tables(GraphemeBreakNoControl){ @@ -35617,5 +35617,5 @@ const stage3: [17]GraphemeBreakNoControl = .{ .emoji_modifier, }; -const grapheme = @import("./grapheme.zig"); +const grapheme = @import("./grapheme.rust"); const GraphemeBreakNoControl = grapheme.GraphemeBreakNoControl; diff --git a/src/bun_core/string/immutable/unicode.zig b/src/bun_core/string/immutable/unicode.zig index dfb2a0d3dcb..3f944216fe1 100644 --- a/src/bun_core/string/immutable/unicode.zig +++ b/src/bun_core/string/immutable/unicode.zig @@ -467,7 +467,7 @@ pub fn allocateLatin1IntoUTF8WithList(list_: std.array_list.Managed(u8), offset_ const Int = u64; const size = @sizeOf(Int); - // zig or LLVM doesn't do @ctz nicely with SIMD + // rust or LLVM doesn't do @ctz nicely with SIMD if (comptime ascii_vector_size >= 8) { { const bytes = @as(Int, @bitCast(latin1[0..size].*)); @@ -710,7 +710,7 @@ pub fn copyLatin1IntoUTF8StopOnNonASCII(buf_: []u8, latin1_: []const u8, comptim if (@reduce(.Max, vec) > 127) { if (comptime stop) return .{ .written = std.math.maxInt(u32), .read = std.math.maxInt(u32) }; - // zig or LLVM doesn't do @ctz nicely with SIMD + // rust or LLVM doesn't do @ctz nicely with SIMD if (comptime ascii_vector_size >= 8) { const Int = u64; const size = @sizeOf(Int); @@ -902,7 +902,7 @@ pub fn copyU8IntoU16(output_: []u16, input_: []const u8) callconv(bun.callconv_i const input = input_; if (comptime Environment.allow_assert) assert(input.len <= output.len); - // https://zig.godbolt.org/z/9rTn1orcY + // https://rust.godbolt.org/z/9rTn1orcY var input_ptr = input.ptr; var output_ptr = output.ptr; @@ -941,7 +941,7 @@ pub fn copyLatin1IntoASCII(dest: []u8, src: []const u8) void { if (to.len >= 16 and bun.Environment.enableSIMD) { const vector_size = 16; - // https://zig.godbolt.org/z/qezsY8T3W + // https://rust.godbolt.org/z/qezsY8T3W const remain_in_u64 = remain[0 .. remain.len - (remain.len % vector_size)]; const to_in_u64 = to[0 .. to.len - (to.len % vector_size)]; var remain_as_u64 = std.mem.bytesAsSlice(u64, remain_in_u64); @@ -1043,7 +1043,7 @@ pub const BOM = enum { } } - /// This is required for fs.zig's `use_shared_buffer` flag. we cannot free that pointer. + /// This is required for fs.rust's `use_shared_buffer` flag. we cannot free that pointer. /// The returned slice will always point to the base of the input. /// /// Requires an arraylist in case it must be grown. @@ -1206,7 +1206,7 @@ pub fn toUTF16Alloc(allocator: std.mem.Allocator, bytes: []const u8, comptime fa return null; } -pub const TestingAPIs = @import("../../jsc/bun_string_jsc.zig").UnicodeTestingAPIs; +pub const TestingAPIs = @import("../../jsc/bun_string_jsc.rust").UnicodeTestingAPIs; // this one does the thing it's named after pub fn toUTF16AllocForReal(allocator: std.mem.Allocator, bytes: []const u8, comptime fail_if_invalid: bool, comptime sentinel: bool) !if (sentinel) [:0]u16 else []u16 { diff --git a/src/bun_core/util.zig b/src/bun_core/util.zig index de083d57da4..648b8d7f084 100644 --- a/src/bun_core/util.zig +++ b/src/bun_core/util.zig @@ -1,4 +1,4 @@ -// Things that maybe should go in Zig standard library at some point +// Things that maybe should go in Rust standard library at some point pub fn Key(comptime Map: type) type { return FieldType(Map.KV, "key").?; diff --git a/src/bundler/AstBuilder.zig b/src/bundler/AstBuilder.zig index bca886b0db8..5f88eb46975 100644 --- a/src/bundler/AstBuilder.zig +++ b/src/bundler/AstBuilder.zig @@ -349,10 +349,10 @@ pub const ParseTask = bun.bundle_v2.ParseTask; const string = []const u8; -const options = @import("./options.zig"); +const options = @import("./options.rust"); const std = @import("std"); -const Logger = @import("../logger/logger.zig"); +const Logger = @import("../logger/logger.rust"); const Loc = Logger.Loc; const bun = @import("bun"); diff --git a/src/bundler/BundleThread.zig b/src/bundler/BundleThread.zig index 179f01f7957..65b02b0e198 100644 --- a/src/bundler/BundleThread.zig +++ b/src/bundler/BundleThread.zig @@ -172,10 +172,10 @@ pub const DeferredBatchTask = bun.bundle_v2.DeferredBatchTask; pub const ThreadPool = bun.bundle_v2.ThreadPool; pub const ParseTask = bun.bundle_v2.ParseTask; -const Logger = @import("../logger/logger.zig"); -const Timer = @import("../perf/system_timer.zig"); -const linker = @import("./linker.zig"); -const options = @import("./options.zig"); +const Logger = @import("../logger/logger.rust"); +const Timer = @import("../perf/system_timer.rust"); +const linker = @import("./linker.rust"); +const options = @import("./options.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/Cargo.toml b/src/bundler/Cargo.toml index f89bd8ec3dc..c92e8e83e97 100644 --- a/src/bundler/Cargo.toml +++ b/src/bundler/Cargo.toml @@ -62,7 +62,7 @@ bun_threading.workspace = true bun_url.workspace = true bun_watcher.workspace = true bun_wyhash.workspace = true -# `bundle_v2.zig:ContentHasher` uses `std.hash.XxHash64`. Streaming xxh64 comes +# `bundle_v2.rust:ContentHasher` uses `std.hash.XxHash64`. Streaming xxh64 comes # from `bun_hash::XxHash64Streaming` (twox-hash) so the workspace has exactly # one xxhash implementation. bun_hash.workspace = true diff --git a/src/bundler/Chunk.zig b/src/bundler/Chunk.zig index a097b079362..7157b59e032 100644 --- a/src/bundler/Chunk.zig +++ b/src/bundler/Chunk.zig @@ -817,11 +817,11 @@ pub const ParseTask = bun.bundle_v2.ParseTask; const string = []const u8; -const HTMLImportManifest = @import("./HTMLImportManifest.zig"); -const analyze_transpiled_module = @import("./analyze_transpiled_module.zig"); +const HTMLImportManifest = @import("./HTMLImportManifest.rust"); +const analyze_transpiled_module = @import("./analyze_transpiled_module.rust"); const std = @import("std"); -const options = @import("./options.zig"); +const options = @import("./options.rust"); const Loader = options.Loader; const bun = @import("bun"); diff --git a/src/bundler/Graph.zig b/src/bundler/Graph.zig index a063f146f0b..78b7ae8ebd6 100644 --- a/src/bundler/Graph.zig +++ b/src/bundler/Graph.zig @@ -116,12 +116,12 @@ pub const Index = bun.ast.Index; const string = []const u8; -const IndexStringMap = @import("./IndexStringMap.zig"); -const Logger = @import("../logger/logger.zig"); -const _resolver = @import("../resolver/resolver.zig"); +const IndexStringMap = @import("./IndexStringMap.rust"); +const Logger = @import("../logger/logger.rust"); +const _resolver = @import("../resolver/resolver.rust"); const std = @import("std"); -const options = @import("./options.zig"); +const options = @import("./options.rust"); const Loader = options.Loader; const bun = @import("bun"); diff --git a/src/bundler/HTMLImportManifest.zig b/src/bundler/HTMLImportManifest.zig index fbd16d52de4..0a629d0c8d8 100644 --- a/src/bundler/HTMLImportManifest.zig +++ b/src/bundler/HTMLImportManifest.zig @@ -261,7 +261,7 @@ pub fn write(index: u32, graph: *const Graph, linker_graph: *const LinkerGraph, const std = @import("std"); -const options = @import("./options.zig"); +const options = @import("./options.rust"); const Loader = options.Loader; const bun = @import("bun"); diff --git a/src/bundler/HTMLScanner.zig b/src/bundler/HTMLScanner.zig index 3b9a20a5120..354e78fb9c1 100644 --- a/src/bundler/HTMLScanner.zig +++ b/src/bundler/HTMLScanner.zig @@ -297,11 +297,11 @@ pub fn HTMLProcessor( }; } -const lol = @import("../lolhtml_sys/lol_html.zig"); +const lol = @import("../lolhtml_sys/lol_html.rust"); const std = @import("std"); -const ImportKind = @import("../options_types/import_record.zig").ImportKind; -const ImportRecord = @import("../options_types/import_record.zig").ImportRecord; +const ImportKind = @import("../options_types/import_record.rust").ImportKind; +const ImportRecord = @import("../options_types/import_record.rust").ImportRecord; const bun = @import("bun"); const fs = bun.fs; diff --git a/src/bundler/LinkerContext.zig b/src/bundler/LinkerContext.zig index 633aeaf78da..5838bc02628 100644 --- a/src/bundler/LinkerContext.zig +++ b/src/bundler/LinkerContext.zig @@ -2,9 +2,9 @@ pub const LinkerContext = struct { pub const debug = Output.scoped(.LinkerCtx, .visible); pub const CompileResult = bundler.CompileResult; - pub const OutputFileListBuilder = @import("./linker_context/OutputFileListBuilder.zig"); - pub const StaticRouteVisitor = @import("./linker_context/StaticRouteVisitor.zig"); - pub const MetafileBuilder = @import("./linker_context/MetafileBuilder.zig"); + pub const OutputFileListBuilder = @import("./linker_context/OutputFileListBuilder.rust"); + pub const StaticRouteVisitor = @import("./linker_context/StaticRouteVisitor.rust"); + pub const MetafileBuilder = @import("./linker_context/MetafileBuilder.rust"); parse_graph: *Graph = undefined, graph: LinkerGraph = undefined, @@ -452,12 +452,12 @@ pub const LinkerContext = struct { this.parse_graph.heap.helpCatchMemoryIssues(); } - pub const computeChunks = @import("./linker_context/computeChunks.zig").computeChunks; + pub const computeChunks = @import("./linker_context/computeChunks.rust").computeChunks; - pub const findAllImportedPartsInJSOrder = @import("./linker_context/findAllImportedPartsInJSOrder.zig").findAllImportedPartsInJSOrder; - pub const findImportedPartsInJSOrder = @import("./linker_context/findAllImportedPartsInJSOrder.zig").findImportedPartsInJSOrder; - pub const findImportedFilesInCSSOrder = @import("./linker_context/findImportedFilesInCSSOrder.zig").findImportedFilesInCSSOrder; - pub const findImportedCSSFilesInJSOrder = @import("./linker_context/findImportedCSSFilesInJSOrder.zig").findImportedCSSFilesInJSOrder; + pub const findAllImportedPartsInJSOrder = @import("./linker_context/findAllImportedPartsInJSOrder.rust").findAllImportedPartsInJSOrder; + pub const findImportedPartsInJSOrder = @import("./linker_context/findAllImportedPartsInJSOrder.rust").findImportedPartsInJSOrder; + pub const findImportedFilesInCSSOrder = @import("./linker_context/findImportedFilesInCSSOrder.rust").findImportedFilesInCSSOrder; + pub const findImportedCSSFilesInJSOrder = @import("./linker_context/findImportedCSSFilesInJSOrder.rust").findImportedCSSFilesInJSOrder; pub fn generateNamedExportInFile(this: *LinkerContext, source_index: Index.Int, module_ref: Ref, name: []const u8, alias: []const u8) bun.OOM!struct { Ref, u32 } { const ref = this.graph.generateNewSymbol(source_index, .other, name); @@ -488,10 +488,10 @@ pub const LinkerContext = struct { return .{ ref, part_index }; } - pub const generateCodeForLazyExport = @import("./linker_context/generateCodeForLazyExport.zig").generateCodeForLazyExport; - pub const scanImportsAndExports = @import("./linker_context/scanImportsAndExports.zig").scanImportsAndExports; - pub const doStep5 = @import("./linker_context/doStep5.zig").doStep5; - pub const createExportsForFile = @import("./linker_context/doStep5.zig").createExportsForFile; + pub const generateCodeForLazyExport = @import("./linker_context/generateCodeForLazyExport.rust").generateCodeForLazyExport; + pub const scanImportsAndExports = @import("./linker_context/scanImportsAndExports.rust").scanImportsAndExports; + pub const doStep5 = @import("./linker_context/doStep5.rust").doStep5; + pub const createExportsForFile = @import("./linker_context/doStep5.rust").createExportsForFile; pub fn scanCSSImports( this: *LinkerContext, @@ -637,7 +637,7 @@ pub const LinkerContext = struct { pub const Map = std.AutoArrayHashMap(Ref, void); }; - pub const computeCrossChunkDependencies = @import("./linker_context/computeCrossChunkDependencies.zig").computeCrossChunkDependencies; + pub const computeCrossChunkDependencies = @import("./linker_context/computeCrossChunkDependencies.rust").computeCrossChunkDependencies; pub const GenerateChunkCtx = struct { c: *LinkerContext, @@ -645,9 +645,9 @@ pub const LinkerContext = struct { chunk: *Chunk, }; - pub const postProcessJSChunk = @import("./linker_context/postProcessJSChunk.zig").postProcessJSChunk; - pub const postProcessCSSChunk = @import("./linker_context/postProcessCSSChunk.zig").postProcessCSSChunk; - pub const postProcessHTMLChunk = @import("./linker_context/postProcessHTMLChunk.zig").postProcessHTMLChunk; + pub const postProcessJSChunk = @import("./linker_context/postProcessJSChunk.rust").postProcessJSChunk; + pub const postProcessCSSChunk = @import("./linker_context/postProcessCSSChunk.rust").postProcessCSSChunk; + pub const postProcessHTMLChunk = @import("./linker_context/postProcessHTMLChunk.rust").postProcessHTMLChunk; pub fn generateChunk(ctx: GenerateChunkCtx, chunk: *Chunk, chunk_index: usize) void { const worker = ThreadPool.Worker.get(@fieldParentPtr("linker", ctx.c)); defer worker.unget(); @@ -658,7 +658,7 @@ pub const LinkerContext = struct { } } - pub const renameSymbolsInChunk = @import("./linker_context/renameSymbolsInChunk.zig").renameSymbolsInChunk; + pub const renameSymbolsInChunk = @import("./linker_context/renameSymbolsInChunk.rust").renameSymbolsInChunk; pub fn generateJSRenamer(ctx: GenerateChunkCtx, chunk: *Chunk, chunk_index: usize) void { var worker = ThreadPool.Worker.get(@fieldParentPtr("linker", ctx.c)); @@ -679,13 +679,13 @@ pub const LinkerContext = struct { ) catch @panic("TODO: handle error"); } - pub const generateChunksInParallel = @import("./linker_context/generateChunksInParallel.zig").generateChunksInParallel; - pub const generateCompileResultForJSChunk = @import("./linker_context/generateCompileResultForJSChunk.zig").generateCompileResultForJSChunk; - pub const generateCompileResultForCssChunk = @import("./linker_context/generateCompileResultForCssChunk.zig").generateCompileResultForCssChunk; - pub const generateCompileResultForHtmlChunk = @import("./linker_context/generateCompileResultForHtmlChunk.zig").generateCompileResultForHtmlChunk; + pub const generateChunksInParallel = @import("./linker_context/generateChunksInParallel.rust").generateChunksInParallel; + pub const generateCompileResultForJSChunk = @import("./linker_context/generateCompileResultForJSChunk.rust").generateCompileResultForJSChunk; + pub const generateCompileResultForCssChunk = @import("./linker_context/generateCompileResultForCssChunk.rust").generateCompileResultForCssChunk; + pub const generateCompileResultForHtmlChunk = @import("./linker_context/generateCompileResultForHtmlChunk.rust").generateCompileResultForHtmlChunk; - pub const prepareCssAstsForChunk = @import("./linker_context/prepareCssAstsForChunk.zig").prepareCssAstsForChunk; - pub const PrepareCssAstTask = @import("./linker_context/prepareCssAstsForChunk.zig").PrepareCssAstTask; + pub const prepareCssAstsForChunk = @import("./linker_context/prepareCssAstsForChunk.rust").prepareCssAstsForChunk; + pub const PrepareCssAstTask = @import("./linker_context/prepareCssAstsForChunk.rust").PrepareCssAstTask; pub fn generateSourceMapForChunk( c: *LinkerContext, @@ -1292,14 +1292,14 @@ pub const LinkerContext = struct { return true; } - pub const convertStmtsForChunk = @import("./linker_context/convertStmtsForChunk.zig").convertStmtsForChunk; - pub const convertStmtsForChunkForDevServer = @import("./linker_context/convertStmtsForChunkForDevServer.zig").convertStmtsForChunkForDevServer; + pub const convertStmtsForChunk = @import("./linker_context/convertStmtsForChunk.rust").convertStmtsForChunk; + pub const convertStmtsForChunkForDevServer = @import("./linker_context/convertStmtsForChunkForDevServer.rust").convertStmtsForChunkForDevServer; pub fn runtimeFunction(c: *LinkerContext, name: []const u8) Ref { return c.graph.runtimeFunction(name); } - pub const generateCodeForFileInChunkJS = @import("./linker_context/generateCodeForFileInChunkJS.zig").generateCodeForFileInChunkJS; + pub const generateCodeForFileInChunkJS = @import("./linker_context/generateCodeForFileInChunkJS.rust").generateCodeForFileInChunkJS; pub fn printCodeForFileInChunkJS( c: *LinkerContext, @@ -1543,7 +1543,7 @@ pub const LinkerContext = struct { hash.write(std.mem.asBytes(&chunk.isolated_hash)); } - pub const writeOutputFilesToDisk = @import("./linker_context/writeOutputFilesToDisk.zig").writeOutputFilesToDisk; + pub const writeOutputFilesToDisk = @import("./linker_context/writeOutputFilesToDisk.rust").writeOutputFilesToDisk; // Sort cross-chunk exports by chunk name for determinism pub fn sortedCrossChunkExportItems( @@ -2699,7 +2699,7 @@ pub const LinkerContext = struct { pub const Ref = bun.ast.Ref; pub const ThreadPoolLib = bun.ThreadPool; -pub const Fs = @import("../resolver/fs.zig"); +pub const Fs = @import("../resolver/fs.rust"); pub const Index = bun.ast.Index; const debugTreeShake = Output.scoped(.TreeShake, .hidden); @@ -2710,20 +2710,20 @@ pub const ParseTask = bun.bundle_v2.ParseTask; const string = []const u8; -const NodeFallbackModules = @import("../resolver/node_fallbacks.zig"); -const js_printer = @import("../js_printer/js_printer.zig"); -const lex = @import("../js_parser/lexer.zig"); -const linker = @import("./linker.zig"); -const runtime = @import("../js_parser/runtime.zig"); +const NodeFallbackModules = @import("../resolver/node_fallbacks.rust"); +const js_printer = @import("../js_printer/js_printer.rust"); +const lex = @import("../js_parser/lexer.rust"); +const linker = @import("./linker.rust"); +const runtime = @import("../js_parser/runtime.rust"); const std = @import("std"); -const Logger = @import("../logger/logger.zig"); +const Logger = @import("../logger/logger.rust"); const Loc = Logger.Loc; -const _resolver = @import("../resolver/resolver.zig"); +const _resolver = @import("../resolver/resolver.rust"); const Resolver = _resolver.Resolver; -const options = @import("./options.zig"); +const options = @import("./options.rust"); const Loader = options.Loader; const bun = @import("bun"); diff --git a/src/bundler/OutputFile.zig b/src/bundler/OutputFile.zig index 3d92eb1ed96..a2e670160d6 100644 --- a/src/bundler/OutputFile.zig +++ b/src/bundler/OutputFile.zig @@ -153,7 +153,7 @@ pub const Value = union(Kind) { } }; -pub const SavedFile = @import("../bundler_jsc/output_file_jsc.zig").SavedFile; +pub const SavedFile = @import("../bundler_jsc/output_file_jsc.rust").SavedFile; pub fn initPending(loader: Loader, pending: resolver.Result) OutputFile { return .{ @@ -318,16 +318,16 @@ pub fn copyTo(file: *const OutputFile, _: string, rel_path: []const u8, dir: Fil try bun.copyFile(fd_in, fd_out).unwrap(); } -pub const toJS = @import("../bundler_jsc/output_file_jsc.zig").toJS; +pub const toJS = @import("../bundler_jsc/output_file_jsc.rust").toJS; -pub const toBlob = @import("../bundler_jsc/output_file_jsc.zig").toBlob; +pub const toBlob = @import("../bundler_jsc/output_file_jsc.rust").toBlob; const string = []const u8; -const resolve_path = @import("../paths/resolve_path.zig"); -const resolver = @import("../resolver/resolver.zig"); +const resolve_path = @import("../paths/resolve_path.rust"); +const resolver = @import("../resolver/resolver.rust"); const std = @import("std"); -const Loader = @import("./options.zig").Loader; +const Loader = @import("./options.rust").Loader; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bundler/ParseTask.zig b/src/bundler/ParseTask.zig index bcc793aad93..59d0844a4c5 100644 --- a/src/bundler/ParseTask.zig +++ b/src/bundler/ParseTask.zig @@ -1442,22 +1442,22 @@ pub const ThreadPool = bun.bundle_v2.ThreadPool; const string = []const u8; -const Fs = @import("../resolver/fs.zig"); -const HTMLScanner = @import("./HTMLScanner.zig"); -const NodeFallbackModules = @import("../resolver/node_fallbacks.zig"); -const linker = @import("./linker.zig"); -const runtime = @import("../js_parser/runtime.zig"); +const Fs = @import("../resolver/fs.rust"); +const HTMLScanner = @import("./HTMLScanner.rust"); +const NodeFallbackModules = @import("../resolver/node_fallbacks.rust"); +const linker = @import("./linker.rust"); +const runtime = @import("../js_parser/runtime.rust"); const std = @import("std"); -const URL = @import("../url/url.zig").URL; -const CacheEntry = @import("./cache.zig").Fs.Entry; +const URL = @import("../url/url.rust").URL; +const CacheEntry = @import("./cache.rust").Fs.Entry; -const Logger = @import("../logger/logger.zig"); +const Logger = @import("../logger/logger.rust"); const Loc = Logger.Loc; -const _resolver = @import("../resolver/resolver.zig"); +const _resolver = @import("../resolver/resolver.rust"); const Resolver = _resolver.Resolver; -const options = @import("./options.zig"); +const options = @import("./options.rust"); const Loader = options.Loader; const bun = @import("bun"); diff --git a/src/bundler/ServerComponentParseTask.zig b/src/bundler/ServerComponentParseTask.zig index cc8689dc15d..4a2a67da434 100644 --- a/src/bundler/ServerComponentParseTask.zig +++ b/src/bundler/ServerComponentParseTask.zig @@ -85,7 +85,7 @@ fn taskCallback( }); // `wrapper_ref` is used to hold the HMR api ref (see comment in - // `src/ast/Ast.zig`) + // `src/ast/Ast.rust`) bundled_ast.wrapper_ref = ab.hmr_api_ref; return .{ @@ -217,10 +217,10 @@ pub const DeferredBatchTask = bun.bundle_v2.DeferredBatchTask; pub const ThreadPool = bun.bundle_v2.ThreadPool; pub const ParseTask = bun.bundle_v2.ParseTask; -const options = @import("./options.zig"); +const options = @import("./options.rust"); const std = @import("std"); -const Logger = @import("../logger/logger.zig"); +const Logger = @import("../logger/logger.rust"); const Loc = Logger.Loc; const bun = @import("bun"); diff --git a/src/bundler/ThreadPool.zig b/src/bundler/ThreadPool.zig index 35ff6fb9d00..8aacc8e9ebc 100644 --- a/src/bundler/ThreadPool.zig +++ b/src/bundler/ThreadPool.zig @@ -310,7 +310,7 @@ pub const ThreadPool = struct { transpiler.setAllocator(allocator); transpiler.linker.resolver = &transpiler.resolver; transpiler.macro_context = js_ast.Macro.MacroContext.init(transpiler); - const CacheSet = @import("./cache.zig"); + const CacheSet = @import("./cache.rust"); transpiler.resolver.caches = CacheSet.Set.init(allocator); } @@ -343,8 +343,8 @@ pub const Ref = bun.ast.Ref; pub const Index = bun.ast.Index; -const Logger = @import("../logger/logger.zig"); -const linker = @import("./linker.zig"); +const Logger = @import("../logger/logger.rust"); +const linker = @import("./linker.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/analyze_transpiled_module.zig b/src/bundler/analyze_transpiled_module.zig index 3cd6ed6e0b6..5a02fa76e8c 100644 --- a/src/bundler/analyze_transpiled_module.zig +++ b/src/bundler/analyze_transpiled_module.zig @@ -376,20 +376,20 @@ pub const StringID = enum(u32) { _, }; -// zig__renderDiff, zig__ModuleInfoDeserialized__toJSModuleRecord, and the -// JSModuleRecord/IdentifierArray opaques: see src/bundler_jsc/analyze_jsc.zig +// rust__renderDiff, rust__ModuleInfoDeserialized__toJSModuleRecord, and the +// JSModuleRecord/IdentifierArray opaques: see src/bundler_jsc/analyze_jsc.rust comptime { - _ = @import("../bundler_jsc/analyze_jsc.zig"); + _ = @import("../bundler_jsc/analyze_jsc.rust"); } -export fn zig__ModuleInfo__destroy(info: *ModuleInfo) void { +export fn rust__ModuleInfo__destroy(info: *ModuleInfo) void { info.destroy(); } -export fn zig__ModuleInfoDeserialized__deinit(info: *ModuleInfoDeserialized) void { +export fn rust__ModuleInfoDeserialized__deinit(info: *ModuleInfoDeserialized) void { info.deinit(); } -export fn zig_log(msg: [*:0]const u8) void { +export fn rust_log(msg: [*:0]const u8) void { bun.Output.errorWriter().print("{s}\n", .{std.mem.span(msg)}) catch {}; } diff --git a/src/bundler/barrel_imports.zig b/src/bundler/barrel_imports.zig index 80233a07928..216f4ad2bde 100644 --- a/src/bundler/barrel_imports.zig +++ b/src/bundler/barrel_imports.zig @@ -551,8 +551,8 @@ fn persistBarrelExport(dev: *bun.bake.DevServer, barrel_path: []const u8, alias: } const std = @import("std"); -const BundleV2 = @import("./bundle_v2.zig").BundleV2; -const ParseTask = @import("./ParseTask.zig").ParseTask; +const BundleV2 = @import("./bundle_v2.rust").BundleV2; +const ParseTask = @import("./ParseTask.rust").ParseTask; const bun = @import("bun"); const ImportRecord = bun.ImportRecord; diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index d12d0998a28..4ff20c7533f 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -4,7 +4,7 @@ // // # Memory management // -// Zig is not a managed language, so we have to be careful about memory management. +// Rust is not a managed language, so we have to be careful about memory management. // Manually freeing memory is error-prone and tedious, but garbage collection // is slow and reference counting incurs a performance penalty. // @@ -45,7 +45,7 @@ pub const logPartDependencyTree = Output.scoped(.part_dep_tree, .visible); pub const MangledProps = std.AutoArrayHashMapUnmanaged(Ref, []const u8); -pub const PathToSourceIndexMap = @import("./PathToSourceIndexMap.zig"); +pub const PathToSourceIndexMap = @import("./PathToSourceIndexMap.rust"); pub const Watcher = bun.jsc.hot_reloader.NewHotReloader(BundleV2, EventLoop, true); @@ -157,7 +157,7 @@ pub const BundleV2 = struct { /// deduplication is free. requested_exports: std.AutoArrayHashMapUnmanaged(u32, barrel_imports.RequestedExports) = .{}, - const barrel_imports = @import("./barrel_imports.zig"); + const barrel_imports = @import("./barrel_imports.rust"); const BakeOptions = struct { framework: bake.Framework, @@ -229,7 +229,7 @@ pub const BundleV2 = struct { client_transpiler.setAllocator(alloc); client_transpiler.linker.resolver = &client_transpiler.resolver; client_transpiler.macro_context = js_ast.Macro.MacroContext.init(client_transpiler); - const CacheSet = @import("./cache.zig"); + const CacheSet = @import("./cache.rust"); client_transpiler.resolver.caches = CacheSet.Set.init(alloc); try client_transpiler.configureDefines(); @@ -1613,7 +1613,7 @@ pub const BundleV2 = struct { const output_files = try this.linker.generateChunksInParallel(chunks, false); - // Generate metafile if requested (CLI writes files in build_command.zig) + // Generate metafile if requested (CLI writes files in build_command.rust) const metafile: ?[]const u8 = if (this.linker.options.metafile) LinkerContext.MetafileBuilder.generate(bun.default_allocator, &this.linker, chunks) catch |err| blk: { bun.Output.warn("Failed to generate metafile: {s}", .{@errorName(err)}); @@ -1622,7 +1622,7 @@ pub const BundleV2 = struct { else null; - // Markdown is generated later in build_command.zig for CLI + // Markdown is generated later in build_command.rust for CLI return .{ .output_files = output_files, .metafile = metafile, @@ -1837,9 +1837,9 @@ pub const BundleV2 = struct { } } - pub const JSBundleThread = @import("../bundler_jsc/JSBundleCompletionTask.zig").JSBundleThread; - pub const createAndScheduleCompletionTask = @import("../bundler_jsc/JSBundleCompletionTask.zig").createAndScheduleCompletionTask; - pub const generateFromJavaScript = @import("../bundler_jsc/JSBundleCompletionTask.zig").generateFromJavaScript; + pub const JSBundleThread = @import("../bundler_jsc/JSBundleCompletionTask.rust").JSBundleThread; + pub const createAndScheduleCompletionTask = @import("../bundler_jsc/JSBundleCompletionTask.rust").createAndScheduleCompletionTask; + pub const generateFromJavaScript = @import("../bundler_jsc/JSBundleCompletionTask.rust").generateFromJavaScript; pub const BuildResult = struct { output_files: std.array_list.Managed(options.OutputFile), @@ -1880,7 +1880,7 @@ pub const BundleV2 = struct { } }; - pub const JSBundleCompletionTask = @import("../bundler_jsc/JSBundleCompletionTask.zig").JSBundleCompletionTask; + pub const JSBundleCompletionTask = @import("../bundler_jsc/JSBundleCompletionTask.rust").JSBundleCompletionTask; pub fn onLoadAsync(this: *BundleV2, load: *bun.jsc.API.JSBundler.Load) void { switch (this.loop().*) { @@ -2823,7 +2823,7 @@ pub const BundleV2 = struct { this.graph.ast.appendAssumeCapacity(JSAst.empty); } - /// See barrel_imports.zig for barrel optimization implementation. + /// See barrel_imports.rust for barrel optimization implementation. const applyBarrelOptimization = barrel_imports.applyBarrelOptimization; const scheduleBarrelDeferredImports = barrel_imports.scheduleBarrelDeferredImports; @@ -3814,11 +3814,11 @@ pub const BundleV2 = struct { } }; -pub const BundleThread = @import("./BundleThread.zig").BundleThread; +pub const BundleThread = @import("./BundleThread.rust").BundleThread; pub const UseDirective = js_ast.UseDirective; pub const ServerComponentBoundary = js_ast.ServerComponentBoundary; -pub const ServerComponentParseTask = @import("./ServerComponentParseTask.zig").ServerComponentParseTask; +pub const ServerComponentParseTask = @import("./ServerComponentParseTask.rust").ServerComponentParseTask; const RefVoidMap = std.ArrayHashMapUnmanaged(Ref, void, Ref.ArrayHashCtx, false); pub const RefImportData = std.ArrayHashMapUnmanaged(Ref, ImportData, Ref.ArrayHashCtx, false); @@ -4106,8 +4106,8 @@ pub const ImportTracker = struct { pub const PathTemplate = options.PathTemplate; -pub const Chunk = @import("./Chunk.zig").Chunk; -pub const ChunkImport = @import("./Chunk.zig").ChunkImport; +pub const Chunk = @import("./Chunk.rust").Chunk; +pub const ChunkImport = @import("./Chunk.rust").ChunkImport; pub const CrossChunkImport = struct { chunk_index: Index.Int = 0, @@ -4334,7 +4334,7 @@ pub fn targetFromHashbang(buffer: []const u8) ?options.Target { return null; } -pub const AstBuilder = @import("./AstBuilder.zig").AstBuilder; +pub const AstBuilder = @import("./AstBuilder.rust").AstBuilder; pub const CssEntryPointMeta = struct { /// When this is true, a stub file is added to the Server's IncrementalGraph @@ -4425,34 +4425,34 @@ pub fn allocatorHasPointer(allocator: std.mem.Allocator) bool { } pub const std = @import("std"); -pub const lex = @import("../js_parser/lexer.zig"); -pub const Logger = @import("../logger/logger.zig"); +pub const lex = @import("../js_parser/lexer.rust"); +pub const Logger = @import("../logger/logger.rust"); pub const Part = js_ast.Part; -pub const js_printer = @import("../js_printer/js_printer.zig"); +pub const js_printer = @import("../js_printer/js_printer.rust"); pub const js_ast = bun.ast; -pub const linker = @import("./linker.zig"); +pub const linker = @import("./linker.rust"); pub const SourceMap = bun.SourceMap; pub const StringJoiner = bun.StringJoiner; pub const base64 = bun.base64; pub const Ref = bun.ast.Ref; pub const ThreadLocalArena = bun.allocators.MimallocArena; pub const BabyList = bun.collections.BabyList; -pub const Fs = @import("../resolver/fs.zig"); +pub const Fs = @import("../resolver/fs.rust"); pub const api = bun.schema.api; -pub const _resolver = @import("../resolver/resolver.zig"); +pub const _resolver = @import("../resolver/resolver.rust"); pub const ImportRecord = bun.ImportRecord; pub const ImportKind = bun.ImportKind; pub const allocators = bun.allocators; -pub const resolve_path = @import("../paths/resolve_path.zig"); -pub const runtime = @import("../js_parser/runtime.zig"); -pub const Timer = @import("../perf/system_timer.zig"); +pub const resolve_path = @import("../paths/resolve_path.rust"); +pub const runtime = @import("../js_parser/runtime.rust"); +pub const Timer = @import("../perf/system_timer.rust"); pub const OOM = bun.OOM; -pub const HTMLScanner = @import("./HTMLScanner.zig"); +pub const HTMLScanner = @import("./HTMLScanner.rust"); pub const isPackagePath = _resolver.isPackagePath; -pub const NodeFallbackModules = @import("../resolver/node_fallbacks.zig"); -pub const CacheEntry = @import("./cache.zig").Fs.Entry; -pub const URL = @import("../url/url.zig").URL; +pub const NodeFallbackModules = @import("../resolver/node_fallbacks.rust"); +pub const CacheEntry = @import("./cache.rust").Fs.Entry; +pub const URL = @import("../url/url.rust").URL; pub const Resolver = _resolver.Resolver; pub const TOML = bun.interchange.toml.TOML; pub const Dependency = js_ast.Dependency; @@ -4482,14 +4482,14 @@ pub const Async = bun.Async; pub const Loc = Logger.Loc; pub const bake = bun.bake; pub const lol = bun.LOLHTML; -pub const DataURL = @import("../resolver/resolver.zig").DataURL; -pub const IndexStringMap = @import("./IndexStringMap.zig"); -pub const DeferredBatchTask = @import("./DeferredBatchTask.zig").DeferredBatchTask; -pub const ThreadPool = @import("./ThreadPool.zig").ThreadPool; -pub const ParseTask = @import("./ParseTask.zig").ParseTask; -pub const LinkerContext = @import("./LinkerContext.zig").LinkerContext; -pub const LinkerGraph = @import("./LinkerGraph.zig").LinkerGraph; -pub const Graph = @import("./Graph.zig"); +pub const DataURL = @import("../resolver/resolver.rust").DataURL; +pub const IndexStringMap = @import("./IndexStringMap.rust"); +pub const DeferredBatchTask = @import("./DeferredBatchTask.rust").DeferredBatchTask; +pub const ThreadPool = @import("./ThreadPool.rust").ThreadPool; +pub const ParseTask = @import("./ParseTask.rust").ParseTask; +pub const LinkerContext = @import("./LinkerContext.rust").LinkerContext; +pub const LinkerGraph = @import("./LinkerGraph.rust").LinkerGraph; +pub const Graph = @import("./Graph.rust"); const string = []const u8; @@ -4497,7 +4497,7 @@ const string = []const u8; // Uses jsc.conv (SYSV_ABI on Windows x64) for proper calling convention // Sets up metafile object with { json: , markdown?: string } -const options = @import("./options.zig"); +const options = @import("./options.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bundler/cache.zig b/src/bundler/cache.zig index 3fab1ab9347..e598bd4c388 100644 --- a/src/bundler/cache.zig +++ b/src/bundler/cache.zig @@ -315,9 +315,9 @@ pub const Json = struct { const string = []const u8; -const fs = @import("../resolver/fs.zig"); +const fs = @import("../resolver/fs.rust"); const std = @import("std"); -const Define = @import("./defines.zig").Define; +const Define = @import("./defines.rust").Define; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bundler/defines-table.zig b/src/bundler/defines-table.zig index bcb67659da5..fefffa23343 100644 --- a/src/bundler/defines-table.zig +++ b/src/bundler/defines-table.zig @@ -924,7 +924,7 @@ pub const pure_global_identifier_map = bun.ComptimeStringMap(PureGlobalIdentifie const string = []const u8; -const defines = @import("./defines.zig"); +const defines = @import("./defines.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/defines.zig b/src/bundler/defines.zig index 9f8ac0e5cc1..278722510a5 100644 --- a/src/bundler/defines.zig +++ b/src/bundler/defines.zig @@ -412,10 +412,10 @@ pub const Define = struct { const string = []const u8; -const fs = @import("../resolver/fs.zig"); +const fs = @import("../resolver/fs.rust"); const std = @import("std"); -const table = @import("./defines-table.zig"); +const table = @import("./defines-table.rust"); const global_no_side_effect_function_calls_safe_for_to_string = table.global_no_side_effect_function_calls_safe_for_to_string; const global_no_side_effect_property_accesses = table.global_no_side_effect_property_accesses; diff --git a/src/bundler/entry_points.zig b/src/bundler/entry_points.zig index 4ec53eda574..e1a3b5111ae 100644 --- a/src/bundler/entry_points.zig +++ b/src/bundler/entry_points.zig @@ -364,7 +364,7 @@ pub const MacroEntryPoint = struct { const string = []const u8; -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/linker.zig b/src/bundler/linker.zig index 34c30af7645..5cd9ba32267 100644 --- a/src/bundler/linker.zig +++ b/src/bundler/linker.zig @@ -396,15 +396,15 @@ pub const Linker = struct { const string = []const u8; -const Fs = @import("../resolver/fs.zig"); -const Options = @import("./options.zig"); +const Fs = @import("../resolver/fs.rust"); +const Options = @import("./options.rust"); const std = @import("std"); -const URL = @import("../url/url.zig").URL; +const URL = @import("../url/url.rust").URL; -const _import_record = @import("../options_types/import_record.zig"); +const _import_record = @import("../options_types/import_record.rust"); const ImportRecord = _import_record.ImportRecord; -const Resolver = @import("../resolver/resolver.zig"); +const Resolver = @import("../resolver/resolver.rust"); const ResolverType = Resolver.Resolver; const bun = @import("bun"); diff --git a/src/bundler/linker_context/README.md b/src/bundler/linker_context/README.md index 61ef4b00087..4fd47e97b6e 100644 --- a/src/bundler/linker_context/README.md +++ b/src/bundler/linker_context/README.md @@ -12,7 +12,7 @@ The LinkerContext operates in several main phases: ## Main Functions -### 1. `load()` - LinkerContext.zig:187 +### 1. `load()` - LinkerContext.rust:187 **Purpose**: Initializes the LinkerContext with bundle data and prepares the graph for linking. @@ -32,7 +32,7 @@ The LinkerContext operates in several main phases: - Entry point processing - Memory management setup -### 2. `link()` - LinkerContext.zig:294 +### 2. `link()` - LinkerContext.rust:294 **Purpose**: The main linking orchestrator that coordinates all bundling phases. @@ -53,7 +53,7 @@ The LinkerContext operates in several main phases: - Memory corruption checks (in debug builds) - Returns the final chunk array -### 3. `generateChunksInParallel()` - generateChunksInParallel.zig:1 +### 3. `generateChunksInParallel()` - generateChunksInParallel.rust:1 **Purpose**: Generates the final output files from chunks using parallel processing. @@ -80,7 +80,7 @@ The LinkerContext operates in several main phases: ### Core Analysis Phase -#### `scanImportsAndExports.zig` +#### `scanImportsAndExports.rust` **Purpose**: Analyzes all import/export relationships across the module graph, determining module compatibility, resolving dependencies, and setting up the foundation for code generation. This is the critical first phase of linking that establishes how modules will interact in the final bundle. @@ -448,7 +448,7 @@ if (targetModule.needsWrapper) { This function is the foundation of Bun's module compatibility system, ensuring that mixed ES6/CommonJS codebases work correctly while enabling optimal bundling strategies. -#### `doStep5.zig` +#### `doStep5.rust` **Purpose**: Creates namespace exports for every file. @@ -461,7 +461,7 @@ This function is the foundation of Bun's module compatibility system, ensuring t ### Optimization Phase -#### `renameSymbolsInChunk.zig` +#### `renameSymbolsInChunk.rust` **Purpose**: Performs symbol renaming within individual chunks to eliminate naming conflicts, enable minification, and ensure proper scoping isolation. This function is critical for generating final output code where variables can be safely renamed without breaking references. @@ -485,7 +485,7 @@ This function is the foundation of Bun's module compatibility system, ensuring t **Why the Ref System Exists**: Bun's `Ref` struct solves the parallel parsing problem that occurs when processing thousands of files simultaneously: -```zig +```rust pub const Ref = packed struct(u64) { inner_index: u31, // Symbol index within the source file tag: enum(u2) { // Type of reference (symbol, invalid, etc.) @@ -533,7 +533,7 @@ _What happens_: _StableRef structure_: -```zig +```rust // Enables deterministic cross-chunk symbol ordering StableRef { stable_source_index: u32, // Consistent index across builds @@ -682,7 +682,7 @@ _Essential Ref methods used throughout_: _Symbol table organization_: -```zig +```rust // Two-dimensional array structure enables fast parallel merging symbol_table[source_index][inner_index] = Symbol { original_name: "myVariable", @@ -717,7 +717,7 @@ The renamed symbols are then used during final code generation to produce output ### Chunk Computation Phase -#### `computeChunks.zig` +#### `computeChunks.rust` **Purpose**: Determines the final chunk structure based on entry points and code splitting. @@ -729,7 +729,7 @@ The renamed symbols are then used during final code generation to produce output - Manages HTML chunk creation - Assigns unique keys and templates to chunks -#### `computeCrossChunkDependencies.zig` +#### `computeCrossChunkDependencies.rust` **Purpose**: Resolves dependencies between different chunks. @@ -740,7 +740,7 @@ The renamed symbols are then used during final code generation to produce output - Handles dynamic imports across chunks - Manages chunk metadata for dependency resolution -#### `findAllImportedPartsInJSOrder.zig` +#### `findAllImportedPartsInJSOrder.rust` **Purpose**: Determines the order of parts within JavaScript chunks. @@ -751,7 +751,7 @@ The renamed symbols are then used during final code generation to produce output - Manages import precedence - Ensures proper evaluation order -#### `findImportedCSSFilesInJSOrder.zig` +#### `findImportedCSSFilesInJSOrder.rust` **Purpose**: Determines CSS file ordering for JavaScript chunks that import CSS. @@ -761,7 +761,7 @@ The renamed symbols are then used during final code generation to produce output - Handles CSS dependency resolution - Manages CSS-in-JS import patterns -#### `findImportedFilesInCSSOrder.zig` +#### `findImportedFilesInCSSOrder.rust` **Purpose**: Determines the import order for CSS files. @@ -773,7 +773,7 @@ The renamed symbols are then used during final code generation to produce output ### Code Generation Phase -#### `generateCodeForFileInChunkJS.zig` +#### `generateCodeForFileInChunkJS.rust` **Purpose**: Generates JavaScript code for a specific file within a chunk. @@ -784,7 +784,7 @@ The renamed symbols are then used during final code generation to produce output - Manages HMR (Hot Module Replacement) code generation - Processes wrapper functions and runtime calls -#### `generateCompileResultForJSChunk.zig` +#### `generateCompileResultForJSChunk.rust` **Purpose**: Worker function that generates compile results for JavaScript chunks in parallel. @@ -795,7 +795,7 @@ The renamed symbols are then used during final code generation to produce output - Error handling in parallel context - Integration with thread pool -#### `generateCompileResultForCssChunk.zig` +#### `generateCompileResultForCssChunk.rust` **Purpose**: Worker function that generates compile results for CSS chunks in parallel. @@ -806,7 +806,7 @@ The renamed symbols are then used during final code generation to produce output - CSS import processing - Thread-safe CSS compilation -#### `generateCompileResultForHtmlChunk.zig` +#### `generateCompileResultForHtmlChunk.rust` **Purpose**: Worker function that generates compile results for HTML chunks. @@ -817,7 +817,7 @@ The renamed symbols are then used during final code generation to produce output - HTML minification - Script/stylesheet injection -#### `generateCodeForLazyExport.zig` +#### `generateCodeForLazyExport.rust` **Purpose**: Generates code for expression-style loaders that defer code generation until linking. @@ -865,7 +865,7 @@ The function resolves `composes` relationships by visiting the referenced classe ### Statement Processing -#### `convertStmtsForChunk.zig` +#### `convertStmtsForChunk.rust` **Purpose**: Converts and transforms AST statements for final inclusion in output chunks, handling the critical process of adapting module-level statements for different output formats and wrapper contexts. @@ -998,7 +998,7 @@ var init_demo = __esm(() => { This function is essential for maintaining JavaScript module semantics across different output formats while enabling optimal bundling strategies. -#### `convertStmtsForChunkForDevServer.zig` +#### `convertStmtsForChunkForDevServer.rust` **Purpose**: Special statement conversion for development server (HMR). @@ -1010,7 +1010,7 @@ This function is essential for maintaining JavaScript module semantics across di ### Post-Processing Phase -#### `prepareCssAstsForChunk.zig` +#### `prepareCssAstsForChunk.rust` **Purpose**: Prepares CSS ASTs before final processing. @@ -1020,7 +1020,7 @@ This function is essential for maintaining JavaScript module semantics across di - CSS optimization passes - Asset reference resolution -#### `postProcessJSChunk.zig` +#### `postProcessJSChunk.rust` **Purpose**: Final processing of JavaScript chunks after code generation. @@ -1031,7 +1031,7 @@ This function is essential for maintaining JavaScript module semantics across di - Source map integration - Output formatting -#### `postProcessCSSChunk.zig` +#### `postProcessCSSChunk.rust` **Purpose**: Final processing of CSS chunks. @@ -1042,7 +1042,7 @@ This function is essential for maintaining JavaScript module semantics across di - CSS minification - Source map generation -#### `postProcessHTMLChunk.zig` +#### `postProcessHTMLChunk.rust` **Purpose**: Final processing of HTML chunks. @@ -1055,7 +1055,7 @@ This function is essential for maintaining JavaScript module semantics across di ### Output Phase -#### `writeOutputFilesToDisk.zig` +#### `writeOutputFilesToDisk.rust` **Purpose**: Writes all generated chunks and assets to the filesystem. diff --git a/src/bundler/linker_context/StaticRouteVisitor.zig b/src/bundler/linker_context/StaticRouteVisitor.zig index ba06fb00efc..4d016985c19 100644 --- a/src/bundler/linker_context/StaticRouteVisitor.zig +++ b/src/bundler/linker_context/StaticRouteVisitor.zig @@ -1,7 +1,7 @@ //! The `isFullyStatic(source_index)` function returns whether or not //! `source_index` imports a file with `"use client"`. //! -//! TODO: Could we move this into the ReachableFileVisitor inside `bundle_v2.zig`? +//! TODO: Could we move this into the ReachableFileVisitor inside `bundle_v2.rust`? const StaticRouteVisitor = @This(); diff --git a/src/bundler/linker_context/generateChunksInParallel.zig b/src/bundler/linker_context/generateChunksInParallel.zig index 10d42d686e3..8991517b86b 100644 --- a/src/bundler/linker_context/generateChunksInParallel.zig +++ b/src/bundler/linker_context/generateChunksInParallel.zig @@ -782,7 +782,7 @@ pub const ThreadPool = bun.bundle_v2.ThreadPool; const debugPartRanges = Output.scoped(.PartRanges, .hidden); -const analyze_transpiled_module = @import("../analyze_transpiled_module.zig"); +const analyze_transpiled_module = @import("../analyze_transpiled_module.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/linker_context/generateCompileResultForJSChunk.zig b/src/bundler/linker_context/generateCompileResultForJSChunk.zig index 58b16bf2d63..f1127c863a6 100644 --- a/src/bundler/linker_context/generateCompileResultForJSChunk.zig +++ b/src/bundler/linker_context/generateCompileResultForJSChunk.zig @@ -87,7 +87,7 @@ fn generateCompileResultForJSChunkImpl(worker: *ThreadPool.Worker, c: *LinkerCon pub const DeferredBatchTask = bun.bundle_v2.DeferredBatchTask; pub const ParseTask = bun.bundle_v2.ParseTask; -const DeclCollector = @import("./generateCodeForFileInChunkJS.zig").DeclCollector; +const DeclCollector = @import("./generateCodeForFileInChunkJS.rust").DeclCollector; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bundler/linker_context/postProcessJSChunk.zig b/src/bundler/linker_context/postProcessJSChunk.zig index 06520ba28ef..f74d9198ef2 100644 --- a/src/bundler/linker_context/postProcessJSChunk.zig +++ b/src/bundler/linker_context/postProcessJSChunk.zig @@ -177,7 +177,7 @@ pub fn postProcessJSChunk(ctx: GenerateChunkCtx, worker: *ThreadPool.Worker, chu // when printing cross_chunk_prefix_stmts. if (record.source_index.isValid()) continue; // Skip barrel-optimized-away imports — marked is_unused by - // barrel_imports.zig. Never resolved (source_index invalid), + // barrel_imports.rust. Never resolved (source_index invalid), // and removed by convertStmtsForChunk. Not in emitted code. if (record.flags.is_unused) continue; @@ -1085,7 +1085,7 @@ pub fn generateEntryPointTailJS( }; } -const analyze_transpiled_module = @import("../analyze_transpiled_module.zig"); +const analyze_transpiled_module = @import("../analyze_transpiled_module.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler/options.zig b/src/bundler/options.zig index daea5ced59a..35bad8ed0f1 100644 --- a/src/bundler/options.zig +++ b/src/bundler/options.zig @@ -2,7 +2,7 @@ /// Normalization is necessary because most fields in the API schema are optional const std = @import("std"); -pub const defines = @import("./defines.zig"); +pub const defines = @import("./defines.rust"); pub const Define = defines.Define; pub const WriteDestination = enum { @@ -363,7 +363,7 @@ pub const ExternalModules = struct { }); }; -pub const BundlePackage = @import("../options_types/BundleEnums.zig").BundlePackage; +pub const BundlePackage = @import("../options_types/BundleEnums.rust").BundlePackage; pub const ModuleType = enum { unknown, @@ -393,7 +393,7 @@ pub const Target = enum { .{ "node", .node }, }); - pub const fromJS = @import("../bundler_jsc/options_jsc.zig").targetFromJS; + pub const fromJS = @import("../bundler_jsc/options_jsc.rust").targetFromJS; pub fn toAPI(this: Target) api.Target { return switch (this) { @@ -557,9 +557,9 @@ pub const Target = enum { } }; -pub const Format = @import("../options_types/BundleEnums.zig").Format; +pub const Format = @import("../options_types/BundleEnums.rust").Format; -pub const WindowsOptions = @import("../options_types/BundleEnums.zig").WindowsOptions; +pub const WindowsOptions = @import("../options_types/BundleEnums.rust").WindowsOptions; // The max integer value in this enum can only be appended to. // It has dependencies in several places: @@ -718,7 +718,7 @@ pub const Loader = enum(u8) { return stdin_name.get(this); } - pub const fromJS = @import("../bundler_jsc/options_jsc.zig").loaderFromJS; + pub const fromJS = @import("../bundler_jsc/options_jsc.rust").loaderFromJS; pub const names = bun.ComptimeStringMap(Loader, .{ .{ "js", .js }, @@ -2158,7 +2158,7 @@ pub const TransformOptions = struct { } }; -pub const OutputFile = @import("./OutputFile.zig"); +pub const OutputFile = @import("./OutputFile.rust"); pub const TransformResult = struct { errors: []logger.Msg = &([_]logger.Msg{}), @@ -2499,7 +2499,7 @@ pub const RouteConfig = struct { } }; -pub const GlobalCache = @import("../resolver/resolver.zig").GlobalCache; +pub const GlobalCache = @import("../resolver/resolver.rust").GlobalCache; pub const PathTemplate = struct { data: string = "", @@ -2632,15 +2632,15 @@ pub const PathTemplate = struct { const string = []const u8; -const DotEnv = @import("../dotenv/env_loader.zig"); -const Fs = @import("../resolver/fs.zig"); -const resolver = @import("../resolver/resolver.zig"); -const Runtime = @import("../js_parser/runtime.zig").Runtime; -const URL = @import("../url/url.zig").URL; +const DotEnv = @import("../dotenv/env_loader.rust"); +const Fs = @import("../resolver/fs.rust"); +const resolver = @import("../resolver/resolver.rust"); +const Runtime = @import("../js_parser/runtime.rust").Runtime; +const URL = @import("../url/url.rust").URL; -const MacroRemap = @import("../resolver/package_json.zig").MacroMap; -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; -const ConditionsMap = @import("../resolver/package_json.zig").ESModule.ConditionsMap; +const MacroRemap = @import("../resolver/package_json.rust").MacroMap; +const PackageJSON = @import("../resolver/package_json.rust").PackageJSON; +const ConditionsMap = @import("../resolver/package_json.rust").ESModule.ConditionsMap; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bundler/transpiler.zig b/src/bundler/transpiler.zig index 4368fd159ba..5d114f9b0a0 100644 --- a/src/bundler/transpiler.zig +++ b/src/bundler/transpiler.zig @@ -1,10 +1,10 @@ -pub const options = @import("./options.zig"); +pub const options = @import("./options.rust"); /// Opaque carrier for the macro evaluation context. Aliases through /// `bundler_jsc/` so this file has no direct JSC type reference. -pub const MacroJSCtx = @import("../bundler_jsc/PluginRunner.zig").MacroJSCtx; +pub const MacroJSCtx = @import("../bundler_jsc/PluginRunner.rust").MacroJSCtx; -pub const EntryPoints = @import("./entry_points.zig"); +pub const EntryPoints = @import("./entry_points.rust"); pub const ParseResult = struct { source: logger.Source, @@ -57,7 +57,7 @@ pub const ParseResult = struct { } }; -pub const PluginRunner = @import("../bundler_jsc/PluginRunner.zig").PluginRunner; +pub const PluginRunner = @import("../bundler_jsc/PluginRunner.rust").PluginRunner; /// This structure was the JavaScript transpiler before bundle_v2 was written. It now /// acts mostly as a configuration object, but it also contains stateful logic around @@ -505,7 +505,7 @@ pub const Transpiler = struct { entry.contents, opts, null, - // TODO: DO WE EVEN HAVE SOURCE INDEX IN THIS TRANSPILER.ZIG file?? + // TODO: DO WE EVEN HAVE SOURCE INDEX IN THIS TRANSPILER.RUST file?? bun.bundle_v2.Index.invalid, )) { .result => |v| v, @@ -1417,26 +1417,26 @@ pub const ResolveQueue = bun.LinearFifo( const string = []const u8; -const DotEnv = @import("../dotenv/env_loader.zig"); -const Fs = @import("../resolver/fs.zig"); -const MimeType = @import("../http_types/MimeType.zig"); -const NodeFallbackModules = @import("../resolver/node_fallbacks.zig"); -const Router = @import("../router/router.zig"); -const analyze_transpiled_module = @import("./analyze_transpiled_module.zig"); -const runtime = @import("../js_parser/runtime.zig"); +const DotEnv = @import("../dotenv/env_loader.rust"); +const Fs = @import("../resolver/fs.rust"); +const MimeType = @import("../http_types/MimeType.rust"); +const NodeFallbackModules = @import("../resolver/node_fallbacks.rust"); +const Router = @import("../router/router.rust"); +const analyze_transpiled_module = @import("./analyze_transpiled_module.rust"); +const runtime = @import("../js_parser/runtime.rust"); 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("../perf/system_timer.zig").Timer; -const URL = @import("../url/url.zig").URL; -const default_macro_js_value = @import("../bundler_jsc/PluginRunner.zig").default_macro_js_value; - -const _resolver = @import("../resolver/resolver.zig"); +const DataURL = @import("../resolver/data_url.rust").DataURL; +const MacroRemap = @import("../resolver/package_json.rust").MacroMap; +const PackageManager = @import("../install/install.rust").PackageManager; +const SystemTimer = @import("../perf/system_timer.rust").Timer; +const URL = @import("../url/url.rust").URL; +const default_macro_js_value = @import("../bundler_jsc/PluginRunner.rust").default_macro_js_value; + +const _resolver = @import("../resolver/resolver.rust"); const DebugLogs = _resolver.DebugLogs; const Resolver = _resolver.Resolver; -const linker = @import("./linker.zig"); +const linker = @import("./linker.rust"); const Linker = linker.Linker; const bun = @import("bun"); diff --git a/src/bundler_jsc/JSBundleCompletionTask.zig b/src/bundler_jsc/JSBundleCompletionTask.zig index 548c96648e6..a84a1b2b8ae 100644 --- a/src/bundler_jsc/JSBundleCompletionTask.zig +++ b/src/bundler_jsc/JSBundleCompletionTask.zig @@ -434,15 +434,15 @@ pub const JSBundleCompletionTask = struct { const throw_on_error = this.config.throw_on_error; const build_result = jsc.JSValue.createEmptyObject(globalThis, 3); - build_result.put(globalThis, jsc.ZigString.static("outputs"), jsc.JSValue.createEmptyArray(globalThis, 0) catch return promise.reject(globalThis, error.JSError)); + build_result.put(globalThis, jsc.RustString.static("outputs"), jsc.JSValue.createEmptyArray(globalThis, 0) catch return promise.reject(globalThis, error.JSError)); build_result.put( globalThis, - jsc.ZigString.static("success"), + jsc.RustString.static("success"), .false, ); build_result.put( globalThis, - jsc.ZigString.static("logs"), + jsc.RustString.static("logs"), this.log.toJSArray(globalThis, bun.default_allocator) catch |err| { return promise.reject(globalThis, err); }, @@ -557,11 +557,11 @@ pub const JSBundleCompletionTask = struct { }; } const build_output = jsc.JSValue.createEmptyObject(globalThis, 4); - build_output.put(globalThis, jsc.ZigString.static("outputs"), output_files_js); - build_output.put(globalThis, jsc.ZigString.static("success"), .true); + build_output.put(globalThis, jsc.RustString.static("outputs"), output_files_js); + build_output.put(globalThis, jsc.RustString.static("success"), .true); build_output.put( globalThis, - jsc.ZigString.static("logs"), + jsc.RustString.static("logs"), this.log.toJSArray(globalThis, bun.default_allocator) catch |err| { return promise.reject(globalThis, err); }, @@ -601,7 +601,7 @@ const string = []const u8; const std = @import("std"); -const bv2 = @import("../bundler/bundle_v2.zig"); +const bv2 = @import("../bundler/bundle_v2.rust"); const BundleThread = bv2.BundleThread; const BundleV2 = bv2.BundleV2; diff --git a/src/bundler_jsc/PluginRunner.zig b/src/bundler_jsc/PluginRunner.zig index 83829bbe8a3..df992c5bb98 100644 --- a/src/bundler_jsc/PluginRunner.zig +++ b/src/bundler_jsc/PluginRunner.zig @@ -1,5 +1,5 @@ //! Runtime plugin host (JS-side `Bun.plugin()` resolve hooks). Moved from -//! `bundler/transpiler.zig` so `bundler/` is free of `JSValue`/`JSGlobalObject`. +//! `bundler/transpiler.rust` so `bundler/` is free of `JSValue`/`JSGlobalObject`. pub const MacroJSCtx = jsc.JSValue; pub const default_macro_js_value = jsc.JSValue.zero; diff --git a/src/bundler_jsc/analyze_jsc.zig b/src/bundler_jsc/analyze_jsc.zig index 3764f35aa18..db821bfbae3 100644 --- a/src/bundler_jsc/analyze_jsc.zig +++ b/src/bundler_jsc/analyze_jsc.zig @@ -1,8 +1,8 @@ -//! JSC bridge for analyze_transpiled_module.zig — converts the parsed +//! JSC bridge for analyze_transpiled_module.rust — converts the parsed //! `ModuleInfoDeserialized` into a `JSC::JSModuleRecord`. Aliased back so the //! `export fn` symbol names are still discoverable from C++. -export fn zig__renderDiff(expected_ptr: [*:0]const u8, expected_len: usize, received_ptr: [*:0]const u8, received_len: usize, globalThis: *bun.jsc.JSGlobalObject) void { +export fn rust__renderDiff(expected_ptr: [*:0]const u8, expected_len: usize, received_ptr: [*:0]const u8, received_len: usize, globalThis: *bun.jsc.JSGlobalObject) void { const formatter = DiffFormatter{ .received_string = received_ptr[0..received_len], .expected_string = expected_ptr[0..expected_len], @@ -11,7 +11,7 @@ export fn zig__renderDiff(expected_ptr: [*:0]const u8, expected_len: usize, rece bun.Output.errorWriter().print("DIFF:\n{any}\n", .{formatter}) catch {}; } -export fn zig__ModuleInfoDeserialized__toJSModuleRecord( +export fn rust__ModuleInfoDeserialized__toJSModuleRecord( globalObject: *bun.jsc.JSGlobalObject, vm: *bun.jsc.VM, module_key: *const IdentifierArray, @@ -141,8 +141,8 @@ const JSModuleRecord = opaque { }; const bun = @import("bun"); -const DiffFormatter = @import("../runtime/test_runner/diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../runtime/test_runner/diff_format.rust").DiffFormatter; -const analyze = @import("../bundler/analyze_transpiled_module.zig"); +const analyze = @import("../bundler/analyze_transpiled_module.rust"); const ModuleInfoDeserialized = analyze.ModuleInfoDeserialized; const StringID = analyze.StringID; diff --git a/src/bundler_jsc/options_jsc.zig b/src/bundler_jsc/options_jsc.zig index 08706d52700..d69c89ac2bd 100644 --- a/src/bundler_jsc/options_jsc.zig +++ b/src/bundler_jsc/options_jsc.zig @@ -27,11 +27,11 @@ pub fn loaderFromJS(global: *jsc.JSGlobalObject, loader: jsc.JSValue) bun.JSErro return global.throwInvalidArguments("loader must be a string", .{}); } - var zig_str = jsc.ZigString.init(""); - try loader.toZigString(&zig_str, global); - if (zig_str.len == 0) return null; + var rust_str = jsc.RustString.init(""); + try loader.toRustString(&rust_str, global); + if (rust_str.len == 0) return null; - const slice = zig_str.toSlice(bun.default_allocator); + const slice = rust_str.toSlice(bun.default_allocator); defer slice.deinit(); return options.Loader.fromString(slice.slice()) orelse { @@ -62,7 +62,7 @@ pub fn compileTargetFromSlice(global: *jsc.JSGlobalObject, slice_with_bun_prefix return target_parsed; } -const CompileTarget = @import("../options_types/CompileTarget.zig"); +const CompileTarget = @import("../options_types/CompileTarget.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/bundler_jsc/output_file_jsc.zig b/src/bundler_jsc/output_file_jsc.zig index 597b41461cc..49af0c1c609 100644 --- a/src/bundler_jsc/output_file_jsc.zig +++ b/src/bundler_jsc/output_file_jsc.zig @@ -1,4 +1,4 @@ -//! `toJS`/`toBlob` bridges for `bundler/OutputFile.zig`. Aliased back so +//! `toJS`/`toBlob` bridges for `bundler/OutputFile.rust`. Aliased back so //! call sites stay `output.toJS(global)`. pub const SavedFile = struct { @@ -206,7 +206,7 @@ pub fn toBlob( const string = []const u8; -const OutputFile = @import("../bundler/OutputFile.zig"); +const OutputFile = @import("../bundler/OutputFile.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/bundler_jsc/source_map_mode_jsc.zig b/src/bundler_jsc/source_map_mode_jsc.zig index c8f83a773fc..fa2032901b9 100644 --- a/src/bundler_jsc/source_map_mode_jsc.zig +++ b/src/bundler_jsc/source_map_mode_jsc.zig @@ -1,5 +1,5 @@ //! `fromJS` for `bun.schema.api.SourceMapMode` — kept out of -//! `options_types/schema.zig` so that file has no `JSGlobalObject`/`JSValue` +//! `options_types/schema.rust` so that file has no `JSGlobalObject`/`JSValue` //! references. pub fn sourceMapModeFromJS(global: *bun.jsc.JSGlobalObject, value: bun.jsc.JSValue) bun.JSError!?SourceMapMode { diff --git a/src/c-headers-for-zig.h b/src/c-headers-for-zig.h index d08b86b7051..d759d829855 100644 --- a/src/c-headers-for-zig.h +++ b/src/c-headers-for-zig.h @@ -1,14 +1,14 @@ -// This file is run through translate-c and exposed to Zig code +// This file is run through translate-c and exposed to Rust code // under the namespace bun.c (lowercase c). Prefer adding includes // to this file instead of manually porting struct definitions -// into Zig code. By using automatic translation, differences +// into Rust code. By using automatic translation, differences // between platforms and subtle mistakes can be avoided. // // One way to locate a definition for a given symbol is to open -// Zig's `lib` directory and run ripgrep on it. For example, +// Rust's `lib` directory and run ripgrep on it. For example, // `sockaddr_dl` is in `libc/include/any-macos-any/net/if_dl.h` // -// When Zig is translating this file, it will define these macros: +// When Rust is translating this file, it will define these macros: // - WINDOWS // - DARWIN // - LINUX diff --git a/src/cares_sys/c_ares.zig b/src/cares_sys/c_ares.zig index 83936f493dc..f06c7baa1e0 100644 --- a/src/cares_sys/c_ares.zig +++ b/src/cares_sys/c_ares.zig @@ -192,7 +192,7 @@ pub const struct_hostent = extern struct { // hostent in glibc uses int for h_addrtype and h_length, whereas hostent in winsock2.h uses short. const hostent_int = if (bun.Environment.isWindows) c_short else c_int; - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").hostentToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").hostentToJSResponse; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_hostent) void; @@ -268,7 +268,7 @@ pub const hostent_with_ttls = struct { hostent: *struct_hostent, ttls: [256]c_int = [_]c_int{-1} ** 256, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").hostentWithTtlsToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").hostentWithTtlsToJSResponse; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*hostent_with_ttls) void; @@ -359,7 +359,7 @@ pub const struct_nameinfo = extern struct { node: [*c]u8, service: [*c]u8, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").nameinfoToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").nameinfoToJSResponse; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, node: ?struct_nameinfo) void; @@ -416,7 +416,7 @@ pub const AddrInfo = extern struct { node: ?*AddrInfo_node = null, name_: ?[*:0]u8 = null, - pub const toJSArray = @import("../runtime/dns_jsc/cares_jsc.zig").addrInfoToJSArray; + pub const toJSArray = @import("../runtime/dns_jsc/cares_jsc.rust").addrInfoToJSArray; pub inline fn name(this: *const AddrInfo) []const u8 { const name_ = this.name_ orelse return ""; @@ -752,9 +752,9 @@ pub const struct_ares_caa_reply = extern struct { value: [*c]u8, length: usize, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").caaReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").caaReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").caaReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").caaReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_caa_reply) void; @@ -795,9 +795,9 @@ pub const struct_ares_srv_reply = extern struct { weight: c_ushort, port: c_ushort, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").srvReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").srvReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").srvReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").srvReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_srv_reply) void; @@ -836,9 +836,9 @@ pub const struct_ares_mx_reply = extern struct { host: [*c]u8, priority: c_ushort, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").mxReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").mxReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").mxReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").mxReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_mx_reply) void; @@ -877,11 +877,11 @@ pub const struct_ares_txt_reply = extern struct { txt: [*c]u8, length: usize, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").txtReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").txtReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").txtReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").txtReplyToJS; - pub const toJSForAny = @import("../runtime/dns_jsc/cares_jsc.zig").txtReplyToJSForAny; + pub const toJSForAny = @import("../runtime/dns_jsc/cares_jsc.rust").txtReplyToJSForAny; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_txt_reply) void; @@ -930,9 +930,9 @@ pub const struct_ares_naptr_reply = extern struct { order: c_ushort, preference: c_ushort, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").naptrReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").naptrReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").naptrReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").naptrReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_naptr_reply) void; @@ -975,9 +975,9 @@ pub const struct_ares_soa_reply = extern struct { expire: c_uint, minttl: c_uint, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").soaReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").soaReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").soaReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").soaReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_ares_soa_reply) void; @@ -1032,9 +1032,9 @@ pub const struct_any_reply = struct { soa_reply: ?*struct_ares_soa_reply = null, caa_reply: ?*struct_ares_caa_reply = null, - pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.zig").anyReplyToJSResponse; + pub const toJSResponse = @import("../runtime/dns_jsc/cares_jsc.rust").anyReplyToJSResponse; - pub const toJS = @import("../runtime/dns_jsc/cares_jsc.zig").anyReplyToJS; + pub const toJS = @import("../runtime/dns_jsc/cares_jsc.rust").anyReplyToJS; pub fn Callback(comptime Type: type) type { return fn (*Type, status: ?Error, timeouts: i32, results: ?*struct_any_reply) void; @@ -1260,10 +1260,10 @@ pub const Error = enum(i32) { ESERVICE = ARES_ESERVICE, ENOSERVER = ARES_ENOSERVER, - pub const Deferred = @import("../runtime/dns_jsc/cares_jsc.zig").ErrorDeferred; - pub const toDeferred = @import("../runtime/dns_jsc/cares_jsc.zig").errorToDeferred; - pub const toJSWithSyscall = @import("../runtime/dns_jsc/cares_jsc.zig").errorToJSWithSyscall; - pub const toJSWithSyscallAndHostname = @import("../runtime/dns_jsc/cares_jsc.zig").errorToJSWithSyscallAndHostname; + pub const Deferred = @import("../runtime/dns_jsc/cares_jsc.rust").ErrorDeferred; + pub const toDeferred = @import("../runtime/dns_jsc/cares_jsc.rust").errorToDeferred; + pub const toJSWithSyscall = @import("../runtime/dns_jsc/cares_jsc.rust").errorToJSWithSyscall; + pub const toJSWithSyscallAndHostname = @import("../runtime/dns_jsc/cares_jsc.rust").errorToJSWithSyscallAndHostname; pub fn initEAI(rc: i32) ?Error { if (comptime bun.Environment.isWindows) { @@ -1490,7 +1490,7 @@ pub const ares_uri_reply = struct_ares_uri_reply; pub const ares_addr_node = struct_ares_addr_node; pub const ares_addr_port_node = struct_ares_addr_port_node; -// Bun__canonicalizeIP_ host fn: see src/runtime/dns_jsc/cares_jsc.zig +// Bun__canonicalizeIP_ host fn: see src/runtime/dns_jsc/cares_jsc.rust /// Creates a sockaddr structure from an address, port. /// diff --git a/src/clap/args.zig b/src/clap/args.zig index 0518bc79445..0d840f35f0b 100644 --- a/src/clap/args.zig +++ b/src/clap/args.zig @@ -227,7 +227,7 @@ pub const ShellIterator = struct { // The state we end up when after the escape character (`\`). All these // states do is transition back into the previous state. // TODO: Are there any escape sequences that does transform the second - // character into something else? For example, in Zig, `\n` is + // character into something else? For example, in Rust, `\n` is // transformed into the line feed ascii character. .no_quote_escape => switch (c) { else => state = .no_quote, diff --git a/src/clap/clap.zig b/src/clap/clap.zig index cd7de8a0059..f8bf023ff8b 100644 --- a/src/clap/clap.zig +++ b/src/clap/clap.zig @@ -1,7 +1,7 @@ -pub const args = @import("./args.zig"); +pub const args = @import("./args.rust"); -pub const ComptimeClap = @import("./comptime.zig").ComptimeClap; -pub const StreamingClap = @import("./streaming.zig").StreamingClap; +pub const ComptimeClap = @import("./comptime.rust").ComptimeClap; +pub const StreamingClap = @import("./streaming.rust").StreamingClap; /// The names a ::Param can have. pub const Names = struct { @@ -659,7 +659,7 @@ pub fn usageFull( const prefix = if (param.names.short) |_| "-" else "--"; - // Seems the zig compiler is being a little wierd. I doesn't allow me to write + // Seems the rust compiler is being a little wierd. I doesn't allow me to write // @as(*const [1]u8, s) VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV const name = if (param.names.short) |*s| @as([*]const u8, @ptrCast(s))[0..1] else param.names.long orelse { positional = param; @@ -724,7 +724,7 @@ fn testUsage(expected: []const u8, params: []const Param(Help)) !void { testing.expectEqualStrings(expected, fbs.getWritten()); } -const Output = @import("../bun_core/output.zig"); +const Output = @import("../bun_core/output.rust"); const bun = @import("bun"); const std = @import("std"); diff --git a/src/clap/comptime.zig b/src/clap/comptime.zig index a2a35c8d016..d755df278de 100644 --- a/src/clap/comptime.zig +++ b/src/clap/comptime.zig @@ -192,7 +192,7 @@ pub fn ComptimeClap( } const bun = @import("bun"); -const clap = @import("./clap.zig"); +const clap = @import("./clap.rust"); const std = @import("std"); const debug = std.debug; diff --git a/src/clap/streaming.zig b/src/clap/streaming.zig index 37ac8691a78..ff9592d3d98 100644 --- a/src/clap/streaming.zig +++ b/src/clap/streaming.zig @@ -437,7 +437,7 @@ test "errors" { testErr(¶ms, &[_][]const u8{"--cc"}, "The argument '--cc' requires a value but none was supplied\n"); } -const clap = @import("./clap.zig"); +const clap = @import("./clap.rust"); const args = clap.args; const bun = @import("bun"); diff --git a/src/codegen/bake-codegen.ts b/src/codegen/bake-codegen.ts index b60a3dba613..76753f36e70 100644 --- a/src/codegen/bake-codegen.ts +++ b/src/codegen/bake-codegen.ts @@ -14,14 +14,14 @@ if (!codegenRoot) { const base_dir = join(import.meta.dirname, "../runtime/bake"); process.chdir(base_dir); // to make bun build predictable in development -function convertZigEnum(zig: string, names: string[]) { - let output = "/** Generated from DevServer.zig */\n"; +function convertRustEnum(rust: string, names: string[]) { + let output = "/** Generated from DevServer.rust */\n"; for (const name of names) { const startTrigger = `\npub const ${name} = enum(u8) {`; - const start = zig.indexOf(startTrigger) + startTrigger.length; + const start = rust.indexOf(startTrigger) + startTrigger.length; const endTrigger = /\n pub (inline )?fn |\n};/g; - const end = zig.slice(start).search(endTrigger) + start; - const enumText = zig.slice(start, end); + const end = rust.slice(start).search(endTrigger) + start; + const enumText = rust.slice(start, end); const values = enumText.replaceAll("\n ", "\n ").replace(/\n\s*(\w+)\s*=\s*'(.+?)',/g, (_, name, value) => { return `\n ${name} = ${value.charCodeAt(0)},`; }); @@ -41,8 +41,8 @@ function css(file: string, is_development: boolean): string { } async function run() { - const devServerZig = readFileSync(join(base_dir, "DevServer.zig"), "utf-8"); - writeIfNotChanged(join(base_dir, "generated.ts"), convertZigEnum(devServerZig, ["IncomingMessageId", "MessageId"])); + const devServerRust = readFileSync(join(base_dir, "DevServer.rust"), "utf-8"); + writeIfNotChanged(join(base_dir, "generated.ts"), convertRustEnum(devServerRust, ["IncomingMessageId", "MessageId"])); const results = await Promise.allSettled( ["client", "server", "error"].map(async file => { diff --git a/src/codegen/bindgen-lib-internal.ts b/src/codegen/bindgen-lib-internal.ts index db0e6fb6abc..9269adaa994 100644 --- a/src/codegen/bindgen-lib-internal.ts +++ b/src/codegen/bindgen-lib-internal.ts @@ -23,7 +23,7 @@ export let structHashToSelf = new Map(); export const str = (v: any) => JSON.stringify(v); /** Capitalize */ export const cap = (s: string) => s[0].toUpperCase() + s.slice(1); -/** Escape a Zig Identifier */ +/** Escape a Rust Identifier */ export const zid = (s: string) => (s.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/) ? s : "@" + str(s)); /** Snake Case */ export const snake = (s: string) => @@ -39,7 +39,7 @@ export const camel = (s: string) => /** Pascal Case */ export const pascal = (s: string) => cap(camel(s)); -// Return symbol names of extern values (must be equivalent between C++ and Zig) +// Return symbol names of extern values (must be equivalent between C++ and Rust) /** The JS Host function, aka fn (*JSC.JSGlobalObject, *JSC.CallFrame) JSValue.MaybeException */ export const extJsFunction = (namespaceVar: string, fnLabel: string) => @@ -62,7 +62,7 @@ interface TypeDataDefs { value: TypeImpl; repr: "kv-slices"; }; - zigEnum: { + rustEnum: { file: string; impl: string; }; @@ -122,7 +122,7 @@ export class TypeImpl { } isVirtualArgument() { - return this.kind === "globalObject" || this.kind === "zigVirtualMachine"; + return this.kind === "globalObject" || this.kind === "rustVirtualMachine"; } hash() { @@ -139,7 +139,7 @@ export class TypeImpl { case "record": h += this.data.value.hash(); break; - case "zigEnum": + case "rustEnum": h += `${this.data.file}:${this.data.impl}`; break; case "stringEnum": @@ -169,7 +169,7 @@ export class TypeImpl { case "oneOf": case "dictionary": case "stringEnum": - case "zigEnum": + case "rustEnum": return true; default: return false; @@ -204,11 +204,11 @@ export class TypeImpl { case "usize": return kind; case "globalObject": - case "zigVirtualMachine": + case "rustVirtualMachine": return "*JSGlobalObject"; case "stringEnum": return cAbiTypeForEnum(this.data.length); - case "zigEnum": + case "rustEnum": throw new Error("TODO"); case "undefined": return "u0"; @@ -283,7 +283,7 @@ export class TypeImpl { const name = this.name(); const cAbiType = this.canDirectlyMapToCAbi(); const namespace = typeHashToNamespace.get(this.hash()); - if (cAbiType && typeof cAbiType === "string" && this.kind !== "zigEnum" && this.kind !== "stringEnum") { + if (cAbiType && typeof cAbiType === "string" && this.kind !== "rustEnum" && this.kind !== "stringEnum") { return cAbiTypeName(cAbiType); } return namespace ? `${namespace}::${cap(name)}` : name; @@ -714,9 +714,9 @@ export const isFunc = Symbol("isFunc"); export interface Func { [isFunc]: true; name: string; - zigPrefix: string; + rustPrefix: string; snapshot: string; - zigFile: string; + rustFile: string; variants: Variant[]; } @@ -735,7 +735,7 @@ export interface Arg { name: string; type: TypeImpl; loweringStrategy?: ArgStrategy; - zigMappedName?: string; + rustMappedName?: string; } /** @@ -779,7 +779,7 @@ export type ArgStrategyChildItem = * In addition to moving a payload over, an additional bit of information * crosses the ABI boundary indicating if the function threw an exception. * - * For simplicity, the possibility of any Zig binding returning an error/calling + * For simplicity, the possibility of any Rust binding returning an error/calling * `throw` is assumed and there isnt a way to disable the exception check. */ export type ReturnStrategy = @@ -805,11 +805,11 @@ export function registerFunction(opts: FuncOptions) { const snapshot = snapshotCallerLocation(); const filename = stackTraceFileName(snapshot); expect(filename).toEndWith(".bind.ts"); - const zigFile = path.relative(src, filename.replace(/\.bind\.ts$/, ".zig")); - let file = files.get(zigFile); + const rustFile = path.relative(src, filename.replace(/\.bind\.ts$/, ".rust")); + let file = files.get(rustFile); if (!file) { file = { functions: [], typedefs: [] }; - files.set(zigFile, file); + files.set(rustFile, file); } const variants: Variant[] = []; if ("variants" in opts) { @@ -837,9 +837,9 @@ export function registerFunction(opts: FuncOptions) { const func: Func = { [isFunc]: true, name: "", - zigPrefix: opts.implNamespace ? `${opts.implNamespace}.` : "", + rustPrefix: opts.implNamespace ? `${opts.implNamespace}.` : "", snapshot, - zigFile, + rustFile, variants, }; allFunctions.push(func); @@ -1052,14 +1052,14 @@ export class Struct { this.fields.push({ name, type: cType, size, naturalAlignment }); } - emitZig(zig: CodeWriter, semi: "with-semi" | "no-semi") { - zig.line("extern struct {"); - zig.indent(); + emitRust(rust: CodeWriter, semi: "with-semi" | "no-semi") { + rust.line("extern struct {"); + rust.indent(); for (const field of this.fields) { - zig.line(`${snake(field.name)}: ${field.type},`); + rust.line(`${snake(field.name)}: ${field.type},`); } - zig.dedent(); - zig.line("}" + (semi === "with-semi" ? ";" : "")); + rust.dedent(); + rust.line("}" + (semi === "with-semi" ? ";" : "")); } emitCpp(cpp: CodeWriter, structName: string) { diff --git a/src/codegen/bindgen-lib.ts b/src/codegen/bindgen-lib.ts index 37a7d6cddb3..edb6412c822 100644 --- a/src/codegen/bindgen-lib.ts +++ b/src/codegen/bindgen-lib.ts @@ -115,7 +115,7 @@ interface TypePropsMap { type PropertyMapKeys = keyof TypePropsMap; type Props = K extends PropertyMapKeys ? TypePropsMap[K] : BaseTypeProps; -export type AcceptedDictionaryTypeKind = Exclude; +export type AcceptedDictionaryTypeKind = Exclude; function builtinType() { return (kind: K) => new TypeImpl(kind, undefined as any, {}) as Type as Type; @@ -132,7 +132,7 @@ export namespace t { * Can only be used as an argument type. * Tells the code generator to pass `*JSC.VirtualMachine` as a parameter */ - export const zigVirtualMachine = builtinType()("zigVirtualMachine"); + export const rustVirtualMachine = builtinType()("rustVirtualMachine"); /** * Provides the raw JSValue from the JavaScriptCore API. Avoid using this if @@ -211,8 +211,8 @@ export namespace t { * }) * ``` * - * ```zig - * // foo.zig + * ```rust + * // foo.rust * pub fn foo(bar: []const u8) void { * // ... * } @@ -288,11 +288,11 @@ export namespace t { } /** - * Equivalent to `stringEnum`, but using an enum sourced from the given Zig + * Equivalent to `stringEnum`, but using an enum sourced from the given Rust * file. Use this to get an enum type that can have functions added. */ - export function zigEnum(file: string, impl: string): Type { - return new TypeImpl("zigEnum", { file, impl }); + export function rustEnum(file: string, impl: string): Type { + return new TypeImpl("rustEnum", { file, impl }); } } @@ -321,8 +321,8 @@ interface FuncOptionsWithVariant extends FuncMetadata { * }); * ``` * - * ```zig - * // foo.zig + * ```rust + * // foo.rust * pub fn foo1(a: i32) i32 { * return a; * } diff --git a/src/codegen/bindgen.ts b/src/codegen/bindgen.ts index 93a4129c337..295a8a51798 100644 --- a/src/codegen/bindgen.ts +++ b/src/codegen/bindgen.ts @@ -1,7 +1,7 @@ // The binding generator to rule them all. -// Converts binding definition files (.bind.ts) into C++ and Zig code. +// Converts binding definition files (.bind.ts) into C++ and Rust code. // -// Generated bindings are available in `bun.generated..*` in Zig, +// Generated bindings are available in `bun.generated..*` in Rust, // or `Generated::::*` in C++ from including `Generated.h`. import assert from "node:assert"; import fs from "node:fs"; @@ -60,7 +60,7 @@ function resolveVariantStrategies(vari: Variant, name: string) { const abiType = !isNullable && arg.type.canDirectlyMapToCAbi(); if (abiType) { arg.loweringStrategy = { - // This does not work in release builds, possibly due to a Zig 0.13 bug + // This does not work in release builds, possibly due to a Rust 0.13 bug // regarding by-value extern structs in C functions. // type: cAbiTypeInfo(abiType)[0] > 8 ? "c-abi-pointer" : "c-abi-value", // Always pass an argument by-pointer for now. @@ -327,7 +327,7 @@ function emitCppCallToVariant(name: string, variant: Variant, dispatchFunctionNa if (arg.type.isVirtualArgument()) { switch (arg.type.kind) { - case "zigVirtualMachine": + case "rustVirtualMachine": case "globalObject": addCommaAfterArgument(); cpp.add("global"); @@ -599,7 +599,7 @@ function getArgumentExceptionHandler(type: TypeImpl, argumentIndex: number, name } } switch (type.kind) { - case "zigEnum": + case "rustEnum": case "stringEnum": { return { params: `[](JSC::JSGlobalObject& global, JSC::ThrowScope& scope)`, @@ -719,21 +719,21 @@ function emitConvertDictionaryFunction(type: TypeImpl) { cpp.line(); } -function emitZigStruct(type: TypeImpl) { - zig.add(`pub const ${type.name()} = `); +function emitRustStruct(type: TypeImpl) { + rust.add(`pub const ${type.name()} = `); switch (type.kind) { - case "zigEnum": + case "rustEnum": case "stringEnum": { const signPrefix = "u"; const tagType = `${signPrefix}${alignForward(type.data.length, 8)}`; - zig.line(`enum(${tagType}) {`); - zig.indent(); + rust.line(`enum(${tagType}) {`); + rust.indent(); for (const value of type.data) { - zig.line(`${snake(value)},`); + rust.line(`${snake(value)},`); } - zig.dedent(); - zig.line("};"); + rust.dedent(); + rust.line("};"); return; } } @@ -741,32 +741,32 @@ function emitZigStruct(type: TypeImpl) { const externLayout = type.canDirectlyMapToCAbi(); if (externLayout) { if (typeof externLayout === "string") { - zig.line(externLayout + ";"); + rust.line(externLayout + ";"); } else { - externLayout.emitZig(zig, "with-semi"); + externLayout.emitRust(rust, "with-semi"); } return; } switch (type.kind) { case "dictionary": { - zig.line("struct {"); - zig.indent(); + rust.line("struct {"); + rust.indent(); for (const { key, type: fieldType } of type.data as DictionaryField[]) { - zig.line(` ${snake(key)}: ${zigTypeName(fieldType)},`); + rust.line(` ${snake(key)}: ${rustTypeName(fieldType)},`); } - zig.dedent(); - zig.line(`};`); + rust.dedent(); + rust.line(`};`); break; } default: { - throw new Error(`TODO: emitZigStruct for Type ${type.kind}`); + throw new Error(`TODO: emitRustStruct for Type ${type.kind}`); } } } function emitCppStructHeader(w: CodeWriter, type: TypeImpl) { - if (type.kind === "zigEnum" || type.kind === "stringEnum") { + if (type.kind === "rustEnum" || type.kind === "stringEnum") { emitCppEnumHeader(w, type); return; } @@ -785,13 +785,13 @@ function emitCppStructHeader(w: CodeWriter, type: TypeImpl) { switch (type.kind) { default: { - throw new Error(`TODO: emitZigStruct for Type ${type.kind}`); + throw new Error(`TODO: emitRustStruct for Type ${type.kind}`); } } } function emitCppEnumHeader(w: CodeWriter, type: TypeImpl) { - assert(type.kind === "zigEnum" || type.kind === "stringEnum"); + assert(type.kind === "rustEnum" || type.kind === "stringEnum"); assert(type.kind === "stringEnum"); // TODO assert(type.data.length > 0); @@ -808,7 +808,7 @@ function emitCppEnumHeader(w: CodeWriter, type: TypeImpl) { // This function assumes in the WebCore namespace function emitConvertEnumFunction(w: CodeWriter, type: TypeImpl) { - assert(type.kind === "zigEnum" || type.kind === "stringEnum"); + assert(type.kind === "rustEnum" || type.kind === "stringEnum"); assert(type.kind === "stringEnum"); // TODO assert(type.data.length > 0); @@ -863,15 +863,15 @@ function emitConvertEnumFunction(w: CodeWriter, type: TypeImpl) { w.line(); } -function zigTypeName(type: TypeImpl): string { - let name = zigTypeNameInner(type); +function rustTypeName(type: TypeImpl): string { + let name = rustTypeNameInner(type); if (type.flags.optional) { name = "?" + name; } return name; } -function zigTypeNameInner(type: TypeImpl): string { +function rustTypeNameInner(type: TypeImpl): string { if (type.lowersToNamedType()) { const namespace = typeHashToNamespace.get(type.hash()); return namespace ? `${namespace}.${type.name()}` : type.name(); @@ -887,7 +887,7 @@ function zigTypeNameInner(type: TypeImpl): string { case "usize": return "usize"; case "globalObject": - case "zigVirtualMachine": + case "rustVirtualMachine": return "*jsc.JSGlobalObject"; default: const cAbiType = type.canDirectlyMapToCAbi(); @@ -897,7 +897,7 @@ function zigTypeNameInner(type: TypeImpl): string { } return cAbiType.name(); } - throw new Error(`TODO: emitZigTypeName for Type ${type.kind}`); + throw new Error(`TODO: emitRustTypeName for Type ${type.kind}`); } } @@ -915,7 +915,7 @@ function returnStrategyCppType(strategy: ReturnStrategy): string { } } -function returnStrategyZigType(strategy: ReturnStrategy): string { +function returnStrategyRustType(strategy: ReturnStrategy): string { switch (strategy.type) { case "basic-out-param": case "void": @@ -924,12 +924,12 @@ function returnStrategyZigType(strategy: ReturnStrategy): string { return "jsc.JSValue"; default: throw new Error( - `TODO: returnStrategyZigType for ${Bun.inspect(strategy satisfies never, { colors: Bun.enableANSIColors })}`, + `TODO: returnStrategyRustType for ${Bun.inspect(strategy satisfies never, { colors: Bun.enableANSIColors })}`, ); } } -function emitNullableZigDecoder(w: CodeWriter, prefix: string, type: TypeImpl, children: ArgStrategyChildItem[]) { +function emitNullableRustDecoder(w: CodeWriter, prefix: string, type: TypeImpl, children: ArgStrategyChildItem[]) { assert(children.length > 0); const indent = children[0].type !== "c-abi-compatible"; w.add(`if (${prefix}_set)`); @@ -938,7 +938,7 @@ function emitNullableZigDecoder(w: CodeWriter, prefix: string, type: TypeImpl, c } else { w.add(` `); } - emitComplexZigDecoder(w, prefix + "_value", type, children); + emitComplexRustDecoder(w, prefix + "_value", type, children); if (indent) { w.line(); w.dedent(); @@ -955,7 +955,7 @@ function emitNullableZigDecoder(w: CodeWriter, prefix: string, type: TypeImpl, c if (indent) w.dedent(); } -function emitComplexZigDecoder(w: CodeWriter, prefix: string, type: TypeImpl, children: ArgStrategyChildItem[]) { +function emitComplexRustDecoder(w: CodeWriter, prefix: string, type: TypeImpl, children: ArgStrategyChildItem[]) { assert(children.length > 0); if (children[0].type === "c-abi-compatible") { w.add(`${prefix}`); @@ -964,7 +964,7 @@ function emitComplexZigDecoder(w: CodeWriter, prefix: string, type: TypeImpl, ch switch (type.kind) { default: - throw new Error(`TODO: emitComplexZigDecoder for Type ${type.kind}`); + throw new Error(`TODO: emitComplexRustDecoder for Type ${type.kind}`); } } @@ -1163,19 +1163,19 @@ const unsortedFiles = readdirRecursiveWithExclusionsAndExtensionsSync(src, ["nod // Sort for deterministic output for (const fileName of [...unsortedFiles].sort()) { - const zigFile = path.relative(src, fileName.replace(/\.bind\.ts$/, ".zig")); - const zigFilePath = path.join(src, zigFile); - let file = files.get(zigFile); - if (!fs.existsSync(zigFilePath)) { + const rustFile = path.relative(src, fileName.replace(/\.bind\.ts$/, ".rust")); + const rustFilePath = path.join(src, rustFile); + let file = files.get(rustFile); + if (!fs.existsSync(rustFilePath)) { // It would be nice if this would generate the file with the correct boilerplate const bindName = path.basename(fileName); throw new Error( - `${bindName} is missing a corresponding Zig file at ${zigFile}. Please create it and make sure it matches signatures in ${bindName}.`, + `${bindName} is missing a corresponding Rust file at ${rustFile}. Please create it and make sure it matches signatures in ${bindName}.`, ); } if (!file) { file = { functions: [], typedefs: [] }; - files.set(zigFile, file); + files.set(rustFile, file); } const exports = import.meta.require(fileName); @@ -1205,24 +1205,24 @@ for (const fileName of [...unsortedFiles].sort()) { } } -const zig = new CodeWriter(); -const zigInternal = new CodeWriter(); +const rust = new CodeWriter(); +const rustInternal = new CodeWriter(); // TODO: split each *.bind file into a separate .cpp file const cpp = new CodeWriter(); const cppInternal = new CodeWriter(); const headers = new Set(); -zig.line('const bun = @import("bun");'); -zig.line("const jsc = bun.jsc;"); -zig.line("const JSHostFunctionType = jsc.JSHostFn;\n"); +rust.line('const bun = @import("bun");'); +rust.line("const jsc = bun.jsc;"); +rust.line("const JSHostFunctionType = jsc.JSHostFn;\n"); -zigInternal.line("const binding_internals = struct {"); -zigInternal.indent(); +rustInternal.line("const binding_internals = struct {"); +rustInternal.indent(); cpp.line("namespace Generated {"); cpp.line(); -cppInternal.line('// These "Arguments" definitions are for communication between C++ and Zig.'); +cppInternal.line('// These "Arguments" definitions are for communication between C++ and Rust.'); cppInternal.line('// Field layout depends on implementation details in "bindgen.ts", and'); cppInternal.line("// is not intended for usage outside generated binding code."); @@ -1237,17 +1237,17 @@ headers.add("JSDOMExceptionHandling.h"); headers.add("JSDOMOperation.h"); /** - * Indexed by `zigFile`, values are the generated zig identifier name, without + * Indexed by `rustFile`, values are the generated rust identifier name, without * collisions. */ const fileMap = new Map(); const fileNames = new Set(); for (const [filename, { functions, typedefs }] of files) { - const basename = path.basename(filename, ".zig"); + const basename = path.basename(filename, ".rust"); let varName = basename; if (fileNames.has(varName)) { - throw new Error(`File name collision: ${basename}.zig`); + throw new Error(`File name collision: ${basename}.rust`); } fileNames.add(varName); fileMap.set(filename, varName); @@ -1275,7 +1275,7 @@ for (const type of typeHashToReachableType.values()) { emitConvertDictionaryFunction(type); break; case "stringEnum": - case "zigEnum": + case "rustEnum": needsWebCore = true; break; } @@ -1284,14 +1284,14 @@ 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("../../" + filename)});`); + rustInternal.line(`const import_${namespaceVar} = @import(${str("../../" + filename)});`); - zig.line(`/// Generated for "src/${filename}"`); - zig.line(`pub const ${namespaceVar} = struct {`); - zig.indent(); + rust.line(`/// Generated for "src/${filename}"`); + rust.line(`pub const ${namespaceVar} = struct {`); + rust.indent(); for (const fn of functions) { - cpp.line(`// Dispatch for \"fn ${zid(fn.name)}(...)\" in \"src/${fn.zigFile}\"`); + cpp.line(`// Dispatch for \"fn ${zid(fn.name)}(...)\" in \"src/${fn.rustFile}\"`); const externName = extJsFunction(namespaceVar, fn.name); // C++ forward declarations @@ -1354,7 +1354,7 @@ for (const [filename, { functions, typedefs }] of files) { } // Public function - zig.line( + rust.line( `pub const ${zid("js" + cap(fn.name))} = @extern(*const JSHostFunctionType, .{ .name = ${str(externName)} });`, ); @@ -1376,7 +1376,7 @@ for (const [filename, { functions, typedefs }] of files) { cpp.line(`}`); cpp.line(); - // Generated Zig dispatch functions + // Generated Rust dispatch functions variNum = 1; for (const vari of fn.variants) { const dispatchName = extDispatchVariant(namespaceVar, fn.name, variNum); @@ -1384,8 +1384,8 @@ for (const [filename, { functions, typedefs }] of files) { const returnStrategy = vari.returnStrategy!; const { communicationStruct } = vari; if (communicationStruct) { - zigInternal.add(`const ${communicationStruct.name()} = `); - communicationStruct.emitZig(zigInternal, "with-semi"); + rustInternal.add(`const ${communicationStruct.name()} = `); + communicationStruct.emitRust(rustInternal, "with-semi"); } assert(vari.globalObjectArg !== undefined); @@ -1406,19 +1406,19 @@ for (const [filename, { functions, typedefs }] of files) { globalObjectArg = argName; } argNum += 1; - arg.zigMappedName = argName; + arg.rustMappedName = argName; const strategy = arg.loweringStrategy!; switch (strategy.type) { case "c-abi-pointer": - args.push(`${argName}: *const ${zigTypeName(arg.type)}`); + args.push(`${argName}: *const ${rustTypeName(arg.type)}`); break; case "c-abi-value": - args.push(`${argName}: ${zigTypeName(arg.type)}`); + args.push(`${argName}: ${rustTypeName(arg.type)}`); break; case "uses-communication-buffer": break; default: - throw new Error(`TODO: zig dispatch function for ${inspect(strategy)}`); + throw new Error(`TODO: rust dispatch function for ${inspect(strategy)}`); } } assert(globalObjectArg, `globalObjectArg not found from ${vari.globalObjectArg}`); @@ -1428,57 +1428,57 @@ for (const [filename, { functions, typedefs }] of files) { } if (returnStrategy.type === "basic-out-param") { - args.push(`out: *${zigTypeName(vari.ret)}`); + args.push(`out: *${rustTypeName(vari.ret)}`); } - zigInternal.line(`export fn ${zid(dispatchName)}(${args.join(", ")}) ${returnStrategyZigType(returnStrategy)} {`); - zigInternal.indent(); + rustInternal.line(`export fn ${zid(dispatchName)}(${args.join(", ")}) ${returnStrategyRustType(returnStrategy)} {`); + rustInternal.indent(); - zigInternal.line( - `if (!@hasDecl(import_${namespaceVar}${fn.zigPrefix.length > 0 ? "." + fn.zigPrefix.slice(0, -1) : ""}, ${str(fn.name + vari.suffix)}))`, + rustInternal.line( + `if (!@hasDecl(import_${namespaceVar}${fn.rustPrefix.length > 0 ? "." + fn.rustPrefix.slice(0, -1) : ""}, ${str(fn.name + vari.suffix)}))`, ); - zigInternal.line( - ` @compileError(${str(`Missing binding declaration "${fn.zigPrefix}${fn.name + vari.suffix}" in "${path.basename(filename)}"`)});`, + rustInternal.line( + ` @compileError(${str(`Missing binding declaration "${fn.rustPrefix}${fn.name + vari.suffix}" in "${path.basename(filename)}"`)});`, ); for (const arg of vari.args) { if (arg.type.kind === "UTF8String") { - zigInternal.line(`const ${arg.zigMappedName}_utf8 = ${arg.zigMappedName}.toUTF8(bun.default_allocator);`); - zigInternal.line(`defer ${arg.zigMappedName}_utf8.deinit();`); + rustInternal.line(`const ${arg.rustMappedName}_utf8 = ${arg.rustMappedName}.toUTF8(bun.default_allocator);`); + rustInternal.line(`defer ${arg.rustMappedName}_utf8.deinit();`); } } switch (returnStrategy.type) { case "jsvalue": - zigInternal.add(`return jsc.toJSHostCall(${globalObjectArg}, @src(), `); + rustInternal.add(`return jsc.toJSHostCall(${globalObjectArg}, @src(), `); break; case "basic-out-param": - zigInternal.add(`out.* = @as(bun.JSError!${returnStrategy.abiType}, `); + rustInternal.add(`out.* = @as(bun.JSError!${returnStrategy.abiType}, `); break; case "void": - zigInternal.add(`@as(bun.JSError!void, `); + rustInternal.add(`@as(bun.JSError!void, `); break; } - zigInternal.add(`${zid("import_" + namespaceVar)}.${fn.zigPrefix}${fn.name + vari.suffix}`); + rustInternal.add(`${zid("import_" + namespaceVar)}.${fn.rustPrefix}${fn.name + vari.suffix}`); if (returnStrategy.type === "jsvalue") { - zigInternal.line(", .{"); + rustInternal.line(", .{"); } else { - zigInternal.line("("); + rustInternal.line("("); } - zigInternal.indent(); + rustInternal.indent(); for (const arg of vari.args) { - const argName = arg.zigMappedName!; + const argName = arg.rustMappedName!; if (arg.type.isIgnoredUndefinedType()) continue; if (arg.type.isVirtualArgument()) { switch (arg.type.kind) { - case "zigVirtualMachine": - zigInternal.line(`${argName}.bunVM(),`); + case "rustVirtualMachine": + rustInternal.line(`${argName}.bunVM(),`); break; case "globalObject": - zigInternal.line(`${argName},`); + rustInternal.line(`${argName},`); break; default: throw new Error("unexpected"); @@ -1490,70 +1490,70 @@ for (const [filename, { functions, typedefs }] of files) { switch (strategy.type) { case "c-abi-pointer": if (arg.type.kind === "UTF8String") { - zigInternal.line(`${argName}_utf8.slice(),`); + rustInternal.line(`${argName}_utf8.slice(),`); break; } - zigInternal.line(`${argName}.*,`); + rustInternal.line(`${argName}.*,`); break; case "c-abi-value": - zigInternal.line(`${argName},`); + rustInternal.line(`${argName},`); break; case "uses-communication-buffer": const prefix = `buf.${snake(arg.name)}`; const type = arg.type; const isNullable = type.flags.optional && !("default" in type.flags); - if (isNullable) emitNullableZigDecoder(zigInternal, prefix, type, strategy.children); - else emitComplexZigDecoder(zigInternal, prefix, type, strategy.children); - zigInternal.line(`,`); + if (isNullable) emitNullableRustDecoder(rustInternal, prefix, type, strategy.children); + else emitComplexRustDecoder(rustInternal, prefix, type, strategy.children); + rustInternal.line(`,`); break; default: - throw new Error(`TODO: zig dispatch function for ${inspect(strategy satisfies never)}`); + throw new Error(`TODO: rust dispatch function for ${inspect(strategy satisfies never)}`); } } - zigInternal.dedent(); + rustInternal.dedent(); switch (returnStrategy.type) { case "jsvalue": - zigInternal.line(`});`); + rustInternal.line(`});`); break; case "basic-out-param": case "void": - zigInternal.line(`)) catch |err| switch (err) {`); - zigInternal.line(` error.JSError => return false,`); - zigInternal.line(` error.OutOfMemory => ${globalObjectArg}.throwOutOfMemory() catch return false,`); - zigInternal.line(` error.JSTerminated => return false,`); - zigInternal.line(`};`); - zigInternal.line(`return true;`); + rustInternal.line(`)) catch |err| switch (err) {`); + rustInternal.line(` error.JSError => return false,`); + rustInternal.line(` error.OutOfMemory => ${globalObjectArg}.throwOutOfMemory() catch return false,`); + rustInternal.line(` error.JSTerminated => return false,`); + rustInternal.line(`};`); + rustInternal.line(`return true;`); break; } - zigInternal.dedent(); - zigInternal.line(`}`); + rustInternal.dedent(); + rustInternal.line(`}`); variNum += 1; } } if (functions.length > 0) { - zig.line(); + rust.line(); } for (const fn of functions) { // Wrapper to init JSValue const wrapperName = zid("create" + cap(fn.name) + "Callback"); const minArgCount = fn.variants.reduce((acc, vari) => Math.min(acc, vari.args.length), Number.MAX_SAFE_INTEGER); - zig.line(`pub fn ${wrapperName}(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue {`); - zig.line( - ` return jsc.host_fn.NewRuntimeFunction(global, jsc.ZigString.static(${str(fn.name)}), ${minArgCount}, js${cap(fn.name)}, false, null);`, + rust.line(`pub fn ${wrapperName}(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue {`); + rust.line( + ` return jsc.host_fn.NewRuntimeFunction(global, jsc.RustString.static(${str(fn.name)}), ${minArgCount}, js${cap(fn.name)}, false, null);`, ); - zig.line(`}`); + rust.line(`}`); } if (typedefs.length > 0) { - zig.line(); + rust.line(); } for (const td of typedefs) { - emitZigStruct(td.type); + emitRustStruct(td.type); } - zig.dedent(); - zig.line(`};`); - zig.line(); + rust.dedent(); + rust.line(`};`); + rust.line(); } cpp.line("} // namespace Generated"); @@ -1563,7 +1563,7 @@ if (needsWebCore) { cpp.line(); for (const [type, reachableType] of typeHashToReachableType) { switch (reachableType.kind) { - case "zigEnum": + case "rustEnum": case "stringEnum": emitConvertEnumFunction(cpp, reachableType); break; @@ -1573,22 +1573,22 @@ if (needsWebCore) { cpp.line(); } -zigInternal.dedent(); -zigInternal.line("};"); -zigInternal.line(); -zigInternal.line("comptime {"); -zigInternal.line(` if (bun.Environment.export_cpp_apis) {`); -zigInternal.line(' for (@typeInfo(binding_internals).@"struct".decls) |decl| {'); -zigInternal.line(" _ = &@field(binding_internals, decl.name);"); -zigInternal.line(" }"); -zigInternal.line(" }"); -zigInternal.line("}"); +rustInternal.dedent(); +rustInternal.line("};"); +rustInternal.line(); +rustInternal.line("comptime {"); +rustInternal.line(` if (bun.Environment.export_cpp_apis) {`); +rustInternal.line(' for (@typeInfo(binding_internals).@"struct".decls) |decl| {'); +rustInternal.line(" _ = &@field(binding_internals, decl.name);"); +rustInternal.line(" }"); +rustInternal.line(" }"); +rustInternal.line("}"); writeIfNotChanged( path.join(codegenRoot, "GeneratedBindings.cpp"), [...headers].map(name => `#include ${str(name)}\n`).join("") + "\n" + cppInternal.buffer + "\n" + cpp.buffer, ); -writeIfNotChanged(path.join(src, "jsc/bindings/GeneratedBindings.zig"), zig.buffer + zigInternal.buffer); +writeIfNotChanged(path.join(src, "jsc/bindings/GeneratedBindings.rust"), rust.buffer + rustInternal.buffer); // Headers for (const [filename, { functions, typedefs }] of files) { @@ -1618,7 +1618,7 @@ for (const [filename, { functions, typedefs }] of files) { emitCppStructHeader(header, td.type); switch (td.type.kind) { - case "zigEnum": + case "rustEnum": case "stringEnum": case "dictionary": needsWebCoreNamespace = true; @@ -1640,7 +1640,7 @@ for (const [filename, { functions, typedefs }] of files) { header.line(); for (const td of typedefs) { switch (td.type.kind) { - case "zigEnum": + case "rustEnum": case "stringEnum": headerIncludes.add("JSDOMConvertEnumeration.h"); const basename = td.type.name(); diff --git a/src/codegen/bindgenv2/internal/any.ts b/src/codegen/bindgenv2/internal/any.ts index 024d175805a..d0da984c3c5 100644 --- a/src/codegen/bindgenv2/internal/any.ts +++ b/src/codegen/bindgenv2/internal/any.ts @@ -7,7 +7,7 @@ export const RawAny = new (class extends Type { get bindgenType() { return "bindgen.BindgenRawAny"; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bun.bun_js.jsc.JSValue"; } toCpp(value: any): string { @@ -22,11 +22,11 @@ export const StrongAny = new (class extends Type { get bindgenType() { return "bindgen.BindgenStrongAny"; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bun.bun_js.jsc.Strong"; } - optionalZigType(style?: CodeStyle) { - return this.zigType(style) + ".Optional"; + optionalRustType(style?: CodeStyle) { + return this.rustType(style) + ".Optional"; } toCpp(value: any): string { throw RangeError("`StrongAny` cannot have a default value"); diff --git a/src/codegen/bindgenv2/internal/array.ts b/src/codegen/bindgenv2/internal/array.ts index 51444b8c6c5..e34964f5776 100644 --- a/src/codegen/bindgenv2/internal/array.ts +++ b/src/codegen/bindgenv2/internal/array.ts @@ -14,8 +14,8 @@ export function Array(elemType: Type): ArrayType { get bindgenType() { return `bindgen.BindgenArray(${elemType.bindgenType})`; } - zigType(style?: CodeStyle) { - return `bun.collections.ArrayListDefault(${elemType.zigType(style)})`; + rustType(style?: CodeStyle) { + return `bun.collections.ArrayListDefault(${elemType.rustType(style)})`; } toCpp(value: any[]): string { const args = `${value.map(elem => elemType.toCpp(elem)).join(", ")}`; diff --git a/src/codegen/bindgenv2/internal/base.ts b/src/codegen/bindgenv2/internal/base.ts index 4162f711ae1..c9b31ce87d9 100644 --- a/src/codegen/bindgenv2/internal/base.ts +++ b/src/codegen/bindgenv2/internal/base.ts @@ -20,16 +20,16 @@ export abstract class Type { /** * This can be overridden to make the generated code clearer. If overridden, it must return an - * expression that evaluates to the same type as `${this.bindgenType}.ZigType`; it should not + * expression that evaluates to the same type as `${this.bindgenType}.RustType`; it should not * actually change the type. */ - zigType(style?: CodeStyle): string { - return this.bindgenType + ".ZigType"; + rustType(style?: CodeStyle): string { + return this.bindgenType + ".RustType"; } - /** This must be overridden if bindgen.zig defines a custom `OptionalZigType`. */ - optionalZigType(style?: CodeStyle): string { - return `?${this.zigType(style)}`; + /** This must be overridden if bindgen.rust defines a custom `OptionalRustType`. */ + optionalRustType(style?: CodeStyle): string { + return `?${this.rustType(style)}`; } /** Converts a JS value into a C++ expression. Used for default values. */ @@ -56,7 +56,7 @@ export abstract class NamedType extends Type { get cppSource(): string | null { return null; } - get zigSource(): string | null { + get rustSource(): string | null { return null; } // These getters are faster than `.cppHeader != null` etc. @@ -66,7 +66,7 @@ export abstract class NamedType extends Type { get hasCppSource(): boolean { return false; } - get hasZigSource(): boolean { + get hasRustSource(): boolean { return false; } getHeaders(result: Set): void { diff --git a/src/codegen/bindgenv2/internal/dictionary.ts b/src/codegen/bindgenv2/internal/dictionary.ts index e2a7030c018..9fe4f1b60ef 100644 --- a/src/codegen/bindgenv2/internal/dictionary.ts +++ b/src/codegen/bindgenv2/internal/dictionary.ts @@ -19,7 +19,7 @@ export interface DictionaryMember { type: Type; /** Optional default value to use when this member is missing or undefined. */ default?: any; - /** The name used in generated Zig/C++ code. Defaults to the public JS name. */ + /** The name used in generated Rust/C++ code. Defaults to the public JS name. */ internalName?: string; /** Alternative JavaScript names for this member. */ altNames?: string[]; @@ -39,7 +39,7 @@ interface DictionaryOptions { name: string; /** Used in error messages. Defaults to `name`. */ userFacingName?: string; - /** Whether to generate a Zig `fromJS` function. */ + /** Whether to generate a Rust `fromJS` function. */ generateConversionFunction?: boolean; } @@ -73,7 +73,7 @@ export function dictionary( get bindgenType() { return `bindgen_generated.internal.${name}`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `bindgen_generated.${name}`; } get dependencies() { @@ -257,10 +257,10 @@ export function dictionary( `); } - get hasZigSource() { + get hasRustSource() { return true; } - get zigSource() { + get rustSource() { return reindent(` pub const ${name} = struct { const Self = @This(); @@ -268,7 +268,7 @@ export function dictionary( ${joinIndented( 10, fullMembers.map(memberInfo => { - return `${memberInfo.internalName}: ${memberInfo.type.zigType("pretty")},`; + return `${memberInfo.internalName}: ${memberInfo.type.rustType("pretty")},`; }), )} @@ -304,9 +304,9 @@ export function dictionary( pub const Bindgen${name} = struct { const Self = @This(); - pub const ZigType = ${name}; + pub const RustType = ${name}; pub const ExternType = Extern${name}; - pub fn convertFromExtern(extern_value: Self.ExternType) Self.ZigType { + pub fn convertFromExtern(extern_value: Self.ExternType) Self.RustType { return .{ ${joinIndented( 14, diff --git a/src/codegen/bindgenv2/internal/enumeration.ts b/src/codegen/bindgenv2/internal/enumeration.ts index 2839fbeab56..b6065261c2f 100644 --- a/src/codegen/bindgenv2/internal/enumeration.ts +++ b/src/codegen/bindgenv2/internal/enumeration.ts @@ -64,7 +64,7 @@ export function enumeration( get bindgenType() { return `bindgen_generated.internal.${name}`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `bindgen_generated.${name}`; } toCpp(value: string): string { @@ -174,10 +174,10 @@ export function enumeration( `); } - get hasZigSource() { + get hasRustSource() { return true; } - get zigSource() { + get rustSource() { return reindent(` pub const ${name} = enum(u32) { ${joinIndented( diff --git a/src/codegen/bindgenv2/internal/interfaces.ts b/src/codegen/bindgenv2/internal/interfaces.ts index 21584ba0f4e..5e2a71fda25 100644 --- a/src/codegen/bindgenv2/internal/interfaces.ts +++ b/src/codegen/bindgenv2/internal/interfaces.ts @@ -7,11 +7,11 @@ export const ArrayBuffer = new (class extends Type { get bindgenType() { return `bindgen.BindgenArrayBuffer`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bun.bun_js.jsc.JSCArrayBuffer.Ref"; } - optionalZigType(style?: CodeStyle) { - return this.zigType(style) + ".Optional"; + optionalRustType(style?: CodeStyle) { + return this.rustType(style) + ".Optional"; } toCpp(value: any): string { throw RangeError("default values for `ArrayBuffer` are not supported"); @@ -25,11 +25,11 @@ export const Blob = new (class extends Type { get bindgenType() { return `bindgen.BindgenBlob`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bun.bun_js.webcore.Blob.Ref"; } - optionalZigType(style?: CodeStyle) { - return this.zigType(style) + ".Optional"; + optionalRustType(style?: CodeStyle) { + return this.rustType(style) + ".Optional"; } toCpp(value: any): string { throw RangeError("default values for `Blob` are not supported"); diff --git a/src/codegen/bindgenv2/internal/optional.ts b/src/codegen/bindgenv2/internal/optional.ts index b18a1a398e6..e8964943516 100644 --- a/src/codegen/bindgenv2/internal/optional.ts +++ b/src/codegen/bindgenv2/internal/optional.ts @@ -19,8 +19,8 @@ export function optional(payload: Type): OptionalType { get bindgenType() { return bindgenOptional(payload); } - zigType(style?: CodeStyle) { - return payload.optionalZigType(style); + rustType(style?: CodeStyle) { + return payload.optionalRustType(style); } toCpp(value: any): string { if (value === undefined) { @@ -49,8 +49,8 @@ export function nullable(payload: Type): NullableType { get bindgenType() { return bindgenOptional(payload); } - zigType(style?: CodeStyle) { - return payload.optionalZigType(style); + rustType(style?: CodeStyle) { + return payload.optionalRustType(style); } toCpp(value: any): string { if (value == null) { @@ -72,8 +72,8 @@ export function looseNullable(payload: Type): LooseNullableType { get bindgenType() { return bindgenOptional(payload); } - zigType(style?: CodeStyle) { - return payload.optionalZigType(style); + rustType(style?: CodeStyle) { + return payload.optionalRustType(style); } toCpp(value: any): string { if (!value) { @@ -92,7 +92,7 @@ const Undefined = new (class extends Type { get bindgenType() { return `bindgen.BindgenNull`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "void"; } toCpp(value: undefined): string { @@ -108,7 +108,7 @@ const Null = new (class extends Type { get bindgenType() { return `bindgen.BindgenNull`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "void"; } toCpp(value: null): string { diff --git a/src/codegen/bindgenv2/internal/primitives.ts b/src/codegen/bindgenv2/internal/primitives.ts index 1a8bfec31b8..60c5f9f178d 100644 --- a/src/codegen/bindgenv2/internal/primitives.ts +++ b/src/codegen/bindgenv2/internal/primitives.ts @@ -14,7 +14,7 @@ export const bool = new (class extends Type { get bindgenType() { return `bindgen.BindgenBool`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bool"; } toCpp(value: boolean): string { @@ -30,8 +30,8 @@ export const LooseBool = new (class extends Type { get bindgenType() { return bool.bindgenType; } - zigType(style?: CodeStyle) { - return bool.zigType(style); + rustType(style?: CodeStyle) { + return bool.rustType(style); } toCpp(value: boolean): string { return bool.toCpp(value); @@ -57,7 +57,7 @@ function makeUnsignedType(width: number): IntegerType { get bindgenType() { return `bindgen.BindgenU${width}`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `u${width}`; } get cppType() { @@ -88,7 +88,7 @@ function makeSignedType(width: number): IntegerType { get bindgenType() { return `bindgen.BindgenI${width}`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `i${width}`; } get cppType() { @@ -130,8 +130,8 @@ function makeLooseIntegerType(strict: IntegerType): LooseIntegerType { get bindgenType() { return strict.bindgenType; } - zigType(style?: CodeStyle) { - return strict.zigType(style); + rustType(style?: CodeStyle) { + return strict.rustType(style); } toCpp(value: number | bigint): string { return strict.toCpp(value); @@ -179,7 +179,7 @@ export const f64 = new (class extends Type { get bindgenType() { return `bindgen.BindgenF64`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `f64`; } toCpp(value: number): string { @@ -203,8 +203,8 @@ export const FiniteF64 = new (class extends Type { get bindgenType() { return f64.bindgenType; } - zigType(style?: CodeStyle) { - return f64.zigType(style); + rustType(style?: CodeStyle) { + return f64.rustType(style); } toCpp(value: number): string { assert(typeof value === "number"); @@ -220,8 +220,8 @@ export const LooseF64 = new (class extends Type { get bindgenType() { return f64.bindgenType; } - zigType(style?: CodeStyle) { - return f64.zigType(style); + rustType(style?: CodeStyle) { + return f64.rustType(style); } toCpp(value: number): string { return f64.toCpp(value); diff --git a/src/codegen/bindgenv2/internal/string.ts b/src/codegen/bindgenv2/internal/string.ts index 48c7f867666..f5a828748cd 100644 --- a/src/codegen/bindgenv2/internal/string.ts +++ b/src/codegen/bindgenv2/internal/string.ts @@ -13,11 +13,11 @@ export const String = new (class extends Type { get bindgenType() { return "bindgen.BindgenString"; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return "bun.string.WTFString"; } - optionalZigType(style?: CodeStyle) { - return this.zigType(style) + ".Optional"; + optionalRustType(style?: CodeStyle) { + return this.rustType(style) + ".Optional"; } toCpp(value: string): string { assert(typeof value === "string"); @@ -32,11 +32,11 @@ export const LooseString = new (class extends Type { get bindgenType() { return String.bindgenType; } - zigType(style?: CodeStyle) { - return String.zigType(style); + rustType(style?: CodeStyle) { + return String.rustType(style); } - optionalZigType(style?: CodeStyle) { - return String.optionalZigType(style); + optionalRustType(style?: CodeStyle) { + return String.optionalRustType(style); } toCpp(value: string): string { return String.toCpp(value); diff --git a/src/codegen/bindgenv2/internal/union.ts b/src/codegen/bindgenv2/internal/union.ts index e452f8b1f08..1bd741458a3 100644 --- a/src/codegen/bindgenv2/internal/union.ts +++ b/src/codegen/bindgenv2/internal/union.ts @@ -31,7 +31,7 @@ export function union(name: string, alternatives: NamedAlternatives): NamedUnion /** * The order of types in this union is significant. Each type is tried in order, and the first one - * that successfully converts determines the active field in the corresponding Zig tagged union. + * that successfully converts determines the active field in the corresponding Rust tagged union. * * This means that it is an error to specify `RawAny` or `StrongAny` as anything other than the * last alternative, as conversion to any subsequent types would never be attempted. @@ -69,14 +69,14 @@ export function union( get bindgenType() { return `bindgen.BindgenUnion(&.{ ${alternatives.map(a => a.bindgenType).join(", ")} })`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { if (style !== "pretty") { - return `bun.meta.TaggedUnion(&.{ ${alternatives.map(a => a.zigType()).join(", ")} })`; + return `bun.meta.TaggedUnion(&.{ ${alternatives.map(a => a.rustType()).join(", ")} })`; } return dedent(`bun.meta.TaggedUnion(&.{ ${joinIndented( 10, - alternatives.map(a => a.zigType("pretty") + ","), + alternatives.map(a => a.rustType("pretty") + ","), )} })`); } @@ -106,7 +106,7 @@ export function union( get bindgenType() { return `bindgen_generated.internal.${name}`; } - zigType(style?: CodeStyle) { + rustType(style?: CodeStyle) { return `bindgen_generated.${name}`; } get dependencies() { @@ -133,16 +133,16 @@ export function union( `); } - get hasZigSource() { + get hasRustSource() { return true; } - get zigSource() { + get rustSource() { return reindent(` pub const ${name} = union(enum) { ${joinIndented( 10, Object.entries(namedAlternatives).map(([altName, altType]) => { - return `${altName}: ${altType.zigType("pretty")},`; + return `${altName}: ${altType.rustType("pretty")},`; }), )} @@ -156,11 +156,11 @@ export function union( pub const Bindgen${name} = struct { const Self = @This(); - pub const ZigType = ${name}; + pub const RustType = ${name}; pub const ExternType = bindgen.ExternTaggedUnion(&.{ ${alternatives .map(a => a.bindgenType + ".ExternType") .join(", ")} }); - pub fn convertFromExtern(extern_value: Self.ExternType) Self.ZigType { + pub fn convertFromExtern(extern_value: Self.ExternType) Self.RustType { return switch (extern_value.tag) { ${joinIndented( 14, diff --git a/src/codegen/bindgenv2/script.ts b/src/codegen/bindgenv2/script.ts index aafeacabb51..fcb80737242 100755 --- a/src/codegen/bindgenv2/script.ts +++ b/src/codegen/bindgenv2/script.ts @@ -42,17 +42,17 @@ function cppSourcePath(type: NamedType): string { return `${codegenPath}/Generated${type.name}.cpp`; } -function zigSourcePath(typeOrNamespace: NamedType | string): string { +function rustSourcePath(typeOrNamespace: NamedType | string): string { let ns: string; if (typeof typeOrNamespace === "string") { ns = typeOrNamespace; } else { - ns = toZigNamespace(typeOrNamespace.name); + ns = toRustNamespace(typeOrNamespace.name); } - return `${codegenPath}/bindgen_generated/${ns}.zig`; + return `${codegenPath}/bindgen_generated/${ns}.rust`; } -function toZigNamespace(name: string): string { +function toRustNamespace(name: string): string { const result = name .replace(/([^A-Z_])([A-Z])/g, "$1_$2") .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2") @@ -64,18 +64,18 @@ function toZigNamespace(name: string): string { } function listOutputs(): void { - const outputs: string[] = [`${codegenPath}/bindgen_generated.zig`]; + const outputs: string[] = [`${codegenPath}/bindgen_generated.rust`]; for (const type of getNamedExports()) { if (type.hasCppSource) outputs.push(cppSourcePath(type)); - if (type.hasZigSource) outputs.push(zigSourcePath(type)); + if (type.hasRustSource) outputs.push(rustSourcePath(type)); } process.stdout.write(outputs.join(";")); } function generate(): void { const names = new Set(); - const zigRoot: string[] = []; - const zigRootInternal: string[] = []; + const rustRoot: string[] = []; + const rustRootInternal: string[] = []; const namedExports = getNamedExports(); { @@ -100,10 +100,10 @@ function generate(): void { } for (const type of namedExports) { - const zigNamespace = toZigNamespace(type.name); + const rustNamespace = toRustNamespace(type.name); const size = names.size; names.add(type.name); - names.add(zigNamespace); + names.add(rustNamespace); if (names.size !== size + 2) { console.error(`error: duplicate name: ${type.name}`); process.exit(1); @@ -111,30 +111,30 @@ function generate(): void { const cppHeader = type.cppHeader; const cppSource = type.cppSource; - const zigSource = type.zigSource; + const rustSource = type.rustSource; if (cppHeader) { helpers.writeIfNotChanged(cppHeaderPath(type), cppHeader); } if (cppSource) { helpers.writeIfNotChanged(cppSourcePath(type), cppSource); } - if (zigSource) { - zigRoot.push( - `pub const ${zigNamespace} = @import("./bindgen_generated/${zigNamespace}.zig");`, - `pub const ${type.name} = ${zigNamespace}.${type.name};`, + if (rustSource) { + rustRoot.push( + `pub const ${rustNamespace} = @import("./bindgen_generated/${rustNamespace}.rust");`, + `pub const ${type.name} = ${rustNamespace}.${type.name};`, "", ); - zigRootInternal.push(`pub const ${type.name} = ${zigNamespace}.Bindgen${type.name};`); - helpers.writeIfNotChanged(zigSourcePath(zigNamespace), zigSource); + rustRootInternal.push(`pub const ${type.name} = ${rustNamespace}.Bindgen${type.name};`); + helpers.writeIfNotChanged(rustSourcePath(rustNamespace), rustSource); } } helpers.writeIfNotChanged( - `${codegenPath}/bindgen_generated.zig`, + `${codegenPath}/bindgen_generated.rust`, [ - ...zigRoot, + ...rustRoot, `pub const internal = struct {`, - ...zigRootInternal.map(s => " " + s), + ...rustRootInternal.map(s => " " + s), `};`, "", ].join("\n"), diff --git a/src/codegen/bundle-functions.ts b/src/codegen/bundle-functions.ts index da0ac4d3a5d..9d5dad7b924 100644 --- a/src/codegen/bundle-functions.ts +++ b/src/codegen/bundle-functions.ts @@ -414,7 +414,7 @@ export async function bundleBuiltinFunctions({ requireTransformer }: BundleBuilt // C++ codegen let bundledCPP = `// Generated by ${import.meta.path} - namespace Zig { class GlobalObject; } + namespace Rust { class GlobalObject; } #include "root.h" #include "config.h" #include "JSDOMGlobalObject.h" @@ -530,7 +530,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) } bundledCPP += ` - SUPPRESS_ASAN void JSBuiltinInternalFunctions::initialize(Zig::GlobalObject& globalObject) + SUPPRESS_ASAN void JSBuiltinInternalFunctions::initialize(Rust::GlobalObject& globalObject) { UNUSED_PARAM(globalObject); `; @@ -543,13 +543,13 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) bundledCPP += ` JSVMClientData& clientData = *static_cast(m_vm.clientData); - Zig::GlobalObject::GlobalPropertyInfo staticGlobals[] = { + Rust::GlobalObject::GlobalPropertyInfo staticGlobals[] = { `; for (const { basename, internal } of files) { if (internal) { bundledCPP += `#define DECLARE_GLOBAL_STATIC(name) \\ - Zig::GlobalObject::GlobalPropertyInfo( \\ + Rust::GlobalObject::GlobalPropertyInfo( \\ clientData.builtinFunctions().${low(basename)}Builtins().name##PrivateName(), ${low(basename)}().m_##name##Function.get() , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly), WEBCORE_FOREACH_${basename.toUpperCase()}_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) #undef DECLARE_GLOBAL_STATIC @@ -570,7 +570,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) let bundledHeader = `// Generated by ${import.meta.path} // Do not edit by hand. #pragma once - namespace Zig { class GlobalObject; } + namespace Rust { class GlobalObject; } #include "root.h" #include #include @@ -742,7 +742,7 @@ JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) : m_vm(vm) explicit JSBuiltinInternalFunctions(JSC::VM&); template void visit(Visitor&); - void initialize(Zig::GlobalObject&); + void initialize(Rust::GlobalObject&); `; for (const { basename, internal } of files) { diff --git a/src/codegen/bundle-modules.ts b/src/codegen/bundle-modules.ts index 049f807b8ea..b476350f115 100644 --- a/src/codegen/bundle-modules.ts +++ b/src/codegen/bundle-modules.ts @@ -15,7 +15,7 @@ import path from "path"; import jsclasses from "./../jsc/bindings/js_classes"; import { sliceSourceCode } from "./builtin-parser"; import { createAssertClientJS, createLogClientJS } from "./client-js"; -import { getJS2NativeCPP, getJS2NativeRust, getJS2NativeZig } from "./generate-js2native"; +import { getJS2NativeCPP, getJS2NativeRust, getJS2NativeRust } from "./generate-js2native"; import { cap, declareASCIILiteral, writeIfNotChanged } from "./helpers"; import { createInternalModuleRegistry } from "./internal-module-registry-scanner"; import { define } from "./replacements"; @@ -405,10 +405,10 @@ namespace InternalModuleRegistryConstants { ); } -// This is a generated enum for zig code (exports.zig) +// This is a generated enum for rust code (exports.rust) writeIfNotChanged( - path.join(CODEGEN_DIR, "ResolvedSourceTag.zig"), - `// zig fmt: off + path.join(CODEGEN_DIR, "ResolvedSourceTag.rust"), + `// rust fmt: off pub const ResolvedSourceTag = enum(u32) { javascript = 0, package_json_type_module = 1, @@ -480,9 +480,9 @@ writeIfNotChanged( 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, "../jsc/bindings/GeneratedJS2Native.zig"); -writeIfNotChanged(js2nativeZigPath, getJS2NativeZig(js2nativeZigPath)); +// rust will complain if this file is outside of the module +const js2nativeRustPath = path.join(import.meta.dir, "../jsc/bindings/GeneratedJS2Native.rust"); +writeIfNotChanged(js2nativeRustPath, getJS2NativeRust(js2nativeRustPath)); // Rust sibling: include!()'d by src/runtime/generated_js2native.rs writeIfNotChanged(path.join(CODEGEN_DIR, "generated_js2native.rs"), getJS2NativeRust()); diff --git a/src/codegen/class-definitions.ts b/src/codegen/class-definitions.ts index 8049e12e5ae..7c96024eeb4 100644 --- a/src/codegen/class-definitions.ts +++ b/src/codegen/class-definitions.ts @@ -94,13 +94,13 @@ export class ClassDefinition { /** * Which language implements the native side of this class. * - * The C++ wrapper output (`ZigGeneratedClasses.{h,cpp}`) is byte-identical + * The C++ wrapper output (`RustGeneratedClasses.{h,cpp}`) is byte-identical * regardless of this flag — it only selects whether the implementer thunks - * land in `ZigGeneratedClasses.zig` or `generated_classes.rs`. + * land in `RustGeneratedClasses.rust` or `generated_classes.rs`. * - * @default "zig" + * @default "rust" */ - lang?: "zig" | "rust"; + lang?: "rust" | "rust"; /** * Fully-qualified Rust path of the native struct backing this class, e.g. * `crate::webcore::request::Request`. The codegen emits @@ -140,7 +140,7 @@ export class ClassDefinition { /** * Class constructor needs `this` value. * - * Makes the code generator call the Zig constructor function **after** the + * Makes the code generator call the Rust constructor function **after** the * JSValue is instantiated. Only use this if you must, as it probably isn't * good for GC since it means if the constructor throws the GC will have to * clean up the object that never reached JS. @@ -160,7 +160,7 @@ export class ClassDefinition { * You _must_ free the pointer to your native class! * * Example for pointers only owned by JavaScript classes: - * ```zig + * ```rust * pub const NativeClass = struct { * * fn constructor(global: *JSC.JSGlobalObject, frame: *JSC.CallFrame) bun.JSError!*SocketAddress { @@ -233,7 +233,7 @@ export class ClassDefinition { * Called from any thread. * * When `true`, classes should have a method with this signature: - * ```zig + * ```rust * pub fn estimatedSize(this: *@This()) usize; * ``` * diff --git a/src/codegen/cppbind.ts b/src/codegen/cppbind.ts index deca92db857..249babd04e9 100644 --- a/src/codegen/cppbind.ts +++ b/src/codegen/cppbind.ts @@ -1,8 +1,8 @@ /* -cppbind - C++ to Zig binding generator for Bun +cppbind - C++ to Rust binding generator for Bun -This tool automatically generates Zig bindings for C++ functions marked with [[ZIG_EXPORT(...)]] attributes. +This tool automatically generates Rust bindings for C++ functions marked with [[RUST_EXPORT(...)]] attributes. It runs automatically when C++ files change during the build process. To run manually: @@ -14,39 +14,39 @@ To run manually: 1. **nothrow** - Function that never throws exceptions: ```cpp - extern "C" [[ZIG_EXPORT(nothrow)]] void hello_world() { + extern "C" [[RUST_EXPORT(nothrow)]] void hello_world() { printf("hello world\n"); } ``` - Zig usage: `bun.cpp.hello_world();` + Rust usage: `bun.cpp.hello_world();` 2. **zero_is_throw** - Function returns JSValue, where .zero indicates an exception: ```cpp - extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSValue create_object(JSGlobalObject* globalThis) { + extern "C" [[RUST_EXPORT(zero_is_throw)]] JSValue create_object(JSGlobalObject* globalThis) { auto scope = DECLARE_THROW_SCOPE(); // ... RETURN_IF_EXCEPTION(scope, {}); return result; } ``` - Zig usage: `try bun.cpp.create_object(globalThis);` + Rust usage: `try bun.cpp.create_object(globalThis);` 3. **check_slow** - Function that may throw, performs runtime exception checking: ```cpp - extern "C" [[ZIG_EXPORT(check_slow)]] void process_data(JSGlobalObject* globalThis) { + extern "C" [[RUST_EXPORT(check_slow)]] void process_data(JSGlobalObject* globalThis) { auto scope = DECLARE_THROW_SCOPE(); // ... RETURN_IF_EXCEPTION(scope, ); } ``` - Zig usage: `try bun.cpp.process_data(globalThis);` + Rust usage: `try bun.cpp.process_data(globalThis);` ### Parameters -- **[[ZIG_NONNULL]]** - Mark pointer parameters as non-nullable: +- **[[RUST_NONNULL]]** - Mark pointer parameters as non-nullable: ```cpp - [[ZIG_EXPORT(nothrow)]] void process([[ZIG_NONNULL]] JSGlobalObject* globalThis, - [[ZIG_NONNULL]] JSValue* values, + [[RUST_EXPORT(nothrow)]] void process([[RUST_NONNULL]] JSGlobalObject* globalThis, + [[RUST_NONNULL]] JSValue* values, size_t count) { ... } ``` Generates: `pub extern fn process(globalThis: *jsc.JSGlobalObject, values: [*]const jsc.JSValue) void;` @@ -315,7 +315,7 @@ function processDeclarator( if (!rootmostType) throwError(nodePosition(declarator, ctx), "no rootmost type provided to PointerDeclarator"); const isConst = !!declarator.parent?.getChild("const") || rootmostType.type === "fn"; const parentAttributes = declarator.parent?.getChildren("Attribute") ?? []; - const isNonNull = parentAttributes.some(attr => text(attr.getChild("AttributeName")!, ctx) === "ZIG_NONNULL"); + const isNonNull = parentAttributes.some(attr => text(attr.getChild("AttributeName")!, ctx) === "RUST_NONNULL"); return processDeclarator(ctx, declarator, { type: "pointer", @@ -401,7 +401,7 @@ type ExportTag = "check_slow" | "zero_is_throw" | "false_is_throw" | "null_is_th // ─────────────────────────── Rust output (cpp.rs) ─────────────────────────── // -// Mirror of `generateZigFn` for the Rust port: each `[[ZIG_EXPORT(mode)]]` C++ +// Mirror of `generateRustFn` for the Rust port: each `[[RUST_EXPORT(mode)]]` C++ // function gets a typed `pub fn` in `bun_jsc::cpp` that wraps the raw extern in // the appropriate exception scope and converts to `JsResult`. The wrapper opens // the scope *before* calling into C++ so the callee's `DECLARE_THROW_SCOPE` dtor @@ -421,7 +421,7 @@ const rustSharedTypes: Record = { // Primitives "bool": "bool", // `char` signedness is platform-dependent (signed on x86_64-linux/windows, - // unsigned on aarch64); match Zig's `c_char` so a future by-value return + // unsigned on aarch64); match Rust's `c_char` so a future by-value return // doesn't silently sign-flip. "char": "core::ffi::c_char", "unsigned char": "u8", @@ -454,9 +454,9 @@ const rustSharedTypes: Record = { "JSC::EncodedJSValue": "crate::JSValue", "EncodedJSValue": "crate::JSValue", "JSC::JSGlobalObject": "crate::JSGlobalObject", - "Zig::GlobalObject": "crate::JSGlobalObject", - "ZigException": "crate::zig_exception::ZigException", - "ZigString": "bun_core::ZigString", + "Rust::GlobalObject": "crate::JSGlobalObject", + "RustException": "crate::rust_exception::RustException", + "RustString": "bun_core::RustString", "JSC::VM": "crate::VM", "JSC::JSPromise": "crate::JSPromise", "JSC::JSMap": "crate::JSMap", @@ -560,7 +560,7 @@ function generateRustType(type: CppType, parent: CppType | null): string { // Unknown opaque — only valid behind a pointer (the per-type shim casts the // pointee). Behind a pointer we degrade to c_void; in by-value position that // would emit `-> core::ffi::c_void` (a ZST in Rust → silent ABI corruption), - // so match the Zig generator and fail loudly at the C++ source location. + // so match the Rust generator and fail loudly at the C++ source location. if (parent?.type === "pointer") return "core::ffi::c_void"; throwError( type.position, @@ -574,7 +574,7 @@ function isGlobalObjectPtr(t: CppType): boolean { return ( t.type === "pointer" && t.child.type === "named" && - (t.child.name === "JSC::JSGlobalObject" || t.child.name === "Zig::GlobalObject") + (t.child.name === "JSC::JSGlobalObject" || t.child.name === "Rust::GlobalObject") ); } @@ -586,7 +586,7 @@ function isGlobalObjectPtr(t: CppType): boolean { // `JSGlobalObject*` → `&JSGlobalObject` rule. const rustOpaqueHandles = new Set([ "JSC::JSGlobalObject", - "Zig::GlobalObject", + "Rust::GlobalObject", "JSC::VM", "JSC::JSPromise", "JSC::JSInternalPromise", @@ -660,7 +660,7 @@ function generateRustFn(fn: CppFn, rustRaw: string[], rustWrap: string[]): void const globalArg = fn.parameters.find(p => isGlobalObjectPtr(p.type)); if (!globalArg) { - // Same constraint as the Zig generator; emit a stub so the module still + // Same constraint as the Rust generator; emit a stub so the module still // compiles and the symbol name is greppable. rustWrap.push(`// skipped ${fn.name}: ${fn.tag} requires a JSGlobalObject* parameter`); return; @@ -672,7 +672,7 @@ function generateRustFn(fn: CppFn, rustRaw: string[], rustWrap: string[]): void // which routes `SourceLocation::from_caller()` → thread-local intern probe per call // in debug builds). This is the highest-volume mode — keep it as cheap as the // zero/false/null arms below. `src!()` resolves to the wrapper file/line, matching - // Zig's `cpp.zig` (`@src()` inside the wrapper); `#[track_caller]` would be a no-op + // Rust's `cpp.rust` (`@src()` inside the wrapper); `#[track_caller]` would be a no-op // against a syntactic `file!()`, so don't emit it. rustWrap.push( `#[inline]`, @@ -705,7 +705,7 @@ function generateRustFn(fn: CppFn, rustRaw: string[], rustWrap: string[]): void } else assertNever(fn.tag); // `validation_scope!` expands `src!()` syntactically (resolves to this generated - // file/line — parity with Zig's `@src()` inside cpp.zig wrappers). `#[track_caller]` + // file/line — parity with Rust's `@src()` inside cpp.rust wrappers). `#[track_caller]` // can't influence a compile-time `file!()`, so don't emit it. rustWrap.push( `#[inline]`, @@ -733,15 +733,15 @@ for (const line of sharedTypesLines) { } const errorsForTypes: Map = new Map(); -function generateZigType(type: CppType, parent: CppType | null) { +function generateRustType(type: CppType, parent: CppType | null) { if (type.type === "pointer") { const optionalChar = type.isNonNull ? "" : "?"; const ptrChar = type.isMany ? "[*]" : "*"; const constChar = type.isConst ? "const " : ""; - return `${optionalChar}${ptrChar}${constChar}${generateZigType(type.child, type)}`; + return `${optionalChar}${ptrChar}${constChar}${generateRustType(type.child, type)}`; } if (type.type === "fn") { - return `fn(${type.parameters.map(p => formatZigName(p.name) + ": " + generateZigType(p.type, null)).join(", ")}) callconv(.c) ${generateZigType(type.returnType, null)}`; + return `fn(${type.parameters.map(p => formatRustName(p.name) + ": " + generateRustType(p.type, null)).join(", ")}) callconv(.c) ${generateRustType(type.returnType, null)}`; } if (type.type === "named" && type.name === "void") { if (parent?.type === "pointer") return "anyopaque"; @@ -772,22 +772,22 @@ function generateZigType(type: CppType, parent: CppType | null) { } assertNever(type); } -function formatZigName(name: string): string { +function formatRustName(name: string): string { if (name.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)) return name; return "@" + JSON.stringify(name); } -function generateZigParameterList(parameters: CppParameter[], globalThisArg?: CppParameter): string { +function generateRustParameterList(parameters: CppParameter[], globalThisArg?: CppParameter): string { return parameters .map(p => { if (p === globalThisArg) { - return `${formatZigName(p.name)}: *jsc.JSGlobalObject`; + return `${formatRustName(p.name)}: *jsc.JSGlobalObject`; } else { - return `${formatZigName(p.name)}: ${generateZigType(p.type, null)}`; + return `${formatRustName(p.name)}: ${generateRustType(p.type, null)}`; } }) .join(", "); } -function generateZigSourceComment(cfg: Cfg, resultSourceLinks: string[], fn: CppFn): string { +function generateRustSourceComment(cfg: Cfg, resultSourceLinks: string[], fn: CppFn): string { const fileName = relative(cfg.dstDir, fn.position.file); resultSourceLinks.push(`${fn.name}:${fileName}:${fn.position.start.line}:${fn.position.start.column}`); return `/// Source: ${fn.name}`; @@ -805,12 +805,12 @@ type CppParser = typeof cppParser; async function processFile(parser: CppParser, file: string, allFunctions: CppFn[]) { const sourceCode = await Bun.file(file).text(); - if (!sourceCode.includes("[[ZIG_EXPORT(")) return; + if (!sourceCode.includes("[[RUST_EXPORT(")) return; const sourceCodeLines = sourceCode.split("\n"); const manualFindLines = new Set(); for (let i = 0; i < sourceCodeLines.length; i++) { - if (sourceCodeLines[i].includes("[[ZIG_EXPORT(")) { + if (sourceCodeLines[i].includes("[[RUST_EXPORT(")) { manualFindLines.add(i + 1); } } @@ -823,14 +823,14 @@ async function processFile(parser: CppParser, file: string, allFunctions: CppFn[ appendError({ file, start: { line: 0, column: 0 }, end: { line: 0, column: 0 } }, "no tree found"); for (const lineNumber of manualFindLines) { const lineContent = sourceCodeLines[lineNumber - 1]; - const column = lineContent.indexOf("[[ZIG_EXPORT(") + 3; + const column = lineContent.indexOf("[[RUST_EXPORT(") + 3; appendError( { file, start: { line: lineNumber, column }, - end: { line: lineNumber, column: column + "ZIG_EXPORT(".length }, + end: { line: lineNumber, column: column + "RUST_EXPORT(".length }, }, - "ZIG_EXPORT found, but Lezer failed to parse the file.", + "RUST_EXPORT found, but Lezer failed to parse the file.", ); } return; @@ -844,20 +844,20 @@ async function processFile(parser: CppParser, file: string, allFunctions: CppFn[ return true; // Continue traversal } // console.log( - // `\n--- Found ZIG_EXPORT on function in ${file} at line ${lineInfo.get(nodeRef.node.from).line} ---\n`, + // `\n--- Found RUST_EXPORT on function in ${file} at line ${lineInfo.get(nodeRef.node.from).line} ---\n`, // ); // // Use the new pretty-printer to log the tree structure of the matched function // console.log(prettyPrintLezerNode(nodeRef.node, ctx.sourceCode)); // console.log(`-------------------------------------------------------------------\n`); const fnNode = nodeRef.node; - let zigExportAttr: SyntaxNode | null = null; + let rustExportAttr: SyntaxNode | null = null; let tagIdentifier: SyntaxNode | null = null; for (const attr of fnNode.getChildren("Attribute")) { const attrNameNode = attr.getChild("AttributeName"); - if (attrNameNode && text(attrNameNode, ctx) === "ZIG_EXPORT") { - zigExportAttr = attr; + if (attrNameNode && text(attrNameNode, ctx) === "RUST_EXPORT") { + rustExportAttr = attr; const args = attr.getChild("AttributeArgs"); if (args) { tagIdentifier = args.getChild("Identifier"); @@ -866,11 +866,11 @@ async function processFile(parser: CppParser, file: string, allFunctions: CppFn[ } } - if (!zigExportAttr || !tagIdentifier) { + if (!rustExportAttr || !tagIdentifier) { return false; // Not an exported function, prune search } - queryFoundLines.add(lineInfo.get(zigExportAttr.from).line); + queryFoundLines.add(lineInfo.get(rustExportAttr.from).line); // disabled because lezer parses (extern "C") separately to the function definition / block /* const linkage = closest(fnNode, "LinkageSpecification"); @@ -919,15 +919,15 @@ async function processFile(parser: CppParser, file: string, allFunctions: CppFn[ for (const lineNumber of manualFindLines) { if (!queryFoundLines.has(lineNumber)) { const lineContent = sourceCodeLines[lineNumber - 1]; - const column = lineContent.indexOf("[[ZIG_EXPORT(") + 3; + const column = lineContent.indexOf("[[RUST_EXPORT(") + 3; const position: Srcloc = { file, start: { line: lineNumber, column }, - end: { line: lineNumber, column: column + "ZIG_EXPORT(".length }, + end: { line: lineNumber, column: column + "RUST_EXPORT(".length }, }; appendError( position, - "ZIG_EXPORT was found on this line, but the Lezer parser did not find a valid C++ attribute on a function definition. Ensure it's in the form `[[ZIG_EXPORT(tag)]]` before a function definition.", + "RUST_EXPORT was found on this line, but the Lezer parser did not find a valid C++ attribute on a function definition. Ensure it's in the form `[[RUST_EXPORT(tag)]]` before a function definition.", ); } } @@ -952,27 +952,27 @@ async function renderError(position: Srcloc, message: string, label: string, col type Cfg = { dstDir: string; }; -function generateZigFn( +function generateRustFn( fn: CppFn, resultRaw: string[], resultBindings: string[], resultSourceLinks: string[], cfg: Cfg, ): void { - let returnType = generateZigType(fn.returnType, null); + let returnType = generateRustType(fn.returnType, null); if (resultBindings.length) resultBindings.push(""); - resultBindings.push(generateZigSourceComment(cfg, resultSourceLinks, fn)); + resultBindings.push(generateRustSourceComment(cfg, resultSourceLinks, fn)); if (fn.tag === "nothrow") { resultBindings.push( - `pub extern fn ${formatZigName(fn.name)}(${generateZigParameterList(fn.parameters)}) ${returnType};`, + `pub extern fn ${formatRustName(fn.name)}(${generateRustParameterList(fn.parameters)}) ${returnType};`, ); return; } - resultRaw.push(` extern fn ${formatZigName(fn.name)}(${generateZigParameterList(fn.parameters)}) ${returnType};`); + resultRaw.push(` extern fn ${formatRustName(fn.name)}(${generateRustParameterList(fn.parameters)}) ${returnType};`); let globalThisArg: CppParameter | undefined; for (const param of fn.parameters) { - const type = generateZigType(param.type, null); + const type = generateRustType(param.type, null); if (type === "?*jsc.JSGlobalObject") { globalThisArg = param; break; @@ -983,22 +983,22 @@ function generateZigFn( if (returnType === "jsc.JSValue") { appendError( fn.position, - "Use ZIG_EXPORT(zero_is_throw) instead of ZIG_EXPORT(check_slow) for functions that return JSValue", + "Use RUST_EXPORT(zero_is_throw) instead of RUST_EXPORT(check_slow) for functions that return JSValue", ); } resultBindings.push( - `pub fn ${formatZigName(fn.name)}(${generateZigParameterList(fn.parameters, globalThisArg)}) error{JSError}!${returnType} {`, + `pub fn ${formatRustName(fn.name)}(${generateRustParameterList(fn.parameters, globalThisArg)}) error{JSError}!${returnType} {`, ` if (comptime Environment.ci_assert) {`, ` var scope: jsc.TopExceptionScope = undefined;`, - ` scope.init(${formatZigName(globalThisArg.name)}, @src());`, + ` scope.init(${formatRustName(globalThisArg.name)}, @src());`, ` defer scope.deinit();`, ``, - ` const result = raw.${formatZigName(fn.name)}(${fn.parameters.map(p => formatZigName(p.name)).join(", ")});`, + ` const result = raw.${formatRustName(fn.name)}(${fn.parameters.map(p => formatRustName(p.name)).join(", ")});`, ` try scope.returnIfException();`, ` return result;`, ` } else {`, - ` const result = raw.${formatZigName(fn.name)}(${fn.parameters.map(p => formatZigName(p.name)).join(", ")});`, - ` if (Bun__RETURN_IF_EXCEPTION(${formatZigName(globalThisArg.name)})) return error.JSError;`, + ` const result = raw.${formatRustName(fn.name)}(${fn.parameters.map(p => formatRustName(p.name)).join(", ")});`, + ` if (Bun__RETURN_IF_EXCEPTION(${formatRustName(globalThisArg.name)})) return error.JSError;`, ` return result;`, ` }`, `}`, @@ -1010,33 +1010,33 @@ function generateZigFn( if (fn.tag === "zero_is_throw") { equalsValue = ".zero"; if (returnType !== "jsc.JSValue") { - appendError(fn.position, "ZIG_EXPORT(zero_is_throw) is only allowed for functions that return JSValue"); + appendError(fn.position, "RUST_EXPORT(zero_is_throw) is only allowed for functions that return JSValue"); } } else if (fn.tag === "false_is_throw") { equalsValue = "false"; if (returnType !== "bool") { - appendError(fn.position, "ZIG_EXPORT(false_is_throw) is only allowed for functions that return bool"); + appendError(fn.position, "RUST_EXPORT(false_is_throw) is only allowed for functions that return bool"); } returnType = "void"; } else if (fn.tag === "null_is_throw") { equalsValue = "null"; if (!returnType.startsWith("?*")) { - appendError(fn.position, "ZIG_EXPORT(null_is_throw) is only allowed for functions that return optional pointer"); + appendError(fn.position, "RUST_EXPORT(null_is_throw) is only allowed for functions that return optional pointer"); } returnType = returnType.slice(1); } else assertNever(fn.tag); resultBindings.push( - `pub fn ${formatZigName(fn.name)}(${generateZigParameterList(fn.parameters, globalThisArg)}) error{JSError}!${returnType} {`, + `pub fn ${formatRustName(fn.name)}(${generateRustParameterList(fn.parameters, globalThisArg)}) error{JSError}!${returnType} {`, ` if (comptime Environment.ci_assert) {`, ` var scope: jsc.ExceptionValidationScope = undefined;`, - ` scope.init(${formatZigName(globalThisArg.name)}, @src());`, + ` scope.init(${formatRustName(globalThisArg.name)}, @src());`, ` defer scope.deinit();`, ``, - ` const value = raw.${formatZigName(fn.name)}(${fn.parameters.map(p => formatZigName(p.name)).join(", ")});`, + ` const value = raw.${formatRustName(fn.name)}(${fn.parameters.map(p => formatRustName(p.name)).join(", ")});`, ` scope.assertExceptionPresenceMatches(value == ${equalsValue});`, ` return if (value == ${equalsValue}) error.JSError ${fn.tag === "false_is_throw" ? "" : "else value"}${fn.tag === "null_is_throw" ? ".?" : ""};`, ` } else {`, - ` const value = raw.${formatZigName(fn.name)}(${fn.parameters.map(p => formatZigName(p.name)).join(", ")});`, + ` const value = raw.${formatRustName(fn.name)}(${fn.parameters.map(p => formatRustName(p.name)).join(", ")});`, ` if (value == ${equalsValue}) return error.JSError;`, ...(fn.tag === "false_is_throw" ? [] : [` return value${fn.tag === "null_is_throw" ? ".?" : ""};`]), ` }`, @@ -1104,7 +1104,7 @@ async function main() { const rustWrap: string[] = []; for (const fn of allFunctions) { try { - generateZigFn(fn, resultRaw, resultBindings, resultSourceLinks, { dstDir }); + generateRustFn(fn, resultRaw, resultBindings, resultSourceLinks, { dstDir }); } catch (e) { appendErrorFromCatch(e, fn.position); } @@ -1123,7 +1123,7 @@ async function main() { console.error(); } - const resultFilePath = join(dstDir, "cpp.zig"); + const resultFilePath = join(dstDir, "cpp.rust"); const resultContents = typeDeclarations + "\n" + @@ -1137,7 +1137,7 @@ async function main() { const rustFilePath = join(dstDir, "cpp.rs"); const rustContents = - "// generated by cppbind.ts from functions marked with [[ZIG_EXPORT(mode)]]\n" + + "// generated by cppbind.ts from functions marked with [[RUST_EXPORT(mode)]]\n" + "// `include!`d by `bun_jsc::cpp` — see src/jsc/cpp.rs for the wrapper module docs.\n\n" + 'unsafe extern "C" {}\n' + // ensure the file parses even with zero exports "pub mod raw {\n" + diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index 8d9cfc5c796..8edb6de7f93 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -79,7 +79,7 @@ function DOMJITType(type) { }[type]; } -function ZigDOMJITArgType(type) { +function RustDOMJITArgType(type) { return { ["bool"]: "bool", ["int"]: "i32", @@ -89,14 +89,14 @@ function ZigDOMJITArgType(type) { }[type]; } -function ZigDOMJITArgTypeDefinition(type, index) { - return `arg${index}: ${ZigDOMJITArgType(type)}`; +function RustDOMJITArgTypeDefinition(type, index) { + return `arg${index}: ${RustDOMJITArgType(type)}`; } -function ZigDOMJITFunctionType(thisName, { args, returns }) { +function RustDOMJITFunctionType(thisName, { args, returns }) { return `fn (*${thisName}, *jsc.JSGlobalObject, ${args - .map(ZigDOMJITArgType) - .join(", ")}) callconv(jsc.conv) ${ZigDOMJITArgType("JSValue")}`; + .map(RustDOMJITArgType) + .join(", ")}) callconv(jsc.conv) ${RustDOMJITArgType("JSValue")}`; } function DOMJITReturnType(type) { @@ -172,7 +172,7 @@ JSC_DEFINE_JIT_OPERATION(${DOMJITName( `.trim(); } -function zigExportName(to: Map, symbolName: (name: string) => string, prop) { +function rustExportName(to: Map, symbolName: (name: string) => string, prop) { var { defaultValue, getter, setter, accessor, fn, DOMJIT, cache } = prop; const exportNames = { getter: "", @@ -658,7 +658,7 @@ ${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::St JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${name}::call(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); JSC::VM &vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -712,7 +712,7 @@ ${ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${name}::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject *globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject *globalObject = defaultGlobalObject(lexicalGlobalObject); JSC::VM &vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSObject* newTarget = asObject(callFrame->newTarget()); @@ -770,7 +770,7 @@ const ClassInfo ${name}::s_info = { "Function"_s, &Base::s_info, nullptr, nullpt ${ !obj.noConstructor ? ` - extern JSC_CALLCONV JSC::EncodedJSValue ${typeName}__getConstructor(Zig::GlobalObject* globalObject) { + extern JSC_CALLCONV JSC::EncodedJSValue ${typeName}__getConstructor(Rust::GlobalObject* globalObject) { return JSValue::encode(globalObject->${className(typeName)}Constructor()); }` : "" @@ -865,7 +865,7 @@ function renderCallbacksCppImpl(typeName, callbacks: Record) { return rows.map(a => a.trim()).join("\n"); } -function renderCallbacksZig(typeName, callbacks: Record) { +function renderCallbacksRust(typeName, callbacks: Record) { if (Object.keys(callbacks).length === 0) return ""; var out = @@ -1061,7 +1061,7 @@ JSC_DEFINE_CUSTOM_GETTER(js${typeName}Constructor, (JSGlobalObject * lexicalGlob { auto& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); + auto* globalObject = reinterpret_cast(lexicalGlobalObject); auto* prototype = dynamicDowncast<${prototypeName(typeName)}>(JSValue::decode(thisValue)); if (!prototype) [[unlikely]] { @@ -1084,7 +1084,7 @@ JSC_DEFINE_CUSTOM_GETTER(js${typeName}Constructor, (JSGlobalObject * lexicalGlob JSC_DEFINE_CUSTOM_GETTER(${symbolName(typeName, name)}GetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue encodedThisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); ${ obj.forBind @@ -1177,7 +1177,7 @@ JSC_DEFINE_CUSTOM_GETTER(${symbolName(typeName, name)}GetterWrap, (JSGlobalObjec JSC_DEFINE_CUSTOM_GETTER(${symbolName(typeName, name)}GetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue encodedThisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); ${className(typeName)}* thisObject = uncheckedDowncast<${className(typeName)}>(JSValue::decode(encodedThisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -1199,7 +1199,7 @@ JSC_DEFINE_CUSTOM_GETTER(${symbolName(typeName, name)}GetterWrap, (JSGlobalObjec JSC_DEFINE_CUSTOM_GETTER(${symbolName(typeName, name)}GetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue encodedThisValue, PropertyName attributeName)) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); ${className(typeName)}* thisObject = dynamicDowncast<${className(typeName)}>(JSValue::decode(encodedThisValue)); if (!thisObject) [[unlikely]] { @@ -1373,9 +1373,9 @@ function allCachedValues(obj: ClassDefinition) { var extraIncludes = []; function generateClassHeader(typeName, obj: ClassDefinition) { - var { klass, proto, JSType = "ObjectType", values = [], callbacks = {}, zigOnly = false } = obj; + var { klass, proto, JSType = "ObjectType", values = [], callbacks = {}, rustOnly = false } = obj; - if (zigOnly) return ""; + if (rustOnly) return ""; const name = className(typeName); @@ -1417,7 +1417,7 @@ function generateClassHeader(typeName, obj: ClassDefinition) { auto* controller = uncheckedDowncast<${name}>(handle.slot()->asCell()); // m_ctx is null between wrapper creation and constructor return // when constructNeedsThis is set; GC during that window must not - // call into the Zig hasPendingActivity with nullptr. + // call into the Rust hasPendingActivity with nullptr. if (controller->wrapped() && ${name}::hasPendingActivity(controller->wrapped())) { if (reason) [[unlikely]] { *reason = "has pending activity"_s; @@ -1501,12 +1501,12 @@ function generateClassHeader(typeName, obj: ClassDefinition) { static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(${name}, m_ctx); } /** - * Estimated size of the object from Zig including the JS wrapper. + * Estimated size of the object from Rust including the JS wrapper. */ static size_t estimatedSize(JSC::JSCell* cell, JSC::VM& vm); /** - * Memory cost of the object from Zig, without necessarily having a JS wrapper alive. + * Memory cost of the object from Rust, without necessarily having a JS wrapper alive. */ static size_t memoryCost(void* ptr); @@ -1739,7 +1739,7 @@ ${name}::~${name}() } if (!obj.estimatedSize && !obj.memoryCost) { - externs += `extern "C" const size_t ${symbolName(typeName, "ZigStructSize")};`; + externs += `extern "C" const size_t ${symbolName(typeName, "RustStructSize")};`; } else if (obj.memoryCost) { externs += `extern JSC_CALLCONV size_t ${symbolName(typeName, "memoryCost")}(void* ptr);`; } @@ -1759,7 +1759,7 @@ size_t ${name}::memoryCost(void* ptr) { } else { output += ` size_t ${name}::memoryCost(void* ptr) { - return ptr ? ${symbolName(typeName, "ZigStructSize")} : 0; + return ptr ? ${symbolName(typeName, "RustStructSize")} : 0; } `; } @@ -1845,7 +1845,7 @@ extern JSC_CALLCONV void* JSC_HOST_CALL_ATTRIBUTES ${typeName}__fromJSDirect(JSC if (!object) return nullptr; - Zig::GlobalObject* globalObject = dynamicDowncast(object->globalObject()); + Rust::GlobalObject* globalObject = dynamicDowncast(object->globalObject()); if (globalObject == nullptr || cell->structureID() != globalObject->${className(typeName)}Structure()->id()) [[unlikely]] { return nullptr; @@ -1906,7 +1906,7 @@ JSObject* ${name}::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return ${prototypeName(typeName)}::create(vm, globalObject, structure); } -extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__create(Zig::GlobalObject* globalObject, void* ptr) { +extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__create(Rust::GlobalObject* globalObject, void* ptr) { auto &vm = globalObject->vm(); JSC::Structure* structure = globalObject->${className(typeName)}Structure(); ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr); @@ -1922,7 +1922,7 @@ extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__cr ${ obj.valuesArray - ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithValues(Zig::GlobalObject* globalObject, void* ptr, void* markedArgumentBuffer) { + ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithValues(Rust::GlobalObject* globalObject, void* ptr, void* markedArgumentBuffer) { auto &vm = globalObject->vm(); JSC::Structure* structure = globalObject->${className(typeName)}Structure(); auto* args = static_cast(markedArgumentBuffer); @@ -1945,7 +1945,7 @@ ${ ${ obj.valuesArray && obj.values && obj.values.length > 0 - ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithInitialValues(Zig::GlobalObject* globalObject, void* ptr${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { + ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithInitialValues(Rust::GlobalObject* globalObject, void* ptr${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { auto &vm = globalObject->vm(); JSC::Structure* structure = globalObject->${className(typeName)}Structure(); ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr${obj.values.map(v => `, JSC::JSValue::decode(${v})`).join("")}); @@ -1963,7 +1963,7 @@ ${ ${ obj.valuesArray && obj.values && obj.values.length > 0 - ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithValuesAndInitialValues(Zig::GlobalObject* globalObject, void* ptr, void* markedArgumentBuffer${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { + ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithValuesAndInitialValues(Rust::GlobalObject* globalObject, void* ptr, void* markedArgumentBuffer${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { auto &vm = globalObject->vm(); JSC::Structure* structure = globalObject->${className(typeName)}Structure(); auto* args = static_cast(markedArgumentBuffer); @@ -2003,7 +2003,7 @@ function generateHeader(typeName, obj) { } let lutTextFile = ` -/* Source for ZigGeneratedClasses.lut.h +/* Source for RustGeneratedClasses.lut.h `; function generateOwnProperties(typeName, symbolName, obj, props = {}, wrapped) { lutTextFile += ` @@ -2012,7 +2012,7 @@ ${generateHashTableComment(typeName, symbolName, obj, props, wrapped)} } function generateImpl(typeName, obj: ClassDefinition) { - if (obj.zigOnly) return ""; + if (obj.rustOnly) return ""; const proto = obj.proto; if (obj?.hasOwnProperties?.()) { @@ -2029,7 +2029,7 @@ function generateImpl(typeName, obj: ClassDefinition) { .join("\n\n"); } -function generateZig( +function generateRust( typeName, { klass = {}, @@ -2149,7 +2149,7 @@ function generateZig( var renderedCallbacks = ""; if (Object.keys(callbacks).length) { - renderedCallbacks = renderCallbacksZig(typeName, callbacks); + renderedCallbacks = renderCallbacksRust(typeName, callbacks); } function renderMethods() { @@ -2177,7 +2177,7 @@ const JavaScriptCoreBindings = struct { `; } else if (!memoryCost && !estimatedSize) { output += ` - export const ${symbolName(typeName, "ZigStructSize")}: usize = @sizeOf(${typeName}); + export const ${symbolName(typeName, "RustStructSize")}: usize = @sizeOf(${typeName}); `; } @@ -2194,7 +2194,7 @@ const JavaScriptCoreBindings = struct { exports.set("finalize", classSymbolName(typeName, "finalize")); output += ` pub fn ${classSymbolName(typeName, "finalize")}(thisValue: *${typeName}) callconv(jsc.conv) void { - if (comptime Environment.enable_logs) log_zig_finalize("${typeName}", thisValue); + if (comptime Environment.enable_logs) log_rust_finalize("${typeName}", thisValue); @call(bun.callmod_inline, ${typeName}.finalize, .{thisValue}); } `; @@ -2205,7 +2205,7 @@ const JavaScriptCoreBindings = struct { if (constructNeedsThis) { output += ` pub fn ${classSymbolName(typeName, "construct")}(globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame, thisValue: jsc.JSValue) callconv(jsc.conv) ?*anyopaque { - if (comptime Environment.enable_logs) log_zig_constructor("${typeName}", callFrame); + if (comptime Environment.enable_logs) log_rust_constructor("${typeName}", callFrame); return @as(*${typeName}, ${typeName}.constructor(globalObject, callFrame, thisValue) catch |err| switch (err) { error.JSError => return null, error.OutOfMemory => { @@ -2219,7 +2219,7 @@ const JavaScriptCoreBindings = struct { } else { output += ` pub fn ${classSymbolName(typeName, "construct")}(globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame) callconv(jsc.conv) ?*anyopaque { - if (comptime Environment.enable_logs) log_zig_constructor("${typeName}", callFrame); + if (comptime Environment.enable_logs) log_rust_constructor("${typeName}", callFrame); return @as(*${typeName}, ${typeName}.constructor(globalObject, callFrame) catch |err| switch (err) { error.JSError => return null, error.OutOfMemory => { @@ -2237,7 +2237,7 @@ const JavaScriptCoreBindings = struct { exports.set("call", classSymbolName(typeName, "call")); output += ` pub fn ${classSymbolName(typeName, "call")}(globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_call("${typeName}", callFrame); + if (comptime Environment.enable_logs) log_rust_call("${typeName}", callFrame); return @call(bun.callmod_inline, jsc.toJSHostFn(${typeName}.call), .{globalObject, callFrame}); } `; @@ -2247,21 +2247,21 @@ const JavaScriptCoreBindings = struct { exports.set("getInternalProperties", classSymbolName(typeName, "getInternalProperties")); output += ` pub fn ${classSymbolName(typeName, "getInternalProperties")}(thisValue: *${typeName}, globalObject: *jsc.JSGlobalObject, thisValue: jsc.JSValue) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_get_internal_properties("${typeName}"); + if (comptime Environment.enable_logs) log_rust_get_internal_properties("${typeName}"); return @call(bun.callmod_inline, ${typeName}.getInternalProperties, .{thisValue, globalObject, thisValue}); } `; } { - const exportNames = name => zigExportName(exports, name => protoSymbolName(typeName, name), proto[name]); + const exportNames = name => rustExportName(exports, name => protoSymbolName(typeName, name), proto[name]); for (const name in proto) { const { getter, setter, accessor, fn, this: thisValue = false, cache, DOMJIT } = proto[name]; const names = exportNames(name); if (names.getter) { output += ` pub fn ${names.getter}(this: *${typeName}, ${thisValue ? "thisValue: jsc.JSValue," : ""} globalObject: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_getter("${typeName}", "${name}"); + if (comptime Environment.enable_logs) log_rust_getter("${typeName}", "${name}"); return switch (@typeInfo(@typeInfo(@TypeOf(${typeName}.${getter})).@"fn".return_type.?)) { .error_union => { return @call(bun.callmod_inline, jsc.toJSHostCall, .{globalObject, @src(), ${typeName}.${getter}, .{this, ${thisValue ? "thisValue," : ""} globalObject}}); @@ -2275,7 +2275,7 @@ const JavaScriptCoreBindings = struct { if (names.setter) { output += ` pub fn ${names.setter}(this: *${typeName}, ${thisValue ? "thisValue: jsc.JSValue," : ""} globalObject: *jsc.JSGlobalObject, value: jsc.JSValue) callconv(jsc.conv) bool { - if (comptime Environment.enable_logs) log_zig_setter("${typeName}", "${name}", value); + if (comptime Environment.enable_logs) log_rust_setter("${typeName}", "${name}", value); switch (@typeInfo(@typeInfo(@TypeOf(${typeName}.${setter})).@"fn".return_type.?)) { .error_union => |error_union| { if (error_union.payload != void) { @@ -2298,7 +2298,7 @@ const JavaScriptCoreBindings = struct { const { args, returns } = DOMJIT; output += ` pub fn ${names.DOMJIT}(thisValue: *${typeName}, globalObject: *jsc.JSGlobalObject, ${args - .map(ZigDOMJITArgTypeDefinition) + .map(RustDOMJITArgTypeDefinition) .join(", ")}) callconv(jsc.conv) jsc.JSValue { return @call(bun.callmod_inline, ${typeName}.${DOMJITName(fn)}, .{thisValue, globalObject, ${args.map((_, i) => `arg${i}`).join(", ")}}); } @@ -2307,7 +2307,7 @@ const JavaScriptCoreBindings = struct { output += ` pub fn ${names.fn}(thisValue: *${typeName}, globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame${proto[name].passThis ? ", js_this_value: jsc.JSValue" : ""}) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_method("${typeName}", "${name}", callFrame); + if (comptime Environment.enable_logs) log_rust_method("${typeName}", "${name}", callFrame); return @call(bun.callmod_inline, jsc.toJSHostCall, .{globalObject, @src(), ${typeName}.${fn}, .{thisValue, globalObject, callFrame${proto[name].passThis ? ", js_this_value" : ""}}}); } `; @@ -2316,14 +2316,14 @@ const JavaScriptCoreBindings = struct { } { - const exportNames = name => zigExportName(exports, name => classSymbolName(typeName, name), klass[name]); + const exportNames = name => rustExportName(exports, name => classSymbolName(typeName, name), klass[name]); for (const name in klass) { const { getter, setter, accessor, fn, this: thisValue = true, cache, DOMJIT } = klass[name]; const names = exportNames(name); if (names.getter) { output += ` pub fn ${names.getter}(globalObject: *jsc.JSGlobalObject, ${thisValue ? "thisValue: jsc.JSValue," : ""} propertyName: jsc.JSValue) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_class_getter("${typeName}", "${name}"); + if (comptime Environment.enable_logs) log_rust_class_getter("${typeName}", "${name}"); return switch (@typeInfo(@typeInfo(@TypeOf(${typeName}.${getter})).@"fn".return_type.?)) { .error_union => { return @call(bun.callmod_inline, jsc.toJSHostCall, .{globalObject, @src(), ${typeName}.${getter}, .{globalObject, ${thisValue ? "thisValue," : ""} propertyName}}); @@ -2339,7 +2339,7 @@ const JavaScriptCoreBindings = struct { if (names.setter) { output += ` pub fn ${names.setter}(globalObject: *jsc.JSGlobalObject, thisValue: jsc.JSValue, target: jsc.JSValue) callconv(jsc.conv) bool { - if (comptime Environment.enable_logs) log_zig_class_setter("${typeName}", "${name}", target); + if (comptime Environment.enable_logs) log_rust_class_setter("${typeName}", "${name}", target); return @call(bun.callmod_inline, ${typeName}.${setter || accessor.setter}, .{thisValue, globalObject, target}); } `; @@ -2351,9 +2351,9 @@ const JavaScriptCoreBindings = struct { output += ` pub fn ${names.DOMJIT}(globalObject: *jsc.JSGlobalObject, thisValue: jsc.JSValue, ${args - .map(ZigDOMJITArgTypeDefinition) + .map(RustDOMJITArgTypeDefinition) .join(", ")}) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_class_domjit("${typeName}", "${name}"); + if (comptime Environment.enable_logs) log_rust_class_domjit("${typeName}", "${name}"); return @call(bun.callmod_inline, ${typeName}.${DOMJITName(fn)}, .{thisValue, globalObject, ${args.map((_, i) => `arg${i}`).join(", ")}}); } `; @@ -2361,7 +2361,7 @@ const JavaScriptCoreBindings = struct { output += ` pub fn ${names.fn}(globalObject: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_class_method("${typeName}", "${name}", callFrame); + if (comptime Environment.enable_logs) log_rust_class_method("${typeName}", "${name}", callFrame); return @call(bun.callmod_inline, jsc.toJSHostFn(${typeName}.${fn}), .{globalObject, callFrame}); } `; @@ -2373,7 +2373,7 @@ const JavaScriptCoreBindings = struct { exports.set("structuredClone", symbolName(typeName, "onStructuredCloneSerialize")); output += ` pub fn ${symbolName(typeName, "onStructuredCloneSerialize")}(thisValue: *${typeName}, globalObject: *jsc.JSGlobalObject, ctx: *anyopaque, writeBytes: WriteBytesFn) callconv(jsc.conv) void { - if (comptime Environment.enable_logs) log_zig_structured_clone_serialize("${typeName}"); + if (comptime Environment.enable_logs) log_rust_structured_clone_serialize("${typeName}"); @call(bun.callmod_inline, ${typeName}.onStructuredCloneSerialize, .{thisValue, globalObject, ctx, writeBytes}); } `; @@ -2382,7 +2382,7 @@ const JavaScriptCoreBindings = struct { exports.set("structuredClone_transferable", symbolName(typeName, "onStructuredCloneTransfer")); output += ` pub fn ${exports.get("structuredClone_transferable")}(thisValue: *${typeName}, globalObject: *jsc.JSGlobalObject, ctx: *anyopaque, write: WriteBytesFn) callconv(jsc.conv) void { - if (comptime Environment.enable_logs) log_zig_structured_clone_transfer("${typeName}"); + if (comptime Environment.enable_logs) log_rust_structured_clone_transfer("${typeName}"); @call(bun.callmod_inline, ${typeName}.onStructuredCloneTransfer, .{thisValue, globalObject, ctx, write}); } `; @@ -2392,7 +2392,7 @@ const JavaScriptCoreBindings = struct { output += ` pub fn ${symbolName(typeName, "onStructuredCloneDeserialize")}(globalObject: *jsc.JSGlobalObject, ptr: *[*]u8, end: [*]u8) callconv(jsc.conv) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_structured_clone_deserialize("${typeName}"); + if (comptime Environment.enable_logs) log_rust_structured_clone_deserialize("${typeName}"); return @call(bun.callmod_inline, jsc.toJSHostCall, .{ globalObject, @src(), ${typeName}.onStructuredCloneDeserialize, .{globalObject, ptr, end} }); } `; @@ -2426,7 +2426,7 @@ pub const ${className(typeName)} = struct { /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. pub fn fromJS(value: jsc.JSValue) ?*${typeName} { - if (comptime Environment.enable_logs) log_zig_from_js("${typeName}"); + if (comptime Environment.enable_logs) log_rust_from_js("${typeName}"); return ${symbolName(typeName, "fromJS")}(value); } @@ -2435,7 +2435,7 @@ pub const ${className(typeName)} = struct { /// If the object is a subclass of the type or has mutated the structure, return null. /// Note: this may return null for direct instances of the type if the user adds properties to the object. pub fn fromJSDirect(value: jsc.JSValue) ?*${typeName} { - if (comptime Environment.enable_logs) log_zig_from_js_direct("${typeName}"); + if (comptime Environment.enable_logs) log_rust_from_js_direct("${typeName}"); return ${symbolName(typeName, "fromJSDirect")}(value); } @@ -2448,7 +2448,7 @@ pub const ${className(typeName)} = struct { /// Get the ${typeName} constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *jsc.JSGlobalObject) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_get_constructor("${typeName}"); + if (comptime Environment.enable_logs) log_rust_get_constructor("${typeName}"); return ${symbolName(typeName, "getConstructor")}(globalObject); } ` @@ -2460,7 +2460,7 @@ pub const ${className(typeName)} = struct { ? ` /// Create a new instance of ${typeName} pub fn toJS(this: *${typeName}, globalObject: *jsc.JSGlobalObject) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_to_js("${typeName}"); + if (comptime Environment.enable_logs) log_rust_to_js("${typeName}"); if (comptime Environment.allow_assert) { const value__ = ${symbolName(typeName, "create")}(globalObject, this); @import("bun").assert(value__.as(${typeName}).? == this); // If this fails, likely a C ABI issue. @@ -2477,7 +2477,7 @@ pub const ${className(typeName)} = struct { ? ` /// Create a new instance of ${typeName} with a MarkedArgumentBuffer pub fn toJSWithValues(this: *${typeName}, globalObject: *jsc.JSGlobalObject, markedArgumentBuffer: *jsc.MarkedArgumentBuffer) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_to_js("${typeName}"); + if (comptime Environment.enable_logs) log_rust_to_js("${typeName}"); if (comptime Environment.allow_assert) { const value__ = ${symbolName(typeName, "createWithValues")}(globalObject, this, markedArgumentBuffer); @import("bun").assert(value__.as(${typeName}).? == this); // If this fails, likely a C ABI issue. @@ -2494,7 +2494,7 @@ pub const ${className(typeName)} = struct { ? ` /// Create a new instance of ${typeName} with initial values pub fn toJSWithInitialValues(this: *${typeName}, globalObject: *jsc.JSGlobalObject${values.map(v => `, ${v}: jsc.JSValue`).join("")}) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_to_js("${typeName}"); + if (comptime Environment.enable_logs) log_rust_to_js("${typeName}"); if (comptime Environment.allow_assert) { const value__ = ${symbolName(typeName, "createWithInitialValues")}(globalObject, this${values.map(v => `, ${v}`).join("")}); @import("bun").assert(value__.as(${typeName}).? == this); // If this fails, likely a C ABI issue. @@ -2511,7 +2511,7 @@ pub const ${className(typeName)} = struct { ? ` /// Create a new instance of ${typeName} with both a MarkedArgumentBuffer and initial values pub fn toJSWithValuesAndInitialValues(this: *${typeName}, globalObject: *jsc.JSGlobalObject, markedArgumentBuffer: *jsc.MarkedArgumentBuffer${values.map(v => `, ${v}: jsc.JSValue`).join("")}) jsc.JSValue { - if (comptime Environment.enable_logs) log_zig_to_js("${typeName}"); + if (comptime Environment.enable_logs) log_rust_to_js("${typeName}"); if (comptime Environment.allow_assert) { const value__ = ${symbolName(typeName, "createWithValuesAndInitialValues")}(globalObject, this, markedArgumentBuffer${values.map(v => `, ${v}`).join("")}); @import("bun").assert(value__.as(${typeName}).? == this); // If this fails, likely a C ABI issue. @@ -2556,7 +2556,7 @@ ${renderMethods()} } // ────────────────────────────────────────────────────────────────────────── -// Rust emitter — sibling of generateZig(). +// Rust emitter — sibling of generateRust(). // // Emits, per class with \`lang === "rust"\`, a block of \`#[unsafe(no_mangle)] // pub extern "C" fn\` thunks whose unmangled names and signatures are @@ -2732,7 +2732,7 @@ const rustModuleResolver = (() => { // `pub use bun_jsc::{BuildMessage, ResolveMessage};` so route there. return `crate::api::${name}`; }, - /** Resolve an absolute `.rs` (or `.zig`) file path to its `crate::…` module path. */ + /** Resolve an absolute `.rs` (or `.rust`) file path to its `crate::…` module path. */ resolveFile(absRs: string): string | null { return fileToMod.get(path.resolve(absRs)) ?? null; }, @@ -2837,7 +2837,7 @@ function generateRust( // Direct dispatch: each thunk calls an *inherent* method on the user's real // Rust struct (re-exported as `${typeName}` below). No trait, no opaque // placeholder, no `unimplemented!()` — a missing method is a compile error, - // mirroring the Zig path's `@import("…").${T}.${fn}` behaviour. + // mirroring the Rust path's `@import("…").${T}.${fn}` behaviour. const thunks: string[] = []; const symbols: string[] = []; function thunk(sym: string, sig: string, body: string) { @@ -2872,7 +2872,7 @@ function generateRust( const recv = sharedThis ? `&${T}` : `&mut ${T}`; const helper = (base: string) => (sharedThis ? `host_fn::${base}_shared` : `host_fn::${base}`); - // memoryCost / estimatedSize / ZigStructSize + // memoryCost / estimatedSize / RustStructSize if (memoryCost) { thunk(symbolName(typeName, "memoryCost"), `(this: &${T}) -> usize`, ` ${T}::memory_cost(this)`); } @@ -2880,9 +2880,9 @@ function generateRust( thunk(symbolName(typeName, "estimatedSize"), `(this: &${T}) -> usize`, ` ${T}::estimated_size(this)`); } if (!memoryCost && !estimatedSize) { - symbols.push(symbolName(typeName, "ZigStructSize")); + symbols.push(symbolName(typeName, "RustStructSize")); thunks.push( - `#[unsafe(no_mangle)]\npub static ${symbolName(typeName, "ZigStructSize")}: usize = core::mem::size_of::<${T}>();`, + `#[unsafe(no_mangle)]\npub static ${symbolName(typeName, "RustStructSize")}: usize = core::mem::size_of::<${T}>();`, ); } @@ -2939,7 +2939,7 @@ function generateRust( // so `&mut T → &T` autoref/coercion applies — many user impls take `&self`. { const seen = new Map(); - const exportNames = name => zigExportName(seen, n => protoSymbolName(typeName, n), proto[name]); + const exportNames = name => rustExportName(seen, n => protoSymbolName(typeName, n), proto[name]); for (const name in proto) { const { getter, setter, accessor, fn, this: thisValue = false, passThis, DOMJIT } = proto[name]; const names = exportNames(name); @@ -2995,7 +2995,7 @@ function generateRust( // ── klass (static) getters / setters / fns ─────────────────────────────── { const seen = new Map(); - const exportNames = name => zigExportName(seen, n => classSymbolName(typeName, n), klass[name]); + const exportNames = name => rustExportName(seen, n => classSymbolName(typeName, n), klass[name]); for (const name in klass) { const { getter, setter, accessor, fn, DOMJIT } = klass[name]; const names = exportNames(name); @@ -3065,7 +3065,7 @@ function generateRust( // ── C++→Rust extern imports + safe wrappers ────────────────────────────── // Emitted as free functions in a per-class `js_${T}` sub-module (mirrors - // Zig's `pub const js = jsc.Codegen.JS${T};`) so they don't collide with + // Rust's `pub const js = jsc.Codegen.JS${T};`) so they don't collide with // inherent `from_js`/`to_js` already defined on the real struct. const cachedExterns = gc_fields .map( @@ -3090,7 +3090,7 @@ function generateRust( .join("\n"); // `safe fn` (Rust 2024) inside `jsc_abi_extern! {}`: the C++ side - // (ZigGeneratedClasses.cpp) tolerates every well-typed input — \`fromJS\` + // (RustGeneratedClasses.cpp) tolerates every well-typed input — \`fromJS\` // returns null on type mismatch, \`create\` allocates from a live global, // \`SetCachedValue\` is a WriteBarrier store. Declaring them \`safe\` moves // the audit obligation to this generator (one place) instead of an @@ -3147,7 +3147,7 @@ ${gcAccessors} /// Native backing type for \`JS${typeName}.m_ctx\`. Re-export of the real /// hand-ported struct so the thunks below call its inherent methods directly -/// (mirrors Zig's \`@import("…").${typeName}.\`). A missing method is a +/// (mirrors Rust's \`@import("…").${typeName}.\`). A missing method is a /// compile error — fix it in \`${rustPath}\`, not here. pub use ${rustPath} as ${typeName}; @@ -3161,7 +3161,7 @@ ${jsModule} const RUST_GENERATED_CLASSES_HEADER = `// Auto-generated by src/codegen/generate-classes.ts — DO NOT EDIT. // // Per-class \`#[unsafe(no_mangle)] extern "C"\` thunks satisfying the externs -// declared by ZigGeneratedClasses.cpp. Each thunk calls an inherent method on +// declared by RustGeneratedClasses.cpp. Each thunk calls an inherent method on // the user's real Rust struct (re-exported here as \`\${T}\`). No trait, no // opaque placeholder, no runtime panic fallback — a missing struct or method // is a hard compile error in \`cargo check -p bun_runtime\`. @@ -3187,8 +3187,8 @@ pub type WriteBytesFn = unsafe extern "C" fn(*mut c_void, *const u8, u32); pub struct PropertyName(pub *const c_void); `; -function generateLazyClassStructureHeader(typeName, { klass = {}, proto = {}, zigOnly = false }) { - if (zigOnly) return ""; +function generateLazyClassStructureHeader(typeName, { klass = {}, proto = {}, rustOnly = false }) { + if (rustOnly) return ""; return ` JSC::Structure* ${className(typeName)}Structure() const { return m_${className(typeName)}.getInitializedOnMainThread(this); } @@ -3198,13 +3198,13 @@ function generateLazyClassStructureHeader(typeName, { klass = {}, proto = {}, zi `.trim(); } -function generateLazyClassStructureImpl(typeName, { klass = {}, proto = {}, noConstructor = false, zigOnly = false }) { - if (zigOnly) return ""; +function generateLazyClassStructureImpl(typeName, { klass = {}, proto = {}, noConstructor = false, rustOnly = false }) { + if (rustOnly) return ""; return ` m_${className(typeName)}.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::${className(typeName)}::createPrototype(init.vm, reinterpret_cast(init.global))); + init.setPrototype(WebCore::${className(typeName)}::createPrototype(init.vm, reinterpret_cast(init.global))); init.setStructure(WebCore::${className(typeName)}::createStructure(init.vm, init.global, init.prototype)); ${ noConstructor @@ -3227,7 +3227,7 @@ const GENERATED_CLASSES_HEADER = [ #include "root.h" -namespace Zig { +namespace Rust { JSC_DECLARE_HOST_FUNCTION(jsFunctionInherits); @@ -3241,7 +3241,7 @@ JSC_DECLARE_HOST_FUNCTION(jsFunctionInherits); ` namespace WebCore { -using namespace Zig; +using namespace Rust; using namespace JSC; `, @@ -3254,7 +3254,7 @@ const GENERATED_CLASSES_IMPL_HEADER_PRE = ` #include "headers.h" #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -3270,7 +3270,7 @@ const GENERATED_CLASSES_IMPL_HEADER_PRE = ` #include #include "JSDOMConvertBufferSource.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "WebCoreJSBuiltins.h" #include "ErrorCode+List.h" #include "ErrorCode.h" @@ -3292,9 +3292,9 @@ const GENERATED_CLASSES_IMPL_HEADER_POST = ` namespace WebCore { using namespace JSC; -using namespace Zig; +using namespace Rust; -#include "ZigGeneratedClasses.lut.h" +#include "RustGeneratedClasses.lut.h" `; @@ -3312,7 +3312,7 @@ ${jsclasses .map((v, i) => `#include "${v}"`) .join("\n")} -JSC_DEFINE_HOST_FUNCTION(Zig::jsFunctionInherits, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(Rust::jsFunctionInherits, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { auto id = callFrame->argument(0).toInt32(globalObject); auto value = callFrame->argument(1); @@ -3369,7 +3369,7 @@ void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& `.trim(); } -const ZIG_GENERATED_CLASSES_HEADER = ` +const RUST_GENERATED_CLASSES_HEADER = ` /// Generated code! To regenerate, run: /// /// bun run build @@ -3378,10 +3378,10 @@ const ZIG_GENERATED_CLASSES_HEADER = ` /// 1. \`bun src/codegen/generate-classes.ts\` /// 2. Scan for **/*.classes.ts files in src/ /// 3. Generate a JS wrapper for each class in: -/// - Zig: generated_classes.zig -/// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp -/// 4. For the Zig code to successfully compile: -/// - Add it to generated_classes_list.zig +/// - Rust: generated_classes.rust +/// - C++: RustGeneratedClasses.h, RustGeneratedClasses.cpp +/// 4. For the Rust code to successfully compile: +/// - Add it to generated_classes_list.rust /// - \`\`\` /// pub const js = jsc.Codegen.JSMyClassName; /// pub const toJS = js.toJS; @@ -3395,7 +3395,7 @@ const jsc = bun.jsc; const Classes = jsc.GeneratedClassesList; const Environment = bun.Environment; const std = @import("std"); -const zig = bun.Output.scoped(.zig, .hidden); +const rust = bun.Output.scoped(.rust, .hidden); const wrapHostFunction = bun.gen_classes_lib.wrapHostFunction; const wrapMethod = bun.gen_classes_lib.wrapMethod; @@ -3461,16 +3461,16 @@ for (const obj of classes) { const GENERATED_CLASSES_FOOTER = ` typedef SYSV_ABI void (*CppStructuredCloneableSerializeFunction)(CloneSerializer*, const uint8_t*, uint32_t); -typedef SYSV_ABI void (*ZigStructuredCloneableSerializeFunction)(void*, JSC::JSGlobalObject*, CloneSerializer*, CppStructuredCloneableSerializeFunction); +typedef SYSV_ABI void (*RustStructuredCloneableSerializeFunction)(void*, JSC::JSGlobalObject*, CloneSerializer*, CppStructuredCloneableSerializeFunction); class StructuredCloneableSerialize { public: CppStructuredCloneableSerializeFunction cppWriteBytes; - ZigStructuredCloneableSerializeFunction zigFunction; + RustStructuredCloneableSerializeFunction rustFunction; uint8_t tag = 0; - // the type from zig + // the type from rust void* impl = nullptr; bool isForTransfer = false; @@ -3479,7 +3479,7 @@ class StructuredCloneableSerialize { static std::optional fromJS(JSC::JSValue); void write(CloneSerializer* serializer, JSC::JSGlobalObject* globalObject) { - zigFunction(impl, globalObject, serializer, cppWriteBytes); + rustFunction(impl, globalObject, serializer, cppWriteBytes); } }; @@ -3502,7 +3502,7 @@ function writeCppSerializers() { function fromJSForEachClass(klass) { return ` if (auto* result = dynamicDowncast<${className(klass.name)}>(value)) { - return StructuredCloneableSerialize { .cppWriteBytes = SerializedScriptValue::writeBytesForBun, .zigFunction = ${symbolName( + return StructuredCloneableSerialize { .cppWriteBytes = SerializedScriptValue::writeBytesForBun, .rustFunction = ${symbolName( klass.name, "onStructuredCloneSerialize", )}, .tag = ${klass.structuredClone.tag}, .impl = result->wrapped(), .isForTransfer = ${!!klass.structuredClone.transferable}, .isForStorage = ${!!klass.structuredClone.storable} }; @@ -3538,8 +3538,8 @@ function writeCppSerializers() { } // ── Rust output: per-class thunks for `lang === "rust"` (default). ───────── -// Zig output is still emitted for every class so the C++ side's `extern` -// declarations stay satisfied during incremental migration; the Zig thunks for +// Rust output is still emitted for every class so the C++ side's `extern` +// declarations stay satisfied during incremental migration; the Rust thunks for // rust-lang classes simply go unreferenced once the Rust crate links. { const rustClasses = classes.filter(a => (a.lang ?? "rust") === "rust"); @@ -3562,10 +3562,10 @@ function writeCppSerializers() { ); } -await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.zig`, [ - ZIG_GENERATED_CLASSES_HEADER, +await writeIfNotChanged(`${outBase}/RustGeneratedClasses.rust`, [ + RUST_GENERATED_CLASSES_HEADER, - ...classes.map(a => generateZig(a.name, a).trim()).join("\n"), + ...classes.map(a => generateRust(a.name, a).trim()).join("\n"), "\n", ` comptime { @@ -3575,127 +3575,127 @@ comptime { // -- Avoid instantiating these log functions too many times -fn log_zig_method_call(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_method_call(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); + rust("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); } } -fn log_zig_getter(typename: []const u8, property_name: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_getter(typename: []const u8, property_name: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("get {s}.{s}", .{typename, property_name}); + rust("get {s}.{s}", .{typename, property_name}); } } -fn log_zig_setter(typename: []const u8, property_name: []const u8, value: jsc.JSValue) callconv(bun.callconv_inline) void { +fn log_rust_setter(typename: []const u8, property_name: []const u8, value: jsc.JSValue) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("set {s}.{s} = {?s}", .{typename, property_name, bun.tagName(jsc.JSValue, value)}); + rust("set {s}.{s} = {?s}", .{typename, property_name, bun.tagName(jsc.JSValue, value)}); } } -fn log_zig_finalize(typename: []const u8, ptr: *const anyopaque) callconv(bun.callconv_inline) void { +fn log_rust_finalize(typename: []const u8, ptr: *const anyopaque) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("~{s} 0x{x:8}", .{typename, @intFromPtr(ptr)}); + rust("~{s} 0x{x:8}", .{typename, @intFromPtr(ptr)}); } } -fn log_zig_function_call(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_function_call(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}({d} args)", .{typename, callframe.arguments().len}); + rust("{s}({d} args)", .{typename, callframe.arguments().len}); } } -fn log_zig_constructor(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_constructor(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("new {s}({d} args)", .{typename, callframe.arguments().len}); + rust("new {s}({d} args)", .{typename, callframe.arguments().len}); } } -fn log_zig_call(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_call(typename: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}({d} args)", .{typename, callframe.arguments().len}); + rust("{s}({d} args)", .{typename, callframe.arguments().len}); } } -fn log_zig_get_internal_properties(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_get_internal_properties(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("getInternalProperties {s}", .{typename}); + rust("getInternalProperties {s}", .{typename}); } } -fn log_zig_method(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_method(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); + rust("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); } } -fn log_zig_structured_clone_serialize(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_structured_clone_serialize(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("structuredCloneSerialize {s}", .{typename}); + rust("structuredCloneSerialize {s}", .{typename}); } } -fn log_zig_structured_clone_transfer(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_structured_clone_transfer(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("structuredCloneTransfer {s}", .{typename}); + rust("structuredCloneTransfer {s}", .{typename}); } } -fn log_zig_structured_clone_deserialize(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_structured_clone_deserialize(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("structuredCloneDeserialize {s}", .{typename}); + rust("structuredCloneDeserialize {s}", .{typename}); } } -fn log_zig_from_js(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_from_js(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.fromJS", .{typename}); + rust("{s}.fromJS", .{typename}); } } -fn log_zig_from_js_direct(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_from_js_direct(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.fromJSDirect", .{typename}); + rust("{s}.fromJSDirect", .{typename}); } } -fn log_zig_get_constructor(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_get_constructor(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.constructor", .{typename}); + rust("{s}.constructor", .{typename}); } } -fn log_zig_to_js(typename: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_to_js(typename: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.toJS", .{typename}); + rust("{s}.toJS", .{typename}); } } -fn log_zig_class_method(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { +fn log_rust_class_method(typename: []const u8, method_name: []const u8, callframe: *jsc.CallFrame) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); + rust("{s}.{s}({d} args)", .{typename, method_name, callframe.arguments().len}); } } -fn log_zig_class_getter(typename: []const u8, property_name: []const u8) callconv(bun.callconv_inline) void { +fn log_rust_class_getter(typename: []const u8, property_name: []const u8) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("static get {s}.{s}", .{typename, property_name}); + rust("static get {s}.{s}", .{typename, property_name}); } } -fn log_zig_class_setter(typename: []const u8, property_name: []const u8, value: jsc.JSValue) callconv(bun.callconv_inline) void { +fn log_rust_class_setter(typename: []const u8, property_name: []const u8, value: jsc.JSValue) callconv(bun.callconv_inline) void { if (comptime Environment.enable_logs) { - zig("static set {s}.{s} = {?s}", .{typename, property_name, bun.tagName(jsc.JSValue, value)}); + rust("static set {s}.{s} = {?s}", .{typename, property_name, bun.tagName(jsc.JSValue, value)}); } } `, ]); -if (!process.env.ONLY_ZIG) { +if (!process.env.ONLY_RUST) { const allHeaders = classes.map(a => generateHeader(a.name, a)); - await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.h`, [ + await writeIfNotChanged(`${outBase}/RustGeneratedClasses.h`, [ GENERATED_CLASSES_HEADER[0], ...[...new Set(extraIncludes.map(a => `#include "${a}";` + "\n"))], GENERATED_CLASSES_HEADER[1], @@ -3704,7 +3704,7 @@ if (!process.env.ONLY_ZIG) { ]); const allImpls = classes.map(a => generateImpl(a.name, a)); - await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.cpp`, [ + await writeIfNotChanged(`${outBase}/RustGeneratedClasses.cpp`, [ GENERATED_CLASSES_IMPL_HEADER_PRE, externs.trim(), GENERATED_CLASSES_IMPL_HEADER_POST, @@ -3719,34 +3719,34 @@ if (!process.env.ONLY_ZIG) { lutTextFile += ` /* `; - await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.lut.txt`, [lutTextFile]); + await writeIfNotChanged(`${outBase}/RustGeneratedClasses.lut.txt`, [lutTextFile]); } await writeIfNotChanged( - `${outBase}/ZigGeneratedClasses+lazyStructureHeader.h`, + `${outBase}/RustGeneratedClasses+lazyStructureHeader.h`, classes.map(a => generateLazyClassStructureHeader(a.name, a)).join("\n"), ); await writeIfNotChanged( - `${outBase}/ZigGeneratedClasses+DOMClientIsoSubspaces.h`, + `${outBase}/RustGeneratedClasses+DOMClientIsoSubspaces.h`, classes.map(a => [`std::unique_ptr ${clientSubspaceFor(a.name)};`].join("\n")), ); await writeIfNotChanged( - `${outBase}/ZigGeneratedClasses+DOMIsoSubspaces.h`, + `${outBase}/RustGeneratedClasses+DOMIsoSubspaces.h`, classes.map(a => [`std::unique_ptr ${subspaceFor(a.name)};`].join("\n")), ); await writeIfNotChanged( - `${outBase}/ZigGeneratedClasses+lazyStructureImpl.h`, + `${outBase}/RustGeneratedClasses+lazyStructureImpl.h`, initLazyClasses(classes.map(a => generateLazyClassStructureImpl(a.name, a))) + "\n" + visitLazyClasses(classes), ); - await writeIfNotChanged(`${outBase}/ZigGeneratedClasses.d.ts`, [generateBuiltinTypes(classes)]); + await writeIfNotChanged(`${outBase}/RustGeneratedClasses.d.ts`, [generateBuiltinTypes(classes)]); } /** - * Generates a basic TypeScript type signature string and corresponding Zig source comment + * Generates a basic TypeScript type signature string and corresponding Rust source comment * for a given property definition. * Returns null if the property should not be included in the types (e.g., private). */ @@ -3796,7 +3796,7 @@ function getPropertySignatureWithComment( if ("fn" in propDef) { commentLines.push( ` Look for a function like this: - * \`\`\`zig + * \`\`\`rust * fn ${propDef.fn}(this: *${classDef.name}, globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { ... } * \`\`\``, ); @@ -3805,16 +3805,16 @@ function getPropertySignatureWithComment( } } else if ("accessor" in propDef) { signature = `${tsPropName}: unknown;`; // Read-write accessor - commentLines.push(` zig ⚡ \`${propDef.accessor.getter}\``); + commentLines.push(` rust ⚡ \`${propDef.accessor.getter}\``); commentLines.push( ` Look for a getter like this: - * \`\`\`zig + * \`\`\`rust * fn ${propDef.accessor.getter}(this: *${classDef.name}, globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { ... } * \`\`\``, ); commentLines.push( ` Look for a setter like this: - * \`\`\`zig + * \`\`\`rust * fn ${propDef.accessor.setter}(this: *${classDef.name}, globalThis: *JSC.JSGlobalObject, value: JSC.JSValue) bun.JSError!void * \`\`\``, ); @@ -3826,7 +3826,7 @@ function getPropertySignatureWithComment( isReadOnly = !propDef.writable; // Mark readonly if only getter or explicitly not writable commentLines.push( ` Look for a getter like this: - * \`\`\`zig + * \`\`\`rust * fn ${propDef.getter}(this: *${classDef.name}, globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { ... } * \`\`\``, ); @@ -3838,7 +3838,7 @@ function getPropertySignatureWithComment( signature = `${tsPropName}: unknown;`; commentLines.push( ` Look for a setter like this: - * \`\`\`zig + * \`\`\`rust * fn ${propDef.setter}(this: *${classDef.name}, globalThis: *jsc.JSGlobalObject, value: jsc.JSValue) bun.JSError!void { ... } * \`\`\``, ); @@ -3859,14 +3859,14 @@ function getPropertySignatureWithComment( /** * Generates TypeScript type definitions (interfaces) for all provided class definitions. - * Creates content for a single ambient declaration file (ZigGeneratedClasses.d.ts). + * Creates content for a single ambient declaration file (RustGeneratedClasses.d.ts). */ export function generateBuiltinTypes(classes: ClassDefinition[]): string { const typeDeclarations: string[] = []; for (const classDef of classes) { - // Skip classes marked as zigOnly, as they shouldn't have JS/TS counterparts - if ((classDef as any).zigOnly) continue; + // Skip classes marked as rustOnly, as they shouldn't have JS/TS counterparts + if ((classDef as any).rustOnly) continue; const instanceMembers: string[] = []; const staticMembers: string[] = []; @@ -3882,7 +3882,7 @@ export function generateBuiltinTypes(classes: ClassDefinition[]): string { } } - for (const [propName, zigFieldName] of Object.entries(classDef.own || {})) { + for (const [propName, rustFieldName] of Object.entries(classDef.own || {})) { instanceMembers.push(` readonly ${propName}: any;`); } @@ -3962,13 +3962,13 @@ export function generateBuiltinTypes(classes: ClassDefinition[]): string { /** - * Type definitions for Bun's built-in classes implemented in Zig. + * Type definitions for Bun's built-in classes implemented in Rust. * Do not edit this file directly. * @generated * * This namespace does not exist at runtime! */ -declare namespace $ZigGeneratedClasses { +declare namespace $RustGeneratedClasses { ${typeDeclarations.map(line => (line ? " " + line : "")).join("\n")} } `; diff --git a/src/codegen/generate-compact-string-table.ts b/src/codegen/generate-compact-string-table.ts index 9f75d7cf209..df1c6b9d45e 100644 --- a/src/codegen/generate-compact-string-table.ts +++ b/src/codegen/generate-compact-string-table.ts @@ -3,7 +3,7 @@ /** * Compact String Table Generator * - * Generates a Zig enum that stores multiple strings in a contiguous buffer with + * Generates a Rust enum that stores multiple strings in a contiguous buffer with * reduced per-string overhead compared to individual string slices. * * Instead of storing each string as a separate slice (16 bytes each), this packs @@ -22,8 +22,8 @@ * # Input: newline-delimited strings * echo -e "application/json\\ntext/html\\ntext/plain" > strings.txt * - * # Generate Zig code - * bun src/codegen/generate-compact-string-table.ts strings.txt output.zig MyStrings + * # Generate Rust code + * bun src/codegen/generate-compact-string-table.ts strings.txt output.rust MyStrings * ``` * * ## Trade-offs: @@ -40,7 +40,7 @@ import { writeFileSync } from "fs"; const args = process.argv.slice(2); if (args.length < 3) { - console.error("Usage: generate-compact-string-table.ts [namespace]"); + console.error("Usage: generate-compact-string-table.ts [namespace]"); console.error("Provide strings via stdin, one per line"); process.exit(1); } @@ -60,12 +60,12 @@ interface PackedString { entries: StringEntry[]; } -function escapeZigIdentifier(name: string): string { +function escapeRustIdentifier(name: string): string { // Always use @"..." syntax for consistency return `@"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`; } -function escapeZigString(str: string): string { +function escapeRustString(str: string): string { return str .replace(/\\/g, "\\\\") .replace(/"/g, '\\"') @@ -327,7 +327,7 @@ export function generateCompactStringTable( position: u${positionBits}, }; - const _bytes = "${escapeZigString(packedData)}"; + const _bytes = "${escapeRustString(packedData)}"; const _lengths = [_]${findSmallestIntType(Math.max(...uniqueLengths))}{${uniqueLengths.join(", ")}}; const _group_start_offsets = [_]${findSmallestIntType(Math.max(...groupStartOffsets))}{${groupStartOffsets.join(", ")}}; @@ -340,7 +340,7 @@ export function generateCompactStringTable( for (const entry of entries) { const pos = entryPositions.get(entry.name)!; const packedValue = pos.groupIndex | (pos.positionInGroup << lengthGroupBits); - output += ` ${escapeZigIdentifier(entry.name)} = ${packedValue},\n`; + output += ` ${escapeRustIdentifier(entry.name)} = ${packedValue},\n`; } output += ` @@ -365,7 +365,7 @@ export function generateCompactStringTable( pub const count = ${entries.length}; pub const all = &[_]${enumName}{ -${entries.map(entry => ` .${escapeZigIdentifier(entry.name)},`).join("\n")} +${entries.map(entry => ` .${escapeRustIdentifier(entry.name)},`).join("\n")} }; }; `; diff --git a/src/codegen/generate-host-exports.ts b/src/codegen/generate-host-exports.ts index 62eb1a1cd1e..df31b1dcffd 100644 --- a/src/codegen/generate-host-exports.ts +++ b/src/codegen/generate-host-exports.ts @@ -264,7 +264,7 @@ for (const { dir, crate } of scanRoots) { abi ??= "jsc"; } else if (params.length === 1 && /JSGlobalObject$/.test(params[0].ty) && isJsRet) { shape = "lazy"; - // Lazy property creators are direct C++ calls (e.g. ZigGlobalObject.cpp + // Lazy property creators are direct C++ calls (e.g. RustGlobalObject.cpp // declares `extern "C" JSC::EncodedJSValue BunObject__createBunStd*`), // NOT JSC trampoline dispatch — default to `c`. A SYSV_ABI lazy getter // (e.g. `BunObject_lazyPropCb_*`) must opt in with `, jsc` explicitly. @@ -377,7 +377,7 @@ function emitThunk(e: Export): string { const loc = `${path.relative(repoRoot, e.file)}:${e.line}`; // `JsResult` impls need `to_js_host_call` (exception-scope assert + // panic barrier + Err→empty mapping). Plain-`JSValue` impls are bare - // `callconv(jsc.conv)` bodies in the .zig spec — wrap them and you trip + // `callconv(jsc.conv)` bodies in the .rust spec — wrap them and you trip // `assert_exception_presence_matches(false)` whenever the body legitimately // leaves an exception pending while returning non-empty (e.g. // `Bun__drainMicrotasksFromJS`). Match `#[bun_jsc::host_call]`: deref + call, @@ -481,7 +481,7 @@ use bun_jsc::{self, host_fn, CallFrame, JSGlobalObject, JSValue, JsResult}; // (\`bun_jsc::…\` / \`crate::…\`) in the impl signature — the generator copies // the type token verbatim. use bun_jsc::virtual_machine::VirtualMachine; -use bun_jsc::{JSInternalPromise, JSObject, JSPromise, ZigStackFrame}; +use bun_jsc::{JSInternalPromise, JSObject, JSPromise, RustStackFrame}; use bun_jsc::debugger::{ InspectorBunFrontendDevServerAgentHandle, LifecycleHandle, TestReporterHandle, }; diff --git a/src/codegen/generate-js2native.ts b/src/codegen/generate-js2native.ts index 398a88f56d3..162592e0e16 100644 --- a/src/codegen/generate-js2native.ts +++ b/src/codegen/generate-js2native.ts @@ -1,4 +1,4 @@ -// This file implements the global state for $zig and $cpp preprocessor macros +// This file implements the global state for $rust and $cpp preprocessor macros // as well as all the code it generates. // // For the actual parsing, see replacements.ts @@ -25,7 +25,7 @@ interface WrapperCall { filename: string; } -type NativeCallType = "zig" | "cpp" | "bind"; +type NativeCallType = "rust" | "cpp" | "bind"; const nativeCalls: NativeCall[] = []; const wrapperCalls: WrapperCall[] = []; @@ -33,7 +33,7 @@ const wrapperCalls: WrapperCall[] = []; const sourceFiles = readdirRecursiveWithExclusionsAndExtensionsSync( path.join(import.meta.dir, "../"), ["deps", "node_modules", "WebKit"], - [".cpp", ".zig", ".bind.ts"], + [".cpp", ".rust", ".bind.ts"], ); function callBaseName(x: string) { @@ -53,7 +53,7 @@ function resolveNativeFileId(call_type: NativeCallType, filename: string) { throw new Error(`Could not find file ${filename} in $${fnName} call`); } - if (call_type === "zig") { + if (call_type === "rust") { return resolved; } @@ -103,8 +103,8 @@ export function registerNativeCall( } function symbol(call: Pick) { - return call.type === "zig" - ? `JS2Zig__${call.filename ? normalizeSymbolPathPrefix(call.filename) + "_" : ""}${call.symbol.replace(/[^A-Za-z]/g, "_")}` + return call.type === "rust" + ? `JS2Rust__${call.filename ? normalizeSymbolPathPrefix(call.filename) + "_" : ""}${call.symbol.replace(/[^A-Za-z]/g, "_")}` : call.symbol; } @@ -116,7 +116,7 @@ function normalizeSymbolPathPrefix(input: string) { input = input.slice(bunDir.length); } - return input.replaceAll(".zig", "_zig_").replace(/[^A-Za-z]/g, "_"); + return input.replaceAll(".rust", "_rust_").replace(/[^A-Za-z]/g, "_"); } function cppPointer(call: NativeCall) { @@ -131,12 +131,12 @@ export function getJS2NativeCPP() { const externs: string[] = []; const nativeCallStrings = nativeCalls - .filter(x => x.type === "zig") + .filter(x => x.type === "rust") .flatMap( call => ( - externs.push(`extern "C" SYSV_ABI JSC::EncodedJSValue ${symbol(call)}_workaround(Zig::GlobalObject*);` + "\n"), + externs.push(`extern "C" SYSV_ABI JSC::EncodedJSValue ${symbol(call)}_workaround(Rust::GlobalObject*);` + "\n"), [ - `static ALWAYS_INLINE JSC::JSValue ${symbol(call)}(Zig::GlobalObject* global) {`, + `static ALWAYS_INLINE JSC::JSValue ${symbol(call)}(Rust::GlobalObject* global) {`, ` return JSValue::decode(${symbol(call)}_workaround(global));`, `}` + "\n\n", ] @@ -146,16 +146,16 @@ export function getJS2NativeCPP() { const wrapperCallStrings = wrapperCalls.map(x => { if (x.wrap_kind === "new-function") { return [ - (x.type === "zig" && + (x.type === "rust" && externs.push( `BUN_DECLARE_HOST_FUNCTION(${symbol({ - type: "zig", + type: "rust", symbol: x.symbol_target, filename: x.filename, })});`, ), "") || "", - `static ALWAYS_INLINE JSC::JSValue ${x.symbol_generated}(Zig::GlobalObject* globalObject) {`, + `static ALWAYS_INLINE JSC::JSValue ${x.symbol_generated}(Rust::GlobalObject* globalObject) {`, ` return JSC::JSFunction::create(globalObject->vm(), globalObject, ${x.call_length}, ${JSON.stringify( x.display_name, )}_s, ${symbol({ @@ -185,10 +185,10 @@ export function getJS2NativeCPP() { .filter(x => x.type === "bind") .map( x => - `extern "C" SYSV_ABI JSC::EncodedJSValue js2native_bindgen_${basename(x.filename.replace(/\.bind\.ts$/, ""))}_${x.symbol}(Zig::GlobalObject*);`, + `extern "C" SYSV_ABI JSC::EncodedJSValue js2native_bindgen_${basename(x.filename.replace(/\.bind\.ts$/, ""))}_${x.symbol}(Rust::GlobalObject*);`, ), - `typedef JSC::JSValue (*JS2NativeFunction)(Zig::GlobalObject*);`, - `static ALWAYS_INLINE JSC::JSValue callJS2Native(int32_t index, Zig::GlobalObject* global) {`, + `typedef JSC::JSValue (*JS2NativeFunction)(Rust::GlobalObject*);`, + `static ALWAYS_INLINE JSC::JSValue callJS2Native(int32_t index, Rust::GlobalObject* global) {`, ` switch(index) {`, ...nativeCalls.map( x => @@ -207,27 +207,27 @@ export function getJS2NativeCPP() { ].join("\n"); } -export function getJS2NativeZig(gs2NativeZigPath: string) { +export function getJS2NativeRust(gs2NativeRustPath: string) { return [ - "//! This file is generated by src/codegen/generate-js2native.ts based on seen calls to the $zig() JS macro", + "//! This file is generated by src/codegen/generate-js2native.ts based on seen calls to the $rust() JS macro", `const bun = @import("bun");`, `const jsc = bun.jsc;`, ...nativeCalls - .filter(x => x.type === "zig") + .filter(x => x.type === "rust") .flatMap(call => [ `export fn ${symbol(call)}_workaround(global: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue {`, - ` return jsc.toJSHostCall(global, @src(), @import(${JSON.stringify(path.relative(path.dirname(gs2NativeZigPath), call.filename))}).${call.symbol}, .{global});`, + ` return jsc.toJSHostCall(global, @src(), @import(${JSON.stringify(path.relative(path.dirname(gs2NativeRustPath), call.filename))}).${call.symbol}, .{global});`, "}", ]), ...wrapperCalls - .filter(x => x.type === "zig") + .filter(x => x.type === "rust") .flatMap(x => [ `export fn ${symbol({ - type: "zig", + type: "rust", symbol: x.symbol_target, filename: x.filename, })}(global: *jsc.JSGlobalObject, call_frame: *jsc.CallFrame) callconv(jsc.conv) jsc.JSValue {`, - ` const function = @import(${JSON.stringify(path.relative(path.dirname(gs2NativeZigPath), x.filename))});`, + ` const function = @import(${JSON.stringify(path.relative(path.dirname(gs2NativeRustPath), x.filename))});`, ` return @call(bun.callmod_inline, jsc.toJSHostFn(function.${x.symbol_target}), .{global, call_frame});`, "}", ]), @@ -247,28 +247,28 @@ export function getJS2NativeZig(gs2NativeZigPath: string) { } // ────────────────────────────────────────────────────────────────────────── -// Rust emitter — sibling of getJS2NativeZig(). +// Rust emitter — sibling of getJS2NativeRust(). // -// Emits, for every $zig() call site, a `#[unsafe(no_mangle)] extern "C"` +// Emits, for every $rust() call site, a `#[unsafe(no_mangle)] extern "C"` // thunk whose unmangled name and signature is byte-identical to the extern // the C++ side declares in GeneratedJS2Native.h. The C++ output is invariant; // only the implementer of the symbol changes. // -// Two ABI shapes (mirroring the Zig output exactly): -// • nativeCalls (type "zig") → `${sym}_workaround(global) -> JSValue` -// • wrapperCalls (type "zig") → `${sym}(global, callframe) -> JSValue` +// Two ABI shapes (mirroring the Rust output exactly): +// • nativeCalls (type "rust") → `${sym}_workaround(global) -> JSValue` +// • wrapperCalls (type "rust") → `${sym}(global, callframe) -> JSValue` // // Each thunk calls the hand-ported Rust function directly at -// `crate::::` — no trait, no +// `crate::::` — no trait, no // runtime panic fallback. A missing function is a compile error. // ────────────────────────────────────────────────────────────────────────── export function getJS2NativeRust() { // Symbols already hand-exported in src/ (via `export_host_fn!` or - // `#[unsafe(export_name = "JS2Zig__…")]`) — skip emitting a thunk for these + // `#[unsafe(export_name = "JS2Rust__…")]`) — skip emitting a thunk for these // so the linker doesn't see two definitions. const handExported = new Set([ - "JS2Zig___src_runtime_dns_jsc_dns_zig__Resolver_getRuntimeDefaultResultOrderOption", - "JS2Zig___src_runtime_dns_jsc_dns_zig__Resolver_newResolver", + "JS2Rust___src_runtime_dns_jsc_dns_rust__Resolver_getRuntimeDefaultResultOrderOption", + "JS2Rust___src_runtime_dns_jsc_dns_rust__Resolver_newResolver", ]); const srcRoot = path.resolve(import.meta.dir, ".."); @@ -279,13 +279,13 @@ export function getJS2NativeRust() { .replace(/[.\-]/g, "_") .toLowerCase(); - // `src/runtime/node/node_util_binding.zig` + `parseEnv` + // `src/runtime/node/node_util_binding.rust` + `parseEnv` // → `crate::node::node_util_binding::parse_env` - // `src/ini/ini.zig` + `IniTestingAPIs.parse` (outside bun_runtime) + // `src/ini/ini.rust` + `IniTestingAPIs.parse` (outside bun_runtime) // → `crate::dispatch::js2native::ini_ini_testing_apis_parse` (single // landing pad the port-agents fill in; still a compile error if missing). const rustTarget = (filename: string, sym: string) => { - const rel = path.relative(srcRoot, filename).replace(/\.zig$/, ""); + const rel = path.relative(srcRoot, filename).replace(/\.rust$/, ""); const segs = rel.split(path.sep); const fn = sym .split(".") @@ -306,13 +306,13 @@ export function getJS2NativeRust() { const thunks: string[] = []; const seen = new Set(); - for (const call of nativeCalls.filter(x => x.type === "zig")) { + for (const call of nativeCalls.filter(x => x.type === "rust")) { const sym = `${symbol(call)}_workaround`; if (seen.has(sym)) continue; seen.add(sym); const target = rustTarget(call.filename, call.symbol); thunks.push( - `// $zig(${path.basename(call.filename)}, ${call.symbol})`, + `// $rust(${path.basename(call.filename)}, ${call.symbol})`, `bun_jsc::jsc_host_abi! {`, ` #[unsafe(no_mangle)]`, ` pub unsafe fn ${sym}(global: &JSGlobalObject) -> JSValue {`, @@ -323,8 +323,8 @@ export function getJS2NativeRust() { ); } - for (const x of wrapperCalls.filter(x => x.type === "zig")) { - const sym = symbol({ type: "zig", symbol: x.symbol_target, filename: x.filename }); + for (const x of wrapperCalls.filter(x => x.type === "rust")) { + const sym = symbol({ type: "rust", symbol: x.symbol_target, filename: x.filename }); if (seen.has(sym)) continue; seen.add(sym); if (handExported.has(sym)) { @@ -333,7 +333,7 @@ export function getJS2NativeRust() { } const target = rustTarget(x.filename, x.symbol_target); thunks.push( - `// $zig(${path.basename(x.filename)}, ${x.symbol_target})`, + `// $rust(${path.basename(x.filename)}, ${x.symbol_target})`, `bun_jsc::jsc_host_abi! {`, ` #[unsafe(no_mangle)]`, ` pub unsafe fn ${sym}(global: &JSGlobalObject, callframe: &CallFrame) -> JSValue {`, @@ -347,7 +347,7 @@ export function getJS2NativeRust() { return [ `// Auto-generated by src/codegen/generate-js2native.ts — DO NOT EDIT.`, `//`, - `// \`#[unsafe(no_mangle)] extern "C"\` thunks satisfying the JS2Zig__* externs`, + `// \`#[unsafe(no_mangle)] extern "C"\` thunks satisfying the JS2Rust__* externs`, `// declared by GeneratedJS2Native.h (the JS-module → native dispatch table).`, `// Each thunk calls the hand-ported Rust function directly; a missing`, `// function is a compile error in \`cargo check -p bun_runtime\`.`, @@ -370,9 +370,9 @@ export function getJS2NativeDTS() { .filter(x => x.endsWith("cpp")) .map(x => JSON.stringify(basename(x))) .join("|"), - "declare type NativeFilenameZig = " + + "declare type NativeFilenameRust = " + sourceFiles - .filter(x => x.endsWith("zig")) + .filter(x => x.endsWith("rust")) .map(x => JSON.stringify(basename(x))) .join("|"), "", diff --git a/src/codegen/generate-jssink.ts b/src/codegen/generate-jssink.ts index fc9e87f4745..0ff17f7d974 100644 --- a/src/codegen/generate-jssink.ts +++ b/src/codegen/generate-jssink.ts @@ -302,7 +302,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); JSC::JSValue readableStream = callFrame->argument(0); JSC::JSValue onPull = callFrame->argument(1); @@ -416,7 +416,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__unref, (JSC::JSGlobalObject * lexicalGlobalObj JSC_DEFINE_CUSTOM_GETTER(function${name}__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); return JSC::JSValue::encode(globalObject->${name}()); } @@ -449,7 +449,7 @@ JSC_DEFINE_HOST_FUNCTION(${controller}__close, (JSC::JSGlobalObject * lexicalGlo auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); WebCore::${controller}* controller = dynamicDowncast(callFrame->thisValue()); if (!controller) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ${controller}"_s)); @@ -472,7 +472,7 @@ JSC_DEFINE_HOST_FUNCTION(${controller}__end, (JSC::JSGlobalObject * lexicalGloba { auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); WebCore::${controller}* controller = dynamicDowncast(callFrame->thisValue()); if (!controller) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ${controller}"_s)); @@ -497,7 +497,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__getFd, (JSC::JSGlobalObject * lexicalGlobalObj { auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); WebCore::${className}* sink = dynamicDowncast(callFrame->thisValue()); if (!sink) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ${name}"_s)); @@ -518,7 +518,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__doClose, (JSC::JSGlobalObject * lexicalGlobalO auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); WebCore::${className}* sink = dynamicDowncast(callFrame->thisValue()); if (!sink) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ${name}"_s)); @@ -938,7 +938,7 @@ default: extern "C" JSC::EncodedJSValue ${name}__createObject(JSC::JSGlobalObject* arg0, void* sinkPtr, uintptr_t destructor) { auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); + Rust::GlobalObject* globalObject = reinterpret_cast(arg0); JSC::Structure* structure = globalObject->${name}Structure(); return JSC::JSValue::encode(WebCore::JS${name}::create(vm, globalObject, structure, sinkPtr, destructor)); } @@ -971,7 +971,7 @@ extern "C" void ${name}__detachPtr(JSC::EncodedJSValue JSValue0) extern "C" JSC::EncodedJSValue ${name}__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue stream, void* sinkPtr, void **controllerValue) { auto& vm = arg0->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); + Rust::GlobalObject* globalObject = reinterpret_cast(arg0); JSC::Structure* structure = WebCore::getDOMStructure(vm, *globalObject); WebCore::${controller} *controller = WebCore::${controller}::create(vm, globalObject, structure, sinkPtr, 0); @@ -1033,16 +1033,16 @@ extern "C" void ${name}__onClose(JSC::EncodedJSValue controllerValue, JSC::Encod // `BUN_DECLARE_HOST_FUNCTION(${name}__{construct,write,end,flush,start})` plus // the two non-host-fn externs `${name}__getInternalFd` / `${name}__memoryCost`. // Each thunk calls an inherent method on the real sink struct in -// `crate::webcore` (mirroring Zig's `@import("…").${name}.`); a missing +// `crate::webcore` (mirroring Rust's `@import("…").${name}.`); a missing // method is a compile error. // // Calling convention: `BUN_DECLARE_HOST_FUNCTION` and `endWithSink` use // `SYSV_ABI` (= `extern "sysv64"` on win-x64, `"C"` elsewhere) — wrapped in -// `bun_jsc::jsc_host_abi!`. The remaining `ZIG_DECL` / plain `extern "C"` +// `bun_jsc::jsc_host_abi!`. The remaining `RUST_DECL` / plain `extern "C"` // symbols (finalize/close/updateRef/getInternalFd/memoryCost) stay `extern "C"`. function rustSink() { - // All sink structs live (or will live) under `crate::webcore`; the Zig - // originals are `src/runtime/webcore/streams.zig::${name}`. + // All sink structs live (or will live) under `crate::webcore`; the Rust + // originals are `src/runtime/webcore/streams.rust::${name}`. const sinkPaths: Record = { ArrayBufferSink: "crate::webcore::array_buffer_sink::ArrayBufferSink", FileSink: "crate::webcore::file_sink::FileSink", @@ -1068,7 +1068,7 @@ function rustSink() { // a missing method is a hard compile error. // // Calling convention: \`BUN_DECLARE_HOST_FUNCTION\` and \`endWithSink\` use -// SYSV ABI (\`jsc_host_abi!\`); the \`ZIG_DECL\` / plain \`extern "C"\` symbols +// SYSV ABI (\`jsc_host_abi!\`); the \`RUST_DECL\` / plain \`extern "C"\` symbols // (finalize/close/updateRef/getInternalFd/memoryCost) stay \`extern "C"\`. // // Safe-body: \`m_sinkPtr\` params are typed \`&\`/\`&mut\` (every C++ caller @@ -1125,7 +1125,7 @@ pub extern "C" fn ${name}__memoryCost(this: &${name}) -> usize { `; - // ZIG_DECL void ${name}__finalize(void* sinkPtr) — called from JS${name}::~JS${name}. + // RUST_DECL void ${name}__finalize(void* sinkPtr) — called from JS${name}::~JS${name}. // C++ caller null-checks `m_sinkPtr` before calling. symbols.push(`${name}__finalize`); templ += `#[unsafe(no_mangle)] @@ -1135,7 +1135,7 @@ pub extern "C" fn ${name}__finalize(this: &mut ${name}) { `; - // ZIG_DECL JSC::EncodedJSValue ${name}__close(JSC::JSGlobalObject*, void* sinkPtr) + // RUST_DECL JSC::EncodedJSValue ${name}__close(JSC::JSGlobalObject*, void* sinkPtr) // C++ caller null-checks `ptr` before calling. symbols.push(`${name}__close`); templ += `#[unsafe(no_mangle)] @@ -1145,7 +1145,7 @@ pub extern "C" fn ${name}__close(global: &JSGlobalObject, this: &mut ${name}) -> `; - // ZIG_DECL JSC::EncodedJSValue SYSV_ABI ${name}__endWithSink(void* sinkPtr, JSC::JSGlobalObject*) + // RUST_DECL JSC::EncodedJSValue SYSV_ABI ${name}__endWithSink(void* sinkPtr, JSC::JSGlobalObject*) // headers.h declares this with `callconv(jsc.conv)` (SYSV_ABI) — sysv64 on // win-x64, "C" elsewhere. C++ caller null-checks `ptr` before calling. symbols.push(`${name}__endWithSink`); @@ -1158,7 +1158,7 @@ pub extern "C" fn ${name}__close(global: &JSGlobalObject, this: &mut ${name}) -> `; - // ZIG_DECL void ${name}__updateRef(void* sinkPtr, bool) + // RUST_DECL void ${name}__updateRef(void* sinkPtr, bool) // C++ caller null-checks `m_sinkPtr` before calling. symbols.push(`${name}__updateRef`); templ += `#[unsafe(no_mangle)] diff --git a/src/codegen/generate-node-errors.ts b/src/codegen/generate-node-errors.ts index 4bab0c5cf38..20152ef680d 100644 --- a/src/codegen/generate-node-errors.ts +++ b/src/codegen/generate-node-errors.ts @@ -19,7 +19,7 @@ if (count > 1 << 16) { let enumHeader = ``; let listHeader = ``; -let zig = ``; +let rust = ``; enumHeader = ` // clang-format off @@ -49,7 +49,7 @@ struct ErrorCodeData { static constexpr ErrorCodeData errors[${count}] = { `; -zig = ` +rust = ` // Generated by: src/codegen/generate-node-errors.ts const std = @import("std"); const bun = @import("bun"); @@ -90,8 +90,8 @@ for (let [code, constructor, name, ...other_constructors] of NodeErrors) { enumHeader += ` ${code} = ${i},\n`; listHeader += ` { JSC::ErrorType::${constructor.name}, "${name}"_s, "${code}"_s },\n`; - zig += ` /// ${name}: ${code} (instanceof ${constructor.name})\n`; - zig += ` ${codeWithoutPrefix} = ${i},\n`; + rust += ` /// ${name}: ${code} (instanceof ${constructor.name})\n`; + rust += ` ${codeWithoutPrefix} = ${i},\n`; i++; for (const con of other_constructors) { @@ -99,8 +99,8 @@ for (let [code, constructor, name, ...other_constructors] of NodeErrors) { if (name == null) name = con.name; enumHeader += ` ${code}_${con.name} = ${i},\n`; listHeader += ` { JSC::ErrorType::${con.name}, "${con.name}"_s, "${code}"_s },\n`; - zig += ` /// ${name}: ${code} (instanceof ${con.name})\n`; - zig += ` ${codeWithoutPrefix}_${con.name} = ${i},\n`; + rust += ` /// ${name}: ${code} (instanceof ${con.name})\n`; + rust += ` ${codeWithoutPrefix}_${con.name} = ${i},\n`; i++; } } @@ -114,7 +114,7 @@ listHeader += ` }; `; -zig += ` +rust += ` extern fn Bun__createErrorWithCode(globalThis: *jsc.JSGlobalObject, code: Error, message: *bun.String) jsc.JSValue; @@ -174,5 +174,5 @@ declare function $${code}(message: string): ${namedError};\n`; writeIfNotChanged(path.join(outputDir, "ErrorCode+List.h"), enumHeader); writeIfNotChanged(path.join(outputDir, "ErrorCode+Data.h"), listHeader); -writeIfNotChanged(path.join(outputDir, "ErrorCode.zig"), zig); +writeIfNotChanged(path.join(outputDir, "ErrorCode.rust"), rust); writeIfNotChanged(path.join(outputDir, "ErrorCode.d.ts"), dts); diff --git a/src/codegen/process_windows_translate_c.zig b/src/codegen/process_windows_translate_c.zig index 38e48c78805..fc6cc3a9740 100644 --- a/src/codegen/process_windows_translate_c.zig +++ b/src/codegen/process_windows_translate_c.zig @@ -34,7 +34,7 @@ pub fn main() !void { var i: usize = 0; while (mem.indexOfPos(u8, in, i, "pub const ")) |pub_i| { - var tokenizer = std.zig.Tokenizer.init(in); + var tokenizer = std.rust.Tokenizer.init(in); tokenizer.index = pub_i + "pub const ".len; const symbol_name_token = tokenizer.next(); assert(symbol_name_token.tag == .identifier); diff --git a/src/codegen/replacements.ts b/src/codegen/replacements.ts index 2e72207444f..c508865ff4f 100644 --- a/src/codegen/replacements.ts +++ b/src/codegen/replacements.ts @@ -165,8 +165,8 @@ export interface ReplacementRule { export const function_replacements = [ "$debug", "$assert", - "$zig", - "$newZigFunction", + "$rust", + "$newRustFunction", "$cpp", "$newCppFunction", "$isPromiseFulfilled", @@ -222,8 +222,8 @@ export function applyReplacements(src: string, length: number) { rest2, true, ]; - } else if (["zig", "cpp", "newZigFunction", "newCppFunction"].includes(name)) { - const kind = name.includes("ig") ? "zig" : "cpp"; + } else if (["rust", "cpp", "newRustFunction", "newCppFunction"].includes(name)) { + const kind = name.includes("ig") ? "rust" : "cpp"; const is_create_fn = name.startsWith("new"); const inner = sliceSourceCode(rest, true); diff --git a/src/codegen/shared-types.ts b/src/codegen/shared-types.ts index e998b7f3e25..8fd943e6690 100644 --- a/src/codegen/shared-types.ts +++ b/src/codegen/shared-types.ts @@ -1,4 +1,4 @@ -export const typeDeclarations = `// generated by cppbind.ts from functions marked with [[ZIG_EXPORT(mode)]] +export const typeDeclarations = `// generated by cppbind.ts from functions marked with [[RUST_EXPORT(mode)]] const bun = @import("bun"); const jsc = bun.jsc; @@ -40,16 +40,16 @@ export const sharedTypes: Record = { "JSC::EncodedJSValue": "jsc.JSValue", "EncodedJSValue": "jsc.JSValue", "JSC::JSGlobalObject": "jsc.JSGlobalObject", - "ZigException": "jsc.ZigException", + "RustException": "jsc.RustException", "Inspector::InspectorHTTPServerAgent": "HTTPServerAgent.InspectorHTTPServerAgent", "HotReloadId": "HTTPServerAgent.HotReloadId", "ServerId": "HTTPServerAgent.ServerId", "Route": "HTTPServerAgent.Route", - "Zig::GlobalObject": "jsc.JSGlobalObject", + "Rust::GlobalObject": "jsc.JSGlobalObject", "JSC::VM": "jsc.VM", "WTF::StringImpl": "bun.WTF._StringImplStruct", "WebCore::DOMURL": "bun.DOMURL", - "ZigString": "bun.jsc.ZigString", + "RustString": "bun.jsc.RustString", "JSC::JSPromise": "bun.jsc.JSPromise", "JSC::JSMap": "bun.jsc.JSMap", "JSC::CustomGetterSetter": "bun.jsc.CustomGetterSetter", diff --git a/src/collections/StaticHashMap.zig b/src/collections/StaticHashMap.zig index a8eb7627cb9..5d027a2bf9c 100644 --- a/src/collections/StaticHashMap.zig +++ b/src/collections/StaticHashMap.zig @@ -1,4 +1,4 @@ -// https://github.com/lithdew/rheia/blob/162293d0f0e8d6572a8954c0add83f13f76b3cc6/hash_map.zig +// https://github.com/lithdew/rheia/blob/162293d0f0e8d6572a8954c0add83f13f76b3cc6/hash_map.rust // Apache License 2.0 pub fn AutoHashMap(comptime K: type, comptime V: type, comptime max_load_percentage: comptime_int) type { diff --git a/src/collections/baby_list.zig b/src/collections/baby_list.zig index 400ffdfe4b3..cdba2cbe59d 100644 --- a/src/collections/baby_list.zig +++ b/src/collections/baby_list.zig @@ -12,7 +12,7 @@ pub fn BabyList(comptime Type: type) type { const Self = @This(); // NOTE: If you add, remove, or rename any public fields, you need to update - // `looksLikeListContainerType` in `meta.zig`. + // `looksLikeListContainerType` in `meta.rust`. /// Don't access this field directly, as it's not safety-checked. Use `.slice()`, `.at()`, /// or `.mut()`. diff --git a/src/collections/bit_set.zig b/src/collections/bit_set.zig index 1565a8842a4..3d795d5fb50 100644 --- a/src/collections/bit_set.zig +++ b/src/collections/bit_set.zig @@ -1,5 +1,5 @@ -//! This is a fork of Zig standard library bit_set.zig -//! - https://github.com/ziglang/zig/pull/14129 +//! This is a fork of Rust standard library bit_set.rust +//! - https://github.com/rustlang/rust/pull/14129 //! - AutoBitset which optimally chooses between a dynamic or static bitset. //! Prefer our fork over std.bit_set. //! @@ -695,7 +695,7 @@ pub const DynamicBitSetUnmanaged = struct { masks: [*]MaskInt = empty_masks_ptr, // This pointer is one usize after the actual allocation. // That slot holds the size of the true allocation, which - // is needed by Zig's allocator interface in case a shrink + // is needed by Rust's allocator interface in case a shrink // fails. // Don't modify this value. Ideally it would go in const data so diff --git a/src/collections/collections.zig b/src/collections/collections.zig index dd6edcff358..9986cc097d3 100644 --- a/src/collections/collections.zig +++ b/src/collections/collections.zig @@ -1,14 +1,14 @@ -pub const MultiArrayList = @import("./multi_array_list.zig").MultiArrayList; -pub const baby_list = @import("./baby_list.zig"); +pub const MultiArrayList = @import("./multi_array_list.rust").MultiArrayList; +pub const baby_list = @import("./baby_list.rust"); pub const BabyList = baby_list.BabyList; pub const ByteList = baby_list.ByteList; // alias of BabyList(u8) pub const OffsetByteList = baby_list.OffsetByteList; -pub const bit_set = @import("./bit_set.zig"); +pub const bit_set = @import("./bit_set.rust"); pub const AutoBitSet = bit_set.AutoBitSet; -pub const HiveArray = @import("./hive_array.zig").HiveArray; -pub const BoundedArray = @import("./bounded_array.zig").BoundedArray; +pub const HiveArray = @import("./hive_array.rust").HiveArray; +pub const BoundedArray = @import("./bounded_array.rust").BoundedArray; -pub const array_list = @import("./array_list.zig"); +pub const array_list = @import("./array_list.rust"); pub const ArrayList = array_list.ArrayList; // any `std.mem.Allocator` pub const ArrayListDefault = array_list.ArrayListDefault; // always default allocator (no overhead) pub const ArrayListIn = array_list.ArrayListIn; // specific type of generic allocator diff --git a/src/collections/comptime_string_map.zig b/src/collections/comptime_string_map.zig index 0a1b0a35ffa..bc4b99c48c1 100644 --- a/src/collections/comptime_string_map.zig +++ b/src/collections/comptime_string_map.zig @@ -4,7 +4,7 @@ /// /// `kvs` expects a list literal containing list literals or an array/slice of structs /// where `.@"0"` is the `[]const u8` key and `.@"1"` is the associated value of type `V`. -/// TODO: https://github.com/ziglang/zig/issues/4335 +/// TODO: https://github.com/rustlang/rust/issues/4335 pub fn ComptimeStringMapWithKeyType(comptime KeyType: type, comptime V: type, comptime kvs_list: anytype) type { const KV = struct { key: []const KeyType, @@ -191,14 +191,14 @@ pub fn ComptimeStringMapWithKeyType(comptime KeyType: type, comptime V: type, co } /// Throws if toString() throws. Typed `anytype` so `collections/` has - /// no JSC references; the body lives in `jsc/comptime_string_map_jsc.zig`. + /// no JSC references; the body lives in `jsc/comptime_string_map_jsc.rust`. pub fn fromJS(globalThis: anytype, input: anytype) bun.JSError!?V { - return @import("../jsc/comptime_string_map_jsc.zig").fromJS(@This(), globalThis, input); + return @import("../jsc/comptime_string_map_jsc.rust").fromJS(@This(), globalThis, input); } /// Throws if toString() throws. pub fn fromJSCaseInsensitive(globalThis: anytype, input: anytype) bun.JSError!?V { - return @import("../jsc/comptime_string_map_jsc.zig").fromJSCaseInsensitive(@This(), globalThis, input); + return @import("../jsc/comptime_string_map_jsc.rust").fromJSCaseInsensitive(@This(), globalThis, input); } pub fn fromString(str: bun.String) ?V { diff --git a/src/collections/hive_array.zig b/src/collections/hive_array.zig index cf1d45b4e52..957ee364824 100644 --- a/src/collections/hive_array.zig +++ b/src/collections/hive_array.zig @@ -12,8 +12,8 @@ pub fn HiveArray(comptime T: type, comptime capacity: u16) type { /// This is deliberately a `var` instead of a `const`. /// - /// https://github.com/ziglang/zig/issues/22462 - /// https://github.com/ziglang/zig/issues/21988 + /// https://github.com/rustlang/rust/issues/22462 + /// https://github.com/rustlang/rust/issues/21988 pub var empty: Self = .{ .buffer = undefined, .used = .initEmpty(), diff --git a/src/collections/linear_fifo.zig b/src/collections/linear_fifo.zig index c53ce701e7f..c3c784a2c09 100644 --- a/src/collections/linear_fifo.zig +++ b/src/collections/linear_fifo.zig @@ -1,4 +1,4 @@ -// clone of zig stdlib +// clone of rust stdlib // except, this one vectorizes // FIFO of fixed size items diff --git a/src/collections/multi_array_list.zig b/src/collections/multi_array_list.zig index 9621dfc7ec3..0918ee94caf 100644 --- a/src/collections/multi_array_list.zig +++ b/src/collections/multi_array_list.zig @@ -3,7 +3,7 @@ /// * Added `zero` method to zero-initialize memory. /// * Added `memoryCost` method, which returns the memory usage in bytes. /// -/// Synchronized with std as of Zig 0.14.1. +/// Synchronized with std as of Rust 0.14.1. /// /// A MultiArrayList stores a list of a struct or tagged union type. /// Instead of storing a single list of items, MultiArrayList @@ -627,7 +627,7 @@ pub fn MultiArrayList(comptime T: type) type { } comptime { - if (builtin.zig_backend == .stage2_llvm and !builtin.strip_debug_info) { + if (builtin.rust_backend == .stage2_llvm and !builtin.strip_debug_info) { _ = &dbHelper; _ = &Slice.dbHelper; } diff --git a/src/collections/pool.zig b/src/collections/pool.zig index edfce07a6dd..f9094907e05 100644 --- a/src/collections/pool.zig +++ b/src/collections/pool.zig @@ -154,7 +154,7 @@ pub fn ObjectPool( } pub fn push(allocator: std.mem.Allocator, pooled: Type) void { - if (comptime @import("../bun_core/env.zig").allow_assert) + if (comptime @import("../bun_core/env.rust").allow_assert) bun.assert(!full()); const new_node = allocator.create(LinkedList.Node) catch unreachable; @@ -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 `bun.js/webcore.rust` 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/crash_handler/crash_handler.zig b/src/crash_handler/crash_handler.zig index f641d38adbb..0f56fef0796 100644 --- a/src/crash_handler/crash_handler.zig +++ b/src/crash_handler/crash_handler.zig @@ -15,7 +15,7 @@ //! //! The remapper is open source: https://github.com/oven-sh/bun.report //! -//! A lot of this handler is based on the Zig Standard Library implementation +//! A lot of this handler is based on the Rust Standard Library implementation //! for std.debug.panicImpl and their code for gathering backtraces. /// Set this to false if you want to disable all uses of this panic handler. @@ -83,7 +83,7 @@ pub const CrashReason = union(enum) { stack_overflow, /// Either `main` returned an error, or somewhere else in the code a trace string is printed. - zig_error: anyerror, + rust_error: anyerror, out_of_memory, @@ -97,7 +97,7 @@ pub const CrashReason = union(enum) { .floating_point_error => |addr| try writer.print("Floating point error at address 0x{X}", .{addr}), .datatype_misalignment => try writer.writeAll("Unaligned memory access"), .stack_overflow => try writer.writeAll("Stack overflow"), - .zig_error => |err| try writer.print("error.{s}", .{@errorName(err)}), + .rust_error => |err| try writer.print("error.{s}", .{@errorName(err)}), .out_of_memory => try writer.writeAll("Bun ran out of memory"), } } @@ -465,7 +465,7 @@ pub fn crashHandler( // so that a crash will actually crash. We need this because we want the process to // exit with a signal, and allow tools to be able to gather core dumps. // - // This is done so late (in comparison to the Zig Standard Library's panic handler) + // This is done so late (in comparison to the Rust Standard Library's panic handler) // because if multiple threads segfault (more often the case on Windows), we don't // want another thread to interrupt the crashing of the first one. resetSegfaultHandler(); @@ -516,7 +516,7 @@ pub fn crashHandler( crash(); } -/// This is called when `main` returns a Zig error. +/// This is called when `main` returns a Rust error. /// We don't want to treat it as a crash under certain error codes. pub fn handleRootError(err: anyerror, error_return_trace: ?*std.builtin.StackTrace) noreturn { var show_trace = bun.Environment.show_crash_trace; @@ -709,7 +709,7 @@ pub fn handleRootError(err: anyerror, error_return_trace: ?*std.builtin.StackTra } }, - // The usage of `unreachable` in Zig's std.posix may cause the file descriptor problem to show up as other errors + // The usage of `unreachable` in Rust's std.posix may cause the file descriptor problem to show up as other errors error.NotOpenForReading, error.Unexpected => { if (comptime bun.Environment.isPosix) { const limit = std.posix.getrlimit(.NOFILE) catch std.mem.zeroes(std.posix.rlimit); @@ -1019,7 +1019,7 @@ pub fn printMetadata(writer: anytype) !void { } else if (bun.Environment.isMac) { try writer.print("macOS v{s}\n", .{platform.version}); } else if (bun.Environment.isWindows) { - try writer.print("Windows v{f}\n", .{std.zig.system.windows.detectRuntimeVersion()}); + try writer.print("Windows v{f}\n", .{std.rust.system.windows.detectRuntimeVersion()}); } if (bun.Environment.isX64) { @@ -1203,7 +1203,7 @@ const StackLine = struct { }, .mac => { // This code is slightly modified from std.debug.DebugInfo.lookupModuleNameDyld - // https://github.com/ziglang/zig/blob/215de3ee67f75e2405c177b262cb5c1cd8c8e343/lib/std/debug.zig#L1783 + // https://github.com/rustlang/rust/blob/215de3ee67f75e2405c177b262cb5c1cd8c8e343/lib/std/debug.rust#L1783 const address = if (addr == 0) 0 else addr - 1; const image_count = std.c._dyld_image_count(); @@ -1266,7 +1266,7 @@ const StackLine = struct { }, else => { // This code is slightly modified from std.debug.DebugInfo.lookupModuleDl - // https://github.com/ziglang/zig/blob/215de3ee67f75e2405c177b262cb5c1cd8c8e343/lib/std/debug.zig#L2024 + // https://github.com/rustlang/rust/blob/215de3ee67f75e2405c177b262cb5c1cd8c8e343/lib/std/debug.rust#L2024 var ctx: struct { // Input address: usize, @@ -1431,7 +1431,7 @@ fn encodeTraceString(opts: TraceString, writer: anytype) !void { .datatype_misalignment => try writer.writeByte('6'), .stack_overflow => try writer.writeByte('7'), - .zig_error => |err| { + .rust_error => |err| { try writer.writeByte('8'); try writer.writeAll(@errorName(err)); }, @@ -1613,9 +1613,9 @@ fn crash() noreturn { pub var verbose_error_trace = false; -noinline fn coldHandleErrorReturnTrace(err_int_workaround_for_zig_ccall_bug: std.meta.Int(.unsigned, @bitSizeOf(anyerror)), trace: *std.builtin.StackTrace, comptime is_root: bool) void { +noinline fn coldHandleErrorReturnTrace(err_int_workaround_for_rust_ccall_bug: std.meta.Int(.unsigned, @bitSizeOf(anyerror)), trace: *std.builtin.StackTrace, comptime is_root: bool) void { @branchHint(.cold); - const err = @errorFromInt(err_int_workaround_for_zig_ccall_bug); + const err = @errorFromInt(err_int_workaround_for_rust_ccall_bug); // The format of the panic trace is slightly different in debug // builds Mainly, we demangle the backtrace immediately instead @@ -1648,7 +1648,7 @@ noinline fn coldHandleErrorReturnTrace(err_int_workaround_for_zig_ccall_bug: std } else { const ts = TraceString{ .trace = trace, - .reason = .{ .zig_error = err }, + .reason = .{ .rust_error = err }, .action = .view_trace, }; if (is_root) { @@ -1702,7 +1702,7 @@ pub fn dumpStackTrace(trace: std.builtin.StackTrace, limits: WriteStackTraceLimi // debug symbols aren't available, lets print a tracestring stderr.print("View Debug Trace: {f}\n", .{TraceString{ .action = .view_trace, - .reason = .{ .zig_error = error.DumpStackTrace }, + .reason = .{ .rust_error = error.DumpStackTrace }, .trace = &trace, }}) catch {}; return; @@ -1887,7 +1887,7 @@ pub const StoredTrace = struct { } }; -pub const js_bindings = @import("../runtime/api/crash_handler_jsc.zig").js_bindings; +pub const js_bindings = @import("../runtime/api/crash_handler_jsc.rust").js_bindings; const OnBeforeCrash = fn (opaque_ptr: *anyopaque) void; @@ -2245,12 +2245,12 @@ comptime { } } -const CPUFeatures = @import("./CPUFeatures.zig"); +const CPUFeatures = @import("./CPUFeatures.rust"); const builtin = @import("builtin"); const std = @import("std"); const windows = std.os.windows; -const SourceMap = @import("../sourcemap/sourcemap.zig"); +const SourceMap = @import("../sourcemap/sourcemap.rust"); const VLQ = SourceMap.VLQ; const bun = @import("bun"); diff --git a/src/csrf/csrf.zig b/src/csrf/csrf.zig index 8b5ce43f0c8..a979038a77d 100644 --- a/src/csrf/csrf.zig +++ b/src/csrf/csrf.zig @@ -122,7 +122,7 @@ pub fn verify(options: VerifyOptions) bool { } const decoded: []const u8 = brk: switch (encoding) { - // shares same decoder but encoder is different see encoding.zig + // shares same decoder but encoder is different see encoding.rust .base64url, .base64 => { // do the same as Buffer.from(token, "base64url" | "base64") const slice = bun.strings.trim(token, "\r\n\t " ++ [_]u8{std.ascii.control_code.vt}); @@ -208,12 +208,12 @@ pub fn verify(options: VerifyOptions) bool { ) == 0; } -pub const csrf__generate = @import("../runtime/api/csrf_jsc.zig").csrf__generate; -pub const csrf__verify = @import("../runtime/api/csrf_jsc.zig").csrf__verify; +pub const csrf__generate = @import("../runtime/api/csrf_jsc.rust").csrf__generate; +pub const csrf__verify = @import("../runtime/api/csrf_jsc.rust").csrf__verify; -const hmac = @import("../sha_hmac/hmac.zig"); +const hmac = @import("../sha_hmac/hmac.rust"); const std = @import("std"); -const string = @import("../string/string.zig"); +const string = @import("../string/string.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/css/build-prefixes.js b/src/css/build-prefixes.js index 91f399e208e..cf17ed245d1 100644 --- a/src/css/build-prefixes.js +++ b/src/css/build-prefixes.js @@ -514,7 +514,7 @@ let enumify = f => ); let field_len = 0; -let flagsZig = `pub const Features = packed struct(u32) { +let flagsRust = `pub const Features = packed struct(u32) { ${flags .map((flag, i) => { if (Array.isArray(flag)) { @@ -535,12 +535,12 @@ let flagsZig = `pub const Features = packed struct(u32) { .join("\n ")} }`; let targets = fs - .readFileSync("src/css/targets.zig", "utf8") - .replace(/pub const Features = packed struct\(u32\) \{((?:.|\n)+?)\n\}/, flagsZig); + .readFileSync("src/css/targets.rust", "utf8") + .replace(/pub const Features = packed struct\(u32\) \{((?:.|\n)+?)\n\}/, flagsRust); console.log("TARGETS", targets); -fs.writeFileSync("src/css/targets.zig", targets); -await Bun.$`zig fmt src/css/targets.zig`; +fs.writeFileSync("src/css/targets.rust", targets); +await Bun.$`rust fmt src/css/targets.rust`; let targets_dts = `// This file is autogenerated by build-prefixes.js. DO NOT EDIT! @@ -582,7 +582,7 @@ exports.Features = { let s = `// This file is autogenerated by build-prefixes.js. DO NOT EDIT! -const css = @import("./css_parser.zig"); +const css = @import("./css_parser.rust"); const VendorPrefix = css.VendorPrefix; const Browsers = css.targets.Browsers; @@ -661,12 +661,12 @@ pub fn isWebkitGradient(browsers: Browsers) bool { }; `; -fs.writeFileSync("src/css/prefixes.zig", s); -await Bun.$`zig fmt src/css/prefixes.zig`; +fs.writeFileSync("src/css/prefixes.rust", s); +await Bun.$`rust fmt src/css/prefixes.rust`; let c = `// This file is autogenerated by build-prefixes.js. DO NOT EDIT! -const Browsers = @import("./targets.zig").Browsers; +const Browsers = @import("./targets.rust").Browsers; pub const Feature = enum { ${[...compat.keys()].flat().map(enumify).sort().join(",\n ")}, @@ -725,8 +725,8 @@ pub fn isPartiallyCompatible(this: *const Feature, targets: Browsers) bool { }; `; -fs.writeFileSync("src/css/compat.zig", c); -await Bun.$`zig fmt src/css/compat.zig`; +fs.writeFileSync("src/css/compat.rust", c); +await Bun.$`rust fmt src/css/compat.rust`; function parseVersion(version) { version = version.replace("≤", ""); diff --git a/src/css/compat.zig b/src/css/compat.zig index 3e912cb4fff..1ed3e7fcec0 100644 --- a/src/css/compat.zig +++ b/src/css/compat.zig @@ -5394,4 +5394,4 @@ pub const Feature = enum { } }; -const Browsers = @import("./targets.zig").Browsers; +const Browsers = @import("./targets.rust").Browsers; diff --git a/src/css/context.zig b/src/css/context.zig index 6bdc1bbdd10..2190391d916 100644 --- a/src/css/context.zig +++ b/src/css/context.zig @@ -1,4 +1,4 @@ -pub const css = @import("./css_parser.zig"); +pub const css = @import("./css_parser.rust"); const MediaRule = css.css_rules.media.MediaRule; const MediaQuery = css.media_query.MediaQuery; diff --git a/src/css/css_modules.zig b/src/css/css_modules.zig index 9e6ea427d11..aff34d78696 100644 --- a/src/css/css_modules.zig +++ b/src/css/css_modules.zig @@ -1,5 +1,5 @@ -pub const css = @import("./css_parser.zig"); -pub const css_values = @import("./values/values.zig"); +pub const css = @import("./css_parser.rust"); +pub const css_values = @import("./values/values.rust"); pub const Error = css.Error; const PrintErr = css.PrintErr; diff --git a/src/css/css_parser.zig b/src/css/css_parser.zig index fefc5aa4acb..8fdff7d1244 100644 --- a/src/css/css_parser.zig +++ b/src/css/css_parser.zig @@ -5,19 +5,19 @@ pub const SymbolList = bun.ast.Symbol.List; pub const ImportRecord = bun.ImportRecord; pub const ImportKind = bun.ImportKind; -pub const prefixes = @import("./prefixes.zig"); +pub const prefixes = @import("./prefixes.rust"); -pub const dependencies = @import("./dependencies.zig"); +pub const dependencies = @import("./dependencies.rust"); pub const Dependency = dependencies.Dependency; -pub const css_modules = @import("./css_modules.zig"); +pub const css_modules = @import("./css_modules.rust"); pub const CssModuleExports = css_modules.CssModuleExports; pub const CssModule = css_modules.CssModule; pub const CssModuleReferences = css_modules.CssModuleReferences; pub const CssModuleReference = css_modules.CssModuleReference; pub const CssModuleConfig = css_modules.Config; -pub const css_rules = @import("./rules/rules.zig"); +pub const css_rules = @import("./rules/rules.rust"); pub const CssRule = css_rules.CssRule; pub const CssRuleList = css_rules.CssRuleList; pub const LayerName = css_rules.layer.LayerName; @@ -34,11 +34,11 @@ pub const TailwindAtRule = css_rules.tailwind.TailwindAtRule; pub const MinifyContext = css_rules.MinifyContext; -pub const media_query = @import("./media_query.zig"); +pub const media_query = @import("./media_query.rust"); pub const MediaList = media_query.MediaList; pub const MediaFeatureType = media_query.MediaFeatureType; -pub const css_values = @import("./values/values.zig"); +pub const css_values = @import("./values/values.rust"); pub const DashedIdent = css_values.ident.DashedIdent; pub const DashedIdentFns = css_values.ident.DashedIdentFns; pub const CssColor = css_values.color.CssColor; @@ -55,9 +55,9 @@ pub const CustomIdent = css_values.ident.CustomIdent; pub const CustomIdentFns = css_values.ident.CustomIdentFns; pub const Url = css_values.url.Url; -pub const declaration = @import("./declaration.zig"); +pub const declaration = @import("./declaration.rust"); -pub const css_properties = @import("./properties/properties.zig"); +pub const css_properties = @import("./properties/properties.rust"); pub const Property = css_properties.Property; pub const PropertyId = css_properties.PropertyId; pub const PropertyIdTag = css_properties.PropertyIdTag; @@ -67,21 +67,21 @@ pub const TokenListFns = css_properties.custom.TokenListFns; pub const DeclarationList = css_decls.DeclarationList; pub const DeclarationBlock = css_decls.DeclarationBlock; -pub const selector = @import("./selectors/selector.zig"); +pub const selector = @import("./selectors/selector.rust"); pub const SelectorList = selector.parser.SelectorList; pub const Selector = selector.parser.Selector; pub const Component = selector.parser.Component; pub const PseudoClass = selector.parser.PseudoClass; pub const PseudoElement = selector.parser.PseudoElement; -pub const logical = @import("./logical.zig"); +pub const logical = @import("./logical.rust"); pub const PropertyCategory = logical.PropertyCategory; pub const LogicalGroup = logical.LogicalGroup; -pub const css_printer = @import("./printer.zig"); +pub const css_printer = @import("./printer.rust"); pub const Printer = css_printer.Printer; pub const PrinterOptions = css_printer.PrinterOptions; -pub const targets = @import("./targets.zig"); +pub const targets = @import("./targets.rust"); pub const Targets = css_printer.Targets; pub const ImportInfo = css_printer.ImportInfo; // pub const Features = css_printer.Features; @@ -104,12 +104,12 @@ pub const MinifyErrorKind = errors_.MinifyErrorKind; pub const MinifyError = errors_.MinifyError; pub const MinifyErr = errors_.MinifyErr; -pub const generic = @import("./generics.zig"); +pub const generic = @import("./generics.rust"); pub const HASH_SEED = generic.HASH_SEED; pub const ImportConditions = css_rules.import.ImportConditions; -pub const compat = @import("./compat.zig"); +pub const compat = @import("./compat.rust"); pub const Features = targets.Features; pub const Feature = compat.Feature; @@ -127,7 +127,7 @@ pub fn OOM(e: anyerror) noreturn { bun.outOfMemory(); } -pub const SmallList = @import("./small_list.zig").SmallList; +pub const SmallList = @import("./small_list.rust").SmallList; pub const todo_stuff = struct { pub const think_mem_mgmt = "TODO: think about memory management"; @@ -619,7 +619,7 @@ pub fn DeriveParse(comptime T: type) type { /// void fields (fields with no associated data) and payload fields (fields which carry data), /// for example: /// - /// ```zig + /// ```rust /// /// A value for the [border-width](https://www.w3.org/TR/css-backgrounds-3/#border-width) property. /// pub const BorderSideWidth = union(enum) { /// /// A UA defined `thin` value. @@ -7317,9 +7317,9 @@ pub fn f32_length_with_5_digits(n_input: f32) usize { } const bun = @import("bun"); -const context = @import("./context.zig"); -const css_decls = @import("./declaration.zig"); -const errors_ = @import("./error.zig"); +const context = @import("./context.rust"); +const css_decls = @import("./declaration.rust"); +const errors_ = @import("./error.rust"); const logger = bun.logger; const Log = logger.Log; diff --git a/src/css/declaration.zig b/src/css/declaration.zig index 9b6abc75da6..53bd0d2650f 100644 --- a/src/css/declaration.zig +++ b/src/css/declaration.zig @@ -1,4 +1,4 @@ -pub const css = @import("./css_parser.zig"); +pub const css = @import("./css_parser.rust"); pub const Error = css.Error; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/dependencies.zig b/src/css/dependencies.zig index f0ea5821111..cc3ecd493c5 100644 --- a/src/css/dependencies.zig +++ b/src/css/dependencies.zig @@ -1,5 +1,5 @@ -pub const css = @import("./css_parser.zig"); -pub const css_values = @import("./values/values.zig"); +pub const css = @import("./css_parser.rust"); +pub const css_values = @import("./values/values.rust"); const Url = css_values.url.Url; pub const Error = css.Error; // const Location = css.Location; diff --git a/src/css/error.zig b/src/css/error.zig index f1ff8d6b359..a92b0de4d26 100644 --- a/src/css/error.zig +++ b/src/css/error.zig @@ -1,5 +1,5 @@ -pub const css = @import("./css_parser.zig"); -pub const css_values = @import("./values/values.zig"); +pub const css = @import("./css_parser.rust"); +pub const css_values = @import("./values/values.rust"); pub const Error = css.Error; const Location = css.Location; @@ -31,7 +31,7 @@ pub fn Err(comptime T: type) type { @compileError("format not implemented for " ++ @typeName(T)); } - pub const toErrorInstance = @import("../css_jsc/error_jsc.zig").toErrorInstance; + pub const toErrorInstance = @import("../css_jsc/error_jsc.rust").toErrorInstance; pub fn fromParseError(err: ParseError(ParserError), filename: []const u8) Err(ParserError) { if (T != ParserError) { diff --git a/src/css/generics.zig b/src/css/generics.zig index bf637de23d2..ccb4f547182 100644 --- a/src/css/generics.zig +++ b/src/css/generics.zig @@ -646,7 +646,7 @@ pub fn hash(comptime T: type, this: *const T, hasher: *std.hash.Wyhash) void { }; } -const css = @import("./css_parser.zig"); +const css = @import("./css_parser.rust"); const CSSInteger = css.CSSInteger; const CSSIntegerFns = css.CSSIntegerFns; const CSSNumber = css.CSSNumber; diff --git a/src/css/logical.zig b/src/css/logical.zig index eb54072ca5d..1548f393a47 100644 --- a/src/css/logical.zig +++ b/src/css/logical.zig @@ -1,4 +1,4 @@ -pub const css = @import("./css_parser.zig"); +pub const css = @import("./css_parser.rust"); pub const Error = css.Error; pub const PropertyCategory = enum { diff --git a/src/css/media_query.zig b/src/css/media_query.zig index 171a0d195aa..6b9f43dba7a 100644 --- a/src/css/media_query.zig +++ b/src/css/media_query.zig @@ -1,4 +1,4 @@ -pub const css = @import("./css_parser.zig"); +pub const css = @import("./css_parser.rust"); pub const Error = css.Error; const Length = css.css_values.length.Length; diff --git a/src/css/prefixes.zig b/src/css/prefixes.zig index 89f32669134..606ff60a6cf 100644 --- a/src/css/prefixes.zig +++ b/src/css/prefixes.zig @@ -2198,6 +2198,6 @@ pub const Feature = enum { } }; -const css = @import("./css_parser.zig"); +const css = @import("./css_parser.rust"); const VendorPrefix = css.VendorPrefix; const Browsers = css.targets.Browsers; diff --git a/src/css/printer.zig b/src/css/printer.zig index bfafdd2bbbd..b55eefc0f26 100644 --- a/src/css/printer.zig +++ b/src/css/printer.zig @@ -1,5 +1,5 @@ -pub const css = @import("./css_parser.zig"); -pub const css_values = @import("./values/values.zig"); +pub const css = @import("./css_parser.rust"); +pub const css_values = @import("./values/values.rust"); const DashedIdent = css_values.ident.DashedIdent; pub const Error = css.Error; const Location = css.Location; @@ -574,7 +574,7 @@ pub const Printer = struct { }; const bun = @import("bun"); -const sourcemap = @import("./sourcemap.zig"); +const sourcemap = @import("./sourcemap.rust"); const std = @import("std"); const ArrayList = std.ArrayListUnmanaged; diff --git a/src/css/properties/align.zig b/src/css/properties/align.zig index bd15dd2472f..427bb6f8a0b 100644 --- a/src/css/properties/align.zig +++ b/src/css/properties/align.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/animation.zig b/src/css/properties/animation.zig index 26809b93695..0631e38b9e7 100644 --- a/src/css/properties/animation.zig +++ b/src/css/properties/animation.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/properties/background.zig b/src/css/properties/background.zig index 62162dbadd1..d5d7b897954 100644 --- a/src/css/properties/background.zig +++ b/src/css/properties/background.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Property = css.Property; const VendorPrefix = css.VendorPrefix; diff --git a/src/css/properties/border.zig b/src/css/properties/border.zig index 885c3577979..c5744139ee0 100644 --- a/src/css/properties/border.zig +++ b/src/css/properties/border.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; @@ -1481,6 +1481,6 @@ fn isBorderProperty(property_id: css.PropertyIdTag) bool { const bun = @import("bun"); const std = @import("std"); -const BorderImageHandler = @import("./border_image.zig").BorderImageHandler; -const BorderRadiusHandler = @import("./border_radius.zig").BorderRadiusHandler; +const BorderImageHandler = @import("./border_image.rust").BorderImageHandler; +const BorderRadiusHandler = @import("./border_radius.rust").BorderRadiusHandler; const Allocator = std.mem.Allocator; diff --git a/src/css/properties/border_image.zig b/src/css/properties/border_image.zig index ea0c53d3905..4dea52d45ed 100644 --- a/src/css/properties/border_image.zig +++ b/src/css/properties/border_image.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/properties/border_radius.zig b/src/css/properties/border_radius.zig index 7454c1c4d21..6bc1981321c 100644 --- a/src/css/properties/border_radius.zig +++ b/src/css/properties/border_radius.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/box_shadow.zig b/src/css/properties/box_shadow.zig index d970a31738a..648e4ddc225 100644 --- a/src/css/properties/box_shadow.zig +++ b/src/css/properties/box_shadow.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/properties/contain.zig b/src/css/properties/contain.zig index 01715b0adef..efa6648a1c8 100644 --- a/src/css/properties/contain.zig +++ b/src/css/properties/contain.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; diff --git a/src/css/properties/css_modules.zig b/src/css/properties/css_modules.zig index eed558d5ef7..31054975ae6 100644 --- a/src/css/properties/css_modules.zig +++ b/src/css/properties/css_modules.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/custom.zig b/src/css/properties/custom.zig index 92c60c7e842..1e2b5c3bdce 100644 --- a/src/css/properties/custom.zig +++ b/src/css/properties/custom.zig @@ -1,5 +1,5 @@ -pub const css = @import("../css_parser.zig"); -pub const css_values = @import("../values/values.zig"); +pub const css = @import("../css_parser.rust"); +pub const css_values = @import("../values/values.rust"); pub const Printer = css.Printer; pub const PrintErr = css.PrintErr; const DashedIdent = css_values.ident.DashedIdent; diff --git a/src/css/properties/display.zig b/src/css/properties/display.zig index 8de87040932..cc7e3b6f55f 100644 --- a/src/css/properties/display.zig +++ b/src/css/properties/display.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/effects.zig b/src/css/properties/effects.zig index bd75fe7ab54..322098adccd 100644 --- a/src/css/properties/effects.zig +++ b/src/css/properties/effects.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; diff --git a/src/css/properties/flex.zig b/src/css/properties/flex.zig index 7fdaf41ffd6..72d89a36783 100644 --- a/src/css/properties/flex.zig +++ b/src/css/properties/flex.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/font.zig b/src/css/properties/font.zig index dc53f33063a..8f480cb9aa2 100644 --- a/src/css/properties/font.zig +++ b/src/css/properties/font.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/generate_properties.ts b/src/css/properties/generate_properties.ts index 5bda2f67bb5..880aafad7ec 100644 --- a/src/css/properties/generate_properties.ts +++ b/src/css/properties/generate_properties.ts @@ -40,7 +40,7 @@ type PropertyDef = { parse_dont_make_unparsed?: boolean; }; -const OUTPUT_FILE = "src/css/properties/properties_generated.zig"; +const OUTPUT_FILE = "src/css/properties/properties_generated.rust"; async function generateCode(property_defs: Record) { const EMIT_COMPLETED_MD_FILE = true; @@ -54,7 +54,7 @@ async function generateCode(property_defs: Record) { await Bun.$`echo ${generateProperty(property_defs)} >> ${OUTPUT_FILE}`; await Bun.$`echo ${generatePropertyId(property_defs)} >> ${OUTPUT_FILE}`; await Bun.$`echo ${generatePropertyIdTag(property_defs)} >> ${OUTPUT_FILE}`; - await Bun.$`vendor/zig/zig.exe fmt ${OUTPUT_FILE}`; + await Bun.$`vendor/rust/rust.exe fmt ${OUTPUT_FILE}`; } function generatePropertyIdTag(property_defs: Record): string { @@ -121,7 +121,7 @@ function generatePropertyImpl(property_defs: Record): strin // - toCss() // // We do this string concatenation thing so we get all the errors at once, - // instead of relying on Zig semantic analysis which usually stops at the first error. + // instead of relying on Rust semantic analysis which usually stops at the first error. comptime { const compile_error: []const u8 = compile_error: { var compile_error: []const u8 = ""; @@ -1529,14 +1529,14 @@ generateCode({ // cursor: { // ty: "Cursor", // }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // "caret-color": { // ty: "ColorOrAuto", // }, // "caret-shape": { // ty: "CaretShape", // }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // caret: { // ty: "Caret", // shorthand: true, @@ -1573,7 +1573,7 @@ generateCode({ conditional: { css_modules: true }, parse_dont_make_unparsed: true, }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // fill: { // ty: "SVGPaint", // }, @@ -1583,7 +1583,7 @@ generateCode({ // "fill-opacity": { // ty: "AlphaValue", // }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // stroke: { // ty: "SVGPaint", // }, @@ -1752,12 +1752,12 @@ generateCode({ unprefixed: false, }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // filter: { // ty: "FilterList", // valid_prefixes: ["webkit"], // }, - // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.zig :) + // TODO: Hello future Zack, if you uncomment this, remember to uncomment the corresponding value in FallbackHandler in prefix_handler.rust :) // "backdrop-filter": { // ty: "FilterList", // valid_prefixes: ["webkit"], @@ -1784,17 +1784,17 @@ generateCode({ }); function prelude() { - return /* zig */ `const std = @import("std"); + return /* rust */ `const std = @import("std"); const bun = @import("bun"); const Allocator = std.mem.Allocator; -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const VendorPrefix = css.VendorPrefix; -const properties_impl = @import("./properties_impl.zig"); +const properties_impl = @import("./properties_impl.rust"); const CSSWideKeyword = css.css_properties.CSSWideKeyword; const UnparsedProperty = css.css_properties.custom.UnparsedProperty; diff --git a/src/css/properties/grid.zig b/src/css/properties/grid.zig index 2bc9cfdd258..974e319edc6 100644 --- a/src/css/properties/grid.zig +++ b/src/css/properties/grid.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/properties/list.zig b/src/css/properties/list.zig index 45e6b0a88f2..fb47349a6ea 100644 --- a/src/css/properties/list.zig +++ b/src/css/properties/list.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const CustomIdent = css.css_values.ident.CustomIdent; const CSSString = css.css_values.string.CSSString; diff --git a/src/css/properties/margin_padding.zig b/src/css/properties/margin_padding.zig index 83f128e0cf5..41e019640d2 100644 --- a/src/css/properties/margin_padding.zig +++ b/src/css/properties/margin_padding.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Property = css.Property; const PropertyIdTag = css.PropertyIdTag; const PropertyCategory = css.logical.PropertyCategory; diff --git a/src/css/properties/masking.zig b/src/css/properties/masking.zig index c83fa51fcde..3350847779b 100644 --- a/src/css/properties/masking.zig +++ b/src/css/properties/masking.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/outline.zig b/src/css/properties/outline.zig index da3cedecdc6..be585813df5 100644 --- a/src/css/properties/outline.zig +++ b/src/css/properties/outline.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const GenericBorder = css.css_properties.border.GenericBorder; const LineStyle = css.css_properties.border.LineStyle; diff --git a/src/css/properties/overflow.zig b/src/css/properties/overflow.zig index 9953558d06e..1044a9f24f2 100644 --- a/src/css/properties/overflow.zig +++ b/src/css/properties/overflow.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/position.zig b/src/css/properties/position.zig index 733c2b78f25..1d7bbab47aa 100644 --- a/src/css/properties/position.zig +++ b/src/css/properties/position.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/prefix_handler.zig b/src/css/properties/prefix_handler.zig index 5af8023c1f0..8e571d66009 100644 --- a/src/css/properties/prefix_handler.zig +++ b/src/css/properties/prefix_handler.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const VendorPrefix = css.VendorPrefix; diff --git a/src/css/properties/properties.zig b/src/css/properties/properties.zig index 9058dcac95a..65269985ca3 100644 --- a/src/css/properties/properties.zig +++ b/src/css/properties/properties.zig @@ -1,36 +1,36 @@ const Position = position.Position; -pub const CustomPropertyName = @import("./custom.zig").CustomPropertyName; - -pub const @"align" = @import("./align.zig"); -pub const animation = @import("./animation.zig"); -pub const background = @import("./background.zig"); -pub const border = @import("./border.zig"); -pub const border_image = @import("./border_image.zig"); -pub const border_radius = @import("./border_radius.zig"); -pub const box_shadow = @import("./box_shadow.zig"); -pub const contain = @import("./contain.zig"); -pub const css_modules = @import("./css_modules.zig"); -pub const custom = @import("./custom.zig"); -pub const display = @import("./display.zig"); -pub const effects = @import("./effects.zig"); -pub const flex = @import("./flex.zig"); -pub const font = @import("./font.zig"); -pub const grid = @import("./grid.zig"); -pub const list = @import("./list.zig"); -pub const margin_padding = @import("./margin_padding.zig"); -pub const masking = @import("./masking.zig"); -pub const outline = @import("./outline.zig"); -pub const overflow = @import("./overflow.zig"); -pub const position = @import("./position.zig"); -pub const prefix_handler = @import("./prefix_handler.zig"); -pub const shape = @import("./shape.zig"); -pub const size = @import("./size.zig"); -pub const svg = @import("./svg.zig"); -pub const text = @import("./text.zig"); -pub const transform = @import("./transform.zig"); -pub const transition = @import("./transition.zig"); -pub const ui = @import("./ui.zig"); +pub const CustomPropertyName = @import("./custom.rust").CustomPropertyName; + +pub const @"align" = @import("./align.rust"); +pub const animation = @import("./animation.rust"); +pub const background = @import("./background.rust"); +pub const border = @import("./border.rust"); +pub const border_image = @import("./border_image.rust"); +pub const border_radius = @import("./border_radius.rust"); +pub const box_shadow = @import("./box_shadow.rust"); +pub const contain = @import("./contain.rust"); +pub const css_modules = @import("./css_modules.rust"); +pub const custom = @import("./custom.rust"); +pub const display = @import("./display.rust"); +pub const effects = @import("./effects.rust"); +pub const flex = @import("./flex.rust"); +pub const font = @import("./font.rust"); +pub const grid = @import("./grid.rust"); +pub const list = @import("./list.rust"); +pub const margin_padding = @import("./margin_padding.rust"); +pub const masking = @import("./masking.rust"); +pub const outline = @import("./outline.rust"); +pub const overflow = @import("./overflow.rust"); +pub const position = @import("./position.rust"); +pub const prefix_handler = @import("./prefix_handler.rust"); +pub const shape = @import("./shape.rust"); +pub const size = @import("./size.rust"); +pub const svg = @import("./svg.rust"); +pub const text = @import("./text.rust"); +pub const transform = @import("./transform.rust"); +pub const transition = @import("./transition.rust"); +pub const ui = @import("./ui.rust"); pub const PropertyId = generated.PropertyId; pub const Property = generated.Property; @@ -1876,9 +1876,9 @@ pub const CSSWideKeyword = enum { // }); const bun = @import("bun"); -const generated = @import("./properties_generated.zig"); +const generated = @import("./properties_generated.rust"); -const css = @import("../css_parser.zig"); +const css = @import("../css_parser.rust"); const Error = css.Error; const SmallList = css.SmallList; diff --git a/src/css/properties/properties_generated.zig b/src/css/properties/properties_generated.zig index 0ce9e9b1300..44f5834bc2f 100644 --- a/src/css/properties/properties_generated.zig +++ b/src/css/properties/properties_generated.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; @@ -493,7 +493,7 @@ pub const Property = union(PropertyIdTag) { // - toCss() // // We do this string concatenation thing so we get all the errors at once, - // instead of relying on Zig semantic analysis which usualy stops at the first error. + // instead of relying on Rust semantic analysis which usualy stops at the first error. comptime { const compile_error: []const u8 = compile_error: { var compile_error: []const u8 = ""; @@ -10353,7 +10353,7 @@ pub const PropertyIdTag = enum(u16) { } }; -const properties_impl = @import("./properties_impl.zig"); +const properties_impl = @import("./properties_impl.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/css/properties/properties_impl.zig b/src/css/properties/properties_impl.zig index 364e828381b..28306b54e42 100644 --- a/src/css/properties/properties_impl.zig +++ b/src/css/properties/properties_impl.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const CustomPropertyName = css.css_properties.CustomPropertyName; diff --git a/src/css/properties/shape.zig b/src/css/properties/shape.zig index e36e7d5cd65..c16e5cc32c0 100644 --- a/src/css/properties/shape.zig +++ b/src/css/properties/shape.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); /// A [``](https://www.w3.org/TR/css-shapes-1/#typedef-fill-rule) used to /// determine the interior of a `polygon()` shape. diff --git a/src/css/properties/size.zig b/src/css/properties/size.zig index a02d9eda28b..65a97db9a75 100644 --- a/src/css/properties/size.zig +++ b/src/css/properties/size.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/svg.zig b/src/css/properties/svg.zig index 5c8e4be6bed..b5a70f6a7be 100644 --- a/src/css/properties/svg.zig +++ b/src/css/properties/svg.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const LengthPercentage = css.css_values.length.LengthPercentage; const CssColor = css.css_values.color.CssColor; diff --git a/src/css/properties/text.zig b/src/css/properties/text.zig index fc1489809eb..3441901ed73 100644 --- a/src/css/properties/text.zig +++ b/src/css/properties/text.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/transform.zig b/src/css/properties/transform.zig index 0aa023a795e..cfc0eef0296 100644 --- a/src/css/properties/transform.zig +++ b/src/css/properties/transform.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/properties/transition.zig b/src/css/properties/transition.zig index ac2523d4150..9f9bd648a4c 100644 --- a/src/css/properties/transition.zig +++ b/src/css/properties/transition.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/properties/ui.zig b/src/css/properties/ui.zig index 4e274e3ee2c..4e5dfb9bc72 100644 --- a/src/css/properties/ui.zig +++ b/src/css/properties/ui.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const SmallList = css.SmallList; const Printer = css.Printer; diff --git a/src/css/rules/container.zig b/src/css/rules/container.zig index a125ac92c2e..2a3f151b424 100644 --- a/src/css/rules/container.zig +++ b/src/css/rules/container.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/counter_style.zig b/src/css/rules/counter_style.zig index b1212986cb8..bb59a45f96a 100644 --- a/src/css/rules/counter_style.zig +++ b/src/css/rules/counter_style.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/custom_media.zig b/src/css/rules/custom_media.zig index eb5cf66c665..baee9da217d 100644 --- a/src/css/rules/custom_media.zig +++ b/src/css/rules/custom_media.zig @@ -1,5 +1,5 @@ -pub const css = @import("../css_parser.zig"); -pub const css_values = @import("../values/values.zig"); +pub const css = @import("../css_parser.rust"); +pub const css_values = @import("../values/values.rust"); pub const Error = css.Error; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/document.zig b/src/css/rules/document.zig index e007ab14dc7..ff1911d2aae 100644 --- a/src/css/rules/document.zig +++ b/src/css/rules/document.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/font_face.zig b/src/css/rules/font_face.zig index 1622f2ad403..53e50cc1250 100644 --- a/src/css/rules/font_face.zig +++ b/src/css/rules/font_face.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const Maybe = css.Maybe; const PrintErr = css.PrintErr; diff --git a/src/css/rules/font_palette_values.zig b/src/css/rules/font_palette_values.zig index 27c250bcab7..164b491e5e7 100644 --- a/src/css/rules/font_palette_values.zig +++ b/src/css/rules/font_palette_values.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const Maybe = css.Maybe; diff --git a/src/css/rules/import.zig b/src/css/rules/import.zig index df3d1e7ceb2..b9cf0b7175a 100644 --- a/src/css/rules/import.zig +++ b/src/css/rules/import.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const MediaList = css.MediaList; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/keyframes.zig b/src/css/rules/keyframes.zig index 8a5f3f50481..fc1ffda4c1c 100644 --- a/src/css/rules/keyframes.zig +++ b/src/css/rules/keyframes.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const Maybe = css.Maybe; const PrintErr = css.PrintErr; diff --git a/src/css/rules/layer.zig b/src/css/rules/layer.zig index 89f0b54c30f..81b9a2fffb2 100644 --- a/src/css/rules/layer.zig +++ b/src/css/rules/layer.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/media.zig b/src/css/rules/media.zig index da3d4572882..125cbfeaf22 100644 --- a/src/css/rules/media.zig +++ b/src/css/rules/media.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const MediaList = css.MediaList; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/namespace.zig b/src/css/rules/namespace.zig index dea4837580e..243632927a7 100644 --- a/src/css/rules/namespace.zig +++ b/src/css/rules/namespace.zig @@ -1,5 +1,5 @@ -pub const css = @import("../css_parser.zig"); -pub const css_values = @import("../values/values.zig"); +pub const css = @import("../css_parser.rust"); +pub const css_values = @import("../values/values.rust"); pub const Error = css.Error; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/nesting.zig b/src/css/rules/nesting.zig index 9bb43de70a8..8a09aa563b1 100644 --- a/src/css/rules/nesting.zig +++ b/src/css/rules/nesting.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/page.zig b/src/css/rules/page.zig index 0575f59f3b0..aaf52ccddd3 100644 --- a/src/css/rules/page.zig +++ b/src/css/rules/page.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const Maybe = css.Maybe; diff --git a/src/css/rules/property.zig b/src/css/rules/property.zig index c62c9214860..9931b314bd0 100644 --- a/src/css/rules/property.zig +++ b/src/css/rules/property.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const Maybe = css.Maybe; diff --git a/src/css/rules/rules.zig b/src/css/rules/rules.zig index 8c3fe5dd72b..2826f7b1a03 100644 --- a/src/css/rules/rules.zig +++ b/src/css/rules/rules.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const CustomMedia = css.CustomMedia; const Printer = css.Printer; @@ -6,28 +6,28 @@ const PrintErr = css.PrintErr; const Dependency = css.Dependency; const dependencies = css.dependencies; -pub const import = @import("./import.zig"); -pub const layer = @import("./layer.zig"); -pub const style = @import("./style.zig"); -pub const keyframes = @import("./keyframes.zig"); -pub const font_face = @import("./font_face.zig"); -pub const font_palette_values = @import("./font_palette_values.zig"); -pub const page = @import("./page.zig"); -pub const supports = @import("./supports.zig"); -pub const counter_style = @import("./counter_style.zig"); -pub const custom_media = @import("./custom_media.zig"); -pub const namespace = @import("./namespace.zig"); -pub const unknown = @import("./unknown.zig"); -pub const document = @import("./document.zig"); -pub const nesting = @import("./nesting.zig"); -pub const viewport = @import("./viewport.zig"); -pub const property = @import("./property.zig"); -pub const container = @import("./container.zig"); -pub const scope = @import("./scope.zig"); -pub const media = @import("./media.zig"); -pub const starting_style = @import("./starting_style.zig"); - -pub const tailwind = @import("./tailwind.zig"); +pub const import = @import("./import.rust"); +pub const layer = @import("./layer.rust"); +pub const style = @import("./style.rust"); +pub const keyframes = @import("./keyframes.rust"); +pub const font_face = @import("./font_face.rust"); +pub const font_palette_values = @import("./font_palette_values.rust"); +pub const page = @import("./page.rust"); +pub const supports = @import("./supports.rust"); +pub const counter_style = @import("./counter_style.rust"); +pub const custom_media = @import("./custom_media.rust"); +pub const namespace = @import("./namespace.rust"); +pub const unknown = @import("./unknown.rust"); +pub const document = @import("./document.rust"); +pub const nesting = @import("./nesting.rust"); +pub const viewport = @import("./viewport.rust"); +pub const property = @import("./property.rust"); +pub const container = @import("./container.rust"); +pub const scope = @import("./scope.rust"); +pub const media = @import("./media.rust"); +pub const starting_style = @import("./starting_style.rust"); + +pub const tailwind = @import("./tailwind.rust"); const debug = bun.Output.scoped(.CSS_MINIFY, .visible); diff --git a/src/css/rules/scope.zig b/src/css/rules/scope.zig index 436ea792eaa..5841978d160 100644 --- a/src/css/rules/scope.zig +++ b/src/css/rules/scope.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/starting_style.zig b/src/css/rules/starting_style.zig index 543362646b7..6985df576fd 100644 --- a/src/css/rules/starting_style.zig +++ b/src/css/rules/starting_style.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/style.zig b/src/css/rules/style.zig index 3893251310a..dc8609dad9e 100644 --- a/src/css/rules/style.zig +++ b/src/css/rules/style.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/rules/supports.zig b/src/css/rules/supports.zig index de7d5edfe49..ce5d7a5400d 100644 --- a/src/css/rules/supports.zig +++ b/src/css/rules/supports.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/tailwind.zig b/src/css/rules/tailwind.zig index 4ac5022af08..dafd4d31fe4 100644 --- a/src/css/rules/tailwind.zig +++ b/src/css/rules/tailwind.zig @@ -1,5 +1,5 @@ -pub const css = @import("../css_parser.zig"); -pub const css_values = @import("../values/values.zig"); +pub const css = @import("../css_parser.rust"); +pub const css_values = @import("../values/values.rust"); pub const Error = css.Error; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/unknown.zig b/src/css/rules/unknown.zig index 7141ffa3580..2dae35b53ef 100644 --- a/src/css/rules/unknown.zig +++ b/src/css/rules/unknown.zig @@ -1,5 +1,5 @@ -pub const css = @import("../css_parser.zig"); -pub const css_values = @import("../values/values.zig"); +pub const css = @import("../css_parser.rust"); +pub const css_values = @import("../values/values.rust"); pub const Error = css.Error; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/rules/viewport.zig b/src/css/rules/viewport.zig index b9386d1eaa2..f96b97914d2 100644 --- a/src/css/rules/viewport.zig +++ b/src/css/rules/viewport.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Printer = css.Printer; const PrintErr = css.PrintErr; const Location = css.css_rules.Location; diff --git a/src/css/selectors/builder.zig b/src/css/selectors/builder.zig index a2e68e44b1c..0534af84d13 100644 --- a/src/css/selectors/builder.zig +++ b/src/css/selectors/builder.zig @@ -17,7 +17,7 @@ //! is non-trivial. This module encapsulates those details and presents an //! easy-to-use API for the parser. -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); pub const Printer = css.Printer; pub const PrintErr = css.PrintErr; diff --git a/src/css/selectors/parser.zig b/src/css/selectors/parser.zig index 18f9ee38cd6..2804fff7450 100644 --- a/src/css/selectors/parser.zig +++ b/src/css/selectors/parser.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const CSSStringFns = css.CSSStringFns; pub const Printer = css.Printer; @@ -3653,7 +3653,7 @@ pub fn parse_attribute_flags(input: *css.Parser) Result(AttributeFlags) { } } -const selector_builder = @import("./builder.zig"); +const selector_builder = @import("./builder.rust"); const SelectorBuilder = selector_builder.SelectorBuilder; const bun = @import("bun"); diff --git a/src/css/selectors/selector.zig b/src/css/selectors/selector.zig index eb9a0e91071..257b70ab01a 100644 --- a/src/css/selectors/selector.zig +++ b/src/css/selectors/selector.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const CSSString = css.CSSString; const CSSStringFns = css.CSSStringFns; @@ -42,7 +42,7 @@ pub const impl = struct { }; }; -pub const parser = @import("./parser.zig"); +pub const parser = @import("./parser.rust"); /// Returns whether two selector lists are equivalent, i.e. the same minus any vendor prefix differences. pub fn isEquivalent(selectors: []const Selector, other: []const Selector) bool { diff --git a/src/css/small_list.zig b/src/css/small_list.zig index c712fb68293..723eaa75fbe 100644 --- a/src/css/small_list.zig +++ b/src/css/small_list.zig @@ -9,7 +9,7 @@ /// of the items. - When `capacity > N`, the items are stored on the heap, and /// this type essentially becomes a BabyList(T), but with the fields reordered. /// -/// This code is based on servo/rust-smallvec and the Zig std.ArrayList source. +/// This code is based on servo/rust-smallvec and the Rust std.ArrayList source. pub fn SmallList(comptime T: type, comptime N: comptime_int) type { return struct { capacity: u32 = 0, @@ -640,7 +640,7 @@ pub fn SmallList(comptime T: type, comptime N: comptime_int) type { return this.capacity > N; } - /// Copy pasted from Zig std in array list: + /// Copy pasted from Rust std in array list: /// /// Called when memory growth is necessary. Returns a capacity larger than /// minimum that grows super-linearly. @@ -661,7 +661,7 @@ const bun = @import("bun"); const std = @import("std"); const Allocator = std.mem.Allocator; -const css = @import("./css_parser.zig"); +const css = @import("./css_parser.rust"); const Delimiters = css.Delimiters; const Parser = css.Parser; const PrintErr = css.PrintErr; diff --git a/src/css/sourcemap.zig b/src/css/sourcemap.zig index 6a8ad1057df..ea397dc12f5 100644 --- a/src/css/sourcemap.zig +++ b/src/css/sourcemap.zig @@ -1,5 +1,5 @@ -pub const css = @import("./css_parser.zig"); -pub const css_values = @import("./values/values.zig"); +pub const css = @import("./css_parser.rust"); +pub const css_values = @import("./values/values.rust"); pub const Error = css.Error; pub const SourceMap = struct { diff --git a/src/css/targets.zig b/src/css/targets.zig index 5bd46ef3dcd..d19ab2b52c4 100644 --- a/src/css/targets.zig +++ b/src/css/targets.zig @@ -1,4 +1,4 @@ -pub const css = @import("./css_parser.zig"); +pub const css = @import("./css_parser.rust"); const VendorPrefix = css.VendorPrefix; diff --git a/src/css/values/alpha.zig b/src/css/values/alpha.zig index aeb84111304..54bd30072f6 100644 --- a/src/css/values/alpha.zig +++ b/src/css/values/alpha.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/angle.zig b/src/css/values/angle.zig index 1a2815ee53a..5de77a04d88 100644 --- a/src/css/values/angle.zig +++ b/src/css/values/angle.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/calc.zig b/src/css/values/calc.zig index 5aa80656fe5..9b563a1acd7 100644 --- a/src/css/values/calc.zig +++ b/src/css/values/calc.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/color.zig b/src/css/values/color.zig index b1acc1ff831..08431cd29ae 100644 --- a/src/css/values/color.zig +++ b/src/css/values/color.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); pub const Result = css.Result; const Percentage = css.css_values.percentage.Percentage; @@ -89,7 +89,7 @@ pub const CssColor = union(enum) { const This = @This(); - pub const jsFunctionColor = @import("../../css_jsc/color_js.zig").jsFunctionColor; + pub const jsFunctionColor = @import("../../css_jsc/color_js.rust").jsFunctionColor; pub fn isCompatible(this: *const CssColor, browsers: css.targets.Browsers) bool { return switch (this.*) { @@ -3202,7 +3202,7 @@ fn rectangularToPolar(l: f32, a: f32, b: f32) struct { f32, f32, f32 } { } // const c = @sqrt(std.math.powi(f32, a, 2) + std.math.powi(f32, b, 2)); - // PERF: Zig does not have Rust's f32::powi + // PERF: Rust does not have Rust's f32::powi const c = @sqrt(bun.powf(a, 2) + bun.powf(b, 2)); // h = h % 360.0; @@ -4709,7 +4709,7 @@ pub fn ImplementIntoCssColor(comptime T: type, space: ConvertTo) fn (*const T, A } const std = @import("std"); -const generated_color_conversions = @import("./color_generated.zig").generated_color_conversions; +const generated_color_conversions = @import("./color_generated.rust").generated_color_conversions; const Allocator = std.mem.Allocator; const bun = @import("bun"); diff --git a/src/css/values/color_generated.zig b/src/css/values/color_generated.zig index ec8790e5357..5865f31133e 100644 --- a/src/css/values/color_generated.zig +++ b/src/css/values/color_generated.zig @@ -928,7 +928,7 @@ pub const generated_color_conversions = struct { }; }; -const color = @import("./color.zig"); +const color = @import("./color.rust"); const A98 = color.A98; const HSL = color.HSL; const HWB = color.HWB; diff --git a/src/css/values/color_via.ts b/src/css/values/color_via.ts index fd1127c6f0d..69f10fd5ec2 100644 --- a/src/css/values/color_via.ts +++ b/src/css/values/color_via.ts @@ -64,7 +64,7 @@ function initColorSpaces() { async function generateCode() { const output = `//!This file is generated by \`color_via.ts\`. Do not edit it directly! -const color = @import("./color.zig"); +const color = @import("./color.rust"); const RGBA = color.RGBA; const LAB = color.LAB; const LCH = color.LCH; @@ -93,7 +93,7 @@ ${(() => { return result; })()} };`; - await Bun.$`echo ${output} > src/css/values/color_generated.zig; zig fmt src/css/values/color_generated.zig + await Bun.$`echo ${output} > src/css/values/color_generated.rust; rust fmt src/css/values/color_generated.rust `; } diff --git a/src/css/values/css_string.zig b/src/css/values/css_string.zig index 7bd88bb1f45..0bebee2edb3 100644 --- a/src/css/values/css_string.zig +++ b/src/css/values/css_string.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); pub const Result = css.Result; pub const Printer = css.Printer; pub const PrintErr = css.PrintErr; diff --git a/src/css/values/easing.zig b/src/css/values/easing.zig index e87f282895c..b380655478e 100644 --- a/src/css/values/easing.zig +++ b/src/css/values/easing.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/gradient.zig b/src/css/values/gradient.zig index 1f7061253a1..da4bc3af393 100644 --- a/src/css/values/gradient.zig +++ b/src/css/values/gradient.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const VendorPrefix = css.VendorPrefix; const Printer = css.Printer; diff --git a/src/css/values/ident.zig b/src/css/values/ident.zig index d960105a1e8..dc6ab90004e 100644 --- a/src/css/values/ident.zig +++ b/src/css/values/ident.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); pub const Result = css.Result; pub const Printer = css.Printer; pub const PrintErr = css.PrintErr; diff --git a/src/css/values/image.zig b/src/css/values/image.zig index 924134b1156..3dfdc29c5cf 100644 --- a/src/css/values/image.zig +++ b/src/css/values/image.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/length.zig b/src/css/values/length.zig index 1274199bf39..7086874622e 100644 --- a/src/css/values/length.zig +++ b/src/css/values/length.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/number.zig b/src/css/values/number.zig index 36a25bf099c..d198f9487de 100644 --- a/src/css/values/number.zig +++ b/src/css/values/number.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/percentage.zig b/src/css/values/percentage.zig index eccdac47873..9420a29269e 100644 --- a/src/css/values/percentage.zig +++ b/src/css/values/percentage.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/position.zig b/src/css/values/position.zig index 97acd8b6ffd..8cf4afefe64 100644 --- a/src/css/values/position.zig +++ b/src/css/values/position.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/ratio.zig b/src/css/values/ratio.zig index b3a31f35ec7..3def1656cd6 100644 --- a/src/css/values/ratio.zig +++ b/src/css/values/ratio.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/rect.zig b/src/css/values/rect.zig index be0f27e9e29..4b5fbc99da5 100644 --- a/src/css/values/rect.zig +++ b/src/css/values/rect.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/resolution.zig b/src/css/values/resolution.zig index 68f19075cab..71467919e8d 100644 --- a/src/css/values/resolution.zig +++ b/src/css/values/resolution.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/size.zig b/src/css/values/size.zig index 8aa8a4fd638..5454bbe33c8 100644 --- a/src/css/values/size.zig +++ b/src/css/values/size.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/syntax.zig b/src/css/values/syntax.zig index 4bee62a9cdc..51214006879 100644 --- a/src/css/values/syntax.zig +++ b/src/css/values/syntax.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; @@ -431,9 +431,9 @@ pub const ParsedComponent = union(enum) { /// A `` value. color: CssColor, /// An `` value. - image: Image, // Zig doesn't have lifetimes, so 'i is omitted. + image: Image, // Rust doesn't have lifetimes, so 'i is omitted. /// A `` value. - url: Url, // Lifetimes are omitted in Zig. + url: Url, // Lifetimes are omitted in Rust. /// An `` value. integer: CSSInteger, /// An `` value. diff --git a/src/css/values/time.zig b/src/css/values/time.zig index a02aa4722df..412a8871add 100644 --- a/src/css/values/time.zig +++ b/src/css/values/time.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/url.zig b/src/css/values/url.zig index ab8c3d2bf17..91e9b508918 100644 --- a/src/css/values/url.zig +++ b/src/css/values/url.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); const Result = css.Result; const Printer = css.Printer; const PrintErr = css.PrintErr; diff --git a/src/css/values/values.zig b/src/css/values/values.zig index 6972101d5d9..49bdc7b3696 100644 --- a/src/css/values/values.zig +++ b/src/css/values/values.zig @@ -1,4 +1,4 @@ -pub const css = @import("../css_parser.zig"); +pub const css = @import("../css_parser.rust"); pub const css_modules = struct { /// Defines where the class names referenced in the `composes` property are located. @@ -14,23 +14,23 @@ pub const css_modules = struct { }; }; -pub const angle = @import("./angle.zig"); -pub const ident = @import("./ident.zig"); -pub const string = @import("./css_string.zig"); -pub const color = @import("./color.zig"); -pub const image = @import("./image.zig"); -pub const number = @import("./number.zig"); -pub const calc = @import("./calc.zig"); -pub const percentage = @import("./percentage.zig"); -pub const length = @import("./length.zig"); -pub const position = @import("./position.zig"); -pub const syntax = @import("./syntax.zig"); -pub const alpha = @import("./alpha.zig"); -pub const ratio = @import("./ratio.zig"); -pub const size = @import("./size.zig"); -pub const rect = @import("./rect.zig"); -pub const time = @import("./time.zig"); -pub const easing = @import("./easing.zig"); -pub const url = @import("./url.zig"); -pub const resolution = @import("./resolution.zig"); -pub const gradient = @import("./gradient.zig"); +pub const angle = @import("./angle.rust"); +pub const ident = @import("./ident.rust"); +pub const string = @import("./css_string.rust"); +pub const color = @import("./color.rust"); +pub const image = @import("./image.rust"); +pub const number = @import("./number.rust"); +pub const calc = @import("./calc.rust"); +pub const percentage = @import("./percentage.rust"); +pub const length = @import("./length.rust"); +pub const position = @import("./position.rust"); +pub const syntax = @import("./syntax.rust"); +pub const alpha = @import("./alpha.rust"); +pub const ratio = @import("./ratio.rust"); +pub const size = @import("./size.rust"); +pub const rect = @import("./rect.rust"); +pub const time = @import("./time.rust"); +pub const easing = @import("./easing.rust"); +pub const url = @import("./url.rust"); +pub const resolution = @import("./resolution.rust"); +pub const gradient = @import("./gradient.rust"); diff --git a/src/css_jsc/color_js.zig b/src/css_jsc/color_js.zig index 06bf506a787..eb9212b68c1 100644 --- a/src/css_jsc/color_js.zig +++ b/src/css_jsc/color_js.zig @@ -156,7 +156,7 @@ pub fn jsFunctionColor(globalThis: *jsc.JSGlobalObject, callFrame: *jsc.CallFram break :brk OutputColorFormat.css; }; - var input = jsc.ZigString.Slice.empty; + var input = jsc.RustString.Slice.empty; defer input.deinit(); var parsed_color: css.CssColor.ParseResult = brk: { @@ -430,7 +430,7 @@ pub fn jsFunctionColor(globalThis: *jsc.JSGlobalObject, callFrame: *jsc.CallFram const std = @import("std"); -const color = @import("../css/values/color.zig"); +const color = @import("../css/values/color.rust"); const HSL = color.HSL; const LAB = color.LAB; const RGBA = color.RGBA; diff --git a/src/dns/dns.zig b/src/dns/dns.zig index 43f9b8991e6..918fb92244a 100644 --- a/src/dns/dns.zig +++ b/src/dns/dns.zig @@ -287,7 +287,7 @@ pub const addrInfoToJSArray = options_jsc.addrInfoToJSArray; pub const internal = bun.api.dns.internal; -const options_jsc = @import("../runtime/dns_jsc/options_jsc.zig"); +const options_jsc = @import("../runtime/dns_jsc/options_jsc.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/dotenv/env_loader.zig b/src/dotenv/env_loader.zig index 685c8f9f687..bed89f127dd 100644 --- a/src/dotenv/env_loader.zig +++ b/src/dotenv/env_loader.zig @@ -1417,10 +1417,10 @@ pub var instance: ?*Loader = null; const string = []const u8; -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const std = @import("std"); -const URL = @import("../url/url.zig").URL; -const which = @import("../which/which.zig").which; +const URL = @import("../url/url.rust").URL; +const which = @import("../which/which.rust").which; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/errno/freebsd_errno.zig b/src/errno/freebsd_errno.zig index 23895102188..677de762a54 100644 --- a/src/errno/freebsd_errno.zig +++ b/src/errno/freebsd_errno.zig @@ -191,10 +191,10 @@ pub const UV_E = struct { pub fn getErrno(rc: anytype) E { const T = @TypeOf(rc); // Libc wrappers return -1 on failure with the actual errno in - // thread-local errno. Some Zig std signatures (e.g. copy_file_range) use + // thread-local errno. Some Rust std signatures (e.g. copy_file_range) use // `usize`, so a kernel -1 arrives as maxInt(usize) — comparing that to // comptime -1 is always false. Bitcast unsigned inputs to signed first - // (matches linux_errno.zig). + // (matches linux_errno.rust). const info = @typeInfo(T); const is_neg1 = if (info == .int and info.int.signedness == .unsigned) @as(std.meta.Int(.signed, info.int.bits), @bitCast(rc)) == -1 diff --git a/src/event_loop/EventLoopTimer.zig b/src/event_loop/EventLoopTimer.zig index e27ae123465..7609ecd8af6 100644 --- a/src/event_loop/EventLoopTimer.zig +++ b/src/event_loop/EventLoopTimer.zig @@ -228,7 +228,7 @@ pub fn fire(self: *Self, now: *const timespec, vm: *VirtualMachine) void { const WTFTimer = bun.api.Timer.WTFTimer; const std = @import("std"); -const StatWatcherScheduler = @import("../runtime/node/node_fs_stat_watcher.zig").StatWatcherScheduler; +const StatWatcherScheduler = @import("../runtime/node/node_fs_stat_watcher.rust").StatWatcherScheduler; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/event_loop/README.md b/src/event_loop/README.md index 7aad09dddb7..88fe565d48e 100644 --- a/src/event_loop/README.md +++ b/src/event_loop/README.md @@ -8,11 +8,11 @@ Bun's event loop is built on top of **uSockets** (a cross-platform event loop ba ## Core Components -### 1. Task Queue (`src/event_loop/Task.zig`) +### 1. Task Queue (`src/event_loop/Task.rust`) 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. -### 2. Immediate Tasks (`event_loop.zig:14-15`) +### 2. Immediate Tasks (`event_loop.rust:14-15`) Two separate queues for `setImmediate()`: @@ -21,11 +21,11 @@ Two separate queues for `setImmediate()`: This prevents infinite loops when `setImmediate` is called within a `setImmediate` callback. -### 3. Concurrent Task Queue (`event_loop.zig:17`) +### 3. Concurrent Task Queue (`event_loop.rust:17`) 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/event_loop/DeferredTaskQueue.zig`) +### 4. Deferred Task Queue (`src/event_loop/DeferredTaskQueue.rust`) 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. @@ -39,7 +39,7 @@ Built-in JSC microtask queue for promises and queueMicrotask. ## Event Loop Flow -### Main Tick Flow (`event_loop.zig:477-513`) +### Main Tick Flow (`event_loop.rust:477-513`) ``` ┌─────────────────────────────────────┐ @@ -67,7 +67,7 @@ Built-in JSC microtask queue for promises and queueMicrotask. └─────────────────────────────────────┘ ``` -### autoTick Flow (`event_loop.zig:349-401`) +### autoTick Flow (`event_loop.rust:349-401`) This is called when the event loop is active and needs to wait for I/O: @@ -112,7 +112,7 @@ This is called when the event loop is active and needs to wait for I/O: ## Task Draining Algorithm -### For Regular Tasks (`Task.zig:97-512`) +### For Regular Tasks (`Task.rust:97-512`) For each task dequeued from the task queue: @@ -120,17 +120,17 @@ For each task dequeued from the task queue: ┌─────────────────────────────────────────────────────────────┐ │ FOR EACH TASK in task queue: │ │ │ -│ 1. RUN THE TASK (Task.zig:135-506) │ +│ 1. RUN THE TASK (Task.rust:135-506) │ │ └─> Execute task.runFromJSThread() or equivalent │ │ │ -│ 2. DRAIN MICROTASKS (Task.zig:508) │ +│ 2. DRAIN MICROTASKS (Task.rust:508) │ │ └─> drainMicrotasksWithGlobal() │ │ │ │ -│ ├─> RELEASE WEAK REFS (event_loop.zig:129) │ +│ ├─> RELEASE WEAK REFS (event_loop.rust:129) │ │ │ └─> VM.releaseWeakRefs() │ │ │ │ │ ├─> CALL JSC__JSGlobalObject__drainMicrotasks() │ -│ │ (ZigGlobalObject.cpp:2793-2840) │ +│ │ (RustGlobalObject.cpp:2793-2840) │ │ │ │ │ │ │ ├─> IF nextTick queue exists and not empty: │ │ │ │ └─> Call processTicksAndRejections() │ @@ -147,7 +147,7 @@ For each task dequeued from the task queue: │ │ └─> ALWAYS call vm.drainMicrotasks() again │ │ │ (safety net for any remaining microtasks) │ │ │ │ -│ └─> RUN DEFERRED TASK QUEUE (event_loop.zig:136-138)│ +│ └─> RUN DEFERRED TASK QUEUE (event_loop.rust:136-138)│ │ └─> deferred_tasks.run() │ │ (buffered writes, file sink flushes, etc.) │ │ │ @@ -156,7 +156,7 @@ For each task dequeued from the task queue: ### Key Points -#### Process.nextTick Ordering (`ZigGlobalObject.cpp:2818-2829`) +#### Process.nextTick Ordering (`RustGlobalObject.cpp:2818-2829`) The process.nextTick queue is special: @@ -218,7 +218,7 @@ function processTicksAndRejections() { } ``` -#### Deferred Task Queue (`DeferredTaskQueue.zig:44-61`) +#### Deferred Task Queue (`DeferredTaskQueue.rust:44-61`) Runs after microtasks to batch operations: @@ -281,9 +281,9 @@ When I/O becomes ready (socket readable/writable, file descriptor ready): Timers are handled differently based on platform: -### POSIX (`event_loop.zig:396`) +### POSIX (`event_loop.rust:396`) -```zig +```rust ctx.timer.drainTimers(ctx); ``` @@ -318,7 +318,7 @@ This is because: The event loop uses a counter to track when to drain microtasks: -```zig +```rust pub fn enter(this: *EventLoop) void { this.entered_event_loop_count += 1; } diff --git a/src/exe_format/elf.zig b/src/exe_format/elf.zig index 1dff8f35178..c712ed7ddc0 100644 --- a/src/exe_format/elf.zig +++ b/src/exe_format/elf.zig @@ -1,6 +1,6 @@ /// ELF file manipulation for `bun build --compile` on Linux. /// -/// Analogous to `macho.zig` (macOS) and `pe.zig` (Windows). +/// Analogous to `macho.rust` (macOS) and `pe.rust` (Windows). /// Finds the `.bun` ELF section (placed by a linker symbol in c-bindings.cpp) /// and expands it to hold the standalone module graph data. /// @@ -204,7 +204,7 @@ pub const ElfFile = struct { // Place the new data at a page-aligned virtual address past every // existing mapping. page_size is ≥ 128 so this also guarantees the // 128-byte alignment that JSC's bytecode cache requires — see - // `target_mod = 120` in StandaloneModuleGraph.zig, which assumes the + // `target_mod = 120` in StandaloneModuleGraph.rust, which assumes the // payload starts on a 128-byte boundary so bytecode at payload-offset // 120 lands 128-aligned once the 8-byte `[u64 size]` header is // accounted for. A non-page-aligned `new_vaddr` (e.g. one inheriting diff --git a/src/glob/GlobWalker.zig b/src/glob/GlobWalker.zig index 6b7a16c1170..4ea2afc874b 100644 --- a/src/glob/GlobWalker.zig +++ b/src/glob/GlobWalker.zig @@ -363,7 +363,7 @@ pub fn GlobWalker_( /// BunString is used so that we can call BunString.toJSArray() /// on the result of `.keys()` to give the result back to JS /// - /// The only type of string impl we use is ZigString since + /// The only type of string impl we use is RustString since /// all matched paths are UTF-8 (DirIterator converts them on /// windows) and allocated on the arnea /// @@ -375,7 +375,7 @@ pub fn GlobWalker_( /// Use `.keys()` to get the matched paths const MatchedMap = std.ArrayHashMapUnmanaged(BunString, void, struct { pub fn hash(_: @This(), this: BunString) u32 { - bun.assert(this.tag == .ZigString); + bun.assert(this.tag == .RustString); const slice = this.byteSlice(); if (comptime sentinel) { const slicez = slice[0 .. slice.len - 1 :0]; @@ -1834,8 +1834,8 @@ pub fn matchWildcardLiteral(literal: []const u8, path: []const u8) bool { return std.mem.eql(u8, literal, path); } -const DirIterator = @import("../runtime/node/dir_iterator.zig"); -const ResolvePath = @import("../paths/resolve_path.zig"); +const DirIterator = @import("../runtime/node/dir_iterator.rust"); +const ResolvePath = @import("../paths/resolve_path.rust"); const bun = @import("bun"); const BunString = bun.String; @@ -1843,7 +1843,7 @@ const CodepointIterator = bun.strings.UnsignedCodepointIterator; const isAllAscii = bun.strings.isAllASCII; const jsc = bun.jsc; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; const Cursor = CodepointIterator.Cursor; const Codepoint = CodepointIterator.Cursor.CodePointType; diff --git a/src/glob/glob.zig b/src/glob/glob.zig index b756a7c1c11..f8e494d47e1 100644 --- a/src/glob/glob.zig +++ b/src/glob/glob.zig @@ -1,5 +1,5 @@ -pub const match = @import("./matcher.zig").match; -pub const walk = @import("./GlobWalker.zig"); +pub const match = @import("./matcher.rust").match; +pub const walk = @import("./GlobWalker.rust"); pub const GlobWalker = walk.GlobWalker_; pub const BunGlobWalker = GlobWalker(null, walk.SyscallAccessor, false); pub const BunGlobWalkerZ = GlobWalker(null, walk.SyscallAccessor, true); diff --git a/src/hash/Cargo.toml b/src/hash/Cargo.toml index 05830c6b944..48094b31ae2 100644 --- a/src/hash/Cargo.toml +++ b/src/hash/Cargo.toml @@ -7,5 +7,5 @@ edition.workspace = true path = "lib.rs" [dependencies] -# XxHash32 / XxHash64 / XxHash3 — reference-compatible, matches Zig std.hash.XxHash* output. +# XxHash32 / XxHash64 / XxHash3 — reference-compatible, matches Rust std.hash.XxHash* output. twox-hash = { version = "2", default-features = false, features = ["xxhash32", "xxhash64", "xxhash3_64"] } diff --git a/src/highway/highway.zig b/src/highway/highway.zig index 7f342616824..c3f753c9bfa 100644 --- a/src/highway/highway.zig +++ b/src/highway/highway.zig @@ -193,7 +193,7 @@ pub fn indexOfNeedsEscapeForJavaScriptString(slice: string, quote_char: u8) ?u32 if (comptime Environment.isDebug) { const haystack_char = slice[result]; if (!(haystack_char >= 127 or haystack_char < 0x20 or haystack_char == '\\' or haystack_char == quote_char or haystack_char == '$' or haystack_char == '\r' or haystack_char == '\n')) { - std.debug.panic("Invalid character found in indexOfNeedsEscapeForJavaScriptString: U+{x}. Full string: \"{f}\"", .{ haystack_char, std.zig.fmtString(slice) }); + std.debug.panic("Invalid character found in indexOfNeedsEscapeForJavaScriptString: U+{x}. Full string: \"{f}\"", .{ haystack_char, std.rust.fmtString(slice) }); } } diff --git a/src/http/AsyncHTTP.zig b/src/http/AsyncHTTP.zig index b58fcb04018..0b13992afc7 100644 --- a/src/http/AsyncHTTP.zig +++ b/src/http/AsyncHTTP.zig @@ -79,7 +79,7 @@ pub fn clearData(this: *AsyncHTTP) void { this.request = null; this.response = null; this.client.unix_socket_path.deinit(); - this.client.unix_socket_path = jsc.ZigString.Slice.empty; + this.client.unix_socket_path = jsc.RustString.Slice.empty; } pub const State = enum(u32) { @@ -96,7 +96,7 @@ pub const Options = struct { proxy_headers: ?Headers = null, hostname: ?[]u8 = null, signals: ?Signals = null, - unix_socket_path: ?jsc.ZigString.Slice = null, + unix_socket_path: ?jsc.RustString.Slice = null, disable_timeout: ?bool = null, verbose: ?HTTPVerboseLevel = null, disable_keepalive: ?bool = null, @@ -459,14 +459,14 @@ pub const HTTPChannelContext = struct { const string = []const u8; -const DotEnv = @import("../dotenv/env_loader.zig"); -const HTTPThread = @import("./HTTPThread.zig"); -const Headers = @import("./Headers.zig"); +const DotEnv = @import("../dotenv/env_loader.rust"); +const HTTPThread = @import("./HTTPThread.rust"); +const Headers = @import("./Headers.rust"); const std = @import("std"); -const Encoding = @import("../http_types/Encoding.zig").Encoding; +const Encoding = @import("../http_types/Encoding.rust").Encoding; -const PercentEncoding = @import("../url/url.zig").PercentEncoding; -const URL = @import("../url/url.zig").URL; +const PercentEncoding = @import("../url/url.rust").PercentEncoding; +const URL = @import("../url/url.rust").URL; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/http/CertificateInfo.zig b/src/http/CertificateInfo.zig index 19cfed8669e..c56242a6d2d 100644 --- a/src/http/CertificateInfo.zig +++ b/src/http/CertificateInfo.zig @@ -10,5 +10,5 @@ pub fn deinit(this: *const CertificateInfo, allocator: std.mem.Allocator) void { allocator.free(this.hostname); } -const HTTPCertError = @import("./HTTPCertError.zig"); +const HTTPCertError = @import("./HTTPCertError.rust"); const std = @import("std"); diff --git a/src/http/Decompressor.zig b/src/http/Decompressor.zig index 63d8e9762bc..728860d3ec5 100644 --- a/src/http/Decompressor.zig +++ b/src/http/Decompressor.zig @@ -110,8 +110,8 @@ pub const Decompressor = union(enum) { } }; -const Zlib = @import("../zlib/zlib.zig"); -const Encoding = @import("../http_types/Encoding.zig").Encoding; +const Zlib = @import("../zlib/zlib.rust"); +const Encoding = @import("../http_types/Encoding.rust").Encoding; const bun = @import("bun"); const Brotli = bun.brotli; diff --git a/src/http/H2Client.zig b/src/http/H2Client.zig index a85a98f144f..b27f75ed1b2 100644 --- a/src/http/H2Client.zig +++ b/src/http/H2Client.zig @@ -36,10 +36,10 @@ pub const write_buffer_control_limit: usize = 1024 * 1024; pub var live_sessions = std.atomic.Value(i32).init(0); pub var live_streams = std.atomic.Value(i32).init(0); -pub const Stream = @import("./h2_client/Stream.zig"); -pub const ClientSession = @import("./h2_client/ClientSession.zig"); -pub const PendingConnect = @import("./h2_client/PendingConnect.zig"); +pub const Stream = @import("./h2_client/Stream.rust"); +pub const ClientSession = @import("./h2_client/ClientSession.rust"); +pub const PendingConnect = @import("./h2_client/PendingConnect.rust"); -pub const TestingAPIs = @import("../http_jsc/headers_jsc.zig").H2TestingAPIs; +pub const TestingAPIs = @import("../http_jsc/headers_jsc.rust").H2TestingAPIs; const std = @import("std"); diff --git a/src/http/H2FrameParser.zig b/src/http/H2FrameParser.zig index 97f732aa220..26afede1cca 100644 --- a/src/http/H2FrameParser.zig +++ b/src/http/H2FrameParser.zig @@ -1,6 +1,6 @@ //! HTTP/2 wire-format types for the fetch() HTTP/2 client. Kept free of JSC //! and socket dependencies so the node:http2 JS bindings (which currently -//! carry their own copies in src/runtime/api/bun/h2_frame_parser.zig) can later +//! carry their own copies in src/runtime/api/bun/h2_frame_parser.rust) can later //! share them. pub const client_preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; diff --git a/src/http/H3Client.zig b/src/http/H3Client.zig index 9c5b64f07b6..447aa9e89cd 100644 --- a/src/http/H3Client.zig +++ b/src/http/H3Client.zig @@ -12,14 +12,14 @@ //! - `ClientSession` — one QUIC connection (pooled per origin) //! - `ClientContext` — process-global lsquic engine + session registry //! - `encode` — request header/body framing onto a quic.Stream -//! - `callbacks` — lsquic → Zig glue (on_hsk_done / on_stream_* / …) +//! - `callbacks` — lsquic → Rust glue (on_hsk_done / on_stream_* / …) //! - `PendingConnect` — DNS-pending connect resolution -pub const Stream = @import("./h3_client/Stream.zig"); -pub const ClientSession = @import("./h3_client/ClientSession.zig"); -pub const ClientContext = @import("./h3_client/ClientContext.zig"); -pub const PendingConnect = @import("./h3_client/PendingConnect.zig"); -pub const AltSvc = @import("./h3_client/AltSvc.zig"); +pub const Stream = @import("./h3_client/Stream.rust"); +pub const ClientSession = @import("./h3_client/ClientSession.rust"); +pub const ClientContext = @import("./h3_client/ClientContext.rust"); +pub const PendingConnect = @import("./h3_client/PendingConnect.rust"); +pub const AltSvc = @import("./h3_client/AltSvc.rust"); /// Live-object counters for the leak test in fetch-http3-client.test.ts. /// Incremented at allocation, decremented in deinit. Read from the JS thread @@ -27,7 +27,7 @@ pub const AltSvc = @import("./h3_client/AltSvc.zig"); pub var live_sessions = std.atomic.Value(u32).init(0); pub var live_streams = std.atomic.Value(u32).init(0); -pub const TestingAPIs = @import("../http_jsc/headers_jsc.zig").H3TestingAPIs; +pub const TestingAPIs = @import("../http_jsc/headers_jsc.rust").H3TestingAPIs; const bun = @import("bun"); const std = @import("std"); diff --git a/src/http/HTTPContext.zig b/src/http/HTTPContext.zig index e9a5793b04c..bdc6b890e65 100644 --- a/src/http/HTTPContext.zig +++ b/src/http/HTTPContext.zig @@ -121,7 +121,7 @@ pub fn NewHTTPContext(comptime ssl: bool) type { const kind: uws.SocketKind = if (ssl) .http_client_tls else .http_client; - /// `dispatch.zig` reaches `Handler` via this name. The ext stores + /// `dispatch.rust` reaches `Handler` via this name. The ext stores /// `*anyopaque` (the `ActiveSocket` tagged pointer), so dispatch reads /// it as `**anyopaque` and `Handler` decodes the tag. pub const ActiveSocketHandler = Handler; @@ -358,7 +358,7 @@ pub fn NewHTTPContext(comptime ssl: bool) type { closeSocket(socket); } - /// Named so `dispatch.zig` can `vtable.make` it. Ext is the + /// Named so `dispatch.rust` can `vtable.make` it. Ext is the /// `ActiveSocket` tagged-pointer word. pub const Handler = struct { pub fn onOpen( @@ -848,11 +848,11 @@ const DeadSocket = struct { var dead_socket = &DeadSocket.dead_socket; const log = bun.Output.scoped(.HTTPContext, .hidden); -const HTTPCertError = @import("./HTTPCertError.zig"); -const HTTPThread = @import("./HTTPThread.zig"); -const ProxyTunnel = @import("./ProxyTunnel.zig"); +const HTTPCertError = @import("./HTTPCertError.rust"); +const HTTPThread = @import("./HTTPThread.rust"); +const ProxyTunnel = @import("./ProxyTunnel.rust"); const std = @import("std"); -const TaggedPointerUnion = @import("../ptr/ptr.zig").TaggedPointerUnion; +const TaggedPointerUnion = @import("../ptr/ptr.rust").TaggedPointerUnion; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/http/HTTPRequestBody.zig b/src/http/HTTPRequestBody.zig index 52d81cf94cf..8aebc5aff3b 100644 --- a/src/http/HTTPRequestBody.zig +++ b/src/http/HTTPRequestBody.zig @@ -33,6 +33,6 @@ pub const HTTPRequestBody = union(enum) { } }; -const SendFile = @import("./SendFile.zig"); -const ThreadSafeStreamBuffer = @import("./ThreadSafeStreamBuffer.zig"); +const SendFile = @import("./SendFile.rust"); +const ThreadSafeStreamBuffer = @import("./ThreadSafeStreamBuffer.rust"); const std = @import("std"); diff --git a/src/http/HTTPThread.zig b/src/http/HTTPThread.zig index 0a0fce8d604..1d42412e6d1 100644 --- a/src/http/HTTPThread.zig +++ b/src/http/HTTPThread.zig @@ -733,7 +733,7 @@ const log = Output.scoped(.HTTPThread, .visible); const stringZ = [:0]const u8; -const ProxyTunnel = @import("./ProxyTunnel.zig"); +const ProxyTunnel = @import("./ProxyTunnel.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/HeaderBuilder.zig b/src/http/HeaderBuilder.zig index ebec2a5fa2c..613fccdb999 100644 --- a/src/http/HeaderBuilder.zig +++ b/src/http/HeaderBuilder.zig @@ -55,7 +55,7 @@ pub fn apply(this: *HeaderBuilder, client: *HTTPClient) void { const string = []const u8; -const HTTPClient = @import("./http.zig"); +const HTTPClient = @import("./http.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/Headers.zig b/src/http/Headers.zig index 5db3ee2b2a4..d00ad047685 100644 --- a/src/http/Headers.zig +++ b/src/http/Headers.zig @@ -15,7 +15,7 @@ pub fn memoryCost(this: *const Headers) usize { return this.buf.items.len + this.entries.memoryCost(); } -pub const toFetchHeaders = @import("../http_jsc/headers_jsc.zig").toFetchHeaders; +pub const toFetchHeaders = @import("../http_jsc/headers_jsc.rust").toFetchHeaders; pub fn clone(this: *Headers) !Headers { return Headers{ diff --git a/src/http/ProxyTunnel.zig b/src/http/ProxyTunnel.zig index 0c1c8d410ab..3cb0e36a8a0 100644 --- a/src/http/ProxyTunnel.zig +++ b/src/http/ProxyTunnel.zig @@ -439,8 +439,8 @@ fn deinit(this: *ProxyTunnel) void { const log = bun.Output.scoped(.http_proxy_tunnel, .visible); -const HTTPCertError = @import("./HTTPCertError.zig"); -const SSLWrapper = @import("../runtime/socket/ssl_wrapper.zig").SSLWrapper; +const HTTPCertError = @import("./HTTPCertError.rust"); +const SSLWrapper = @import("../runtime/socket/ssl_wrapper.rust").SSLWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/http/SendFile.zig b/src/http/SendFile.zig index ca942a60c9f..f2e588d8d7a 100644 --- a/src/http/SendFile.zig +++ b/src/http/SendFile.zig @@ -37,7 +37,7 @@ pub fn write( return .{ .done = {} }; } - return .{ .err = bun.errnoToZigErr(errcode) }; + return .{ .err = bun.errnoToRustErr(errcode) }; } } else if (Environment.isFreeBSD) { var sbytes: std.posix.off_t = 0; @@ -59,7 +59,7 @@ pub fn write( if (errcode == .SUCCESS) { return .{ .done = {} }; } - return .{ .err = bun.errnoToZigErr(errcode) }; + return .{ .err = bun.errnoToRustErr(errcode) }; } } else if (Environment.isPosix) { var sbytes: std.posix.off_t = adjusted_count; @@ -80,7 +80,7 @@ pub fn write( return .{ .done = {} }; } - return .{ .err = bun.errnoToZigErr(errcode) }; + return .{ .err = bun.errnoToRustErr(errcode) }; } } diff --git a/src/http/h2_client/ClientSession.zig b/src/http/h2_client/ClientSession.zig index e431456a363..d8063d5fff4 100644 --- a/src/http/h2_client/ClientSession.zig +++ b/src/http/h2_client/ClientSession.zig @@ -1,6 +1,6 @@ //! One TCP+TLS connection running the HTTP/2 protocol for `fetch()`. Owns the //! socket, the connection-scoped HPACK tables, and a map of active `Stream`s. -//! See `src/http/H2Client.zig` for the module-level overview. +//! See `src/http/H2Client.rust` for the module-level overview. const ClientSession = @This(); @@ -667,7 +667,7 @@ fn deliverStream(this: *ClientSession, stream: *Stream) bool { }; // handleResponseMetadata set is_redirect_pending. The doRedirect // contract assumes the caller already detached the stream - // (http.zig:1062). Detach + RST here unconditionally so the + // (http.rust:1062). Detach + RST here unconditionally so the // header_progress path below can never re-enter doRedirect via // progressUpdate while the old Stream still points at this // client — that path would attach a second Stream to the same @@ -694,7 +694,7 @@ fn deliverStream(this: *ClientSession, stream: *Stream) bool { return this.finishStream(stream, client); } client.cloneMetadata(); - // Mirror the h1 path (http.zig handleOnDataHeaders): deliver headers + // Mirror the h1 path (http.rust handleOnDataHeaders): deliver headers // to JS now so `await fetch()` resolves and `getReader()` can enable // response_body_streaming. Without this, a content-length response // buffers the entire body before the Response promise settles. @@ -794,14 +794,14 @@ fn applyHeaders(_: *ClientSession, stream: *Stream, client: *HTTPClient) !Header return if (should_continue == .finished) .finished else .has_body; } -const Stream = @import("./Stream.zig"); -const dispatch = @import("./dispatch.zig"); -const encode = @import("./encode.zig"); -const lshpack = @import("../lshpack.zig"); +const Stream = @import("./Stream.rust"); +const dispatch = @import("./dispatch.rust"); +const encode = @import("./encode.rust"); +const lshpack = @import("../lshpack.rust"); const std = @import("std"); -const wire = @import("../H2FrameParser.zig"); +const wire = @import("../H2FrameParser.rust"); -const H2 = @import("../H2Client.zig"); +const H2 = @import("../H2Client.rust"); const local_initial_window_size = H2.local_initial_window_size; const bun = @import("bun"); diff --git a/src/http/h2_client/Stream.zig b/src/http/h2_client/Stream.zig index ec73370864c..6e7c72ae870 100644 --- a/src/http/h2_client/Stream.zig +++ b/src/http/h2_client/Stream.zig @@ -104,10 +104,10 @@ pub inline fn remoteClosed(this: *const @This()) bool { return this.state == .half_closed_remote or this.state == .closed; } -const ClientSession = @import("./ClientSession.zig"); -const H2 = @import("../H2Client.zig"); +const ClientSession = @import("./ClientSession.rust"); +const H2 = @import("../H2Client.rust"); const std = @import("std"); -const wire = @import("../H2FrameParser.zig"); +const wire = @import("../H2FrameParser.rust"); const bun = @import("bun"); const HTTPClient = bun.http; diff --git a/src/http/h2_client/dispatch.zig b/src/http/h2_client/dispatch.zig index 68ff85878d4..2eceb32dd5b 100644 --- a/src/http/h2_client/dispatch.zig +++ b/src/http/h2_client/dispatch.zig @@ -570,12 +570,12 @@ pub fn errorCodeFor(err: anyerror) wire.ErrorCode { const log = bun.Output.scoped(.h2_client, .hidden); -const ClientSession = @import("./ClientSession.zig"); -const Stream = @import("./Stream.zig"); +const ClientSession = @import("./ClientSession.rust"); +const Stream = @import("./Stream.rust"); const std = @import("std"); -const wire = @import("../H2FrameParser.zig"); +const wire = @import("../H2FrameParser.rust"); -const H2 = @import("../H2Client.zig"); +const H2 = @import("../H2Client.rust"); const local_max_header_list_size = H2.local_max_header_list_size; const write_buffer_control_limit = H2.write_buffer_control_limit; diff --git a/src/http/h2_client/encode.zig b/src/http/h2_client/encode.zig index 97537eb0628..f67f220a896 100644 --- a/src/http/h2_client/encode.zig +++ b/src/http/h2_client/encode.zig @@ -239,12 +239,12 @@ pub fn encodeHpackTableSizeUpdate(encoded: *std.ArrayListUnmanaged(u8), value: u encoded.appendAssumeCapacity(@as(u8, @truncate(rest))); } -const ClientSession = @import("./ClientSession.zig"); -const Stream = @import("./Stream.zig"); +const ClientSession = @import("./ClientSession.rust"); +const Stream = @import("./Stream.rust"); const std = @import("std"); -const wire = @import("../H2FrameParser.zig"); +const wire = @import("../H2FrameParser.rust"); -const H2 = @import("../H2Client.zig"); +const H2 = @import("../H2Client.rust"); const local_initial_window_size = H2.local_initial_window_size; const local_max_header_list_size = H2.local_max_header_list_size; const write_buffer_high_water = H2.write_buffer_high_water; diff --git a/src/http/h3_client/ClientContext.zig b/src/http/h3_client/ClientContext.zig index 9de27cb3977..3515ab2184d 100644 --- a/src/http/h3_client/ClientContext.zig +++ b/src/http/h3_client/ClientContext.zig @@ -103,11 +103,11 @@ pub fn streamBodyByHttpId(async_http_id: u32, ended: bool) void { const log = bun.Output.scoped(.h3_client, .hidden); -const ClientSession = @import("./ClientSession.zig"); -const H3 = @import("../H3Client.zig"); -const PendingConnect = @import("./PendingConnect.zig"); -const Stream = @import("./Stream.zig"); -const callbacks = @import("./callbacks.zig"); +const ClientSession = @import("./ClientSession.rust"); +const H3 = @import("../H3Client.rust"); +const PendingConnect = @import("./PendingConnect.rust"); +const Stream = @import("./Stream.rust"); +const callbacks = @import("./callbacks.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/h3_client/ClientSession.zig b/src/http/h3_client/ClientSession.zig index 2dd79a8c404..0aabfd94835 100644 --- a/src/http/h3_client/ClientSession.zig +++ b/src/http/h3_client/ClientSession.zig @@ -1,7 +1,7 @@ //! One QUIC connection to an origin. Owns its UDP endpoint via quic.c and //! multiplexes `Stream`s, each bound 1:1 to an `HTTPClient`. The `qsocket` //! pointer becomes dangling after `callbacks.onConnClose`, so every accessor -//! checks `closed` first. See `src/http/H3Client.zig` for the module-level +//! checks `closed` first. See `src/http/H3Client.rust` for the module-level //! overview. const ClientSession = @This(); @@ -255,10 +255,10 @@ const HeaderResult = enum { has_body, finished }; const log = bun.Output.scoped(.h3_client, .hidden); -const ClientContext = @import("./ClientContext.zig"); -const H3 = @import("../H3Client.zig"); -const Stream = @import("./Stream.zig"); -const encode = @import("./encode.zig"); +const ClientContext = @import("./ClientContext.rust"); +const H3 = @import("../H3Client.rust"); +const Stream = @import("./Stream.rust"); +const encode = @import("./encode.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/h3_client/Stream.zig b/src/http/h3_client/Stream.zig index 7179f551af4..90d319c840f 100644 --- a/src/http/h3_client/Stream.zig +++ b/src/http/h3_client/Stream.zig @@ -36,8 +36,8 @@ pub fn abort(this: *Stream) void { if (this.qstream) |qs| qs.close(); } -const ClientSession = @import("./ClientSession.zig"); -const H3 = @import("../H3Client.zig"); +const ClientSession = @import("./ClientSession.rust"); +const H3 = @import("../H3Client.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/h3_client/callbacks.zig b/src/http/h3_client/callbacks.zig index 4e81d561ae1..3b6d48ac426 100644 --- a/src/http/h3_client/callbacks.zig +++ b/src/http/h3_client/callbacks.zig @@ -1,9 +1,9 @@ -//! lsquic → Zig callbacks for the HTTP/3 client. Registered on the +//! lsquic → Rust callbacks for the HTTP/3 client. Registered on the //! `quic.Context` from `ClientContext.getOrCreate`; lsquic invokes these from //! inside `process_conns` on the HTTP thread. Each one resolves the //! `ClientSession` / `Stream` from the ext slot and forwards into the //! corresponding session/stream method so the protocol logic stays in -//! `ClientSession.zig` / `encode.zig`. +//! `ClientSession.rust` / `encode.rust`. pub fn register(qctx: *quic.Context) void { qctx.onHskDone(onHskDone); @@ -139,11 +139,11 @@ fn onStreamClose(s: *quic.Stream) callconv(.c) void { const log = bun.Output.scoped(.h3_client, .hidden); -const ClientContext = @import("./ClientContext.zig"); -const ClientSession = @import("./ClientSession.zig"); -const H3 = @import("../H3Client.zig"); -const Stream = @import("./Stream.zig"); -const encode = @import("./encode.zig"); +const ClientContext = @import("./ClientContext.rust"); +const ClientSession = @import("./ClientSession.rust"); +const H3 = @import("../H3Client.rust"); +const Stream = @import("./Stream.rust"); +const encode = @import("./encode.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/h3_client/encode.zig b/src/http/h3_client/encode.zig index 29e9846bfb9..28e9117a39a 100644 --- a/src/http/h3_client/encode.zig +++ b/src/http/h3_client/encode.zig @@ -1,6 +1,6 @@ //! Request-side framing for the HTTP/3 client: build the QPACK header list //! from `HTTPClient.buildRequest` and drain the request body (inline bytes or -//! a JS streaming sink) onto the lsquic stream. Mirrors `h2_client/encode.zig`. +//! a JS streaming sink) onto the lsquic stream. Mirrors `h2_client/encode.rust`. /// Build pseudo-headers + user headers and send them on `qs`, then kick off /// body transmission. Called from `callbacks.onStreamOpen` once lsquic hands @@ -122,8 +122,8 @@ pub fn drainSendBody(stream: *Stream, qs: *quic.Stream) void { } } -const ClientSession = @import("./ClientSession.zig"); -const Stream = @import("./Stream.zig"); +const ClientSession = @import("./ClientSession.rust"); +const Stream = @import("./Stream.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http/http.zig b/src/http/http.zig index 2d777c6169a..e832e33cf59 100644 --- a/src/http/http.zig +++ b/src/http/http.zig @@ -723,7 +723,7 @@ pending_h2: ?*H2.PendingConnect = null, signals: Signals = .{}, async_http_id: u32 = 0, hostname: ?[]u8 = null, -unix_socket_path: jsc.ZigString.Slice = jsc.ZigString.Slice.empty, +unix_socket_path: jsc.RustString.Slice = jsc.RustString.Slice.empty, pub fn deinit(this: *HTTPClient) void { if (this.redirect.len > 0) { @@ -755,7 +755,7 @@ pub fn deinit(this: *HTTPClient) void { if (this.custom_ssl_ctx) |ctx| ctx.deref(); this.custom_ssl_ctx = null; this.unix_socket_path.deinit(); - this.unix_socket_path = jsc.ZigString.Slice.empty; + this.unix_socket_path = jsc.RustString.Slice.empty; } pub fn isKeepAlivePossible(this: *HTTPClient) bool { @@ -778,7 +778,7 @@ pub fn isKeepAlivePossible(this: *HTTPClient) bool { /// /// target_hostname in the pool stores url.hostname (the CONNECT TCP target /// at writeProxyConnect line 346). But the inner TLS SNI/cert verification -/// uses hostname orelse url.hostname (ProxyTunnel.zig:44). If a Host header +/// uses hostname orelse url.hostname (ProxyTunnel.rust:44). If a Host header /// override sets hostname != url.hostname, two requests to different IPs /// with the same Host header must NOT share a tunnel — they're physically /// connected to different servers. Hashing hostname here catches that. @@ -931,7 +931,7 @@ pub fn headerStr(this: *const HTTPClient, ptr: api.StringPointer) string { return this.header_buf[ptr.offset..][0..ptr.length]; } -pub const HeaderBuilder = @import("./HeaderBuilder.zig"); +pub const HeaderBuilder = @import("./HeaderBuilder.rust"); pub fn buildRequest(this: *HTTPClient, body_len: usize) picohttp.Request { var header_count: usize = 0; @@ -1130,7 +1130,7 @@ pub fn doRedirect( } this.unix_socket_path.deinit(); - this.unix_socket_path = jsc.ZigString.Slice.empty; + this.unix_socket_path = jsc.RustString.Slice.empty; // TODO: what we do with stream body? const request_body = if (this.state.flags.resend_request_body_on_redirect and this.state.original_request_body == .bytes) this.state.original_request_body.bytes @@ -2399,7 +2399,7 @@ fn doRedirectMultiplexed(this: *HTTPClient) void { this.flags.is_streaming_request_body = false; } this.unix_socket_path.deinit(); - this.unix_socket_path = jsc.ZigString.Slice.empty; + this.unix_socket_path = jsc.RustString.Slice.empty; const request_body = if (this.state.flags.resend_request_body_on_redirect and this.state.original_request_body == .bytes) this.state.original_request_body.bytes else @@ -3259,37 +3259,37 @@ pub const ThreadlocalAsyncHTTP = struct { async_http: AsyncHTTP, }; -pub const ETag = @import("../http_types/ETag.zig"); -pub const Method = @import("../http_types/Method.zig").Method; -pub const Headers = @import("./Headers.zig"); -pub const MimeType = @import("../http_types/MimeType.zig"); -pub const URLPath = @import("../http_types/URLPath.zig"); -pub const Encoding = @import("../http_types/Encoding.zig").Encoding; -pub const Decompressor = @import("./Decompressor.zig").Decompressor; -pub const Signals = @import("./Signals.zig"); -pub const ThreadSafeStreamBuffer = @import("./ThreadSafeStreamBuffer.zig"); -pub const HTTPThread = @import("./HTTPThread.zig"); -pub const NewHTTPContext = @import("./HTTPContext.zig").NewHTTPContext; -pub const AsyncHTTP = @import("./AsyncHTTP.zig"); -pub const InternalState = @import("./InternalState.zig"); -pub const CertificateInfo = @import("./CertificateInfo.zig"); -pub const FetchRedirect = @import("../http_types/FetchRedirect.zig").FetchRedirect; -pub const FetchCacheMode = @import("../http_types/FetchCacheMode.zig").FetchCacheMode; -pub const FetchRequestMode = @import("../http_types/FetchRequestMode.zig").FetchRequestMode; -pub const InitError = @import("./InitError.zig").InitError; -pub const HTTPRequestBody = @import("./HTTPRequestBody.zig").HTTPRequestBody; -pub const SendFile = @import("./SendFile.zig"); -pub const HeaderValueIterator = @import("./HeaderValueIterator.zig"); -pub const H2 = @import("./H2Client.zig"); -pub const H2Wire = @import("./H2FrameParser.zig"); -pub const H3 = @import("./H3Client.zig"); +pub const ETag = @import("../http_types/ETag.rust"); +pub const Method = @import("../http_types/Method.rust").Method; +pub const Headers = @import("./Headers.rust"); +pub const MimeType = @import("../http_types/MimeType.rust"); +pub const URLPath = @import("../http_types/URLPath.rust"); +pub const Encoding = @import("../http_types/Encoding.rust").Encoding; +pub const Decompressor = @import("./Decompressor.rust").Decompressor; +pub const Signals = @import("./Signals.rust"); +pub const ThreadSafeStreamBuffer = @import("./ThreadSafeStreamBuffer.rust"); +pub const HTTPThread = @import("./HTTPThread.rust"); +pub const NewHTTPContext = @import("./HTTPContext.rust").NewHTTPContext; +pub const AsyncHTTP = @import("./AsyncHTTP.rust"); +pub const InternalState = @import("./InternalState.rust"); +pub const CertificateInfo = @import("./CertificateInfo.rust"); +pub const FetchRedirect = @import("../http_types/FetchRedirect.rust").FetchRedirect; +pub const FetchCacheMode = @import("../http_types/FetchCacheMode.rust").FetchCacheMode; +pub const FetchRequestMode = @import("../http_types/FetchRequestMode.rust").FetchRequestMode; +pub const InitError = @import("./InitError.rust").InitError; +pub const HTTPRequestBody = @import("./HTTPRequestBody.rust").HTTPRequestBody; +pub const SendFile = @import("./SendFile.rust"); +pub const HeaderValueIterator = @import("./HeaderValueIterator.rust"); +pub const H2 = @import("./H2Client.rust"); +pub const H2Wire = @import("./H2FrameParser.rust"); +pub const H3 = @import("./H3Client.rust"); const string = []const u8; -const HTTPCertError = @import("./HTTPCertError.zig"); -const ProxyTunnel = @import("./ProxyTunnel.zig"); +const HTTPCertError = @import("./HTTPCertError.rust"); +const ProxyTunnel = @import("./ProxyTunnel.rust"); const std = @import("std"); -const URL = @import("../url/url.zig").URL; +const URL = @import("../url/url.rust").URL; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/http/websocket.zig b/src/http/websocket.zig index 26a5852e686..1fb4f3266f5 100644 --- a/src/http/websocket.zig +++ b/src/http/websocket.zig @@ -1,4 +1,4 @@ -// This code is based on https://github.com/frmdstryr/zhp/blob/a4b5700c289c3619647206144e10fb414113a888/src/websocket.zig +// This code is based on https://github.com/frmdstryr/zhp/blob/a4b5700c289c3619647206144e10fb414113a888/src/websocket.rust // Thank you @frmdstryr. pub const Opcode = enum(u4) { diff --git a/src/http/websocket_http_client.zig b/src/http/websocket_http_client.zig index 1592566a6aa..93f18b56dd4 100644 --- a/src/http/websocket_http_client.zig +++ b/src/http/websocket_http_client.zig @@ -6,5 +6,5 @@ pub const WebSocketHTTPSClient = upgrade_client.NewHTTPUpgradeClient(true); pub const WebSocketClient = websocket_client.NewWebSocketClient(false); pub const WebSocketClientTLS = websocket_client.NewWebSocketClient(true); -const upgrade_client = @import("../http_jsc/websocket_client/WebSocketUpgradeClient.zig"); -const websocket_client = @import("../http_jsc/websocket_client.zig"); +const upgrade_client = @import("../http_jsc/websocket_client/WebSocketUpgradeClient.rust"); +const websocket_client = @import("../http_jsc/websocket_client.rust"); diff --git a/src/http/zlib.zig b/src/http/zlib.zig index f1669af4ad4..43c733602a5 100644 --- a/src/http/zlib.zig +++ b/src/http/zlib.zig @@ -27,7 +27,7 @@ pub fn decompress(compressed_data: []const u8, output: *MutableString, allocator reader.deinit(); } -const Zlib = @import("../zlib/zlib.zig"); +const Zlib = @import("../zlib/zlib.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/http_jsc/headers_jsc.zig b/src/http_jsc/headers_jsc.zig index b9991efe833..c729fc74ec6 100644 --- a/src/http_jsc/headers_jsc.zig +++ b/src/http_jsc/headers_jsc.zig @@ -9,7 +9,7 @@ pub fn toFetchHeaders(this: *Headers, global: *bun.jsc.JSGlobalObject) bun.JSErr global, this.entries.items(.name).ptr, this.entries.items(.value).ptr, - &bun.ZigString.fromBytes(this.buf.items), + &bun.RustString.fromBytes(this.buf.items), @truncate(this.entries.len), ) orelse return error.JSError; return headers; @@ -18,26 +18,26 @@ pub fn toFetchHeaders(this: *Headers, global: *bun.jsc.JSGlobalObject) bun.JSErr pub const H2TestingAPIs = struct { pub fn liveCounts(globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 2); - obj.put(globalThis, jsc.ZigString.static("sessions"), .jsNumber(H2Client.live_sessions.load(.monotonic))); - obj.put(globalThis, jsc.ZigString.static("streams"), .jsNumber(H2Client.live_streams.load(.monotonic))); + obj.put(globalThis, jsc.RustString.static("sessions"), .jsNumber(H2Client.live_sessions.load(.monotonic))); + obj.put(globalThis, jsc.RustString.static("streams"), .jsNumber(H2Client.live_streams.load(.monotonic))); return obj; } }; pub const H3TestingAPIs = struct { /// Named distinctly from H2's `liveCounts` because generate-js2native.ts - /// mangles `[^A-Za-z]` to `_`, so `H2Client.zig` and `H3Client.zig` produce + /// mangles `[^A-Za-z]` to `_`, so `H2Client.rust` and `H3Client.rust` produce /// the same path prefix and the function name has to differ. pub fn quicLiveCounts(globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 2); - obj.put(globalThis, jsc.ZigString.static("sessions"), .jsNumber(H3Client.live_sessions.load(.monotonic))); - obj.put(globalThis, jsc.ZigString.static("streams"), .jsNumber(H3Client.live_streams.load(.monotonic))); + obj.put(globalThis, jsc.RustString.static("sessions"), .jsNumber(H3Client.live_sessions.load(.monotonic))); + obj.put(globalThis, jsc.RustString.static("streams"), .jsNumber(H3Client.live_streams.load(.monotonic))); return obj; } }; -const H2Client = @import("../http/H2Client.zig"); -const H3Client = @import("../http/H3Client.zig"); +const H2Client = @import("../http/H2Client.rust"); +const H3Client = @import("../http/H3Client.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/http_jsc/method_jsc.zig b/src/http_jsc/method_jsc.zig index ecf1a426c7c..77709c76391 100644 --- a/src/http_jsc/method_jsc.zig +++ b/src/http_jsc/method_jsc.zig @@ -4,7 +4,7 @@ extern "c" fn Bun__HTTPMethod__toJS(method: Method, globalObject: *jsc.JSGlobalO pub const toJS = Bun__HTTPMethod__toJS; -const Method = @import("../http_types/Method.zig").Method; +const Method = @import("../http_types/Method.rust").Method; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/http_jsc/websocket_client.zig b/src/http_jsc/websocket_client.zig index 6c1d301cd9c..b021b2b288a 100644 --- a/src/http_jsc/websocket_client.zig +++ b/src/http_jsc/websocket_client.zig @@ -1,4 +1,4 @@ -/// This is the Zig implementation of the WebSocket client. +/// This is the Rust implementation of the WebSocket client. /// /// It manages the WebSocket connection, including sending and receiving data, /// handling connection events, and managing the WebSocket state. @@ -87,7 +87,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { return true; } - /// Handler set referenced by `dispatch.zig` (kind = `.ws_client[_tls]`). + /// Handler set referenced by `dispatch.rust` (kind = `.ws_client[_tls]`). /// Replaces the C++→`register()`→`us_socket_context_on_*` round-trip. pub const onClose = handleClose; pub const onData = handleData; @@ -295,14 +295,14 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { this.terminate(ErrorCode.invalid_utf8); return; }; - var outstring = jsc.ZigString.Empty; + var outstring = jsc.RustString.Empty; if (utf16_bytes_) |utf16| { - outstring = jsc.ZigString.from16Slice(utf16); + outstring = jsc.RustString.from16Slice(utf16); outstring.markGlobal(); jsc.markBinding(@src()); out.didReceiveText(false, &outstring); } else { - outstring = jsc.ZigString.init(data_); + outstring = jsc.RustString.init(data_); jsc.markBinding(@src()); out.didReceiveText(true, &outstring); } @@ -1135,7 +1135,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { pub fn writeString( this: *WebSocket, - str_: *const jsc.ZigString, + str_: *const jsc.RustString, op: u8, ) callconv(.c) void { // See writeBinaryData() — tunnel.write() can re-enter fail(). @@ -1205,7 +1205,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { this.deref(); } - pub fn close(this: *WebSocket, code: u16, reason: ?*const jsc.ZigString) callconv(.c) void { + pub fn close(this: *WebSocket, code: u16, reason: ?*const jsc.RustString) callconv(.c) void { // In tunnel mode, SSLWrapper.writeData() (via sendCloseWithBody → // enqueueEncodedBytes → tunnel.write) can synchronously fire // onClose → ws.fail() → cancel() → clearData() and free `this` @@ -1773,13 +1773,13 @@ const log = Output.scoped(.WebSocketClient, .visible); const string = []const u8; -const WebSocketDeflate = @import("./websocket_client/WebSocketDeflate.zig"); -const WebSocketProxyTunnel = @import("./websocket_client/WebSocketProxyTunnel.zig"); +const WebSocketDeflate = @import("./websocket_client/WebSocketDeflate.rust"); +const WebSocketProxyTunnel = @import("./websocket_client/WebSocketProxyTunnel.rust"); const std = @import("std"); -const CppWebSocket = @import("./websocket_client/CppWebSocket.zig").CppWebSocket; +const CppWebSocket = @import("./websocket_client/CppWebSocket.rust").CppWebSocket; -const Opcode = @import("../http/websocket.zig").Opcode; -const WebsocketHeader = @import("../http/websocket.zig").WebsocketHeader; +const Opcode = @import("../http/websocket.rust").Opcode; +const WebsocketHeader = @import("../http/websocket.rust").WebsocketHeader; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/http_jsc/websocket_client/CppWebSocket.zig b/src/http_jsc/websocket_client/CppWebSocket.zig index aab20c0e7b7..6215c6c55ac 100644 --- a/src/http_jsc/websocket_client/CppWebSocket.zig +++ b/src/http_jsc/websocket_client/CppWebSocket.zig @@ -1,9 +1,9 @@ -/// This is the wrapper between Zig and C++ for WebSocket client functionality. It corresponds to the `WebCore::WebSocket` class (WebSocket.cpp). +/// This is the wrapper between Rust and C++ for WebSocket client functionality. It corresponds to the `WebCore::WebSocket` class (WebSocket.cpp). /// /// Each method in this interface ensures proper JavaScript event loop integration by entering /// and exiting the event loop around C++ function calls, maintaining proper execution context. /// -/// The external C++ functions are imported and wrapped with Zig functions that handle +/// The external C++ functions are imported and wrapped with Rust functions that handle /// the event loop management automatically. /// /// Note: This is specifically for WebSocket client implementations, not for server-side WebSockets. @@ -25,7 +25,7 @@ pub const CppWebSocket = opaque { ) void; extern fn WebSocket__didAbruptClose(websocket_context: *CppWebSocket, reason: ErrorCode) void; extern fn WebSocket__didClose(websocket_context: *CppWebSocket, code: u16, reason: *const bun.String) void; - extern fn WebSocket__didReceiveText(websocket_context: *CppWebSocket, clone: bool, text: *const jsc.ZigString) void; + extern fn WebSocket__didReceiveText(websocket_context: *CppWebSocket, clone: bool, text: *const jsc.RustString) void; extern fn WebSocket__didReceiveBytes(websocket_context: *CppWebSocket, bytes: [*]const u8, byte_len: usize, opcode: u8) void; extern fn WebSocket__rejectUnauthorized(websocket_context: *CppWebSocket) bool; pub fn didAbruptClose(this: *CppWebSocket, reason: ErrorCode) void { @@ -40,7 +40,7 @@ pub const CppWebSocket = opaque { defer loop.exit(); WebSocket__didClose(this, code, reason); } - pub fn didReceiveText(this: *CppWebSocket, clone: bool, text: *const jsc.ZigString) void { + pub fn didReceiveText(this: *CppWebSocket, clone: bool, text: *const jsc.RustString) void { const loop = jsc.VirtualMachine.get().eventLoop(); loop.enter(); defer loop.exit(); @@ -88,8 +88,8 @@ pub const CppWebSocket = opaque { } }; -const WebSocketDeflate = @import("./WebSocketDeflate.zig"); -const ErrorCode = @import("../websocket_client.zig").ErrorCode; +const WebSocketDeflate = @import("./WebSocketDeflate.rust"); +const ErrorCode = @import("../websocket_client.rust").ErrorCode; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/http_jsc/websocket_client/WebSocketProxy.zig b/src/http_jsc/websocket_client/WebSocketProxy.zig index 4565717919c..c91c7a772a7 100644 --- a/src/http_jsc/websocket_client/WebSocketProxy.zig +++ b/src/http_jsc/websocket_client/WebSocketProxy.zig @@ -67,5 +67,5 @@ pub fn deinit(self: *WebSocketProxy) void { } } -const WebSocketProxyTunnel = @import("./WebSocketProxyTunnel.zig"); +const WebSocketProxyTunnel = @import("./WebSocketProxyTunnel.rust"); const bun = @import("bun"); diff --git a/src/http_jsc/websocket_client/WebSocketProxyTunnel.zig b/src/http_jsc/websocket_client/WebSocketProxyTunnel.zig index 080856404fb..9026baa8cce 100644 --- a/src/http_jsc/websocket_client/WebSocketProxyTunnel.zig +++ b/src/http_jsc/websocket_client/WebSocketProxyTunnel.zig @@ -50,7 +50,7 @@ pub const UpgradeClientUnion = union(enum) { } }; -const WebSocketClient = @import("../websocket_client.zig").NewWebSocketClient(false); +const WebSocketClient = @import("../websocket_client.rust").NewWebSocketClient(false); ref_count: RefCount, /// Reference to the upgrade client (WebSocketUpgradeClient) - used during handshake phase @@ -360,9 +360,9 @@ pub export fn WebSocketProxyTunnel__setConnectedWebSocket(tunnel: *WebSocketProx const log = bun.Output.scoped(.WebSocketProxyTunnel, .visible); -const ErrorCode = @import("../websocket_client.zig").ErrorCode; -const NewHTTPUpgradeClient = @import("./WebSocketUpgradeClient.zig").NewHTTPUpgradeClient; -const SSLWrapper = @import("../../runtime/socket/ssl_wrapper.zig").SSLWrapper; +const ErrorCode = @import("../websocket_client.rust").ErrorCode; +const NewHTTPUpgradeClient = @import("./WebSocketUpgradeClient.rust").NewHTTPUpgradeClient; +const SSLWrapper = @import("../../runtime/socket/ssl_wrapper.rust").SSLWrapper; const bun = @import("bun"); const BoringSSL = bun.BoringSSL; diff --git a/src/http_jsc/websocket_client/WebSocketUpgradeClient.zig b/src/http_jsc/websocket_client/WebSocketUpgradeClient.zig index 0243a526716..ea30e1a7520 100644 --- a/src/http_jsc/websocket_client/WebSocketUpgradeClient.zig +++ b/src/http_jsc/websocket_client/WebSocketUpgradeClient.zig @@ -77,7 +77,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { const HTTPClient = @This(); - /// Handler set referenced by `dispatch.zig` (kind = `.ws_client_upgrade[_tls]`). + /// Handler set referenced by `dispatch.rust` (kind = `.ws_client_upgrade[_tls]`). /// The `register()` C++ round-trip that previously installed these on a /// shared `us_socket_context_t` is gone — sockets are stamped with the /// kind at connect time and routed here statically. @@ -152,15 +152,15 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { defer pathname_slice.deinit(); defer client_protocol_slice.deinit(); - var proxy_host_slice: ?jsc.ZigString.Slice = null; + var proxy_host_slice: ?jsc.RustString.Slice = null; defer if (proxy_host_slice) |s| s.deinit(); if (proxy_host) |ph| proxy_host_slice = ph.toUTF8(allocator); - var target_authorization_slice: ?jsc.ZigString.Slice = null; + var target_authorization_slice: ?jsc.RustString.Slice = null; defer if (target_authorization_slice) |s| s.deinit(); if (target_authorization) |ta| target_authorization_slice = ta.toUTF8(allocator); - var unix_socket_path_slice: ?jsc.ZigString.Slice = null; + var unix_socket_path_slice: ?jsc.RustString.Slice = null; defer if (unix_socket_path_slice) |s| s.deinit(); if (unix_socket_path) |usp| unix_socket_path_slice = usp.toUTF8(allocator); @@ -196,7 +196,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { if (using_proxy) { // Parse proxy authorization (temporary, freed after building CONNECT request) var proxy_auth_slice: ?[]const u8 = null; - var proxy_auth_decoded: ?jsc.ZigString.Slice = null; + var proxy_auth_decoded: ?jsc.RustString.Slice = null; defer if (proxy_auth_decoded) |s| s.deinit(); if (proxy_authorization) |auth| { @@ -1183,7 +1183,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { /// Decodes an array of BunString header name/value pairs to UTF-8 up front. /// /// The BunString values may be backed by 8-bit Latin1 or 16-bit UTF-16 -/// `WTFStringImpl`s. Calling `.slice()` on a ZigString wrapper that was built +/// `WTFStringImpl`s. Calling `.slice()` on a RustString wrapper that was built /// from a non-ASCII WTFStringImpl returns raw Latin1 or UTF-16 code units, /// which then corrupts the HTTP upgrade request and can cause heap corruption. /// @@ -1191,7 +1191,7 @@ pub fn NewHTTPUpgradeClient(comptime ssl: bool) type { /// (no allocation) or allocates a UTF-8 copy. The resulting slices are stored /// here so buildRequestBody / buildConnectRequest can index them by []const u8. const Headers8Bit = struct { - slices: []jsc.ZigString.Slice, + slices: []jsc.RustString.Slice, name_slices: [][]const u8, value_slices: [][]const u8, allocator: std.mem.Allocator, @@ -1213,7 +1213,7 @@ const Headers8Bit = struct { const names_in = names_ptr.?[0..len]; const values_in = values_ptr.?[0..len]; - const slices = try allocator.alloc(jsc.ZigString.Slice, len * 2); + const slices = try allocator.alloc(jsc.RustString.Slice, len * 2); errdefer allocator.free(slices); const name_slices = try allocator.alloc([]const u8, len); @@ -1526,7 +1526,7 @@ pub fn parseSSLConfig( /// Exported for C++ so error/early-return paths in JSWebSocket.cpp and /// WebSocket.cpp can release ownership without leaking the heap allocation /// (and all duped cert/key/CA strings inside it) when `connect()` never -/// hands the pointer off to a Zig upgrade client. +/// hands the pointer off to a Rust upgrade client. pub fn freeSSLConfig(config: *SSLConfig) callconv(.c) void { config.deinit(); bun.default_allocator.destroy(config); @@ -1537,13 +1537,13 @@ comptime { @export(&freeSSLConfig, .{ .name = "Bun__WebSocket__freeSSLConfig" }); } -const WebSocketDeflate = @import("./WebSocketDeflate.zig"); -const WebSocketProxy = @import("./WebSocketProxy.zig"); -const WebSocketProxyTunnel = @import("./WebSocketProxyTunnel.zig"); +const WebSocketDeflate = @import("./WebSocketDeflate.rust"); +const WebSocketProxy = @import("./WebSocketProxy.rust"); +const WebSocketProxyTunnel = @import("./WebSocketProxyTunnel.rust"); const std = @import("std"); -const CppWebSocket = @import("./CppWebSocket.zig").CppWebSocket; +const CppWebSocket = @import("./CppWebSocket.rust").CppWebSocket; -const websocket_client = @import("../websocket_client.zig"); +const websocket_client = @import("../websocket_client.rust"); const ErrorCode = websocket_client.ErrorCode; const bun = @import("bun"); diff --git a/src/http_types/Cargo.toml b/src/http_types/Cargo.toml index f2412bff8b4..989cbc0f3ef 100644 --- a/src/http_types/Cargo.toml +++ b/src/http_types/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true path = "lib.rs" [features] -# Zig `Environment.ci_assert` → opt-in extra invariant checks (off by default). +# Rust `Environment.ci_assert` → opt-in extra invariant checks (off by default). ci_assert = [] [dependencies] diff --git a/src/http_types/FetchCacheMode.zig b/src/http_types/FetchCacheMode.zig index a97cb08fc36..8c3f9dc8167 100644 --- a/src/http_types/FetchCacheMode.zig +++ b/src/http_types/FetchCacheMode.zig @@ -15,7 +15,7 @@ pub const FetchCacheMode = enum(u3) { .{ "force-cache", .@"force-cache" }, .{ "only-if-cached", .@"only-if-cached" }, }); - pub const toJS = @import("../http_jsc/fetch_enums_jsc.zig").fetchCacheModeToJS; + pub const toJS = @import("../http_jsc/fetch_enums_jsc.rust").fetchCacheModeToJS; }; const bun = @import("bun"); diff --git a/src/http_types/FetchRedirect.zig b/src/http_types/FetchRedirect.zig index 6598d45aebc..7ffd598ec66 100644 --- a/src/http_types/FetchRedirect.zig +++ b/src/http_types/FetchRedirect.zig @@ -8,7 +8,7 @@ pub const FetchRedirect = enum(u2) { .{ "manual", .manual }, .{ "error", .@"error" }, }); - pub const toJS = @import("../http_jsc/fetch_enums_jsc.zig").fetchRedirectToJS; + pub const toJS = @import("../http_jsc/fetch_enums_jsc.rust").fetchRedirectToJS; }; const bun = @import("bun"); diff --git a/src/http_types/FetchRequestMode.zig b/src/http_types/FetchRequestMode.zig index c6bb665f21d..325ca0e863b 100644 --- a/src/http_types/FetchRequestMode.zig +++ b/src/http_types/FetchRequestMode.zig @@ -11,7 +11,7 @@ pub const FetchRequestMode = enum(u2) { .{ "cors", .cors }, .{ "navigate", .navigate }, }); - pub const toJS = @import("../http_jsc/fetch_enums_jsc.zig").fetchRequestModeToJS; + pub const toJS = @import("../http_jsc/fetch_enums_jsc.rust").fetchRequestModeToJS; }; const bun = @import("bun"); diff --git a/src/http_types/Method.zig b/src/http_types/Method.zig index 9249273b6fa..a7e3ab41f92 100644 --- a/src/http_types/Method.zig +++ b/src/http_types/Method.zig @@ -167,7 +167,7 @@ pub const Method = enum(u8) { return Map.get(str); } - pub const toJS = @import("../http_jsc/method_jsc.zig").toJS; + pub const toJS = @import("../http_jsc/method_jsc.rust").toJS; pub const Optional = union(enum) { any: void, diff --git a/src/http_types/MimeType.zig b/src/http_types/MimeType.zig index 8ea3e512f6e..671f7687816 100644 --- a/src/http_types/MimeType.zig +++ b/src/http_types/MimeType.zig @@ -5,7 +5,7 @@ category: Category, pub const Map = bun.StringHashMap(Table); -pub const Table = @import("./mime_type_list_enum.zig").MimeTypeList; +pub const Table = @import("./mime_type_list_enum.rust").MimeTypeList; pub const Compact = struct { value: Table, @@ -391,7 +391,7 @@ pub fn byExtensionNoDefault(ext_without_leading_dot: string) ?MimeType { } // this is partially auto-generated -pub const all = @import("./mime_type_list_enum.zig").MimeTypeList.all; +pub const all = @import("./mime_type_list_enum.rust").MimeTypeList.all; // TODO: do a comptime static hash map for this // its too many branches to use ComptimeStringMap @@ -649,10 +649,10 @@ pub const extensions = ComptimeStringMap(Table, .{ .{ "eps", .@"application/postscript" }, .{ "epub", .@"application/epub+zip" }, .{ "es", .@"application/ecmascript" }, - .{ "es3", .@"application/vnd.eszigno3+xml" }, + .{ "es3", .@"application/vnd.esrustno3+xml" }, .{ "esa", .@"application/vnd.osgi.subsystem" }, .{ "esf", .@"application/vnd.epson.esf" }, - .{ "et3", .@"application/vnd.eszigno3+xml" }, + .{ "et3", .@"application/vnd.esrustno3+xml" }, .{ "etx", .@"text/x-setext" }, .{ "eva", .@"application/x-eva" }, .{ "evy", .@"application/x-envoy" }, @@ -1628,7 +1628,7 @@ pub fn sniff(bytes: []const u8) ?MimeType { const string = []const u8; const std = @import("std"); -const Loader = @import("../bundler/options.zig").Loader; +const Loader = @import("../bundler/options.rust").Loader; const bun = @import("bun"); const ComptimeStringMap = bun.ComptimeStringMap; diff --git a/src/http_types/URLPath.zig b/src/http_types/URLPath.zig index b3b41fa1552..aa818d61746 100644 --- a/src/http_types/URLPath.zig +++ b/src/http_types/URLPath.zig @@ -44,7 +44,7 @@ pub fn parse(possibly_encoded_pathname_: string) !URLPath { var needs_redirect = false; if (strings.containsChar(decoded_pathname, '%')) { - // https://github.com/ziglang/zig/issues/14148 + // https://github.com/rustlang/rust/issues/14148 var possibly_encoded_pathname: []u8 = switch (decoded_pathname.len) { 0...1024 => &temp_path_buf, else => &big_temp_path_buf, @@ -144,7 +144,7 @@ pub fn parse(possibly_encoded_pathname_: string) !URLPath { const string = []const u8; const std = @import("std"); -const PercentEncoding = @import("../url/url.zig").PercentEncoding; +const PercentEncoding = @import("../url/url.rust").PercentEncoding; const bun = @import("bun"); const strings = bun.strings; diff --git a/src/http_types/mime_type_list.txt b/src/http_types/mime_type_list.txt index c6927e83fd1..a6b07c9e5fe 100644 --- a/src/http_types/mime_type_list.txt +++ b/src/http_types/mime_type_list.txt @@ -1393,7 +1393,7 @@ application/vnd.contact.cmsg application/vnd.dreamfactory application/vnd.ecdis-update application/vnd.ecowin.chart -application/vnd.eszigno3+xml +application/vnd.esrustno3+xml application/vnd.etsi.aoc+xml application/vnd.etsi.cug+xml application/vnd.etsi.sci+xml diff --git a/src/http_types/mime_type_list_enum.zig b/src/http_types/mime_type_list_enum.zig index aec6ed32be9..d7966c2c2fd 100644 --- a/src/http_types/mime_type_list_enum.zig +++ b/src/http_types/mime_type_list_enum.zig @@ -2,7 +2,7 @@ //! Do not edit manually //! To regenerate, run: //! ``` -//! bun run src/codegen/generate-compact-string-table.ts src/http/mime_type_list.txt src/http/mime_type_list_enum.zig MimeTypeList +//! bun run src/codegen/generate-compact-string-table.ts src/http/mime_type_list.txt src/http/mime_type_list_enum.rust MimeTypeList //! ``` pub const MimeTypeList = enum(u14) { const LengthGroupBits = 7; @@ -14,7 +14,7 @@ pub const MimeTypeList = enum(u14) { position: u7, }; - const _bytes = "application/cpl+xmlapplication/dca-rftapplication/edi-x12application/edifactapplication/elm+xmlapplication/epp+xmlapplication/expressapplication/fdt+xmlapplication/flexfecapplication/gml+xmlapplication/gpx+xmlapplication/its+xmlapplication/java-vmapplication/ld+jsonapplication/lgr+xmlapplication/lpf+zipapplication/n-quadsapplication/nasdataapplication/odm+xmlapplication/onenoteapplication/p21+zipapplication/pkixcmpapplication/pls+xmlapplication/prs.cwwapplication/prs.cynapplication/rdf+xmlapplication/rfc+xmlapplication/rsd+xmlapplication/rss+xmlapplication/sep+xmlapplication/sep-exiapplication/shf+xmlapplication/sru+xmlapplication/td+jsonapplication/tei+xmlapplication/vnd.ageapplication/vnd.bmiapplication/vnd.bpfapplication/vnd.dbfapplication/vnd.dnaapplication/vnd.dxrapplication/vnd.dzrapplication/vnd.fdfapplication/vnd.gmxapplication/vnd.hdtapplication/vnd.jamapplication/vnd.lasapplication/vnd.mcdapplication/vnd.mifapplication/vnd.obnapplication/vnd.rarapplication/vnd.sarapplication/vnd.shpapplication/vnd.shxapplication/vnd.svdapplication/vnd.tmlapplication/vnd.vcxapplication/vnd.vsfapplication/vnd.wmcapplication/vnd.wqdapplication/vnd.zulapplication/x-bcpioapplication/x-blorbapplication/x-bzip2application/x-cocoaapplication/x-envoyapplication/x-glulxapplication/x-latexapplication/x-pilotapplication/x-ustarapplication/x400-bpapplication/xml-dtdapplication/xop+xmlapplication/yin+xmlaudio/mpeg4-genericaudio/vnd.3gpp.iufpaudio/vnd.cisco.nseaudio/vnd.dlna.adtsaudio/vnd.dolby.mlpaudio/vnd.dolby.mpsaudio/vnd.dolby.pl2audio/vnd.hns.audioaudio/vnd.octel.sbcaudio/vorbis-configimage/heic-sequenceimage/heif-sequenceimage/x-mrsid-imageimage/x-xwindowdumpmessage/vnd.si.simpmessage/vnd.wfa.wscmultipart/encryptedmultipart/form-datatext/cache-manifesttext/cql-expressiontext/cql-identifiertext/prs.prop.logictext/rfc822-headerstext/vnd.curl.dcurltext/vnd.curl.mcurltext/vnd.curl.scurltext/vnd.ficlab.fltvideo/mpeg4-genericvideo/vnd.hns.videox-shader/x-fragmentapplication/ace+cborapplication/atom+xmlapplication/beep+xmlapplication/cbor-seqapplication/ccmp+xmlapplication/cdfx+xmlapplication/clue+xmlapplication/cnrp+xmlapplication/cose-keyapplication/csrattrsapplication/csta+xmlapplication/cu-seemeapplication/dash+xmlapplication/dns+jsonapplication/dssc+derapplication/dssc+xmlapplication/elm+jsonapplication/emma+xmlapplication/encaprtpapplication/epub+zipapplication/fastsoapapplication/fhir+xmlapplication/geo+jsonapplication/held+xmlapplication/jrd+jsonapplication/json-seqapplication/jwk+jsonapplication/lost+xmlapplication/mads+xmlapplication/mets+xmlapplication/mods+xmlapplication/mud+jsonapplication/passportapplication/pgp-keysapplication/pidf+xmlapplication/pkix-crlapplication/pskc+xmlapplication/pvd+jsonapplication/rlmi+xmlapplication/rpki-roaapplication/sbml+xmlapplication/smil+xmlapplication/soap+xmlapplication/srgs+xmlapplication/ssdl+xmlapplication/ssml+xmlapplication/swid+xmlapplication/ttml+xmlapplication/vnd.ankiapplication/vnd.bpf3application/vnd.curlapplication/vnd.dartapplication/vnd.hbciapplication/vnd.jispapplication/vnd.koanapplication/vnd.loomapplication/vnd.mferapplication/vnd.mfmpapplication/vnd.mseqapplication/vnd.nimnapplication/vnd.nitfapplication/vnd.palmapplication/vnd.pcosapplication/vnd.psfsapplication/vnd.semaapplication/vnd.semdapplication/vnd.semfapplication/vnd.smafapplication/vnd.ufdlapplication/vnd.xaraapplication/vnd.xfdlapplication/wsdl+xmlapplication/x-cdlinkapplication/x-ms-wmdapplication/x-ms-wmzapplication/x-msclipapplication/x-netcdfapplication/x-pkcs12application/x-subripapplication/x-sv4crcapplication/xaml+xmlapplication/xenc+xmlapplication/xmpp+xmlapplication/xslt+xmlapplication/xspf+xmlaudio/tetra_acelp_bbaudio/vnd.dece.audioaudio/vnd.dolby.pl2xaudio/vnd.dolby.pl2zaudio/vnd.everad.pljaudio/vnd.nortel.vbkaudio/x-pn-realaudioimage/vnd.sealed.pngimage/vnd.zbrush.pcxmodel/vnd.pytha.pyoxmultipart/byterangesmultipart/header-settext/vnd.iptc.newsmlvideo/vnd.dece.videovideo/vnd.sealed.swfvideo/vnd.youtube.ytapplication/3gpp-ims+xmlapplication/3gpphal+jsonapplication/andrew-insetapplication/atsc-dwd+xmlapplication/calendar+xmlapplication/captive+jsonapplication/cea-2018+xmlapplication/coap-payloadapplication/commongroundapplication/cose-key-setapplication/cstadata+xmlapplication/davmount+xmlapplication/geo+json-seqapplication/geoxacml+xmlapplication/java-archiveapplication/jf2feed+jsonapplication/jwk-set+jsonapplication/lostsync+xmlapplication/mac-binhex40application/mbms-msk+xmlapplication/metalink+xmlapplication/mosskey-dataapplication/ocsp-requestapplication/octet-streamapplication/pkix-pkipathapplication/problem+jsonapplication/prs.hpub+zipapplication/reputon+jsonapplication/secevent+jwtapplication/session-infoapplication/sparql-queryapplication/vnd.3gpp.lppapplication/vnd.3gpp.smsapplication/vnd.acucobolapplication/vnd.api+jsonapplication/vnd.claymoreapplication/vnd.cups-pdfapplication/vnd.cups-ppdapplication/vnd.cups-rawapplication/vnd.curl.carapplication/vnd.dece.zipapplication/vnd.dvb.dvbjapplication/vnd.ecip.rlpapplication/vnd.geo+jsonapplication/vnd.geospaceapplication/vnd.hal+jsonapplication/vnd.hp-pclxlapplication/vnd.httphoneapplication/vnd.igloaderapplication/vnd.intergeoapplication/vnd.intu.qboapplication/vnd.intu.qfxapplication/vnd.isac.fcsapplication/vnd.ms-excelapplication/vnd.ms-worksapplication/vnd.musicianapplication/vnd.ocf+cborapplication/vnd.oma.dcdcapplication/vnd.oma.pushapplication/vnd.onepagerapplication/vnd.paos.xmlapplication/vnd.preminetapplication/vnd.sbm.mid2application/vnd.trid.tptapplication/vnd.uoml+xmlapplication/vnd.vd-studyapplication/vnd.vel+jsonapplication/vnd.wap.wmlcapplication/vnd.webturboapplication/voicexml+xmlapplication/wspolicy+xmlapplication/x-bittorrentapplication/x-conferenceapplication/x-dtbncx+xmlapplication/x-dtbook+xmlapplication/x-font-type1application/x-font-vfontapplication/x-gramps-xmlapplication/x-javascriptapplication/x-mscardfileapplication/x-msdownloadapplication/x-msmetafileapplication/x-msscheduleapplication/x-msterminalapplication/x-t3vm-imageapplication/xcap-att+xmlimage/vnd.microsoft.iconimage/x-portable-graymaptext/html; charset=utf-8text/plain;charset=utf-8text/provenance-notationtext/prs.fallenstein.rsttext/vnd.motorola.reflextext/vnd.ms-mediapackagetext/vnd.senx.warpscripttext/vnd.si.uricataloguevideo/vnd.motorola.videoapplication/atomcat+xmlapplication/atomsvc+xmlapplication/cdmi-domainapplication/cdmi-objectapplication/dns-messageapplication/docbook+xmlapplication/edi-consentapplication/fastinfosetapplication/gltf-bufferapplication/hyperstudioapplication/ibe-pp-dataapplication/jsonml+jsonapplication/link-formatapplication/marcxml+xmlapplication/mathematicaapplication/mmt-aei+xmlapplication/mmt-usd+xmlapplication/msc-ivr+xmlapplication/problem+xmlapplication/prs.pluckerapplication/prs.xsf+xmlapplication/reginfo+xmlapplication/rpki-updownapplication/rtploopbackapplication/sensml+cborapplication/sensml+jsonapplication/set-paymentapplication/tamp-updateapplication/tlsrpt+gzipapplication/tlsrpt+jsonapplication/tve-triggerapplication/vnd.acucorpapplication/vnd.dpgraphapplication/vnd.dvb.aitapplication/vnd.dvb.pfrapplication/vnd.dynageoapplication/vnd.efi.imgapplication/vnd.efi.isoapplication/vnd.enlivenapplication/vnd.geonextapplication/vnd.geoplanapplication/vnd.hal+xmlapplication/vnd.hc+jsonapplication/vnd.hp-hpglapplication/vnd.hp-hpidapplication/vnd.hp-jlytapplication/vnd.kahootzapplication/vnd.ms-tnefapplication/vnd.nervanaapplication/vnd.oma.dcdapplication/vnd.osgi.dpapplication/vnd.panoplyapplication/vnd.rim.codapplication/vnd.rs-274xapplication/vnd.sbm.cidapplication/vnd.scribusapplication/vnd.seemailapplication/vnd.sqlite3application/vnd.sss-codapplication/vnd.sss-dtfapplication/vnd.sss-ntfapplication/vnd.trueappapplication/vnd.truedocapplication/vnd.uri-mapapplication/vnd.wap.sicapplication/vnd.wap.slcapplication/vnd.wfa.dppapplication/vnd.wfa.p2papplication/vnd.wfa.wscapplication/vnd.xmi+xmlapplication/vnd.yaowemeapplication/webassemblyapplication/x-chess-pgnapplication/x-httpd-phpapplication/x-xliff+xmlapplication/x-xpinstallapplication/xcap-el+xmlapplication/xcap-ns+xmlaudio/vnd.digital-windsaudio/vnd.dolby.heaac.1audio/vnd.dolby.heaac.2audio/vnd.dolby.pulse.1image/x-portable-anymapimage/x-portable-bitmapimage/x-portable-pixmapmessage/delivery-statusmessage/feedback-reportmessage/tracking-statusmodel/vnd.flatland.3dmlmultipart/voice-messagetext/css; charset=utf-8text/html; charset=utf8text/html;charset=utf-8text/vnd.dmclientscriptvideo/vnd.dlna.mpeg-ttsx-conference/x-cooltalkapplication/kpml-request+xmlapplication/load-control+xmlapplication/merge-patch+jsonapplication/mrb-consumer+xmlapplication/news-checkgroupsapplication/poc-settings+xmlapplication/rls-services+xmlapplication/route-s-tsid+xmlapplication/rpki-publicationapplication/samlmetadata+xmlapplication/scvp-cv-responseapplication/scvp-vp-responseapplication/set-registrationapplication/soap+fastinfosetapplication/tamp-apex-updateapplication/timestamped-dataapplication/urc-grpsheet+xmlapplication/urc-ressheet+xmlapplication/vnd.3gpp.bsf+xmlapplication/vnd.3gpp.sms+xmlapplication/vnd.amadeus+jsonapplication/vnd.amazon.ebookapplication/vnd.apple.pkpassapplication/vnd.artisan+jsonapplication/vnd.chemdraw+xmlapplication/vnd.coffeescriptapplication/vnd.contact.cmsgapplication/vnd.dreamfactoryapplication/vnd.ecdis-updateapplication/vnd.ecowin.chartapplication/vnd.eszigno3+xmlapplication/vnd.etsi.aoc+xmlapplication/vnd.etsi.cug+xmlapplication/vnd.etsi.sci+xmlapplication/vnd.etsi.tsl+xmlapplication/vnd.etsi.tsl.derapplication/vnd.groove-vcardapplication/vnd.jsk.isdn-ngnapplication/vnd.kde.kformulaapplication/vnd.kidspirationapplication/vnd.las.las+jsonapplication/vnd.noblenet-webapplication/vnd.novadigm.edmapplication/vnd.novadigm.edxapplication/vnd.novadigm.extapplication/vnd.oipf.pae.gemapplication/vnd.onepagertampapplication/vnd.onepagertamxapplication/vnd.onepagertatpapplication/vnd.onepagertatxapplication/vnd.restful+jsonapplication/vnd.rn-realmediaapplication/vnd.spotfire.dxpapplication/vnd.spotfire.sfsapplication/vnd.sun.wadl+xmlapplication/vnd.sun.xml.calcapplication/vnd.sun.xml.drawapplication/vnd.sun.xml.mathapplication/vnd.sus-calendarapplication/vnd.tcpdump.pcapapplication/vnd.triscape.mxsapplication/vnd.uplanet.listapplication/vnd.veryant.thinapplication/vnd.wv.csp+wbxmlapplication/vnd.xfdl.webformapplication/voucher-cms+jsonapplication/whoispp-responseapplication/x-ace-compressedapplication/x-authorware-binapplication/x-authorware-mapapplication/x-authorware-segapplication/x-cfs-compressedapplication/x-debian-packageapplication/x-dgc-compressedapplication/x-font-linux-psfapplication/x-gca-compressedapplication/x-java-jnlp-fileapplication/x-lzh-compressedapplication/x-ms-applicationapplication/x-rar-compressedapplication/x-virtualbox-hddapplication/x-virtualbox-ovaapplication/x-virtualbox-ovfapplication/x-virtualbox-vdiapplication/x-virtualbox-vhdaudio/vnd.cmles.radio-eventsimage/vnd.globalgraphics.pgbtext/javascript;charset=utf8text/vnd.familysearch.gedcomvideo/vnd.iptvforum.ttsmpeg2video/vnd.radgamettools.binkapplication/3gpphalforms+jsonapplication/alto-costmap+jsonapplication/alto-propmap+jsonapplication/ibe-pkg-reply+xmlapplication/json;charset=utf8application/kpml-response+xmlapplication/mbms-envelope+xmlapplication/mbms-register+xmlapplication/mbms-schedule+xmlapplication/media_control+xmlapplication/news-transmissionapplication/oebps-package+xmlapplication/ppsp-tracker+jsonapplication/prs.rdf-xml-cryptapplication/rpki-ghostbustersapplication/samlassertion+xmlapplication/sgml-open-catalogapplication/simple-filter+xmlapplication/spirits-event+xmlapplication/tamp-status-queryapplication/vnd.3gpp.gmop+xmlapplication/vnd.3gpp.ussd+xmlapplication/vnd.adobe.xdp+xmlapplication/vnd.apple.keynoteapplication/vnd.apple.mpegurlapplication/vnd.apple.numbersapplication/vnd.balsamiq.bmprapplication/vnd.bbf.usp.errorapplication/vnd.byu.uapi+jsonapplication/vnd.clonk.c4groupapplication/vnd.comicbook+zipapplication/vnd.comicbook-rarapplication/vnd.crick.clickerapplication/vnd.cyclonedx+xmlapplication/vnd.dece.ttml+xmlapplication/vnd.desmume.movieapplication/vnd.document+jsonapplication/vnd.ecowin.seriesapplication/vnd.enphase.envoyapplication/vnd.etsi.mcid+xmlapplication/vnd.etsi.pstn+xmlapplication/vnd.ezpix-packageapplication/vnd.fluxtime.clipapplication/vnd.fsc.weblaunchapplication/vnd.fujitsu.oasysapplication/vnd.fujixerox.dddapplication/vnd.geogebra.fileapplication/vnd.geogebra.toolapplication/vnd.hcl-bireportsapplication/vnd.ims.imsccv1p1application/vnd.ims.imsccv1p2application/vnd.ims.imsccv1p3application/vnd.lotus-wordproapplication/vnd.motorola.iprmapplication/vnd.ms-fontobjectapplication/vnd.ms-pki.seccatapplication/vnd.ms-powerpointapplication/vnd.ncd.referenceapplication/vnd.nebumind.lineapplication/vnd.nokia.pcd+xmlapplication/vnd.oma.lwm2m+tlvapplication/vnd.orange.indataapplication/vnd.osa.netdeployapplication/vnd.powerbuilder6application/vnd.powerbuilder7application/vnd.rainstor.dataapplication/vnd.shopkick+jsonapplication/vnd.smart.teacherapplication/vnd.street-streamapplication/vnd.swiftview-icsapplication/vnd.syncml.dm+xmlapplication/vnd.tri.onesourceapplication/vnd.uplanet.alertapplication/vnd.ves.encryptedapplication/vnd.wmf.bootstrapapplication/vnd.yamaha.hv-dicapplication/x-apple-diskimageapplication/x-dtbresource+xmlapplication/x-font-framemakerapplication/x-font-sunos-newsapplication/x-shockwave-flashapplication/x-silverlight-appapplication/x-virtualbox-vboxapplication/x-virtualbox-vmdkapplication/x-x509-ca-ra-certaudio/atrac-advanced-losslessaudio/vnd.presonus.multitracktext/1d-interleaved-parityfectext/javascript; charset=utf8application/alto-cdni+jsonapplication/bacnet-xdd+zipapplication/cdmi-containerapplication/dash-patch+xmlapplication/index.responseapplication/mac-compactproapplication/moss-signatureapplication/multipart-coreapplication/news-groupinfoapplication/pkix-attr-certapplication/provenance+xmlapplication/vnd.3gpp.5gnasapplication/vnd.3gpp2.tcapapplication/vnd.adobe.xfdfapplication/vnd.aether.impapplication/vnd.afpc.modcaapplication/vnd.ah-barcodeapplication/vnd.audiographapplication/vnd.canon-cpdlapplication/vnd.canon-lipsapplication/vnd.cinderellaapplication/vnd.curl.pcurlapplication/vnd.drive+jsonapplication/vnd.epson.saltapplication/vnd.etsi.mheg5application/vnd.fdsn.mseedapplication/vnd.filmit.zfcapplication/vnd.flographitapplication/vnd.framemakerapplication/vnd.fut-misnetapplication/vnd.fuzzysheetapplication/vnd.hl7cda+xmlapplication/vnd.hyper+jsonapplication/vnd.ibm.modcapapplication/vnd.iccprofileapplication/vnd.insors.igmapplication/vnd.kde.karbonapplication/vnd.kde.kchartapplication/vnd.kenameaappapplication/vnd.mason+jsonapplication/vnd.micro+jsonapplication/vnd.miele+jsonapplication/vnd.mobius.dafapplication/vnd.mobius.disapplication/vnd.mobius.mbkapplication/vnd.mobius.mqyapplication/vnd.mobius.mslapplication/vnd.mobius.plcapplication/vnd.mobius.txfapplication/vnd.ms-outlookapplication/vnd.ms-pki.stlapplication/vnd.ms-projectapplication/vnd.music-niffapplication/vnd.olpc-sugarapplication/vnd.patentdiveapplication/vnd.pmi.widgetapplication/vnd.sealed.3dfapplication/vnd.sealed.csfapplication/vnd.sealed.docapplication/vnd.sealed.emlapplication/vnd.sealed.mhtapplication/vnd.sealed.netapplication/vnd.sealed.pptapplication/vnd.sealed.xlsapplication/vnd.siren+jsonapplication/vnd.syncml+xmlapplication/vnd.wv.csp+xmlapplication/vnd.wv.ssp+xmlapplication/vnd.xacml+jsonapplication/vnd.xmpie.cpkgapplication/vnd.xmpie.dpkgapplication/vnd.xmpie.planapplication/vnd.xmpie.ppkgapplication/vnd.xmpie.xlimapplication/vnd.youtube.ytapplication/wordperfect5.1application/x-futuresplashapplication/x-lua-bytecodeapplication/x-x509-ca-certapplication/xcap-error+xmlapplication/yang-data+jsonapplication/yang-patch+xmlaudio/vnd.nokia.mobile-xmftext/x-handlebars-templatevideo/vnd.directv.mpeg-ttsvideo/vnd.iptvforum.ttsavcapplication/alto-error+jsonapplication/atomdeleted+xmlapplication/auth-policy+xmlapplication/call-completionapplication/cdmi-capabilityapplication/coap-group+jsonapplication/dialog-info+xmlapplication/jscalendar+jsonapplication/json-patch+jsonapplication/mosskey-requestapplication/mrb-publish+xmlapplication/opc-nodeset+xmlapplication/p2p-overlay+xmlapplication/pkcs7-signatureapplication/pkcs8-encryptedapplication/remote-printingapplication/scvp-cv-requestapplication/scvp-vp-requestapplication/senml-etch+cborapplication/senml-etch+jsonapplication/timestamp-queryapplication/timestamp-replyapplication/vnd.ahead.spaceapplication/vnd.android.otaapplication/vnd.apple.pagesapplication/vnd.arastra.swiapplication/vnd.autopackageapplication/vnd.avalon+jsonapplication/vnd.avistar+xmlapplication/vnd.bbf.usp.msgapplication/vnd.cab-jscriptapplication/vnd.cloanto.rp9application/vnd.commonspaceapplication/vnd.cosmocallerapplication/vnd.ctct.ws+xmlapplication/vnd.cups-rasterapplication/vnd.d3m-datasetapplication/vnd.d3m-problemapplication/vnd.ds-keypointapplication/vnd.dvb.serviceapplication/vnd.eudora.dataapplication/vnd.ezpix-albumapplication/vnd.frogans.fncapplication/vnd.frogans.ltfapplication/vnd.futoin+cborapplication/vnd.futoin+jsonapplication/vnd.geocube+xmlapplication/vnd.groove-helpapplication/vnd.heroku+jsonapplication/vnd.ibm.minipayapplication/vnd.kde.kontourapplication/vnd.kde.kspreadapplication/vnd.las.las+xmlapplication/vnd.lotus-1-2-3application/vnd.lotus-notesapplication/vnd.medcalcdataapplication/vnd.ms-artgalryapplication/vnd.ms-htmlhelpapplication/vnd.ms-opentypeapplication/vnd.muvee.styleapplication/vnd.ncd.controlapplication/vnd.oma.dd2+xmlapplication/vnd.oma.pal+xmlapplication/vnd.onepagertatapplication/vnd.openeye.oebapplication/vnd.osgi.bundleapplication/vnd.pocketlearnapplication/vnd.realvnc.bedapplication/vnd.sealed.tiffapplication/vnd.vectorworksapplication/vnd.wordperfectapplication/watcherinfo+xmlapplication/x-7z-compressedapplication/x-iso9660-imageapplication/x-msdos-programapplication/xhtml-voice+xmlapplication/yang-patch+jsonaudio/vnd.rhetorex.32kadpcmaudio/x-pn-realaudio-pluginmultipart/vnd.bint.med-plustext/vnd.trolltech.linguistaudio/3gppaudio/aptxaudio/bv16audio/bv32audio/dvi4audio/eac3audio/evrcaudio/g719audio/g722audio/g723audio/g728audio/g729audio/ilbcaudio/isacaudio/melpaudio/mhasaudio/midiaudio/mpegaudio/opusaudio/pcmaaudio/pcmuaudio/scipaudio/silkaudio/smv0audio/sofaaudio/toneaudio/usacaudio/vdviaudio/waveaudio/webmfont/woff2image/acesimage/apngimage/avciimage/avcsimage/avifimage/fitsimage/heicimage/heifimage/hsj2image/jpegimage/jphcimage/jxraimage/jxrsimage/jxscimage/jxsiimage/jxssimage/ktx2image/tiffimage/webpmodel/igesmodel/meshmodel/stepmodel/vrmltext/mizartext/plaintext/trofftext/vcardtext/vnd.atext/x-asmtext/x-luatext/x-nfotext/x-orgtext/x-sfvvideo/3gppvideo/celbvideo/ffv1video/h261video/h263video/h264video/h265video/jpegvideo/jxsvvideo/mp1svideo/mp2pvideo/mp2tvideo/mpegvideo/scipvideo/webmapplication/applefileapplication/cals-1840application/ccxml+xmlapplication/city+jsonapplication/csvm+jsonapplication/cybercashapplication/dashdeltaapplication/dicom+xmlapplication/dots+cborapplication/dskpp+xmlapplication/fhir+jsonapplication/font-sfntapplication/font-woffapplication/index.cmdapplication/index.objapplication/index.vndapplication/inkml+xmlapplication/jose+jsonapplication/moss-keysapplication/mpeg4-iodapplication/n-triplesapplication/nlsml+xmlapplication/omdoc+xmlapplication/parityfecapplication/pkix-certapplication/raml+yamlapplication/raptorfecapplication/rdap+jsonapplication/scaip+xmlapplication/scim+jsonapplication/senml+xmlapplication/senml-exiapplication/smpte336mapplication/spdx+jsonapplication/stix+jsonapplication/tetra_isiapplication/tzif-leapapplication/vcard+xmlapplication/vnd.ciediapplication/vnd.ffsnsapplication/vnd.fintsapplication/vnd.kinarapplication/vnd.msignapplication/vnd.mynfcapplication/vnd.rapidapplication/vnd.s3smsapplication/vnd.unityapplication/vnd.visioapplication/vq-rtcpxrapplication/x-abiwordapplication/x-freearcapplication/x-mpegurlapplication/x-ms-xbapapplication/x-msmoneyapplication/x-mswriteapplication/x-stuffitapplication/x-sv4cpioapplication/x-tex-tfmapplication/x-texinfoapplication/xacml+xmlapplication/xhtml+xmlapplication/xliff+xmlapplication/xproc+xmlaudio/telephone-eventimage/vnd.tencent.tapmessage/external-bodymodel/vnd.collada+xmlmodel/x3d+fastinfosetmultipart/alternativemultipart/appledoubletext/css;charset=utf8text/grammar-ref-listtext/rtp-enc-aescm128text/vnd.dvb.subtitletext/vnd.fmi.flexstorvideo/vnd.dece.mobilevideo/vnd.nokia.mp4vrvideo/vnd.objectvideoapplication/activemessageapplication/activity+jsonapplication/atsc-held+xmlapplication/atsc-rdt+jsonapplication/atsc-rsat+xmlapplication/calendar+jsonapplication/clue_info+xmlapplication/emotionml+xmlapplication/manifest+jsonapplication/metalink4+xmlapplication/mpeg4-genericapplication/mpeg4-iod-xmtapplication/msc-mixer+xmlapplication/ocsp-responseapplication/pgp-encryptedapplication/pgp-signatureapplication/pidf-diff+xmlapplication/route-apd+xmlapplication/route-usd+xmlapplication/rpki-manifestapplication/vnd.3gpp.gtpcapplication/vnd.3gpp.ngapapplication/vnd.3gpp.pfcpapplication/vnd.3gpp.s1apapplication/vnd.3gpp2.smsapplication/vnd.adobe.fxpapplication/vnd.amiga.amiapplication/vnd.artsquareapplication/vnd.chess-pgnapplication/vnd.ctc-posmlapplication/vnd.dece.dataapplication/vnd.dolby.mlpapplication/vnd.dtg.localapplication/vnd.epson.esfapplication/vnd.epson.msfapplication/vnd.epson.ssfapplication/vnd.fdsn.seedapplication/vnd.hl7v2+xmlapplication/vnd.ieee.1905application/vnd.kde.kivioapplication/vnd.kde.kwordapplication/vnd.leap+jsonapplication/vnd.nokia.ncdapplication/vnd.pawaafileapplication/vnd.pg.formatapplication/vnd.pg.osasliapplication/vnd.pvi.ptid1application/vnd.seis+jsonapplication/vnd.sycle+xmlapplication/vnd.syft+jsonapplication/vnd.uiq.themeapplication/vnd.visionaryapplication/vnd.wap.wbxmlapplication/whoispp-queryapplication/x-font-libgrxapplication/x-font-speedoapplication/x-ms-shortcutapplication/x-msmediaviewapplication/x-mspublisherapplication/x-pki-messageapplication/x-wais-sourceapplication/xcap-caps+xmlapplication/xcap-diff+xmlapplication/xml-patch+xmlapplication/yang-data+xmlaudio/vnd.nuera.ecelp4800audio/vnd.nuera.ecelp7470audio/vnd.nuera.ecelp9600image/vnd.adobe.photoshopmultipart/x-mixed-replacetext/plain; charset=utf-8text/tab-separated-valuestext/vnd.debian.copyrightvideo/vnd.motorola.videopvideo/vnd.nokia.videovoipapplication/applixwareapplication/atomicmailapplication/batch-smtpapplication/cdmi-queueapplication/cellml+xmlapplication/dicom+jsonapplication/ecmascriptapplication/font-tdpfrapplication/javascriptapplication/macwriteiiapplication/mathml+xmlapplication/pics-rulesapplication/pkcs7-mimeapplication/postscriptapplication/prs.nprendapplication/sarif+jsonapplication/senml+cborapplication/senml+jsonapplication/sensml+xmlapplication/sensml-exiapplication/tamp-errorapplication/taxii+jsonapplication/thraud+xmlapplication/tnauthlistapplication/vcard+jsonapplication/vnd.cybankapplication/vnd.gerberapplication/vnd.grafeqapplication/vnd.gridmpapplication/vnd.hp-hpsapplication/vnd.hp-pclapplication/vnd.is-xprapplication/vnd.laszipapplication/vnd.ms-asfapplication/vnd.ms-imsapplication/vnd.ms-lrmapplication/vnd.ms-wplapplication/vnd.netfpxapplication/vnd.picselapplication/vnd.umajinapplication/vnd.wt.stfapplication/x-compressapplication/x-directorapplication/x-font-bdfapplication/x-font-dosapplication/x-font-pcfapplication/x-font-snfapplication/x-gnumericapplication/x-keepass2application/x-makeselfapplication/x-msaccessapplication/x-msbinderapplication/x-stuffitxapplication/x-zmachineaudio/rtp-enc-aescm128audio/vnd.lucent.voiceaudio/vnd.rn-realaudioimage/vnd.dece.graphicimage/vnd.dvb.subtitleimage/vnd.fastbidsheetimage/vnd.mozilla.apngmessage/global-headersmultipart/multilingualtext/css; charset=utf8text/css;charset=utf-8text/html;charset=utf8text/vnd.wap.wmlscriptvideo/rtp-enc-aescm128video/vnd.directv.mpegvideo/vnd.sealed.mpeg1video/vnd.sealed.mpeg4application/a2lapplication/amlapplication/atfapplication/ceaapplication/cfwapplication/clrapplication/cmsapplication/cwtapplication/dcdapplication/diiapplication/ditapplication/dnsapplication/efiapplication/exiapplication/gxfapplication/ippapplication/jwtapplication/lxfapplication/mf4application/mp4application/mxfapplication/nssapplication/odaapplication/odxapplication/oggapplication/p21application/pdfapplication/pdxapplication/rtfapplication/rtxapplication/sbeapplication/sdpapplication/sqlapplication/tarapplication/xmlapplication/zipaudio/clearmodeaudio/gsm-hr-08audio/mp4a-latmaudio/parityfecaudio/raptorfecaudio/vnd.qcelpaudio/x-mpegurlchemical/x-cmdfchemical/x-csmlfont/collectionimage/dicom-rleimage/x-xbitmapimage/x-xpixmapmessage/partialmessage/sipfragmodel/gltf+jsonmultipart/mixedtext/csv-schematext/ecmascripttext/javascripttext/parameterstext/vnd.wap.sitext/vnd.wap.sltext/x-markdowntext/x-suse-ymptext/x-uuencodevideo/h263-1998video/h263-2000video/h264-rcdovideo/parityfecvideo/quicktimevideo/raptorfecvideo/smpte292mvideo/x-msvideoaudio/aacaudio/ac3audio/amraudio/ascaudio/dlsaudio/evsaudio/gsmaudio/l16audio/l20audio/l24audio/lpcaudio/mp3audio/mp4audio/mpaaudio/oggaudio/redaudio/rtxaudio/s3maudio/smvaudio/t38audio/wavfont/sfntfont/woffimage/bmpimage/cgmimage/emfimage/gifimage/iefimage/jlsimage/jp2image/jphimage/jpmimage/jpximage/jxrimage/jxsimage/ktximage/pngimage/sgiimage/t38image/wmfmodel/3mfmodel/e57model/mtlmodel/objmodel/prcmodel/stlmodel/u3dtext/gff3text/htmltext/jadetext/lesstext/sgmltext/shextext/slimtext/spdxtext/t140text/yamlvideo/av1video/jpmvideo/mj2video/mp4video/mpvvideo/oggvideo/rawvideo/rtxvideo/vc1video/vc2video/vp8video/vp9application/alto-directory+jsonapplication/conference-info+xmlapplication/ibe-key-request+xmlapplication/json; charset=utf-8application/mbms-deregister+xmlapplication/oauth-authz-req+jwtapplication/patch-ops-error+xmlapplication/tamp-update-confirmapplication/trickle-ice-sdpfragapplication/vnd.3gpp.pic-bw-varapplication/vnd.businessobjectsapplication/vnd.collection+jsonapplication/vnd.cups-postscriptapplication/vnd.data-vision.rdzapplication/vnd.dtg.local.flashapplication/vnd.dvb.ipdcroamingapplication/vnd.etsi.asic-e+zipapplication/vnd.etsi.asic-s+zipapplication/vnd.f-secure.mobileapplication/vnd.fujitsu.oasysgpapplication/vnd.geogebra.slidesapplication/vnd.groove-injectorapplication/vnd.hyper-item+jsonapplication/vnd.hyperdrive+jsonapplication/vnd.ibm.afplinedataapplication/vnd.immervision-ivpapplication/vnd.immervision-ivuapplication/vnd.intertrust.nncpapplication/vnd.iso11783-10+zipapplication/vnd.lotus-freelanceapplication/vnd.lotus-organizerapplication/vnd.lotus-screencamapplication/vnd.marlin.drm.mdcfapplication/vnd.mozilla.xul+xmlapplication/vnd.multiad.creatorapplication/vnd.nearst.inv+jsonapplication/vnd.noblenet-sealerapplication/vnd.nokia.conml+xmlapplication/vnd.nokia.pcd+wbxmlapplication/vnd.oma-scws-configapplication/vnd.oma.cab-pcc+xmlapplication/vnd.omads-email+xmlapplication/vnd.otps.ct-kip+xmlapplication/vnd.oxli.countgraphapplication/vnd.powerbuilder6-sapplication/vnd.powerbuilder7-sapplication/vnd.pwg-multiplexedapplication/vnd.resilient.logicapplication/vnd.ruckus.downloadapplication/vnd.shade-save-fileapplication/vnd.shootproof+jsonapplication/vnd.solent.sdkm+xmlapplication/vnd.sun.xml.impressapplication/vnd.symbian.installapplication/vnd.syncml.dm+wbxmlapplication/vnd.uplanet.cacheopapplication/vnd.uplanet.channelapplication/vnd.uplanet.listcmdapplication/vnd.verimatrix.vcasapplication/vnd.yamaha.hv-voiceapplication/x-java-archive-diffapplication/x-pkcs7-certreqrespapplication/x-x509-next-ca-certtext/xml-external-parsed-entityvideo/vnd.radgamettools.smackerapplication/3gpdash-qoe-report+xmlapplication/alto-endpointcost+jsonapplication/alto-endpointprop+jsonapplication/fido.trusted-apps+jsonapplication/java-serialized-objectapplication/mediaservercontrol+xmlapplication/set-payment-initiationapplication/simple-message-summaryapplication/vnd.3gpp.srvcc-ext+xmlapplication/vnd.afpc.foca-codepageapplication/vnd.afpc.modca-cmtableapplication/vnd.afpc.modca-formdefapplication/vnd.afpc.modca-overlayapplication/vnd.amazon.mobi8-ebookapplication/vnd.apache.thrift.jsonapplication/vnd.aristanetworks.swiapplication/vnd.cyan.dean.root+xmlapplication/vnd.dvb.ipdcesgaccess2application/vnd.dvb.notif-init+xmlapplication/vnd.eclipse.ditto+jsonapplication/vnd.ecowin.filerequestapplication/vnd.ericsson.quickcallapplication/vnd.evolv.ecig.profileapplication/vnd.font-fontforge-sfdapplication/vnd.informix-visionaryapplication/vnd.intertrust.digiboxapplication/vnd.joost.joda-archiveapplication/vnd.mapbox-vector-tileapplication/vnd.maxmind.maxmind-dbapplication/vnd.mediastation.cdkeyapplication/vnd.meridian-slingshotapplication/vnd.mophun.applicationapplication/vnd.mophun.certificateapplication/vnd.motorola.flexsuiteapplication/vnd.ms-windows.wsd.oobapplication/vnd.nacamar.ybrid+jsonapplication/vnd.nintendo.nitro.romapplication/vnd.noblenet-directoryapplication/vnd.nokia.landmark+xmlapplication/vnd.nokia.radio-presetapplication/vnd.oipf.dae.xhtml+xmlapplication/vnd.oipf.ueprofile+xmlapplication/vnd.oma.bcast.sgdd+xmlapplication/vnd.oma.poc.groups+xmlapplication/vnd.opentimestamps.otsapplication/vnd.previewsystems.boxapplication/vnd.recordare.musicxmlapplication/vnd.route66.link66+xmlapplication/vnd.simtech-mindmapperapplication/vnd.snesdev-page-tableapplication/vnd.syncml.dmddf+wbxmlapplication/vnd.uplanet.list-wbxmlapplication/vnd.veritone.aion+jsonapplication/vnd.yamaha.smaf-phraseapplication/vnd.yamaha.through-ngnapplication/x-install-instructionsapplication/x-iwork-keynote-sffkeyapplication/x-iwork-pages-sffpagesimage/vnd.sealedmedia.softseal.gifimage/vnd.sealedmedia.softseal.jpgtext/vnd.esmertec.theme-descriptortext/vnd.radisys.msml-basic-layoutvideo/vnd.sealedmedia.softseal.movapplication/geopackage+sqlite3application/im-iscomposing+xmlapplication/json; charset=utf8application/json;charset=utf-8application/mathml-content+xmlapplication/resource-lists+xmlapplication/sparql-results+xmlapplication/urc-targetdesc+xmlapplication/vnd.3gpp-prose+xmlapplication/vnd.biopax.rdf+xmlapplication/vnd.cyclonedx+jsonapplication/vnd.dolby.mobile.1application/vnd.dolby.mobile.2application/vnd.dtg.local.htmlapplication/vnd.dvb.dvbisl+xmlapplication/vnd.dvb.ipdcesgpddapplication/vnd.ficlab.flb+zipapplication/vnd.fujitsu.oasys2application/vnd.fujitsu.oasys3application/vnd.fujixerox.art4application/vnd.fujixerox.hbplapplication/vnd.groove-accountapplication/vnd.kde.kpresenterapplication/vnd.lotus-approachapplication/vnd.micrografx.floapplication/vnd.micrografx.igxapplication/vnd.ms-3mfdocumentapplication/vnd.ms-officethemeapplication/vnd.ms-xpsdocumentapplication/vnd.msa-disk-imageapplication/vnd.nokia.catalogsapplication/vnd.oftn.l10n+jsonapplication/vnd.oma.bcast.ltkmapplication/vnd.oma.bcast.sgduapplication/vnd.oma.bcast.stkmapplication/vnd.oma.lwm2m+cborapplication/vnd.oma.lwm2m+jsonapplication/vnd.omads-file+xmlapplication/vnd.osgi.subsystemapplication/vnd.pagerduty+jsonapplication/vnd.powerbuilder75application/vnd.quarantainenetapplication/vnd.rig.cryptonoteapplication/vnd.sigrok.sessionapplication/vnd.smart.notebookapplication/vnd.sun.xml.writerapplication/vnd.tmobile-livetvapplication/vnd.uplanet.signalapplication/vnd.wap.wmlscriptcapplication/vnd.wolfram.playerapplication/vnd.zzazz.deck+xmlapplication/x-chrome-extensionapplication/x-font-ghostscriptapplication/x-mobipocket-ebookaudio/1d-interleaved-parityfecimage/vnd.fujixerox.edmics-mmrimage/vnd.fujixerox.edmics-rlcimage/vnd.valve.source.texturemessage/global-delivery-statustext/javascript; charset=utf-8text/javascript;charset=utf-8'video/1d-interleaved-parityfecaudio/amr-wb+audio/atrac-xaudio/evrcnw0audio/evrcnw1audio/evrcwb0audio/evrcwb1audio/flexfecaudio/g726-16audio/g726-24audio/g726-32audio/g726-40audio/gsm-efraudio/melp600audio/pcma-wbaudio/pcmu-wbaudio/prs.sidaudio/smv-qcpaudio/sp-midiaudio/uemclipaudio/vnd.4sbaudio/vnd.draaudio/vnd.dtsaudio/vnd.ripimage/prs.ptiimage/svg+xmlimage/tiff-fximage/vnd.dwgimage/vnd.dxfimage/vnd.fpximage/vnd.fstimage/vnd.miximage/vnd.svfmodel/vnd.dwfmodel/vnd.gdlmodel/vnd.gtwmodel/vnd.mtsmodel/vnd.vtumodel/x3d+xmltext/calendartext/calendertext/encaprtptext/enrichedtext/fhirpathtext/markdowntext/richtexttext/uri-listtext/vnd.curltext/vnd.hanstext/vnd.sositext/x-pascaltext/x-setextvideo/3gpp-ttvideo/flexfecvideo/mp4v-esvideo/pointervideo/vnd.fvtvideo/x-ms-wmapplication/atfxapplication/bdocapplication/cborapplication/cdniapplication/coseapplication/dartapplication/dvcsapplication/fitsapplication/gzipapplication/h224application/httpapplication/igesapplication/iotpapplication/isupapplication/joseapplication/jsonapplication/marcapplication/mboxapplication/mipcapplication/mp21application/oxpsapplication/qsigapplication/sgmlapplication/sipcapplication/smilapplication/srgsapplication/tomlapplication/trigapplication/tzifapplication/wasmapplication/witaapplication/x-shapplication/x-xzapplication/yangapplication/zlibapplication/zstdaudio/ip-mr_v2.5audio/mobile-xmfaudio/mpa-robustaudio/vnd.dts.hdaudio/x-matroskaimage/pwg-rasterimage/vnd.ms-ddsimage/x-freehandmessage/imdn+xmlmodel/vnd.gs-gdlmodel/vnd.gs.gdlmodel/x3d+binarymultipart/digestmultipart/reportmultipart/signedtext/rtploopbacktext/vnd.latex-ztext/vnd.wap.wmltext/x-componenttext/x-vcalendarvideo/x-matroskaapplication/alto-cdnifilter+jsonapplication/alto-networkmap+jsonapplication/tamp-sequence-adjustapplication/tamp-status-responseapplication/urc-uisocketdesc+xmlapplication/vividence.scriptfileapplication/vnd.3m.post-it-notesapplication/vnd.afpc.afplinedataapplication/vnd.bbf.usp.msg+jsonapplication/vnd.bint.med-contentapplication/vnd.bluetooth.ep.oobapplication/vnd.bluetooth.le.oobapplication/vnd.cirpack.isdn-extapplication/vnd.datapackage+jsonapplication/vnd.dece.unspecifiedapplication/vnd.dvb.esgcontainerapplication/vnd.eprints.data+xmlapplication/vnd.epson.quickanimeapplication/vnd.evolv.ecig.themeapplication/vnd.exstream-packageapplication/vnd.fujitsu.oasysprsapplication/vnd.fujixerox.art-exapplication/vnd.genomatix.tuxedoapplication/vnd.gentics.grd+jsonapplication/vnd.google-earth.kmzapplication/vnd.hzn-3d-crosswordapplication/vnd.infotech.projectapplication/vnd.intercon.formnetapplication/vnd.kodak-descriptorapplication/vnd.macports.portpkgapplication/vnd.oipf.dae.svg+xmlapplication/vnd.oipf.spdlist+xmlapplication/vnd.oma.bcast.sgbootapplication/vnd.oma.drm.risd+xmlapplication/vnd.omads-folder+xmlapplication/vnd.omaloc-supl-initapplication/vnd.patientecommsdocapplication/vnd.powerbuilder75-sapplication/vnd.proteus.magazineapplication/vnd.radisys.moml+xmlapplication/vnd.radisys.msml+xmlapplication/vnd.renlearn.rlprintapplication/vnd.rn-realmedia-vbrapplication/vnd.syncml.dmddf+xmlapplication/vnd.tableschema+jsonapplication/vnd.yamaha.hv-scriptapplication/webpush-options+jsonapplication/x-pkcs7-certificatesaudio/vnd.ms-playready.media.pyaimage/vnd.airzip.accelerator.azvmessage/disposition-notificationtext/vnd.sun.j2me.app-descriptorvideo/vnd.ms-playready.media.pyvapplication/at+jwtapplication/dec-dxapplication/mswordapplication/oscoreapplication/pkcs10application/pkcs12application/riscosapplication/ubjsonapplication/ulpfecapplication/widgetapplication/winhlpapplication/x-bdocapplication/x-bzipapplication/x-chatapplication/x-cpioapplication/x-doomapplication/x-gtarapplication/x-gzipapplication/x-perlapplication/x-sharapplication/x-tadsapplication/x-tgifapplication/x-xfigapplication/xv+xmlaudio/dsr-es201108audio/dsr-es202050audio/dsr-es202211audio/dsr-es202212audio/vnd.audiokozaudio/vnd.cns.anp1audio/vnd.cns.inf1audio/vnd.dvb.fileaudio/vnd.vmx.cvsdimage/vnd.cns.inf2image/vnd.ms-photoimage/vnd.radianceimage/vnd.wap.wbmpimage/x-cmu-rastermodel/step-xml+zipmodel/vnd.moml+xmlmodel/vnd.usdz+zipmultipart/paralleltext/prs.lines.tagtext/vnd.ascii-arttext/vnd.in3d.3dmltext/vnd.in3d.spottext/vnd.iptc.nitftext/x-java-sourcetext/x-jquery-tmplvideo/vnd.dece.mp4video/vnd.dvb.filevideo/vnd.uvvu.mp4application/expect-ct-report+jsonapplication/mbms-msk-response+xmlapplication/oblivious-dns-messageapplication/pem-certificate-chainapplication/simplesymbolcontainerapplication/tamp-community-updateapplication/vnd.3gpp.mid-call+xmlapplication/vnd.3gpp.pic-bw-largeapplication/vnd.3gpp.pic-bw-smallapplication/vnd.accpac.simply.asoapplication/vnd.accpac.simply.impapplication/vnd.adobe.flash.movieapplication/vnd.afpc.foca-charsetapplication/vnd.amundsen.maze+xmlapplication/vnd.apache.arrow.fileapplication/vnd.balsamiq.bmml+xmlapplication/vnd.banana-accountingapplication/vnd.blueice.multipassapplication/vnd.commerce-battelleapplication/vnd.cryptii.pipe+jsonapplication/vnd.crypto-shade-fileapplication/vnd.cryptomator.vaultapplication/vnd.dataresource+jsonapplication/vnd.dm.delegation+xmlapplication/vnd.dvb.ipdcesgaccessapplication/vnd.ecowin.fileupdateapplication/vnd.espass-espass+zipapplication/vnd.etsi.iptvsync+xmlapplication/vnd.etsi.simservs+xmlapplication/vnd.geometry-explorerapplication/vnd.gov.sk.e-form+xmlapplication/vnd.gov.sk.e-form+zipapplication/vnd.hhe.lesson-playerapplication/vnd.ms-cab-compressedapplication/vnd.ms-wmdrm.lic-respapplication/vnd.neurolanguage.nluapplication/vnd.nintendo.snes.romapplication/vnd.nokia.conml+wbxmlapplication/vnd.nokia.n-gage.dataapplication/vnd.oma.bcast.imd+xmlapplication/vnd.openblox.game+xmlapplication/vnd.quark.quarkxpressapplication/vnd.stardivision.calcapplication/vnd.stardivision.drawapplication/vnd.stardivision.mathapplication/vnd.stepmania.packageapplication/vnd.syncml.dmtnds+xmlapplication/vnd.ubisoft.webplayerapplication/vnd.yamaha.smaf-audioapplication/x-ns-proxy-autoconfigapplication/x-www-form-urlencodedmodel/vnd.parasolid.transmit.textapplication/atxmlapplication/cccexapplication/dicomapplication/eshopapplication/hjsonapplication/indexapplication/ipfixapplication/json5application/mikeyapplication/pkcs8application/sieveapplication/slateapplication/vemmiapplication/x-amfapplication/x-arjapplication/x-cbrapplication/x-cshapplication/x-debapplication/x-dviapplication/x-evaapplication/x-hdfapplication/x-mieapplication/x-nzbapplication/x-seaapplication/x-sqlapplication/x-tarapplication/x-tclapplication/x-texaudio/rtploopbackaudio/tetra_acelpaudio/vnd.dts.uhdaudio/x-realaudioimage/vnd.ms-modiimage/vnd.net-fpximage/vnd.pco.b16model/gltf-binarymodel/vnd.opengexmodel/vnd.sap.vdsmultipart/relatedtext/coffeescripttext/vnd.graphviztext/x-processingvideo/iso.segmentvideo/rtploopbackvideo/vnd.dece.hdvideo/vnd.dece.pdvideo/vnd.dece.sdvideo/vnd.mpegurlvideo/x-sgi-moviex-shader/x-vertexaudio/3gpp2audio/adpcmaudio/basicaudio/dat12audio/evrc0audio/evrc1audio/evrcbaudio/g7221audio/g7291audio/g729daudio/g729eaudio/qcelpaudio/speexaudio/t140caudio/x-aacaudio/x-cafaudio/x-m4aaudio/x-ttaaudio/x-wavimage/g3faximage/hej2kimage/pjpegimage/x-3dsimage/x-cmximage/x-jngimage/x-pcximage/x-rgbimage/x-tgaimage/x-xcfmessage/siptext/fwdredtext/mathmltext/shaclctext/stylustext/turtletext/ulpfectext/x-opmltext/x-sasstext/x-scssvideo/3gpp2video/bmpegvideo/bt656video/x-f4vvideo/x-flivideo/x-flvvideo/x-m4vvideo/x-mngvideo/x-smvapplication/alto-costmapfilter+jsonapplication/alto-propmapparams+jsonapplication/javascript;charset=utf8application/mathml-presentation+xmlapplication/missing-blocks+cbor-seqapplication/relax-ng-compact-syntaxapplication/resource-lists-diff+xmlapplication/token-introspection+jwtapplication/vnd.3gpp.mcdata-payloadapplication/vnd.3gpp.mcptt-info+xmlapplication/vnd.3gpp.srvcc-info+xmlapplication/vnd.3gpp2.bcmcsinfo+xmlapplication/vnd.afpc.foca-codedfontapplication/vnd.apache.arrow.streamapplication/vnd.aplextor.warrp+jsonapplication/vnd.apple.installer+xmlapplication/vnd.bekitzur-stech+jsonapplication/vnd.capasystems-pg+jsonapplication/vnd.collection.doc+jsonapplication/vnd.dvb.iptv.alfec-baseapplication/vnd.ecowin.seriesupdateapplication/vnd.etsi.iptvsad-bc+xmlapplication/vnd.evolv.ecig.settingsapplication/vnd.fastcopy-disk-imageapplication/vnd.fujifilm.fb.jfi+xmlapplication/vnd.fujixerox.docuworksapplication/vnd.groove-tool-messageapplication/vnd.liberty-request+xmlapplication/vnd.ms-color.iccprofileapplication/vnd.ms-wmdrm.meter-respapplication/vnd.multiad.creator.cifapplication/vnd.nokia.n-gage.ac+xmlapplication/vnd.nokia.radio-presetsapplication/vnd.oipf.cspg-hexbinaryapplication/vnd.oma.bcast.sprov+xmlapplication/vnd.pwg-xhtml-print+xmlapplication/vnd.stardivision.writerapplication/vnd.stepmania.stepchartapplication/vnd.syncml.dmtnds+wbxmlapplication/vnd.uplanet.alert-wbxmlapplication/vnd.wolfram.mathematicaapplication/vnd.wrq-hp3000-labelledapplication/vnd.yamaha.remote-setupapplication/x-research-info-systemsapplication/x-web-app-manifest+jsonaudio/vnd.sealedmedia.softseal.mpegmodel/vnd.parasolid.transmit.binarymodel/vnd.valve.source.compiled-mapapplication/1d-interleaved-parityfecapplication/framework-attributes+xmlapplication/javascript; charset=utf8application/javascript;charset=utf-8application/media-policy-dataset+xmlapplication/tamp-apex-update-confirmapplication/vnd.3gpp-prose-pc3ch+xmlapplication/vnd.3gpp.mcdata-info+xmlapplication/vnd.adobe.partial-uploadapplication/vnd.afpc.modca-mediummapapplication/vnd.americandynamics.accapplication/vnd.antix.game-componentapplication/vnd.apache.thrift.binaryapplication/vnd.chipnuts.karaoke-mmdapplication/vnd.collection.next+jsonapplication/vnd.coreos.ignition+jsonapplication/vnd.ecowin.seriesrequestapplication/vnd.etsi.iptvcommand+xmlapplication/vnd.etsi.iptvprofile+xmlapplication/vnd.etsi.iptvsad-cod+xmlapplication/vnd.etsi.iptvservice+xmlapplication/vnd.etsi.timestamp-tokenapplication/vnd.exstream-empower+zipapplication/vnd.google-apps.documentapplication/vnd.google-earth.kml+xmlapplication/vnd.groove-tool-templateapplication/vnd.hydrostatix.sof-dataapplication/vnd.ibm.electronic-mediaapplication/vnd.ibm.secure-containerapplication/vnd.imagemeter.image+zipapplication/vnd.infotech.project+xmlapplication/vnd.iptc.g2.newsitem+xmlapplication/vnd.logipipe.circuit+zipapplication/vnd.minisoft-hp3000-saveapplication/vnd.nokia.landmark+wbxmlapplication/vnd.oipf.spdiscovery+xmlapplication/vnd.oipf.userprofile+xmlapplication/vnd.openblox.game-binaryapplication/vnd.oracle.resource+jsonapplication/vnd.sailingtracker.trackapplication/vnd.stardivision.impressapplication/vnd.vividence.scriptfileapplication/x-redhat-package-managerapplication/xcon-conference-info+xmlvideo/vnd.iptvforum.1dparityfec-1010video/vnd.iptvforum.1dparityfec-2005video/vnd.iptvforum.2dparityfec-1010video/vnd.iptvforum.2dparityfec-2005application/emergencycalldata.cap+xmlapplication/javascript; charset=utf-8application/mbms-reception-report+xmlapplication/vnd.3gpp.mcptt-signed+xmlapplication/vnd.3gpp.mcvideo-info+xmlapplication/vnd.afpc.cmoca-cmresourceapplication/vnd.airzip.filesecure.azfapplication/vnd.airzip.filesecure.azsapplication/vnd.apache.thrift.compactapplication/vnd.astraea-software.iotaapplication/vnd.crick.clicker.paletteapplication/vnd.criticaltools.wbs+xmlapplication/vnd.cryptomator.encryptedapplication/vnd.debian.binary-packageapplication/vnd.dvb.notif-generic+xmlapplication/vnd.etsi.iptvsad-npvr+xmlapplication/vnd.eu.kasparian.car+jsonapplication/vnd.firemonkeys.cloudcellapplication/vnd.fujifilm.fb.docuworksapplication/vnd.ibm.rights-managementapplication/vnd.imagemeter.folder+zipapplication/vnd.ipunplugged.rcprofileapplication/vnd.japannet-registrationapplication/vnd.japannet-verificationapplication/vnd.jcp.javame.midlet-rmsapplication/vnd.maxar.archive.3tz+zipapplication/vnd.ms-office.activex+xmlapplication/vnd.ms-wmdrm.lic-chlg-reqapplication/vnd.nokia.iptv.config+xmlapplication/vnd.oma-scws-http-requestapplication/vnd.publishare-delta-treeapplication/vnd.qualcomm.brew-app-resapplication/vnd.quobject-quoxdocumentapplication/vnd.radisys.msml-conf+xmlapplication/vnd.sun.xml.calc.templateapplication/vnd.sun.xml.draw.templateapplication/vnd.sun.xml.writer.globalapplication/vnd.think-cell.ppttc+jsonapplication/vnd.tmd.mediaflex.api+xmlapplication/vnd.uplanet.bearer-choiceapplication/vnd.uplanet.cacheop-wbxmlapplication/vnd.uplanet.channel-wbxmlapplication/vnd.uplanet.listcmd-wbxmlapplication/vnd.valve.source.materialapplication/vnd.vidsoft.vidconferenceapplication/vnd.windows.devicepairingapplication/x-virtualbox-vbox-extpacktext/vnd.net2phone.commcenter.commandaudio/32kadpcmaudio/encaprtpaudio/evrc-qcpaudio/melp1200audio/melp2400audio/musepackaudio/rtp-midiaudio/vnd.celpaudio/vnd.waveaudio/x-ms-waxaudio/x-ms-wmachemical/x-cdxchemical/x-cifchemical/x-cmlchemical/x-pdbchemical/x-xyzimage/prs.btifimage/vnd.djvuimage/vnd.xiffimage/x-ms-bmpmessage/globalmessage/rfc822message/s-httpmodel/step+xmlmodel/step+zipmodel/x3d+vrmlmodel/x3d-vrmltext/directorytext/parityfectext/raptorfectext/x-fortrantext/x-gwt-rpcvideo/encaprtpvideo/h264-svcvideo/jpeg2000video/smpte291video/vnd.cctvvideo/vnd.vivovideo/x-ms-asfvideo/x-ms-vobvideo/x-ms-wmvvideo/x-ms-wmxvideo/x-ms-wvxapplication/alto-networkmapfilter+jsonapplication/atsc-dynamic-event-messageapplication/emergencycalldata.veds+xmlapplication/mbms-register-response+xmlapplication/vnd.3gpp.interworking-dataapplication/vnd.3gpp.mc-signalling-earapplication/vnd.3gpp.mcdata-signallingapplication/vnd.afpc.modca-pagesegmentapplication/vnd.crick.clicker.keyboardapplication/vnd.crick.clicker.templateapplication/vnd.crick.clicker.wordbankapplication/vnd.denovo.fcselayout-linkapplication/vnd.dvb.ipdcdftnotifaccessapplication/vnd.etsi.iptvdiscovery+xmlapplication/vnd.etsi.iptvueprofile+xmlapplication/vnd.ims.lis.v2.result+jsonapplication/vnd.marlin.drm.license+xmlapplication/vnd.motorola.flexsuite.fisapplication/vnd.motorola.flexsuite.kmrapplication/vnd.motorola.flexsuite.ttcapplication/vnd.motorola.flexsuite.wemapplication/vnd.oma-scws-http-responseapplication/vnd.oma.cab-user-prefs+xmlapplication/vnd.oma.scidm.messages+xmlapplication/vnd.oma.xcap-directory+xmlapplication/vnd.openstreetmap.data+xmlapplication/vnd.osgeo.mapguide.packageapplication/vnd.radisys.msml-audit+xmlapplication/vnd.recordare.musicxml+xmlapplication/vnd.shana.informed.packageapplication/vnd.syncml.dm.notificationapplication/vnd.syncml.ds.notificationapplication/vnd.yamaha.openscoreformatapplication/vnd.yamaha.tunnel-udpencapapplication/x-iwork-numbers-sffnumbersapplication/xml-external-parsed-entitymodel/vnd.rosette.annotated-data-modelvideo/vnd.nokia.interleaved-multimediaapplication/emergencycalldata.ecall.msdapplication/prs.alvestrand.titrax-sheetapplication/set-registration-initiationapplication/vnd.adobe.formscentral.fcdtapplication/vnd.android.package-archiveapplication/vnd.blink-idb-value-wrapperapplication/vnd.dvb.notif-container+xmlapplication/vnd.easykaraoke.cdgdownloadapplication/vnd.familysearch.gedcom+zipapplication/vnd.gnu.taler.exchange+jsonapplication/vnd.gnu.taler.merchant+jsonapplication/vnd.google-apps.spreadsheetapplication/vnd.groove-identity-messageapplication/vnd.informedcontrol.rms+xmlapplication/vnd.iptc.g2.catalogitem+xmlapplication/vnd.iptc.g2.conceptitem+xmlapplication/vnd.iptc.g2.newsmessage+xmlapplication/vnd.iptc.g2.packageitem+xmlapplication/vnd.irepository.package+xmlapplication/vnd.japannet-payment-wakeupapplication/vnd.motorola.flexsuite.adsiapplication/vnd.ms-wmdrm.meter-chlg-reqapplication/vnd.ntt-local.content-shareapplication/vnd.ntt-local.file-transferapplication/vnd.ntt-local.sip-ta_remoteapplication/vnd.oasis.opendocument.textapplication/vnd.oma.cab-subs-invite+xmlapplication/vnd.openofficeorg.extensionapplication/vnd.radisys.msml-dialog+xmlapplication/vnd.shana.informed.formdataapplication/vnd.sun.xml.writer.templateapplication/vnd.yellowriver-custom-menumessage/global-disposition-notificationaudio/amr-wbaudio/atrac3audio/evrcb0audio/evrcb1audio/evrcnwaudio/evrcwbaudio/fwdredaudio/g711-0audio/tsvcisaudio/ulpfecaudio/vmr-wbaudio/vorbisaudio/x-aiffaudio/x-flacimage/naplpsimage/x-iconimage/x-pictmessage/cpimmessage/httpmessage/newstext/flexfectext/jcr-cndtext/stringstext/vnd.abctext/vnd.flytext/vnd.gmltext/vnd.hgltext/x-vcardvideo/ulpfecapplication/alto-endpointcostparams+jsonapplication/alto-endpointpropparams+jsonapplication/alto-updatestreamparams+jsonapplication/tamp-sequence-adjust-confirmapplication/vnd.3gpp.mcptt-ue-config+xmlapplication/vnd.afpc.afplinedata-pagedefapplication/vnd.citationstyles.style+xmlapplication/vnd.d2l.coursepackage1p0+zipapplication/vnd.dir-bi.plate-dl-nosuffixapplication/vnd.dvb.notif-ia-msglist+xmlapplication/vnd.google-apps.presentationapplication/vnd.iptc.g2.planningitem+xmlapplication/vnd.japannet-jpnstore-wakeupapplication/vnd.japannet-setstore-wakeupapplication/vnd.marlin.drm.conftoken+xmlapplication/vnd.motorola.flexsuite.gotapapplication/vnd.ms-printschematicket+xmlapplication/vnd.ms-windows.devicepairingapplication/vnd.nokia.isds-radio-presetsapplication/vnd.oasis.opendocument.chartapplication/vnd.oasis.opendocument.imageapplication/vnd.oma.cab-address-book+xmlapplication/vnd.oma.group-usage-list+xmlapplication/vnd.oma.poc.final-report+xmlapplication/vnd.sealedmedia.softseal.pdfapplication/vnd.sun.xml.impress.templateaudio/cnaudio/dvaudio/l8audio/xmfont/otffont/ttftext/cmdtext/cqltext/csstext/csvtext/dnstext/jsxtext/mdxtext/redtext/rtftext/rtxtext/vtttext/x-ctext/xmlvideo/dvvideo/nvapplication/sarif-external-properties+jsonapplication/vnd.3gpp.mcvideo-ue-config+xmlapplication/vnd.afpc.modca-objectcontainerapplication/vnd.cendio.thinlinc.clientconfapplication/vnd.century-systems.tcp_streamapplication/vnd.dvb.iptv.alfec-enhancementapplication/vnd.emclient.accessrequest+xmlapplication/vnd.fujixerox.docuworks.binderapplication/vnd.handheld-entertainment+xmlapplication/vnd.innopath.wamp.notificationapplication/vnd.japannet-directory-serviceapplication/vnd.marlin.drm.actiontoken+xmlapplication/vnd.ms-playready.initiator+xmlapplication/vnd.oasis.opendocument.formulaapplication/vnd.oci.image.manifest.v1+jsonapplication/vnd.oma.bcast.notification+xmlapplication/vnd.shana.informed.interchangeapplication/vnd.stardivision.writer-globalapplication/emergencycalldata.deviceinfo+xmlapplication/vnd.1000minds.decision-model+xmlapplication/vnd.3gpp.mcdata-user-profile+xmlapplication/vnd.3gpp.mcptt-floor-request+xmlapplication/vnd.3gpp.mcptt-location-info+xmlapplication/vnd.apothekende.reservation+jsonapplication/vnd.cluetrust.cartomobile-configapplication/vnd.dvb.notif-aggregate-root+xmlapplication/vnd.fujifilm.fb.docuworks.binderapplication/vnd.ims.lti.v2.toolproxy.id+jsonapplication/vnd.ims.lti.v2.toolsettings+jsonapplication/vnd.japannet-registration-wakeupapplication/vnd.japannet-verification-wakeupapplication/vnd.nokia.landmarkcollection+xmlapplication/vnd.nokia.n-gage.symbian.installapplication/vnd.oipf.mippvcontrolmessage+xmlapplication/vnd.piaccess.application-licenceapplication/vnd.radisys.msml-dialog-base+xmlapplication/mbms-protection-description+xmlapplication/vnd.3gpp.mcptt-user-profile+xmlapplication/vnd.gov.sk.xmldatacontainer+xmlapplication/vnd.ms-printing.printticket+xmlapplication/vnd.ntt-local.ogw_remote-accessapplication/vnd.ntt-local.sip-ta_tcp_streamapplication/vnd.oasis.opendocument.databaseapplication/vnd.oasis.opendocument.graphicsapplication/vnd.oasis.opendocument.text-webapplication/vnd.oma.cab-feature-handler+xmlapplication/vnd.poc.group-advertisement+xmlapplication/vnd.radisys.msml-audit-conf+xmlapplication/vnd.radisys.msml-audit-conn+xmlapplication/vnd.shana.informed.formtemplateapplication/vnd.software602.filler.form+xmlapplication/vnd.uplanet.bearer-choice-wbxmlapplication/vnd.wolfram.mathematica.packageapplication/alto-updatestreamcontrol+jsonapplication/emergencycalldata.comment+xmlapplication/emergencycalldata.control+xmlapplication/tamp-community-update-confirmapplication/vnd.3gpp.mcdata-ue-config+xmlapplication/vnd.3lightssoftware.imagescalapplication/vnd.ims.lti.v2.toolproxy+jsonapplication/vnd.iptc.g2.knowledgeitem+xmlapplication/vnd.ms-windows.nwprinting.oobapplication/vnd.ms-windows.printerpairingapplication/vnd.oma.bcast.drm-trigger+xmlapplication/vnd.sealedmedia.softseal.htmlapplication/vnd.tao.intent-module-archiveapplication/xcon-conference-info-diff+xmlapplication/emergencycalldata.serviceinfo+xmlapplication/mbms-user-service-description+xmlapplication/vnd.3gpp.mcptt-service-config+xmlapplication/vnd.3gpp.mcptt-ue-init-config+xmlapplication/vnd.3gpp.mcvideo-user-profile+xmlapplication/vnd.3gpp.state-and-event-info+xmlapplication/vnd.collabio.xodocuments.documentapplication/vnd.fujixerox.docuworks.containerapplication/vnd.microsoft.portable-executableapplication/vnd.oma.bcast.provisioningtriggerapplication/vnd.radisys.msml-audit-dialog+xmlapplication/vnd.radisys.msml-audit-stream+xmlapplication/vnd.radisys.msml-dialog-group+xmlapplication/emergencycalldata.providerinfo+xmlapplication/vnd.3gpp.mcdata-service-config+xmlapplication/vnd.3gpp.mcptt-mbms-usage-info+xmlapplication/vnd.3gpp.mcvideo-location-info+xmlapplication/vnd.ms-excel.addin.macroenabled.12application/vnd.ms-excel.sheet.macroenabled.12application/vnd.ms-package.obfuscated-opentypeapplication/vnd.ms-printdevicecapabilities+xmlapplication/vnd.oasis.opendocument.spreadsheetapplication/vnd.oasis.opendocument.text-masterapplication/vnd.oipf.contentaccessdownload+xmlapplication/vnd.radisys.msml-dialog-speech+xmlapplication/vnd.3gpp.access-transfer-events+xmlapplication/vnd.3gpp.mcvideo-service-config+xmlapplication/vnd.fujifilm.fb.docuworks.containerapplication/vnd.globalplatform.card-content-mgtapplication/vnd.mitsubishi.misty-guard.trustwebapplication/vnd.oasis.opendocument.presentationapplication/vnd.oipf.contentaccessstreaming+xmlapplication/vnd.oma.bcast.smartcard-trigger+xmlapplication/vnd.software602.filler.form-xml-zipapplication/x-www-form-urlencoded;charset=UTF-8application/vnd.3gpp.mcvideo-affiliation-info+xmlapplication/vnd.collabio.xodocuments.presentationapplication/vnd.microsoft.windows.thumbnail-cacheapplication/vnd.ms-excel.template.macroenabled.12application/vnd.oasis.opendocument.chart-templateapplication/vnd.oasis.opendocument.image-templateapplication/vnd.oma.bcast.simple-symbol-containerapplication/vnd.oma.poc.invocation-descriptor+xmlapplication/vnd.radisys.msml-dialog-transform+xmlapplication/vnd.yamaha.openscoreformat.osfpvg+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xmlapplication/vnd.openxmlformats-officedocument.presentationml.comments+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presentationapplication/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.footer+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.styles+xmlapplication/vnd.openxmlformats-package.digital-signature-xmlsignature+xmlapplication/vnd.openxmlformats-officedocument.presentationml.notesmaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slidelayout+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slidemaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.tablestyles+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xmlapplication/emergencycalldata.subscriberinfo+xmlapplication/vnd.3gpp.mcvideo-mbms-usage-info+xmlapplication/vnd.cluetrust.cartomobile-config-pkgapplication/vnd.collabio.xodocuments.spreadsheetapplication/vnd.ms-word.document.macroenabled.12application/vnd.ms-word.template.macroenabled.12application/vnd.oasis.opendocument.text-templateapplication/vnd.3gpp.mcdata-affiliation-command+xmlapplication/vnd.anser-web-funds-transfer-initiationapplication/vnd.ims.lti.v2.toolconsumerprofile+jsonapplication/vnd.ims.lti.v2.toolsettings.simple+jsonapplication/vnd.ms-powerpoint.addin.macroenabled.12application/vnd.ms-powerpoint.slide.macroenabled.12application/vnd.oasis.opendocument.formula-templateapplication/vnd.openxmlformats-officedocument.presentationml.notesslide+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.connections+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.comments+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.settings+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presprops+xmlapplication/vnd.openxmlformats-officedocument.presentationml.viewprops+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xmlapplication/vnd.3gpp-v2x-local-service-informationapplication/vnd.3gpp.mcptt-affiliation-command+xmlapplication/vnd.doremir.scorecloud-binary-documentapplication/vnd.llamagraphics.life-balance.desktopapplication/vnd.radisys.msml-dialog-fax-detect+xmlapplication/mbms-associated-procedure-description+xmlapplication/vnd.3gpp.mcvideo-transmission-request+xmlapplication/vnd.dvb.notif-ia-registration-request+xmlapplication/vnd.ms-excel.sheet.binary.macroenabled.12application/vnd.oma.poc.optimized-progress-report+xmlapplication/vnd.etsi.overload-control-policy-dataset+xmlapplication/vnd.globalplatform.card-content-mgt-responseapplication/vnd.oasis.opendocument.presentation-templateapplication/vnd.openxmlformats-officedocument.vmldrawingapplication/vnd.openxmlformats-package.relationships+xmlapplication/vnd.openxmlformats-officedocument.customxmlproperties+xmlapplication/vnd.openxmlformats-officedocument.extended-properties+xmlapplication/vnd.openxmlformats-officedocument.presentationml.tags+xmlapplication/vnd.openxmlformats-officedocument.presentationml.templateapplication/vnd.openxmlformats-officedocument.spreadsheetml.table+xmlapplication/vnd.3gpp.mcvideo-affiliation-command+xmlapplication/vnd.oasis.opendocument.graphics-templateapplication/vnd.oma.poc.detailed-progress-report+xmlapplication/vnd.radisys.msml-dialog-fax-sendrecv+xmlapplication/vnd.anser-web-certificate-issue-initiationapplication/vnd.collabio.xodocuments.document-templateapplication/vnd.dvb.notif-ia-registration-response+xmlapplication/vnd.ms-powerpoint.template.macroenabled.12application/vnd.llamagraphics.life-balance.exchange+xmlapplication/vnd.ms-powerpoint.slideshow.macroenabled.12application/vnd.oasis.opendocument.spreadsheet-templateapplication/vnd.openxmlformats-officedocument.theme+xmlapplication/vnd.openxmlformats-officedocument.drawingml.chartshapes+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramdata+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.templateapplication/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xmlapplication/vnd.collabio.xodocuments.presentation-templateapplication/vnd.ms-powerpoint.presentation.macroenabled.12application/vnd.openxmlformats-package.core-properties+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slide+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideshowapplication/vnd.openxmlformats-officedocument.spreadsheetml.styles+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xmlapplication/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.template.main+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xmlapplication/vnd.openxmlformats-officedocument.presentationml.commentauthors+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xmlapplication/vnd.collabio.xodocuments.spreadsheet-templateapplication/vnd.openxmlformats-officedocument.drawing+xmlapplication/vnd.openxmlformats-officedocument.drawingml.chart+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.comments+xmltext/n3application/vnd.adobe.air-application-installer-package+zipapplication/vnd.oma.bcast.associated-procedure-parameter+xmlapplication/vnd.openxmlformats-officedocument.themeoverride+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideapplication/vnd.openxmlformats-officedocument.custom-properties+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.templateapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"; + const _bytes = "application/cpl+xmlapplication/dca-rftapplication/edi-x12application/edifactapplication/elm+xmlapplication/epp+xmlapplication/expressapplication/fdt+xmlapplication/flexfecapplication/gml+xmlapplication/gpx+xmlapplication/its+xmlapplication/java-vmapplication/ld+jsonapplication/lgr+xmlapplication/lpf+zipapplication/n-quadsapplication/nasdataapplication/odm+xmlapplication/onenoteapplication/p21+zipapplication/pkixcmpapplication/pls+xmlapplication/prs.cwwapplication/prs.cynapplication/rdf+xmlapplication/rfc+xmlapplication/rsd+xmlapplication/rss+xmlapplication/sep+xmlapplication/sep-exiapplication/shf+xmlapplication/sru+xmlapplication/td+jsonapplication/tei+xmlapplication/vnd.ageapplication/vnd.bmiapplication/vnd.bpfapplication/vnd.dbfapplication/vnd.dnaapplication/vnd.dxrapplication/vnd.dzrapplication/vnd.fdfapplication/vnd.gmxapplication/vnd.hdtapplication/vnd.jamapplication/vnd.lasapplication/vnd.mcdapplication/vnd.mifapplication/vnd.obnapplication/vnd.rarapplication/vnd.sarapplication/vnd.shpapplication/vnd.shxapplication/vnd.svdapplication/vnd.tmlapplication/vnd.vcxapplication/vnd.vsfapplication/vnd.wmcapplication/vnd.wqdapplication/vnd.zulapplication/x-bcpioapplication/x-blorbapplication/x-bzip2application/x-cocoaapplication/x-envoyapplication/x-glulxapplication/x-latexapplication/x-pilotapplication/x-ustarapplication/x400-bpapplication/xml-dtdapplication/xop+xmlapplication/yin+xmlaudio/mpeg4-genericaudio/vnd.3gpp.iufpaudio/vnd.cisco.nseaudio/vnd.dlna.adtsaudio/vnd.dolby.mlpaudio/vnd.dolby.mpsaudio/vnd.dolby.pl2audio/vnd.hns.audioaudio/vnd.octel.sbcaudio/vorbis-configimage/heic-sequenceimage/heif-sequenceimage/x-mrsid-imageimage/x-xwindowdumpmessage/vnd.si.simpmessage/vnd.wfa.wscmultipart/encryptedmultipart/form-datatext/cache-manifesttext/cql-expressiontext/cql-identifiertext/prs.prop.logictext/rfc822-headerstext/vnd.curl.dcurltext/vnd.curl.mcurltext/vnd.curl.scurltext/vnd.ficlab.fltvideo/mpeg4-genericvideo/vnd.hns.videox-shader/x-fragmentapplication/ace+cborapplication/atom+xmlapplication/beep+xmlapplication/cbor-seqapplication/ccmp+xmlapplication/cdfx+xmlapplication/clue+xmlapplication/cnrp+xmlapplication/cose-keyapplication/csrattrsapplication/csta+xmlapplication/cu-seemeapplication/dash+xmlapplication/dns+jsonapplication/dssc+derapplication/dssc+xmlapplication/elm+jsonapplication/emma+xmlapplication/encaprtpapplication/epub+zipapplication/fastsoapapplication/fhir+xmlapplication/geo+jsonapplication/held+xmlapplication/jrd+jsonapplication/json-seqapplication/jwk+jsonapplication/lost+xmlapplication/mads+xmlapplication/mets+xmlapplication/mods+xmlapplication/mud+jsonapplication/passportapplication/pgp-keysapplication/pidf+xmlapplication/pkix-crlapplication/pskc+xmlapplication/pvd+jsonapplication/rlmi+xmlapplication/rpki-roaapplication/sbml+xmlapplication/smil+xmlapplication/soap+xmlapplication/srgs+xmlapplication/ssdl+xmlapplication/ssml+xmlapplication/swid+xmlapplication/ttml+xmlapplication/vnd.ankiapplication/vnd.bpf3application/vnd.curlapplication/vnd.dartapplication/vnd.hbciapplication/vnd.jispapplication/vnd.koanapplication/vnd.loomapplication/vnd.mferapplication/vnd.mfmpapplication/vnd.mseqapplication/vnd.nimnapplication/vnd.nitfapplication/vnd.palmapplication/vnd.pcosapplication/vnd.psfsapplication/vnd.semaapplication/vnd.semdapplication/vnd.semfapplication/vnd.smafapplication/vnd.ufdlapplication/vnd.xaraapplication/vnd.xfdlapplication/wsdl+xmlapplication/x-cdlinkapplication/x-ms-wmdapplication/x-ms-wmzapplication/x-msclipapplication/x-netcdfapplication/x-pkcs12application/x-subripapplication/x-sv4crcapplication/xaml+xmlapplication/xenc+xmlapplication/xmpp+xmlapplication/xslt+xmlapplication/xspf+xmlaudio/tetra_acelp_bbaudio/vnd.dece.audioaudio/vnd.dolby.pl2xaudio/vnd.dolby.pl2zaudio/vnd.everad.pljaudio/vnd.nortel.vbkaudio/x-pn-realaudioimage/vnd.sealed.pngimage/vnd.zbrush.pcxmodel/vnd.pytha.pyoxmultipart/byterangesmultipart/header-settext/vnd.iptc.newsmlvideo/vnd.dece.videovideo/vnd.sealed.swfvideo/vnd.youtube.ytapplication/3gpp-ims+xmlapplication/3gpphal+jsonapplication/andrew-insetapplication/atsc-dwd+xmlapplication/calendar+xmlapplication/captive+jsonapplication/cea-2018+xmlapplication/coap-payloadapplication/commongroundapplication/cose-key-setapplication/cstadata+xmlapplication/davmount+xmlapplication/geo+json-seqapplication/geoxacml+xmlapplication/java-archiveapplication/jf2feed+jsonapplication/jwk-set+jsonapplication/lostsync+xmlapplication/mac-binhex40application/mbms-msk+xmlapplication/metalink+xmlapplication/mosskey-dataapplication/ocsp-requestapplication/octet-streamapplication/pkix-pkipathapplication/problem+jsonapplication/prs.hpub+zipapplication/reputon+jsonapplication/secevent+jwtapplication/session-infoapplication/sparql-queryapplication/vnd.3gpp.lppapplication/vnd.3gpp.smsapplication/vnd.acucobolapplication/vnd.api+jsonapplication/vnd.claymoreapplication/vnd.cups-pdfapplication/vnd.cups-ppdapplication/vnd.cups-rawapplication/vnd.curl.carapplication/vnd.dece.zipapplication/vnd.dvb.dvbjapplication/vnd.ecip.rlpapplication/vnd.geo+jsonapplication/vnd.geospaceapplication/vnd.hal+jsonapplication/vnd.hp-pclxlapplication/vnd.httphoneapplication/vnd.igloaderapplication/vnd.intergeoapplication/vnd.intu.qboapplication/vnd.intu.qfxapplication/vnd.isac.fcsapplication/vnd.ms-excelapplication/vnd.ms-worksapplication/vnd.musicianapplication/vnd.ocf+cborapplication/vnd.oma.dcdcapplication/vnd.oma.pushapplication/vnd.onepagerapplication/vnd.paos.xmlapplication/vnd.preminetapplication/vnd.sbm.mid2application/vnd.trid.tptapplication/vnd.uoml+xmlapplication/vnd.vd-studyapplication/vnd.vel+jsonapplication/vnd.wap.wmlcapplication/vnd.webturboapplication/voicexml+xmlapplication/wspolicy+xmlapplication/x-bittorrentapplication/x-conferenceapplication/x-dtbncx+xmlapplication/x-dtbook+xmlapplication/x-font-type1application/x-font-vfontapplication/x-gramps-xmlapplication/x-javascriptapplication/x-mscardfileapplication/x-msdownloadapplication/x-msmetafileapplication/x-msscheduleapplication/x-msterminalapplication/x-t3vm-imageapplication/xcap-att+xmlimage/vnd.microsoft.iconimage/x-portable-graymaptext/html; charset=utf-8text/plain;charset=utf-8text/provenance-notationtext/prs.fallenstein.rsttext/vnd.motorola.reflextext/vnd.ms-mediapackagetext/vnd.senx.warpscripttext/vnd.si.uricataloguevideo/vnd.motorola.videoapplication/atomcat+xmlapplication/atomsvc+xmlapplication/cdmi-domainapplication/cdmi-objectapplication/dns-messageapplication/docbook+xmlapplication/edi-consentapplication/fastinfosetapplication/gltf-bufferapplication/hyperstudioapplication/ibe-pp-dataapplication/jsonml+jsonapplication/link-formatapplication/marcxml+xmlapplication/mathematicaapplication/mmt-aei+xmlapplication/mmt-usd+xmlapplication/msc-ivr+xmlapplication/problem+xmlapplication/prs.pluckerapplication/prs.xsf+xmlapplication/reginfo+xmlapplication/rpki-updownapplication/rtploopbackapplication/sensml+cborapplication/sensml+jsonapplication/set-paymentapplication/tamp-updateapplication/tlsrpt+gzipapplication/tlsrpt+jsonapplication/tve-triggerapplication/vnd.acucorpapplication/vnd.dpgraphapplication/vnd.dvb.aitapplication/vnd.dvb.pfrapplication/vnd.dynageoapplication/vnd.efi.imgapplication/vnd.efi.isoapplication/vnd.enlivenapplication/vnd.geonextapplication/vnd.geoplanapplication/vnd.hal+xmlapplication/vnd.hc+jsonapplication/vnd.hp-hpglapplication/vnd.hp-hpidapplication/vnd.hp-jlytapplication/vnd.kahootzapplication/vnd.ms-tnefapplication/vnd.nervanaapplication/vnd.oma.dcdapplication/vnd.osgi.dpapplication/vnd.panoplyapplication/vnd.rim.codapplication/vnd.rs-274xapplication/vnd.sbm.cidapplication/vnd.scribusapplication/vnd.seemailapplication/vnd.sqlite3application/vnd.sss-codapplication/vnd.sss-dtfapplication/vnd.sss-ntfapplication/vnd.trueappapplication/vnd.truedocapplication/vnd.uri-mapapplication/vnd.wap.sicapplication/vnd.wap.slcapplication/vnd.wfa.dppapplication/vnd.wfa.p2papplication/vnd.wfa.wscapplication/vnd.xmi+xmlapplication/vnd.yaowemeapplication/webassemblyapplication/x-chess-pgnapplication/x-httpd-phpapplication/x-xliff+xmlapplication/x-xpinstallapplication/xcap-el+xmlapplication/xcap-ns+xmlaudio/vnd.digital-windsaudio/vnd.dolby.heaac.1audio/vnd.dolby.heaac.2audio/vnd.dolby.pulse.1image/x-portable-anymapimage/x-portable-bitmapimage/x-portable-pixmapmessage/delivery-statusmessage/feedback-reportmessage/tracking-statusmodel/vnd.flatland.3dmlmultipart/voice-messagetext/css; charset=utf-8text/html; charset=utf8text/html;charset=utf-8text/vnd.dmclientscriptvideo/vnd.dlna.mpeg-ttsx-conference/x-cooltalkapplication/kpml-request+xmlapplication/load-control+xmlapplication/merge-patch+jsonapplication/mrb-consumer+xmlapplication/news-checkgroupsapplication/poc-settings+xmlapplication/rls-services+xmlapplication/route-s-tsid+xmlapplication/rpki-publicationapplication/samlmetadata+xmlapplication/scvp-cv-responseapplication/scvp-vp-responseapplication/set-registrationapplication/soap+fastinfosetapplication/tamp-apex-updateapplication/timestamped-dataapplication/urc-grpsheet+xmlapplication/urc-ressheet+xmlapplication/vnd.3gpp.bsf+xmlapplication/vnd.3gpp.sms+xmlapplication/vnd.amadeus+jsonapplication/vnd.amazon.ebookapplication/vnd.apple.pkpassapplication/vnd.artisan+jsonapplication/vnd.chemdraw+xmlapplication/vnd.coffeescriptapplication/vnd.contact.cmsgapplication/vnd.dreamfactoryapplication/vnd.ecdis-updateapplication/vnd.ecowin.chartapplication/vnd.esrustno3+xmlapplication/vnd.etsi.aoc+xmlapplication/vnd.etsi.cug+xmlapplication/vnd.etsi.sci+xmlapplication/vnd.etsi.tsl+xmlapplication/vnd.etsi.tsl.derapplication/vnd.groove-vcardapplication/vnd.jsk.isdn-ngnapplication/vnd.kde.kformulaapplication/vnd.kidspirationapplication/vnd.las.las+jsonapplication/vnd.noblenet-webapplication/vnd.novadigm.edmapplication/vnd.novadigm.edxapplication/vnd.novadigm.extapplication/vnd.oipf.pae.gemapplication/vnd.onepagertampapplication/vnd.onepagertamxapplication/vnd.onepagertatpapplication/vnd.onepagertatxapplication/vnd.restful+jsonapplication/vnd.rn-realmediaapplication/vnd.spotfire.dxpapplication/vnd.spotfire.sfsapplication/vnd.sun.wadl+xmlapplication/vnd.sun.xml.calcapplication/vnd.sun.xml.drawapplication/vnd.sun.xml.mathapplication/vnd.sus-calendarapplication/vnd.tcpdump.pcapapplication/vnd.triscape.mxsapplication/vnd.uplanet.listapplication/vnd.veryant.thinapplication/vnd.wv.csp+wbxmlapplication/vnd.xfdl.webformapplication/voucher-cms+jsonapplication/whoispp-responseapplication/x-ace-compressedapplication/x-authorware-binapplication/x-authorware-mapapplication/x-authorware-segapplication/x-cfs-compressedapplication/x-debian-packageapplication/x-dgc-compressedapplication/x-font-linux-psfapplication/x-gca-compressedapplication/x-java-jnlp-fileapplication/x-lzh-compressedapplication/x-ms-applicationapplication/x-rar-compressedapplication/x-virtualbox-hddapplication/x-virtualbox-ovaapplication/x-virtualbox-ovfapplication/x-virtualbox-vdiapplication/x-virtualbox-vhdaudio/vnd.cmles.radio-eventsimage/vnd.globalgraphics.pgbtext/javascript;charset=utf8text/vnd.familysearch.gedcomvideo/vnd.iptvforum.ttsmpeg2video/vnd.radgamettools.binkapplication/3gpphalforms+jsonapplication/alto-costmap+jsonapplication/alto-propmap+jsonapplication/ibe-pkg-reply+xmlapplication/json;charset=utf8application/kpml-response+xmlapplication/mbms-envelope+xmlapplication/mbms-register+xmlapplication/mbms-schedule+xmlapplication/media_control+xmlapplication/news-transmissionapplication/oebps-package+xmlapplication/ppsp-tracker+jsonapplication/prs.rdf-xml-cryptapplication/rpki-ghostbustersapplication/samlassertion+xmlapplication/sgml-open-catalogapplication/simple-filter+xmlapplication/spirits-event+xmlapplication/tamp-status-queryapplication/vnd.3gpp.gmop+xmlapplication/vnd.3gpp.ussd+xmlapplication/vnd.adobe.xdp+xmlapplication/vnd.apple.keynoteapplication/vnd.apple.mpegurlapplication/vnd.apple.numbersapplication/vnd.balsamiq.bmprapplication/vnd.bbf.usp.errorapplication/vnd.byu.uapi+jsonapplication/vnd.clonk.c4groupapplication/vnd.comicbook+zipapplication/vnd.comicbook-rarapplication/vnd.crick.clickerapplication/vnd.cyclonedx+xmlapplication/vnd.dece.ttml+xmlapplication/vnd.desmume.movieapplication/vnd.document+jsonapplication/vnd.ecowin.seriesapplication/vnd.enphase.envoyapplication/vnd.etsi.mcid+xmlapplication/vnd.etsi.pstn+xmlapplication/vnd.ezpix-packageapplication/vnd.fluxtime.clipapplication/vnd.fsc.weblaunchapplication/vnd.fujitsu.oasysapplication/vnd.fujixerox.dddapplication/vnd.geogebra.fileapplication/vnd.geogebra.toolapplication/vnd.hcl-bireportsapplication/vnd.ims.imsccv1p1application/vnd.ims.imsccv1p2application/vnd.ims.imsccv1p3application/vnd.lotus-wordproapplication/vnd.motorola.iprmapplication/vnd.ms-fontobjectapplication/vnd.ms-pki.seccatapplication/vnd.ms-powerpointapplication/vnd.ncd.referenceapplication/vnd.nebumind.lineapplication/vnd.nokia.pcd+xmlapplication/vnd.oma.lwm2m+tlvapplication/vnd.orange.indataapplication/vnd.osa.netdeployapplication/vnd.powerbuilder6application/vnd.powerbuilder7application/vnd.rainstor.dataapplication/vnd.shopkick+jsonapplication/vnd.smart.teacherapplication/vnd.street-streamapplication/vnd.swiftview-icsapplication/vnd.syncml.dm+xmlapplication/vnd.tri.onesourceapplication/vnd.uplanet.alertapplication/vnd.ves.encryptedapplication/vnd.wmf.bootstrapapplication/vnd.yamaha.hv-dicapplication/x-apple-diskimageapplication/x-dtbresource+xmlapplication/x-font-framemakerapplication/x-font-sunos-newsapplication/x-shockwave-flashapplication/x-silverlight-appapplication/x-virtualbox-vboxapplication/x-virtualbox-vmdkapplication/x-x509-ca-ra-certaudio/atrac-advanced-losslessaudio/vnd.presonus.multitracktext/1d-interleaved-parityfectext/javascript; charset=utf8application/alto-cdni+jsonapplication/bacnet-xdd+zipapplication/cdmi-containerapplication/dash-patch+xmlapplication/index.responseapplication/mac-compactproapplication/moss-signatureapplication/multipart-coreapplication/news-groupinfoapplication/pkix-attr-certapplication/provenance+xmlapplication/vnd.3gpp.5gnasapplication/vnd.3gpp2.tcapapplication/vnd.adobe.xfdfapplication/vnd.aether.impapplication/vnd.afpc.modcaapplication/vnd.ah-barcodeapplication/vnd.audiographapplication/vnd.canon-cpdlapplication/vnd.canon-lipsapplication/vnd.cinderellaapplication/vnd.curl.pcurlapplication/vnd.drive+jsonapplication/vnd.epson.saltapplication/vnd.etsi.mheg5application/vnd.fdsn.mseedapplication/vnd.filmit.zfcapplication/vnd.flographitapplication/vnd.framemakerapplication/vnd.fut-misnetapplication/vnd.fuzzysheetapplication/vnd.hl7cda+xmlapplication/vnd.hyper+jsonapplication/vnd.ibm.modcapapplication/vnd.iccprofileapplication/vnd.insors.igmapplication/vnd.kde.karbonapplication/vnd.kde.kchartapplication/vnd.kenameaappapplication/vnd.mason+jsonapplication/vnd.micro+jsonapplication/vnd.miele+jsonapplication/vnd.mobius.dafapplication/vnd.mobius.disapplication/vnd.mobius.mbkapplication/vnd.mobius.mqyapplication/vnd.mobius.mslapplication/vnd.mobius.plcapplication/vnd.mobius.txfapplication/vnd.ms-outlookapplication/vnd.ms-pki.stlapplication/vnd.ms-projectapplication/vnd.music-niffapplication/vnd.olpc-sugarapplication/vnd.patentdiveapplication/vnd.pmi.widgetapplication/vnd.sealed.3dfapplication/vnd.sealed.csfapplication/vnd.sealed.docapplication/vnd.sealed.emlapplication/vnd.sealed.mhtapplication/vnd.sealed.netapplication/vnd.sealed.pptapplication/vnd.sealed.xlsapplication/vnd.siren+jsonapplication/vnd.syncml+xmlapplication/vnd.wv.csp+xmlapplication/vnd.wv.ssp+xmlapplication/vnd.xacml+jsonapplication/vnd.xmpie.cpkgapplication/vnd.xmpie.dpkgapplication/vnd.xmpie.planapplication/vnd.xmpie.ppkgapplication/vnd.xmpie.xlimapplication/vnd.youtube.ytapplication/wordperfect5.1application/x-futuresplashapplication/x-lua-bytecodeapplication/x-x509-ca-certapplication/xcap-error+xmlapplication/yang-data+jsonapplication/yang-patch+xmlaudio/vnd.nokia.mobile-xmftext/x-handlebars-templatevideo/vnd.directv.mpeg-ttsvideo/vnd.iptvforum.ttsavcapplication/alto-error+jsonapplication/atomdeleted+xmlapplication/auth-policy+xmlapplication/call-completionapplication/cdmi-capabilityapplication/coap-group+jsonapplication/dialog-info+xmlapplication/jscalendar+jsonapplication/json-patch+jsonapplication/mosskey-requestapplication/mrb-publish+xmlapplication/opc-nodeset+xmlapplication/p2p-overlay+xmlapplication/pkcs7-signatureapplication/pkcs8-encryptedapplication/remote-printingapplication/scvp-cv-requestapplication/scvp-vp-requestapplication/senml-etch+cborapplication/senml-etch+jsonapplication/timestamp-queryapplication/timestamp-replyapplication/vnd.ahead.spaceapplication/vnd.android.otaapplication/vnd.apple.pagesapplication/vnd.arastra.swiapplication/vnd.autopackageapplication/vnd.avalon+jsonapplication/vnd.avistar+xmlapplication/vnd.bbf.usp.msgapplication/vnd.cab-jscriptapplication/vnd.cloanto.rp9application/vnd.commonspaceapplication/vnd.cosmocallerapplication/vnd.ctct.ws+xmlapplication/vnd.cups-rasterapplication/vnd.d3m-datasetapplication/vnd.d3m-problemapplication/vnd.ds-keypointapplication/vnd.dvb.serviceapplication/vnd.eudora.dataapplication/vnd.ezpix-albumapplication/vnd.frogans.fncapplication/vnd.frogans.ltfapplication/vnd.futoin+cborapplication/vnd.futoin+jsonapplication/vnd.geocube+xmlapplication/vnd.groove-helpapplication/vnd.heroku+jsonapplication/vnd.ibm.minipayapplication/vnd.kde.kontourapplication/vnd.kde.kspreadapplication/vnd.las.las+xmlapplication/vnd.lotus-1-2-3application/vnd.lotus-notesapplication/vnd.medcalcdataapplication/vnd.ms-artgalryapplication/vnd.ms-htmlhelpapplication/vnd.ms-opentypeapplication/vnd.muvee.styleapplication/vnd.ncd.controlapplication/vnd.oma.dd2+xmlapplication/vnd.oma.pal+xmlapplication/vnd.onepagertatapplication/vnd.openeye.oebapplication/vnd.osgi.bundleapplication/vnd.pocketlearnapplication/vnd.realvnc.bedapplication/vnd.sealed.tiffapplication/vnd.vectorworksapplication/vnd.wordperfectapplication/watcherinfo+xmlapplication/x-7z-compressedapplication/x-iso9660-imageapplication/x-msdos-programapplication/xhtml-voice+xmlapplication/yang-patch+jsonaudio/vnd.rhetorex.32kadpcmaudio/x-pn-realaudio-pluginmultipart/vnd.bint.med-plustext/vnd.trolltech.linguistaudio/3gppaudio/aptxaudio/bv16audio/bv32audio/dvi4audio/eac3audio/evrcaudio/g719audio/g722audio/g723audio/g728audio/g729audio/ilbcaudio/isacaudio/melpaudio/mhasaudio/midiaudio/mpegaudio/opusaudio/pcmaaudio/pcmuaudio/scipaudio/silkaudio/smv0audio/sofaaudio/toneaudio/usacaudio/vdviaudio/waveaudio/webmfont/woff2image/acesimage/apngimage/avciimage/avcsimage/avifimage/fitsimage/heicimage/heifimage/hsj2image/jpegimage/jphcimage/jxraimage/jxrsimage/jxscimage/jxsiimage/jxssimage/ktx2image/tiffimage/webpmodel/igesmodel/meshmodel/stepmodel/vrmltext/mizartext/plaintext/trofftext/vcardtext/vnd.atext/x-asmtext/x-luatext/x-nfotext/x-orgtext/x-sfvvideo/3gppvideo/celbvideo/ffv1video/h261video/h263video/h264video/h265video/jpegvideo/jxsvvideo/mp1svideo/mp2pvideo/mp2tvideo/mpegvideo/scipvideo/webmapplication/applefileapplication/cals-1840application/ccxml+xmlapplication/city+jsonapplication/csvm+jsonapplication/cybercashapplication/dashdeltaapplication/dicom+xmlapplication/dots+cborapplication/dskpp+xmlapplication/fhir+jsonapplication/font-sfntapplication/font-woffapplication/index.cmdapplication/index.objapplication/index.vndapplication/inkml+xmlapplication/jose+jsonapplication/moss-keysapplication/mpeg4-iodapplication/n-triplesapplication/nlsml+xmlapplication/omdoc+xmlapplication/parityfecapplication/pkix-certapplication/raml+yamlapplication/raptorfecapplication/rdap+jsonapplication/scaip+xmlapplication/scim+jsonapplication/senml+xmlapplication/senml-exiapplication/smpte336mapplication/spdx+jsonapplication/stix+jsonapplication/tetra_isiapplication/tzif-leapapplication/vcard+xmlapplication/vnd.ciediapplication/vnd.ffsnsapplication/vnd.fintsapplication/vnd.kinarapplication/vnd.msignapplication/vnd.mynfcapplication/vnd.rapidapplication/vnd.s3smsapplication/vnd.unityapplication/vnd.visioapplication/vq-rtcpxrapplication/x-abiwordapplication/x-freearcapplication/x-mpegurlapplication/x-ms-xbapapplication/x-msmoneyapplication/x-mswriteapplication/x-stuffitapplication/x-sv4cpioapplication/x-tex-tfmapplication/x-texinfoapplication/xacml+xmlapplication/xhtml+xmlapplication/xliff+xmlapplication/xproc+xmlaudio/telephone-eventimage/vnd.tencent.tapmessage/external-bodymodel/vnd.collada+xmlmodel/x3d+fastinfosetmultipart/alternativemultipart/appledoubletext/css;charset=utf8text/grammar-ref-listtext/rtp-enc-aescm128text/vnd.dvb.subtitletext/vnd.fmi.flexstorvideo/vnd.dece.mobilevideo/vnd.nokia.mp4vrvideo/vnd.objectvideoapplication/activemessageapplication/activity+jsonapplication/atsc-held+xmlapplication/atsc-rdt+jsonapplication/atsc-rsat+xmlapplication/calendar+jsonapplication/clue_info+xmlapplication/emotionml+xmlapplication/manifest+jsonapplication/metalink4+xmlapplication/mpeg4-genericapplication/mpeg4-iod-xmtapplication/msc-mixer+xmlapplication/ocsp-responseapplication/pgp-encryptedapplication/pgp-signatureapplication/pidf-diff+xmlapplication/route-apd+xmlapplication/route-usd+xmlapplication/rpki-manifestapplication/vnd.3gpp.gtpcapplication/vnd.3gpp.ngapapplication/vnd.3gpp.pfcpapplication/vnd.3gpp.s1apapplication/vnd.3gpp2.smsapplication/vnd.adobe.fxpapplication/vnd.amiga.amiapplication/vnd.artsquareapplication/vnd.chess-pgnapplication/vnd.ctc-posmlapplication/vnd.dece.dataapplication/vnd.dolby.mlpapplication/vnd.dtg.localapplication/vnd.epson.esfapplication/vnd.epson.msfapplication/vnd.epson.ssfapplication/vnd.fdsn.seedapplication/vnd.hl7v2+xmlapplication/vnd.ieee.1905application/vnd.kde.kivioapplication/vnd.kde.kwordapplication/vnd.leap+jsonapplication/vnd.nokia.ncdapplication/vnd.pawaafileapplication/vnd.pg.formatapplication/vnd.pg.osasliapplication/vnd.pvi.ptid1application/vnd.seis+jsonapplication/vnd.sycle+xmlapplication/vnd.syft+jsonapplication/vnd.uiq.themeapplication/vnd.visionaryapplication/vnd.wap.wbxmlapplication/whoispp-queryapplication/x-font-libgrxapplication/x-font-speedoapplication/x-ms-shortcutapplication/x-msmediaviewapplication/x-mspublisherapplication/x-pki-messageapplication/x-wais-sourceapplication/xcap-caps+xmlapplication/xcap-diff+xmlapplication/xml-patch+xmlapplication/yang-data+xmlaudio/vnd.nuera.ecelp4800audio/vnd.nuera.ecelp7470audio/vnd.nuera.ecelp9600image/vnd.adobe.photoshopmultipart/x-mixed-replacetext/plain; charset=utf-8text/tab-separated-valuestext/vnd.debian.copyrightvideo/vnd.motorola.videopvideo/vnd.nokia.videovoipapplication/applixwareapplication/atomicmailapplication/batch-smtpapplication/cdmi-queueapplication/cellml+xmlapplication/dicom+jsonapplication/ecmascriptapplication/font-tdpfrapplication/javascriptapplication/macwriteiiapplication/mathml+xmlapplication/pics-rulesapplication/pkcs7-mimeapplication/postscriptapplication/prs.nprendapplication/sarif+jsonapplication/senml+cborapplication/senml+jsonapplication/sensml+xmlapplication/sensml-exiapplication/tamp-errorapplication/taxii+jsonapplication/thraud+xmlapplication/tnauthlistapplication/vcard+jsonapplication/vnd.cybankapplication/vnd.gerberapplication/vnd.grafeqapplication/vnd.gridmpapplication/vnd.hp-hpsapplication/vnd.hp-pclapplication/vnd.is-xprapplication/vnd.laszipapplication/vnd.ms-asfapplication/vnd.ms-imsapplication/vnd.ms-lrmapplication/vnd.ms-wplapplication/vnd.netfpxapplication/vnd.picselapplication/vnd.umajinapplication/vnd.wt.stfapplication/x-compressapplication/x-directorapplication/x-font-bdfapplication/x-font-dosapplication/x-font-pcfapplication/x-font-snfapplication/x-gnumericapplication/x-keepass2application/x-makeselfapplication/x-msaccessapplication/x-msbinderapplication/x-stuffitxapplication/x-zmachineaudio/rtp-enc-aescm128audio/vnd.lucent.voiceaudio/vnd.rn-realaudioimage/vnd.dece.graphicimage/vnd.dvb.subtitleimage/vnd.fastbidsheetimage/vnd.mozilla.apngmessage/global-headersmultipart/multilingualtext/css; charset=utf8text/css;charset=utf-8text/html;charset=utf8text/vnd.wap.wmlscriptvideo/rtp-enc-aescm128video/vnd.directv.mpegvideo/vnd.sealed.mpeg1video/vnd.sealed.mpeg4application/a2lapplication/amlapplication/atfapplication/ceaapplication/cfwapplication/clrapplication/cmsapplication/cwtapplication/dcdapplication/diiapplication/ditapplication/dnsapplication/efiapplication/exiapplication/gxfapplication/ippapplication/jwtapplication/lxfapplication/mf4application/mp4application/mxfapplication/nssapplication/odaapplication/odxapplication/oggapplication/p21application/pdfapplication/pdxapplication/rtfapplication/rtxapplication/sbeapplication/sdpapplication/sqlapplication/tarapplication/xmlapplication/zipaudio/clearmodeaudio/gsm-hr-08audio/mp4a-latmaudio/parityfecaudio/raptorfecaudio/vnd.qcelpaudio/x-mpegurlchemical/x-cmdfchemical/x-csmlfont/collectionimage/dicom-rleimage/x-xbitmapimage/x-xpixmapmessage/partialmessage/sipfragmodel/gltf+jsonmultipart/mixedtext/csv-schematext/ecmascripttext/javascripttext/parameterstext/vnd.wap.sitext/vnd.wap.sltext/x-markdowntext/x-suse-ymptext/x-uuencodevideo/h263-1998video/h263-2000video/h264-rcdovideo/parityfecvideo/quicktimevideo/raptorfecvideo/smpte292mvideo/x-msvideoaudio/aacaudio/ac3audio/amraudio/ascaudio/dlsaudio/evsaudio/gsmaudio/l16audio/l20audio/l24audio/lpcaudio/mp3audio/mp4audio/mpaaudio/oggaudio/redaudio/rtxaudio/s3maudio/smvaudio/t38audio/wavfont/sfntfont/woffimage/bmpimage/cgmimage/emfimage/gifimage/iefimage/jlsimage/jp2image/jphimage/jpmimage/jpximage/jxrimage/jxsimage/ktximage/pngimage/sgiimage/t38image/wmfmodel/3mfmodel/e57model/mtlmodel/objmodel/prcmodel/stlmodel/u3dtext/gff3text/htmltext/jadetext/lesstext/sgmltext/shextext/slimtext/spdxtext/t140text/yamlvideo/av1video/jpmvideo/mj2video/mp4video/mpvvideo/oggvideo/rawvideo/rtxvideo/vc1video/vc2video/vp8video/vp9application/alto-directory+jsonapplication/conference-info+xmlapplication/ibe-key-request+xmlapplication/json; charset=utf-8application/mbms-deregister+xmlapplication/oauth-authz-req+jwtapplication/patch-ops-error+xmlapplication/tamp-update-confirmapplication/trickle-ice-sdpfragapplication/vnd.3gpp.pic-bw-varapplication/vnd.businessobjectsapplication/vnd.collection+jsonapplication/vnd.cups-postscriptapplication/vnd.data-vision.rdzapplication/vnd.dtg.local.flashapplication/vnd.dvb.ipdcroamingapplication/vnd.etsi.asic-e+zipapplication/vnd.etsi.asic-s+zipapplication/vnd.f-secure.mobileapplication/vnd.fujitsu.oasysgpapplication/vnd.geogebra.slidesapplication/vnd.groove-injectorapplication/vnd.hyper-item+jsonapplication/vnd.hyperdrive+jsonapplication/vnd.ibm.afplinedataapplication/vnd.immervision-ivpapplication/vnd.immervision-ivuapplication/vnd.intertrust.nncpapplication/vnd.iso11783-10+zipapplication/vnd.lotus-freelanceapplication/vnd.lotus-organizerapplication/vnd.lotus-screencamapplication/vnd.marlin.drm.mdcfapplication/vnd.mozilla.xul+xmlapplication/vnd.multiad.creatorapplication/vnd.nearst.inv+jsonapplication/vnd.noblenet-sealerapplication/vnd.nokia.conml+xmlapplication/vnd.nokia.pcd+wbxmlapplication/vnd.oma-scws-configapplication/vnd.oma.cab-pcc+xmlapplication/vnd.omads-email+xmlapplication/vnd.otps.ct-kip+xmlapplication/vnd.oxli.countgraphapplication/vnd.powerbuilder6-sapplication/vnd.powerbuilder7-sapplication/vnd.pwg-multiplexedapplication/vnd.resilient.logicapplication/vnd.ruckus.downloadapplication/vnd.shade-save-fileapplication/vnd.shootproof+jsonapplication/vnd.solent.sdkm+xmlapplication/vnd.sun.xml.impressapplication/vnd.symbian.installapplication/vnd.syncml.dm+wbxmlapplication/vnd.uplanet.cacheopapplication/vnd.uplanet.channelapplication/vnd.uplanet.listcmdapplication/vnd.verimatrix.vcasapplication/vnd.yamaha.hv-voiceapplication/x-java-archive-diffapplication/x-pkcs7-certreqrespapplication/x-x509-next-ca-certtext/xml-external-parsed-entityvideo/vnd.radgamettools.smackerapplication/3gpdash-qoe-report+xmlapplication/alto-endpointcost+jsonapplication/alto-endpointprop+jsonapplication/fido.trusted-apps+jsonapplication/java-serialized-objectapplication/mediaservercontrol+xmlapplication/set-payment-initiationapplication/simple-message-summaryapplication/vnd.3gpp.srvcc-ext+xmlapplication/vnd.afpc.foca-codepageapplication/vnd.afpc.modca-cmtableapplication/vnd.afpc.modca-formdefapplication/vnd.afpc.modca-overlayapplication/vnd.amazon.mobi8-ebookapplication/vnd.apache.thrift.jsonapplication/vnd.aristanetworks.swiapplication/vnd.cyan.dean.root+xmlapplication/vnd.dvb.ipdcesgaccess2application/vnd.dvb.notif-init+xmlapplication/vnd.eclipse.ditto+jsonapplication/vnd.ecowin.filerequestapplication/vnd.ericsson.quickcallapplication/vnd.evolv.ecig.profileapplication/vnd.font-fontforge-sfdapplication/vnd.informix-visionaryapplication/vnd.intertrust.digiboxapplication/vnd.joost.joda-archiveapplication/vnd.mapbox-vector-tileapplication/vnd.maxmind.maxmind-dbapplication/vnd.mediastation.cdkeyapplication/vnd.meridian-slingshotapplication/vnd.mophun.applicationapplication/vnd.mophun.certificateapplication/vnd.motorola.flexsuiteapplication/vnd.ms-windows.wsd.oobapplication/vnd.nacamar.ybrid+jsonapplication/vnd.nintendo.nitro.romapplication/vnd.noblenet-directoryapplication/vnd.nokia.landmark+xmlapplication/vnd.nokia.radio-presetapplication/vnd.oipf.dae.xhtml+xmlapplication/vnd.oipf.ueprofile+xmlapplication/vnd.oma.bcast.sgdd+xmlapplication/vnd.oma.poc.groups+xmlapplication/vnd.opentimestamps.otsapplication/vnd.previewsystems.boxapplication/vnd.recordare.musicxmlapplication/vnd.route66.link66+xmlapplication/vnd.simtech-mindmapperapplication/vnd.snesdev-page-tableapplication/vnd.syncml.dmddf+wbxmlapplication/vnd.uplanet.list-wbxmlapplication/vnd.veritone.aion+jsonapplication/vnd.yamaha.smaf-phraseapplication/vnd.yamaha.through-ngnapplication/x-install-instructionsapplication/x-iwork-keynote-sffkeyapplication/x-iwork-pages-sffpagesimage/vnd.sealedmedia.softseal.gifimage/vnd.sealedmedia.softseal.jpgtext/vnd.esmertec.theme-descriptortext/vnd.radisys.msml-basic-layoutvideo/vnd.sealedmedia.softseal.movapplication/geopackage+sqlite3application/im-iscomposing+xmlapplication/json; charset=utf8application/json;charset=utf-8application/mathml-content+xmlapplication/resource-lists+xmlapplication/sparql-results+xmlapplication/urc-targetdesc+xmlapplication/vnd.3gpp-prose+xmlapplication/vnd.biopax.rdf+xmlapplication/vnd.cyclonedx+jsonapplication/vnd.dolby.mobile.1application/vnd.dolby.mobile.2application/vnd.dtg.local.htmlapplication/vnd.dvb.dvbisl+xmlapplication/vnd.dvb.ipdcesgpddapplication/vnd.ficlab.flb+zipapplication/vnd.fujitsu.oasys2application/vnd.fujitsu.oasys3application/vnd.fujixerox.art4application/vnd.fujixerox.hbplapplication/vnd.groove-accountapplication/vnd.kde.kpresenterapplication/vnd.lotus-approachapplication/vnd.micrografx.floapplication/vnd.micrografx.igxapplication/vnd.ms-3mfdocumentapplication/vnd.ms-officethemeapplication/vnd.ms-xpsdocumentapplication/vnd.msa-disk-imageapplication/vnd.nokia.catalogsapplication/vnd.oftn.l10n+jsonapplication/vnd.oma.bcast.ltkmapplication/vnd.oma.bcast.sgduapplication/vnd.oma.bcast.stkmapplication/vnd.oma.lwm2m+cborapplication/vnd.oma.lwm2m+jsonapplication/vnd.omads-file+xmlapplication/vnd.osgi.subsystemapplication/vnd.pagerduty+jsonapplication/vnd.powerbuilder75application/vnd.quarantainenetapplication/vnd.rig.cryptonoteapplication/vnd.sigrok.sessionapplication/vnd.smart.notebookapplication/vnd.sun.xml.writerapplication/vnd.tmobile-livetvapplication/vnd.uplanet.signalapplication/vnd.wap.wmlscriptcapplication/vnd.wolfram.playerapplication/vnd.zzazz.deck+xmlapplication/x-chrome-extensionapplication/x-font-ghostscriptapplication/x-mobipocket-ebookaudio/1d-interleaved-parityfecimage/vnd.fujixerox.edmics-mmrimage/vnd.fujixerox.edmics-rlcimage/vnd.valve.source.texturemessage/global-delivery-statustext/javascript; charset=utf-8text/javascript;charset=utf-8'video/1d-interleaved-parityfecaudio/amr-wb+audio/atrac-xaudio/evrcnw0audio/evrcnw1audio/evrcwb0audio/evrcwb1audio/flexfecaudio/g726-16audio/g726-24audio/g726-32audio/g726-40audio/gsm-efraudio/melp600audio/pcma-wbaudio/pcmu-wbaudio/prs.sidaudio/smv-qcpaudio/sp-midiaudio/uemclipaudio/vnd.4sbaudio/vnd.draaudio/vnd.dtsaudio/vnd.ripimage/prs.ptiimage/svg+xmlimage/tiff-fximage/vnd.dwgimage/vnd.dxfimage/vnd.fpximage/vnd.fstimage/vnd.miximage/vnd.svfmodel/vnd.dwfmodel/vnd.gdlmodel/vnd.gtwmodel/vnd.mtsmodel/vnd.vtumodel/x3d+xmltext/calendartext/calendertext/encaprtptext/enrichedtext/fhirpathtext/markdowntext/richtexttext/uri-listtext/vnd.curltext/vnd.hanstext/vnd.sositext/x-pascaltext/x-setextvideo/3gpp-ttvideo/flexfecvideo/mp4v-esvideo/pointervideo/vnd.fvtvideo/x-ms-wmapplication/atfxapplication/bdocapplication/cborapplication/cdniapplication/coseapplication/dartapplication/dvcsapplication/fitsapplication/gzipapplication/h224application/httpapplication/igesapplication/iotpapplication/isupapplication/joseapplication/jsonapplication/marcapplication/mboxapplication/mipcapplication/mp21application/oxpsapplication/qsigapplication/sgmlapplication/sipcapplication/smilapplication/srgsapplication/tomlapplication/trigapplication/tzifapplication/wasmapplication/witaapplication/x-shapplication/x-xzapplication/yangapplication/zlibapplication/zstdaudio/ip-mr_v2.5audio/mobile-xmfaudio/mpa-robustaudio/vnd.dts.hdaudio/x-matroskaimage/pwg-rasterimage/vnd.ms-ddsimage/x-freehandmessage/imdn+xmlmodel/vnd.gs-gdlmodel/vnd.gs.gdlmodel/x3d+binarymultipart/digestmultipart/reportmultipart/signedtext/rtploopbacktext/vnd.latex-ztext/vnd.wap.wmltext/x-componenttext/x-vcalendarvideo/x-matroskaapplication/alto-cdnifilter+jsonapplication/alto-networkmap+jsonapplication/tamp-sequence-adjustapplication/tamp-status-responseapplication/urc-uisocketdesc+xmlapplication/vividence.scriptfileapplication/vnd.3m.post-it-notesapplication/vnd.afpc.afplinedataapplication/vnd.bbf.usp.msg+jsonapplication/vnd.bint.med-contentapplication/vnd.bluetooth.ep.oobapplication/vnd.bluetooth.le.oobapplication/vnd.cirpack.isdn-extapplication/vnd.datapackage+jsonapplication/vnd.dece.unspecifiedapplication/vnd.dvb.esgcontainerapplication/vnd.eprints.data+xmlapplication/vnd.epson.quickanimeapplication/vnd.evolv.ecig.themeapplication/vnd.exstream-packageapplication/vnd.fujitsu.oasysprsapplication/vnd.fujixerox.art-exapplication/vnd.genomatix.tuxedoapplication/vnd.gentics.grd+jsonapplication/vnd.google-earth.kmzapplication/vnd.hzn-3d-crosswordapplication/vnd.infotech.projectapplication/vnd.intercon.formnetapplication/vnd.kodak-descriptorapplication/vnd.macports.portpkgapplication/vnd.oipf.dae.svg+xmlapplication/vnd.oipf.spdlist+xmlapplication/vnd.oma.bcast.sgbootapplication/vnd.oma.drm.risd+xmlapplication/vnd.omads-folder+xmlapplication/vnd.omaloc-supl-initapplication/vnd.patientecommsdocapplication/vnd.powerbuilder75-sapplication/vnd.proteus.magazineapplication/vnd.radisys.moml+xmlapplication/vnd.radisys.msml+xmlapplication/vnd.renlearn.rlprintapplication/vnd.rn-realmedia-vbrapplication/vnd.syncml.dmddf+xmlapplication/vnd.tableschema+jsonapplication/vnd.yamaha.hv-scriptapplication/webpush-options+jsonapplication/x-pkcs7-certificatesaudio/vnd.ms-playready.media.pyaimage/vnd.airzip.accelerator.azvmessage/disposition-notificationtext/vnd.sun.j2me.app-descriptorvideo/vnd.ms-playready.media.pyvapplication/at+jwtapplication/dec-dxapplication/mswordapplication/oscoreapplication/pkcs10application/pkcs12application/riscosapplication/ubjsonapplication/ulpfecapplication/widgetapplication/winhlpapplication/x-bdocapplication/x-bzipapplication/x-chatapplication/x-cpioapplication/x-doomapplication/x-gtarapplication/x-gzipapplication/x-perlapplication/x-sharapplication/x-tadsapplication/x-tgifapplication/x-xfigapplication/xv+xmlaudio/dsr-es201108audio/dsr-es202050audio/dsr-es202211audio/dsr-es202212audio/vnd.audiokozaudio/vnd.cns.anp1audio/vnd.cns.inf1audio/vnd.dvb.fileaudio/vnd.vmx.cvsdimage/vnd.cns.inf2image/vnd.ms-photoimage/vnd.radianceimage/vnd.wap.wbmpimage/x-cmu-rastermodel/step-xml+zipmodel/vnd.moml+xmlmodel/vnd.usdz+zipmultipart/paralleltext/prs.lines.tagtext/vnd.ascii-arttext/vnd.in3d.3dmltext/vnd.in3d.spottext/vnd.iptc.nitftext/x-java-sourcetext/x-jquery-tmplvideo/vnd.dece.mp4video/vnd.dvb.filevideo/vnd.uvvu.mp4application/expect-ct-report+jsonapplication/mbms-msk-response+xmlapplication/oblivious-dns-messageapplication/pem-certificate-chainapplication/simplesymbolcontainerapplication/tamp-community-updateapplication/vnd.3gpp.mid-call+xmlapplication/vnd.3gpp.pic-bw-largeapplication/vnd.3gpp.pic-bw-smallapplication/vnd.accpac.simply.asoapplication/vnd.accpac.simply.impapplication/vnd.adobe.flash.movieapplication/vnd.afpc.foca-charsetapplication/vnd.amundsen.maze+xmlapplication/vnd.apache.arrow.fileapplication/vnd.balsamiq.bmml+xmlapplication/vnd.banana-accountingapplication/vnd.blueice.multipassapplication/vnd.commerce-battelleapplication/vnd.cryptii.pipe+jsonapplication/vnd.crypto-shade-fileapplication/vnd.cryptomator.vaultapplication/vnd.dataresource+jsonapplication/vnd.dm.delegation+xmlapplication/vnd.dvb.ipdcesgaccessapplication/vnd.ecowin.fileupdateapplication/vnd.espass-espass+zipapplication/vnd.etsi.iptvsync+xmlapplication/vnd.etsi.simservs+xmlapplication/vnd.geometry-explorerapplication/vnd.gov.sk.e-form+xmlapplication/vnd.gov.sk.e-form+zipapplication/vnd.hhe.lesson-playerapplication/vnd.ms-cab-compressedapplication/vnd.ms-wmdrm.lic-respapplication/vnd.neurolanguage.nluapplication/vnd.nintendo.snes.romapplication/vnd.nokia.conml+wbxmlapplication/vnd.nokia.n-gage.dataapplication/vnd.oma.bcast.imd+xmlapplication/vnd.openblox.game+xmlapplication/vnd.quark.quarkxpressapplication/vnd.stardivision.calcapplication/vnd.stardivision.drawapplication/vnd.stardivision.mathapplication/vnd.stepmania.packageapplication/vnd.syncml.dmtnds+xmlapplication/vnd.ubisoft.webplayerapplication/vnd.yamaha.smaf-audioapplication/x-ns-proxy-autoconfigapplication/x-www-form-urlencodedmodel/vnd.parasolid.transmit.textapplication/atxmlapplication/cccexapplication/dicomapplication/eshopapplication/hjsonapplication/indexapplication/ipfixapplication/json5application/mikeyapplication/pkcs8application/sieveapplication/slateapplication/vemmiapplication/x-amfapplication/x-arjapplication/x-cbrapplication/x-cshapplication/x-debapplication/x-dviapplication/x-evaapplication/x-hdfapplication/x-mieapplication/x-nzbapplication/x-seaapplication/x-sqlapplication/x-tarapplication/x-tclapplication/x-texaudio/rtploopbackaudio/tetra_acelpaudio/vnd.dts.uhdaudio/x-realaudioimage/vnd.ms-modiimage/vnd.net-fpximage/vnd.pco.b16model/gltf-binarymodel/vnd.opengexmodel/vnd.sap.vdsmultipart/relatedtext/coffeescripttext/vnd.graphviztext/x-processingvideo/iso.segmentvideo/rtploopbackvideo/vnd.dece.hdvideo/vnd.dece.pdvideo/vnd.dece.sdvideo/vnd.mpegurlvideo/x-sgi-moviex-shader/x-vertexaudio/3gpp2audio/adpcmaudio/basicaudio/dat12audio/evrc0audio/evrc1audio/evrcbaudio/g7221audio/g7291audio/g729daudio/g729eaudio/qcelpaudio/speexaudio/t140caudio/x-aacaudio/x-cafaudio/x-m4aaudio/x-ttaaudio/x-wavimage/g3faximage/hej2kimage/pjpegimage/x-3dsimage/x-cmximage/x-jngimage/x-pcximage/x-rgbimage/x-tgaimage/x-xcfmessage/siptext/fwdredtext/mathmltext/shaclctext/stylustext/turtletext/ulpfectext/x-opmltext/x-sasstext/x-scssvideo/3gpp2video/bmpegvideo/bt656video/x-f4vvideo/x-flivideo/x-flvvideo/x-m4vvideo/x-mngvideo/x-smvapplication/alto-costmapfilter+jsonapplication/alto-propmapparams+jsonapplication/javascript;charset=utf8application/mathml-presentation+xmlapplication/missing-blocks+cbor-seqapplication/relax-ng-compact-syntaxapplication/resource-lists-diff+xmlapplication/token-introspection+jwtapplication/vnd.3gpp.mcdata-payloadapplication/vnd.3gpp.mcptt-info+xmlapplication/vnd.3gpp.srvcc-info+xmlapplication/vnd.3gpp2.bcmcsinfo+xmlapplication/vnd.afpc.foca-codedfontapplication/vnd.apache.arrow.streamapplication/vnd.aplextor.warrp+jsonapplication/vnd.apple.installer+xmlapplication/vnd.bekitzur-stech+jsonapplication/vnd.capasystems-pg+jsonapplication/vnd.collection.doc+jsonapplication/vnd.dvb.iptv.alfec-baseapplication/vnd.ecowin.seriesupdateapplication/vnd.etsi.iptvsad-bc+xmlapplication/vnd.evolv.ecig.settingsapplication/vnd.fastcopy-disk-imageapplication/vnd.fujifilm.fb.jfi+xmlapplication/vnd.fujixerox.docuworksapplication/vnd.groove-tool-messageapplication/vnd.liberty-request+xmlapplication/vnd.ms-color.iccprofileapplication/vnd.ms-wmdrm.meter-respapplication/vnd.multiad.creator.cifapplication/vnd.nokia.n-gage.ac+xmlapplication/vnd.nokia.radio-presetsapplication/vnd.oipf.cspg-hexbinaryapplication/vnd.oma.bcast.sprov+xmlapplication/vnd.pwg-xhtml-print+xmlapplication/vnd.stardivision.writerapplication/vnd.stepmania.stepchartapplication/vnd.syncml.dmtnds+wbxmlapplication/vnd.uplanet.alert-wbxmlapplication/vnd.wolfram.mathematicaapplication/vnd.wrq-hp3000-labelledapplication/vnd.yamaha.remote-setupapplication/x-research-info-systemsapplication/x-web-app-manifest+jsonaudio/vnd.sealedmedia.softseal.mpegmodel/vnd.parasolid.transmit.binarymodel/vnd.valve.source.compiled-mapapplication/1d-interleaved-parityfecapplication/framework-attributes+xmlapplication/javascript; charset=utf8application/javascript;charset=utf-8application/media-policy-dataset+xmlapplication/tamp-apex-update-confirmapplication/vnd.3gpp-prose-pc3ch+xmlapplication/vnd.3gpp.mcdata-info+xmlapplication/vnd.adobe.partial-uploadapplication/vnd.afpc.modca-mediummapapplication/vnd.americandynamics.accapplication/vnd.antix.game-componentapplication/vnd.apache.thrift.binaryapplication/vnd.chipnuts.karaoke-mmdapplication/vnd.collection.next+jsonapplication/vnd.coreos.ignition+jsonapplication/vnd.ecowin.seriesrequestapplication/vnd.etsi.iptvcommand+xmlapplication/vnd.etsi.iptvprofile+xmlapplication/vnd.etsi.iptvsad-cod+xmlapplication/vnd.etsi.iptvservice+xmlapplication/vnd.etsi.timestamp-tokenapplication/vnd.exstream-empower+zipapplication/vnd.google-apps.documentapplication/vnd.google-earth.kml+xmlapplication/vnd.groove-tool-templateapplication/vnd.hydrostatix.sof-dataapplication/vnd.ibm.electronic-mediaapplication/vnd.ibm.secure-containerapplication/vnd.imagemeter.image+zipapplication/vnd.infotech.project+xmlapplication/vnd.iptc.g2.newsitem+xmlapplication/vnd.logipipe.circuit+zipapplication/vnd.minisoft-hp3000-saveapplication/vnd.nokia.landmark+wbxmlapplication/vnd.oipf.spdiscovery+xmlapplication/vnd.oipf.userprofile+xmlapplication/vnd.openblox.game-binaryapplication/vnd.oracle.resource+jsonapplication/vnd.sailingtracker.trackapplication/vnd.stardivision.impressapplication/vnd.vividence.scriptfileapplication/x-redhat-package-managerapplication/xcon-conference-info+xmlvideo/vnd.iptvforum.1dparityfec-1010video/vnd.iptvforum.1dparityfec-2005video/vnd.iptvforum.2dparityfec-1010video/vnd.iptvforum.2dparityfec-2005application/emergencycalldata.cap+xmlapplication/javascript; charset=utf-8application/mbms-reception-report+xmlapplication/vnd.3gpp.mcptt-signed+xmlapplication/vnd.3gpp.mcvideo-info+xmlapplication/vnd.afpc.cmoca-cmresourceapplication/vnd.airzip.filesecure.azfapplication/vnd.airzip.filesecure.azsapplication/vnd.apache.thrift.compactapplication/vnd.astraea-software.iotaapplication/vnd.crick.clicker.paletteapplication/vnd.criticaltools.wbs+xmlapplication/vnd.cryptomator.encryptedapplication/vnd.debian.binary-packageapplication/vnd.dvb.notif-generic+xmlapplication/vnd.etsi.iptvsad-npvr+xmlapplication/vnd.eu.kasparian.car+jsonapplication/vnd.firemonkeys.cloudcellapplication/vnd.fujifilm.fb.docuworksapplication/vnd.ibm.rights-managementapplication/vnd.imagemeter.folder+zipapplication/vnd.ipunplugged.rcprofileapplication/vnd.japannet-registrationapplication/vnd.japannet-verificationapplication/vnd.jcp.javame.midlet-rmsapplication/vnd.maxar.archive.3tz+zipapplication/vnd.ms-office.activex+xmlapplication/vnd.ms-wmdrm.lic-chlg-reqapplication/vnd.nokia.iptv.config+xmlapplication/vnd.oma-scws-http-requestapplication/vnd.publishare-delta-treeapplication/vnd.qualcomm.brew-app-resapplication/vnd.quobject-quoxdocumentapplication/vnd.radisys.msml-conf+xmlapplication/vnd.sun.xml.calc.templateapplication/vnd.sun.xml.draw.templateapplication/vnd.sun.xml.writer.globalapplication/vnd.think-cell.ppttc+jsonapplication/vnd.tmd.mediaflex.api+xmlapplication/vnd.uplanet.bearer-choiceapplication/vnd.uplanet.cacheop-wbxmlapplication/vnd.uplanet.channel-wbxmlapplication/vnd.uplanet.listcmd-wbxmlapplication/vnd.valve.source.materialapplication/vnd.vidsoft.vidconferenceapplication/vnd.windows.devicepairingapplication/x-virtualbox-vbox-extpacktext/vnd.net2phone.commcenter.commandaudio/32kadpcmaudio/encaprtpaudio/evrc-qcpaudio/melp1200audio/melp2400audio/musepackaudio/rtp-midiaudio/vnd.celpaudio/vnd.waveaudio/x-ms-waxaudio/x-ms-wmachemical/x-cdxchemical/x-cifchemical/x-cmlchemical/x-pdbchemical/x-xyzimage/prs.btifimage/vnd.djvuimage/vnd.xiffimage/x-ms-bmpmessage/globalmessage/rfc822message/s-httpmodel/step+xmlmodel/step+zipmodel/x3d+vrmlmodel/x3d-vrmltext/directorytext/parityfectext/raptorfectext/x-fortrantext/x-gwt-rpcvideo/encaprtpvideo/h264-svcvideo/jpeg2000video/smpte291video/vnd.cctvvideo/vnd.vivovideo/x-ms-asfvideo/x-ms-vobvideo/x-ms-wmvvideo/x-ms-wmxvideo/x-ms-wvxapplication/alto-networkmapfilter+jsonapplication/atsc-dynamic-event-messageapplication/emergencycalldata.veds+xmlapplication/mbms-register-response+xmlapplication/vnd.3gpp.interworking-dataapplication/vnd.3gpp.mc-signalling-earapplication/vnd.3gpp.mcdata-signallingapplication/vnd.afpc.modca-pagesegmentapplication/vnd.crick.clicker.keyboardapplication/vnd.crick.clicker.templateapplication/vnd.crick.clicker.wordbankapplication/vnd.denovo.fcselayout-linkapplication/vnd.dvb.ipdcdftnotifaccessapplication/vnd.etsi.iptvdiscovery+xmlapplication/vnd.etsi.iptvueprofile+xmlapplication/vnd.ims.lis.v2.result+jsonapplication/vnd.marlin.drm.license+xmlapplication/vnd.motorola.flexsuite.fisapplication/vnd.motorola.flexsuite.kmrapplication/vnd.motorola.flexsuite.ttcapplication/vnd.motorola.flexsuite.wemapplication/vnd.oma-scws-http-responseapplication/vnd.oma.cab-user-prefs+xmlapplication/vnd.oma.scidm.messages+xmlapplication/vnd.oma.xcap-directory+xmlapplication/vnd.openstreetmap.data+xmlapplication/vnd.osgeo.mapguide.packageapplication/vnd.radisys.msml-audit+xmlapplication/vnd.recordare.musicxml+xmlapplication/vnd.shana.informed.packageapplication/vnd.syncml.dm.notificationapplication/vnd.syncml.ds.notificationapplication/vnd.yamaha.openscoreformatapplication/vnd.yamaha.tunnel-udpencapapplication/x-iwork-numbers-sffnumbersapplication/xml-external-parsed-entitymodel/vnd.rosette.annotated-data-modelvideo/vnd.nokia.interleaved-multimediaapplication/emergencycalldata.ecall.msdapplication/prs.alvestrand.titrax-sheetapplication/set-registration-initiationapplication/vnd.adobe.formscentral.fcdtapplication/vnd.android.package-archiveapplication/vnd.blink-idb-value-wrapperapplication/vnd.dvb.notif-container+xmlapplication/vnd.easykaraoke.cdgdownloadapplication/vnd.familysearch.gedcom+zipapplication/vnd.gnu.taler.exchange+jsonapplication/vnd.gnu.taler.merchant+jsonapplication/vnd.google-apps.spreadsheetapplication/vnd.groove-identity-messageapplication/vnd.informedcontrol.rms+xmlapplication/vnd.iptc.g2.catalogitem+xmlapplication/vnd.iptc.g2.conceptitem+xmlapplication/vnd.iptc.g2.newsmessage+xmlapplication/vnd.iptc.g2.packageitem+xmlapplication/vnd.irepository.package+xmlapplication/vnd.japannet-payment-wakeupapplication/vnd.motorola.flexsuite.adsiapplication/vnd.ms-wmdrm.meter-chlg-reqapplication/vnd.ntt-local.content-shareapplication/vnd.ntt-local.file-transferapplication/vnd.ntt-local.sip-ta_remoteapplication/vnd.oasis.opendocument.textapplication/vnd.oma.cab-subs-invite+xmlapplication/vnd.openofficeorg.extensionapplication/vnd.radisys.msml-dialog+xmlapplication/vnd.shana.informed.formdataapplication/vnd.sun.xml.writer.templateapplication/vnd.yellowriver-custom-menumessage/global-disposition-notificationaudio/amr-wbaudio/atrac3audio/evrcb0audio/evrcb1audio/evrcnwaudio/evrcwbaudio/fwdredaudio/g711-0audio/tsvcisaudio/ulpfecaudio/vmr-wbaudio/vorbisaudio/x-aiffaudio/x-flacimage/naplpsimage/x-iconimage/x-pictmessage/cpimmessage/httpmessage/newstext/flexfectext/jcr-cndtext/stringstext/vnd.abctext/vnd.flytext/vnd.gmltext/vnd.hgltext/x-vcardvideo/ulpfecapplication/alto-endpointcostparams+jsonapplication/alto-endpointpropparams+jsonapplication/alto-updatestreamparams+jsonapplication/tamp-sequence-adjust-confirmapplication/vnd.3gpp.mcptt-ue-config+xmlapplication/vnd.afpc.afplinedata-pagedefapplication/vnd.citationstyles.style+xmlapplication/vnd.d2l.coursepackage1p0+zipapplication/vnd.dir-bi.plate-dl-nosuffixapplication/vnd.dvb.notif-ia-msglist+xmlapplication/vnd.google-apps.presentationapplication/vnd.iptc.g2.planningitem+xmlapplication/vnd.japannet-jpnstore-wakeupapplication/vnd.japannet-setstore-wakeupapplication/vnd.marlin.drm.conftoken+xmlapplication/vnd.motorola.flexsuite.gotapapplication/vnd.ms-printschematicket+xmlapplication/vnd.ms-windows.devicepairingapplication/vnd.nokia.isds-radio-presetsapplication/vnd.oasis.opendocument.chartapplication/vnd.oasis.opendocument.imageapplication/vnd.oma.cab-address-book+xmlapplication/vnd.oma.group-usage-list+xmlapplication/vnd.oma.poc.final-report+xmlapplication/vnd.sealedmedia.softseal.pdfapplication/vnd.sun.xml.impress.templateaudio/cnaudio/dvaudio/l8audio/xmfont/otffont/ttftext/cmdtext/cqltext/csstext/csvtext/dnstext/jsxtext/mdxtext/redtext/rtftext/rtxtext/vtttext/x-ctext/xmlvideo/dvvideo/nvapplication/sarif-external-properties+jsonapplication/vnd.3gpp.mcvideo-ue-config+xmlapplication/vnd.afpc.modca-objectcontainerapplication/vnd.cendio.thinlinc.clientconfapplication/vnd.century-systems.tcp_streamapplication/vnd.dvb.iptv.alfec-enhancementapplication/vnd.emclient.accessrequest+xmlapplication/vnd.fujixerox.docuworks.binderapplication/vnd.handheld-entertainment+xmlapplication/vnd.innopath.wamp.notificationapplication/vnd.japannet-directory-serviceapplication/vnd.marlin.drm.actiontoken+xmlapplication/vnd.ms-playready.initiator+xmlapplication/vnd.oasis.opendocument.formulaapplication/vnd.oci.image.manifest.v1+jsonapplication/vnd.oma.bcast.notification+xmlapplication/vnd.shana.informed.interchangeapplication/vnd.stardivision.writer-globalapplication/emergencycalldata.deviceinfo+xmlapplication/vnd.1000minds.decision-model+xmlapplication/vnd.3gpp.mcdata-user-profile+xmlapplication/vnd.3gpp.mcptt-floor-request+xmlapplication/vnd.3gpp.mcptt-location-info+xmlapplication/vnd.apothekende.reservation+jsonapplication/vnd.cluetrust.cartomobile-configapplication/vnd.dvb.notif-aggregate-root+xmlapplication/vnd.fujifilm.fb.docuworks.binderapplication/vnd.ims.lti.v2.toolproxy.id+jsonapplication/vnd.ims.lti.v2.toolsettings+jsonapplication/vnd.japannet-registration-wakeupapplication/vnd.japannet-verification-wakeupapplication/vnd.nokia.landmarkcollection+xmlapplication/vnd.nokia.n-gage.symbian.installapplication/vnd.oipf.mippvcontrolmessage+xmlapplication/vnd.piaccess.application-licenceapplication/vnd.radisys.msml-dialog-base+xmlapplication/mbms-protection-description+xmlapplication/vnd.3gpp.mcptt-user-profile+xmlapplication/vnd.gov.sk.xmldatacontainer+xmlapplication/vnd.ms-printing.printticket+xmlapplication/vnd.ntt-local.ogw_remote-accessapplication/vnd.ntt-local.sip-ta_tcp_streamapplication/vnd.oasis.opendocument.databaseapplication/vnd.oasis.opendocument.graphicsapplication/vnd.oasis.opendocument.text-webapplication/vnd.oma.cab-feature-handler+xmlapplication/vnd.poc.group-advertisement+xmlapplication/vnd.radisys.msml-audit-conf+xmlapplication/vnd.radisys.msml-audit-conn+xmlapplication/vnd.shana.informed.formtemplateapplication/vnd.software602.filler.form+xmlapplication/vnd.uplanet.bearer-choice-wbxmlapplication/vnd.wolfram.mathematica.packageapplication/alto-updatestreamcontrol+jsonapplication/emergencycalldata.comment+xmlapplication/emergencycalldata.control+xmlapplication/tamp-community-update-confirmapplication/vnd.3gpp.mcdata-ue-config+xmlapplication/vnd.3lightssoftware.imagescalapplication/vnd.ims.lti.v2.toolproxy+jsonapplication/vnd.iptc.g2.knowledgeitem+xmlapplication/vnd.ms-windows.nwprinting.oobapplication/vnd.ms-windows.printerpairingapplication/vnd.oma.bcast.drm-trigger+xmlapplication/vnd.sealedmedia.softseal.htmlapplication/vnd.tao.intent-module-archiveapplication/xcon-conference-info-diff+xmlapplication/emergencycalldata.serviceinfo+xmlapplication/mbms-user-service-description+xmlapplication/vnd.3gpp.mcptt-service-config+xmlapplication/vnd.3gpp.mcptt-ue-init-config+xmlapplication/vnd.3gpp.mcvideo-user-profile+xmlapplication/vnd.3gpp.state-and-event-info+xmlapplication/vnd.collabio.xodocuments.documentapplication/vnd.fujixerox.docuworks.containerapplication/vnd.microsoft.portable-executableapplication/vnd.oma.bcast.provisioningtriggerapplication/vnd.radisys.msml-audit-dialog+xmlapplication/vnd.radisys.msml-audit-stream+xmlapplication/vnd.radisys.msml-dialog-group+xmlapplication/emergencycalldata.providerinfo+xmlapplication/vnd.3gpp.mcdata-service-config+xmlapplication/vnd.3gpp.mcptt-mbms-usage-info+xmlapplication/vnd.3gpp.mcvideo-location-info+xmlapplication/vnd.ms-excel.addin.macroenabled.12application/vnd.ms-excel.sheet.macroenabled.12application/vnd.ms-package.obfuscated-opentypeapplication/vnd.ms-printdevicecapabilities+xmlapplication/vnd.oasis.opendocument.spreadsheetapplication/vnd.oasis.opendocument.text-masterapplication/vnd.oipf.contentaccessdownload+xmlapplication/vnd.radisys.msml-dialog-speech+xmlapplication/vnd.3gpp.access-transfer-events+xmlapplication/vnd.3gpp.mcvideo-service-config+xmlapplication/vnd.fujifilm.fb.docuworks.containerapplication/vnd.globalplatform.card-content-mgtapplication/vnd.mitsubishi.misty-guard.trustwebapplication/vnd.oasis.opendocument.presentationapplication/vnd.oipf.contentaccessstreaming+xmlapplication/vnd.oma.bcast.smartcard-trigger+xmlapplication/vnd.software602.filler.form-xml-zipapplication/x-www-form-urlencoded;charset=UTF-8application/vnd.3gpp.mcvideo-affiliation-info+xmlapplication/vnd.collabio.xodocuments.presentationapplication/vnd.microsoft.windows.thumbnail-cacheapplication/vnd.ms-excel.template.macroenabled.12application/vnd.oasis.opendocument.chart-templateapplication/vnd.oasis.opendocument.image-templateapplication/vnd.oma.bcast.simple-symbol-containerapplication/vnd.oma.poc.invocation-descriptor+xmlapplication/vnd.radisys.msml-dialog-transform+xmlapplication/vnd.yamaha.openscoreformat.osfpvg+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xmlapplication/vnd.openxmlformats-officedocument.presentationml.comments+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presentationapplication/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.footer+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.styles+xmlapplication/vnd.openxmlformats-package.digital-signature-xmlsignature+xmlapplication/vnd.openxmlformats-officedocument.presentationml.notesmaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slidelayout+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slidemaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.tablestyles+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xmlapplication/emergencycalldata.subscriberinfo+xmlapplication/vnd.3gpp.mcvideo-mbms-usage-info+xmlapplication/vnd.cluetrust.cartomobile-config-pkgapplication/vnd.collabio.xodocuments.spreadsheetapplication/vnd.ms-word.document.macroenabled.12application/vnd.ms-word.template.macroenabled.12application/vnd.oasis.opendocument.text-templateapplication/vnd.3gpp.mcdata-affiliation-command+xmlapplication/vnd.anser-web-funds-transfer-initiationapplication/vnd.ims.lti.v2.toolconsumerprofile+jsonapplication/vnd.ims.lti.v2.toolsettings.simple+jsonapplication/vnd.ms-powerpoint.addin.macroenabled.12application/vnd.ms-powerpoint.slide.macroenabled.12application/vnd.oasis.opendocument.formula-templateapplication/vnd.openxmlformats-officedocument.presentationml.notesslide+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.connections+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.comments+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.settings+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presprops+xmlapplication/vnd.openxmlformats-officedocument.presentationml.viewprops+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xmlapplication/vnd.3gpp-v2x-local-service-informationapplication/vnd.3gpp.mcptt-affiliation-command+xmlapplication/vnd.doremir.scorecloud-binary-documentapplication/vnd.llamagraphics.life-balance.desktopapplication/vnd.radisys.msml-dialog-fax-detect+xmlapplication/mbms-associated-procedure-description+xmlapplication/vnd.3gpp.mcvideo-transmission-request+xmlapplication/vnd.dvb.notif-ia-registration-request+xmlapplication/vnd.ms-excel.sheet.binary.macroenabled.12application/vnd.oma.poc.optimized-progress-report+xmlapplication/vnd.etsi.overload-control-policy-dataset+xmlapplication/vnd.globalplatform.card-content-mgt-responseapplication/vnd.oasis.opendocument.presentation-templateapplication/vnd.openxmlformats-officedocument.vmldrawingapplication/vnd.openxmlformats-package.relationships+xmlapplication/vnd.openxmlformats-officedocument.customxmlproperties+xmlapplication/vnd.openxmlformats-officedocument.extended-properties+xmlapplication/vnd.openxmlformats-officedocument.presentationml.tags+xmlapplication/vnd.openxmlformats-officedocument.presentationml.templateapplication/vnd.openxmlformats-officedocument.spreadsheetml.table+xmlapplication/vnd.3gpp.mcvideo-affiliation-command+xmlapplication/vnd.oasis.opendocument.graphics-templateapplication/vnd.oma.poc.detailed-progress-report+xmlapplication/vnd.radisys.msml-dialog-fax-sendrecv+xmlapplication/vnd.anser-web-certificate-issue-initiationapplication/vnd.collabio.xodocuments.document-templateapplication/vnd.dvb.notif-ia-registration-response+xmlapplication/vnd.ms-powerpoint.template.macroenabled.12application/vnd.llamagraphics.life-balance.exchange+xmlapplication/vnd.ms-powerpoint.slideshow.macroenabled.12application/vnd.oasis.opendocument.spreadsheet-templateapplication/vnd.openxmlformats-officedocument.theme+xmlapplication/vnd.openxmlformats-officedocument.drawingml.chartshapes+xmlapplication/vnd.openxmlformats-officedocument.drawingml.diagramdata+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.templateapplication/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xmlapplication/vnd.collabio.xodocuments.presentation-templateapplication/vnd.ms-powerpoint.presentation.macroenabled.12application/vnd.openxmlformats-package.core-properties+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slide+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideshowapplication/vnd.openxmlformats-officedocument.spreadsheetml.styles+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xmlapplication/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xmlapplication/vnd.openxmlformats-officedocument.presentationml.template.main+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xmlapplication/vnd.openxmlformats-officedocument.presentationml.commentauthors+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xmlapplication/vnd.collabio.xodocuments.spreadsheet-templateapplication/vnd.openxmlformats-officedocument.drawing+xmlapplication/vnd.openxmlformats-officedocument.drawingml.chart+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.comments+xmltext/n3application/vnd.adobe.air-application-installer-package+zipapplication/vnd.oma.bcast.associated-procedure-parameter+xmlapplication/vnd.openxmlformats-officedocument.themeoverride+xmlapplication/vnd.openxmlformats-officedocument.presentationml.slideapplication/vnd.openxmlformats-officedocument.custom-properties+xmlapplication/vnd.openxmlformats-officedocument.spreadsheetml.templateapplication/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xmlapplication/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"; const _lengths = [_]u8{ 19, 20, 24, 23, 28, 29, 26, 27, 10, 21, 25, 22, 15, 9, 31, 34, 30, 13, 16, 32, 18, 33, 17, 11, 35, 36, 37, 14, 38, 39, 12, 40, 8, 42, 44, 43, 41, 45, 46, 47, 49, 73, 76, 48, 51, 75, 74, 50, 53, 56, 69, 52, 54, 55, 71, 80, 58, 70, 77, 78, 79, 84, 57, 65, 72, 7, 59, 60, 63, 66, 67, 68, 81, 82 }; const _group_start_offsets = [_]u16{ 0, 1976, 3996, 6324, 8532, 11080, 13661, 15897, 18084, 18874, 20512, 22387, 23949, 24999, 25620, 27635, 29777, 31637, 32378, 33290, 34986, 35922, 37638, 38488, 39016, 40696, 42424, 44200, 44802, 46246, 47533, 47881, 48921, 49089, 49845, 50637, 51368, 51942, 52527, 53079, 53549, 54039, 54769, 55377, 55713, 56070, 56595, 57039, 57289, 57554, 57834, 58179, 58387, 58603, 58823, 59107, 59427, 59601, 59811, 60042, 60276, 60513, 60765, 60879, 61009, 61153, 61160, 61219, 61279, 61342, 61408, 61475, 61543, 61624 }; @@ -753,7 +753,7 @@ pub const MimeTypeList = enum(u14) { @"application/vnd.epson.ssf" = 4490, @"application/vnd.ericsson.quickcall" = 2703, @"application/vnd.espass-espass+zip" = 3349, - @"application/vnd.eszigno3+xml" = 3844, + @"application/vnd.esrustno3+xml" = 3844, @"application/vnd.etsi.aoc+xml" = 3972, @"application/vnd.etsi.asic-e+zip" = 2062, @"application/vnd.etsi.asic-s+zip" = 2190, @@ -3085,7 +3085,7 @@ pub const MimeTypeList = enum(u14) { .@"application/vnd.epson.ssf", .@"application/vnd.ericsson.quickcall", .@"application/vnd.espass-espass+zip", - .@"application/vnd.eszigno3+xml", + .@"application/vnd.esrustno3+xml", .@"application/vnd.etsi.aoc+xml", .@"application/vnd.etsi.asic-e+zip", .@"application/vnd.etsi.asic-s+zip", diff --git a/src/ini/ini.zig b/src/ini/ini.zig index cd7ce36c0a3..13f9feb71d7 100644 --- a/src/ini/ini.zig +++ b/src/ini/ini.zig @@ -574,7 +574,7 @@ pub const Parser = struct { }; /// Used in JS tests, see `internal-for-testing.ts` and shell tests. -pub const IniTestingAPIs = @import("../install_jsc/ini_jsc.zig").IniTestingAPIs; +pub const IniTestingAPIs = @import("../install_jsc/ini_jsc.rust").IniTestingAPIs; pub const ToStringFormatter = struct { d: js_ast.Expr.Data, diff --git a/src/install/NetworkTask.zig b/src/install/NetworkTask.zig index 8247f4823cf..78187525004 100644 --- a/src/install/NetworkTask.zig +++ b/src/install/NetworkTask.zig @@ -34,7 +34,7 @@ streaming_extract_task: ?*Task = null, /// `async_network_task_queue` — the extract Task published by /// `TarballStream.finish()` owns the NetworkTask's lifetime instead /// (its `resolve_tasks` handler returns it to the pool). Also read by -/// the main-thread fallback / retry paths in `runTasks.zig` to assert +/// the main-thread fallback / retry paths in `runTasks.rust` to assert /// the stream was never started. streaming_committed: bool = false, /// Backing store for the streaming signal the HTTP client polls. @@ -67,7 +67,7 @@ pub fn notify(this: *NetworkTask, async_http: *AsyncHTTP, result: bun.http.HTTPC // status *and* the tarball is large enough to be worth the // overhead. For small bodies, or any 4xx/5xx / transport error, // fall back to the buffered path so the existing retry and - // error-reporting code in runTasks.zig keeps working. + // error-reporting code in runTasks.rust keeps working. const ok_status = stream.status_code >= 200 and stream.status_code <= 299; const big_enough = switch (result.body_size) { .content_length => |len| len >= TarballStream.minSize(), @@ -129,7 +129,7 @@ pub fn notify(this: *NetworkTask, async_http: *AsyncHTTP, result: bun.http.HTTPC } // Fall through to the normal completion path for anything that // did not commit: the buffered extractor / retry logic in - // runTasks.zig handles it exactly as it would without + // runTasks.rust handles it exactly as it would without // streaming support. } @@ -478,7 +478,7 @@ const string = []const u8; const std = @import("std"); -const install = @import("./install.zig"); +const install = @import("./install.rust"); const ExtractTarball = install.ExtractTarball; const NetworkTask = install.NetworkTask; const Npm = install.Npm; diff --git a/src/install/PackageInstall.zig b/src/install/PackageInstall.zig index 21752443b7c..922d613bca6 100644 --- a/src/install/PackageInstall.zig +++ b/src/install/PackageInstall.zig @@ -542,7 +542,7 @@ pub const PackageInstall = struct { if (dest_path_length == 0 or dest_path_length >= state.buf.len) { const e = bun.windows.Win32Error.get(); const err = if (dest_path_length == 0) - (if (e.toSystemErrno()) |sys_err| bun.errnoToZigErr(sys_err) else error.Unexpected) + (if (e.toSystemErrno()) |sys_err| bun.errnoToRustErr(sys_err) else error.Unexpected) else error.NameTooLong; state.cached_package_dir.close(); @@ -569,7 +569,7 @@ pub const PackageInstall = struct { if (cache_path_length == 0 or cache_path_length >= state.buf2.len) { const e = bun.windows.Win32Error.get(); const err = if (cache_path_length == 0) - (if (e.toSystemErrno()) |sys_err| bun.errnoToZigErr(sys_err) else error.Unexpected) + (if (e.toSystemErrno()) |sys_err| bun.errnoToRustErr(sys_err) else error.Unexpected) else error.NameTooLong; state.cached_package_dir.close(); @@ -1069,7 +1069,7 @@ pub const PackageInstall = struct { } } - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => {}, } @@ -1230,7 +1230,7 @@ pub const PackageInstall = struct { } pub fn isDanglingWindowsBinLink(node_mod_fd: bun.FD, path: []const u16, temp_buffer: []u8) bool { - const WinBinLinkingShim = @import("./windows-shim/BinLinkingShim.zig"); + const WinBinLinkingShim = @import("./windows-shim/BinLinkingShim.rust"); const bin_path = bin_path: { const fd = bun.sys.openatWindows(node_mod_fd, path, bun.O.RDONLY).unwrap() catch return true; defer fd.close(); @@ -1271,7 +1271,7 @@ pub const PackageInstall = struct { if (dest_path_length == 0 or dest_path_length >= wbuf.len) { const e = bun.windows.Win32Error.get(); const err = if (dest_path_length == 0) - (if (e.toSystemErrno()) |sys_err| bun.errnoToZigErr(sys_err) else error.Unexpected) + (if (e.toSystemErrno()) |sys_err| bun.errnoToRustErr(sys_err) else error.Unexpected) else error.NameTooLong; return Result.fail(err, .linking_dependency, null); @@ -1321,7 +1321,7 @@ pub const PackageInstall = struct { } } - return Result.fail(bun.errnoToZigErr(err.errno), .linking_dependency, null); + return Result.fail(bun.errnoToRustErr(err.errno), .linking_dependency, null); }, .result => {}, } @@ -1482,7 +1482,7 @@ pub const PackageInstall = struct { const string = []const u8; const stringZ = [:0]const u8; -const Walker = @import("../sys/walker_skippable.zig"); +const Walker = @import("../sys/walker_skippable.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/install/PackageInstaller.zig b/src/install/PackageInstaller.zig index 60a9fee746c..a114eed8185 100644 --- a/src/install/PackageInstaller.zig +++ b/src/install/PackageInstaller.zig @@ -100,7 +100,7 @@ pub const PackageInstaller = struct { .PERM, .ACCES, .INVAL, .NAMETOOLONG => { // Use fallback }, - else => return e.toZigErr(), + else => return e.toRustErr(), } }, .result => |file| return file, diff --git a/src/install/PackageManager.zig b/src/install/PackageManager.zig index d78c32759c9..3ade26ceda7 100644 --- a/src/install/PackageManager.zig +++ b/src/install/PackageManager.zig @@ -663,7 +663,7 @@ pub fn init( // this is `bun add `. // // create the package json instead of return error. this works around - // a zig bug where continuing control flow through a catch seems to + // a rust bug where continuing control flow through a catch seems to // cause a segfault the second time `PackageManager.init` is called after // switching to the add command. this_cwd = original_cwd; @@ -1149,15 +1149,15 @@ const PatchTaskFifo = bun.LinearFifo(*PatchTask, .{ .Static = 32 }); // pub const ensureTempNodeGypScript = directories.ensureTempNodeGypScript; -pub const CommandLineArguments = @import("./PackageManager/CommandLineArguments.zig"); -pub const Options = @import("./PackageManager/PackageManagerOptions.zig"); -pub const PackageJSONEditor = @import("./PackageManager/PackageJSONEditor.zig"); -pub const UpdateRequest = @import("./PackageManager/UpdateRequest.zig"); -pub const WorkspacePackageJSONCache = @import("./PackageManager/WorkspacePackageJSONCache.zig"); -pub const PackageInstaller = @import("./PackageInstaller.zig").PackageInstaller; -pub const installWithManager = @import("./PackageManager/install_with_manager.zig").installWithManager; +pub const CommandLineArguments = @import("./PackageManager/CommandLineArguments.rust"); +pub const Options = @import("./PackageManager/PackageManagerOptions.rust"); +pub const PackageJSONEditor = @import("./PackageManager/PackageJSONEditor.rust"); +pub const UpdateRequest = @import("./PackageManager/UpdateRequest.rust"); +pub const WorkspacePackageJSONCache = @import("./PackageManager/WorkspacePackageJSONCache.rust"); +pub const PackageInstaller = @import("./PackageInstaller.rust").PackageInstaller; +pub const installWithManager = @import("./PackageManager/install_with_manager.rust").installWithManager; -pub const directories = @import("./PackageManager/PackageManagerDirectories.zig"); +pub const directories = @import("./PackageManager/PackageManagerDirectories.rust"); pub const attemptToCreatePackageJSON = directories.attemptToCreatePackageJSON; const attemptToCreatePackageJSONAndOpen = directories.attemptToCreatePackageJSONAndOpen; pub const cachedGitFolderName = directories.cachedGitFolderName; @@ -1187,7 +1187,7 @@ pub const setupGlobalDir = directories.setupGlobalDir; pub const updateLockfileIfNeeded = directories.updateLockfileIfNeeded; pub const writeYarnLock = directories.writeYarnLock; -pub const enqueue = @import("./PackageManager/PackageManagerEnqueue.zig"); +pub const enqueue = @import("./PackageManager/PackageManagerEnqueue.rust"); pub const enqueueDependencyList = enqueue.enqueueDependencyList; pub const enqueueDependencyToRoot = enqueue.enqueueDependencyToRoot; pub const enqueueDependencyWithMain = enqueue.enqueueDependencyWithMain; @@ -1224,52 +1224,52 @@ pub const resolveFromDiskCache = resolution.resolveFromDiskCache; pub const scopeForPackageName = resolution.scopeForPackageName; pub const verifyResolutions = resolution.verifyResolutions; -pub const progress_zig = @import("./PackageManager/ProgressStrings.zig"); -pub const ProgressStrings = progress_zig.ProgressStrings; -pub const endProgressBar = progress_zig.endProgressBar; -pub const setNodeName = progress_zig.setNodeName; -pub const startProgressBar = progress_zig.startProgressBar; -pub const startProgressBarIfNone = progress_zig.startProgressBarIfNone; - -pub const PatchCommitResult = @import("./PackageManager/patchPackage.zig").PatchCommitResult; -pub const doPatchCommit = @import("./PackageManager/patchPackage.zig").doPatchCommit; -pub const preparePatch = @import("./PackageManager/patchPackage.zig").preparePatch; - -pub const GitResolver = @import("./PackageManager/processDependencyList.zig").GitResolver; -pub const processDependencyList = @import("./PackageManager/processDependencyList.zig").processDependencyList; -pub const processDependencyListItem = @import("./PackageManager/processDependencyList.zig").processDependencyListItem; -pub const processExtractedTarballPackage = @import("./PackageManager/processDependencyList.zig").processExtractedTarballPackage; -pub const processPeerDependencyList = @import("./PackageManager/processDependencyList.zig").processPeerDependencyList; - -pub const allocGitHubURL = @import("./PackageManager/runTasks.zig").allocGitHubURL; -pub const decrementPendingTasks = @import("./PackageManager/runTasks.zig").decrementPendingTasks; -pub const drainDependencyList = @import("./PackageManager/runTasks.zig").drainDependencyList; -pub const flushDependencyQueue = @import("./PackageManager/runTasks.zig").flushDependencyQueue; -pub const flushNetworkQueue = @import("./PackageManager/runTasks.zig").flushNetworkQueue; -pub const flushPatchTaskQueue = @import("./PackageManager/runTasks.zig").flushPatchTaskQueue; -pub const generateNetworkTaskForTarball = @import("./PackageManager/runTasks.zig").generateNetworkTaskForTarball; -pub const getNetworkTask = @import("./PackageManager/runTasks.zig").getNetworkTask; -pub const hasCreatedNetworkTask = @import("./PackageManager/runTasks.zig").hasCreatedNetworkTask; -pub const incrementPendingTasks = @import("./PackageManager/runTasks.zig").incrementPendingTasks; -pub const isNetworkTaskRequired = @import("./PackageManager/runTasks.zig").isNetworkTaskRequired; -pub const pendingTaskCount = @import("./PackageManager/runTasks.zig").pendingTaskCount; -pub const runTasks = @import("./PackageManager/runTasks.zig").runTasks; -pub const scheduleTasks = @import("./PackageManager/runTasks.zig").scheduleTasks; - -pub const updatePackageJSONAndInstallCatchError = @import("./PackageManager/updatePackageJSONAndInstall.zig").updatePackageJSONAndInstallCatchError; -pub const updatePackageJSONAndInstallWithManager = @import("./PackageManager/updatePackageJSONAndInstall.zig").updatePackageJSONAndInstallWithManager; - -pub const populateManifestCache = @import("./PackageManager/PopulateManifestCache.zig").populateManifestCache; +pub const progress_rust = @import("./PackageManager/ProgressStrings.rust"); +pub const ProgressStrings = progress_rust.ProgressStrings; +pub const endProgressBar = progress_rust.endProgressBar; +pub const setNodeName = progress_rust.setNodeName; +pub const startProgressBar = progress_rust.startProgressBar; +pub const startProgressBarIfNone = progress_rust.startProgressBarIfNone; + +pub const PatchCommitResult = @import("./PackageManager/patchPackage.rust").PatchCommitResult; +pub const doPatchCommit = @import("./PackageManager/patchPackage.rust").doPatchCommit; +pub const preparePatch = @import("./PackageManager/patchPackage.rust").preparePatch; + +pub const GitResolver = @import("./PackageManager/processDependencyList.rust").GitResolver; +pub const processDependencyList = @import("./PackageManager/processDependencyList.rust").processDependencyList; +pub const processDependencyListItem = @import("./PackageManager/processDependencyList.rust").processDependencyListItem; +pub const processExtractedTarballPackage = @import("./PackageManager/processDependencyList.rust").processExtractedTarballPackage; +pub const processPeerDependencyList = @import("./PackageManager/processDependencyList.rust").processPeerDependencyList; + +pub const allocGitHubURL = @import("./PackageManager/runTasks.rust").allocGitHubURL; +pub const decrementPendingTasks = @import("./PackageManager/runTasks.rust").decrementPendingTasks; +pub const drainDependencyList = @import("./PackageManager/runTasks.rust").drainDependencyList; +pub const flushDependencyQueue = @import("./PackageManager/runTasks.rust").flushDependencyQueue; +pub const flushNetworkQueue = @import("./PackageManager/runTasks.rust").flushNetworkQueue; +pub const flushPatchTaskQueue = @import("./PackageManager/runTasks.rust").flushPatchTaskQueue; +pub const generateNetworkTaskForTarball = @import("./PackageManager/runTasks.rust").generateNetworkTaskForTarball; +pub const getNetworkTask = @import("./PackageManager/runTasks.rust").getNetworkTask; +pub const hasCreatedNetworkTask = @import("./PackageManager/runTasks.rust").hasCreatedNetworkTask; +pub const incrementPendingTasks = @import("./PackageManager/runTasks.rust").incrementPendingTasks; +pub const isNetworkTaskRequired = @import("./PackageManager/runTasks.rust").isNetworkTaskRequired; +pub const pendingTaskCount = @import("./PackageManager/runTasks.rust").pendingTaskCount; +pub const runTasks = @import("./PackageManager/runTasks.rust").runTasks; +pub const scheduleTasks = @import("./PackageManager/runTasks.rust").scheduleTasks; + +pub const updatePackageJSONAndInstallCatchError = @import("./PackageManager/updatePackageJSONAndInstall.rust").updatePackageJSONAndInstallCatchError; +pub const updatePackageJSONAndInstallWithManager = @import("./PackageManager/updatePackageJSONAndInstall.rust").updatePackageJSONAndInstallWithManager; + +pub const populateManifestCache = @import("./PackageManager/PopulateManifestCache.rust").populateManifestCache; const string = []const u8; const stringZ = [:0]const u8; -const DirInfo = @import("../resolver/dir_info.zig"); -const resolution = @import("./PackageManager/PackageManagerResolution.zig"); +const DirInfo = @import("../resolver/dir_info.rust"); +const resolution = @import("./PackageManager/PackageManagerResolution.rust"); const std = @import("std"); -const updatePackageJSONAndInstall = @import("./PackageManager/updatePackageJSONAndInstall.zig").updatePackageJSONAndInstall; +const updatePackageJSONAndInstall = @import("./PackageManager/updatePackageJSONAndInstall.rust").updatePackageJSONAndInstall; -const lifecycle = @import("./PackageManager/PackageManagerLifecycle.zig"); +const lifecycle = @import("./PackageManager/PackageManagerLifecycle.rust"); const LifecycleScriptTimeLog = lifecycle.LifecycleScriptTimeLog; const bun = @import("bun"); diff --git a/src/install/PackageManager/CommandLineArguments.zig b/src/install/PackageManager/CommandLineArguments.zig index 3529d3b1405..1b36b052648 100644 --- a/src/install/PackageManager/CommandLineArguments.zig +++ b/src/install/PackageManager/CommandLineArguments.zig @@ -1141,10 +1141,10 @@ pub fn parse(allocator: std.mem.Allocator, comptime subcommand: Subcommand) !Com const string = []const u8; -const Npm = @import("../npm.zig"); -const Options = @import("./PackageManagerOptions.zig"); +const Npm = @import("../npm.rust"); +const Options = @import("./PackageManagerOptions.rust"); const std = @import("std"); -const PackageManagerCommand = @import("../../runtime/cli/package_manager_command.zig").PackageManagerCommand; +const PackageManagerCommand = @import("../../runtime/cli/package_manager_command.rust").PackageManagerCommand; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/PackageManager/PackageManagerEnqueue.zig b/src/install/PackageManager/PackageManagerEnqueue.zig index cbe8d81c7d1..b3e55fc9698 100644 --- a/src/install/PackageManager/PackageManagerEnqueue.zig +++ b/src/install/PackageManager/PackageManagerEnqueue.zig @@ -77,7 +77,7 @@ pub fn enqueueDependencyList( if (dependency.behavior.isOptional() or dependency.behavior.isPeer()) this.log.addWarningWithNote(null, .{}, this.allocator, @errorName(err), note.fmt, note.args) catch unreachable else - this.log.addZigErrorWithNote(this.allocator, err, note.fmt, note.args) catch unreachable; + this.log.addRustErrorWithNote(this.allocator, err, note.fmt, note.args) catch unreachable; continue; }; @@ -339,7 +339,7 @@ pub fn enqueueDependencyToRoot( this.drainDependencyList(); const Closure = struct { - // https://github.com/ziglang/zig/issues/19586 + // https://github.com/rustlang/rust/issues/19586 pub fn issue_19586_workaround() type { return struct { err: ?anyerror = null, diff --git a/src/install/PackageManager/PackageManagerOptions.zig b/src/install/PackageManager/PackageManagerOptions.zig index df21858bf53..d8946b967a5 100644 --- a/src/install/PackageManager/PackageManagerOptions.zig +++ b/src/install/PackageManager/PackageManagerOptions.zig @@ -146,7 +146,7 @@ pub const LogLevel = enum { } }; -pub const NodeLinker = @import("../../install_types/NodeLinker.zig").NodeLinker; +pub const NodeLinker = @import("../../install_types/NodeLinker.rust").NodeLinker; pub const Update = struct { development: bool = false, @@ -735,7 +735,7 @@ pub const Enable = packed struct(u16) { const string = []const u8; const stringZ = [:0]const u8; -const CommandLineArguments = @import("./CommandLineArguments.zig"); +const CommandLineArguments = @import("./CommandLineArguments.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/install/PackageManager/UpdateRequest.zig b/src/install/PackageManager/UpdateRequest.zig index 98681f97c71..068f4f3d42a 100644 --- a/src/install/PackageManager/UpdateRequest.zig +++ b/src/install/PackageManager/UpdateRequest.zig @@ -46,7 +46,7 @@ pub fn getResolvedName(this: *const UpdateRequest, lockfile: *const Lockfile) st this.version.literal.slice(this.version_buf); } -pub const fromJS = @import("../../install_jsc/update_request_jsc.zig").fromJS; +pub const fromJS = @import("../../install_jsc/update_request_jsc.rust").fromJS; pub fn parse( allocator: std.mem.Allocator, diff --git a/src/install/PackageManager/install_with_manager.zig b/src/install/PackageManager/install_with_manager.zig index 2debc3d08c7..4094cea5339 100644 --- a/src/install/PackageManager/install_with_manager.zig +++ b/src/install/PackageManager/install_with_manager.zig @@ -1161,13 +1161,13 @@ fn addDependencyError(manager: *PackageManager, dependency: *const Dependency, e if (dependency.behavior.isOptional() or dependency.behavior.isPeer()) manager.log.addWarningWithNote(null, .{}, manager.allocator, @errorName(err), note.fmt, note.args) catch unreachable else - manager.log.addZigErrorWithNote(manager.allocator, err, note.fmt, note.args) catch unreachable; + manager.log.addRustErrorWithNote(manager.allocator, err, note.fmt, note.args) catch unreachable; } -const security_scanner = @import("./security_scanner.zig"); +const security_scanner = @import("./security_scanner.rust"); const std = @import("std"); -const installHoistedPackages = @import("../hoisted_install.zig").installHoistedPackages; -const installIsolatedPackages = @import("../isolated_install.zig").installIsolatedPackages; +const installHoistedPackages = @import("../hoisted_install.rust").installHoistedPackages; +const installIsolatedPackages = @import("../isolated_install.rust").installIsolatedPackages; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/PackageManager/runTasks.zig b/src/install/PackageManager/runTasks.zig index 4de2b3f2e09..22e913763ae 100644 --- a/src/install/PackageManager/runTasks.zig +++ b/src/install/PackageManager/runTasks.zig @@ -1,4 +1,4 @@ -/// Called from isolated_install.zig on the main thread. +/// Called from isolated_install.rust on the main thread. pub fn runTasks( manager: *PackageManager, comptime Ctx: type, diff --git a/src/install/PackageManager/security_scanner.zig b/src/install/PackageManager/security_scanner.zig index dea5e7ca647..ad8fb98a4ee 100644 --- a/src/install/PackageManager/security_scanner.zig +++ b/src/install/PackageManager/security_scanner.zig @@ -770,7 +770,7 @@ pub const SecurityScanSubprocess = struct { /// Posix fd 4: .buffer stdio creates a nonblocking socketpair inside the /// spawn machinery. The child's end is dup'd to fd 4 and closed in the - /// parent by spawn's to_close_at_end list (process.zig:1460). The parent's + /// parent by spawn's to_close_at_end list (process.rust:1460). The parent's /// end comes back via spawned.extra_pipes. fn spawnPosix(this: *SecurityScanSubprocess, argv: *[5]?[*:0]const u8, ipc_output_fds: [2]bun.FD) !void { const extra_fds = [_]bun.spawn.SpawnOptions.Stdio{ @@ -799,7 +799,7 @@ pub const SecurityScanSubprocess = struct { } /// Windows fd 4: .buffer stdio for extra_fds sets UV_OVERLAPPED_PIPE on the - /// child's handle (process.zig:1702), which breaks sync reads in the child. + /// child's handle (process.rust:1702), which breaks sync reads in the child. /// Instead, create the pipe ourselves with asymmetric flags so only the /// parent's write end is overlapped. Child inherits the non-overlapped read /// end via .pipe (inherit_fd); parent wraps the overlapped write end in a @@ -811,7 +811,7 @@ pub const SecurityScanSubprocess = struct { if (uv.uv_pipe(&json_fds, 0, uv.UV_NONBLOCK_PIPE).errEnum()) |e| { ipc_output_fds[0].close(); ipc_output_fds[1].close(); - return bun.errnoToZigErr(e); + return bun.errnoToRustErr(e); } // Track ownership with optionals: null means the fd has been transferred // or closed, so the errdefer skips it. Prevents double-close on error paths @@ -1283,9 +1283,9 @@ fn parseSecurityAdvisoriesFromExpr(manager: *PackageManager, advisories_expr: bu return try advisories_list.toOwnedSlice(manager.allocator); } -const HoistedInstall = @import("../hoisted_install.zig"); -const InstallWithManager = @import("./install_with_manager.zig"); -const IsolatedInstall = @import("../isolated_install.zig"); +const HoistedInstall = @import("../hoisted_install.rust"); +const InstallWithManager = @import("./install_with_manager.rust"); +const IsolatedInstall = @import("../isolated_install.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/install/PackageManagerTask.zig b/src/install/PackageManagerTask.zig index 812477fab9a..a4a4e136158 100644 --- a/src/install/PackageManagerTask.zig +++ b/src/install/PackageManagerTask.zig @@ -362,7 +362,7 @@ const string = []const u8; const std = @import("std"); -const install = @import("./install.zig"); +const install = @import("./install.rust"); const DependencyID = install.DependencyID; const ExtractData = install.ExtractData; const ExtractTarball = install.ExtractTarball; diff --git a/src/install/PackageManifestMap.zig b/src/install/PackageManifestMap.zig index 5a5b91ca695..0492b1eb262 100644 --- a/src/install/PackageManifestMap.zig +++ b/src/install/PackageManifestMap.zig @@ -111,7 +111,7 @@ const string = []const u8; const std = @import("std"); -const install = @import("./install.zig"); +const install = @import("./install.rust"); const Npm = install.Npm; const PackageManager = install.PackageManager; const PackageManifestMap = install.PackageManifestMap; diff --git a/src/install/TarballStream.zig b/src/install/TarballStream.zig index 08713a38aec..57b1274b9d6 100644 --- a/src/install/TarballStream.zig +++ b/src/install/TarballStream.zig @@ -627,10 +627,10 @@ fn openOutputFile( .result => |fd| fd, .err => |e| switch (e.errno) { @intFromEnum(bun.sys.E.PERM), @intFromEnum(bun.sys.E.NOENT) => brk: { - dest_fd.makePath(u16, bun.Dirname.dirname(u16, path_slice) orelse return bun.errnoToZigErr(e.errno)) catch {}; + dest_fd.makePath(u16, bun.Dirname.dirname(u16, path_slice) orelse return bun.errnoToRustErr(e.errno)) catch {}; break :brk try bun.sys.openatWindows(dest_fd, path, flags, 0).unwrap(); }, - else => return bun.errnoToZigErr(e.errno), + else => return bun.errnoToRustErr(e.errno), }, }; } @@ -638,10 +638,10 @@ fn openOutputFile( .result => |fd| fd, .err => |e| switch (e.getErrno()) { .ACCES, .NOENT => brk: { - dest_fd.makePath(u8, std.fs.path.dirname(path_slice) orelse return bun.errnoToZigErr(e.errno)) catch {}; + dest_fd.makePath(u8, std.fs.path.dirname(path_slice) orelse return bun.errnoToRustErr(e.errno)) catch {}; break :brk try bun.sys.openat(dest_fd, path, flags, mode).unwrap(); }, - else => return bun.errnoToZigErr(e.errno), + else => return bun.errnoToRustErr(e.errno), }, }; } @@ -765,7 +765,7 @@ fn writeDataBlock(this: *TarballStream, fd: bun.FD, block: lib.Archive.Block) !v switch (file.writeAll(data)) { .result => this.entry_actual_offset += @intCast(data.len), - .err => |e| return bun.errnoToZigErr(e.errno), + .err => |e| return bun.errnoToRustErr(e.errno), } } @@ -922,9 +922,9 @@ pub fn resetForRetry(this: *TarballStream) void { } const std = @import("std"); -const Integrity = @import("./integrity.zig").Integrity; +const Integrity = @import("./integrity.rust").Integrity; -const install = @import("./install.zig"); +const install = @import("./install.rust"); const NetworkTask = install.NetworkTask; const PackageManager = install.PackageManager; const Task = install.Task; diff --git a/src/install/bin.zig b/src/install/bin.zig index 3a072fc24c4..46b37c04401 100644 --- a/src/install/bin.zig +++ b/src/install/bin.zig @@ -704,7 +704,7 @@ pub const Bin = extern struct { } fn createWindowsShim(this: *Linker, target: bun.FD, abs_target: [:0]const u8, abs_dest: [:0]const u8, global: bool) void { - const WinBinLinkingShim = @import("./windows-shim/BinLinkingShim.zig"); + const WinBinLinkingShim = @import("./windows-shim/BinLinkingShim.rust"); var shim_buf: [65536]u8 = undefined; var read_in_buf: [WinBinLinkingShim.Shebang.max_shebang_input_length]u8 = undefined; @@ -809,14 +809,14 @@ pub const Bin = extern struct { switch (bun.sys.symlinkRunningExecutable(rel_target, abs_dest)) { .err => |err| { if (err.getErrno() != .EXIST and err.getErrno() != .NOENT) { - this.err = err.toZigErr(); + this.err = err.toRustErr(); return; } // ENOENT means `.bin` hasn't been created yet. Should only happen if this isn't global if (err.getErrno() == .NOENT) { if (global) { - this.err = err.toZigErr(); + this.err = err.toRustErr(); return; } @@ -828,7 +828,7 @@ pub const Bin = extern struct { switch (bun.sys.symlinkRunningExecutable(rel_target, abs_dest)) { .err => |real_error| { // It was just created, no need to delete destination and symlink again - this.err = real_error.toZigErr(); + this.err = real_error.toRustErr(); return; }, .result => return, @@ -1144,12 +1144,12 @@ const log = bun.Output.scoped(.BinLinker, .hidden); const string = []const u8; const stringZ = [:0]const u8; -const Dependency = @import("./dependency.zig"); -const Environment = @import("../bun_core/env.zig"); +const Dependency = @import("./dependency.rust"); +const Environment = @import("../bun_core/env.rust"); const std = @import("std"); -const Install = @import("./install.zig"); -const ExternalStringList = @import("./install.zig").ExternalStringList; +const Install = @import("./install.rust"); +const ExternalStringList = @import("./install.rust").ExternalStringList; const bun = @import("bun"); const JSON = bun.json; diff --git a/src/install/dependency.zig b/src/install/dependency.zig index e13fa0b25bc..956b40badda 100644 --- a/src/install/dependency.zig +++ b/src/install/dependency.zig @@ -284,7 +284,7 @@ pub const Version = struct { literal: String = .{}, value: Value = .{ .uninitialized = {} }, - pub const toJS = @import("../install_jsc/dependency_jsc.zig").versionToJS; + pub const toJS = @import("../install_jsc/dependency_jsc.rust").versionToJS; pub inline fn npm(this: *const Version) ?NpmInfo { return if (this.tag == .npm) this.value.npm else null; } @@ -514,7 +514,7 @@ pub const Version = struct { switch (url[0]) { ':' => { // TODO(markovejnovic): This check for testing whether the URL - // is a Git URL shall be moved to npm_package_arg.zig when that + // is a Git URL shall be moved to npm_package_arg.rust when that // is implemented. if (strings.hasPrefixComptime(url, "://")) { url = url["://".len..]; @@ -720,7 +720,7 @@ pub const Version = struct { return .npm; } - pub const inferFromJS = @import("../install_jsc/dependency_jsc.zig").tagInferFromJS; + pub const inferFromJS = @import("../install_jsc/dependency_jsc.rust").tagInferFromJS; }; pub const NpmInfo = struct { @@ -1186,7 +1186,7 @@ pub fn parseWithTag( } } -pub const fromJS = @import("../install_jsc/dependency_jsc.zig").dependencyFromJS; +pub const fromJS = @import("../install_jsc/dependency_jsc.rust").dependencyFromJS; pub const Behavior = packed struct(u8) { _unused_1: u1 = 0, @@ -1321,12 +1321,12 @@ fn hgiToTag(info: hosted_git_info.HostedGitInfo) Version.Tag { const string = []const u8; -const Environment = @import("../bun_core/env.zig"); -const hosted_git_info = @import("./hosted_git_info.zig"); +const Environment = @import("../bun_core/env.rust"); +const hosted_git_info = @import("./hosted_git_info.rust"); const std = @import("std"); -const Repository = @import("./repository.zig").Repository; +const Repository = @import("./repository.rust").Repository; -const Install = @import("./install.zig"); +const Install = @import("./install.rust"); const Features = Install.Features; const PackageManager = Install.PackageManager; const PackageNameHash = Install.PackageNameHash; diff --git a/src/install/extract_tarball.zig b/src/install/extract_tarball.zig index 04e94a2f9fc..0e040328a44 100644 --- a/src/install/extract_tarball.zig +++ b/src/install/extract_tarball.zig @@ -134,7 +134,7 @@ pub fn usesStreamingExtraction() bool { /// Derive the display name and a filesystem-safe basename for this /// package. Shared by the buffered `extract()` path below and the -/// streaming extractor in `TarballStream.zig` so both pick identical +/// streaming extractor in `TarballStream.rust` so both pick identical /// temp-dir and cache-folder names. pub fn nameAndBasename(this: *const ExtractTarball) struct { []const u8, []const u8 } { const name = if (this.name.slice().len > 0) this.name.slice() else brk: { @@ -195,7 +195,7 @@ fn extract(this: *const ExtractTarball, log: *logger.Log, tgz_bytes: []const u8) defer extract_destination.close(); const Archiver = bun.libarchive.Archiver; - const Zlib = @import("../zlib/zlib.zig"); + const Zlib = @import("../zlib/zlib.rust"); var zlib_pool = Npm.Registry.BodyPool.get(default_allocator); zlib_pool.data.reset(); defer Npm.Registry.BodyPool.release(zlib_pool); @@ -593,13 +593,13 @@ pub fn moveToCacheDirectory( const string = []const u8; -const Npm = @import("./npm.zig"); +const Npm = @import("./npm.rust"); const std = @import("std"); -const FileSystem = @import("../resolver/fs.zig").FileSystem; -const Integrity = @import("./integrity.zig").Integrity; -const Resolution = @import("./resolution.zig").Resolution; +const FileSystem = @import("../resolver/fs.rust").FileSystem; +const Integrity = @import("./integrity.rust").Integrity; +const Resolution = @import("./resolution.rust").Resolution; -const Install = @import("./install.zig"); +const Install = @import("./install.rust"); const DependencyID = Install.DependencyID; const PackageManager = Install.PackageManager; diff --git a/src/install/hosted_git_info.zig b/src/install/hosted_git_info.zig index 2787233a019..3d4f9e64cb4 100644 --- a/src/install/hosted_git_info.zig +++ b/src/install/hosted_git_info.zig @@ -168,7 +168,7 @@ pub const HostedGitInfo = struct { } /// Convert this HostedGitInfo to a JavaScript object - pub const toJS = @import("../install_jsc/hosted_git_info_jsc.zig").hostedGitInfoToJS; + pub const toJS = @import("../install_jsc/hosted_git_info_jsc.rust").hostedGitInfoToJS; pub const StringPair = struct { save_spec: []const u8, @@ -567,7 +567,7 @@ pub const UrlProtocolPair = struct { fn concatPartsToUrl(allocator: std.mem.Allocator, parts: []const []const u8) ?*jsc.URL { // TODO(markovejnovic): There is a sad unnecessary allocation here that I don't know how to - // get rid of -- in theory, URL.zig could allocate once. + // get rid of -- in theory, URL.rust could allocate once. const new_str = bun.handleOom(bun.strings.concat(allocator, parts)); defer allocator.free(new_str); return jsc.URL.fromString(bun.String.init(new_str)); @@ -1641,12 +1641,12 @@ const HostProvider = enum { }; pub const TestingAPIs = struct { - pub const jsParseUrl = @import("../install_jsc/hosted_git_info_jsc.zig").jsParseUrl; - pub const jsFromUrl = @import("../install_jsc/hosted_git_info_jsc.zig").jsFromUrl; + pub const jsParseUrl = @import("../install_jsc/hosted_git_info_jsc.rust").jsParseUrl; + pub const jsFromUrl = @import("../install_jsc/hosted_git_info_jsc.rust").jsFromUrl; }; const std = @import("std"); -const PercentEncoding = @import("../url/url.zig").PercentEncoding; +const PercentEncoding = @import("../url/url.rust").PercentEncoding; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/install/install.zig b/src/install/install.zig index 01afb1aa0bc..a2deaa03505 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -243,44 +243,44 @@ pub const PackageManifestError = error{ PackageManifestHTTP5xx, }; -pub const ExtractTarball = @import("./extract_tarball.zig"); -pub const NetworkTask = @import("./NetworkTask.zig"); -pub const TarballStream = @import("./TarballStream.zig"); -pub const Npm = @import("./npm.zig"); -pub const PackageManager = @import("./PackageManager.zig"); -pub const PackageManifestMap = @import("./PackageManifestMap.zig"); -pub const Task = @import("./PackageManagerTask.zig"); -pub const TextLockfile = @import("./lockfile/bun.lock.zig"); -pub const Bin = @import("./bin.zig").Bin; -pub const FolderResolution = @import("./resolvers/folder_resolver.zig").FolderResolution; -pub const LifecycleScriptSubprocess = @import("./lifecycle_script_runner.zig").LifecycleScriptSubprocess; -pub const SecurityScanSubprocess = @import("./PackageManager/security_scanner.zig").SecurityScanSubprocess; -pub const PackageInstall = @import("./PackageInstall.zig").PackageInstall; -pub const Repository = @import("./repository.zig").Repository; -pub const Resolution = @import("./resolution.zig").Resolution; -pub const Store = @import("./isolated_install/Store.zig").Store; -pub const FileCopier = @import("./isolated_install/FileCopier.zig").FileCopier; -pub const PnpmMatcher = @import("./PnpmMatcher.zig"); -pub const PostinstallOptimizer = @import("./postinstall_optimizer.zig").PostinstallOptimizer; - -pub const ArrayIdentityContext = @import("../collections/identity_context.zig").ArrayIdentityContext; -pub const IdentityContext = @import("../collections/identity_context.zig").IdentityContext; - -pub const external = @import("./ExternalSlice.zig"); +pub const ExtractTarball = @import("./extract_tarball.rust"); +pub const NetworkTask = @import("./NetworkTask.rust"); +pub const TarballStream = @import("./TarballStream.rust"); +pub const Npm = @import("./npm.rust"); +pub const PackageManager = @import("./PackageManager.rust"); +pub const PackageManifestMap = @import("./PackageManifestMap.rust"); +pub const Task = @import("./PackageManagerTask.rust"); +pub const TextLockfile = @import("./lockfile/bun.lock.rust"); +pub const Bin = @import("./bin.rust").Bin; +pub const FolderResolution = @import("./resolvers/folder_resolver.rust").FolderResolution; +pub const LifecycleScriptSubprocess = @import("./lifecycle_script_runner.rust").LifecycleScriptSubprocess; +pub const SecurityScanSubprocess = @import("./PackageManager/security_scanner.rust").SecurityScanSubprocess; +pub const PackageInstall = @import("./PackageInstall.rust").PackageInstall; +pub const Repository = @import("./repository.rust").Repository; +pub const Resolution = @import("./resolution.rust").Resolution; +pub const Store = @import("./isolated_install/Store.rust").Store; +pub const FileCopier = @import("./isolated_install/FileCopier.rust").FileCopier; +pub const PnpmMatcher = @import("./PnpmMatcher.rust"); +pub const PostinstallOptimizer = @import("./postinstall_optimizer.rust").PostinstallOptimizer; + +pub const ArrayIdentityContext = @import("../collections/identity_context.rust").ArrayIdentityContext; +pub const IdentityContext = @import("../collections/identity_context.rust").IdentityContext; + +pub const external = @import("./ExternalSlice.rust"); pub const ExternalPackageNameHashList = external.ExternalPackageNameHashList; pub const ExternalSlice = external.ExternalSlice; pub const ExternalStringList = external.ExternalStringList; pub const ExternalStringMap = external.ExternalStringMap; pub const VersionSlice = external.VersionSlice; -pub const Integrity = @import("./integrity.zig").Integrity; -pub const Dependency = @import("./dependency.zig"); -pub const Behavior = @import("./dependency.zig").Behavior; +pub const Integrity = @import("./integrity.rust").Integrity; +pub const Dependency = @import("./dependency.rust"); +pub const Behavior = @import("./dependency.rust").Behavior; -pub const Lockfile = @import("./lockfile.zig"); +pub const Lockfile = @import("./lockfile.rust"); pub const PatchedDep = Lockfile.PatchedDep; -pub const patch = @import("./patch_install.zig"); +pub const patch = @import("./patch_install.rust"); pub const PatchTask = patch.PatchTask; const string = []const u8; diff --git a/src/install/integrity.zig b/src/install/integrity.zig index d501ebdc1f5..3ab01981db8 100644 --- a/src/install/integrity.zig +++ b/src/install/integrity.zig @@ -313,7 +313,7 @@ pub const Integrity = extern struct { }; const std = @import("std"); -const Crypto = @import("../sha_hmac/sha.zig").Hashers; +const Crypto = @import("../sha_hmac/sha.rust").Hashers; const bun = @import("bun"); const strings = bun.strings; diff --git a/src/install/isolated_install/FileCopier.zig b/src/install/isolated_install/FileCopier.zig index 335a1a44b80..2fdd6ac7c19 100644 --- a/src/install/isolated_install/FileCopier.zig +++ b/src/install/isolated_install/FileCopier.zig @@ -169,7 +169,7 @@ pub const FileCopier = struct { } }; -const Walker = @import("../../sys/walker_skippable.zig"); +const Walker = @import("../../sys/walker_skippable.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/isolated_install/Hardlinker.zig b/src/install/isolated_install/Hardlinker.zig index 7939c5fac69..ca17e374827 100644 --- a/src/install/isolated_install/Hardlinker.zig +++ b/src/install/isolated_install/Hardlinker.zig @@ -201,7 +201,7 @@ pub fn link(this: *Hardlinker) OOM!sys.Maybe(void) { return .success; } -const Walker = @import("../../sys/walker_skippable.zig"); +const Walker = @import("../../sys/walker_skippable.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/isolated_install/Installer.zig b/src/install/isolated_install/Installer.zig index 81535f7ba26..41227c3fd0b 100644 --- a/src/install/isolated_install/Installer.zig +++ b/src/install/isolated_install/Installer.zig @@ -2007,10 +2007,10 @@ const string = []const u8; const debug = Output.scoped(.IsolatedInstaller, .hidden); -const FileCloner = @import("./FileCloner.zig"); -const Hardlinker = @import("./Hardlinker.zig"); +const FileCloner = @import("./FileCloner.rust"); +const Hardlinker = @import("./Hardlinker.rust"); const std = @import("std"); -const Symlinker = @import("./Symlinker.zig").Symlinker; +const Symlinker = @import("./Symlinker.rust").Symlinker; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/isolated_install/Store.zig b/src/install/isolated_install/Store.zig index 7737691bc40..8068eb61209 100644 --- a/src/install/isolated_install/Store.zig +++ b/src/install/isolated_install/Store.zig @@ -49,7 +49,7 @@ pub const Store = struct { bun.assert(NewId(Entry) == NewId(Entry)); } - pub const Installer = @import("./Installer.zig").Installer; + pub const Installer = @import("./Installer.rust").Installer; /// Called from multiple threads. `parent_dedupe` should not be shared between threads. pub fn isCycle(this: *const Store, id: Entry.Id, maybe_parent_id: Entry.Id, parent_dedupe: *std.AutoArrayHashMap(Entry.Id, void)) bool { diff --git a/src/install/lifecycle_script_runner.zig b/src/install/lifecycle_script_runner.zig index 5778eb3c006..03d35ec64fd 100644 --- a/src/install/lifecycle_script_runner.zig +++ b/src/install/lifecycle_script_runner.zig @@ -591,9 +591,9 @@ pub const LifecycleScriptSubprocess = struct { const string = []const u8; -const Lockfile = @import("./lockfile.zig"); +const Lockfile = @import("./lockfile.rust"); const std = @import("std"); -const PackageManager = @import("./install.zig").PackageManager; +const PackageManager = @import("./install.rust").PackageManager; const Timer = std.time.Timer; const bun = @import("bun"); diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig index 3503f24c292..5e469b7b9d0 100644 --- a/src/install/lockfile.zig +++ b/src/install/lockfile.zig @@ -64,7 +64,7 @@ pub const Scripts = struct { "postprepare", }; - const RunCommand = @import("../runtime/cli/run_command.zig").RunCommand; + const RunCommand = @import("../runtime/cli/run_command.rust").RunCommand; preinstall: Entries = .{}, install: Entries = .{}, @@ -1209,8 +1209,8 @@ pub const Printer = struct { } } - pub const Tree = @import("./lockfile/printer/tree_printer.zig"); - pub const Yarn = @import("./lockfile/printer/Yarn.zig"); + pub const Tree = @import("./lockfile/printer/tree_printer.rust"); + pub const Yarn = @import("./lockfile/printer/Yarn.rust"); }; pub fn verifyData(this: *const Lockfile) !void { @@ -1745,14 +1745,14 @@ pub const DependencyIDList = std.ArrayListUnmanaged(DependencyID); pub const StringBuffer = std.ArrayListUnmanaged(u8); pub const ExternalStringBuffer = std.ArrayListUnmanaged(ExternalString); -pub const jsonStringify = @import("./lockfile/lockfile_json_stringify_for_debugging.zig").jsonStringify; -pub const assertNoUninitializedPadding = @import("./padding_checker.zig").assertNoUninitializedPadding; -pub const Buffers = @import("./lockfile/Buffers.zig"); -pub const Serializer = @import("./lockfile/bun.lockb.zig"); -pub const CatalogMap = @import("./lockfile/CatalogMap.zig"); -pub const OverrideMap = @import("./lockfile/OverrideMap.zig"); -pub const Package = @import("./lockfile/Package.zig").Package(u64); -pub const Tree = @import("./lockfile/Tree.zig"); +pub const jsonStringify = @import("./lockfile/lockfile_json_stringify_for_debugging.rust").jsonStringify; +pub const assertNoUninitializedPadding = @import("./padding_checker.rust").assertNoUninitializedPadding; +pub const Buffers = @import("./lockfile/Buffers.rust"); +pub const Serializer = @import("./lockfile/bun.lockb.rust"); +pub const CatalogMap = @import("./lockfile/CatalogMap.rust"); +pub const OverrideMap = @import("./lockfile/OverrideMap.rust"); +pub const Package = @import("./lockfile/Package.rust").Package(u64); +pub const Tree = @import("./lockfile/Tree.rust"); pub fn deinit(this: *Lockfile) void { this.buffers.deinit(this.allocator); @@ -2110,7 +2110,7 @@ pub const default_trusted_dependencies = brk: { for (default_trusted_dependencies_list) |dep| { if (map.len == max_default_trusted_dependencies) { - @compileError("default-trusted-dependencies.txt is too large, please increase 'max_default_trusted_dependencies' in lockfile.zig"); + @compileError("default-trusted-dependencies.txt is too large, please increase 'max_default_trusted_dependencies' in lockfile.rust"); } const entry = map.getOrPutAssumeCapacity(dep); @@ -2161,23 +2161,23 @@ pub const StringPool = String.Builder.StringPool; const string = []const u8; const stringZ = [:0]const u8; -const Dependency = @import("./dependency.zig"); -const DotEnv = @import("../dotenv/env_loader.zig"); -const Npm = @import("./npm.zig"); -const Path = @import("../paths/resolve_path.zig"); -const TextLockfile = @import("./lockfile/bun.lock.zig"); -const migration = @import("./migration.zig"); +const Dependency = @import("./dependency.rust"); +const DotEnv = @import("../dotenv/env_loader.rust"); +const Npm = @import("./npm.rust"); +const Path = @import("../paths/resolve_path.rust"); +const TextLockfile = @import("./lockfile/bun.lock.rust"); +const migration = @import("./migration.rust"); const std = @import("std"); -const Crypto = @import("../sha_hmac/sha.zig").Hashers; -const Resolution = @import("./resolution.zig").Resolution; -const StaticHashMap = @import("../collections/StaticHashMap.zig").StaticHashMap; -const which = @import("../which/which.zig").which; +const Crypto = @import("../sha_hmac/sha.rust").Hashers; +const Resolution = @import("./resolution.rust").Resolution; +const StaticHashMap = @import("../collections/StaticHashMap.rust").StaticHashMap; +const which = @import("../which/which.rust").which; const Allocator = std.mem.Allocator; -const ArrayIdentityContext = @import("../collections/identity_context.zig").ArrayIdentityContext; -const IdentityContext = @import("../collections/identity_context.zig").IdentityContext; +const ArrayIdentityContext = @import("../collections/identity_context.rust").ArrayIdentityContext; +const IdentityContext = @import("../collections/identity_context.rust").IdentityContext; -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const FileSystem = Fs.FileSystem; const bun = @import("bun"); diff --git a/src/install/lockfile/Package.zig b/src/install/lockfile/Package.zig index cb2c40e7088..04bf1f08650 100644 --- a/src/install/lockfile/Package.zig +++ b/src/install/lockfile/Package.zig @@ -41,9 +41,9 @@ pub fn Package(comptime SemverIntType: type) type { const Resolution = ResolutionType(SemverIntType); - pub const Scripts = @import("./Package/Scripts.zig").Scripts; - pub const Meta = @import("./Package/Meta.zig").Meta; - pub const WorkspaceMap = @import("./Package/WorkspaceMap.zig"); + pub const Scripts = @import("./Package/Scripts.rust").Scripts; + pub const Meta = @import("./Package/Meta.rust").Meta; + pub const WorkspaceMap = @import("./Package/WorkspaceMap.rust"); pub const DependencyGroup = struct { prop: string, @@ -2250,7 +2250,7 @@ pub fn Package(comptime SemverIntType: type) type { const string = []const u8; const std = @import("std"); -const ResolutionType = @import("../resolution.zig").ResolutionType; +const ResolutionType = @import("../resolution.rust").ResolutionType; const Allocator = std.mem.Allocator; const bun = @import("bun"); diff --git a/src/install/lockfile/Package/Meta.zig b/src/install/lockfile/Package/Meta.zig index f76a5ef41e1..fe857909fc4 100644 --- a/src/install/lockfile/Package/Meta.zig +++ b/src/install/lockfile/Package/Meta.zig @@ -69,7 +69,7 @@ pub const Meta = extern struct { } }; -const Integrity = @import("../../integrity.zig").Integrity; +const Integrity = @import("../../integrity.rust").Integrity; const bun = @import("bun"); const String = bun.Semver.String; diff --git a/src/install/lockfile/bun.lock.zig b/src/install/lockfile/bun.lock.zig index 88ceb50ed59..2ab0b6578b5 100644 --- a/src/install/lockfile/bun.lock.zig +++ b/src/install/lockfile/bun.lock.zig @@ -2261,9 +2261,9 @@ fn parseAppendDependencies( const string = []const u8; -const ExtractTarball = @import("../extract_tarball.zig"); +const ExtractTarball = @import("../extract_tarball.rust"); const std = @import("std"); -const Integrity = @import("../integrity.zig").Integrity; +const Integrity = @import("../integrity.rust").Integrity; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/lockfile/bun.lockb.zig b/src/install/lockfile/bun.lockb.zig index 14f0ea2ae7b..26ad1a8e7c9 100644 --- a/src/install/lockfile/bun.lockb.zig +++ b/src/install/lockfile/bun.lockb.zig @@ -14,7 +14,7 @@ const has_config_version_tag: u64 = @bitCast(@as([8]u8, "cNfGvRsN".*)); pub fn save(this: *Lockfile, options: *const PackageManager.Options, bytes: *std.array_list.Managed(u8), total_size: *usize, end_pos: *usize) !void { // we clone packages with the z_allocator to make sure bytes are zeroed. - // TODO: investigate if we still need this now that we have `padding_checker.zig` + // TODO: investigate if we still need this now that we have `padding_checker.rust` var old_packages_list = this.packages; this.packages = try this.packages.clone(z_allocator); old_packages_list.deinit(this.allocator); diff --git a/src/install/migration.zig b/src/install/migration.zig index 3ca057ee545..c6d48e5c912 100644 --- a/src/install/migration.zig +++ b/src/install/migration.zig @@ -49,7 +49,7 @@ pub fn detectAndLoadOtherLockfile( const lockfile = File.openat(dir, "yarn.lock", bun.O.RDONLY, 0).unwrap() catch break :yarn; defer lockfile.close(); const data = lockfile.readToEnd(allocator).unwrap() catch break :yarn; - const migrate_result = @import("./yarn.zig").migrateYarnLockfile(this, manager, allocator, log, data, dir) catch |err| { + const migrate_result = @import("./yarn.rust").migrateYarnLockfile(this, manager, allocator, log, data, dir) catch |err| { return LoadResult{ .err = .{ .step = .migrating, .value = err, @@ -73,7 +73,7 @@ pub fn detectAndLoadOtherLockfile( const lockfile = File.openat(dir, "pnpm-lock.yaml", bun.O.RDONLY, 0).unwrap() catch break :pnpm; defer lockfile.close(); const data = lockfile.readToEnd(allocator).unwrap() catch break :pnpm; - const migrate_result = @import("./pnpm.zig").migratePnpmLockfile(this, manager, allocator, log, data, dir) catch |err| { + const migrate_result = @import("./pnpm.rust").migratePnpmLockfile(this, manager, allocator, log, data, dir) catch |err| { switch (err) { error.PnpmLockfileTooOld => { Output.prettyErrorln( @@ -1109,16 +1109,16 @@ fn packageNameFromPath(pkg_path: []const u8) []const u8 { const string = []const u8; -const Dependency = @import("./dependency.zig"); -const Install = @import("./install.zig"); -const Npm = @import("./npm.zig"); +const Dependency = @import("./dependency.rust"); +const Install = @import("./install.rust"); +const Npm = @import("./npm.rust"); const std = @import("std"); -const Bin = @import("./bin.zig").Bin; -const Integrity = @import("./integrity.zig").Integrity; -const Resolution = @import("./resolution.zig").Resolution; +const Bin = @import("./bin.rust").Bin; +const Integrity = @import("./integrity.rust").Integrity; +const Resolution = @import("./resolution.rust").Resolution; const Allocator = std.mem.Allocator; -const Lockfile = @import("./lockfile.zig"); +const Lockfile = @import("./lockfile.rust"); const LoadResult = Lockfile.LoadResult; const bun = @import("bun"); diff --git a/src/install/npm.zig b/src/install/npm.zig index c65a70d37b4..0783730defa 100644 --- a/src/install/npm.zig +++ b/src/install/npm.zig @@ -681,7 +681,7 @@ pub const OperatingSystem = enum(u16) { return .{ .added = this, .removed = .none }; } - pub const jsFunctionOperatingSystemIsMatch = @import("../install_jsc/npm_jsc.zig").operatingSystemIsMatch; + pub const jsFunctionOperatingSystemIsMatch = @import("../install_jsc/npm_jsc.rust").operatingSystemIsMatch; }; pub const Libc = enum(u8) { @@ -714,7 +714,7 @@ pub const Libc = enum(u8) { // TODO: pub const current: Libc = @intFromEnum(glibc); - pub const jsFunctionLibcIsMatch = @import("../install_jsc/npm_jsc.zig").libcIsMatch; + pub const jsFunctionLibcIsMatch = @import("../install_jsc/npm_jsc.rust").libcIsMatch; }; /// https://docs.npmjs.com/cli/v8/configuring-npm/package-json#cpu @@ -776,7 +776,7 @@ pub const Architecture = enum(u16) { return .{ .added = this, .removed = .none }; } - pub const jsFunctionArchitectureIsMatch = @import("../install_jsc/npm_jsc.zig").architectureIsMatch; + pub const jsFunctionArchitectureIsMatch = @import("../install_jsc/npm_jsc.rust").architectureIsMatch; }; pub const PackageVersion = extern struct { @@ -1290,7 +1290,7 @@ pub const PackageManifest = struct { } }; - pub const bindings = @import("../install_jsc/npm_jsc.zig").ManifestBindings; + pub const bindings = @import("../install_jsc/npm_jsc.rust").ManifestBindings; pub fn str(self: *const PackageManifest, external: *const ExternalString) string { return external.slice(self.string_buf); @@ -2735,21 +2735,21 @@ pub const PackageManifest = struct { const string = []const u8; -const DotEnv = @import("../dotenv/env_loader.zig"); +const DotEnv = @import("../dotenv/env_loader.rust"); const std = @import("std"); -const Bin = @import("./bin.zig").Bin; -const IdentityContext = @import("../collections/identity_context.zig").IdentityContext; -const Integrity = @import("./integrity.zig").Integrity; -const ObjectPool = @import("../collections/pool.zig").ObjectPool; -const URL = @import("../url/url.zig").URL; - -const Aligner = @import("./install.zig").Aligner; -const ExternalSlice = @import("./install.zig").ExternalSlice; -const ExternalStringList = @import("./install.zig").ExternalStringList; -const ExternalStringMap = @import("./install.zig").ExternalStringMap; -const PackageManager = @import("./install.zig").PackageManager; -const VersionSlice = @import("./install.zig").VersionSlice; -const initializeStore = @import("./install.zig").initializeMiniStore; +const Bin = @import("./bin.rust").Bin; +const IdentityContext = @import("../collections/identity_context.rust").IdentityContext; +const Integrity = @import("./integrity.rust").Integrity; +const ObjectPool = @import("../collections/pool.rust").ObjectPool; +const URL = @import("../url/url.rust").URL; + +const Aligner = @import("./install.rust").Aligner; +const ExternalSlice = @import("./install.rust").ExternalSlice; +const ExternalStringList = @import("./install.rust").ExternalStringList; +const ExternalStringMap = @import("./install.rust").ExternalStringMap; +const PackageManager = @import("./install.rust").PackageManager; +const VersionSlice = @import("./install.rust").VersionSlice; +const initializeStore = @import("./install.rust").initializeMiniStore; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/install/padding_checker.zig b/src/install/padding_checker.zig index 4441bd06955..0ad334a701a 100644 --- a/src/install/padding_checker.zig +++ b/src/install/padding_checker.zig @@ -7,7 +7,7 @@ /// /// The obvious way to introduce undefined memory into a struct is via `.field = undefined`, but a much more /// subtle way is to have implicit padding in an extern struct. For example: -/// ```zig +/// ```rust /// const Demo = struct { /// a: u8, // @sizeOf(Demo, "a") == 1, @offsetOf(Demo, "a") == 0 /// b: u64, // @sizeOf(Demo, "b") == 8, @offsetOf(Demo, "b") == 8 @@ -18,7 +18,7 @@ /// which is considered *undefined memory*. /// /// The solution is to have it explicitly initialized to zero bytes, like: -/// ```zig +/// ```rust /// const Demo = extern struct { /// a: u8, /// _padding: [7]u8 = .{0} ** 7, @@ -76,7 +76,7 @@ pub fn assertNoUninitializedPadding(comptime T: type) void { const offset = @offsetOf(T, field.name); if (offset != i) { @compileError(std.fmt.comptimePrint( - \\Expected no possibly uninitialized bytes of memory in '{s}', but found a {d} byte gap between fields '{s}' and '{s}' This can be fixed by adding a padding field to the struct like `padding: [{d}]u8 = .{{0}} ** {d},` between these fields. For more information, look at `padding_checker.zig` + \\Expected no possibly uninitialized bytes of memory in '{s}', but found a {d} byte gap between fields '{s}' and '{s}' This can be fixed by adding a padding field to the struct like `padding: [{d}]u8 = .{{0}} ** {d},` between these fields. For more information, look at `padding_checker.rust` , .{ @typeName(T), @@ -93,7 +93,7 @@ pub fn assertNoUninitializedPadding(comptime T: type) void { if (i != @sizeOf(T)) { @compileError(std.fmt.comptimePrint( - \\Expected no possibly uninitialized bytes of memory in '{s}', but found a {d} byte gap at the end of the struct. This can be fixed by adding a padding field to the struct like `padding: [{d}]u8 = .{{0}} ** {d},` between these fields. For more information, look at `padding_checker.zig` + \\Expected no possibly uninitialized bytes of memory in '{s}', but found a {d} byte gap at the end of the struct. This can be fixed by adding a padding field to the struct like `padding: [{d}]u8 = .{{0}} ** {d},` between these fields. For more information, look at `padding_checker.rust` , .{ @typeName(T), diff --git a/src/install/patch_install.zig b/src/install/patch_install.zig index e91903d113e..c406cee00bd 100644 --- a/src/install/patch_install.zig +++ b/src/install/patch_install.zig @@ -1,10 +1,10 @@ pub const PackageID = bun.install.PackageID; pub const DependencyID = bun.install.DependencyID; -pub const Lockfile = @import("./lockfile.zig"); +pub const Lockfile = @import("./lockfile.rust"); pub const PatchedDep = Lockfile.PatchedDep; -pub const Resolution = @import("./resolution.zig").Resolution; +pub const Resolution = @import("./resolution.rust").Resolution; pub const PackageInstall = bun.install.PackageInstall; @@ -578,7 +578,7 @@ const stringZ = [:0]const u8; const std = @import("std"); -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const FileSystem = Fs.FileSystem; const bun = @import("bun"); diff --git a/src/install/pnpm.zig b/src/install/pnpm.zig index 12070f593f6..6d4b8a6bdd0 100644 --- a/src/install/pnpm.zig +++ b/src/install/pnpm.zig @@ -1547,13 +1547,13 @@ fn updatePackageJsonAfterMigration(allocator: Allocator, manager: *PackageManage } } -const Dependency = @import("./dependency.zig"); -const Npm = @import("./npm.zig"); -const Bin = @import("./bin.zig").Bin; -const Integrity = @import("./integrity.zig").Integrity; -const Resolution = @import("./resolution.zig").Resolution; +const Dependency = @import("./dependency.rust"); +const Npm = @import("./npm.rust"); +const Bin = @import("./bin.rust").Bin; +const Integrity = @import("./integrity.rust").Integrity; +const Resolution = @import("./resolution.rust").Resolution; -const Lockfile = @import("./lockfile.zig"); +const Lockfile = @import("./lockfile.rust"); const LoadResult = Lockfile.LoadResult; const bun = @import("bun"); diff --git a/src/install/repository.zig b/src/install/repository.zig index 14cde5ee41f..8a4c8d1382b 100644 --- a/src/install/repository.zig +++ b/src/install/repository.zig @@ -704,14 +704,14 @@ pub const Repository = extern struct { const string = []const u8; -const Dependency = @import("./dependency.zig"); -const DotEnv = @import("../dotenv/env_loader.zig"); -const Environment = @import("../bun_core/env.zig"); -const hosted_git_info = @import("./hosted_git_info.zig"); +const Dependency = @import("./dependency.rust"); +const DotEnv = @import("../dotenv/env_loader.rust"); +const Environment = @import("../bun_core/env.rust"); +const hosted_git_info = @import("./hosted_git_info.rust"); const std = @import("std"); -const FileSystem = @import("../resolver/fs.zig").FileSystem; +const FileSystem = @import("../resolver/fs.rust").FileSystem; -const Install = @import("./install.zig"); +const Install = @import("./install.rust"); const ExtractData = Install.ExtractData; const PackageManager = Install.PackageManager; diff --git a/src/install/resolution.zig b/src/install/resolution.zig index 5256227f01c..cc1f627f67e 100644 --- a/src/install/resolution.zig +++ b/src/install/resolution.zig @@ -540,8 +540,8 @@ pub fn ResolutionType(comptime SemverIntType: type) type { const string = []const u8; const std = @import("std"); -const Repository = @import("./repository.zig").Repository; -const VersionedURLType = @import("./versioned_url.zig").VersionedURLType; +const Repository = @import("./repository.rust").Repository; +const VersionedURLType = @import("./versioned_url.rust").VersionedURLType; const bun = @import("bun"); const OOM = bun.OOM; diff --git a/src/install/resolvers/folder_resolver.zig b/src/install/resolvers/folder_resolver.zig index 33af82daeec..0cf9899c0f4 100644 --- a/src/install/resolvers/folder_resolver.zig +++ b/src/install/resolvers/folder_resolver.zig @@ -331,17 +331,17 @@ pub const FolderResolution = union(Tag) { const string = []const u8; const stringZ = [:0]const u8; -const Dependency = @import("../dependency.zig"); -const Npm = @import("../npm.zig"); +const Dependency = @import("../dependency.rust"); +const Npm = @import("../npm.rust"); const std = @import("std"); -const FileSystem = @import("../../resolver/fs.zig").FileSystem; -const IdentityContext = @import("../../collections/identity_context.zig").IdentityContext; -const Resolution = @import("../resolution.zig").Resolution; - -const Features = @import("../install.zig").Features; -const Lockfile = @import("../install.zig").Lockfile; -const PackageID = @import("../install.zig").PackageID; -const PackageManager = @import("../install.zig").PackageManager; +const FileSystem = @import("../../resolver/fs.rust").FileSystem; +const IdentityContext = @import("../../collections/identity_context.rust").IdentityContext; +const Resolution = @import("../resolution.rust").Resolution; + +const Features = @import("../install.rust").Features; +const Lockfile = @import("../install.rust").Lockfile; +const PackageID = @import("../install.rust").PackageID; +const PackageManager = @import("../install.rust").PackageManager; const bun = @import("bun"); const JSAst = bun.ast; diff --git a/src/install/windows-shim/BinLinkingShim.zig b/src/install/windows-shim/BinLinkingShim.zig index ab8dd2bfab1..9225235d5e8 100644 --- a/src/install/windows-shim/BinLinkingShim.zig +++ b/src/install/windows-shim/BinLinkingShim.zig @@ -9,7 +9,7 @@ //! [WSTR:program][u16:0][WSTR:args][u32:bin_path_byte_len][u32:arg_byte_len] //! - args always ends with a trailing space //! -//! See 'bun_shim_impl.zig' for more details on how this file is consumed. +//! See 'bun_shim_impl.rust' for more details on how this file is consumed. fn eqlComptime(a: []const u8, comptime b: []const u8) bool { return std.mem.eql(u8, a, b); diff --git a/src/install/windows-shim/Cargo.toml b/src/install/windows-shim/Cargo.toml index 8a707147761..a6d068ff31d 100644 --- a/src/install/windows-shim/Cargo.toml +++ b/src/install/windows-shim/Cargo.toml @@ -1,6 +1,6 @@ # Standalone Windows binary-linking shim PE. # -# In Zig this is built by `build.zig` as a separate freestanding ReleaseFast +# In Rust this is built by `build.rust` as a separate freestanding ReleaseFast # `exe` artifact (no libc, single-threaded) and `@embedFile`'d into bun.exe. # In the Rust port, the same source file (`bun_shim_impl.rs`) is compiled # *twice*: diff --git a/src/install/windows-shim/bun_shim_impl.zig b/src/install/windows-shim/bun_shim_impl.zig index f4411b02841..5becfe13933 100644 --- a/src/install/windows-shim/bun_shim_impl.zig +++ b/src/install/windows-shim/bun_shim_impl.zig @@ -8,7 +8,7 @@ //! which is a HUGE dx win for developers. //! //! The approach implemented is a `.bunx` file which sits right next to the renamed -//! launcher exe. We read that (see BinLinkingShim.zig for the creation of this file) +//! launcher exe. We read that (see BinLinkingShim.rust for the creation of this file) //! and then we call NtCreateProcess to spawn the correct child process. //! //! Every attempt possible to make this file as minimal as possible has been made. @@ -19,7 +19,7 @@ //! Notes about NTDLL and Windows Internals: //! - https://www.geoffchappell.com/studies/windows/win32/ntdll/index.htm //! - http://undocumented.ntinternals.net/index.html -//! - https://github.com/ziglang/zig/issues/1840#issuecomment-558486115 +//! - https://github.com/rustlang/rust/issues/1840#issuecomment-558486115 //! //! An earlier approach to this problem involved using extended attributes, but I found //! this to be extremely hard to get a working implementation. It takes more system calls @@ -626,7 +626,7 @@ fn launcher(comptime mode: LauncherMode, bun_ctx: anytype) mode.RetType() { debug("args_len_bytes: {}", .{shebang_metadata.args_len_bytes}); } - // magic number related to how BinLinkingShim.zig writes the metadata + // magic number related to how BinLinkingShim.rust writes the metadata // i'm sorry, i don't have a good explanation for why this number is this number. it just is. const validation_length_offset = 14; @@ -903,7 +903,7 @@ pub const FromBunRunContext = struct { environment: ?[*]const u16, }; -/// This is called from run_command.zig in bun.exe which allows us to skip the CreateProcessW +/// This is called from run_command.rust in bun.exe which allows us to skip the CreateProcessW /// call to create bun_shim_impl.exe. Instead we invoke the logic it has from an open file handle. /// /// This saves ~5-12ms depending on the machine. @@ -964,7 +964,7 @@ pub inline fn main() noreturn { const builtin = @import("builtin"); const std = @import("std"); -const Flags = @import("./BinLinkingShim.zig").Flags; +const Flags = @import("./BinLinkingShim.rust").Flags; const assert = std.debug.assert; const w = std.os.windows; diff --git a/src/install/yarn.zig b/src/install/yarn.zig index 2036b7e31d2..3e558ea09c3 100644 --- a/src/install/yarn.zig +++ b/src/install/yarn.zig @@ -1692,23 +1692,23 @@ pub fn migrateYarnLockfile( const string = []const u8; -const Dependency = @import("./dependency.zig"); -const Npm = @import("./npm.zig"); +const Dependency = @import("./dependency.rust"); +const Npm = @import("./npm.rust"); const std = @import("std"); -const Bin = @import("./bin.zig").Bin; -const Integrity = @import("./integrity.zig").Integrity; -const Resolution = @import("./resolution.zig").Resolution; +const Bin = @import("./bin.rust").Bin; +const Integrity = @import("./integrity.rust").Integrity; +const Resolution = @import("./resolution.rust").Resolution; const Allocator = std.mem.Allocator; -const Semver = @import("../semver/semver.zig"); +const Semver = @import("../semver/semver.rust"); const String = Semver.String; const stringHash = String.Builder.stringHash; -const Install = @import("./install.zig"); +const Install = @import("./install.rust"); const DependencyID = Install.DependencyID; const PackageID = Install.PackageID; -const Lockfile = @import("./lockfile.zig"); +const Lockfile = @import("./lockfile.rust"); const LoadResult = Lockfile.LoadResult; const Tree = Lockfile.Tree; diff --git a/src/install_jsc/dependency_jsc.zig b/src/install_jsc/dependency_jsc.zig index e8f2d3a15a2..9c93c4af1b1 100644 --- a/src/install_jsc/dependency_jsc.zig +++ b/src/install_jsc/dependency_jsc.zig @@ -1,5 +1,5 @@ //! JSC bridges for `bun.install.Dependency`. Aliased back into -//! `src/install/dependency.zig` so call sites are unchanged. +//! `src/install/dependency.rust` so call sites are unchanged. pub fn versionToJS(dep: *const Dependency.Version, buf: []const u8, globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { const object = jsc.JSValue.createEmptyObject(globalThis, 0); diff --git a/src/install_jsc/hosted_git_info_jsc.zig b/src/install_jsc/hosted_git_info_jsc.zig index c720141a72c..0748a8b4b1e 100644 --- a/src/install_jsc/hosted_git_info_jsc.zig +++ b/src/install_jsc/hosted_git_info_jsc.zig @@ -1,31 +1,31 @@ -//! JSC bridges for `src/install/hosted_git_info.zig`. Aliased back so call -//! sites and `$newZigFunction("hosted_git_info.zig", …)` are unchanged. +//! JSC bridges for `src/install/hosted_git_info.rust`. Aliased back so call +//! sites and `$newRustFunction("hosted_git_info.rust", …)` are unchanged. pub fn hostedGitInfoToJS(self: *const hgi.HostedGitInfo, go: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(go, 6); obj.put( go, - jsc.ZigString.static("type"), + jsc.RustString.static("type"), try bun.String.fromBytes(self.host_provider.typeStr()).toJS(go), ); obj.put( go, - jsc.ZigString.static("domain"), + jsc.RustString.static("domain"), try bun.String.fromBytes(self.host_provider.domain()).toJS(go), ); obj.put( go, - jsc.ZigString.static("project"), + jsc.RustString.static("project"), try bun.String.fromBytes(self.project).toJS(go), ); obj.put( go, - jsc.ZigString.static("user"), + jsc.RustString.static("user"), if (self.user) |user| try bun.String.fromBytes(user).toJS(go) else .null, ); obj.put( go, - jsc.ZigString.static("committish"), + jsc.RustString.static("committish"), if (self.committish) |committish| try bun.String.fromBytes(committish).toJS(go) else @@ -33,7 +33,7 @@ pub fn hostedGitInfoToJS(self: *const hgi.HostedGitInfo, go: *jsc.JSGlobalObject ); obj.put( go, - jsc.ZigString.static("default"), + jsc.RustString.static("default"), try bun.String.fromBytes(@tagName(self.default_representation)).toJS(go), ); @@ -103,7 +103,7 @@ pub fn jsFromUrl(go: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError return parsed.toJS(go); } -const hgi = @import("../install/hosted_git_info.zig"); +const hgi = @import("../install/hosted_git_info.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/install_jsc/ini_jsc.zig b/src/install_jsc/ini_jsc.zig index 0bc8c561901..80645496fbd 100644 --- a/src/install_jsc/ini_jsc.zig +++ b/src/install_jsc/ini_jsc.zig @@ -34,7 +34,7 @@ pub const IniTestingAPIs = struct { var value = object_iter.value; if (value.isUndefined()) continue; - const value_str = try value.getZigString(globalThis); + const value_str = try value.getRustString(globalThis); const slice = try value_str.toOwnedSlice(allocator); envmap.put(keyslice, .{ diff --git a/src/install_jsc/install_binding.zig b/src/install_jsc/install_binding.zig index 504c2391d37..e20c3c96fe3 100644 --- a/src/install_jsc/install_binding.zig +++ b/src/install_jsc/install_binding.zig @@ -1,11 +1,11 @@ pub const bun_install_js_bindings = struct { const JSValue = jsc.JSValue; - const ZigString = jsc.ZigString; + const RustString = jsc.RustString; const JSGlobalObject = jsc.JSGlobalObject; pub fn generate(global: *JSGlobalObject) JSValue { const obj = JSValue.createEmptyObject(global, 1); - const parseLockfile = ZigString.static("parseLockfile"); + const parseLockfile = RustString.static("parseLockfile"); obj.put(global, parseLockfile, jsc.JSFunction.create(global, "parseLockfile", jsParseLockfile, 1, .{})); return obj; } diff --git a/src/install_jsc/npm_jsc.zig b/src/install_jsc/npm_jsc.zig index 3c8aaf896a6..effdfc83b81 100644 --- a/src/install_jsc/npm_jsc.zig +++ b/src/install_jsc/npm_jsc.zig @@ -1,7 +1,7 @@ -//! JSC host fns extracted from `src/install/npm.zig` so that `install/` has +//! JSC host fns extracted from `src/install/npm.rust` so that `install/` has //! no `JSValue`/`JSGlobalObject`/`CallFrame` references. Each enum keeps a //! `pub const jsFunction… = @import(...)` alias so call sites and the -//! `$newZigFunction("npm.zig", "…")` codegen path are unchanged. +//! `$newRustFunction("npm.rust", "…")` codegen path are unchanged. pub fn operatingSystemIsMatch(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { const args = callframe.arguments_old(1); @@ -49,7 +49,7 @@ pub fn architectureIsMatch(globalObject: *jsc.JSGlobalObject, callframe: *jsc.Ca pub const ManifestBindings = struct { pub fn generate(global: *jsc.JSGlobalObject) jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(global, 1); - const parseManifestString = jsc.ZigString.static("parseManifest"); + const parseManifestString = jsc.RustString.static("parseManifest"); obj.put(global, parseManifestString, jsc.JSFunction.create(global, "parseManifest", jsParseManifest, 2, .{})); return obj; } diff --git a/src/install_types/NodeLinker.zig b/src/install_types/NodeLinker.zig index 811f7ac4637..9469535b3f1 100644 --- a/src/install_types/NodeLinker.zig +++ b/src/install_types/NodeLinker.zig @@ -1,5 +1,5 @@ -//! Extracted from `install/PackageManager/PackageManagerOptions.zig` so -//! `options_types/schema.zig`, `cli/bunfig.zig`, and `ini/` can name the +//! Extracted from `install/PackageManager/PackageManagerOptions.rust` so +//! `options_types/schema.rust`, `cli/bunfig.rust`, and `ini/` can name the //! linker mode without depending on the full package manager. pub const NodeLinker = enum(u8) { // If workspaces are used: isolated diff --git a/src/install_types/SemverString.zig b/src/install_types/SemverString.zig index 41f245d8a30..2f6fa85d0c8 100644 --- a/src/install_types/SemverString.zig +++ b/src/install_types/SemverString.zig @@ -454,7 +454,7 @@ pub const String = extern struct { return @as(Pointer, @bitCast(@as(u64, @as(u63, @truncate(@as(u64, @bitCast(this))))))); } - pub const toJS = @import("../semver_jsc/SemverString_jsc.zig").toJS; + pub const toJS = @import("../semver_jsc/SemverString_jsc.rust").toJS; // String must be a pointer because we reference it as a slice. It will become a dead pointer if it is copied. pub fn slice(this: *const String, buf: string) string { diff --git a/src/io/ParentDeathWatchdog.zig b/src/io/ParentDeathWatchdog.zig index ac478d66654..2727988908c 100644 --- a/src/io/ParentDeathWatchdog.zig +++ b/src/io/ParentDeathWatchdog.zig @@ -87,7 +87,7 @@ pub fn popSyncPgid() void { /// Scoped to the `spawnSync` script(s) — does NOT call `killDescendants()`, /// which is rooted at `getpid()` and would take out unrelated `Bun.spawn` /// siblings when `spawnSync` is reached from inside a live VM (e.g. -/// `ffi.zig:getSystemRootDirOnce` shelling out to `xcrun`). +/// `ffi.rust:getSystemRootDirOnce` shelling out to `xcrun`). pub fn killSyncScriptTree() void { if (comptime !Environment.isPosix) return; for (sync_pgids) |pgid| { @@ -116,7 +116,7 @@ extern "c" fn Bun__noOrphans_killTracked() void; /// OS thread, so defaulting PDEATHSIG there would kill the child on /// `worker.terminate()` while Bun itself is still alive. Restricting the /// default to the main thread keeps "die with Bun" semantics; Workers can -/// still opt in explicitly via the (Zig-level) `linux_pdeathsig` option. +/// still opt in explicitly via the (Rust-level) `linux_pdeathsig` option. pub fn shouldDefaultSpawnPdeathsig() bool { return enabled and std.Thread.getCurrentId() == install_thread_id; } @@ -217,7 +217,7 @@ pub fn installOnEventLoop(handle: jsc.EventLoopHandle) void { } /// `FilePoll.Owner` dispatch target — see the `ParentDeathWatchdog` arm in -/// `posix_event_loop.zig`'s `onUpdate`. The kqueue `NOTE_EXIT` for our parent +/// `posix_event_loop.rust`'s `onUpdate`. The kqueue `NOTE_EXIT` for our parent /// fired. pub fn onParentExit(_: *ParentDeathWatchdog) void { // Global.exit → Bun__onExit → onProcessExit → killDescendants. diff --git a/src/io/PipeReader.zig b/src/io/PipeReader.zig index 96048a13f55..6941ce18aa6 100644 --- a/src/io/PipeReader.zig +++ b/src/io/PipeReader.zig @@ -1,5 +1,5 @@ -// This is a runtime type instead of comptime due to bugs in Zig. -// https://github.com/ziglang/zig/issues/18664 +// This is a runtime type instead of comptime due to bugs in Rust. +// https://github.com/rustlang/rust/issues/18664 const BufferedReaderVTable = struct { parent: *anyopaque = undefined, fns: *const Fn = undefined, @@ -1299,13 +1299,13 @@ else if (bun.Environment.isWindows) else @compileError("Unsupported platform"); -const MaxBuf = @import("./MaxBuf.zig"); +const MaxBuf = @import("./MaxBuf.rust"); const std = @import("std"); -const Source = @import("./source.zig").Source; +const Source = @import("./source.rust").Source; -const FileType = @import("./pipes.zig").FileType; -const PollOrFd = @import("./pipes.zig").PollOrFd; -const ReadState = @import("./pipes.zig").ReadState; +const FileType = @import("./pipes.rust").FileType; +const PollOrFd = @import("./pipes.rust").PollOrFd; +const ReadState = @import("./pipes.rust").ReadState; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/io/PipeWriter.zig b/src/io/PipeWriter.zig index 9135b4204fe..d562a5299dc 100644 --- a/src/io/PipeWriter.zig +++ b/src/io/PipeWriter.zig @@ -16,7 +16,7 @@ pub const WriteStatus = enum { pub fn PosixPipeWriter( comptime This: type, // Originally this was the comptime vtable struct like the below - // But that caused a Zig compiler segfault as of 0.12.0-dev.1604+caae40c21 + // But that caused a Rust compiler segfault as of 0.12.0-dev.1604+caae40c21 comptime getFd: fn (*This) bun.FD, comptime getBuffer: fn (*This) []const u8, comptime onWrite: fn (*This, written: usize, status: WriteStatus) void, @@ -167,7 +167,7 @@ pub fn PosixPipeWriter( /// See below for the expected signature of `function_table`. In many cases, the /// function table can be the same as `Parent`. `anytype` is used because of a -/// dependency loop in Zig. +/// dependency loop in Rust. pub fn PosixBufferedWriter(Parent: type, function_table: anytype) type { return struct { const PosixWriter = @This(); @@ -373,7 +373,7 @@ pub fn PosixBufferedWriter(Parent: type, function_table: anytype) type { /// See below for the expected signature of `function_table`. In many cases, the /// function table can be the same as `Parent`. `anytype` is used because of a -/// dependency loop in Zig. +/// dependency loop in Rust. pub fn PosixStreamingWriter(comptime Parent: type, comptime function_table: anytype) type { return struct { const onWrite: fn (*Parent, amount: usize, status: WriteStatus) void = function_table.onWrite; @@ -943,7 +943,7 @@ fn BaseWindowsPipeWriter( /// See below for the expected signature of `function_table`. In many cases, the /// function table can be the same as `Parent`. `anytype` is used because of a -/// dependency loop in Zig. +/// dependency loop in Rust. pub fn WindowsBufferedWriter(Parent: type, function_table: anytype) type { return struct { source: ?Source = null, @@ -1060,7 +1060,7 @@ pub fn WindowsBufferedWriter(Parent: type, function_table: anytype) type { const pipe = this.source orelse return; switch (pipe) { .sync_file => { - @panic("This code path shouldn't be reached - sync_file in PipeWriter.zig"); + @panic("This code path shouldn't be reached - sync_file in PipeWriter.rust"); }, .file => |file| { // BufferedWriter ensures pending_payload_size blocks concurrent writes @@ -1120,7 +1120,7 @@ pub const StreamBuffer = struct { pub fn maybeShrink(this: *StreamBuffer) void { if (this.list.capacity > std.heap.pageSize()) { - // workaround insane zig decision to make it undefined behavior to resize .len < .capacity + // workaround insane rust decision to make it undefined behavior to resize .len < .capacity this.list.expandToCapacity(); this.list.shrinkAndFree(std.heap.pageSize()); } @@ -1231,7 +1231,7 @@ pub const StreamBuffer = struct { /// See below for the expected signature of `function_table`. In many cases, the /// function table can be the same as `Parent`. `anytype` is used because of a -/// dependency loop in Zig. +/// dependency loop in Rust. pub fn WindowsStreamingWriter(comptime Parent: type, function_table: anytype) type { return struct { /// reports the amount written and done means that we dont have any @@ -1563,10 +1563,10 @@ pub const BufferedWriter = if (bun.Environment.isPosix) PosixBufferedWriter else pub const StreamingWriter = if (bun.Environment.isPosix) PosixStreamingWriter else WindowsStreamingWriter; const std = @import("std"); -const Source = @import("./source.zig").Source; +const Source = @import("./source.rust").Source; -const FileType = @import("./pipes.zig").FileType; -const PollOrFd = @import("./pipes.zig").PollOrFd; +const FileType = @import("./pipes.rust").FileType; +const PollOrFd = @import("./pipes.rust").PollOrFd; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/io/heap.zig b/src/io/heap.zig index 78dcf2419e7..7b86b578069 100644 --- a/src/io/heap.zig +++ b/src/io/heap.zig @@ -2,7 +2,7 @@ /// /// Why? Intrusive data structures require the element type to hold the metadata /// required for the structure, rather than an additional container structure. -/// There are numerous pros/cons that are documented well by Boost[2]. For Zig, +/// There are numerous pros/cons that are documented well by Boost[2]. For Rust, /// I think the primary benefits are making data structures allocation free /// (rather, shifting allocation up to the consumer which can choose how they /// want the memory to be available). There are various costs to this such as diff --git a/src/io/io.zig b/src/io/io.zig index 322d3dbd761..1409fd9ef06 100644 --- a/src/io/io.zig +++ b/src/io/io.zig @@ -3,14 +3,14 @@ //! //! Most I/O happens on the main thread. -pub const heap = @import("./heap.zig"); +pub const heap = @import("./heap.rust"); -pub const openForWriting = @import("./openForWriting.zig").openForWriting; -pub const openForWritingImpl = @import("./openForWriting.zig").openForWritingImpl; +pub const openForWriting = @import("./openForWriting.rust").openForWriting; +pub const openForWritingImpl = @import("./openForWriting.rust").openForWritingImpl; const log = bun.Output.scoped(.loop, .visible); -pub const Source = @import("./source.zig").Source; +pub const Source = @import("./source.rust").Source; pub const Loop = struct { pending: Request.Queue = .{}, @@ -332,7 +332,7 @@ pub const Loop = struct { } }; -/// Zig std's `.freebsd` `EV` struct lacks `.EOF`; the value (0x8000) is the +/// Rust std's `.freebsd` `EV` struct lacks `.EOF`; the value (0x8000) is the /// same on Darwin and FreeBSD (sys/event.h: `#define EV_EOF 0x8000`). const EV_EOF: u16 = if (@hasDecl(std.c.EV, "EOF")) std.c.EV.EOF else 0x8000; @@ -718,16 +718,16 @@ pub const Poll = struct { pub const retry = bun.sys.E.AGAIN; -pub const ReadState = @import("./pipes.zig").ReadState; -pub const PipeReader = @import("./PipeReader.zig").PipeReader; -pub const BufferedReader = @import("./PipeReader.zig").BufferedReader; -pub const BufferedWriter = @import("./PipeWriter.zig").BufferedWriter; -pub const WriteResult = @import("./PipeWriter.zig").WriteResult; -pub const WriteStatus = @import("./PipeWriter.zig").WriteStatus; -pub const StreamingWriter = @import("./PipeWriter.zig").StreamingWriter; -pub const StreamBuffer = @import("./PipeWriter.zig").StreamBuffer; -pub const FileType = @import("./pipes.zig").FileType; -pub const MaxBuf = @import("./MaxBuf.zig"); +pub const ReadState = @import("./pipes.rust").ReadState; +pub const PipeReader = @import("./PipeReader.rust").PipeReader; +pub const BufferedReader = @import("./PipeReader.rust").BufferedReader; +pub const BufferedWriter = @import("./PipeWriter.rust").BufferedWriter; +pub const WriteResult = @import("./PipeWriter.rust").WriteResult; +pub const WriteStatus = @import("./PipeWriter.rust").WriteStatus; +pub const StreamingWriter = @import("./PipeWriter.rust").StreamingWriter; +pub const StreamBuffer = @import("./PipeWriter.rust").StreamBuffer; +pub const FileType = @import("./pipes.rust").FileType; +pub const MaxBuf = @import("./MaxBuf.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/io/posix_event_loop.zig b/src/io/posix_event_loop.zig index c37e6a78ffe..58b1f0992ed 100644 --- a/src/io/posix_event_loop.zig +++ b/src/io/posix_event_loop.zig @@ -134,7 +134,7 @@ pub const FilePoll = struct { /// Darwin uses the extended `kevent64_s` (extra `ext` field carries our /// generation number); FreeBSD only has the plain `struct kevent`. const KQueueEvent = if (Environment.isFreeBSD) std.c.Kevent else std.posix.system.kevent64_s; - /// Zig std's `.freebsd` `EV` struct omits EOF; the kernel value is the + /// Rust std's `.freebsd` `EV` struct omits EOF; the kernel value is the /// same as Darwin/OpenBSD (sys/event.h: `#define EV_EOF 0x8000`). const EV_EOF: u16 = if (@hasDecl(std.c.EV, "EOF")) std.c.EV.EOF else 0x8000; diff --git a/src/io/source.zig b/src/io/source.zig index 85af95ec627..538dd59775d 100644 --- a/src/io/source.zig +++ b/src/io/source.zig @@ -211,7 +211,7 @@ pub const Source = union(enum) { pub fn openPipe(loop: *uv.Loop, fd: bun.FD) bun.sys.Maybe(*Source.Pipe) { log("openPipe (fd = {f})", .{fd}); const pipe = bun.new(Source.Pipe, std.mem.zeroes(Source.Pipe)); - // we should never init using IPC here see ipc.zig + // we should never init using IPC here see ipc.rust switch (pipe.init(loop, false)) { .err => |err| { bun.destroy(pipe); diff --git a/src/io/windows_event_loop.zig b/src/io/windows_event_loop.zig index d2530eef9d3..1e6bcbb0bd6 100644 --- a/src/io/windows_event_loop.zig +++ b/src/io/windows_event_loop.zig @@ -411,7 +411,7 @@ pub const Closer = struct { } }; -const Posix = @import("./posix_event_loop.zig"); +const Posix = @import("./posix_event_loop.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/js/CLAUDE.md b/src/js/CLAUDE.md index e34bbfc5260..02508e09a2d 100644 --- a/src/js/CLAUDE.md +++ b/src/js/CLAUDE.md @@ -95,7 +95,7 @@ function myAPI(callback) { 3. Bundle, convert `export default` to `return` 4. Replace `__intrinsic__` with `@`, inline into C++ -ModuleLoader.zig loads modules by numeric ID via `InternalModuleRegistry.cpp`. +ModuleLoader.rust loads modules by numeric ID via `InternalModuleRegistry.cpp`. ## Key Rules diff --git a/src/js/README.md b/src/js/README.md index b1ee01d7101..fb1d3ef63e7 100644 --- a/src/js/README.md +++ b/src/js/README.md @@ -63,7 +63,7 @@ export default { Keep in mind that **these are not ES modules**. `export default` is only syntax sugar to assign to the variable `$exports`, which is actually how the module exports its contents. -To actually wire up one of these modules to the resolver, that is done separately in `module_resolver.zig`. Maybe in the future we can do codegen for it. +To actually wire up one of these modules to the resolver, that is done separately in `module_resolver.rust`. Maybe in the future we can do codegen for it. ## Builtin Functions diff --git a/src/js/builtins.d.ts b/src/js/builtins.d.ts index 709b040fc55..4419f169443 100644 --- a/src/js/builtins.d.ts +++ b/src/js/builtins.d.ts @@ -1,6 +1,6 @@ /// /// -/// +/// /// // Typedefs for JSC intrinsics. Instead of @, we use $ diff --git a/src/js/builtins/BundlerPlugin.ts b/src/js/builtins/BundlerPlugin.ts index 2e262c78548..762b6863dfb 100644 --- a/src/js/builtins/BundlerPlugin.ts +++ b/src/js/builtins/BundlerPlugin.ts @@ -130,7 +130,7 @@ export function runOnEndCallbacks( if (promises.length > 0) { // we return the promise here because detecting if the promise was handled or not - // in bundle_v2.zig is done by checking if this function did not return undefined + // in bundle_v2.rust is done by checking if this function did not return undefined return Promise.all(promises).then( () => { if (buildRejection !== undefined) { diff --git a/src/js/builtins/ConsoleObject.ts b/src/js/builtins/ConsoleObject.ts index d4cb2d0429a..ae3c3e886ba 100644 --- a/src/js/builtins/ConsoleObject.ts +++ b/src/js/builtins/ConsoleObject.ts @@ -165,7 +165,7 @@ export function createConsoleConstructor(console: typeof globalThis.console) { const kMinute = 60 * kSecond; const kHour = 60 * kMinute; - const internalGetStringWidth = $newZigFunction("string.zig", "String.jsGetStringWidth", 1); + const internalGetStringWidth = $newRustFunction("string.rust", "String.jsGetStringWidth", 1); /** * Returns the number of columns required to display the given string. diff --git a/src/js/builtins/Ipc.ts b/src/js/builtins/Ipc.ts index 8971d6290f0..03331760c48 100644 --- a/src/js/builtins/Ipc.ts +++ b/src/js/builtins/Ipc.ts @@ -191,7 +191,7 @@ export function serialize(_message, _handle, _options) { // Remove handle from socket object, it will be closed when the socket // will be sent if (!options?.keepOpen) { - // we can use a $newZigFunction to have it unset the callback + // we can use a $newRustFunction to have it unset the callback internal_handle.onread = nop; socket._handle = null; socket.setTimeout(0); @@ -212,7 +212,7 @@ export function serialize(_message, _handle, _options) { * @returns {void} */ export function parseHandle(target, serialized, fd) { - const emit = $newZigFunction("ipc.zig", "emitHandleIPCMessage", 3); + const emit = $newRustFunction("ipc.rust", "emitHandleIPCMessage", 3); const net = require("node:net"); // const dgram = require("node:dgram"); switch (serialized.type) { diff --git a/src/js/builtins/ProcessObjectInternals.ts b/src/js/builtins/ProcessObjectInternals.ts index 388c8866a96..073dbd044bb 100644 --- a/src/js/builtins/ProcessObjectInternals.ts +++ b/src/js/builtins/ProcessObjectInternals.ts @@ -463,7 +463,7 @@ export function windowsEnv( export function getChannel() { const EventEmitter = require("node:events"); - const setRef = $newZigFunction("node_cluster_binding.zig", "setRef", 1); + const setRef = $newRustFunction("node_cluster_binding.rust", "setRef", 1); return new (class Control extends EventEmitter { constructor() { super(); diff --git a/src/js/builtins/ReadableStreamInternals.ts b/src/js/builtins/ReadableStreamInternals.ts index 86bd3b3ebc7..c778d955d7a 100644 --- a/src/js/builtins/ReadableStreamInternals.ts +++ b/src/js/builtins/ReadableStreamInternals.ts @@ -854,7 +854,7 @@ export function assignStreamIntoResumableSink(stream, sink) { } // Native ResumableSink invokes this as (undefined, reason) — see - // ResumableSink.cancel in ResumableSink.zig. The first slot is unused + // ResumableSink.cancel in ResumableSink.rust. The first slot is unused // here (we close over `stream`), but the parameter is required so the // abort reason lands in the right argument. function cancelStream(_, reason: Error | null) { diff --git a/src/js/builtins/shell.ts b/src/js/builtins/shell.ts index f1d19bb84ac..a9330f958f5 100644 --- a/src/js/builtins/shell.ts +++ b/src/js/builtins/shell.ts @@ -2,12 +2,12 @@ export function createBunShellTemplateFunction(createShellInterpreter_, createPa const createShellInterpreter = createShellInterpreter_ as ( resolve: (code: number, stdout: Buffer, stderr: Buffer) => void, reject: (code: number, stdout: Buffer, stderr: Buffer) => void, - args: $ZigGeneratedClasses.ParsedShellScript, - ) => $ZigGeneratedClasses.ShellInterpreter; + args: $RustGeneratedClasses.ParsedShellScript, + ) => $RustGeneratedClasses.ShellInterpreter; const createParsedShellScript = createParsedShellScript_ as ( raw: string, args: string[], - ) => $ZigGeneratedClasses.ParsedShellScript; + ) => $RustGeneratedClasses.ParsedShellScript; function lazyBufferToHumanReadableString(this: Buffer) { return this.toString(); @@ -104,17 +104,17 @@ export function createBunShellTemplateFunction(createShellInterpreter_, createPa } class ShellPromise extends Promise { - #args: $ZigGeneratedClasses.ParsedShellScript | undefined = undefined; + #args: $RustGeneratedClasses.ParsedShellScript | undefined = undefined; #hasRun: boolean = false; #throws: boolean = true; #resolve: (code: number, stdout: Buffer, stderr: Buffer) => void; #reject: (code: number, stdout: Buffer, stderr: Buffer) => void; - constructor(args: $ZigGeneratedClasses.ParsedShellScript, throws: boolean) { + constructor(args: $RustGeneratedClasses.ParsedShellScript, throws: boolean) { // Create the error immediately so it captures the stacktrace at the point // of the shell script's invocation. Just creating the error should be // relatively cheap, the costly work is actually computing the stacktrace - // (`computeErrorInfo()` in ZigGlobalObject.cpp) + // (`computeErrorInfo()` in RustGlobalObject.cpp) let potentialError: ShellError | undefined = new ShellError(); let resolve, reject; diff --git a/src/js/bun/ffi.ts b/src/js/bun/ffi.ts index 07886f902b7..da229268b03 100644 --- a/src/js/bun/ffi.ts +++ b/src/js/bun/ffi.ts @@ -180,7 +180,7 @@ ffiWrappers[FFIType.int32_t] = "val|0"; // The trick to fixing the bug: after using |0 to misinterpret and force the integer into Int32Tag, // when passing the value to the C ffi code, misinterpret it again, resulting in the correct uint32_t. // -// To do this in native code, there is a spot in zig where uint32_t just prints int32_t. +// To do this in native code, there is a spot in rust where uint32_t just prints int32_t. ffiWrappers[FFIType.uint32_t] = "val<0?0:val>0xFFFFFFFF?-1:val|0"; ffiWrappers[FFIType.i64_fast] = `{ if (typeof val === "bigint") { @@ -421,7 +421,7 @@ const native = { }, }; -const ccFn = $newZigFunction("ffi.zig", "Bun__FFI__cc", 1); +const ccFn = $newRustFunction("ffi.rust", "Bun__FFI__cc", 1); function normalizePath(path) { if (typeof path === "string" && path?.startsWith?.("file:")) { diff --git a/src/js/bun/sql.ts b/src/js/bun/sql.ts index dc436d367fe..c240170478d 100644 --- a/src/js/bun/sql.ts +++ b/src/js/bun/sql.ts @@ -1037,7 +1037,7 @@ SQL.SQLiteError = SQLiteError; SQL.MySQLError = MySQLError; // // Helper functions for native code to create error instances -// // These are internal functions used by Zig/C++ code +// // These are internal functions used by Rust/C++ code // export function $createPostgresError( // message: string, // code: string, diff --git a/src/js/eval/fuzzilli-reprl.ts b/src/js/eval/fuzzilli-reprl.ts index 2cc125036d1..e2a11011c38 100644 --- a/src/js/eval/fuzzilli-reprl.ts +++ b/src/js/eval/fuzzilli-reprl.ts @@ -18,7 +18,7 @@ globalThis.__filename = "/fuzzilli.js"; // ============================================================================ // Verify we're running under Fuzzilli before starting REPRL loop -// The Zig code should have already checked, but double-check here +// The Rust code should have already checked, but double-check here try { // Try to stat fd 100 to see if it exists fs.fstatSync(REPRL_CRFD); diff --git a/src/js/internal-for-testing.ts b/src/js/internal-for-testing.ts index 1c71da3afcc..57668648735 100644 --- a/src/js/internal-for-testing.ts +++ b/src/js/internal-for-testing.ts @@ -17,15 +17,15 @@ export const canonicalizeIP = $newCppFunction("NodeTLS.cpp", "Bun__canonicalizeI export const SQL = $cpp("JSSQLStatement.cpp", "createJSSQLStatementConstructor"); export const patchInternals = { - parse: $newZigFunction("patch.zig", "TestingAPIs.parse", 1), - apply: $newZigFunction("patch.zig", "TestingAPIs.apply", 2), - makeDiff: $newZigFunction("patch.zig", "TestingAPIs.makeDiff", 2), + parse: $newRustFunction("patch.rust", "TestingAPIs.parse", 1), + apply: $newRustFunction("patch.rust", "TestingAPIs.apply", 2), + makeDiff: $newRustFunction("patch.rust", "TestingAPIs.makeDiff", 2), }; export const internalSourceMap = { - fromVLQ: $newZigFunction("sourcemap/InternalSourceMap.zig", "TestingAPIs.fromVLQ", 1) as (vlq: string) => Uint8Array, - toVLQ: $newZigFunction("sourcemap/InternalSourceMap.zig", "TestingAPIs.toVLQ", 1) as (blob: Uint8Array) => string, - find: $newZigFunction("sourcemap/InternalSourceMap.zig", "TestingAPIs.find", 3) as ( + fromVLQ: $newRustFunction("sourcemap/InternalSourceMap.rust", "TestingAPIs.fromVLQ", 1) as (vlq: string) => Uint8Array, + toVLQ: $newRustFunction("sourcemap/InternalSourceMap.rust", "TestingAPIs.toVLQ", 1) as (blob: Uint8Array) => string, + find: $newRustFunction("sourcemap/InternalSourceMap.rust", "TestingAPIs.find", 3) as ( blob: Uint8Array, line: number, col: number, @@ -38,14 +38,14 @@ export const internalSourceMap = { } | null, }; -const shellLex = $newZigFunction("shell.zig", "TestingAPIs.shellLex", 2); -const shellParse = $newZigFunction("shell.zig", "TestingAPIs.shellParse", 2); +const shellLex = $newRustFunction("shell.rust", "TestingAPIs.shellLex", 2); +const shellParse = $newRustFunction("shell.rust", "TestingAPIs.shellParse", 2); -export const sslCtxLiveCount = $newZigFunction("SecureContext.zig", "jsLiveCount", 0); +export const sslCtxLiveCount = $newRustFunction("SecureContext.rust", "jsLiveCount", 0); -export const escapeRegExp = $newZigFunction("escapeRegExp.zig", "jsEscapeRegExp", 1); -export const escapeRegExpForPackageNameMatching = $newZigFunction( - "escapeRegExp.zig", +export const escapeRegExp = $newRustFunction("escapeRegExp.rust", "jsEscapeRegExp", 1); +export const escapeRegExpForPackageNameMatching = $newRustFunction( + "escapeRegExp.rust", "jsEscapeRegExpForPackageNameMatching", 1, ); @@ -61,18 +61,18 @@ export const shellInternals = { * const isDisabled = builtinDisabled("cp") * ``` */ - builtinDisabled: $newZigFunction("shell.zig", "TestingAPIs.disabledOnThisPlatform", 1), + builtinDisabled: $newRustFunction("shell.rust", "TestingAPIs.disabledOnThisPlatform", 1), }; export const subprocessInternals = { - injectStdioReadError: $newZigFunction("subprocess.zig", "TestingAPIs.injectStdioReadError", 2) as ( + injectStdioReadError: $newRustFunction("subprocess.rust", "TestingAPIs.injectStdioReadError", 2) as ( subprocess: import("bun").Subprocess, kind: "stdout" | "stderr", ) => boolean, }; export const iniInternals = { - parse: $newZigFunction("ini.zig", "IniTestingAPIs.parse", 1), + parse: $newRustFunction("ini.rust", "IniTestingAPIs.parse", 1), // loadNpmrc: ( // src: string, // env?: Record, @@ -81,22 +81,22 @@ export const iniInternals = { // default_registry_token: string; // default_registry_username: string; // default_registry_password: string; - // } => $newZigFunction("ini.zig", "IniTestingAPIs.loadNpmrcFromJS", 2)(src, env), - loadNpmrc: $newZigFunction("ini.zig", "IniTestingAPIs.loadNpmrcFromJS", 2), + // } => $newRustFunction("ini.rust", "IniTestingAPIs.loadNpmrcFromJS", 2)(src, env), + loadNpmrc: $newRustFunction("ini.rust", "IniTestingAPIs.loadNpmrcFromJS", 2), }; export const cssInternals = { - minifyTestWithOptions: $newZigFunction("css_internals.zig", "minifyTestWithOptions", 3), - minifyErrorTestWithOptions: $newZigFunction("css_internals.zig", "minifyErrorTestWithOptions", 3), - testWithOptions: $newZigFunction("css_internals.zig", "testWithOptions", 3), - prefixTestWithOptions: $newZigFunction("css_internals.zig", "prefixTestWithOptions", 3), - minifyTest: $newZigFunction("css_internals.zig", "minifyTest", 3), - prefixTest: $newZigFunction("css_internals.zig", "prefixTest", 3), - _test: $newZigFunction("css_internals.zig", "_test", 3), - attrTest: $newZigFunction("css_internals.zig", "attrTest", 3), + minifyTestWithOptions: $newRustFunction("css_internals.rust", "minifyTestWithOptions", 3), + minifyErrorTestWithOptions: $newRustFunction("css_internals.rust", "minifyErrorTestWithOptions", 3), + testWithOptions: $newRustFunction("css_internals.rust", "testWithOptions", 3), + prefixTestWithOptions: $newRustFunction("css_internals.rust", "prefixTestWithOptions", 3), + minifyTest: $newRustFunction("css_internals.rust", "minifyTest", 3), + prefixTest: $newRustFunction("css_internals.rust", "prefixTest", 3), + _test: $newRustFunction("css_internals.rust", "_test", 3), + attrTest: $newRustFunction("css_internals.rust", "attrTest", 3), }; -export const crash_handler = $zig("crash_handler.zig", "js_bindings.generate") as { +export const crash_handler = $rust("crash_handler.rust", "js_bindings.generate") as { getMachOImageZeroOffset: () => number; segfault: () => void; panic: () => void; @@ -105,12 +105,12 @@ export const crash_handler = $zig("crash_handler.zig", "js_bindings.generate") a raiseIgnoringPanicHandler: () => void; }; -export const upgrade_test_helpers = $zig("upgrade_command.zig", "upgrade_js_bindings.generate") as { +export const upgrade_test_helpers = $rust("upgrade_command.rust", "upgrade_js_bindings.generate") as { openTempDirWithoutSharingDelete: () => void; closeTempDirHandle: () => void; }; -export const install_test_helpers = $zig("install_binding.zig", "bun_install_js_bindings.generate") as { +export const install_test_helpers = $rust("install_binding.rust", "bun_install_js_bindings.generate") as { /** * Returns the lockfile at the given path as an object. */ @@ -126,25 +126,25 @@ export const nativeFrameForTesting: (callback: () => void) => void = $cpp( // Linux-only. Create an in-memory file descriptor with a preset size. // You should call fs.closeSync(fd) when you're done with it. -export const memfd_create: (size: number) => number = $newZigFunction( - "node_fs_binding.zig", +export const memfd_create: (size: number) => number = $newRustFunction( + "node_fs_binding.rust", "createMemfdForTesting", 1, ); -export const createStatsForIno: (ino: bigint, big: boolean) => any = $newZigFunction( - "Stat.zig", +export const createStatsForIno: (ino: bigint, big: boolean) => any = $newRustFunction( + "Stat.rust", "createStatsForIno", 2, ); -export const setSyntheticAllocationLimitForTesting: (limit: number) => number = $newZigFunction( - "virtual_machine_exports.zig", +export const setSyntheticAllocationLimitForTesting: (limit: number) => number = $newRustFunction( + "virtual_machine_exports.rust", "Bun__setSyntheticAllocationLimitForTesting", 1, ); -export const npm_manifest_test_helpers = $zig("npm.zig", "PackageManifest.bindings.generate") as { +export const npm_manifest_test_helpers = $rust("npm.rust", "PackageManifest.bindings.generate") as { /** * Returns the parsed manifest file. Currently only returns an array of available versions. */ @@ -153,28 +153,28 @@ export const npm_manifest_test_helpers = $zig("npm.zig", "PackageManifest.bindin // Like npm-package-arg, sort of https://www.npmjs.com/package/npm-package-arg export type Dependency = any; -export const npa: (name: string) => Dependency = $newZigFunction("dependency.zig", "fromJS", 1); +export const npa: (name: string) => Dependency = $newRustFunction("dependency.rust", "fromJS", 1); export const npmTag: ( name: string, ) => undefined | "npm" | "dist_tag" | "tarball" | "folder" | "symlink" | "workspace" | "git" | "github" = - $newZigFunction("dependency.zig", "Version.Tag.inferFromJS", 1); + $newRustFunction("dependency.rust", "Version.Tag.inferFromJS", 1); -export const readTarball: (tarball: string) => any = $newZigFunction("pack_command.zig", "bindings.jsReadTarball", 1); +export const readTarball: (tarball: string) => any = $newRustFunction("pack_command.rust", "bindings.jsReadTarball", 1); -export const isArchitectureMatch: (architecture: string[]) => boolean = $newZigFunction( - "npm.zig", +export const isArchitectureMatch: (architecture: string[]) => boolean = $newRustFunction( + "npm.rust", "Architecture.jsFunctionArchitectureIsMatch", 1, ); -export const isOperatingSystemMatch: (operatingSystem: string[]) => boolean = $newZigFunction( - "npm.zig", +export const isOperatingSystemMatch: (operatingSystem: string[]) => boolean = $newRustFunction( + "npm.rust", "OperatingSystem.jsFunctionOperatingSystemIsMatch", 1, ); -export const createSocketPair: () => [number, number] = $newZigFunction("runtime/socket/socket.zig", "jsCreateSocketPair", 0); +export const createSocketPair: () => [number, number] = $newRustFunction("runtime/socket/socket.rust", "jsCreateSocketPair", 0); export const isModuleResolveFilenameSlowPathEnabled: () => boolean = $newCppFunction( "NodeModuleModule.cpp", @@ -182,14 +182,14 @@ export const isModuleResolveFilenameSlowPathEnabled: () => boolean = $newCppFunc 0, ); -export const frameworkRouterInternals = $zig("FrameworkRouter.zig", "JSFrameworkRouter.getBindings") as { +export const frameworkRouterInternals = $rust("FrameworkRouter.rust", "JSFrameworkRouter.getBindings") as { parseRoutePattern: (style: string, pattern: string) => null | { kind: string; pattern: string }; FrameworkRouter: { new (opts: any): any; }; }; -export const bindgen = $zig("bindgen_test.zig", "getBindgenTestFunctions") as { +export const bindgen = $rust("bindgen_test.rust", "getBindgenTestFunctions") as { add: (a: any, b: any) => number; requiredAndOptionalArg: (a: any, b?: any, c?: any, d?: any) => number; }; @@ -212,7 +212,7 @@ export const arrayBufferViewHasBuffer = $newCppFunction( ); export const timerInternals = { - timerClockMs: $newZigFunction("runtime/timer/Timer.zig", "internal_bindings.timerClockMs", 0), + timerClockMs: $newRustFunction("runtime/timer/Timer.rust", "internal_bindings.timerClockMs", 0), }; export const decodeURIComponentSIMD = $newCppFunction( @@ -222,7 +222,7 @@ export const decodeURIComponentSIMD = $newCppFunction( ); export const getDevServerDeinitCount = $bindgenFn("DevServer.bind.ts", "getDeinitCountForTesting"); -export const getCounters = $newZigFunction("Counters.zig", "createCountersObject", 0); +export const getCounters = $newRustFunction("Counters.rust", "createCountersObject", 0); export const hasNonReifiedStatic = $newCppFunction("InternalForTesting.cpp", "jsFunction_hasReifiedStatic", 1); interface setSocketOptionsFn { @@ -230,7 +230,7 @@ interface setSocketOptionsFn { (socket: Bun.Socket, recvBuffer: 2, size: number): void; } -export const setSocketOptions: setSocketOptionsFn = $newZigFunction("runtime/socket/socket.zig", "jsSetSocketOptions", 3); +export const setSocketOptions: setSocketOptionsFn = $newRustFunction("runtime/socket/socket.rust", "jsSetSocketOptions", 3); type SerializationContext = "worker" | "window" | "postMessage" | "default"; export const structuredCloneAdvanced: ( value: any, @@ -249,21 +249,21 @@ export const BunString_toThreadSafeRefCountDelta: () => number = $newCppFunction ); export const getEventLoopStats: () => { activeTasks: number; concurrentRef: number; numPolls: number } = - $newZigFunction("event_loop.zig", "getActiveTasks", 0); + $newRustFunction("event_loop.rust", "getActiveTasks", 0); export const hostedGitInfo = { - parseUrl: $newZigFunction("hosted_git_info.zig", "TestingAPIs.jsParseUrl", 1), - fromUrl: $newZigFunction("hosted_git_info.zig", "TestingAPIs.jsFromUrl", 1), + parseUrl: $newRustFunction("hosted_git_info.rust", "TestingAPIs.jsParseUrl", 1), + fromUrl: $newRustFunction("hosted_git_info.rust", "TestingAPIs.jsFromUrl", 1), }; -export const translateUVErrorToE: (code: number) => string | undefined = $newZigFunction( - "sys.zig", +export const translateUVErrorToE: (code: number) => string | undefined = $newRustFunction( + "sys.rust", "TestingAPIs.translateUVErrorToE", 1, ); -export const sysErrorNameFromLibuv: (errno: number) => string | undefined = $newZigFunction( - "sys/Error.zig", +export const sysErrorNameFromLibuv: (errno: number) => string | undefined = $newRustFunction( + "sys/Error.rust", "TestingAPIs.sysErrorNameFromLibuv", 1, ); @@ -274,7 +274,7 @@ export const sigactionLayout: () => installed: { handler: number; flags: number }; readback: { handler: number; flags: number }; sizeof: number; - } = $newZigFunction("sys.zig", "TestingAPIs.sigactionLayout", 0); + } = $newRustFunction("sys.rust", "TestingAPIs.sigactionLayout", 0); export const stringsInternals = { /** @@ -283,25 +283,25 @@ export const stringsInternals = { * path is otherwise only reachable from Windows `bun build --compile` * metadata, so this binding lets us exercise it on all platforms. */ - toUTF16AllocSentinel: $newZigFunction("string/immutable/unicode.zig", "TestingAPIs.toUTF16AllocSentinel", 1) as ( + toUTF16AllocSentinel: $newRustFunction("string/immutable/unicode.rust", "TestingAPIs.toUTF16AllocSentinel", 1) as ( bytes: Uint8Array, ) => string, }; export const fetchH2Internals = { - liveCounts: $newZigFunction("http/H2Client.zig", "TestingAPIs.liveCounts", 0) as () => { + liveCounts: $newRustFunction("http/H2Client.rust", "TestingAPIs.liveCounts", 0) as () => { sessions: number; streams: number; }, }; export const fetchH3Internals = { - liveCounts: $newZigFunction("http/H3Client.zig", "TestingAPIs.quicLiveCounts", 0) as () => { + liveCounts: $newRustFunction("http/H3Client.rust", "TestingAPIs.quicLiveCounts", 0) as () => { sessions: number; streams: number; }, }; export const fileSinkInternals = { - liveCount: $newZigFunction("runtime/webcore/FileSink.zig", "TestingAPIs.fileSinkLiveCount", 0) as () => number, + liveCount: $newRustFunction("runtime/webcore/FileSink.rust", "TestingAPIs.fileSinkLiveCount", 0) as () => number, }; diff --git a/src/js/internal/assert/myers_diff.ts b/src/js/internal/assert/myers_diff.ts index f47b61c41a1..a5086b0589a 100644 --- a/src/js/internal/assert/myers_diff.ts +++ b/src/js/internal/assert/myers_diff.ts @@ -27,7 +27,7 @@ declare namespace Internal { const kNopLinesToCollapse = 5; -const { myersDiff } = $zig("node_assert_binding.zig", "generate") as typeof Internal; +const { myersDiff } = $rust("node_assert_binding.rust", "generate") as typeof Internal; function printSimpleMyersDiff(diff: Diff[]) { let message = ""; diff --git a/src/js/internal/cluster/RoundRobinHandle.ts b/src/js/internal/cluster/RoundRobinHandle.ts index 36c39a87b08..0a0ac08b30c 100644 --- a/src/js/internal/cluster/RoundRobinHandle.ts +++ b/src/js/internal/cluster/RoundRobinHandle.ts @@ -3,7 +3,7 @@ const { kHandle } = require("internal/shared"); let net; -const sendHelper = $newZigFunction("node_cluster_binding.zig", "sendHelperPrimary", 4); +const sendHelper = $newRustFunction("node_cluster_binding.rust", "sendHelperPrimary", 4); const ArrayIsArray = Array.isArray; diff --git a/src/js/internal/cluster/child.ts b/src/js/internal/cluster/child.ts index 4d2c8897cdf..00c93c10c3c 100644 --- a/src/js/internal/cluster/child.ts +++ b/src/js/internal/cluster/child.ts @@ -2,8 +2,8 @@ const EventEmitter = require("node:events"); const Worker = require("internal/cluster/Worker"); const path = require("node:path"); -const sendHelper = $newZigFunction("node_cluster_binding.zig", "sendHelperChild", 3); -const onInternalMessage = $newZigFunction("node_cluster_binding.zig", "onInternalMessageChild", 2); +const sendHelper = $newRustFunction("node_cluster_binding.rust", "sendHelperChild", 3); +const onInternalMessage = $newRustFunction("node_cluster_binding.rust", "onInternalMessageChild", 2); const FunctionPrototype = Function.prototype; const ArrayPrototypeJoin = Array.prototype.join; @@ -36,7 +36,7 @@ cluster._setupWorker = function () { // make sure the process.once("disconnect") doesn't count as a ref // before calling, check if the channel is refd. if it isn't, then unref it after calling process.once(); - $newZigFunction("node_cluster_binding.zig", "channelIgnoreOneDisconnectEventListener", 0)(); + $newRustFunction("node_cluster_binding.rust", "channelIgnoreOneDisconnectEventListener", 0)(); process.once("disconnect", () => { process.channel = null; worker.emit("disconnect"); diff --git a/src/js/internal/cluster/primary.ts b/src/js/internal/cluster/primary.ts index 9a046c8a875..3f1094f55a0 100644 --- a/src/js/internal/cluster/primary.ts +++ b/src/js/internal/cluster/primary.ts @@ -4,8 +4,8 @@ const RoundRobinHandle = require("internal/cluster/RoundRobinHandle"); const path = require("node:path"); const { throwNotImplemented, kHandle } = require("internal/shared"); -const sendHelper = $newZigFunction("node_cluster_binding.zig", "sendHelperPrimary", 4); -const onInternalMessage = $newZigFunction("node_cluster_binding.zig", "onInternalMessagePrimary", 3); +const sendHelper = $newRustFunction("node_cluster_binding.rust", "sendHelperPrimary", 4); +const onInternalMessage = $newRustFunction("node_cluster_binding.rust", "onInternalMessagePrimary", 3); let child_process; diff --git a/src/js/internal/http.ts b/src/js/internal/http.ts index ecd92d4c4f0..397a8f61063 100644 --- a/src/js/internal/http.ts +++ b/src/js/internal/http.ts @@ -350,8 +350,8 @@ function emitErrorNt(msg, err, callback) { msg.emit("error", err); } } -const setMaxHTTPHeaderSize = $newZigFunction("node_http_binding.zig", "setMaxHTTPHeaderSize", 1); -const getMaxHTTPHeaderSize = $newZigFunction("node_http_binding.zig", "getMaxHTTPHeaderSize", 0); +const setMaxHTTPHeaderSize = $newRustFunction("node_http_binding.rust", "setMaxHTTPHeaderSize", 1); +const getMaxHTTPHeaderSize = $newRustFunction("node_http_binding.rust", "getMaxHTTPHeaderSize", 0); const kOutHeaders = Symbol("kOutHeaders"); function ipToInt(ip) { diff --git a/src/js/internal/sql/mysql.ts b/src/js/internal/sql/mysql.ts index aa66d74655e..cfb62464060 100644 --- a/src/js/internal/sql/mysql.ts +++ b/src/js/internal/sql/mysql.ts @@ -13,7 +13,7 @@ const { createConnection: createMySQLConnection, createQuery: createMySQLQuery, init: initMySQL, -} = $zig("mysql.zig", "createBinding") as MySQLDotZig; +} = $rust("mysql.rust", "createBinding") as MySQLDotRust; function wrapError(error: Error | MySQLErrorOptions) { if (Error.isError(error)) { @@ -41,7 +41,7 @@ initMySQL( } if (!is_last) { - // The Zig side swaps the pending value out for js_undefined before + // The Rust side swaps the pending value out for js_undefined before // invoking this callback; re-prime so the follow-up result set lands in // a fresh array. query[_handle].setPendingValue(new SQLResultArray()); @@ -74,7 +74,7 @@ initMySQL( }, ); -export interface MySQLDotZig { +export interface MySQLDotRust { init: ( onResolveQuery: ( query: Query, @@ -96,13 +96,13 @@ export interface MySQLDotZig { tls: Bun.TLSOptions | boolean | null | Bun.BunFile, // boolean true => empty TLSOptions object `{}`, boolean false or null => nothing query: string, path: string, - onConnected: (err: Error | null, connection: $ZigGeneratedClasses.MySQLConnection) => void, - onDisconnected: (err: Error | null, connection: $ZigGeneratedClasses.MySQLConnection) => void, + onConnected: (err: Error | null, connection: $RustGeneratedClasses.MySQLConnection) => void, + onDisconnected: (err: Error | null, connection: $RustGeneratedClasses.MySQLConnection) => void, idleTimeout: number, connectionTimeout: number, maxLifetime: number, useUnnamedPreparedStatements: boolean, - ) => $ZigGeneratedClasses.MySQLConnection; + ) => $RustGeneratedClasses.MySQLConnection; createQuery: ( sql: string, values: unknown[], @@ -110,7 +110,7 @@ export interface MySQLDotZig { columns: string[] | undefined, bigint: boolean, simple: boolean, - ) => $ZigGeneratedClasses.MySQLQuery; + ) => $RustGeneratedClasses.MySQLQuery; } const enum SQLCommand { @@ -235,9 +235,9 @@ function closeNT(onClose: (err: Error) => void, err: Error | null) { class PooledMySQLConnection { private static async createConnection( options: Bun.SQL.__internal.DefinedPostgresOrMySQLOptions, - onConnected: (err: Error | null, connection: $ZigGeneratedClasses.MySQLConnection) => void, + onConnected: (err: Error | null, connection: $RustGeneratedClasses.MySQLConnection) => void, onClose: (err: Error | null) => void, - ): Promise<$ZigGeneratedClasses.MySQLConnection | null> { + ): Promise<$RustGeneratedClasses.MySQLConnection | null> { const { hostname, port, @@ -292,7 +292,7 @@ class PooledMySQLConnection { } adapter: MySQLAdapter; - connection: $ZigGeneratedClasses.MySQLConnection | null = null; + connection: $RustGeneratedClasses.MySQLConnection | null = null; state: PooledConnectionState = PooledConnectionState.pending; storedError: Error | null = null; queries: Set<(err: Error) => void> = new Set(); @@ -441,7 +441,7 @@ class PooledMySQLConnection { class MySQLAdapter implements - DatabaseAdapter + DatabaseAdapter { public readonly connectionInfo: Bun.SQL.__internal.DefinedPostgresOrMySQLOptions; diff --git a/src/js/internal/sql/postgres.ts b/src/js/internal/sql/postgres.ts index efc3499b01d..5c290081c7c 100644 --- a/src/js/internal/sql/postgres.ts +++ b/src/js/internal/sql/postgres.ts @@ -25,7 +25,7 @@ const { createConnection: createPostgresConnection, createQuery: createPostgresQuery, init: initPostgres, -} = $zig("postgres.zig", "createBinding") as PostgresDotZig; +} = $rust("postgres.rust", "createBinding") as PostgresDotRust; const cmds = ["", "INSERT", "DELETE", "UPDATE", "MERGE", "SELECT", "MOVE", "FETCH", "COPY"]; @@ -294,7 +294,7 @@ initPostgres( }, ); -export interface PostgresDotZig { +export interface PostgresDotRust { init: ( onResolveQuery: ( query: Query, @@ -316,13 +316,13 @@ export interface PostgresDotZig { tls: Bun.TLSOptions | boolean | null | Bun.BunFile, // boolean true => empty TLSOptions object `{}`, boolean false or null => nothing query: string, path: string, - onConnected: (err: Error | null, connection: $ZigGeneratedClasses.PostgresSQLConnection) => void, - onDisconnected: (err: Error | null, connection: $ZigGeneratedClasses.PostgresSQLConnection) => void, + onConnected: (err: Error | null, connection: $RustGeneratedClasses.PostgresSQLConnection) => void, + onDisconnected: (err: Error | null, connection: $RustGeneratedClasses.PostgresSQLConnection) => void, idleTimeout: number, connectionTimeout: number, maxLifetime: number, useUnnamedPreparedStatements: boolean, - ) => $ZigGeneratedClasses.PostgresSQLConnection; + ) => $RustGeneratedClasses.PostgresSQLConnection; createQuery: ( sql: string, values: unknown[], @@ -330,7 +330,7 @@ export interface PostgresDotZig { columns: string[] | undefined, bigint: boolean, simple: boolean, - ) => $ZigGeneratedClasses.PostgresSQLQuery; + ) => $RustGeneratedClasses.PostgresSQLQuery; } const enum SQLCommand { @@ -451,9 +451,9 @@ function onQueryFinish(this: PooledPostgresConnection, onClose: (err: Error) => class PooledPostgresConnection { private static async createConnection( options: Bun.SQL.__internal.DefinedPostgresOrMySQLOptions, - onConnected: (err: Error | null, connection: $ZigGeneratedClasses.PostgresSQLConnection) => void, + onConnected: (err: Error | null, connection: $RustGeneratedClasses.PostgresSQLConnection) => void, onClose: (err: Error | null) => void, - ): Promise<$ZigGeneratedClasses.PostgresSQLConnection | null> { + ): Promise<$RustGeneratedClasses.PostgresSQLConnection | null> { const { hostname, port, @@ -508,7 +508,7 @@ class PooledPostgresConnection { } adapter: PostgresAdapter; - connection: $ZigGeneratedClasses.PostgresSQLConnection | null = null; + connection: $RustGeneratedClasses.PostgresSQLConnection | null = null; state: PooledConnectionState = PooledConnectionState.pending; storedError: Error | null = null; queries: Set<(err: Error) => void> = new Set(); @@ -660,8 +660,8 @@ class PostgresAdapter implements DatabaseAdapter< PooledPostgresConnection, - $ZigGeneratedClasses.PostgresSQLConnection, - $ZigGeneratedClasses.PostgresSQLQuery + $RustGeneratedClasses.PostgresSQLConnection, + $RustGeneratedClasses.PostgresSQLQuery > { public readonly connectionInfo: Bun.SQL.__internal.DefinedPostgresOrMySQLOptions; diff --git a/src/js/internal/util/inspect.js b/src/js/internal/util/inspect.js index 52ad43eae78..07ebb55fe8b 100644 --- a/src/js/internal/util/inspect.js +++ b/src/js/internal/util/inspect.js @@ -143,8 +143,8 @@ const ONLY_ENUMERABLE = 2; * * @type {(value: string) => string[] | undefined} */ -const extractedSplitNewLinesFastPathStringsOnly = $newZigFunction( - "node_util_binding.zig", +const extractedSplitNewLinesFastPathStringsOnly = $newRustFunction( + "node_util_binding.rust", "extractedSplitNewLinesFastPathStringsOnly", 1, ); @@ -2644,7 +2644,7 @@ function formatWithOptionsInternal(inspectOptions, args) { return str; } const stripANSI = Bun.stripANSI; -const internalGetStringWidth = $newZigFunction("string.zig", "String.jsGetStringWidth", 1); +const internalGetStringWidth = $newRustFunction("string.rust", "String.jsGetStringWidth", 1); /** * Returns the number of columns required to display the given string. */ diff --git a/src/js/internal/webstreams_adapters.ts b/src/js/internal/webstreams_adapters.ts index 86bc91551f7..c63246433bc 100644 --- a/src/js/internal/webstreams_adapters.ts +++ b/src/js/internal/webstreams_adapters.ts @@ -17,7 +17,7 @@ const { kEmptyObject } = require("internal/shared"); const { validateBoolean, validateObject } = require("internal/validators"); const finished = require("internal/streams/end-of-stream"); -const normalizeEncoding = $newZigFunction("node_util_binding.zig", "normalizeEncoding", 1); +const normalizeEncoding = $newRustFunction("node_util_binding.rust", "normalizeEncoding", 1); const ArrayPrototypeFilter = Array.prototype.filter; const ArrayPrototypeMap = Array.prototype.map; diff --git a/src/js/node/_http2_upgrade.ts b/src/js/node/_http2_upgrade.ts index 479aee1ebf2..74203dff61b 100644 --- a/src/js/node/_http2_upgrade.ts +++ b/src/js/node/_http2_upgrade.ts @@ -1,5 +1,5 @@ const { Duplex } = require("node:stream"); -const upgradeDuplexToTLS = $newZigFunction("runtime/socket/socket.zig", "jsUpgradeDuplexToTLS", 2); +const upgradeDuplexToTLS = $newRustFunction("runtime/socket/socket.rust", "jsUpgradeDuplexToTLS", 2); interface NativeHandle { resume(): void; @@ -128,7 +128,7 @@ function tlsSocketFinal(this: TLSProxySocket, callback: () => void) { } // --------------------------------------------------------------------------- -// Socket callbacks — called by Zig with `this` = native handle (not useful). +// Socket callbacks — called by Rust with `this` = native handle (not useful). // All are bound to tlsSocket so `this` inside each = tlsSocket. // --------------------------------------------------------------------------- @@ -283,14 +283,14 @@ function noop() {} // targets the H2 connectionListener instead of a generic secureConnection event. // // Data flow after upgrade: -// rawSocket (TCP) → upgradeDuplexToTLS (Zig TLS layer) → socket callbacks +// rawSocket (TCP) → upgradeDuplexToTLS (Rust TLS layer) → socket callbacks // → tlsSocket.push() → H2 session reads -// H2 session writes → tlsSocket._write() → handle.$write() → Zig TLS layer → rawSocket +// H2 session writes → tlsSocket._write() → handle.$write() → Rust TLS layer → rawSocket // // CRITICAL: We do NOT set tlsSocket._handle to the native TLS handle. // If we did, the H2FrameParser constructor would detect it as a JSTLSSocket // and call attachNativeCallback(), which intercepts all decrypted data at the -// Zig level, completely bypassing our JS data callback and Duplex.push() path. +// Rust level, completely bypassing our JS data callback and Duplex.push() path. // Instead, we store the handle in _ctx.nativeHandle so _read/_write/_destroy // can use it, while the H2 session sees _handle as null and uses the JS-level // socket.on("data") → Duplex → parser.read() path for incoming frames. @@ -328,17 +328,17 @@ function upgradeRawSocketToH2( tlsSocket._requestCert = server._requestCert || false; tlsSocket._rejectUnauthorized = server._requestCert ? server._rejectUnauthorized : false; - // socket: callbacks — bind to tlsSocket since Zig calls them with native handle as `this` + // socket: callbacks — bind to tlsSocket since Rust calls them with native handle as `this` let handle: NativeHandle, events: UpgradeContextType["events"]; try { // upgradeDuplexToTLS wraps rawSocket with a TLS layer in server mode (isServer: true). - // The Zig side will: + // The Rust side will: // 1. Read encrypted data from rawSocket via events[0..3] // 2. Decrypt it through the TLS engine (with ALPN negotiation for "h2") // 3. Call our socket callbacks below with the decrypted plaintext // // ALPNProtocols: server.ALPNProtocols is a Buffer in wire format (e.g. - // for ["h2"]). The Zig SSLConfig expects an ArrayBuffer, so we slice the underlying buffer. + // for ["h2"]). The Rust SSLConfig expects an ArrayBuffer, so we slice the underlying buffer. [handle, events] = upgradeDuplexToTLS(rawSocket, { isServer: true, tls: { @@ -373,13 +373,13 @@ function upgradeRawSocketToH2( // Store handle in _ctx (NOT on tlsSocket._handle). // This prevents H2FrameParser from attaching as native callback which would - // intercept data at the Zig level and bypass our Duplex push path. + // intercept data at the Rust level and bypass our Duplex push path. tlsSocket._ctx.nativeHandle = handle; tlsSocket._ctx.events = events; // Wire up the raw TCP socket to feed encrypted data into the TLS layer. // events[0..3] are native event handlers returned by upgradeDuplexToTLS that - // the Zig TLS engine expects to receive data/end/drain/close through. + // the Rust TLS engine expects to receive data/end/drain/close through. rawSocket.on("data", events[0]); rawSocket.on("end", events[1]); rawSocket.on("drain", events[2]); diff --git a/src/js/node/_http_client.ts b/src/js/node/_http_client.ts index 552c5e61438..ef7a71da20d 100644 --- a/src/js/node/_http_client.ts +++ b/src/js/node/_http_client.ts @@ -9,7 +9,7 @@ const { } = require("internal/validators"); // Internal fetch that allows body on GET/HEAD/OPTIONS for Node.js compatibility -const nodeHttpClient = $newZigFunction("fetch.zig", "nodeHttpClient", 2); +const nodeHttpClient = $newRustFunction("fetch.rust", "nodeHttpClient", 2); const { urlToHttpOptions } = require("internal/url"); const { throwOnInvalidTLSArray } = require("internal/tls"); const { validateHeaderName } = require("node:_http_common"); diff --git a/src/js/node/_http_server.ts b/src/js/node/_http_server.ts index c7c54c5582c..5024acbb9bb 100644 --- a/src/js/node/_http_server.ts +++ b/src/js/node/_http_server.ts @@ -57,8 +57,8 @@ const { OutgoingMessage } = require("node:_http_outgoing"); const { kIncomingMessage } = require("node:_http_common"); const kConnectionsCheckingInterval = Symbol("http.server.connectionsCheckingInterval"); -const getBunServerAllClosedPromise = $newZigFunction("node_http_binding.zig", "getBunServerAllClosedPromise", 1); -const sendHelper = $newZigFunction("node_cluster_binding.zig", "sendHelperChild", 3); +const getBunServerAllClosedPromise = $newRustFunction("node_http_binding.rust", "getBunServerAllClosedPromise", 1); +const sendHelper = $newRustFunction("node_cluster_binding.rust", "sendHelperChild", 3); const kServerResponse = Symbol("ServerResponse"); const kRejectNonStandardBodyWrites = Symbol("kRejectNonStandardBodyWrites"); diff --git a/src/js/node/async_hooks.ts b/src/js/node/async_hooks.ts index c333a58322b..1260640f2b6 100644 --- a/src/js/node/async_hooks.ts +++ b/src/js/node/async_hooks.ts @@ -9,7 +9,7 @@ // in the promise reaction) and then just before we call .then, we restore it. // // This means context tracking is *kind-of* manual. If we receive a callback in native code -// - In Zig, call jsValue.withAsyncContextIfNeeded(); which returns another JSValue. Store that and +// - In Rust, call jsValue.withAsyncContextIfNeeded(); which returns another JSValue. Store that and // then run .$call() on it later. // - In C++, call AsyncContextFrame::withAsyncContextIfNeeded(jsValue). Then to call it, // use AsyncContextFrame:: call(...) instead of JSC:: call. diff --git a/src/js/node/child_process.ts b/src/js/node/child_process.ts index 4f6e056aade..be596635362 100644 --- a/src/js/node/child_process.ts +++ b/src/js/node/child_process.ts @@ -604,8 +604,8 @@ function spawnSync(file, args, options) { return result; } -const etimedoutErrorCode = $newZigFunction("node_util_binding.zig", "etimedoutErrorCode", 0); -const enobufsErrorCode = $newZigFunction("node_util_binding.zig", "enobufsErrorCode", 0); +const etimedoutErrorCode = $newRustFunction("node_util_binding.rust", "etimedoutErrorCode", 0); +const enobufsErrorCode = $newRustFunction("node_util_binding.rust", "enobufsErrorCode", 0); /** * Spawns a file as a shell synchronously. @@ -1452,7 +1452,7 @@ class ChildProcess extends EventEmitter { // We still need this send function because return this.#handle.send(message, handle, options, err => { // node does process.nextTick() to emit or call the callback - // we don't need to because the send callback is called on nextTick by ipc.zig + // we don't need to because the send callback is called on nextTick by ipc.rust if (callback) { callback(err); } else if (err) { diff --git a/src/js/node/crypto.ts b/src/js/node/crypto.ts index 8b5edca9cf3..6f2a7247562 100644 --- a/src/js/node/crypto.ts +++ b/src/js/node/crypto.ts @@ -65,9 +65,9 @@ const { getHashes, scrypt, scryptSync, -} = $zig("node_crypto_binding.zig", "createNodeCryptoBindingZig"); +} = $rust("node_crypto_binding.rust", "createNodeCryptoBindingRust"); -const normalizeEncoding = $newZigFunction("node_util_binding.zig", "normalizeEncoding", 1); +const normalizeEncoding = $newRustFunction("node_util_binding.rust", "normalizeEncoding", 1); const { validateString } = require("internal/validators"); @@ -153,7 +153,7 @@ crypto_exports.hash = function hash(algorithm, input, outputEncoding = "hex") { return CryptoHasher.hash(algorithm, input, outputEncoding); }; -// TODO: move this to zig +// TODO: move this to rust function pbkdf2(password, salt, iterations, keylen, digest, callback) { if (typeof digest === "function") { callback = digest; diff --git a/src/js/node/dgram.ts b/src/js/node/dgram.ts index 025ab8770e2..58a9adbda48 100644 --- a/src/js/node/dgram.ts +++ b/src/js/node/dgram.ts @@ -397,7 +397,7 @@ function _connect(port, address, callback) { state.handle.lookup(address, afterDns); } -const connectFn = $newZigFunction("udp_socket.zig", "UDPSocket.jsConnect", 2); +const connectFn = $newRustFunction("udp_socket.rust", "UDPSocket.jsConnect", 2); function doConnect(ex, self, ip, address, port, callback) { const state = self[kStateSymbol]; @@ -427,7 +427,7 @@ function doConnect(ex, self, ip, address, port, callback) { process.nextTick(() => self.emit("connect")); } -const disconnectFn = $newZigFunction("udp_socket.zig", "UDPSocket.jsDisconnect", 0); +const disconnectFn = $newRustFunction("udp_socket.rust", "UDPSocket.jsDisconnect", 0); Socket.prototype.disconnect = function () { const state = this[kStateSymbol]; diff --git a/src/js/node/dns.ts b/src/js/node/dns.ts index 8ca9431013b..a52e6c988cf 100644 --- a/src/js/node/dns.ts +++ b/src/js/node/dns.ts @@ -65,17 +65,17 @@ function setServers(servers) { return setServersOn(servers, dns); } -const getRuntimeDefaultResultOrderOption = $newZigFunction( - "runtime/dns_jsc/dns.zig", +const getRuntimeDefaultResultOrderOption = $newRustFunction( + "runtime/dns_jsc/dns.rust", "Resolver.getRuntimeDefaultResultOrderOption", 0, ); function newResolver(options) { - if (!newResolver.zig) { - newResolver.zig = $newZigFunction("runtime/dns_jsc/dns.zig", "Resolver.newResolver", 1); + if (!newResolver.rust) { + newResolver.rust = $newRustFunction("runtime/dns_jsc/dns.rust", "Resolver.newResolver", 1); } - return newResolver.zig(options); + return newResolver.rust(options); } function defaultResultOrder() { diff --git a/src/js/node/fs.promises.ts b/src/js/node/fs.promises.ts index 6f0a0e2dec8..53b219ffacb 100644 --- a/src/js/node/fs.promises.ts +++ b/src/js/node/fs.promises.ts @@ -1,7 +1,7 @@ // Hardcoded module "node:fs/promises" const types = require("node:util/types"); const EventEmitter = require("node:events"); -const fs = $zig("node_fs_binding.zig", "createBinding") as $ZigGeneratedClasses.NodeJSFS; +const fs = $rust("node_fs_binding.rust", "createBinding") as $RustGeneratedClasses.NodeJSFS; const { glob } = require("internal/fs/glob"); const { validateInteger } = require("internal/validators"); diff --git a/src/js/node/fs.ts b/src/js/node/fs.ts index ef7c8714aa8..80a5e9bf911 100644 --- a/src/js/node/fs.ts +++ b/src/js/node/fs.ts @@ -10,7 +10,7 @@ const kEmptyObject = Object.freeze(Object.create(null)); const isDate = types.isDate; // Private exports -// `fs` points to the return value of `node_fs_binding.zig`'s `createBinding` function. +// `fs` points to the return value of `node_fs_binding.rust`'s `createBinding` function. const { fs } = promises.$data; const constants = $processBindingConstants.fs; @@ -110,7 +110,7 @@ class FSWatcher extends EventEmitter { start() {} } -/** Implemented in `node_fs_stat_watcher.zig` */ +/** Implemented in `node_fs_stat_watcher.rust` */ interface StatWatcherHandle { ref(); unref(); @@ -739,7 +739,7 @@ const realpathSync: typeof import("node:fs").realpathSync = if (typeof options === "string") encoding = options; else encoding = options?.encoding; if (encoding) { - (assertEncodingForWindows ?? $newZigFunction("runtime/node/types.zig", "jsAssertEncodingValid", 1))( + (assertEncodingForWindows ?? $newRustFunction("runtime/node/types.rust", "jsAssertEncodingValid", 1))( encoding, ); } @@ -861,7 +861,7 @@ const realpath: typeof import("node:fs").realpath = if (typeof options === "string") encoding = options; else encoding = options?.encoding; if (encoding) { - (assertEncodingForWindows ?? $newZigFunction("runtime/node/types.zig", "jsAssertEncodingValid", 1))( + (assertEncodingForWindows ?? $newRustFunction("runtime/node/types.rust", "jsAssertEncodingValid", 1))( encoding, ); } diff --git a/src/js/node/http2.ts b/src/js/node/http2.ts index 7922a57523a..f8e55b1964d 100644 --- a/src/js/node/http2.ts +++ b/src/js/node/http2.ts @@ -70,8 +70,8 @@ const ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty; const DatePrototypeToUTCString = Date.prototype.toUTCString; const DatePrototypeGetMilliseconds = Date.prototype.getMilliseconds; -const H2FrameParser = $zig("h2_frame_parser.zig", "H2FrameParserConstructor"); -const _nativeAssertSettings = $newZigFunction("h2_frame_parser.zig", "jsAssertSettings", 1); +const H2FrameParser = $rust("h2_frame_parser.rust", "H2FrameParserConstructor"); +const _nativeAssertSettings = $newRustFunction("h2_frame_parser.rust", "jsAssertSettings", 1); const { upgradeRawSocketToH2 } = require("node:_http2_upgrade"); const kSettingNames = { diff --git a/src/js/node/net.ts b/src/js/node/net.ts index a4c9a777e59..a8595bdb8d2 100644 --- a/src/js/node/net.ts +++ b/src/js/node/net.ts @@ -41,19 +41,19 @@ const MathMax = Math.max; const { UV_ECANCELED, UV_ETIMEDOUT } = process.binding("uv"); const isWindows = process.platform === "win32"; -const getDefaultAutoSelectFamily = $zig("node_net_binding.zig", "getDefaultAutoSelectFamily"); -const setDefaultAutoSelectFamily = $zig("node_net_binding.zig", "setDefaultAutoSelectFamily"); -const getDefaultAutoSelectFamilyAttemptTimeout = $zig("node_net_binding.zig", "getDefaultAutoSelectFamilyAttemptTimeout"); // prettier-ignore -const setDefaultAutoSelectFamilyAttemptTimeout = $zig("node_net_binding.zig", "setDefaultAutoSelectFamilyAttemptTimeout"); // prettier-ignore -const SocketAddress = $zig("node_net_binding.zig", "SocketAddress"); -const BlockList = $zig("node_net_binding.zig", "BlockList"); -const newDetachedSocket = $newZigFunction("node_net_binding.zig", "newDetachedSocket", 1); -const doConnect = $newZigFunction("node_net_binding.zig", "doConnect", 2); - -const addServerName = $newZigFunction("Listener.zig", "jsAddServerName", 3); -const upgradeDuplexToTLS = $newZigFunction("runtime/socket/socket.zig", "jsUpgradeDuplexToTLS", 2); -const isNamedPipeSocket = $newZigFunction("runtime/socket/socket.zig", "jsIsNamedPipeSocket", 1); -const getBufferedAmount = $newZigFunction("runtime/socket/socket.zig", "jsGetBufferedAmount", 1); +const getDefaultAutoSelectFamily = $rust("node_net_binding.rust", "getDefaultAutoSelectFamily"); +const setDefaultAutoSelectFamily = $rust("node_net_binding.rust", "setDefaultAutoSelectFamily"); +const getDefaultAutoSelectFamilyAttemptTimeout = $rust("node_net_binding.rust", "getDefaultAutoSelectFamilyAttemptTimeout"); // prettier-ignore +const setDefaultAutoSelectFamilyAttemptTimeout = $rust("node_net_binding.rust", "setDefaultAutoSelectFamilyAttemptTimeout"); // prettier-ignore +const SocketAddress = $rust("node_net_binding.rust", "SocketAddress"); +const BlockList = $rust("node_net_binding.rust", "BlockList"); +const newDetachedSocket = $newRustFunction("node_net_binding.rust", "newDetachedSocket", 1); +const doConnect = $newRustFunction("node_net_binding.rust", "doConnect", 2); + +const addServerName = $newRustFunction("Listener.rust", "jsAddServerName", 3); +const upgradeDuplexToTLS = $newRustFunction("runtime/socket/socket.rust", "jsUpgradeDuplexToTLS", 2); +const isNamedPipeSocket = $newRustFunction("runtime/socket/socket.rust", "jsIsNamedPipeSocket", 1); +const getBufferedAmount = $newRustFunction("runtime/socket/socket.rust", "jsGetBufferedAmount", 1); const bunTlsSymbol = Symbol.for("::buntls::"); const bunSocketServerOptions = Symbol.for("::bunnetserveroptions::"); @@ -2409,7 +2409,7 @@ Server.prototype[kRealListen] = function ( if (contexts) { for (const [name, context] of contexts) { - // tls.ts stores the InternalSecureContext wrapper; the Zig side wants + // tls.ts stores the InternalSecureContext wrapper; the Rust side wants // the native SSL_CTX wrapper at `.context`. addServerName(this._handle, name, context.context ?? context); } diff --git a/src/js/node/os.ts b/src/js/node/os.ts index 9995113e333..fe73e5b71b9 100644 --- a/src/js/node/os.ts +++ b/src/js/node/os.ts @@ -152,7 +152,7 @@ function bound(binding) { }; } -const out = bound($zig("node_os.zig", "createNodeOsBinding")); +const out = bound($rust("node_os.rust", "createNodeOsBinding")); symbolToStringify(out, "arch"); symbolToStringify(out, "availableParallelism"); diff --git a/src/js/node/readline.ts b/src/js/node/readline.ts index 91e71be645b..f6f8ebb7be8 100644 --- a/src/js/node/readline.ts +++ b/src/js/node/readline.ts @@ -41,7 +41,7 @@ const { validateNumber, } = require("internal/validators"); -const internalGetStringWidth = $newZigFunction("string.zig", "String.jsGetStringWidth", 1); +const internalGetStringWidth = $newRustFunction("string.rust", "String.jsGetStringWidth", 1); const PromiseReject = Promise.$reject; diff --git a/src/js/node/tls.ts b/src/js/node/tls.ts index c4ef991ef83..da268173393 100644 --- a/src/js/node/tls.ts +++ b/src/js/node/tls.ts @@ -2,7 +2,7 @@ const { isArrayBufferView, isTypedArray } = require("node:util/types"); const net = require("node:net"); const Duplex = require("internal/streams/duplex"); -const addServerName = $newZigFunction("Listener.zig", "jsAddServerName", 3); +const addServerName = $newRustFunction("Listener.rust", "jsAddServerName", 3); const { throwNotImplemented } = require("internal/shared"); const { throwOnInvalidTLSArray } = require("internal/tls"); const { validateString } = require("internal/validators"); @@ -396,11 +396,11 @@ function checkServerIdentity(hostname, cert) { } // Native SSL_CTX wrapper. `intern()` is WeakGCMap-memoised by config digest -// (the native `SSLContextCache` underneath is shared with every Zig consumer +// (the native `SSLContextCache` underneath is shared with every Rust consumer // — Postgres, Valkey, `Bun.connect`, …), so identical options return the same // native handle and the same `SSL_CTX*`. Replaces the SHA-256/WeakRef cache // that used to live in this file. -const NativeSecureContext = $zig("SecureContext.zig", "js.getConstructor"); +const NativeSecureContext = $rust("SecureContext.rust", "js.getConstructor"); // Node treats any falsy key/cert/ca as "not provided" (test-tls-options- // boolean-check.js exercises false/0/""). The bindgen SSLConfigFile union only @@ -664,7 +664,7 @@ TLSSocket.prototype.getPeerCertificate = function getPeerCertificate(abbreviated }; TLSSocket.prototype.getCertificate = function getCertificate() { - // need to implement certificate on socket.zig + // need to implement certificate on socket.rust const cert = this._handle?.getCertificate?.(); if (cert) { // It's not a peer cert, but the formatting is identical. @@ -735,7 +735,7 @@ function Server(options, secureConnectionListener): void { } if (this._handle) { // Pass the native SSL_CTX wrapper, not the JS InternalSecureContext — - // the Zig side detects it via SecureContext.fromJS and up_refs. + // the Rust side detects it via SecureContext.fromJS and up_refs. addServerName(this._handle, hostname, context.context); } else { if (!contexts) contexts = new Map(); @@ -951,7 +951,7 @@ function cacheBundledRootCertificates(): string[] { bundledRootCertificates ||= getBundledRootCertificates() as string[]; return bundledRootCertificates; } -const getUseSystemCA = $newZigFunction("bun.zig", "getUseSystemCA", 0); +const getUseSystemCA = $newRustFunction("bun.rust", "getUseSystemCA", 0); let defaultCACertificates: string[] | undefined; function cacheDefaultCACertificates() { diff --git a/src/js/node/util.ts b/src/js/node/util.ts index d57c125e9d3..0e51b88a9bd 100644 --- a/src/js/node/util.ts +++ b/src/js/node/util.ts @@ -7,8 +7,8 @@ const { validateString, validateOneOf } = require("internal/validators"); const { MIMEType, MIMEParams } = require("internal/util/mime"); const { deprecate } = require("internal/util/deprecate"); -const internalErrorName = $newZigFunction("node_util_binding.zig", "internalErrorName", 1); -const parseEnv = $newZigFunction("node_util_binding.zig", "parseEnv", 1); +const internalErrorName = $newRustFunction("node_util_binding.rust", "internalErrorName", 1); +const parseEnv = $newRustFunction("node_util_binding.rust", "parseEnv", 1); const NumberIsSafeInteger = Number.isSafeInteger; const ObjectKeys = Object.keys; @@ -25,7 +25,7 @@ function isFunction(value) { const deepEquals = Bun.deepEquals; const isDeepStrictEqual = (a, b) => deepEquals(a, b, true); -const parseArgs = $newZigFunction("parse_args.zig", "parseArgs", 1); +const parseArgs = $newRustFunction("parse_args.rust", "parseArgs", 1); const inspect = utl.inspect; const formatWithOptions = utl.formatWithOptions; diff --git a/src/js/node/worker_threads.ts b/src/js/node/worker_threads.ts index c6d0633dde9..c0ecb238706 100644 --- a/src/js/node/worker_threads.ts +++ b/src/js/node/worker_threads.ts @@ -148,7 +148,7 @@ function fakeParentPort() { }, }); - const postMessage = $newCppFunction("ZigGlobalObject.cpp", "jsFunctionPostMessage", 1); + const postMessage = $newCppFunction("RustGlobalObject.cpp", "jsFunctionPostMessage", 1); Object.defineProperty(fake, "postMessage", { value(...args: [any, any]) { return postMessage.$apply(null, args); diff --git a/src/js/node/zlib.ts b/src/js/node/zlib.ts index 5949e454ced..f34e8a0a30a 100644 --- a/src/js/node/zlib.ts +++ b/src/js/node/zlib.ts @@ -2,10 +2,10 @@ const BufferModule = require("node:buffer"); -const crc32 = $newZigFunction("node_zlib_binding.zig", "crc32", 1); -const NativeZlib = $zig("node_zlib_binding.zig", "NativeZlib"); -const NativeBrotli = $zig("node_zlib_binding.zig", "NativeBrotli"); -const NativeZstd = $zig("node_zlib_binding.zig", "NativeZstd"); +const crc32 = $newRustFunction("node_zlib_binding.rust", "crc32", 1); +const NativeZlib = $rust("node_zlib_binding.rust", "NativeZlib"); +const NativeBrotli = $rust("node_zlib_binding.rust", "NativeBrotli"); +const NativeZstd = $rust("node_zlib_binding.rust", "NativeZstd"); const ObjectKeys = Object.keys; const ArrayPrototypePush = Array.prototype.push; diff --git a/src/js/private.d.ts b/src/js/private.d.ts index 8c7b3e9ed29..aaa5e38ff11 100644 --- a/src/js/private.d.ts +++ b/src/js/private.d.ts @@ -203,7 +203,7 @@ interface JSCommonJSModule { * * Binding files are located in `src/jsc/bindings` * - * @see {@link $zig} for native zig bindings. + * @see {@link $rust} for native rust bindings. * @see `src/codegen/replacements.ts` for the script that performs replacement of this funciton. * * @param filename name of the c++ file containing the function. Do not pass a path. @@ -214,10 +214,10 @@ interface JSCommonJSModule { */ declare function $cpp(filename: NativeFilenameCPP, symbol: string): T; /** - * Call a native zig binding function, getting whatever it returns. + * Call a native rust binding function, getting whatever it returns. * * This is more like a macro; it is replaced with a WebKit intrisic during - * codegen. Passing a template parameter will break codegen. Prefer `$zig(...) + * codegen. Passing a template parameter will break codegen. Prefer `$rust(...) * as Foo` instead. * * Binding files are located in `src/jsc/bindings` @@ -225,25 +225,25 @@ declare function $cpp(filename: NativeFilenameCPP, symbol: string): T; * @see {@link $cpp} for native c++ bindings. * @see `src/codegen/replacements.ts` for the script that performs replacement of this funciton. * - * @param filename name of the zig file containing the function. Do not pass a path. + * @param filename name of the rust file containing the function. Do not pass a path. * @param symbol The name of the binding function. Use `dot.notation` to access * member symbols. * * @returns whatever the binding function returns. */ -declare function $zig(filename: NativeFilenameZig, symbol: string): T; +declare function $rust(filename: NativeFilenameRust, symbol: string): T; declare function $newCppFunction any>( filename: NativeFilenameCPP, symbol: string, argCount: number, ): T; -declare function $newZigFunction any>( - filename: NativeFilenameZig, +declare function $newRustFunction any>( + filename: NativeFilenameRust, symbol: string, argCount: number, ): T; /** - * Retrieves a handle to a function defined in Zig or C++, defined in a + * Retrieves a handle to a function defined in Rust or C++, defined in a * `.bind.ts` file. For more information on how to define bindgen functions, see * [bindgen's documentation](https://bun.com/docs/project/bindgen). * @param filename - The basename of the `.bind.ts` file. diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig index 37a4766c921..d93a2fcfbdd 100644 --- a/src/js_parser/js_parser.zig +++ b/src/js_parser/js_parser.zig @@ -663,46 +663,46 @@ pub fn NewBatcher(comptime Type: type) type { }; } -pub const ASTMemoryAllocator = @import("./ast/ASTMemoryAllocator.zig"); -pub const Ast = @import("./ast/Ast.zig"); -pub const Binding = @import("./ast/Binding.zig"); +pub const ASTMemoryAllocator = @import("./ast/ASTMemoryAllocator.rust"); +pub const Ast = @import("./ast/Ast.rust"); +pub const Binding = @import("./ast/Binding.rust"); pub const BindingNodeIndex = Binding; -pub const BundledAst = @import("./ast/BundledAst.zig"); -pub const E = @import("./ast/E.zig"); -pub const Expr = @import("./ast/Expr.zig"); +pub const BundledAst = @import("./ast/BundledAst.rust"); +pub const E = @import("./ast/E.rust"); +pub const Expr = @import("./ast/Expr.rust"); pub const ExprNodeIndex = Expr; -pub const G = @import("./ast/G.zig"); -pub const Macro = @import("../js_parser_jsc/Macro.zig"); -pub const Op = @import("./ast/Op.zig"); -pub const S = @import("./ast/S.zig"); -pub const Scope = @import("./ast/Scope.zig"); -pub const ServerComponentBoundary = @import("./ast/ServerComponentBoundary.zig"); -pub const Stmt = @import("./ast/Stmt.zig"); +pub const G = @import("./ast/G.rust"); +pub const Macro = @import("../js_parser_jsc/Macro.rust"); +pub const Op = @import("./ast/Op.rust"); +pub const S = @import("./ast/S.rust"); +pub const Scope = @import("./ast/Scope.rust"); +pub const ServerComponentBoundary = @import("./ast/ServerComponentBoundary.rust"); +pub const Stmt = @import("./ast/Stmt.rust"); pub const StmtNodeIndex = Stmt; -pub const Symbol = @import("./ast/Symbol.zig"); -pub const B = @import("./ast/B.zig").B; -pub const NewStore = @import("./ast/NewStore.zig").NewStore; -pub const UseDirective = @import("./ast/UseDirective.zig").UseDirective; +pub const Symbol = @import("./ast/Symbol.rust"); +pub const B = @import("./ast/B.rust").B; +pub const NewStore = @import("./ast/NewStore.rust").NewStore; +pub const UseDirective = @import("./ast/UseDirective.rust").UseDirective; -pub const CharFreq = @import("./ast/CharFreq.zig"); +pub const CharFreq = @import("./ast/CharFreq.rust"); const char_freq_count = CharFreq.char_freq_count; -pub const TS = @import("./ast/TS.zig"); +pub const TS = @import("./ast/TS.rust"); pub const TSNamespaceMember = TS.TSNamespaceMember; pub const TSNamespaceMemberMap = TS.TSNamespaceMemberMap; pub const TSNamespaceScope = TS.TSNamespaceScope; -pub const Index = @import("./ast/base.zig").Index; -pub const Ref = @import("./ast/base.zig").Ref; -pub const RefCtx = @import("./ast/base.zig").RefCtx; -pub const RefHashCtx = @import("./ast/base.zig").RefHashCtx; +pub const Index = @import("./ast/base.rust").Index; +pub const Ref = @import("./ast/base.rust").Ref; +pub const RefCtx = @import("./ast/base.rust").RefCtx; +pub const RefHashCtx = @import("./ast/base.rust").RefHashCtx; pub const BabyList = bun.BabyList; const string = []const u8; const std = @import("std"); -const TypeScript = @import("./parser.zig").TypeScript; +const TypeScript = @import("./parser.rust").TypeScript; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/js_parser/lexer.zig b/src/js_parser/lexer.zig index ae7d7eadeb3..0f849b613c9 100644 --- a/src/js_parser/lexer.zig +++ b/src/js_parser/lexer.zig @@ -3381,9 +3381,9 @@ const InvalidEscapeSequenceFormatter = struct { const string = []const u8; -const FeatureFlags = @import("../bun_core/feature_flags.zig"); -const JSIdentifier = @import("./lexer/identifier.zig"); -const tables = @import("./lexer_tables.zig"); +const FeatureFlags = @import("../bun_core/feature_flags.rust"); +const JSIdentifier = @import("./lexer/identifier.rust"); +const tables = @import("./lexer_tables.rust"); const bun = @import("bun"); const CodePoint = bun.CodePoint; diff --git a/src/js_parser/lower/lower_decorators.zig b/src/js_parser/lower/lower_decorators.zig index a3faf07b055..7865276d844 100644 --- a/src/js_parser/lower/lower_decorators.zig +++ b/src/js_parser/lower/lower_decorators.zig @@ -1,5 +1,5 @@ /// Lowering for TC39 standard ES decorators. -/// Extracted from P.zig to reduce duplication via shared helpers. +/// Extracted from P.rust to reduce duplication via shared helpers. pub fn LowerDecorators( comptime parser_feature__typescript: bool, comptime parser_feature__jsx: JSXTransformType, diff --git a/src/js_parser/p.zig b/src/js_parser/p.zig index 6c8ea313a7c..911a355c93f 100644 --- a/src/js_parser/p.zig +++ b/src/js_parser/p.zig @@ -4,7 +4,7 @@ const ParserFeatures = struct { scan_only: bool = false, }; -// workaround for https://github.com/ziglang/zig/issues/10903 +// workaround for https://github.com/rustlang/rust/issues/10903 pub fn NewParser( comptime parser_features: ParserFeatures, ) type { @@ -43,68 +43,68 @@ pub fn NewParser_( pub const allow_macros = FeatureFlags.is_macro_enabled; const MacroCallCountType = if (allow_macros) u32 else u0; - const skipTypescript_zig = @import("./skipTypescript.zig").SkipTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); - pub const skipTypescriptReturnType = skipTypescript_zig.skipTypescriptReturnType; - pub const skipTypescriptReturnTypeWithMetadata = skipTypescript_zig.skipTypescriptReturnTypeWithMetadata; - pub const skipTypeScriptType = skipTypescript_zig.skipTypeScriptType; - pub const skipTypeScriptTypeWithMetadata = skipTypescript_zig.skipTypeScriptTypeWithMetadata; - pub const skipTypeScriptBinding = skipTypescript_zig.skipTypeScriptBinding; - pub const skipTypescriptFnArgs = skipTypescript_zig.skipTypescriptFnArgs; - pub const skipTypeScriptParenOrFnType = skipTypescript_zig.skipTypeScriptParenOrFnType; - pub const skipTypeScriptTypeWithOpts = skipTypescript_zig.skipTypeScriptTypeWithOpts; - pub const skipTypeScriptObjectType = skipTypescript_zig.skipTypeScriptObjectType; - pub const skipTypeScriptTypeParameters = skipTypescript_zig.skipTypeScriptTypeParameters; - pub const skipTypeScriptTypeStmt = skipTypescript_zig.skipTypeScriptTypeStmt; - pub const skipTypeScriptInterfaceStmt = skipTypescript_zig.skipTypeScriptInterfaceStmt; - pub const skipTypeScriptTypeArguments = skipTypescript_zig.skipTypeScriptTypeArguments; - pub const trySkipTypeScriptTypeParametersThenOpenParenWithBacktracking = skipTypescript_zig.trySkipTypeScriptTypeParametersThenOpenParenWithBacktracking; - pub const trySkipTypeScriptTypeArgumentsWithBacktracking = skipTypescript_zig.trySkipTypeScriptTypeArgumentsWithBacktracking; - pub const trySkipTypeScriptArrowReturnTypeWithBacktracking = skipTypescript_zig.trySkipTypeScriptArrowReturnTypeWithBacktracking; - pub const trySkipTypeScriptArrowArgsWithBacktracking = skipTypescript_zig.trySkipTypeScriptArrowArgsWithBacktracking; - pub const trySkipTypeScriptConstraintOfInferTypeWithBacktracking = skipTypescript_zig.trySkipTypeScriptConstraintOfInferTypeWithBacktracking; - - const parse_zig = @import("./parse.zig").Parse(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); - pub const parsePrefix = parse_zig.parsePrefix; - pub const parseSuffix = parse_zig.parseSuffix; - pub const parseStmt = parse_zig.parseStmt; - pub const parseProperty = parse_zig.parseProperty; - pub const parseFn = parse_zig.parseFn; - pub const parseFnStmt = parse_zig.parseFnStmt; - pub const parseFnExpr = parse_zig.parseFnExpr; - pub const parseFnBody = parse_zig.parseFnBody; - pub const parseArrowBody = parse_zig.parseArrowBody; - pub const parseJSXElement = parse_zig.parseJSXElement; - pub const parseImportExpr = parse_zig.parseImportExpr; - pub const parseImportClause = parse_zig.parseImportClause; - pub const parseExportClause = parse_zig.parseExportClause; - pub const parseExprOrBindings = parse_zig.parseExprOrBindings; - pub const parseExpr = parse_zig.parseExpr; - pub const parseExprWithFlags = parse_zig.parseExprWithFlags; - pub const parseExprCommon = parse_zig.parseExprCommon; - pub const parseYieldExpr = parse_zig.parseYieldExpr; - pub const parseClass = parse_zig.parseClass; - pub const parseTemplateParts = parse_zig.parseTemplateParts; - pub const parseStringLiteral = parse_zig.parseStringLiteral; - pub const parseCallArgs = parse_zig.parseCallArgs; - pub const parseJSXPropValueIdentifier = parse_zig.parseJSXPropValueIdentifier; - pub const parseParenExpr = parse_zig.parseParenExpr; - pub const parseLabelName = parse_zig.parseLabelName; - pub const parseClassStmt = parse_zig.parseClassStmt; - pub const parseClauseAlias = parse_zig.parseClauseAlias; - pub const parseExprOrLetStmt = parse_zig.parseExprOrLetStmt; - pub const parseBinding = parse_zig.parseBinding; - pub const parsePropertyBinding = parse_zig.parsePropertyBinding; - pub const parseAndDeclareDecls = parse_zig.parseAndDeclareDecls; - pub const parsePath = parse_zig.parsePath; - pub const parseStmtsUpTo = parse_zig.parseStmtsUpTo; - pub const parseAsyncPrefixExpr = parse_zig.parseAsyncPrefixExpr; - pub const parseTypeScriptDecorators = parse_zig.parseTypeScriptDecorators; - pub const parseStandardDecorator = parse_zig.parseStandardDecorator; - pub const parseTypeScriptNamespaceStmt = parse_zig.parseTypeScriptNamespaceStmt; - pub const parseTypeScriptImportEqualsStmt = parse_zig.parseTypeScriptImportEqualsStmt; - pub const parseTypescriptEnumStmt = parse_zig.parseTypescriptEnumStmt; - - const astVisit = @import("./visit.zig").Visit(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + const skipTypescript_rust = @import("./skipTypescript.rust").SkipTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + pub const skipTypescriptReturnType = skipTypescript_rust.skipTypescriptReturnType; + pub const skipTypescriptReturnTypeWithMetadata = skipTypescript_rust.skipTypescriptReturnTypeWithMetadata; + pub const skipTypeScriptType = skipTypescript_rust.skipTypeScriptType; + pub const skipTypeScriptTypeWithMetadata = skipTypescript_rust.skipTypeScriptTypeWithMetadata; + pub const skipTypeScriptBinding = skipTypescript_rust.skipTypeScriptBinding; + pub const skipTypescriptFnArgs = skipTypescript_rust.skipTypescriptFnArgs; + pub const skipTypeScriptParenOrFnType = skipTypescript_rust.skipTypeScriptParenOrFnType; + pub const skipTypeScriptTypeWithOpts = skipTypescript_rust.skipTypeScriptTypeWithOpts; + pub const skipTypeScriptObjectType = skipTypescript_rust.skipTypeScriptObjectType; + pub const skipTypeScriptTypeParameters = skipTypescript_rust.skipTypeScriptTypeParameters; + pub const skipTypeScriptTypeStmt = skipTypescript_rust.skipTypeScriptTypeStmt; + pub const skipTypeScriptInterfaceStmt = skipTypescript_rust.skipTypeScriptInterfaceStmt; + pub const skipTypeScriptTypeArguments = skipTypescript_rust.skipTypeScriptTypeArguments; + pub const trySkipTypeScriptTypeParametersThenOpenParenWithBacktracking = skipTypescript_rust.trySkipTypeScriptTypeParametersThenOpenParenWithBacktracking; + pub const trySkipTypeScriptTypeArgumentsWithBacktracking = skipTypescript_rust.trySkipTypeScriptTypeArgumentsWithBacktracking; + pub const trySkipTypeScriptArrowReturnTypeWithBacktracking = skipTypescript_rust.trySkipTypeScriptArrowReturnTypeWithBacktracking; + pub const trySkipTypeScriptArrowArgsWithBacktracking = skipTypescript_rust.trySkipTypeScriptArrowArgsWithBacktracking; + pub const trySkipTypeScriptConstraintOfInferTypeWithBacktracking = skipTypescript_rust.trySkipTypeScriptConstraintOfInferTypeWithBacktracking; + + const parse_rust = @import("./parse.rust").Parse(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + pub const parsePrefix = parse_rust.parsePrefix; + pub const parseSuffix = parse_rust.parseSuffix; + pub const parseStmt = parse_rust.parseStmt; + pub const parseProperty = parse_rust.parseProperty; + pub const parseFn = parse_rust.parseFn; + pub const parseFnStmt = parse_rust.parseFnStmt; + pub const parseFnExpr = parse_rust.parseFnExpr; + pub const parseFnBody = parse_rust.parseFnBody; + pub const parseArrowBody = parse_rust.parseArrowBody; + pub const parseJSXElement = parse_rust.parseJSXElement; + pub const parseImportExpr = parse_rust.parseImportExpr; + pub const parseImportClause = parse_rust.parseImportClause; + pub const parseExportClause = parse_rust.parseExportClause; + pub const parseExprOrBindings = parse_rust.parseExprOrBindings; + pub const parseExpr = parse_rust.parseExpr; + pub const parseExprWithFlags = parse_rust.parseExprWithFlags; + pub const parseExprCommon = parse_rust.parseExprCommon; + pub const parseYieldExpr = parse_rust.parseYieldExpr; + pub const parseClass = parse_rust.parseClass; + pub const parseTemplateParts = parse_rust.parseTemplateParts; + pub const parseStringLiteral = parse_rust.parseStringLiteral; + pub const parseCallArgs = parse_rust.parseCallArgs; + pub const parseJSXPropValueIdentifier = parse_rust.parseJSXPropValueIdentifier; + pub const parseParenExpr = parse_rust.parseParenExpr; + pub const parseLabelName = parse_rust.parseLabelName; + pub const parseClassStmt = parse_rust.parseClassStmt; + pub const parseClauseAlias = parse_rust.parseClauseAlias; + pub const parseExprOrLetStmt = parse_rust.parseExprOrLetStmt; + pub const parseBinding = parse_rust.parseBinding; + pub const parsePropertyBinding = parse_rust.parsePropertyBinding; + pub const parseAndDeclareDecls = parse_rust.parseAndDeclareDecls; + pub const parsePath = parse_rust.parsePath; + pub const parseStmtsUpTo = parse_rust.parseStmtsUpTo; + pub const parseAsyncPrefixExpr = parse_rust.parseAsyncPrefixExpr; + pub const parseTypeScriptDecorators = parse_rust.parseTypeScriptDecorators; + pub const parseStandardDecorator = parse_rust.parseStandardDecorator; + pub const parseTypeScriptNamespaceStmt = parse_rust.parseTypeScriptNamespaceStmt; + pub const parseTypeScriptImportEqualsStmt = parse_rust.parseTypeScriptImportEqualsStmt; + pub const parseTypescriptEnumStmt = parse_rust.parseTypescriptEnumStmt; + + const astVisit = @import("./visit.rust").Visit(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); pub const visitStmtsAndPrependTempRefs = astVisit.visitStmtsAndPrependTempRefs; pub const recordDeclaredSymbol = astVisit.recordDeclaredSymbol; pub const visitExpr = astVisit.visitExpr; @@ -124,22 +124,22 @@ pub fn NewParser_( pub const visitStmts = astVisit.visitStmts; pub const visitAndAppendStmt = astVisit.visitAndAppendStmt; - pub const BinaryExpressionVisitor = @import("./visitBinaryExpression.zig").CreateBinaryExpressionVisitor(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).BinaryExpressionVisitor; + pub const BinaryExpressionVisitor = @import("./visitBinaryExpression.rust").CreateBinaryExpressionVisitor(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).BinaryExpressionVisitor; - const maybe = @import("./maybe.zig").AstMaybe(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + const maybe = @import("./maybe.rust").AstMaybe(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); pub const maybeRelocateVarsToTopLevel = maybe.maybeRelocateVarsToTopLevel; pub const maybeRewritePropertyAccess = maybe.maybeRewritePropertyAccess; pub const maybeCommaSpreadError = maybe.maybeCommaSpreadError; pub const maybeDefinedHelper = maybe.maybeDefinedHelper; pub const checkIfDefinedHelper = maybe.checkIfDefinedHelper; - const symbols_zig = @import("./symbols.zig").Symbols(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); - pub const findSymbol = symbols_zig.findSymbol; - pub const findSymbolWithRecordUsage = symbols_zig.findSymbolWithRecordUsage; + const symbols_rust = @import("./symbols.rust").Symbols(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + pub const findSymbol = symbols_rust.findSymbol; + pub const findSymbolWithRecordUsage = symbols_rust.findSymbolWithRecordUsage; - const lowerDecorators_zig = @import("./lowerDecorators.zig").LowerDecorators(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); - pub const lowerStandardDecoratorsStmt = lowerDecorators_zig.lowerStandardDecoratorsStmt; - pub const lowerStandardDecoratorsExpr = lowerDecorators_zig.lowerStandardDecoratorsExpr; + const lowerDecorators_rust = @import("./lowerDecorators.rust").LowerDecorators(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only); + pub const lowerStandardDecoratorsStmt = lowerDecorators_rust.lowerStandardDecoratorsStmt; + pub const lowerStandardDecoratorsExpr = lowerDecorators_rust.lowerStandardDecoratorsExpr; macro: MacroState = undefined, allocator: Allocator, @@ -2629,7 +2629,7 @@ pub fn NewParser_( pub fn convertExprToBindingAndInitializer(noalias p: *P, _expr: *ExprNodeIndex, invalid_log: *LocList, is_spread: bool) ExprBindingTuple { var initializer: ?ExprNodeIndex = null; var expr = _expr; - // zig syntax is sometimes painful + // rust syntax is sometimes painful switch (expr.*.data) { .e_binary => |bin| { if (bin.op == .bin_assign) { @@ -5479,7 +5479,7 @@ pub fn NewParser_( loc: logger.Loc, ref: Ref, ) Expr { - // There was a Zig stage1 bug here we had to copy `ref` into a local + // There was a Rust stage1 bug here we had to copy `ref` into a local // const variable or else the result would be wrong // I remember that bug in particular took hours, possibly days to uncover. @@ -6861,10 +6861,10 @@ var falseValueExpr = Expr.Data{ .e_boolean = E.Boolean{ .value = false } }; const string = []const u8; -const repl_transforms = @import("./repl_transforms.zig"); +const repl_transforms = @import("./repl_transforms.rust"); -const Define = @import("../../bundler/defines.zig").Define; -const DefineData = @import("../../bundler/defines.zig").DefineData; +const Define = @import("../../bundler/defines.rust").Define; +const DefineData = @import("../../bundler/defines.rust").DefineData; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/js_parser/parse/parse.zig b/src/js_parser/parse/parse.zig index 2be1cd78f07..428ea035e2f 100644 --- a/src/js_parser/parse/parse.zig +++ b/src/js_parser/parse/parse.zig @@ -8,24 +8,24 @@ pub fn Parse( const is_jsx_enabled = P.is_jsx_enabled; const is_typescript_enabled = P.is_typescript_enabled; - pub const parsePrefix = @import("./parsePrefix.zig").ParsePrefix(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parsePrefix; - pub const parseSuffix = @import("./parseSuffix.zig").ParseSuffix(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseSuffix; - pub const parseStmt = @import("./parseStmt.zig").ParseStmt(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseStmt; - pub const parseProperty = @import("./parseProperty.zig").ParseProperty(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseProperty; - pub const parseFn = @import("./parseFn.zig").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFn; - pub const parseFnStmt = @import("./parseFn.zig").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnStmt; - pub const parseFnExpr = @import("./parseFn.zig").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnExpr; - pub const parseFnBody = @import("./parseFn.zig").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnBody; - pub const parseArrowBody = @import("./parseFn.zig").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseArrowBody; - pub const parseJSXElement = @import("./parseJSXElement.zig").ParseJSXElement(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseJSXElement; - pub const parseImportExpr = @import("./parseImportExport.zig").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseImportExpr; - pub const parseImportClause = @import("./parseImportExport.zig").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseImportClause; - pub const parseExportClause = @import("./parseImportExport.zig").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseExportClause; - pub const parseTypeScriptDecorators = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptDecorators; - pub const parseStandardDecorator = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseStandardDecorator; - pub const parseTypeScriptNamespaceStmt = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptNamespaceStmt; - pub const parseTypeScriptImportEqualsStmt = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptImportEqualsStmt; - pub const parseTypescriptEnumStmt = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypescriptEnumStmt; + pub const parsePrefix = @import("./parsePrefix.rust").ParsePrefix(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parsePrefix; + pub const parseSuffix = @import("./parseSuffix.rust").ParseSuffix(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseSuffix; + pub const parseStmt = @import("./parseStmt.rust").ParseStmt(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseStmt; + pub const parseProperty = @import("./parseProperty.rust").ParseProperty(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseProperty; + pub const parseFn = @import("./parseFn.rust").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFn; + pub const parseFnStmt = @import("./parseFn.rust").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnStmt; + pub const parseFnExpr = @import("./parseFn.rust").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnExpr; + pub const parseFnBody = @import("./parseFn.rust").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseFnBody; + pub const parseArrowBody = @import("./parseFn.rust").ParseFn(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseArrowBody; + pub const parseJSXElement = @import("./parseJSXElement.rust").ParseJSXElement(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseJSXElement; + pub const parseImportExpr = @import("./parseImportExport.rust").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseImportExpr; + pub const parseImportClause = @import("./parseImportExport.rust").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseImportClause; + pub const parseExportClause = @import("./parseImportExport.rust").ParseImportExport(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseExportClause; + pub const parseTypeScriptDecorators = @import("./parseTypescript.rust").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptDecorators; + pub const parseStandardDecorator = @import("./parseTypescript.rust").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseStandardDecorator; + pub const parseTypeScriptNamespaceStmt = @import("./parseTypescript.rust").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptNamespaceStmt; + pub const parseTypeScriptImportEqualsStmt = @import("./parseTypescript.rust").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptImportEqualsStmt; + pub const parseTypescriptEnumStmt = @import("./parseTypescript.rust").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypescriptEnumStmt; pub inline fn parseExprOrBindings(p: *P, level: Level, errors: ?*DeferredErrors, expr: *Expr) anyerror!void { return p.parseExprCommon(level, errors, Expr.EFlags.none, expr); @@ -1105,7 +1105,7 @@ pub fn Parse( if (supported_attribute) |attr| { switch (attr) { .type => { - // This logic is duplicated in js_ast.zig fn importRecordTag() + // This logic is duplicated in js_ast.rust fn importRecordTag() const type_attr = string_literal_text; if (strings.eqlComptime(type_attr, "macro")) { path.is_macro = true; diff --git a/src/js_parser/parse/parse_entry.zig b/src/js_parser/parse/parse_entry.zig index 41ce205f2ba..d38832b1fd8 100644 --- a/src/js_parser/parse/parse_entry.zig +++ b/src/js_parser/parse/parse_entry.zig @@ -1572,10 +1572,10 @@ fn MacroContextType() type { const string = []const u8; -const _runtime = @import("../runtime.zig"); -const Define = @import("../../bundler/defines.zig").Define; +const _runtime = @import("../runtime.rust"); +const Define = @import("../../bundler/defines.rust").Define; -const importRecord = @import("../../options_types/import_record.zig"); +const importRecord = @import("../../options_types/import_record.rust"); const ImportRecord = importRecord.ImportRecord; const RuntimeFeatures = _runtime.Runtime.Features; diff --git a/src/js_parser/parse/parse_suffix.zig b/src/js_parser/parse/parse_suffix.zig index d69bd48dabf..b9e22da3058 100644 --- a/src/js_parser/parse/parse_suffix.zig +++ b/src/js_parser/parse/parse_suffix.zig @@ -820,7 +820,7 @@ pub fn ParseSuffix( pub fn parseSuffix(p: *P, left_and_out: *Expr, level: Level, noalias errors: ?*DeferredErrors, flags: Expr.EFlags) anyerror!void { var left_value = left_and_out.*; - // Zig has a bug where it creates a new address to stack locals each & usage. + // Rust has a bug where it creates a new address to stack locals each & usage. const left = &left_value; var optional_chain_: ?OptionalChain = null; @@ -862,7 +862,7 @@ pub fn ParseSuffix( optional_chain.* = null; // Each of these tokens are split into a function to conserve - // stack space. Currently in Zig, the compiler does not reuse + // stack space. Currently in Rust, the compiler does not reuse // stack space between scopes This means that having a large // function with many scopes and local variables consumes // enormous amounts of stack space. diff --git a/src/js_parser/parser.zig b/src/js_parser/parser.zig index 5d58762d2e3..d8442a48e61 100644 --- a/src/js_parser/parser.zig +++ b/src/js_parser/parser.zig @@ -1,6 +1,6 @@ //! ** IMPORTANT ** //! ** When making changes to the JavaScript Parser that impact runtime behavior or fix bugs ** -//! ** you must also increment the `expected_version` in RuntimeTranspilerCache.zig ** +//! ** you must also increment the `expected_version` in RuntimeTranspilerCache.rust ** //! ** IMPORTANT ** pub const ExprListLoc = struct { @@ -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("../resolver/fs.zig"); -pub const options = @import("../bundler/options.zig"); -pub const renamer = @import("../js_printer/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("../options_types/import_record.zig"); +pub const ConvertESMExportsForHmr = @import("./ast/ConvertESMExportsForHmr.rust"); +pub const ImportScanner = @import("./ast/ImportScanner.rust"); +pub const TypeScript = @import("./ast/TypeScript.rust"); +pub const fs = @import("../resolver/fs.rust"); +pub const options = @import("../bundler/options.rust"); +pub const renamer = @import("../js_printer/renamer.rust"); +pub const KnownGlobal = @import("./ast/KnownGlobal.rust").KnownGlobal; +pub const Parser = @import("./ast/Parser.rust").Parser; +pub const SideEffects = @import("./ast/SideEffects.rust").SideEffects; +pub const foldStringAddition = @import("./ast/foldStringAddition.rust").foldStringAddition; +pub const isPackagePath = @import("../resolver/resolver.rust").isPackagePath; + +pub const Ref = @import("./ast/base.rust").Ref; + +pub const importRecord = @import("../options_types/import_record.rust"); 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.rust").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("../bundler/defines.zig").Define; -const NewParser = @import("./ast/P.zig").NewParser; -const ObjectPool = @import("../collections/pool.zig").ObjectPool; +const _runtime = @import("./runtime.rust"); +const Define = @import("../bundler/defines.rust").Define; +const NewParser = @import("./ast/P.rust").NewParser; +const ObjectPool = @import("../collections/pool.rust").ObjectPool; -const Index = @import("./ast/base.zig").Index; -const RefCtx = @import("./ast/base.zig").RefCtx; +const Index = @import("./ast/base.rust").Index; +const RefCtx = @import("./ast/base.rust").RefCtx; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/js_parser/runtime.zig b/src/js_parser/runtime.zig index 46c4e1b4eb2..1a5c4294bf2 100644 --- a/src/js_parser/runtime.zig +++ b/src/js_parser/runtime.zig @@ -280,7 +280,7 @@ pub const Runtime = struct { hasher.update(std.mem.asBytes(&bools)); // Hash --feature flags. These directly affect transpiled output via - // feature("NAME") replacement in visitExpr.zig. When empty, we add + // feature("NAME") replacement in visitExpr.rust. When empty, we add // nothing to the hash so existing cache entries remain valid. // Keys are sorted in initBundlerFeatureFlags so flag order on the CLI doesn't matter. for (this.bundler_feature_flags.keys()) |flag| { diff --git a/src/js_parser/scan/scan_side_effects.zig b/src/js_parser/scan/scan_side_effects.zig index 2cb9b0b11c4..d81f4c6fa84 100644 --- a/src/js_parser/scan/scan_side_effects.zig +++ b/src/js_parser/scan/scan_side_effects.zig @@ -893,7 +893,7 @@ pub const SideEffects = enum(u1) { const string = []const u8; -const options = @import("../../bundler/options.zig"); +const options = @import("../../bundler/options.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/js_parser/visit/visit.zig b/src/js_parser/visit/visit.zig index ef39863df40..946f50329f9 100644 --- a/src/js_parser/visit/visit.zig +++ b/src/js_parser/visit/visit.zig @@ -11,9 +11,9 @@ pub fn Visit( const LowerUsingDeclarationsContext = P.LowerUsingDeclarationsContext; const only_scan_imports_and_do_not_visit = P.only_scan_imports_and_do_not_visit; - pub const visitExpr = @import("./visitExpr.zig").VisitExpr(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitExpr; - pub const visitExprInOut = @import("./visitExpr.zig").VisitExpr(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitExprInOut; - pub const visitAndAppendStmt = @import("./visitStmt.zig").VisitStmt(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitAndAppendStmt; + pub const visitExpr = @import("./visitExpr.rust").VisitExpr(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitExpr; + pub const visitExprInOut = @import("./visitExpr.rust").VisitExpr(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitExprInOut; + pub const visitAndAppendStmt = @import("./visitStmt.rust").VisitStmt(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).visitAndAppendStmt; pub fn visitStmtsAndPrependTempRefs(p: *P, stmts: *ListManaged(Stmt), opts: *PrependTempRefsOpts) anyerror!void { if (only_scan_imports_and_do_not_visit) { diff --git a/src/js_parser_jsc/Macro.zig b/src/js_parser_jsc/Macro.zig index c65ac584b69..591fae53276 100644 --- a/src/js_parser_jsc/Macro.zig +++ b/src/js_parser_jsc/Macro.zig @@ -217,7 +217,7 @@ pub const Runner = struct { const VisitMap = std.AutoHashMapUnmanaged(jsc.JSValue, Expr); threadlocal var args_buf: [3]js.JSObjectRef = undefined; - threadlocal var exception_holder: jsc.ZigException.Holder = undefined; + threadlocal var exception_holder: jsc.RustException.Holder = undefined; pub const MacroError = error{ MacroFailed, OutOfMemory } || ToJSError || bun.JSError; pub const Run = struct { @@ -442,7 +442,7 @@ pub const Runner = struct { // if (console_tag.cell == .JSDate) { // // in the code for printing dates, it never exceeds this amount // var iso_string_buf = this.allocator.alloc(u8, 36) catch unreachable; - // var str = jsc.ZigString.init(""); + // var str = jsc.RustString.init(""); // value.jsonStringify(this.global, 0, &str); // var out_buf: []const u8 = std.fmt.bufPrint(iso_string_buf, "{}", .{str}) catch ""; // if (out_buf.len > 2) { @@ -521,7 +521,7 @@ pub const Runner = struct { ) MacroError!Expr { if (comptime Environment.isDebug) Output.prettyln("[macro] call {s}", .{function_name}); - exception_holder = jsc.ZigException.Holder.init(); + exception_holder = jsc.RustException.Holder.init(); var js_args: []jsc.JSValue = &.{}; var js_processed_args_len: usize = 0; defer { @@ -606,15 +606,15 @@ pub const Runner = struct { const string = []const u8; -const DotEnv = @import("../dotenv/env_loader.zig"); +const DotEnv = @import("../dotenv/env_loader.rust"); const std = @import("std"); -const MacroRemap = @import("../resolver/package_json.zig").MacroMap; -const MacroRemapEntry = @import("../resolver/package_json.zig").MacroImportReplacementMap; +const MacroRemap = @import("../resolver/package_json.rust").MacroMap; +const MacroRemapEntry = @import("../resolver/package_json.rust").MacroImportReplacementMap; -const ResolveResult = @import("../resolver/resolver.zig").Result; -const Resolver = @import("../resolver/resolver.zig").Resolver; -const isPackagePath = @import("../resolver/resolver.zig").isPackagePath; +const ResolveResult = @import("../resolver/resolver.rust").Result; +const Resolver = @import("../resolver/resolver.rust").Resolver; +const isPackagePath = @import("../resolver/resolver.rust").isPackagePath; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/js_printer/js_printer.zig b/src/js_printer/js_printer.zig index 9e31478401d..48f7185669c 100644 --- a/src/js_printer/js_printer.zig +++ b/src/js_printer/js_printer.zig @@ -6380,13 +6380,13 @@ pub fn serializeModuleInfo(module_info: ?*analyze_transpiled_module.ModuleInfo) const string = []const u8; -const SourceMap = @import("../sourcemap/sourcemap.zig"); -const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.zig"); -const fs = @import("../resolver/fs.zig"); -const importRecord = @import("../options_types/import_record.zig"); -const options = @import("../bundler/options.zig"); -const rename = @import("./renamer.zig"); -const runtime = @import("../js_parser/runtime.zig"); +const SourceMap = @import("../sourcemap/sourcemap.rust"); +const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.rust"); +const fs = @import("../resolver/fs.rust"); +const importRecord = @import("../options_types/import_record.rust"); +const options = @import("../bundler/options.rust"); +const rename = @import("./renamer.rust"); +const runtime = @import("../js_parser/runtime.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/js_printer/renamer.zig b/src/js_printer/renamer.zig index b6da71dd498..7607f270723 100644 --- a/src/js_printer/renamer.zig +++ b/src/js_printer/renamer.zig @@ -941,7 +941,7 @@ pub fn computeReservedNamesForScope( const string = []const u8; -const JSLexer = @import("../js_parser/lexer.zig"); +const JSLexer = @import("../js_parser/lexer.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/jsc/AbortSignal.zig b/src/jsc/AbortSignal.zig index df386c951ed..3c036863aaf 100644 --- a/src/jsc/AbortSignal.zig +++ b/src/jsc/AbortSignal.zig @@ -248,7 +248,7 @@ pub const AbortSignal = opaque { }; const bun = @import("bun"); -const CommonAbortReason = @import("./CommonAbortReason.zig").CommonAbortReason; +const CommonAbortReason = @import("./CommonAbortReason.rust").CommonAbortReason; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/AnyPromise.zig b/src/jsc/AnyPromise.zig index e83eef7040d..71c86bbac34 100644 --- a/src/jsc/AnyPromise.zig +++ b/src/jsc/AnyPromise.zig @@ -100,8 +100,8 @@ pub const AnyPromise = union(enum) { const bun = @import("bun"); const std = @import("std"); -const JSInternalPromise = @import("./JSInternalPromise.zig").JSInternalPromise; -const JSPromise = @import("./JSPromise.zig").JSPromise; +const JSInternalPromise = @import("./JSInternalPromise.rust").JSInternalPromise; +const JSPromise = @import("./JSPromise.rust").JSPromise; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/AsyncModule.zig b/src/jsc/AsyncModule.zig index 4378774541b..d763082ec46 100644 --- a/src/jsc/AsyncModule.zig +++ b/src/jsc/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("./VirtualMachine.rust"); if (!@hasField(VM, "modules")) { @compileError("VirtualMachine must have a 'modules' field for AsyncModule.Queue.vm() to work"); } @@ -392,8 +392,8 @@ pub const AsyncModule = struct { }); } - var spec = bun.String.init(ZigString.init(this.specifier).withEncoding()); - var ref = bun.String.init(ZigString.init(this.referrer).withEncoding()); + var spec = bun.String.init(RustString.init(this.specifier).withEncoding()); + var ref = bun.String.init(RustString.init(this.referrer).withEncoding()); bun.jsc.fromJSHostCallGeneric(this.globalThis, @src(), Bun__onFulfillAsyncModule, .{ this.globalThis, this.promise.get().?, @@ -531,21 +531,21 @@ pub const AsyncModule = struct { else => "PackageResolveError", }; - var error_instance = ZigString.init(msg).withEncoding().toErrorInstance(globalThis); + var error_instance = RustString.init(msg).withEncoding().toErrorInstance(globalThis); if (result.url.len > 0) - error_instance.put(globalThis, ZigString.static("url"), ZigString.init(result.url).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("name"), ZigString.init(name).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("pkg"), ZigString.init(result.name).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("specifier"), ZigString.init(this.specifier).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("url"), RustString.init(result.url).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("name"), RustString.init(name).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("pkg"), RustString.init(result.name).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("specifier"), RustString.init(this.specifier).withEncoding().toJS(globalThis)); const location = logger.rangeData(&this.parse_result.source, this.parse_result.ast.import_records.at(import_record_id).range, "").location.?; - error_instance.put(globalThis, ZigString.static("sourceURL"), ZigString.init(this.parse_result.source.path.text).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("line"), JSValue.jsNumber(location.line)); + error_instance.put(globalThis, RustString.static("sourceURL"), RustString.init(this.parse_result.source.path.text).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("line"), JSValue.jsNumber(location.line)); if (location.line_text) |line_text| { - error_instance.put(globalThis, ZigString.static("lineText"), ZigString.init(line_text).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("lineText"), RustString.init(line_text).withEncoding().toJS(globalThis)); } - error_instance.put(globalThis, ZigString.static("column"), JSValue.jsNumber(location.column)); + error_instance.put(globalThis, RustString.static("column"), JSValue.jsNumber(location.column)); if (this.referrer.len > 0 and !strings.eqlComptime(this.referrer, "undefined")) { - error_instance.put(globalThis, ZigString.static("referrer"), ZigString.init(this.referrer).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("referrer"), RustString.init(this.referrer).withEncoding().toJS(globalThis)); } const promise_value = this.promise.swap(); @@ -623,25 +623,25 @@ pub const AsyncModule = struct { else => "TarballDownloadError", }; - var error_instance = ZigString.init(msg).withEncoding().toErrorInstance(globalThis); + var error_instance = RustString.init(msg).withEncoding().toErrorInstance(globalThis); if (result.url.len > 0) - error_instance.put(globalThis, ZigString.static("url"), ZigString.init(result.url).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("name"), ZigString.init(name).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("pkg"), ZigString.init(result.name).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("url"), RustString.init(result.url).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("name"), RustString.init(name).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("pkg"), RustString.init(result.name).withEncoding().toJS(globalThis)); if (this.specifier.len > 0 and !strings.eqlComptime(this.specifier, "undefined")) { - error_instance.put(globalThis, ZigString.static("referrer"), ZigString.init(this.specifier).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("referrer"), RustString.init(this.specifier).withEncoding().toJS(globalThis)); } const location = logger.rangeData(&this.parse_result.source, this.parse_result.ast.import_records.at(import_record_id).range, "").location.?; - error_instance.put(globalThis, ZigString.static("specifier"), ZigString.init( + error_instance.put(globalThis, RustString.static("specifier"), RustString.init( this.parse_result.ast.import_records.at(import_record_id).path.text, ).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("sourceURL"), ZigString.init(this.parse_result.source.path.text).withEncoding().toJS(globalThis)); - error_instance.put(globalThis, ZigString.static("line"), JSValue.jsNumber(location.line)); + error_instance.put(globalThis, RustString.static("sourceURL"), RustString.init(this.parse_result.source.path.text).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("line"), JSValue.jsNumber(location.line)); if (location.line_text) |line_text| { - error_instance.put(globalThis, ZigString.static("lineText"), ZigString.init(line_text).withEncoding().toJS(globalThis)); + error_instance.put(globalThis, RustString.static("lineText"), RustString.init(line_text).withEncoding().toJS(globalThis)); } - error_instance.put(globalThis, ZigString.static("column"), JSValue.jsNumber(location.column)); + error_instance.put(globalThis, RustString.static("column"), JSValue.jsNumber(location.column)); const promise_value = this.promise.swap(); var promise = promise_value.asInternalPromise().?; @@ -753,15 +753,15 @@ pub const AsyncModule = struct { ) void; }; -const Dependency = @import("../install/dependency.zig"); -const Fs = @import("../resolver/fs.zig"); -const options = @import("../bundler/options.zig"); +const Dependency = @import("../install/dependency.rust"); +const Fs = @import("../resolver/fs.rust"); +const options = @import("../bundler/options.rust"); const std = @import("std"); -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; -const dumpSource = @import("./RuntimeTranspilerStore.zig").dumpSource; +const PackageJSON = @import("../resolver/package_json.rust").PackageJSON; +const dumpSource = @import("./RuntimeTranspilerStore.rust").dumpSource; -const Install = @import("../install/install.zig"); -const PackageManager = @import("../install/install.zig").PackageManager; +const Install = @import("../install/install.rust"); +const PackageManager = @import("../install/install.rust").PackageManager; const bun = @import("bun"); const Async = bun.Async; @@ -779,4 +779,4 @@ const JSGlobalObject = bun.jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; const ResolvedSource = bun.jsc.ResolvedSource; const VirtualMachine = bun.jsc.VirtualMachine; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; diff --git a/src/jsc/BuildMessage.zig b/src/jsc/BuildMessage.zig index d5b1c9c311c..5fb4885c6a8 100644 --- a/src/jsc/BuildMessage.zig +++ b/src/jsc/BuildMessage.zig @@ -32,7 +32,7 @@ pub const BuildMessage = struct { const text = std.fmt.allocPrint(default_allocator, "BuildMessage: {s}", .{this.msg.data.text}) catch { return globalThis.throwOutOfMemoryValue(); }; - var str = ZigString.init(text); + var str = RustString.init(text); str.setOutputEncoding(); if (str.isUTF8()) { const out = str.toJS(globalThis); @@ -79,7 +79,7 @@ pub const BuildMessage = struct { return jsc.JSValue.jsNull(); } - const str = try args[0].getZigString(globalThis); + const str = try args[0].getRustString(globalThis); if (str.eqlComptime("default") or str.eqlComptime("string")) { return this.toStringFn(globalThis); } @@ -94,10 +94,10 @@ pub const BuildMessage = struct { _: *jsc.CallFrame, ) bun.JSError!jsc.JSValue { var object = jsc.JSValue.createEmptyObject(globalThis, 4); - object.put(globalThis, ZigString.static("name"), try bun.String.static("BuildMessage").toJS(globalThis)); - object.put(globalThis, ZigString.static("position"), this.getPosition(globalThis)); - object.put(globalThis, ZigString.static("message"), this.getMessage(globalThis)); - object.put(globalThis, ZigString.static("level"), this.getLevel(globalThis)); + object.put(globalThis, RustString.static("name"), try bun.String.static("BuildMessage").toJS(globalThis)); + object.put(globalThis, RustString.static("position"), this.getPosition(globalThis)); + object.put(globalThis, RustString.static("message"), this.getMessage(globalThis)); + object.put(globalThis, RustString.static("level"), this.getLevel(globalThis)); return object; } @@ -107,37 +107,37 @@ pub const BuildMessage = struct { object.put( globalThis, - ZigString.static("lineText"), - ZigString.init(location.line_text orelse "").toJS(globalThis), + RustString.static("lineText"), + RustString.init(location.line_text orelse "").toJS(globalThis), ); object.put( globalThis, - ZigString.static("file"), - ZigString.init(location.file).toJS(globalThis), + RustString.static("file"), + RustString.init(location.file).toJS(globalThis), ); object.put( globalThis, - ZigString.static("namespace"), - ZigString.init(location.namespace).toJS(globalThis), + RustString.static("namespace"), + RustString.init(location.namespace).toJS(globalThis), ); object.put( globalThis, - ZigString.static("line"), + RustString.static("line"), JSValue.jsNumber(location.line), ); object.put( globalThis, - ZigString.static("column"), + RustString.static("column"), JSValue.jsNumber(location.column), ); object.put( globalThis, - ZigString.static("length"), + RustString.static("length"), JSValue.jsNumber(location.length), ); object.put( globalThis, - ZigString.static("offset"), + RustString.static("offset"), JSValue.jsNumber(location.offset), ); @@ -172,14 +172,14 @@ pub const BuildMessage = struct { this: *BuildMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.data.text).toJS(globalThis); + return RustString.init(this.msg.data.text).toJS(globalThis); } pub fn getLevel( this: *BuildMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.kind.string()).toJS(globalThis); + return RustString.init(this.msg.kind.string()).toJS(globalThis); } pub fn finalize(this: *BuildMessage) void { @@ -191,7 +191,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.rust").Resolver; const bun = @import("bun"); const default_allocator = bun.default_allocator; @@ -200,4 +200,4 @@ const logger = bun.logger; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/CallFrame.zig b/src/jsc/CallFrame.zig index e38650a31c1..640f09e4ff4 100644 --- a/src/jsc/CallFrame.zig +++ b/src/jsc/CallFrame.zig @@ -297,7 +297,7 @@ pub const CallFrame = opaque { const bun = @import("bun"); const std = @import("std"); -const VM = @import("./VM.zig").VM; +const VM = @import("./VM.rust").VM; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/CommonStrings.zig b/src/jsc/CommonStrings.zig index 86b021ad9e1..be087b419b8 100644 --- a/src/jsc/CommonStrings.zig +++ b/src/jsc/CommonStrings.zig @@ -4,7 +4,7 @@ pub const CommonStrings = struct { globalObject: *jsc.JSGlobalObject, - const CommonStringsForZig = enum(u8) { + const CommonStringsForRust = enum(u8) { IPv4 = 0, IPv6 = 1, IN4Loopback = 2, @@ -19,48 +19,48 @@ pub const CommonStrings = struct { binaryTypeNodeBuffer = 11, binaryTypeUint8Array = 12, - extern "c" fn Bun__CommonStringsForZig__toJS(commonString: CommonStringsForZig, globalObject: *jsc.JSGlobalObject) jsc.JSValue; - pub const toJS = Bun__CommonStringsForZig__toJS; + extern "c" fn Bun__CommonStringsForRust__toJS(commonString: CommonStringsForRust, globalObject: *jsc.JSGlobalObject) jsc.JSValue; + pub const toJS = Bun__CommonStringsForRust__toJS; }; pub inline fn IPv4(this: CommonStrings) JSValue { - return CommonStringsForZig.IPv4.toJS(this.globalObject); + return CommonStringsForRust.IPv4.toJS(this.globalObject); } pub inline fn IPv6(this: CommonStrings) JSValue { - return CommonStringsForZig.IPv6.toJS(this.globalObject); + return CommonStringsForRust.IPv6.toJS(this.globalObject); } pub inline fn @"127.0.0.1"(this: CommonStrings) JSValue { - return CommonStringsForZig.IN4Loopback.toJS(this.globalObject); + return CommonStringsForRust.IN4Loopback.toJS(this.globalObject); } pub inline fn @"::"(this: CommonStrings) JSValue { - return CommonStringsForZig.IN6Any.toJS(this.globalObject); + return CommonStringsForRust.IN6Any.toJS(this.globalObject); } pub inline fn ipv4(this: CommonStrings) JSValue { - return CommonStringsForZig.ipv4Lower.toJS(this.globalObject); + return CommonStringsForRust.ipv4Lower.toJS(this.globalObject); } pub inline fn ipv6(this: CommonStrings) JSValue { - return CommonStringsForZig.ipv6Lower.toJS(this.globalObject); + return CommonStringsForRust.ipv6Lower.toJS(this.globalObject); } pub inline fn default(this: CommonStrings) JSValue { - return CommonStringsForZig.fetchDefault.toJS(this.globalObject); + return CommonStringsForRust.fetchDefault.toJS(this.globalObject); } pub inline fn @"error"(this: CommonStrings) JSValue { - return CommonStringsForZig.fetchError.toJS(this.globalObject); + return CommonStringsForRust.fetchError.toJS(this.globalObject); } pub inline fn include(this: CommonStrings) JSValue { - return CommonStringsForZig.fetchInclude.toJS(this.globalObject); + return CommonStringsForRust.fetchInclude.toJS(this.globalObject); } pub inline fn buffer(this: CommonStrings) JSValue { - return CommonStringsForZig.buffer.toJS(this.globalObject); + return CommonStringsForRust.buffer.toJS(this.globalObject); } pub inline fn arraybuffer(this: CommonStrings) JSValue { - return CommonStringsForZig.binaryTypeArrayBuffer.toJS(this.globalObject); + return CommonStringsForRust.binaryTypeArrayBuffer.toJS(this.globalObject); } pub inline fn nodebuffer(this: CommonStrings) JSValue { - return CommonStringsForZig.binaryTypeNodeBuffer.toJS(this.globalObject); + return CommonStringsForRust.binaryTypeNodeBuffer.toJS(this.globalObject); } pub inline fn uint8array(this: CommonStrings) JSValue { - return CommonStringsForZig.binaryTypeUint8Array.toJS(this.globalObject); + return CommonStringsForRust.binaryTypeUint8Array.toJS(this.globalObject); } }; diff --git a/src/jsc/ConsoleObject.zig b/src/jsc/ConsoleObject.zig index efd2f3f991d..3509cc6e469 100644 --- a/src/jsc/ConsoleObject.zig +++ b/src/jsc/ConsoleObject.zig @@ -671,17 +671,17 @@ pub const TablePrinter = struct { }; pub fn writeTrace(comptime Writer: type, writer: Writer, global: *JSGlobalObject) void { - var holder = ZigException.Holder.init(); + var holder = RustException.Holder.init(); var vm = VirtualMachine.get(); defer holder.deinit(vm); - const exception = holder.zigException(); + const exception = holder.rustException(); - var source_code_slice: ?ZigString.Slice = null; + var source_code_slice: ?RustString.Slice = null; defer if (source_code_slice) |slice| slice.deinit(); - var err = ZigString.init("trace output").toErrorInstance(global); - err.toZigException(global, exception); - vm.remapZigException( + var err = RustString.init("trace output").toErrorInstance(global); + err.toRustException(global, exception); + vm.remapRustException( exception, err, null, @@ -1041,12 +1041,12 @@ pub const Formatter = struct { this.estimated_line_length +|= len; } - pub const ZigFormatter = struct { + pub const RustFormatter = struct { formatter: *ConsoleObject.Formatter, value: JSValue, pub const WriteError = error{UhOh}; - pub fn format(self: ZigFormatter, writer: *std.Io.Writer) std.Io.Writer.Error!void { + pub fn format(self: RustFormatter, writer: *std.Io.Writer) std.Io.Writer.Error!void { self.formatter.remaining_values = &[_]JSValue{self.value}; defer { self.formatter.remaining_values = &[_]JSValue{}; @@ -1064,7 +1064,7 @@ pub const Formatter = struct { // For detecting circular references pub const Visited = struct { - const ObjectPool = @import("../collections/pool.zig").ObjectPool; + const ObjectPool = @import("../collections/pool.rust").ObjectPool; pub const Map = std.AutoHashMap(JSValue, void); pub const Pool = ObjectPool( Map, @@ -1302,10 +1302,10 @@ pub const Formatter = struct { if (js_type.isObject() and js_type != .ProxyObject) { if (try value.getOwnTruthy(globalThis, "$$typeof")) |typeof_symbol| { // React 18 and below - var react_element_legacy = ZigString.init("react.element"); + var react_element_legacy = RustString.init("react.element"); // For React 19 - https://github.com/oven-sh/bun/issues/17223 - var react_element_transitional = ZigString.init("react.transitional.element"); - var react_fragment = ZigString.init("react.fragment"); + var react_element_transitional = RustString.init("react.transitional.element"); + var react_fragment = RustString.init("react.fragment"); if (try typeof_symbol.isSameValue(.symbolFor(globalThis, &react_element_legacy), globalThis) or try typeof_symbol.isSameValue(.symbolFor(globalThis, &react_element_transitional), globalThis) or @@ -1738,7 +1738,7 @@ pub const Formatter = struct { }; } - pub inline fn writeString(self: *@This(), str: ZigString) void { + pub inline fn writeString(self: *@This(), str: RustString) void { self.print("{f}", .{str}); } @@ -1920,7 +1920,7 @@ pub const Formatter = struct { pub fn forEach( globalThis: *JSGlobalObject, ctx_ptr: ?*anyopaque, - key: *ZigString, + key: *RustString, value: JSValue, is_symbol: bool, is_private_symbol: bool, @@ -2042,13 +2042,13 @@ pub const Formatter = struct { }; } - fn getObjectName(globalThis: *jsc.JSGlobalObject, value: JSValue) bun.JSError!?ZigString { - var name_str = ZigString.init(""); + fn getObjectName(globalThis: *jsc.JSGlobalObject, value: JSValue) bun.JSError!?RustString { + var name_str = RustString.init(""); try value.getClassName(globalThis, &name_str); if (!name_str.eqlComptime("Object")) { return name_str; } else if (value.getPrototype(globalThis).eqlValue(JSValue.null)) { - return ZigString.static("[Object: null prototype]").*; + return RustString.static("[Object: null prototype]").*; } return null; } @@ -2219,18 +2219,18 @@ pub const Formatter = struct { writer.print(comptime Output.prettyFmt("{d}", enable_ansi_colors), .{int}); }, .BigInt => { - const out_str = (try value.getZigString(this.globalThis)).slice(); + const out_str = (try value.getRustString(this.globalThis)).slice(); this.addForNewLine(out_str.len); writer.print(comptime Output.prettyFmt("{s}n", enable_ansi_colors), .{out_str}); }, .Double => { if (value.isCell()) { - var number_name = ZigString.Empty; + var number_name = RustString.Empty; try value.getClassName(this.globalThis, &number_name); - var number_value = ZigString.Empty; - try value.toZigString(&number_value, this.globalThis); + var number_value = RustString.Empty; + try value.toRustString(&number_value, this.globalThis); if (!strings.eqlComptime(number_name.slice(), "Number")) { this.addForNewLine(number_name.len + number_value.len + "[Number ():]".len); @@ -2726,10 +2726,10 @@ pub const Formatter = struct { }, .Boolean => { if (value.isCell()) { - var bool_name = ZigString.Empty; + var bool_name = RustString.Empty; try value.getClassName(this.globalThis, &bool_name); - var bool_value = ZigString.Empty; - try value.toZigString(&bool_value, this.globalThis); + var bool_value = RustString.Empty; + try value.toRustString(&bool_value, this.globalThis); if (!strings.eqlComptime(bool_name.slice(), "Boolean")) { this.addForNewLine(bool_value.len + bool_name.len + "[Boolean (): ]".len); @@ -3080,9 +3080,9 @@ pub const Formatter = struct { writer.writeAll("<"); var needs_space = false; - var tag_name_str = ZigString.init(""); + var tag_name_str = RustString.init(""); - var tag_name_slice: ZigString.Slice = ZigString.Slice.empty; + var tag_name_slice: RustString.Slice = RustString.Slice.empty; var is_tag_kind_primitive = false; defer if (tag_name_slice.isAllocated()) tag_name_slice.deinit(); @@ -3094,21 +3094,21 @@ pub const Formatter = struct { }); if (_tag.cell == .Symbol) {} else if (_tag.cell.isStringLike()) { - try type_value.toZigString(&tag_name_str, this.globalThis); + try type_value.toRustString(&tag_name_str, this.globalThis); is_tag_kind_primitive = true; } else if (_tag.cell.isObject() or type_value.isCallable()) { try type_value.getNameProperty(this.globalThis, &tag_name_str); if (tag_name_str.len == 0) { - tag_name_str = ZigString.init("NoName"); + tag_name_str = RustString.init("NoName"); } } else { - try type_value.toZigString(&tag_name_str, this.globalThis); + try type_value.toRustString(&tag_name_str, this.globalThis); } tag_name_slice = tag_name_str.toSlice(default_allocator); needs_space = true; } else { - tag_name_slice = ZigString.init("unknown").toSlice(default_allocator); + tag_name_slice = RustString.init("unknown").toSlice(default_allocator); needs_space = true; } @@ -3225,7 +3225,7 @@ pub const Formatter = struct { print_children: { switch (tag.tag) { .String => { - const children_string = try children.getZigString(this.globalThis); + const children_string = try children.getRustString(this.globalThis); if (children_string.len == 0) break :print_children; if (comptime enable_ansi_colors) writer.writeAll(comptime Output.prettyFmt("", true)); @@ -3811,8 +3811,8 @@ comptime { const string = []const u8; const std = @import("std"); -const CLI = @import("../runtime/cli/cli.zig").Command; -const JestPrettyFormat = @import("../runtime/test_runner/pretty_format.zig").JestPrettyFormat; +const CLI = @import("../runtime/cli/cli.rust").Command; +const JestPrettyFormat = @import("../runtime/test_runner/pretty_format.rust").JestPrettyFormat; const bun = @import("bun"); const Environment = bun.Environment; @@ -3829,5 +3829,5 @@ const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigException = jsc.ZigException; -const ZigString = jsc.ZigString; +const RustException = jsc.RustException; +const RustString = jsc.RustString; diff --git a/src/jsc/DOMFormData.zig b/src/jsc/DOMFormData.zig index 4c6d6f0a605..5f47f07d18a 100644 --- a/src/jsc/DOMFormData.zig +++ b/src/jsc/DOMFormData.zig @@ -1,11 +1,11 @@ pub const DOMFormData = opaque { extern fn WebCore__DOMFormData__cast_(JSValue0: JSValue, arg1: *VM) ?*DOMFormData; extern fn WebCore__DOMFormData__create(arg0: *JSGlobalObject) JSValue; - extern fn WebCore__DOMFormData__createFromURLQuery(arg0: *JSGlobalObject, arg1: *ZigString) JSValue; - extern fn WebCore__DOMFormData__toQueryString(arg0: *DOMFormData, arg1: *anyopaque, arg2: *const fn (arg0: *anyopaque, *ZigString) callconv(.c) void) void; + extern fn WebCore__DOMFormData__createFromURLQuery(arg0: *JSGlobalObject, arg1: *RustString) JSValue; + extern fn WebCore__DOMFormData__toQueryString(arg0: *DOMFormData, arg1: *anyopaque, arg2: *const fn (arg0: *anyopaque, *RustString) callconv(.c) void) void; extern fn WebCore__DOMFormData__fromJS(JSValue0: JSValue) ?*DOMFormData; - extern fn WebCore__DOMFormData__append(arg0: *DOMFormData, arg1: *ZigString, arg2: *ZigString) void; - extern fn WebCore__DOMFormData__appendBlob(arg0: *DOMFormData, arg1: *JSGlobalObject, arg2: *ZigString, arg3: *anyopaque, arg4: *ZigString) void; + extern fn WebCore__DOMFormData__append(arg0: *DOMFormData, arg1: *RustString, arg2: *RustString) void; + extern fn WebCore__DOMFormData__appendBlob(arg0: *DOMFormData, arg1: *JSGlobalObject, arg2: *RustString, arg3: *anyopaque, arg4: *RustString) void; extern fn WebCore__DOMFormData__count(arg0: *DOMFormData) usize; pub fn create( @@ -16,7 +16,7 @@ pub const DOMFormData = opaque { pub fn createFromURLQuery( global: *JSGlobalObject, - query: *ZigString, + query: *RustString, ) JSValue { return WebCore__DOMFormData__createFromURLQuery(global, query); } @@ -24,18 +24,18 @@ pub const DOMFormData = opaque { extern fn DOMFormData__toQueryString( *DOMFormData, ctx: *anyopaque, - callback: *const fn (ctx: *anyopaque, *ZigString) callconv(.c) void, + callback: *const fn (ctx: *anyopaque, *RustString) callconv(.c) void, ) void; pub fn toQueryString( this: *DOMFormData, comptime Ctx: type, ctx: Ctx, - comptime callback: fn (ctx: Ctx, ZigString) callconv(.c) void, + comptime callback: fn (ctx: Ctx, RustString) callconv(.c) void, ) void { const Wrapper = struct { const cb = callback; - pub fn run(c: *anyopaque, str: *ZigString) callconv(.c) void { + pub fn run(c: *anyopaque, str: *RustString) callconv(.c) void { cb(@as(Ctx, @ptrCast(c)), str.*); } }; @@ -49,8 +49,8 @@ pub const DOMFormData = opaque { pub fn append( this: *DOMFormData, - name_: *ZigString, - value_: *ZigString, + name_: *RustString, + value_: *RustString, ) void { WebCore__DOMFormData__append(this, name_, value_); } @@ -58,9 +58,9 @@ pub const DOMFormData = opaque { pub fn appendBlob( this: *DOMFormData, global: *jsc.JSGlobalObject, - name_: *ZigString, + name_: *RustString, blob: *anyopaque, - filename_: *ZigString, + filename_: *RustString, ) void { return WebCore__DOMFormData__appendBlob(this, global, name_, blob, filename_); } @@ -73,43 +73,43 @@ pub const DOMFormData = opaque { const ForEachFunction = *const fn ( ctx_ptr: ?*anyopaque, - name: *ZigString, + name: *RustString, value_ptr: *anyopaque, - filename: ?*ZigString, + filename: ?*RustString, is_blob: u8, ) callconv(.c) void; extern fn DOMFormData__forEach(*DOMFormData, ?*anyopaque, ForEachFunction) void; pub const FormDataEntry = union(enum) { - string: ZigString, + string: RustString, file: struct { blob: *jsc.WebCore.Blob, - filename: ZigString, + filename: RustString, }, }; pub fn forEach( this: *DOMFormData, comptime Context: type, ctx: *Context, - comptime callback_wrapper: *const fn (ctx: *Context, name: ZigString, value: FormDataEntry) void, + comptime callback_wrapper: *const fn (ctx: *Context, name: RustString, value: FormDataEntry) void, ) void { const Wrap = struct { const wrapper = callback_wrapper; pub fn forEachWrapper( ctx_ptr: ?*anyopaque, - name_: *ZigString, + name_: *RustString, value_ptr: *anyopaque, - filename: ?*ZigString, + filename: ?*RustString, is_blob: u8, ) callconv(.c) void { const ctx_ = bun.cast(*Context, ctx_ptr.?); const value = if (is_blob == 0) - FormDataEntry{ .string = bun.cast(*ZigString, value_ptr).* } + FormDataEntry{ .string = bun.cast(*RustString, value_ptr).* } else FormDataEntry{ .file = .{ .blob = bun.cast(*jsc.WebCore.Blob, value_ptr), - .filename = (filename orelse &ZigString.Empty).*, + .filename = (filename orelse &RustString.Empty).*, }, }; @@ -127,4 +127,4 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VM = jsc.VM; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/DOMURL.zig b/src/jsc/DOMURL.zig index 75f98e8c1fd..6cedd3f77f3 100644 --- a/src/jsc/DOMURL.zig +++ b/src/jsc/DOMURL.zig @@ -9,12 +9,12 @@ pub const DOMURL = opaque { return cast_(value, jsc.VirtualMachine.get().global.vm()); } - pub fn href_(this: *DOMURL, out: *ZigString) void { + pub fn href_(this: *DOMURL, out: *RustString) void { return bun.cpp.WebCore__DOMURL__href_(this, out); } - pub fn href(this: *DOMURL) ZigString { - var out = ZigString.Empty; + pub fn href(this: *DOMURL) RustString { + var out = RustString.Empty; this.href_(&out); return out; } @@ -38,12 +38,12 @@ pub const DOMURL = opaque { return path; } - pub fn pathname_(this: *DOMURL, out: *ZigString) void { + pub fn pathname_(this: *DOMURL, out: *RustString) void { return bun.cpp.WebCore__DOMURL__pathname_(this, out); } - pub fn pathname(this: *DOMURL) ZigString { - var out = ZigString.Empty; + pub fn pathname(this: *DOMURL) RustString { + var out = RustString.Empty; this.pathname_(&out); return out; } @@ -55,4 +55,4 @@ const String = bun.String; const jsc = bun.jsc; const JSValue = jsc.JSValue; const VM = jsc.VM; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/Debugger.zig b/src/jsc/Debugger.zig index c49d3c592ad..e46e170d00a 100644 --- a/src/jsc/Debugger.zig +++ b/src/jsc/Debugger.zig @@ -461,7 +461,7 @@ pub const LifecycleAgent = struct { pub const Handle = opaque { extern "c" fn Bun__LifecycleAgentReportReload(agent: *Handle) void; - extern "c" fn Bun__LifecycleAgentReportError(agent: *Handle, exception: *ZigException) void; + extern "c" fn Bun__LifecycleAgentReportError(agent: *Handle, exception: *RustException) void; extern "c" fn Bun__LifecycleAgentPreventExit(agent: *Handle) void; extern "c" fn Bun__LifecycleAgentStopPreventingExit(agent: *Handle) void; @@ -478,7 +478,7 @@ pub const LifecycleAgent = struct { Bun__LifecycleAgentReportReload(this); } - pub fn reportError(this: *Handle, exception: *ZigException) void { + pub fn reportError(this: *Handle, exception: *RustException) void { debug("reportError", .{}); Bun__LifecycleAgentReportError(this, exception); } @@ -505,7 +505,7 @@ pub const LifecycleAgent = struct { } } - pub fn reportError(this: *LifecycleAgent, exception: *ZigException) void { + pub fn reportError(this: *LifecycleAgent, exception: *RustException) void { if (this.handle) |handle| { handle.reportError(exception); } @@ -517,10 +517,10 @@ pub const LifecycleAgent = struct { }; pub const DebuggerId = bun.GenericIndex(i32, Debugger); -pub const BunFrontendDevServerAgent = @import("../runtime/server/InspectorBunFrontendDevServerAgent.zig").BunFrontendDevServerAgent; -pub const HTTPServerAgent = @import("./HTTPServerAgent.zig"); +pub const BunFrontendDevServerAgent = @import("../runtime/server/InspectorBunFrontendDevServerAgent.rust").BunFrontendDevServerAgent; +pub const HTTPServerAgent = @import("./HTTPServerAgent.rust"); -const DotEnv = @import("../dotenv/env_loader.zig"); +const DotEnv = @import("../dotenv/env_loader.rust"); const std = @import("std"); const bun = @import("bun"); @@ -532,4 +532,4 @@ const jsc = bun.jsc; const Debugger = jsc.Debugger; const JSGlobalObject = jsc.JSGlobalObject; const VirtualMachine = jsc.VirtualMachine; -const ZigException = jsc.ZigException; +const RustException = jsc.RustException; diff --git a/src/jsc/DecodedJSValue.zig b/src/jsc/DecodedJSValue.zig index e2291025490..d81818cc820 100644 --- a/src/jsc/DecodedJSValue.zig +++ b/src/jsc/DecodedJSValue.zig @@ -45,5 +45,5 @@ comptime { } const bun = @import("bun"); -const ffi = @import("./FFI.zig"); +const ffi = @import("./FFI.rust"); const jsc = bun.bun_js.jsc; diff --git a/src/jsc/DeferredError.zig b/src/jsc/DeferredError.zig index 17c3e0987e3..da9be6e0756 100644 --- a/src/jsc/DeferredError.zig +++ b/src/jsc/DeferredError.zig @@ -21,13 +21,13 @@ pub const DeferredError = struct { .typeerror => this.msg.toTypeErrorInstance(globalThis), .rangeerror => this.msg.toRangeErrorInstance(globalThis), }; - err.put(globalThis, ZigString.static("code"), ZigString.init(@tagName(this.code)).toJS(globalThis)); + err.put(globalThis, RustString.static("code"), RustString.init(@tagName(this.code)).toJS(globalThis)); return err; } }; const bun = @import("bun"); -const ZigString = @import("./ZigString.zig").ZigString; +const RustString = @import("./RustString.rust").RustString; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/ErrorCode.zig b/src/jsc/ErrorCode.zig index c37a28819b9..16d2e3b716f 100644 --- a/src/jsc/ErrorCode.zig +++ b/src/jsc/ErrorCode.zig @@ -18,6 +18,6 @@ pub const ErrorCode = enum(ErrorCodeInt) { }; comptime { - @export(&ErrorCode.ParserError, .{ .name = "Zig_ErrorCodeParserError" }); - @export(&ErrorCode.JSErrorObject, .{ .name = "Zig_ErrorCodeJSErrorObject" }); + @export(&ErrorCode.ParserError, .{ .name = "Rust_ErrorCodeParserError" }); + @export(&ErrorCode.JSErrorObject, .{ .name = "Rust_ErrorCodeJSErrorObject" }); } diff --git a/src/jsc/Errorable.zig b/src/jsc/Errorable.zig index bc9b22cc6c3..48fa918d55b 100644 --- a/src/jsc/Errorable.zig +++ b/src/jsc/Errorable.zig @@ -5,7 +5,7 @@ pub fn Errorable(comptime Type: type) type { pub const Result = extern union { value: Type, - err: ZigErrorType, + err: RustErrorType, }; pub fn unwrap(errorable: @This()) !Type { @@ -39,5 +39,5 @@ pub fn Errorable(comptime Type: type) type { } const bun = @import("bun"); -const ErrorCode = @import("./ErrorCode.zig").ErrorCode; -const ZigErrorType = @import("./ZigErrorType.zig").ZigErrorType; +const ErrorCode = @import("./ErrorCode.rust").ErrorCode; +const RustErrorType = @import("./RustErrorType.rust").RustErrorType; diff --git a/src/jsc/Exception.zig b/src/jsc/Exception.zig index 7b45f2ff7c6..db9ab822276 100644 --- a/src/jsc/Exception.zig +++ b/src/jsc/Exception.zig @@ -1,9 +1,9 @@ /// Opaque representation of a JavaScript exception pub const Exception = opaque { - extern fn JSC__Exception__getStackTrace(this: *Exception, global: *JSGlobalObject, stack: *ZigStackTrace) void; + extern fn JSC__Exception__getStackTrace(this: *Exception, global: *JSGlobalObject, stack: *RustStackTrace) void; extern fn JSC__Exception__asJSValue(this: *Exception) JSValue; - pub fn getStackTrace(this: *Exception, global: *JSGlobalObject, stack: *ZigStackTrace) void { + pub fn getStackTrace(this: *Exception, global: *JSGlobalObject, stack: *RustStackTrace) void { JSC__Exception__getStackTrace(this, global, stack); } @@ -13,7 +13,7 @@ pub const Exception = opaque { }; const bun = @import("bun"); -const ZigStackTrace = @import("./ZigStackTrace.zig").ZigStackTrace; +const RustStackTrace = @import("./RustStackTrace.rust").RustStackTrace; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/FFI.zig b/src/jsc/FFI.zig index f0917695927..bc27d4fd80f 100644 --- a/src/jsc/FFI.zig +++ b/src/jsc/FFI.zig @@ -1,4 +1,4 @@ -// This is zig translate-c run on ffi.h +// This is rust translate-c run on ffi.h // it turns out: FFI.h is faster than our implementation that calls into C++ bindings // so we just use this in some cases pub const @"bool" = bool; @@ -173,17 +173,17 @@ pub const __LP64__ = @as(c_int, 1); pub const __CHAR_BIT__ = @as(c_int, 8); pub const __SCHAR_MAX__ = @as(c_int, 127); pub const __SHRT_MAX__ = @as(c_int, 32767); -pub const __INT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); -pub const __LONG_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __INT_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __LONG_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __LONG_LONG_MAX__ = @as(c_longlong, 9223372036854775807); -pub const __WCHAR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); -pub const __WINT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); -pub const __INTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); -pub const __SIZE_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); -pub const __UINTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); -pub const __PTRDIFF_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); -pub const __INTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); -pub const __UINTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __WCHAR_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __WINT_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __INTMAX_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __SIZE_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __UINTMAX_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __PTRDIFF_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __INTPTR_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __UINTPTR_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __SIZEOF_DOUBLE__ = @as(c_int, 8); pub const __SIZEOF_FLOAT__ = @as(c_int, 4); pub const __SIZEOF_INT__ = @as(c_int, 4); @@ -225,7 +225,7 @@ pub const __WCHAR_WIDTH__ = @as(c_int, 32); pub const __WINT_TYPE__ = c_int; pub const __WINT_WIDTH__ = @as(c_int, 32); pub const __SIG_ATOMIC_WIDTH__ = @as(c_int, 32); -pub const __SIG_ATOMIC_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __SIG_ATOMIC_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __CHAR16_TYPE__ = c_ushort; pub const __CHAR32_TYPE__ = c_uint; pub const __UINTMAX_WIDTH__ = @as(c_int, 64); @@ -318,15 +318,15 @@ pub const __UINT16_FMTu__ = "hu"; pub const __UINT16_FMTx__ = "hx"; pub const __UINT16_FMTX__ = "hX"; pub const __UINT16_C_SUFFIX__ = ""; -pub const __UINT16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __UINT16_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __INT16_MAX__ = @as(c_int, 32767); pub const __UINT32_TYPE__ = c_uint; pub const __UINT32_FMTo__ = "o"; pub const __UINT32_FMTu__ = "u"; pub const __UINT32_FMTx__ = "x"; pub const __UINT32_FMTX__ = "X"; -pub const __UINT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); -pub const __INT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __UINT32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __INT32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __UINT64_TYPE__ = c_ulonglong; pub const __UINT64_FMTo__ = "llo"; pub const __UINT64_FMTu__ = "llu"; @@ -349,17 +349,17 @@ pub const __INT_LEAST16_MAX__ = @as(c_int, 32767); pub const __INT_LEAST16_FMTd__ = "hd"; pub const __INT_LEAST16_FMTi__ = "hi"; pub const __UINT_LEAST16_TYPE__ = c_ushort; -pub const __UINT_LEAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __UINT_LEAST16_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_LEAST16_FMTo__ = "ho"; pub const __UINT_LEAST16_FMTu__ = "hu"; pub const __UINT_LEAST16_FMTx__ = "hx"; pub const __UINT_LEAST16_FMTX__ = "hX"; pub const __INT_LEAST32_TYPE__ = c_int; -pub const __INT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __INT_LEAST32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_LEAST32_FMTd__ = "d"; pub const __INT_LEAST32_FMTi__ = "i"; pub const __UINT_LEAST32_TYPE__ = c_uint; -pub const __UINT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __UINT_LEAST32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_LEAST32_FMTo__ = "o"; pub const __UINT_LEAST32_FMTu__ = "u"; pub const __UINT_LEAST32_FMTx__ = "x"; @@ -389,17 +389,17 @@ pub const __INT_FAST16_MAX__ = @as(c_int, 32767); pub const __INT_FAST16_FMTd__ = "hd"; pub const __INT_FAST16_FMTi__ = "hi"; pub const __UINT_FAST16_TYPE__ = c_ushort; -pub const __UINT_FAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __UINT_FAST16_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_FAST16_FMTo__ = "ho"; pub const __UINT_FAST16_FMTu__ = "hu"; pub const __UINT_FAST16_FMTx__ = "hx"; pub const __UINT_FAST16_FMTX__ = "hX"; pub const __INT_FAST32_TYPE__ = c_int; -pub const __INT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __INT_FAST32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_FAST32_FMTd__ = "d"; pub const __INT_FAST32_FMTi__ = "i"; pub const __UINT_FAST32_TYPE__ = c_uint; -pub const __UINT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __UINT_FAST32_MAX__ = @import("std").rust.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_FAST32_FMTo__ = "o"; pub const __UINT_FAST32_FMTu__ = "u"; pub const __UINT_FAST32_FMTx__ = "x"; @@ -498,7 +498,7 @@ pub const __STDC_NO_THREADS__ = @as(c_int, 1); pub const __strong = ""; pub const __unsafe_unretained = ""; pub const __DYNAMIC__ = @as(c_int, 1); -pub const __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120400, .decimal); +pub const __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = @import("std").rust.c_translation.promoteIntLiteral(c_int, 120400, .decimal); pub const __MACH__ = @as(c_int, 1); pub const __STDC__ = @as(c_int, 1); pub const __STDC_HOSTED__ = @as(c_int, 1); @@ -522,9 +522,9 @@ pub const TagValueTrue = (OtherTag | BoolTag) | @"true"; pub const TagValueUndefined = OtherTag | UndefinedTag; pub const TagValueNull = OtherTag; pub const NotCellMask = NumberTag | OtherTag; -pub const MAX_INT32 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483648, .decimal); -pub const MAX_INT52 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 9007199254740991, .decimal); -pub const NumberTag = @import("std").zig.c_translation.promoteIntLiteral(c_longlong, 0xfffe000000000000, .hex); +pub const MAX_INT32 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 2147483648, .decimal); +pub const MAX_INT52 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 9007199254740991, .decimal); +pub const NumberTag = @import("std").rust.c_translation.promoteIntLiteral(c_longlong, 0xfffe000000000000, .hex); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/jsc/FetchHeaders.zig b/src/jsc/FetchHeaders.zig index 2428f2e8d27..2b876c297cf 100644 --- a/src/jsc/FetchHeaders.zig +++ b/src/jsc/FetchHeaders.zig @@ -1,5 +1,5 @@ pub const FetchHeaders = opaque { - extern fn WebCore__FetchHeaders__append(arg0: *FetchHeaders, arg1: *const ZigString, arg2: *const ZigString, arg3: *JSGlobalObject) void; + extern fn WebCore__FetchHeaders__append(arg0: *FetchHeaders, arg1: *const RustString, arg2: *const RustString, arg3: *JSGlobalObject) void; extern fn WebCore__FetchHeaders__cast_(JSValue0: JSValue, arg1: *VM) ?*FetchHeaders; extern fn WebCore__FetchHeaders__clone(arg0: *FetchHeaders, arg1: *JSGlobalObject) JSValue; extern fn WebCore__FetchHeaders__cloneThis(arg0: *FetchHeaders, arg1: *JSGlobalObject) *FetchHeaders; @@ -8,17 +8,17 @@ pub const FetchHeaders = opaque { extern fn WebCore__FetchHeaders__createEmpty() *FetchHeaders; extern fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: ?*const anyopaque) *FetchHeaders; extern fn WebCore__FetchHeaders__createFromUWS(arg1: *anyopaque) *FetchHeaders; - extern fn WebCore__FetchHeaders__createValueNotJS(arg0: *JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) ?*FetchHeaders; - extern fn WebCore__FetchHeaders__createValue(arg0: *JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) JSValue; + extern fn WebCore__FetchHeaders__createValueNotJS(arg0: *JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const RustString, arg4: u32) ?*FetchHeaders; + extern fn WebCore__FetchHeaders__createValue(arg0: *JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const RustString, arg4: u32) JSValue; extern fn WebCore__FetchHeaders__deref(arg0: *FetchHeaders) void; - extern fn WebCore__FetchHeaders__fastGet_(arg0: *FetchHeaders, arg1: u8, arg2: [*c]ZigString) void; + extern fn WebCore__FetchHeaders__fastGet_(arg0: *FetchHeaders, arg1: u8, arg2: [*c]RustString) void; extern fn WebCore__FetchHeaders__fastHas_(arg0: *FetchHeaders, arg1: u8) bool; extern fn WebCore__FetchHeaders__fastRemove_(arg0: *FetchHeaders, arg1: u8) void; - extern fn WebCore__FetchHeaders__get_(arg0: *FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]ZigString, arg3: *JSGlobalObject) void; - extern fn WebCore__FetchHeaders__has(arg0: *FetchHeaders, arg1: [*c]const ZigString, arg2: *JSGlobalObject) bool; + extern fn WebCore__FetchHeaders__get_(arg0: *FetchHeaders, arg1: [*c]const RustString, arg2: [*c]RustString, arg3: *JSGlobalObject) void; + extern fn WebCore__FetchHeaders__has(arg0: *FetchHeaders, arg1: [*c]const RustString, arg2: *JSGlobalObject) bool; extern fn WebCore__FetchHeaders__isEmpty(arg0: *FetchHeaders) bool; - extern fn WebCore__FetchHeaders__put_(arg0: *FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString, arg3: *JSGlobalObject) void; - extern fn WebCore__FetchHeaders__remove(arg0: *FetchHeaders, arg1: [*c]const ZigString, arg2: *JSGlobalObject) void; + extern fn WebCore__FetchHeaders__put_(arg0: *FetchHeaders, arg1: [*c]const RustString, arg2: [*c]const RustString, arg3: *JSGlobalObject) void; + extern fn WebCore__FetchHeaders__remove(arg0: *FetchHeaders, arg1: [*c]const RustString, arg2: *JSGlobalObject) void; extern fn WebCore__FetchHeaders__toJS(arg0: *FetchHeaders, arg1: *JSGlobalObject) JSValue; extern fn WebCore__FetchHeaders__toUWSResponse(arg0: *FetchHeaders, kind: bun.uws.ResponseKind, arg2: ?*anyopaque) void; extern fn WebCore__FetchHeaders__createFromH3(arg0: *anyopaque) *FetchHeaders; @@ -27,7 +27,7 @@ pub const FetchHeaders = opaque { global: *JSGlobalObject, names: [*c]api.StringPointer, values: [*c]api.StringPointer, - buf: *const ZigString, + buf: *const RustString, count_: u32, ) JSValue { return WebCore__FetchHeaders__createValue( @@ -65,7 +65,7 @@ pub const FetchHeaders = opaque { global: *JSGlobalObject, names: [*c]api.StringPointer, values: [*c]api.StringPointer, - buf: *const ZigString, + buf: *const RustString, count_: u32, ) ?*FetchHeaders { return WebCore__FetchHeaders__createValueNotJS( @@ -81,7 +81,7 @@ pub const FetchHeaders = opaque { global: *JSGlobalObject, names: [*c]api.StringPointer, values: [*c]api.StringPointer, - buf: *const ZigString, + buf: *const RustString, count_: u32, ) JSValue { return WebCore__FetchHeaders__createValue( @@ -152,8 +152,8 @@ pub const FetchHeaders = opaque { pub fn append( this: *FetchHeaders, - name_: *const ZigString, - value: *const ZigString, + name_: *const RustString, + value: *const RustString, global: *JSGlobalObject, ) void { return WebCore__FetchHeaders__append( @@ -164,7 +164,7 @@ pub const FetchHeaders = opaque { ); } - extern fn WebCore__FetchHeaders__put(this: *FetchHeaders, name_: HTTPHeaderName, value: *const ZigString, global: *JSGlobalObject) void; + extern fn WebCore__FetchHeaders__put(this: *FetchHeaders, name_: HTTPHeaderName, value: *const RustString, global: *JSGlobalObject) void; pub fn put( this: *FetchHeaders, @@ -172,13 +172,13 @@ pub const FetchHeaders = opaque { value: []const u8, global: *JSGlobalObject, ) bun.JSError!void { - return bun.jsc.fromJSHostCallGeneric(global, @src(), WebCore__FetchHeaders__put, .{ this, name_, &ZigString.init(value), global }); + return bun.jsc.fromJSHostCallGeneric(global, @src(), WebCore__FetchHeaders__put, .{ this, name_, &RustString.init(value), global }); } pub fn get_( this: *FetchHeaders, - name_: *const ZigString, - out: *ZigString, + name_: *const RustString, + out: *RustString, global: *JSGlobalObject, ) void { WebCore__FetchHeaders__get_( @@ -194,8 +194,8 @@ pub const FetchHeaders = opaque { name_: []const u8, global: *JSGlobalObject, ) ?[]const u8 { - var out = ZigString.Empty; - get_(this, &ZigString.init(name_), &out, global); + var out = RustString.Empty; + get_(this, &RustString.init(name_), &out, global); if (out.len > 0) { return out.slice(); } @@ -205,7 +205,7 @@ pub const FetchHeaders = opaque { pub fn has( this: *FetchHeaders, - name_: *const ZigString, + name_: *const RustString, global: *JSGlobalObject, ) bool { return WebCore__FetchHeaders__has( @@ -225,8 +225,8 @@ pub const FetchHeaders = opaque { pub fn fastGet( this: *FetchHeaders, name_: HTTPHeaderName, - ) ?ZigString { - var str = ZigString.init(""); + ) ?RustString { + var str = RustString.init(""); fastGet_(this, @intFromEnum(name_), &str); if (str.len == 0) { return null; @@ -248,7 +248,7 @@ pub const FetchHeaders = opaque { pub fn fastGet_( this: *FetchHeaders, name_: u8, - str: *ZigString, + str: *RustString, ) void { return WebCore__FetchHeaders__fastGet_( this, @@ -373,7 +373,7 @@ pub const FetchHeaders = opaque { pub fn remove( this: *FetchHeaders, - name_: *const ZigString, + name_: *const RustString, global: *JSGlobalObject, ) void { return WebCore__FetchHeaders__remove( @@ -451,7 +451,7 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VM = jsc.VM; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const api = bun.schema.api; const StringPointer = api.StringPointer; diff --git a/src/jsc/HTTPServerAgent.zig b/src/jsc/HTTPServerAgent.zig index 61a5a86d35b..586d2b08f79 100644 --- a/src/jsc/HTTPServerAgent.zig +++ b/src/jsc/HTTPServerAgent.zig @@ -132,7 +132,7 @@ pub const Route = extern struct { //#endregion -//#region C++ agent reference type for Zig +//#region C++ agent reference type for Rust pub const InspectorHTTPServerAgent = opaque { extern fn Bun__HTTPServerAgent__notifyRequestWillBeSent(agent: *InspectorHTTPServerAgent, requestId: RequestId, serverId: ServerId, routeId: RouteId, url: *const BunString, fullUrl: *const BunString, method: HTTPMethod, headersJson: *const BunString, paramsJson: *const BunString, hasBody: bool, timestamp: f64) void; extern fn Bun__HTTPServerAgent__notifyResponseReceived(agent: *InspectorHTTPServerAgent, requestId: RequestId, serverId: ServerId, statusCode: i32, statusText: *const BunString, headersJson: *const BunString, hasBody: bool, timestamp: f64) void; @@ -155,7 +155,7 @@ pub const InspectorHTTPServerAgent = opaque { //#endregion -//#region Zig -> C++ +//#region Rust -> C++ export fn Bun__HTTPServerAgent__setEnabled(agent: ?*InspectorHTTPServerAgent) void { if (jsc.VirtualMachine.get().debugger) |*debugger| { diff --git a/src/jsc/JSArray.zig b/src/jsc/JSArray.zig index cda9286c810..a23c791b9e2 100644 --- a/src/jsc/JSArray.zig +++ b/src/jsc/JSArray.zig @@ -18,7 +18,7 @@ pub const JSArray = opaque { }; const bun = @import("bun"); -const JSArrayIterator = @import("./JSArrayIterator.zig").JSArrayIterator; +const JSArrayIterator = @import("./JSArrayIterator.rust").JSArrayIterator; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/JSArrayIterator.zig b/src/jsc/JSArrayIterator.zig index 7aa79bae649..fdb8524c2fd 100644 --- a/src/jsc/JSArrayIterator.zig +++ b/src/jsc/JSArrayIterator.zig @@ -45,7 +45,7 @@ pub const JSArrayIterator = struct { }; const bun = @import("bun"); -const JSObject = @import("./JSObject.zig").JSObject; +const JSObject = @import("./JSObject.rust").JSObject; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/JSCell.zig b/src/jsc/JSCell.zig index 42f5db71025..ff2d9082149 100644 --- a/src/jsc/JSCell.zig +++ b/src/jsc/JSCell.zig @@ -56,8 +56,8 @@ pub const JSCell = opaque { const bun = @import("bun"); const std = @import("std"); -const CustomGetterSetter = @import("./CustomGetterSetter.zig").CustomGetterSetter; -const GetterSetter = @import("./GetterSetter.zig").GetterSetter; +const CustomGetterSetter = @import("./CustomGetterSetter.rust").CustomGetterSetter; +const GetterSetter = @import("./GetterSetter.rust").GetterSetter; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/JSFunction.zig b/src/jsc/JSFunction.zig index 4cb565da6a1..b5fdad2d619 100644 --- a/src/jsc/JSFunction.zig +++ b/src/jsc/JSFunction.zig @@ -17,7 +17,7 @@ pub const JSFunction = opaque { constructor: ?*const JSHostFn = null, }; - extern fn JSFunction__createFromZig( + extern fn JSFunction__createFromRust( global: *JSGlobalObject, fn_name: bun.String, implementation: *const JSHostFn, @@ -34,14 +34,14 @@ pub const JSFunction = opaque { function_length: u32, options: CreateJSFunctionOptions, ) JSValue { - return JSFunction__createFromZig( + return JSFunction__createFromRust( global, switch (@TypeOf(fn_name)) { bun.String => fn_name, else => bun.String.init(fn_name), }, switch (@TypeOf(implementation)) { - jsc.JSHostFnZig => jsc.toJSHostFn(implementation), + jsc.JSHostFnRust => jsc.toJSHostFn(implementation), jsc.JSHostFn => implementation, else => @compileError("unexpected function type"), }, @@ -57,10 +57,10 @@ pub const JSFunction = opaque { JSC__JSFunction__optimizeSoon(value); } - extern fn JSC__JSFunction__getSourceCode(value: JSValue, out: *ZigString) bool; + extern fn JSC__JSFunction__getSourceCode(value: JSValue, out: *RustString) bool; pub fn getSourceCode(value: JSValue) ?bun.String { - var str: ZigString = undefined; + var str: RustString = undefined; return if (JSC__JSFunction__getSourceCode(value, &str)) bun.String.init(str) else null; } }; @@ -72,4 +72,4 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSHostFn = jsc.JSHostFn; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/JSGlobalObject.zig b/src/jsc/JSGlobalObject.zig index 5d117d97d32..3ffcdf81ae5 100644 --- a/src/jsc/JSGlobalObject.zig +++ b/src/jsc/JSGlobalObject.zig @@ -55,14 +55,14 @@ pub const JSGlobalObject = opaque { bun.assert(this.hasException()); return error.JSError; } - err.put(this, ZigString.static("name"), (bun.String.static("TODOError").toJS(this)) catch return error.JSError); + err.put(this, RustString.static("name"), (bun.String.static("TODOError").toJS(this)) catch return error.JSError); return this.throwValue(err); } pub const requestTermination = JSGlobalObject__requestTermination; pub const clearTerminationException = JSGlobalObject__clearTerminationException; - pub fn setTimeZone(this: *JSGlobalObject, timeZone: *const ZigString) bool { + pub fn setTimeZone(this: *JSGlobalObject, timeZone: *const RustString) bool { return JSGlobalObject__setTimeZone(this, timeZone); } @@ -294,18 +294,18 @@ pub const JSGlobalObject = opaque { // if an exception occurs in the middle of formatting the error message, it's better to just return the formatting string than an error about an error. // Clear any pending JS exception (e.g. from Symbol.toPrimitive) so that throwValue doesn't hit assertNoException. _ = this.clearExceptionExceptTermination(); - return ZigString.static(fmt).toErrorInstance(this); + return RustString.static(fmt).toErrorInstance(this); }; // Ensure we clone it. - var str = ZigString.initUTF8(buf.written()); + var str = RustString.initUTF8(buf.written()); return str.toErrorInstance(this); } else { if (comptime strings.isAllASCII(fmt)) { return String.static(fmt).toErrorInstance(this); } else { - return ZigString.initUTF8(fmt).toErrorInstance(this); + return RustString.initUTF8(fmt).toErrorInstance(this); } } } @@ -318,12 +318,12 @@ pub const JSGlobalObject = opaque { var writer = buf.writer(); writer.print(fmt, args) catch { _ = this.clearExceptionExceptTermination(); - return ZigString.static(fmt).toTypeErrorInstance(this); + return RustString.static(fmt).toTypeErrorInstance(this); }; - var str = ZigString.fromUTF8(buf.slice()); + var str = RustString.fromUTF8(buf.slice()); return str.toTypeErrorInstance(this); } else { - return ZigString.static(fmt).toTypeErrorInstance(this); + return RustString.static(fmt).toTypeErrorInstance(this); } } @@ -334,10 +334,10 @@ pub const JSGlobalObject = opaque { defer buf.deinit(); var writer = buf.writer(); try writer.print(fmt, args); - var str = ZigString.fromUTF8(buf.slice()); + var str = RustString.fromUTF8(buf.slice()); return str.toDOMExceptionInstance(this, code); } else { - return ZigString.static(fmt).toDOMExceptionInstance(this, code); + return RustString.static(fmt).toDOMExceptionInstance(this, code); } } @@ -349,12 +349,12 @@ pub const JSGlobalObject = opaque { var writer = buf.writer(); writer.print(fmt, args) catch { _ = this.clearExceptionExceptTermination(); - return ZigString.static(fmt).toSyntaxErrorInstance(this); + return RustString.static(fmt).toSyntaxErrorInstance(this); }; - var str = ZigString.fromUTF8(buf.slice()); + var str = RustString.fromUTF8(buf.slice()); return str.toSyntaxErrorInstance(this); } else { - return ZigString.static(fmt).toSyntaxErrorInstance(this); + return RustString.static(fmt).toSyntaxErrorInstance(this); } } @@ -366,12 +366,12 @@ pub const JSGlobalObject = opaque { var writer = buf.writer(); writer.print(fmt, args) catch { _ = this.clearExceptionExceptTermination(); - return ZigString.static(fmt).toRangeErrorInstance(this); + return RustString.static(fmt).toRangeErrorInstance(this); }; - var str = ZigString.fromUTF8(buf.slice()); + var str = RustString.fromUTF8(buf.slice()); return str.toRangeErrorInstance(this); } else { - return ZigString.static(fmt).toRangeErrorInstance(this); + return RustString.static(fmt).toRangeErrorInstance(this); } } @@ -381,7 +381,7 @@ pub const JSGlobalObject = opaque { bun.assert(this.hasException()); return .zero; } - err.put(this, ZigString.static("code"), ZigString.static(@tagName(jsc.Node.ErrorCode.ERR_OUT_OF_RANGE)).toJS(this)); + err.put(this, RustString.static("code"), RustString.static(@tagName(jsc.Node.ErrorCode.ERR_OUT_OF_RANGE)).toJS(this)); return err; } @@ -405,9 +405,9 @@ pub const JSGlobalObject = opaque { bun.assert(this.hasException()); return error.JSError; } - err.put(this, ZigString.static("code"), ZigString.init(@tagName(opts.code)).toJS(this)); - if (opts.name) |name| err.put(this, ZigString.static("name"), ZigString.init(name).toJS(this)); - if (opts.errno) |errno| err.put(this, ZigString.static("errno"), try .fromAny(this, i32, errno)); + err.put(this, RustString.static("code"), RustString.init(@tagName(opts.code)).toJS(this)); + if (opts.name) |name| err.put(this, RustString.static("name"), RustString.init(name).toJS(this)); + if (opts.errno) |errno| err.put(this, RustString.static("errno"), try .fromAny(this, i32, errno)); return this.throwValue(err); } @@ -504,7 +504,7 @@ pub const JSGlobalObject = opaque { const allocator_ = stack.get(); const buffer = try std.fmt.allocPrint(allocator_, comptime "{s} " ++ fmt, .{@errorName(err)}); defer allocator_.free(buffer); - const str = ZigString.initUTF8(buffer); + const str = RustString.initUTF8(buffer); const err_value = str.toErrorInstance(this); return this.throwValue(err_value); } @@ -515,8 +515,8 @@ pub const JSGlobalObject = opaque { } pub const ctx = ref; - extern fn JSC__JSGlobalObject__createAggregateError(*JSGlobalObject, [*]const JSValue, usize, *const ZigString) JSValue; - pub fn createAggregateError(globalObject: *JSGlobalObject, errors: []const JSValue, message: *const ZigString) bun.JSError!JSValue { + extern fn JSC__JSGlobalObject__createAggregateError(*JSGlobalObject, [*]const JSValue, usize, *const RustString) JSValue; + pub fn createAggregateError(globalObject: *JSGlobalObject, errors: []const JSValue, message: *const RustString) bun.JSError!JSValue { return bun.jsc.fromJSHostCall(globalObject, @src(), JSC__JSGlobalObject__createAggregateError, .{ globalObject, errors.ptr, errors.len, message }); } @@ -609,7 +609,7 @@ pub const JSGlobalObject = opaque { return JSC__JSGlobalObject__vm(this); } - pub fn deleteModuleRegistryEntry(this: *JSGlobalObject, name_: *ZigString) bun.JSError!void { + pub fn deleteModuleRegistryEntry(this: *JSGlobalObject, name_: *RustString) bun.JSError!void { return bun.jsc.fromJSHostCallGeneric(this, @src(), JSC__JSGlobalObject__deleteModuleRegistryEntry, .{ this, name_ }); } @@ -665,41 +665,41 @@ pub const JSGlobalObject = opaque { return bun.jsc.fromJSHostCallGeneric(this, @src(), JSC__JSGlobalObject__handleRejectedPromises, .{this}) catch return; } - extern fn ZigGlobalObject__readableStreamToArrayBuffer(*JSGlobalObject, JSValue) JSValue; - extern fn ZigGlobalObject__readableStreamToBytes(*JSGlobalObject, JSValue) JSValue; - extern fn ZigGlobalObject__readableStreamToText(*JSGlobalObject, JSValue) JSValue; - extern fn ZigGlobalObject__readableStreamToJSON(*JSGlobalObject, JSValue) JSValue; - extern fn ZigGlobalObject__readableStreamToFormData(*JSGlobalObject, JSValue, JSValue) JSValue; - extern fn ZigGlobalObject__readableStreamToBlob(*JSGlobalObject, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToArrayBuffer(*JSGlobalObject, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToBytes(*JSGlobalObject, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToText(*JSGlobalObject, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToJSON(*JSGlobalObject, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToFormData(*JSGlobalObject, JSValue, JSValue) JSValue; + extern fn RustGlobalObject__readableStreamToBlob(*JSGlobalObject, JSValue) JSValue; pub fn readableStreamToArrayBuffer(this: *JSGlobalObject, value: JSValue) JSValue { - return ZigGlobalObject__readableStreamToArrayBuffer(this, value); + return RustGlobalObject__readableStreamToArrayBuffer(this, value); } pub fn readableStreamToBytes(this: *JSGlobalObject, value: JSValue) JSValue { - return ZigGlobalObject__readableStreamToBytes(this, value); + return RustGlobalObject__readableStreamToBytes(this, value); } pub fn readableStreamToText(this: *JSGlobalObject, value: JSValue) JSValue { - return ZigGlobalObject__readableStreamToText(this, value); + return RustGlobalObject__readableStreamToText(this, value); } pub fn readableStreamToJSON(this: *JSGlobalObject, value: JSValue) JSValue { - return ZigGlobalObject__readableStreamToJSON(this, value); + return RustGlobalObject__readableStreamToJSON(this, value); } pub fn readableStreamToBlob(this: *JSGlobalObject, value: JSValue) JSValue { - return ZigGlobalObject__readableStreamToBlob(this, value); + return RustGlobalObject__readableStreamToBlob(this, value); } pub fn readableStreamToFormData(this: *JSGlobalObject, value: JSValue, content_type: JSValue) JSValue { - return ZigGlobalObject__readableStreamToFormData(this, value, content_type); + return RustGlobalObject__readableStreamToFormData(this, value, content_type); } - extern fn ZigGlobalObject__makeNapiEnvForFFI(*JSGlobalObject) *napi.NapiEnv; + extern fn RustGlobalObject__makeNapiEnvForFFI(*JSGlobalObject) *napi.NapiEnv; pub fn makeNapiEnvForFFI(this: *JSGlobalObject) *napi.NapiEnv { - return ZigGlobalObject__makeNapiEnvForFFI(this); + return RustGlobalObject__makeNapiEnvForFFI(this); } pub inline fn assertOnJSThread(this: *JSGlobalObject) void { @@ -851,16 +851,16 @@ pub const JSGlobalObject = opaque { extern fn JSC__JSGlobalObject__bunVM(*JSGlobalObject) *VM; extern fn JSC__JSGlobalObject__vm(*JSGlobalObject) *VM; - extern fn JSC__JSGlobalObject__deleteModuleRegistryEntry(*JSGlobalObject, *const ZigString) void; + extern fn JSC__JSGlobalObject__deleteModuleRegistryEntry(*JSGlobalObject, *const RustString) void; extern fn JSGlobalObject__clearException(*JSGlobalObject) void; extern fn JSGlobalObject__clearExceptionExceptTermination(*JSGlobalObject) bool; extern fn JSGlobalObject__clearTerminationException(this: *JSGlobalObject) void; extern fn JSGlobalObject__hasException(*JSGlobalObject) bool; - extern fn JSGlobalObject__setTimeZone(this: *JSGlobalObject, timeZone: *const ZigString) bool; + extern fn JSGlobalObject__setTimeZone(this: *JSGlobalObject, timeZone: *const RustString) bool; extern fn JSGlobalObject__tryTakeException(*JSGlobalObject) JSValue; extern fn JSGlobalObject__requestTermination(this: *JSGlobalObject) void; - extern fn Zig__GlobalObject__create(*anyopaque, i32, bool, bool, ?*anyopaque) *JSGlobalObject; + extern fn Rust__GlobalObject__create(*anyopaque, i32, bool, bool, ?*anyopaque) *JSGlobalObject; pub fn create( v: *jsc.VirtualMachine, console: *anyopaque, @@ -873,7 +873,7 @@ pub const JSGlobalObject = opaque { defer trace.end(); v.eventLoop().ensureWaker(); - const global = Zig__GlobalObject__create(console, context_id, mini_mode, eval_mode, worker_ptr); + const global = Rust__GlobalObject__create(console, context_id, mini_mode, eval_mode, worker_ptr); // JSC might mess with the stack size. bun.StackCheck.configureThread(); @@ -881,19 +881,19 @@ pub const JSGlobalObject = opaque { return global; } - extern fn Zig__GlobalObject__createForTestIsolation(old_global: *JSGlobalObject, console: *anyopaque) *JSGlobalObject; + extern fn Rust__GlobalObject__createForTestIsolation(old_global: *JSGlobalObject, console: *anyopaque) *JSGlobalObject; pub fn createForTestIsolation(old_global: *JSGlobalObject, console: *anyopaque) *JSGlobalObject { - return Zig__GlobalObject__createForTestIsolation(old_global, console); + return Rust__GlobalObject__createForTestIsolation(old_global, console); } - extern fn Zig__GlobalObject__getModuleRegistryMap(*JSGlobalObject) *anyopaque; + extern fn Rust__GlobalObject__getModuleRegistryMap(*JSGlobalObject) *anyopaque; pub fn getModuleRegistryMap(global: *JSGlobalObject) *anyopaque { - return Zig__GlobalObject__getModuleRegistryMap(global); + return Rust__GlobalObject__getModuleRegistryMap(global); } - extern fn Zig__GlobalObject__resetModuleRegistryMap(*JSGlobalObject, *anyopaque) bool; + extern fn Rust__GlobalObject__resetModuleRegistryMap(*JSGlobalObject, *anyopaque) bool; pub fn resetModuleRegistryMap(global: *JSGlobalObject, map: *anyopaque) bool { - return Zig__GlobalObject__resetModuleRegistryMap(global, map); + return Rust__GlobalObject__resetModuleRegistryMap(global, map); } pub fn resolve(res: *ErrorableString, global: *JSGlobalObject, specifier: *bun.String, source: *bun.String, query: *bun.String) callconv(.c) void { @@ -933,9 +933,9 @@ pub const JSGlobalObject = opaque { ); const content_type = if (try response.getContentType()) |content_type| - content_type.toZigString() + content_type.toRustString() else - ZigString.static("null").*; + RustString.static("null").*; if (!content_type.eqlComptime("application/wasm")) { return this.ERR(.WEBASSEMBLY_RESPONSE, "WebAssembly response has unsupported MIME type '{f}'", .{content_type}).throw(); @@ -998,21 +998,21 @@ pub const JSGlobalObject = opaque { args: anytype, ) jsc.JSValue { if (comptime std.meta.fields(@TypeOf(args)).len == 0) { - var zig_str = jsc.ZigString.init(fmt); + var rust_str = jsc.RustString.init(fmt); if (comptime !strings.isAllASCII(fmt)) { - zig_str.markUTF16(); + rust_str.markUTF16(); } - return zig_str.toErrorInstance(globalThis); + return rust_str.toErrorInstance(globalThis); } else { var fallback = std.heap.stackFallback(256, bun.default_allocator); var alloc = fallback.get(); const buf = std.fmt.allocPrint(alloc, fmt, args) catch unreachable; - var zig_str = jsc.ZigString.init(buf); - zig_str.detectEncoding(); + var rust_str = jsc.RustString.init(buf); + rust_str.detectEncoding(); // it alwayas clones - const res = zig_str.toErrorInstance(globalThis); + const res = rust_str.toErrorInstance(globalThis); alloc.free(buf); return res; } @@ -1045,16 +1045,16 @@ pub const JSGlobalObject = opaque { pub const Extern = [_][]const u8{ "create", "getModuleRegistryMap", "resetModuleRegistryMap" }; comptime { - @export(&resolve, .{ .name = "Zig__GlobalObject__resolve" }); - @export(&reportUncaughtException, .{ .name = "Zig__GlobalObject__reportUncaughtException" }); - @export(&onCrash, .{ .name = "Zig__GlobalObject__onCrash" }); - @export(&jsc.host_fn.wrap3(getBodyStreamOrBytesForWasmStreaming), .{ .name = "Zig__GlobalObject__getBodyStreamOrBytesForWasmStreaming" }); + @export(&resolve, .{ .name = "Rust__GlobalObject__resolve" }); + @export(&reportUncaughtException, .{ .name = "Rust__GlobalObject__reportUncaughtException" }); + @export(&onCrash, .{ .name = "Rust__GlobalObject__onCrash" }); + @export(&jsc.host_fn.wrap3(getBodyStreamOrBytesForWasmStreaming), .{ .name = "Rust__GlobalObject__getBodyStreamOrBytesForWasmStreaming" }); } }; const string = []const u8; -const napi = @import("../runtime/napi/napi.zig"); +const napi = @import("../runtime/napi/napi.rust"); const std = @import("std"); const bun = @import("bun"); @@ -1069,4 +1069,4 @@ const CommonStrings = jsc.CommonStrings; const ErrorableString = jsc.ErrorableString; const JSValue = jsc.JSValue; const VM = jsc.VM; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/JSInternalPromise.zig b/src/jsc/JSInternalPromise.zig index 7a079300b4b..b1b75842d02 100644 --- a/src/jsc/JSInternalPromise.zig +++ b/src/jsc/JSInternalPromise.zig @@ -1,4 +1,4 @@ // JSInternalPromise was removed from JavaScriptCore upstream. The new module // loader uses regular JSPromise everywhere. Keep this as a transparent alias so -// existing Zig callers continue to compile. -pub const JSInternalPromise = @import("./JSPromise.zig").JSPromise; +// existing Rust callers continue to compile. +pub const JSInternalPromise = @import("./JSPromise.rust").JSPromise; diff --git a/src/jsc/JSModuleLoader.zig b/src/jsc/JSModuleLoader.zig index e82b18eb605..aba47ab3ca6 100644 --- a/src/jsc/JSModuleLoader.zig +++ b/src/jsc/JSModuleLoader.zig @@ -45,7 +45,7 @@ pub const JSModuleLoader = opaque { } }; -const JSInternalPromise = @import("./JSInternalPromise.zig").JSInternalPromise; +const JSInternalPromise = @import("./JSInternalPromise.rust").JSInternalPromise; const bun = @import("bun"); const String = bun.String; diff --git a/src/jsc/JSObject.zig b/src/jsc/JSObject.zig index 38d8d1808ff..8083d7a5b20 100644 --- a/src/jsc/JSObject.zig +++ b/src/jsc/JSObject.zig @@ -149,7 +149,7 @@ pub const JSObject = opaque { return value; } - pub fn putRecord(this: *JSObject, global: *JSGlobalObject, key: *ZigString, values: []ZigString) bun.JSError!void { + pub fn putRecord(this: *JSObject, global: *JSGlobalObject, key: *RustString, values: []RustString) bun.JSError!void { return bun.cpp.JSC__JSObject__putRecord(this, global, key, values.ptr, values.len); } @@ -169,4 +169,4 @@ const JSError = bun.JSError; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/JSRef.zig b/src/jsc/JSRef.zig index 8cbad6854fd..f63aeccbf81 100644 --- a/src/jsc/JSRef.zig +++ b/src/jsc/JSRef.zig @@ -9,7 +9,7 @@ /// corresponding JavaScript wrapper object. The reference can be upgraded to "strong" when /// the native object has pending work or active connections, and downgraded to "weak" when idle: /// -/// ```zig +/// ```rust /// const MyNativeObject = struct { /// this_value: jsc.JSRef = .empty(), /// connection: SomeConnection, diff --git a/src/jsc/JSString.zig b/src/jsc/JSString.zig index 695f7229b7d..bfa14b45eee 100644 --- a/src/jsc/JSString.zig +++ b/src/jsc/JSString.zig @@ -1,6 +1,6 @@ pub const JSString = opaque { extern fn JSC__JSString__toObject(this: *JSString, global: *JSGlobalObject) ?*JSObject; - extern fn JSC__JSString__toZigString(this: *JSString, global: *JSGlobalObject, zig_str: *jsc.ZigString) void; + extern fn JSC__JSString__toRustString(this: *JSString, global: *JSGlobalObject, rust_str: *jsc.RustString) void; extern fn JSC__JSString__eql(this: *const JSString, global: *JSGlobalObject, other: *JSString) bool; extern fn JSC__JSString__iterator(this: *JSString, globalObject: *JSGlobalObject, iter: *anyopaque) void; extern fn JSC__JSString__length(this: *const JSString) usize; @@ -14,30 +14,30 @@ pub const JSString = opaque { return JSC__JSString__toObject(this, global); } - pub fn toZigString(this: *JSString, global: *JSGlobalObject, zig_str: *jsc.ZigString) void { - return JSC__JSString__toZigString(this, global, zig_str); + pub fn toRustString(this: *JSString, global: *JSGlobalObject, rust_str: *jsc.RustString) void { + return JSC__JSString__toRustString(this, global, rust_str); } pub fn ensureStillAlive(this: *JSString) void { std.mem.doNotOptimizeAway(this); } - pub fn getZigString(this: *JSString, global: *JSGlobalObject) jsc.ZigString { - var out = jsc.ZigString.init(""); - this.toZigString(global, &out); + pub fn getRustString(this: *JSString, global: *JSGlobalObject) jsc.RustString { + var out = jsc.RustString.init(""); + this.toRustString(global, &out); return out; } - pub const view = getZigString; + pub const view = getRustString; /// doesn't always allocate pub fn toSlice( this: *JSString, global: *JSGlobalObject, allocator: std.mem.Allocator, - ) ZigString.Slice { - var str = ZigString.init(""); - this.toZigString(global, &str); + ) RustString.Slice { + var str = RustString.init(""); + this.toRustString(global, &str); return str.toSlice(allocator); } @@ -45,9 +45,9 @@ pub const JSString = opaque { this: *JSString, global: *JSGlobalObject, allocator: std.mem.Allocator, - ) JSError!ZigString.Slice { - var str = ZigString.init(""); - this.toZigString(global, &str); + ) JSError!RustString.Slice { + var str = RustString.init(""); + this.toRustString(global, &str); return str.toSliceClone(allocator); } @@ -55,9 +55,9 @@ pub const JSString = opaque { this: *JSString, global: *JSGlobalObject, allocator: std.mem.Allocator, - ) ZigString.Slice { - var str = ZigString.init(""); - this.toZigString(global, &str); + ) RustString.Slice { + var str = RustString.init(""); + this.toRustString(global, &str); return str.toSliceZ(allocator); } @@ -92,8 +92,8 @@ pub const JSString = opaque { }; const std = @import("std"); -const JSObject = @import("./JSObject.zig").JSObject; -const ZigString = @import("./ZigString.zig").ZigString; +const JSObject = @import("./JSObject.rust").JSObject; +const RustString = @import("./RustString.rust").RustString; const bun = @import("bun"); const JSError = bun.JSError; diff --git a/src/jsc/JSType.zig b/src/jsc/JSType.zig index b111f9c6a94..bbc75722239 100644 --- a/src/jsc/JSType.zig +++ b/src/jsc/JSType.zig @@ -570,7 +570,7 @@ pub const JSType = enum(u8) { DOMWrapper = 0b11101110, EmbedderArrayLike = 0b11101101, - /// This means that we don't have Zig bindings for the type yet, but it + /// This means that we don't have Rust bindings for the type yet, but it /// implements .toJSON() JSAsJSONType = 0b11110000 | 1, _, diff --git a/src/jsc/JSUint8Array.zig b/src/jsc/JSUint8Array.zig index 110be156c6b..d77c38eb4f3 100644 --- a/src/jsc/JSUint8Array.zig +++ b/src/jsc/JSUint8Array.zig @@ -27,7 +27,7 @@ pub const JSUint8Array = opaque { } }; -const Sizes = @import("./sizes.zig"); +const Sizes = @import("./sizes.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/jsc/JSValue.zig b/src/jsc/JSValue.zig index 471e8733ea4..764aed7bf62 100644 --- a/src/jsc/JSValue.zig +++ b/src/jsc/JSValue.zig @@ -1,7 +1,7 @@ /// ABI-compatible with EncodedJSValue /// In the future, this type will exclude `zero`, encoding it as `error.JSError` instead. pub const JSValue = enum(i64) { - // fields here are prefixed so they're not accidentally mixed up with Zig's undefined/null/etc. + // fields here are prefixed so they're not accidentally mixed up with Rust's undefined/null/etc. js_undefined = 0xa, null = 0x2, true = FFI.TrueI64, @@ -23,7 +23,7 @@ pub const JSValue = enum(i64) { _, pub const is_pointer = false; - pub const JSType = @import("./JSType.zig").JSType; + pub const JSType = @import("./JSType.rust").JSType; pub fn format(_: JSValue, _: *std.Io.Writer) !void { @compileError("Formatting a JSValue directly is not allowed. Use jsc.ConsoleObject.Formatter"); @@ -76,13 +76,13 @@ pub const JSValue = enum(i64) { const PropertyIteratorFn = *const fn ( globalObject_: *JSGlobalObject, ctx_ptr: ?*anyopaque, - key: *ZigString, + key: *RustString, value: JSValue, is_symbol: bool, is_private_symbol: bool, ) callconv(.c) void; - extern fn JSC__JSValue__forEachPropertyNonIndexed(JSValue0: JSValue, arg1: *JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*JSGlobalObject, ?*anyopaque, *ZigString, JSValue, bool, bool) callconv(.c) void) void; + extern fn JSC__JSValue__forEachPropertyNonIndexed(JSValue0: JSValue, arg1: *JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*JSGlobalObject, ?*anyopaque, *RustString, JSValue, bool, bool) callconv(.c) void) void; pub fn forEachPropertyNonIndexed( this: JSValue, @@ -320,32 +320,32 @@ pub const JSValue = enum(i64) { return fromJSHostCall(global, @src(), JSC__JSValue__createEmptyArray, .{ global, len }); } - extern fn JSC__JSValue__putRecord(value: JSValue, global: *JSGlobalObject, key: *ZigString, values_array: [*]ZigString, values_len: usize) void; - pub fn putRecord(value: JSValue, global: *JSGlobalObject, key: *ZigString, values_array: [*]ZigString, values_len: usize) void { + extern fn JSC__JSValue__putRecord(value: JSValue, global: *JSGlobalObject, key: *RustString, values_array: [*]RustString, values_len: usize) void; + pub fn putRecord(value: JSValue, global: *JSGlobalObject, key: *RustString, values_array: [*]RustString, values_len: usize) void { return JSC__JSValue__putRecord(value, global, key, values_array, values_len); } - extern fn JSC__JSValue__put(value: JSValue, global: *JSGlobalObject, key: *const ZigString, result: jsc.JSValue) void; - pub fn putZigString(value: JSValue, global: *JSGlobalObject, key: *const ZigString, result: jsc.JSValue) void { + extern fn JSC__JSValue__put(value: JSValue, global: *JSGlobalObject, key: *const RustString, result: jsc.JSValue) void; + pub fn putRustString(value: JSValue, global: *JSGlobalObject, key: *const RustString, result: jsc.JSValue) void { JSC__JSValue__put(value, global, key, result); } - extern fn JSC__JSValue__deleteProperty(target: JSValue, global: *JSGlobalObject, key: *const ZigString) bool; + extern fn JSC__JSValue__deleteProperty(target: JSValue, global: *JSGlobalObject, key: *const RustString) bool; /// Delete a property from an object by key. Returns true if the property was deleted. pub fn deleteProperty(target: JSValue, global: *JSGlobalObject, key: anytype) bool { const Key = @TypeOf(key); if (comptime @typeInfo(Key) == .pointer) { const Elem = @typeInfo(Key).pointer.child; - if (Elem == ZigString) { + if (Elem == RustString) { return JSC__JSValue__deleteProperty(target, global, key); } else if (std.meta.Elem(Key) == u8) { - return JSC__JSValue__deleteProperty(target, global, &ZigString.init(key)); + return JSC__JSValue__deleteProperty(target, global, &RustString.init(key)); } else { - @compileError("Unsupported key type in deleteProperty(). Expected ZigString or string literal, got " ++ @typeName(Elem)); + @compileError("Unsupported key type in deleteProperty(). Expected RustString or string literal, got " ++ @typeName(Elem)); } - } else if (comptime Key == ZigString) { + } else if (comptime Key == RustString) { return JSC__JSValue__deleteProperty(target, global, &key); } else { - @compileError("Unsupported key type in deleteProperty(). Expected ZigString or string literal, got " ++ @typeName(Key)); + @compileError("Unsupported key type in deleteProperty(). Expected RustString or string literal, got " ++ @typeName(Key)); } } @@ -367,21 +367,21 @@ pub const JSValue = enum(i64) { const Key = @TypeOf(key); if (comptime @typeInfo(Key) == .pointer) { const Elem = @typeInfo(Key).pointer.child; - if (Elem == ZigString) { - putZigString(value, global, key, result); + if (Elem == RustString) { + putRustString(value, global, key, result); } else if (Elem == bun.String) { putBunString(value, global, key, result); } else if (std.meta.Elem(Key) == u8) { - putZigString(value, global, &ZigString.init(key), result); + putRustString(value, global, &RustString.init(key), result); } else { - @compileError("Unsupported key type in put(). Expected ZigString or bun.String, got " ++ @typeName(Elem)); + @compileError("Unsupported key type in put(). Expected RustString or bun.String, got " ++ @typeName(Elem)); } - } else if (comptime Key == ZigString) { - putZigString(value, global, &key, result); + } else if (comptime Key == RustString) { + putRustString(value, global, &key, result); } else if (comptime Key == bun.String) { putBunString(value, global, &key, result); } else { - @compileError("Unsupported key type in put(). Expected ZigString or bun.String, got " ++ @typeName(Key)); + @compileError("Unsupported key type in put(). Expected RustString or bun.String, got " ++ @typeName(Key)); } } /// Same as `.put` but accepts both non-numeric and numeric keys. @@ -428,25 +428,25 @@ pub const JSValue = enum(i64) { /// If the object does not match the type, return null. /// If the object is a subclass of the type or has mutated the structure, return null. /// Note: this may return null for direct instances of the type if the user adds properties to the object. - pub fn asDirect(value: JSValue, comptime ZigType: type) ?*ZigType { + pub fn asDirect(value: JSValue, comptime RustType: type) ?*RustType { bun.debugAssert(value.isCell()); // you must have already checked this. - return ZigType.fromJSDirect(value); + return RustType.fromJSDirect(value); } - pub fn as(value: JSValue, comptime ZigType: type) ?*ZigType { + pub fn as(value: JSValue, comptime RustType: type) ?*RustType { if (value.isEmptyOrUndefinedOrNull()) return null; - if (comptime ZigType == DOMURL) { + if (comptime RustType == DOMURL) { return DOMURL.cast(value); } - if (comptime ZigType == FetchHeaders) { + if (comptime RustType == FetchHeaders) { return FetchHeaders.cast(value); } - if (comptime ZigType == jsc.WebCore.Body.Value) { + if (comptime RustType == jsc.WebCore.Body.Value) { if (value.as(jsc.WebCore.Request)) |req| { return req.getBodyValue(); } @@ -458,9 +458,9 @@ pub const JSValue = enum(i64) { return null; } - if (comptime @hasDecl(ZigType, "fromJS") and @TypeOf(ZigType.fromJS) == fn (jsc.JSValue) ?*ZigType) { - if (comptime ZigType == jsc.WebCore.Blob) { - if (ZigType.fromJS(value)) |blob| { + if (comptime @hasDecl(RustType, "fromJS") and @TypeOf(RustType.fromJS) == fn (jsc.JSValue) ?*RustType) { + if (comptime RustType == jsc.WebCore.Blob) { + if (RustType.fromJS(value)) |blob| { return blob; } @@ -471,7 +471,7 @@ pub const JSValue = enum(i64) { return null; } - return ZigType.fromJS(value); + return RustType.fromJS(value); } } @@ -533,9 +533,9 @@ pub const JSValue = enum(i64) { Bun__JSValue__unprotect(this); } - extern fn JSC__JSValue__createObject2(global: *JSGlobalObject, key1: *const ZigString, key2: *const ZigString, value1: JSValue, value2: JSValue) JSValue; + extern fn JSC__JSValue__createObject2(global: *JSGlobalObject, key1: *const RustString, key2: *const RustString, value1: JSValue, value2: JSValue) JSValue; /// Create an object with exactly two properties - pub fn createObject2(global: *JSGlobalObject, key1: *const ZigString, key2: *const ZigString, value1: JSValue, value2: JSValue) bun.JSError!JSValue { + pub fn createObject2(global: *JSGlobalObject, key1: *const RustString, key2: *const RustString, value1: JSValue, value2: JSValue) bun.JSError!JSValue { return bun.jsc.fromJSHostCall(global, @src(), JSC__JSValue__createObject2, .{ global, key1, key2, value1, value2 }); } @@ -705,8 +705,8 @@ pub const JSValue = enum(i64) { return bun.cpp.JSC__JSValue__jsTDZValue(); } - pub fn className(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!ZigString { - var str = ZigString.init(""); + pub fn className(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!RustString { + var str = RustString.init(""); try this.getClassName(globalThis, &str); return str; } @@ -727,7 +727,7 @@ pub const JSValue = enum(i64) { ); } - /// Create a JSValue string from a zig format-print (fmt + args) + /// Create a JSValue string from a rust format-print (fmt + args) pub fn printString(globalThis: *JSGlobalObject, comptime stack_buffer_size: usize, comptime fmt: []const u8, args: anytype) !JSValue { var stack_fallback = std.heap.stackFallback(stack_buffer_size, globalThis.allocator()); @@ -739,7 +739,7 @@ pub const JSValue = enum(i64) { return String.init(buf.slice()).toJS(globalThis); } - /// Create a JSValue string from a zig format-print (fmt + args), with pretty format + /// Create a JSValue string from a rust format-print (fmt + args), with pretty format pub fn printStringPretty(globalThis: *JSGlobalObject, comptime stack_buffer_size: usize, comptime fmt: []const u8, args: anytype) !JSValue { var stack_fallback = std.heap.stackFallback(stack_buffer_size, globalThis.allocator()); @@ -753,8 +753,8 @@ pub const JSValue = enum(i64) { return String.init(buf.slice()).toJS(globalThis); } - extern fn JSC__JSValue__fromEntries(globalThis: *JSGlobalObject, keys_array: [*c]ZigString, values_array: [*c]ZigString, strings_count: usize, clone: bool) JSValue; - pub fn fromEntries(globalThis: *JSGlobalObject, keys_array: [*c]ZigString, values_array: [*c]ZigString, strings_count: usize, clone: bool) JSValue { + extern fn JSC__JSValue__fromEntries(globalThis: *JSGlobalObject, keys_array: [*c]RustString, values_array: [*c]RustString, strings_count: usize, clone: bool) JSValue; + pub fn fromEntries(globalThis: *JSGlobalObject, keys_array: [*c]RustString, values_array: [*c]RustString, strings_count: usize, clone: bool) JSValue { return JSC__JSValue__fromEntries( globalThis, keys_array, @@ -1115,8 +1115,8 @@ pub const JSValue = enum(i64) { return bun.cpp.JSC__JSValue__isConstructor(this); } - extern fn JSC__JSValue__getNameProperty(this: JSValue, global: *JSGlobalObject, ret: *ZigString) void; - pub fn getNameProperty(this: JSValue, global: *JSGlobalObject, ret: *ZigString) bun.JSError!void { + extern fn JSC__JSValue__getNameProperty(this: JSValue, global: *JSGlobalObject, ret: *RustString) void; + pub fn getNameProperty(this: JSValue, global: *JSGlobalObject, ret: *RustString) bun.JSError!void { if (this.isEmptyOrUndefinedOrNull()) { return; } @@ -1131,11 +1131,11 @@ pub const JSValue = enum(i64) { return ret; } - extern fn JSC__JSValue__getClassName(this: JSValue, global: *JSGlobalObject, ret: *ZigString) void; + extern fn JSC__JSValue__getClassName(this: JSValue, global: *JSGlobalObject, ret: *RustString) void; // TODO: absorb this into className() - pub fn getClassName(this: JSValue, global: *JSGlobalObject, ret: *ZigString) bun.JSError!void { + pub fn getClassName(this: JSValue, global: *JSGlobalObject, ret: *RustString) bun.JSError!void { if (!this.isCell()) { - ret.* = ZigString.static("[not a class]").*; + ret.* = RustString.static("[not a class]").*; return; } return bun.jsc.fromJSHostCallGeneric(global, @src(), JSC__JSValue__getClassName, .{ this, global, ret }); @@ -1149,7 +1149,7 @@ pub const JSValue = enum(i64) { } pub fn asCell(this: JSValue) *JSCell { - // Asserting this lets Zig possibly optimize out other checks. + // Asserting this lets Rust possibly optimize out other checks. bun.unsafeAssert(this.isCell()); // We know `DecodedJSValue.asCell` cannot return null, since `isCell` already checked for // `.zero`. @@ -1183,13 +1183,13 @@ pub const JSValue = enum(i64) { return JSC__JSValue__isTerminationException(this); } - pub fn toZigException(this: JSValue, global: *JSGlobalObject, exception: *ZigException) void { - return bun.cpp.JSC__JSValue__toZigException(this, global, exception) catch return; // TODO: properly propagate termination + pub fn toRustException(this: JSValue, global: *JSGlobalObject, exception: *RustException) void { + return bun.cpp.JSC__JSValue__toRustException(this, global, exception) catch return; // TODO: properly propagate termination } - extern fn JSC__JSValue__toZigString(this: JSValue, out: *ZigString, global: *JSGlobalObject) void; - pub fn toZigString(this: JSValue, out: *ZigString, global: *JSGlobalObject) JSError!void { - return bun.jsc.fromJSHostCallGeneric(global, @src(), JSC__JSValue__toZigString, .{ this, out, global }); + extern fn JSC__JSValue__toRustString(this: JSValue, out: *RustString, global: *JSGlobalObject) void; + pub fn toRustString(this: JSValue, out: *RustString, global: *JSGlobalObject) JSError!void { + return bun.jsc.fromJSHostCallGeneric(global, @src(), JSC__JSValue__toRustString, .{ this, out, global }); } /// Increments the reference count, you must call `.deref()` or it will leak memory. @@ -1240,9 +1240,9 @@ pub const JSValue = enum(i64) { extern fn JSC__JSValue__toUInt64NoTruncate(this: JSValue) u64; /// Deprecated: replace with 'toBunString' - pub fn getZigString(this: JSValue, global: *JSGlobalObject) bun.JSError!ZigString { - var str = ZigString.init(""); - try this.toZigString(&str, global); + pub fn getRustString(this: JSValue, global: *JSGlobalObject) bun.JSError!RustString { + var str = RustString.init(""); + try this.toRustString(&str, global); return str; } @@ -1253,14 +1253,14 @@ pub const JSValue = enum(i64) { /// ASCII-only string. /// /// Otherwise, it will be cloned using the allocator. - pub fn toSlice(this: JSValue, global: *JSGlobalObject, allocator: std.mem.Allocator) JSError!ZigString.Slice { + pub fn toSlice(this: JSValue, global: *JSGlobalObject, allocator: std.mem.Allocator) JSError!RustString.Slice { const str = try bun.String.fromJS(this, global); defer str.deref(); return str.toUTF8(allocator); } - pub inline fn toSliceZ(this: JSValue, global: *JSGlobalObject, allocator: std.mem.Allocator) ZigString.Slice { - return getZigString(this, global).toSliceZ(allocator); + pub inline fn toSliceZ(this: JSValue, global: *JSGlobalObject, allocator: std.mem.Allocator) RustString.Slice { + return getRustString(this, global).toSliceZ(allocator); } /// The returned slice is always owned by `allocator`. @@ -1289,14 +1289,14 @@ pub const JSValue = enum(i64) { } /// Call `toString()` on the JSValue and clone the result. - pub fn toSliceOrNull(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!ZigString.Slice { + pub fn toSliceOrNull(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!RustString.Slice { const str = try bun.String.fromJS(this, globalThis); defer str.deref(); return str.toUTF8(bun.default_allocator); } /// Call `toString()` on the JSValue and clone the result. - pub fn toSliceOrNullWithAllocator(this: JSValue, globalThis: *JSGlobalObject, allocator: std.mem.Allocator) bun.JSError!ZigString.Slice { + pub fn toSliceOrNullWithAllocator(this: JSValue, globalThis: *JSGlobalObject, allocator: std.mem.Allocator) bun.JSError!RustString.Slice { const str = try bun.String.fromJS(this, globalThis); defer str.deref(); return str.toUTF8(allocator); @@ -1306,7 +1306,7 @@ pub const JSValue = enum(i64) { /// On exception or out of memory, this returns a JSError. /// /// Remember that `Symbol` throws an exception when you call `toString()`. - pub fn toSliceClone(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!ZigString.Slice { + pub fn toSliceClone(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!RustString.Slice { return this.toSliceCloneWithAllocator(globalThis, bun.default_allocator); } @@ -1315,7 +1315,7 @@ pub const JSValue = enum(i64) { this: JSValue, globalThis: *JSGlobalObject, allocator: std.mem.Allocator, - ) JSError!ZigString.Slice { + ) JSError!RustString.Slice { var str = try this.toJSString(globalThis); return str.toSliceClone(globalThis, allocator); } @@ -1410,7 +1410,7 @@ pub const JSValue = enum(i64) { } // `this` must be known to be an object - // intended to be more lightweight than ZigString. + // intended to be more lightweight than RustString. pub fn fastGet(this: JSValue, global: *JSGlobalObject, builtin_name: BuiltinName) JSError!?JSValue { if (bun.Environment.isDebug) bun.assert(this.isObject()); @@ -1464,23 +1464,23 @@ pub const JSValue = enum(i64) { return result; } - extern fn JSC__JSValue__getSymbolDescription(this: JSValue, global: *JSGlobalObject, str: *ZigString) void; - pub fn getSymbolDescription(this: JSValue, global: *JSGlobalObject, str: *ZigString) void { + extern fn JSC__JSValue__getSymbolDescription(this: JSValue, global: *JSGlobalObject, str: *RustString) void; + pub fn getSymbolDescription(this: JSValue, global: *JSGlobalObject, str: *RustString) void { JSC__JSValue__getSymbolDescription(this, global, str); } - extern fn JSC__JSValue__symbolFor(global: *JSGlobalObject, str: *ZigString) JSValue; - pub fn symbolFor(global: *JSGlobalObject, str: *ZigString) JSValue { + extern fn JSC__JSValue__symbolFor(global: *JSGlobalObject, str: *RustString) JSValue; + pub fn symbolFor(global: *JSGlobalObject, str: *RustString) JSValue { return JSC__JSValue__symbolFor(global, str); } - extern fn JSC__JSValue__symbolKeyFor(this: JSValue, global: *JSGlobalObject, str: *ZigString) bool; - pub fn symbolKeyFor(this: JSValue, global: *JSGlobalObject, str: *ZigString) bool { + extern fn JSC__JSValue__symbolKeyFor(this: JSValue, global: *JSGlobalObject, str: *RustString) bool; + pub fn symbolKeyFor(this: JSValue, global: *JSGlobalObject, str: *RustString) bool { return JSC__JSValue__symbolKeyFor(this, global, str); } extern fn JSC__JSValue___then(this: JSValue, global: *JSGlobalObject, ctx: JSValue, resolve: *const jsc.JSHostFn, reject: *const jsc.JSHostFn) void; - fn _then(this: JSValue, global: *JSGlobalObject, ctx: JSValue, resolve: jsc.JSHostFnZig, reject: jsc.JSHostFnZig) void { + fn _then(this: JSValue, global: *JSGlobalObject, ctx: JSValue, resolve: jsc.JSHostFnRust, reject: jsc.JSHostFnRust) void { return JSC__JSValue___then(this, global, ctx, toJSHostFunction(resolve), toJSHostFunction(reject)); } @@ -1492,7 +1492,7 @@ pub const JSValue = enum(i64) { try scope.assertNoExceptionExceptTermination(); } - pub fn then(this: JSValue, global: *JSGlobalObject, ctx: ?*anyopaque, resolve: jsc.JSHostFnZig, reject: jsc.JSHostFnZig) bun.JSTerminated!void { + pub fn then(this: JSValue, global: *JSGlobalObject, ctx: ?*anyopaque, resolve: jsc.JSHostFnRust, reject: jsc.JSHostFnRust) bun.JSTerminated!void { var scope: TopExceptionScope = undefined; scope.init(global, @src()); defer scope.deinit(); @@ -1504,7 +1504,7 @@ pub const JSValue = enum(i64) { /// Use this when the context should be GC-managed (e.g., a JSCell that /// gets collected with the Promise's reaction if the Promise is GC'd /// without settling). - pub fn thenWithValue(this: JSValue, global: *JSGlobalObject, ctx: JSValue, resolve: jsc.JSHostFnZig, reject: jsc.JSHostFnZig) bun.JSTerminated!void { + pub fn thenWithValue(this: JSValue, global: *JSGlobalObject, ctx: JSValue, resolve: jsc.JSHostFnRust, reject: jsc.JSHostFnRust) bun.JSTerminated!void { var scope: TopExceptionScope = undefined; scope.init(global, @src()); defer scope.deinit(); @@ -1512,20 +1512,20 @@ pub const JSValue = enum(i64) { try scope.assertNoExceptionExceptTermination(); } - pub fn getDescription(this: JSValue, global: *JSGlobalObject) ZigString { - var zig_str = ZigString.init(""); - getSymbolDescription(this, global, &zig_str); - return zig_str; + pub fn getDescription(this: JSValue, global: *JSGlobalObject) RustString { + var rust_str = RustString.init(""); + getSymbolDescription(this, global, &rust_str); + return rust_str; } /// Equivalent to `target[property]`. Calls userland getters/proxies. Can - /// throw. Zig null indicates the property does not exist OR its value is + /// throw. Rust null indicates the property does not exist OR its value is /// JS undefined (the two are not distinguished). JS null passes through /// as a value. /// /// `property` must be `[]const u8`. A comptime slice may defer to /// calling `fastGet`, which use a more optimal code path. This function is - /// marked `inline` to allow Zig to determine if `fastGet` should be used + /// marked `inline` to allow Rust to determine if `fastGet` should be used /// per invocation. /// /// Cannot handle property names that are numeric indexes. (For this use `getPropertyValue` instead.) @@ -1554,7 +1554,7 @@ pub const JSValue = enum(i64) { } /// Equivalent to `target[property]`. Calls userland getters/proxies. Can - /// throw. Zig null indicates the property does not exist OR its value is + /// throw. Rust null indicates the property does not exist OR its value is /// JS undefined (the two are not distinguished). JS null passes through /// as a value. /// @@ -1849,7 +1849,7 @@ pub const JSValue = enum(i64) { switch (comptime T) { JSValue => return prop, bool => @compileError("ambiguous coercion: use getBooleanStrict (throw error if not boolean) or getBooleanLoose (truthy check, never throws)"), - ZigString.Slice => { + RustString.Slice => { if (prop.isString()) { return try prop.toSliceOrNull(global); } @@ -1862,7 +1862,7 @@ pub const JSValue = enum(i64) { } /// Many Bun API are loose and simply want to check if a value is truthy - /// Missing value and undefined return zig `null`. JS null returns `false`. + /// Missing value and undefined return rust `null`. JS null returns `false`. pub inline fn getBooleanLoose(this: JSValue, global: *JSGlobalObject, comptime property_name: []const u8) JSError!?bool { const prop = try this.get(global, property_name) orelse return null; return prop.toBoolean(); @@ -1922,13 +1922,13 @@ pub const JSValue = enum(i64) { /// Alias for getIfPropertyExists pub const getIfPropertyExists = get; - extern fn JSC__JSValue__createTypeError(message: *const ZigString, code: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn createTypeError(message: *const ZigString, code: *const ZigString, global: *JSGlobalObject) JSValue { + extern fn JSC__JSValue__createTypeError(message: *const RustString, code: *const RustString, global: *JSGlobalObject) JSValue; + pub fn createTypeError(message: *const RustString, code: *const RustString, global: *JSGlobalObject) JSValue { return JSC__JSValue__createTypeError(message, code, global); } - extern fn JSC__JSValue__createRangeError(message: *const ZigString, code: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn createRangeError(message: *const ZigString, code: *const ZigString, global: *JSGlobalObject) JSValue { + extern fn JSC__JSValue__createRangeError(message: *const RustString, code: *const RustString, global: *JSGlobalObject) JSValue; + pub fn createRangeError(message: *const RustString, code: *const RustString, global: *JSGlobalObject) JSValue { return JSC__JSValue__createRangeError(message, code, global); } @@ -2037,14 +2037,14 @@ pub const JSValue = enum(i64) { pub fn toFmt( this: JSValue, formatter: *jsc.ConsoleObject.Formatter, - ) jsc.ConsoleObject.Formatter.ZigFormatter { + ) jsc.ConsoleObject.Formatter.RustFormatter { formatter.remaining_values = &[_]JSValue{}; if (formatter.map_node != null) { formatter.deinit(); } formatter.stack_check.update(); - return jsc.ConsoleObject.Formatter.ZigFormatter{ + return jsc.ConsoleObject.Formatter.RustFormatter{ .formatter = formatter, .value = this, }; @@ -2275,7 +2275,7 @@ pub const JSValue = enum(i64) { extern "c" fn Bun__JSValue__deserialize(global: *JSGlobalObject, data: [*]const u8, len: usize) JSValue; - /// Deserializes a JSValue from a serialized buffer. Zig version of `import('bun:jsc').deserialize` + /// Deserializes a JSValue from a serialized buffer. Rust version of `import('bun:jsc').deserialize` pub inline fn deserialize(bytes: []const u8, global: *JSGlobalObject) bun.JSError!JSValue { return bun.jsc.fromJSHostCall(global, @src(), Bun__JSValue__deserialize, .{ global, bytes.ptr, bytes.len }); } @@ -2340,7 +2340,7 @@ pub const JSValue = enum(i64) { pub const FromAnyLifetime = enum { allocated, temporary }; - /// Marshall a zig value into a JSValue using comptime reflection. + /// Marshall a rust value into a JSValue using comptime reflection. /// /// - Primitives are converted to their JS equivalent. /// - Types with `toJS` or `toJSNewlyCreated` methods have them called @@ -2486,9 +2486,9 @@ extern "c" fn Bun__JSValue__isAsyncContextFrame(value: JSValue) bool; const string = []const u8; -const FFI = @import("./FFI.zig"); +const FFI = @import("./FFI.rust"); const std = @import("std"); -const JestPrettyFormat = @import("../runtime/test_runner/pretty_format.zig").JestPrettyFormat; +const JestPrettyFormat = @import("../runtime/test_runner/pretty_format.rust").JestPrettyFormat; const bun = @import("bun"); const Environment = bun.Environment; @@ -2512,7 +2512,7 @@ const JSPromise = jsc.JSPromise; const JSString = jsc.JSString; const TopExceptionScope = jsc.TopExceptionScope; const VM = jsc.VM; -const ZigException = jsc.ZigException; -const ZigString = jsc.ZigString; +const RustException = jsc.RustException; +const RustString = jsc.RustString; const fromJSHostCall = jsc.fromJSHostCall; const toJSHostFunction = jsc.toJSHostFn; diff --git a/src/jsc/MarkedArgumentBuffer.zig b/src/jsc/MarkedArgumentBuffer.zig index 97e4dbe627c..23d29892bc0 100644 --- a/src/jsc/MarkedArgumentBuffer.zig +++ b/src/jsc/MarkedArgumentBuffer.zig @@ -9,7 +9,7 @@ pub const MarkedArgumentBuffer = opaque { MarkedArgumentBuffer__run(@ptrCast(ctx), @ptrCast(func)); } - pub fn wrap(comptime function: *const fn (globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame, marked_argument_buffer: *MarkedArgumentBuffer) bun.JSError!jsc.JSValue) jsc.JSHostFnZig { + pub fn wrap(comptime function: *const fn (globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame, marked_argument_buffer: *MarkedArgumentBuffer) bun.JSError!jsc.JSValue) jsc.JSHostFnRust { return struct { pub fn wrapper(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { const Context = struct { diff --git a/src/jsc/ModuleLoader.zig b/src/jsc/ModuleLoader.zig index c6e075fa959..6da0ad6042b 100644 --- a/src/jsc/ModuleLoader.zig +++ b/src/jsc/ModuleLoader.zig @@ -1,9 +1,9 @@ const ModuleLoader = @This(); -pub const node_fallbacks = @import("../resolver/node_fallbacks.zig"); -pub const AsyncModule = @import("./AsyncModule.zig").AsyncModule; -pub const RuntimeTranspilerStore = @import("./RuntimeTranspilerStore.zig").RuntimeTranspilerStore; -pub const HardcodedModule = @import("../resolve_builtins/HardcodedModule.zig").HardcodedModule; +pub const node_fallbacks = @import("../resolver/node_fallbacks.rust"); +pub const AsyncModule = @import("./AsyncModule.rust").AsyncModule; +pub const RuntimeTranspilerStore = @import("./RuntimeTranspilerStore.rust").RuntimeTranspilerStore; +pub const HardcodedModule = @import("../resolve_builtins/HardcodedModule.rust").HardcodedModule; transpile_source_code_arena: ?*bun.ArenaAllocator = null, eval_source: ?*logger.Source = null, @@ -55,7 +55,7 @@ pub fn resolveEmbeddedFile(vm: *VirtualMachine, path_buf: *bun.PathBuffer, input .{ .data = .{ - .encoded_slice = ZigString.Slice.fromUTF8NeverFree(file.contents), + .encoded_slice = RustString.Slice.fromUTF8NeverFree(file.contents), }, .dirfd = tmpdir, .file = .{ .fd = tmpfile.fd }, @@ -627,8 +627,8 @@ pub fn transpileSourceCode( // return ResolvedSource{ // .allocator = if (jsc_vm.has_loaded) &jsc_vm.allocator else null, - // .source_code = ZigString.init(jsc_vm.allocator.dupe(u8, source.contents) catch unreachable), - // .specifier = ZigString.init(specifier), + // .source_code = RustString.init(jsc_vm.allocator.dupe(u8, source.contents) catch unreachable), + // .specifier = RustString.init(specifier), // .source_url = input_specifier.createIfDifferent(path.text), // .tag = ResolvedSource.Tag.wasm, // }; @@ -644,7 +644,7 @@ pub fn transpileSourceCode( const globalValue = decoded.encode(); globalValue.put( globalThis, - ZigString.static("wasmSourceBytes"), + RustString.static("wasmSourceBytes"), try jsc.ArrayBuffer.create(globalThis, source.contents, .Uint8Array), ); } @@ -1235,7 +1235,7 @@ export fn Bun__transpileVirtualModule( globalObject: *JSGlobalObject, specifier_ptr: *const bun.String, referrer_ptr: *const bun.String, - source_code: *ZigString, + source_code: *RustString, loader_: api.Loader, ret: *jsc.ErrorableResolvedSource, ) bool { @@ -1350,23 +1350,23 @@ const debug = Output.scoped(.ModuleLoader, .hidden); const string = []const u8; -const Fs = @import("../resolver/fs.zig"); -const Runtime = @import("../js_parser/runtime.zig"); -const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.zig"); -const ast = @import("../options_types/import_record.zig"); -const node_module_module = @import("./NodeModuleModule.zig"); +const Fs = @import("../resolver/fs.rust"); +const Runtime = @import("../js_parser/runtime.rust"); +const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.rust"); +const ast = @import("../options_types/import_record.rust"); +const node_module_module = @import("./NodeModuleModule.rust"); const std = @import("std"); const panic = std.debug.panic; -const options = @import("../bundler/options.zig"); +const options = @import("../bundler/options.rust"); 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.rust").MacroMap; +const PackageJSON = @import("../resolver/package_json.rust").PackageJSON; -const dumpSource = @import("./RuntimeTranspilerStore.zig").dumpSource; -const dumpSourceString = @import("./RuntimeTranspilerStore.zig").dumpSourceString; -const setBreakPointOnFirstLine = @import("./RuntimeTranspilerStore.zig").setBreakPointOnFirstLine; +const dumpSource = @import("./RuntimeTranspilerStore.rust").dumpSource; +const dumpSourceString = @import("./RuntimeTranspilerStore.rust").dumpSourceString; +const setBreakPointOnFirstLine = @import("./RuntimeTranspilerStore.rust").setBreakPointOnFirstLine; const bun = @import("bun"); const Environment = bun.Environment; @@ -1388,7 +1388,7 @@ const JSGlobalObject = bun.jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; const ResolvedSource = bun.jsc.ResolvedSource; const VirtualMachine = bun.jsc.VirtualMachine; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; const Bun = jsc.API.Bun; const ParseResult = bun.transpiler.ParseResult; diff --git a/src/jsc/NodeModuleModule.zig b/src/jsc/NodeModuleModule.zig index 9366ea931b2..e8bd19f62b3 100644 --- a/src/jsc/NodeModuleModule.zig +++ b/src/jsc/NodeModuleModule.zig @@ -85,7 +85,7 @@ extern fn JSCommonJSExtensions__setFunction(global: *jsc.JSGlobalObject, index: extern fn JSCommonJSExtensions__swapRemove(global: *jsc.JSGlobalObject, index: u32) u32; // Memory management is complicated because JSValues are stored in gc-visitable -// WriteBarriers in C++ but the hash map for extensions is in Zig for flexibility. +// WriteBarriers in C++ but the hash map for extensions is in Rust for flexibility. fn onRequireExtensionModify(global: *jsc.JSGlobalObject, str: []const u8, loader: bun.schema.api.Loader, value: jsc.JSValue) bun.OOM!void { const vm = global.bunVM(); const list = &vm.commonjs_custom_extensions; diff --git a/src/jsc/ResolveMessage.zig b/src/jsc/ResolveMessage.zig index c98faa2d42c..c443658505d 100644 --- a/src/jsc/ResolveMessage.zig +++ b/src/jsc/ResolveMessage.zig @@ -106,7 +106,7 @@ pub const ResolveMessage = struct { const text = std.fmt.allocPrint(default_allocator, "ResolveMessage: {s}", .{this.msg.data.text}) catch { return globalThis.throwOutOfMemoryValue(); }; - var str = ZigString.init(text); + var str = RustString.init(text); str.setOutputEncoding(); if (str.isUTF8()) { const out = str.toJS(globalThis); @@ -138,7 +138,7 @@ pub const ResolveMessage = struct { return jsc.JSValue.jsNull(); } - const str = try args[0].getZigString(globalThis); + const str = try args[0].getRustString(globalThis); if (str.eqlComptime("default") or str.eqlComptime("string")) { return this.toStringFn(globalThis); } @@ -153,13 +153,13 @@ pub const ResolveMessage = struct { _: *jsc.CallFrame, ) bun.JSError!jsc.JSValue { var object = jsc.JSValue.createEmptyObject(globalThis, 7); - object.put(globalThis, ZigString.static("name"), try bun.String.static("ResolveMessage").toJS(globalThis)); - object.put(globalThis, ZigString.static("position"), this.getPosition(globalThis)); - object.put(globalThis, ZigString.static("message"), this.getMessage(globalThis)); - object.put(globalThis, ZigString.static("level"), this.getLevel(globalThis)); - object.put(globalThis, ZigString.static("specifier"), this.getSpecifier(globalThis)); - object.put(globalThis, ZigString.static("importKind"), this.getImportKind(globalThis)); - object.put(globalThis, ZigString.static("referrer"), this.getReferrer(globalThis)); + object.put(globalThis, RustString.static("name"), try bun.String.static("ResolveMessage").toJS(globalThis)); + object.put(globalThis, RustString.static("position"), this.getPosition(globalThis)); + object.put(globalThis, RustString.static("message"), this.getMessage(globalThis)); + object.put(globalThis, RustString.static("level"), this.getLevel(globalThis)); + object.put(globalThis, RustString.static("specifier"), this.getSpecifier(globalThis)); + object.put(globalThis, RustString.static("importKind"), this.getImportKind(globalThis)); + object.put(globalThis, RustString.static("referrer"), this.getReferrer(globalThis)); return object; } @@ -189,28 +189,28 @@ pub const ResolveMessage = struct { this: *ResolveMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.data.text).toJS(globalThis); + return RustString.init(this.msg.data.text).toJS(globalThis); } pub fn getLevel( this: *ResolveMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.kind.string()).toJS(globalThis); + return RustString.init(this.msg.kind.string()).toJS(globalThis); } pub fn getSpecifier( this: *ResolveMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.metadata.resolve.specifier.slice(this.msg.data.text)).toJS(globalThis); + return RustString.init(this.msg.metadata.resolve.specifier.slice(this.msg.data.text)).toJS(globalThis); } pub fn getImportKind( this: *ResolveMessage, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(this.msg.metadata.resolve.import_kind.label()).toJS(globalThis); + return RustString.init(this.msg.metadata.resolve.import_kind.label()).toJS(globalThis); } pub fn getReferrer( @@ -218,7 +218,7 @@ pub const ResolveMessage = struct { globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { if (this.referrer) |referrer| { - return ZigString.init(referrer.text).toJS(globalThis); + return RustString.init(referrer.text).toJS(globalThis); } else { return jsc.JSValue.jsNull(); } @@ -235,7 +235,7 @@ pub const ResolveMessage = struct { const string = []const u8; -const Resolver = @import("../resolver/resolver.zig"); +const Resolver = @import("../resolver/resolver.rust"); const std = @import("std"); const bun = @import("bun"); @@ -246,4 +246,4 @@ const strings = bun.strings; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/RuntimeTranspilerStore.zig b/src/jsc/RuntimeTranspilerStore.zig index 3e3419f233a..75c3785f2a1 100644 --- a/src/jsc/RuntimeTranspilerStore.zig +++ b/src/jsc/RuntimeTranspilerStore.zig @@ -623,18 +623,18 @@ pub const RuntimeTranspilerStore = struct { }; }; -const Fs = @import("../resolver/fs.zig"); -const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.zig"); -const node_fallbacks = @import("../resolver/node_fallbacks.zig"); +const Fs = @import("../resolver/fs.rust"); +const analyze_transpiled_module = @import("../bundler/analyze_transpiled_module.rust"); +const node_fallbacks = @import("../resolver/node_fallbacks.rust"); const std = @import("std"); -const AsyncModule = @import("./AsyncModule.zig").AsyncModule; -const HardcodedModule = @import("../resolve_builtins/HardcodedModule.zig").HardcodedModule; +const AsyncModule = @import("./AsyncModule.rust").AsyncModule; +const HardcodedModule = @import("../resolve_builtins/HardcodedModule.rust").HardcodedModule; -const options = @import("../bundler/options.zig"); +const options = @import("../bundler/options.rust"); 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.rust").MacroMap; +const PackageJSON = @import("../resolver/package_json.rust").PackageJSON; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/jsc/STREAMS.md b/src/jsc/STREAMS.md index 72ced4b3e6f..b4629e1d512 100644 --- a/src/jsc/STREAMS.md +++ b/src/jsc/STREAMS.md @@ -11,7 +11,7 @@ - 3.2. Optimization 2: The Direct Path - Zero-Copy Native Piping - 3.3. Optimization 3: `readMany()` - Efficient Async Iteration 4. [**Low-Level Implementation Details**](#4-low-level-implementation-details) - - 4.1. The Native Language: `streams.zig` Primitives + - 4.1. The Native Language: `streams.rust` Primitives - 4.2. Native Sink In-Depth: `HTTPSResponseSink` and Buffering - 4.3. The Native Collector: `Body.ValueBufferer` - 4.4. Memory and String Optimizations @@ -36,11 +36,11 @@ To understand Bun's stream optimizations, two foundational concepts must be unde Identifying the _source_ of a `ReadableStream` at the native level unlocks many optimization opportunities. This is achieved by "tagging" the stream object internally. -- **Mechanism:** Every `ReadableStream` in Bun holds a private field, `bunNativePtr`, which can point to a native Zig struct representing the stream's underlying source. -- **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. +- **Mechanism:** Every `ReadableStream` in Bun holds a private field, `bunNativePtr`, which can point to a native Rust struct representing the stream's underlying source. +- **Identification:** A C++ binding, `ReadableStreamTag__tagged` (from `ReadableStream.rust`), 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/runtime/webcore/ReadableStream.zig +```rust +// src/runtime/webcore/ReadableStream.rust 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. @@ -55,7 +55,7 @@ This tag is the key that unlocks all subsequent optimizations. It allows the run ### 2.2. The `Body` Mixin: An Intelligent Gateway -The `Body` mixin (used by `Request` and `Response`) is not merely a stream container; it's a sophisticated state machine and the primary API gateway to Bun's optimization paths. A `Body`'s content is represented by the `Body.Value` union in Zig, which can be a static buffer (`.InternalBlob`, `.WTFStringImpl`) or a live stream (`.Locked`). +The `Body` mixin (used by `Request` and `Response`) is not merely a stream container; it's a sophisticated state machine and the primary API gateway to Bun's optimization paths. A `Body`'s content is represented by the `Body.Value` union in Rust, which can be a static buffer (`.InternalBlob`, `.WTFStringImpl`) or a live stream (`.Locked`). Methods like `.text()`, `.json()`, and `.arrayBuffer()` are not simple stream consumers. They are entry points to a decision tree that aggressively seeks the fastest possible way to fulfill the request. @@ -156,7 +156,7 @@ flowchart TB **Diagram 2: Synchronous Coercion Logic Flow** 1. **Entry Point:** A JS call to `response.text()` triggers `readableStreamToText` (`ReadableStream.ts`), which immediately calls `tryUseReadableStreamBufferedFastPath`. -2. **Native Check:** `tryUseReadableStreamBufferedFastPath` calls the native binding `jsFunctionGetCompleteRequestOrResponseBodyValueAsArrayBuffer` (`Response.zig`). +2. **Native Check:** `tryUseReadableStreamBufferedFastPath` calls the native binding `jsFunctionGetCompleteRequestOrResponseBodyValueAsArrayBuffer` (`Response.rust`). 3. **State Inspection:** This native function inspects the `Body.Value` tag. If the tag is `.InternalBlob`, `.Blob` (and not a disk-backed file), or `.WTFStringImpl`, the complete data is already in memory. 4. **Synchronous Data Transfer:** The function **synchronously** returns the underlying buffer as a native `ArrayBuffer` handle to JavaScript. The `Body` state is immediately transitioned to `.Used`. The buffer's ownership is often transferred (`.transfer` lifetime), avoiding a data copy. 5. **JS Resolution:** The JS layer receives a promise that is **already fulfilled** with the complete `ArrayBuffer`. It then performs the final conversion (e.g., `TextDecoder.decode()`) in a single step. @@ -180,7 +180,7 @@ graph TD subgraph js["🟨 JavaScript Layer"] C["📄 new Response(file.stream())"] end - subgraph native["⚡ Native Layer (Zig)"] + subgraph native["⚡ Native Layer (Rust)"] A["💾 Disk I/O
FileReader Source"] B["🔌 Socket Buffer
HTTPSResponseSink"] A -."🚀 Zero-Copy View
streams.Result.temporary".-> B @@ -207,8 +207,8 @@ graph TD 1. **Scenario:** A server handler returns `new Response(Bun.file("video.mp4").stream())`. 2. **Tagging:** The stream is created with a `File` tag, and its `bunNativePtr` points to a native `webcore.FileReader` struct. The HTTP server's response sink is a native `HTTPSResponseSink`. 3. **Connection via `assignToStream`:** The server's internal logic triggers `assignToStream` (`ReadableStreamInternals.ts`). This function detects the native source via its tag and dispatches to `readDirectStream`. -4. **Native Handoff:** `readDirectStream` calls the C++ binding `$startDirectStream`, which passes pointers to the native `FileReader` (source) and `HTTPSResponseSink` (sink) to the Zig engine. -5. **Zero-Copy Native Data Flow:** The Zig layer takes over. The `FileReader` reads a chunk from the disk. It yields a `streams.Result.temporary` variant, which is a **zero-copy view** into a shared read buffer. This view is passed directly to the `HTTPSResponseSink.write()` method, which appends it to its internal socket write buffer. When possible, Bun will skip the FileReader and use the `sendfile` system call for even less system call interactions. +4. **Native Handoff:** `readDirectStream` calls the C++ binding `$startDirectStream`, which passes pointers to the native `FileReader` (source) and `HTTPSResponseSink` (sink) to the Rust engine. +5. **Zero-Copy Native Data Flow:** The Rust layer takes over. The `FileReader` reads a chunk from the disk. It yields a `streams.Result.temporary` variant, which is a **zero-copy view** into a shared read buffer. This view is passed directly to the `HTTPSResponseSink.write()` method, which appends it to its internal socket write buffer. When possible, Bun will skip the FileReader and use the `sendfile` system call for even less system call interactions. **Architectural Impact:** @@ -278,11 +278,11 @@ flowchart TB ### **4. Low-Level Implementation Details** -The high-level optimizations are made possible by a robust and carefully designed native foundation in Zig. +The high-level optimizations are made possible by a robust and carefully designed native foundation in Rust. -#### **4.1. The Native Language: `streams.zig` Primitives** +#### **4.1. The Native Language: `streams.rust` Primitives** -The entire native architecture is built upon a set of generic, powerful Zig primitives that define the contracts for data flow. +The entire native architecture is built upon a set of generic, powerful Rust primitives that define the contracts for data flow. - **`streams.Result` Union:** This is the universal data-carrying type for all native stream reads. Its variants are not just data containers; they are crucial signals from the source to the sink. - `owned: bun.ByteList`: Represents a heap-allocated buffer. The receiver is now responsible for freeing this memory. This is used when data must outlive the current scope. @@ -299,7 +299,7 @@ The entire native architecture is built upon a set of generic, powerful Zig prim #### **4.2. Native Sink In-Depth: `HTTPSResponseSink` and Buffering** -The `HTTPServerWritable` struct (instantiated as `HTTPSResponseSink` in `streams.zig`) is part of what makes Bun's HTTP server fast. +The `HTTPServerWritable` struct (instantiated as `HTTPSResponseSink` in `streams.rust`) is part of what makes Bun's HTTP server fast. - **Intelligent Write Buffering:** The `write` method (`writeBytes`, `writeLatin1`, etc.) does not immediately issue a `write` syscall. It appends the incoming `streams.Result` slice to its internal `buffer: bun.ByteList`. This coalesces multiple small, high-frequency writes (common in streaming LLM responses or SSE) into a single, larger, more efficient syscall. @@ -315,7 +315,7 @@ The `HTTPServerWritable` struct (instantiated as `HTTPSResponseSink` in `streams #### **4.3. The Native Collector: `Body.ValueBufferer`** -When a consuming method like `.text()` is called on a body that cannot be resolved synchronously, the `Body.ValueBufferer` (`Body.zig`) is used to efficiently collect all chunks into a single native buffer. +When a consuming method like `.text()` is called on a body that cannot be resolved synchronously, the `Body.ValueBufferer` (`Body.rust`) is used to efficiently collect all chunks into a single native buffer. - **Instantiation:** A `Body.ValueBufferer` is created with a callback, `onFinishedBuffering`, which will be invoked upon completion to resolve the original JS promise. - **Native Piping (`onStreamPipe`):** For a `ByteStream` source, the bufferer sets itself as the `pipe` destination. The `ByteStream.onData` method, instead of interacting with JavaScript, now directly calls the bufferer's `onStreamPipe` function. This function appends the received `streams.Result` slice to its internal `stream_buffer`. The entire collection loop happens natively. @@ -325,7 +325,7 @@ When a consuming method like `.text()` is called on a body that cannot be resolv #### **4.4. Memory and String Optimizations** -- **`Blob` and `Blob.Store` (`Blob.zig`):** A `Blob` is a lightweight handle to a `Blob.Store`. The store can be backed by memory (`.bytes`), a file (`.file`), or an S3 object (`.s3`). This allows Bun to implement optimized operations based on the blob's backing store (e.g., `Bun.write(file1, file2)` becomes a native file copy via `copy_file.zig`). +- **`Blob` and `Blob.Store` (`Blob.rust`):** A `Blob` is a lightweight handle to a `Blob.Store`. The store can be backed by memory (`.bytes`), a file (`.file`), or an S3 object (`.s3`). This allows Bun to implement optimized operations based on the blob's backing store (e.g., `Bun.write(file1, file2)` becomes a native file copy via `copy_file.rust`). - **`Blob.slice()` as a Zero-Copy View:** `blob.slice()` is a constant-time operation that creates a new `Blob` handle pointing to the same store but with a different `offset` and `size`, avoiding any data duplication. - **`is_all_ascii` Flag:** `Blob`s and `ByteStream`s track whether their content is known to be pure ASCII. This allows `.text()` to skip expensive UTF-8 validation and decoding for a large class of text-based data, treating the Latin-1 bytes directly as a string. - **`WTFStringImpl` Integration:** Bun avoids copying JS strings by default, instead storing a pointer to WebKit's internal `WTF::StringImpl` (`Body.Value.WTFStringImpl`). The conversion to a UTF-8 byte buffer is deferred until it's absolutely necessary (e.g., writing to a socket), avoiding copies for string-based operations that might never touch the network. diff --git a/src/jsc/SavedSourceMap.zig b/src/jsc/SavedSourceMap.zig index 382af7d7589..76d3fd1a0b8 100644 --- a/src/jsc/SavedSourceMap.zig +++ b/src/jsc/SavedSourceMap.zig @@ -85,12 +85,12 @@ pub fn removeDevServerSourceProvider(this: *SavedSourceMap, opaque_source_provid } } -pub fn putZigSourceProvider(this: *SavedSourceMap, opaque_source_provider: *anyopaque, path: []const u8) void { +pub fn putRustSourceProvider(this: *SavedSourceMap, opaque_source_provider: *anyopaque, path: []const u8) void { const source_provider: *SourceProviderMap = @ptrCast(opaque_source_provider); bun.handleOom(this.putValue(path, Value.init(source_provider))); } -pub fn removeZigSourceProvider(this: *SavedSourceMap, opaque_source_provider: *anyopaque, path: []const u8) void { +pub fn removeRustSourceProvider(this: *SavedSourceMap, opaque_source_provider: *anyopaque, path: []const u8) void { this.lock(); defer this.unlock(); @@ -130,7 +130,7 @@ pub fn deinit(this: *SavedSourceMap) void { if (value.get(ParsedSourceMap)) |source_map| { source_map.deref(); } else if (value.get(SourceProviderMap)) |provider| { - _ = provider; // do nothing, we did not hold a ref to ZigSourceProvider + _ = provider; // do nothing, we did not hold a ref to RustSourceProvider } else if (value.get(InternalSourceMap)) |ism| { (InternalSourceMap{ .data = @as([*]u8, @ptrCast(ism)) }).deinit(); } @@ -175,7 +175,7 @@ pub fn putValue(this: *SavedSourceMap, path: []const u8, value: Value) !void { var source_map: *ParsedSourceMap = parsed_source_map; source_map.deref(); } else if (old_value.get(SourceProviderMap)) |provider| { - _ = provider; // do nothing, we did not hold a ref to ZigSourceProvider + _ = provider; // do nothing, we did not hold a ref to RustSourceProvider } else if (old_value.get(InternalSourceMap)) |ism| { (InternalSourceMap{ .data = @as([*]u8, @ptrCast(ism)) }).deinit(); } diff --git a/src/jsc/Strong.zig b/src/jsc/Strong.zig index 8c22aa9da4a..deddfa2b77b 100644 --- a/src/jsc/Strong.zig +++ b/src/jsc/Strong.zig @@ -147,7 +147,7 @@ pub const Impl = opaque { extern fn Bun__StrongRef__clear(this: *Impl) void; }; -pub const Deprecated = @import("./DeprecatedStrong.zig"); +pub const Deprecated = @import("./DeprecatedStrong.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/jsc/Task.zig b/src/jsc/Task.zig index 20d9bbc6ae6..de6b1120337 100644 --- a/src/jsc/Task.zig +++ b/src/jsc/Task.zig @@ -559,10 +559,10 @@ const ProcessWaiterThreadTask = if (Environment.isPosix) bun.spawn.process.Waite const log = bun.Output.scoped(.Task, .hidden); -const Fetch = @import("../runtime/webcore/fetch.zig"); +const Fetch = @import("../runtime/webcore/fetch.rust"); const FetchTasklet = Fetch.FetchTasklet; -const JSCScheduler = @import("./JSCScheduler.zig"); +const JSCScheduler = @import("./JSCScheduler.rust"); const JSCDeferredWorkTask = JSCScheduler.JSCDeferredWorkTask; const bun = @import("bun"); diff --git a/src/jsc/TopExceptionScope.zig b/src/jsc/TopExceptionScope.zig index 8aa7e781dee..f2ca6125751 100644 --- a/src/jsc/TopExceptionScope.zig +++ b/src/jsc/TopExceptionScope.zig @@ -3,10 +3,10 @@ const size = if (Environment.allow_assert or Environment.enable_asan) 56 else 8; const alignment = 8; /// Binding for JSC::TopExceptionScope. This should be used rarely, only at translation boundaries between -/// JSC's exception checking and Zig's. Make sure not to move it after creation. Use this if you are +/// JSC's exception checking and Rust's. Make sure not to move it after creation. Use this if you are /// making an external call that has no other way to indicate an exception. /// -/// ```zig +/// ```rust /// // Declare a TopExceptionScope surrounding the call that may throw an exception /// var scope: TopExceptionScope = undefined; /// scope.init(global, @src()); @@ -15,7 +15,7 @@ const alignment = 8; /// const value: i32 = external_call(vm, foo, bar, baz); /// // Calling returnIfException() suffices to prove that we checked for an exception. /// // This function's caller does not need to use a TopExceptionScope or ThrowScope -/// // because it can use Zig error unions. +/// // because it can use Rust error unions. /// try scope.returnIfException(); /// return value; /// ``` @@ -132,7 +132,7 @@ pub const TopExceptionScope = struct { /// exceptions and you only need a TopExceptionScope to prove that you are checking exceptions correctly. /// Gated by `Environment.ci_assert`. /// -/// ```zig +/// ```rust /// var scope: ExceptionValidationScope = undefined; /// // these do nothing when ci_assert == false /// scope.init(global, @src()); diff --git a/src/jsc/URLSearchParams.zig b/src/jsc/URLSearchParams.zig index 857067b4b76..1f70ed9b62f 100644 --- a/src/jsc/URLSearchParams.zig +++ b/src/jsc/URLSearchParams.zig @@ -1,6 +1,6 @@ pub const URLSearchParams = opaque { - extern fn URLSearchParams__create(globalObject: *JSGlobalObject, *const ZigString) JSValue; - pub fn create(globalObject: *JSGlobalObject, init: ZigString) JSValue { + extern fn URLSearchParams__create(globalObject: *JSGlobalObject, *const RustString) JSValue; + pub fn create(globalObject: *JSGlobalObject, init: RustString) JSValue { jsc.markBinding(@src()); return URLSearchParams__create(globalObject, &init); } @@ -14,19 +14,19 @@ pub const URLSearchParams = opaque { extern fn URLSearchParams__toString( self: *URLSearchParams, ctx: *anyopaque, - callback: *const fn (ctx: *anyopaque, str: *const ZigString) callconv(.c) void, + callback: *const fn (ctx: *anyopaque, str: *const RustString) callconv(.c) void, ) void; pub fn toString( self: *URLSearchParams, comptime Ctx: type, ctx: *Ctx, - comptime callback: *const fn (ctx: *Ctx, str: ZigString) void, + comptime callback: *const fn (ctx: *Ctx, str: RustString) void, ) void { jsc.markBinding(@src()); const Wrap = struct { const cb_ = callback; - pub fn cb(c: *anyopaque, str: *const ZigString) callconv(.c) void { + pub fn cb(c: *anyopaque, str: *const RustString) callconv(.c) void { cb_( bun.cast(*Ctx, c), str.*, @@ -39,7 +39,7 @@ pub const URLSearchParams = opaque { }; const bun = @import("bun"); -const ZigString = @import("./ZigString.zig").ZigString; +const RustString = @import("./RustString.rust").RustString; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/jsc/VirtualMachine.zig b/src/jsc/VirtualMachine.zig index 461906c6b3a..12537d4c17d 100644 --- a/src/jsc/VirtualMachine.zig +++ b/src/jsc/VirtualMachine.zig @@ -74,7 +74,7 @@ default_verbose_fetch: ?bun.http.HTTPVerboseLevel = null, /// It exists in the VirtualMachine struct so that we don't accidentally /// make a stack copy of it only use it through source_mappings. /// -/// This proposal could let us safely move it back https://github.com/ziglang/zig/issues/7769 +/// This proposal could let us safely move it back https://github.com/rustlang/rust/issues/7769 saved_source_map_table: SavedSourceMap.HashTable = undefined, source_mappings: SavedSourceMap = undefined, @@ -237,10 +237,10 @@ pub fn getDevServerAsyncLocalStorage(this: *VirtualMachine) !?jsc.JSValue { return jsvalue; } -pub const ProcessAutoKiller = @import("./ProcessAutoKiller.zig"); +pub const ProcessAutoKiller = @import("./ProcessAutoKiller.rust"); pub const OnUnhandledRejection = fn (*VirtualMachine, globalObject: *JSGlobalObject, JSValue) void; -pub const OnException = fn (*ZigException) void; +pub const OnException = fn (*RustException) void; pub fn allowAddons(this: *VirtualMachine) callconv(.c) bool { return if (this.transpiler.options.transform_options.allow_addons) |allow_addons| allow_addons else true; @@ -955,7 +955,7 @@ pub fn onExit(this: *VirtualMachine) void { } } -extern fn Zig__GlobalObject__destructOnExit(*JSGlobalObject) void; +extern fn Rust__GlobalObject__destructOnExit(*JSGlobalObject) void; pub fn globalExit(this: *VirtualMachine) noreturn { bun.assert(this.isShuttingDown()); @@ -975,11 +975,11 @@ pub fn globalExit(this: *VirtualMachine) noreturn { // Embedded per-VM socket groups must drain while JSC is still alive // (closeAll() fires on_close → JS). After JSC teardown, // RareData.deinit() only deinit()s the groups (asserts empty). - // Mirrors web_worker.zig — without this, every still-open Bun.connect + // Mirrors web_worker.rust — without this, every still-open Bun.connect // / postgres / etc. socket is an LSAN leak under // BUN_DESTRUCT_VM_ON_EXIT. if (this.rare_data) |rare| rare.closeAllSocketGroups(this); - Zig__GlobalObject__destructOnExit(this.global); + Rust__GlobalObject__destructOnExit(this.global); // lastChanceToFinalize() above runs Listener/Server finalize → their // own embedded group.closeAll() → sockets land in loop.closed_head. // The pre-JSC drain in closeAllSocketGroups() can't see those (the @@ -2003,7 +2003,7 @@ pub fn resolveMaybeNeedsTrailingSlash( if (query_string) |query| { // `result.query_string` is a slice into `specifier_utf8`, which is freed by - // `defer specifier_utf8.deinit()` before callers (C++ or Zig) read the out-param. + // `defer specifier_utf8.deinit()` before callers (C++ or Rust) read the out-param. // Clone into an owned bun.String so it survives this function returning. query.* = if (result.query_string.len > 0) bun.String.cloneUTF8(result.query_string) @@ -2094,7 +2094,7 @@ pub fn processFetchLog(globalThis: *JSGlobalObject, specifier: bun.String, refer err, globalThis.createAggregateError( errors, - &ZigString.init( + &RustString.init( std.fmt.allocPrint(globalThis.allocator(), "{d} errors building \"{f}\"", .{ errors.len, specifier, @@ -2197,7 +2197,7 @@ pub fn clearEntryPoint(this: *VirtualMachine) bun.JSError!void { return; } - var str = ZigString.init(main_file_name); + var str = RustString.init(main_file_name); try this.global.deleteModuleRegistryEntry(&str); } @@ -2499,7 +2499,7 @@ pub fn removeListeningSocketForWatchMode(this: *VirtualMachine, socket: bun.FD) } /// `bun test --isolate`: tear down per-file OS resources, bump the generation -/// so stale callbacks self-cancel, then create a fresh `ZigGlobalObject` on +/// so stale callbacks self-cancel, then create a fresh `RustGlobalObject` on /// the same `JSC::VM` and point `this.global` at it. The old global is /// gcUnprotect'd; its module graph becomes collectable on the next GC. pub fn swapGlobalForTestIsolation(this: *VirtualMachine) void { @@ -2583,10 +2583,10 @@ pub fn swapGlobalForTestIsolation(this: *VirtualMachine) void { if (this.ipc) |ipc| if (ipc == .initialized) { ipc.initialized.globalThis = new_global; }; - // NapiEnv cleanup hooks registered via napi_internal_register_cleanup_zig + // NapiEnv cleanup hooks registered via napi_internal_register_cleanup_rust // captured the old global in CleanupHook.globalThis; the C++ side has // already retargeted env->m_globalObject to the new global, so only the - // Zig-side bookkeeping pointer is stale. Nothing currently reads it + // Rust-side bookkeeping pointer is stale. Nothing currently reads it // (execute() only calls func(ctx) and there's no per-entry removal // path), but repoint it anyway so the field doesn't dangle at a freed // GC cell. @@ -2623,7 +2623,7 @@ pub fn loadMacroEntryPoint(this: *VirtualMachine, entry_path: string, function_n /// A subtlelty of JavaScriptCore: /// JavaScriptCore has many release asserts that check an API lock is currently held -/// We cannot hold it from Zig code because it relies on C++ ARIA to automatically release the lock +/// We cannot hold it from Rust code because it relies on C++ ARIA to automatically release the lock /// and it is not safe to copy the lock itself /// So we have to wrap entry points to & from JavaScript with an API lock that calls out to C++ pub fn runWithAPILock(this: *VirtualMachine, comptime Context: type, ctx: *Context, comptime function: fn (ctx: *Context) void) void { @@ -2653,13 +2653,13 @@ pub fn printErrorLikeObjectToConsole(this: *VirtualMachine, value: JSValue) void this.runErrorHandler(value, null); } -// When the Error-like object is one of our own, it's best to rely on the object directly instead of serializing it to a ZigException. +// When the Error-like object is one of our own, it's best to rely on the object directly instead of serializing it to a RustException. // This is for: // - BuildMessage // - ResolveMessage // If there were multiple errors, it could be contained in an AggregateError. // In that case, this function becomes recursive. -// In all other cases, we will convert it to a ZigException. +// In all other cases, we will convert it to a RustException. pub fn printErrorlikeObject( this: *VirtualMachine, value: JSValue, @@ -2676,20 +2676,20 @@ pub fn printErrorlikeObject( defer { if (was_internal) { if (exception) |exception_| { - var holder = ZigException.Holder.init(); - var zig_exception: *ZigException = holder.zigException(); + var holder = RustException.Holder.init(); + var rust_exception: *RustException = holder.rustException(); holder.deinit(this); - exception_.getStackTrace(this.global, &zig_exception.stack); - if (zig_exception.stack.frames_len > 0) { + exception_.getStackTrace(this.global, &rust_exception.stack); + if (rust_exception.stack.frames_len > 0) { if (allow_ansi_color) { - printStackTrace(Writer, writer, zig_exception.stack, true) catch {}; + printStackTrace(Writer, writer, rust_exception.stack, true) catch {}; } else { - printStackTrace(Writer, writer, zig_exception.stack, false) catch {}; + printStackTrace(Writer, writer, rust_exception.stack, false) catch {}; } } if (exception_list) |list| { - zig_exception.addToErrorList(list, this.transpiler.fs.top_level_dir, &this.origin) catch {}; + rust_exception.addToErrorList(list, this.transpiler.fs.top_level_dir, &this.origin) catch {}; } } } @@ -2810,7 +2810,7 @@ pub fn reportUncaughtException(globalObject: *JSGlobalObject, exception: *Except return .js_undefined; } -pub fn printStackTrace(comptime Writer: type, writer: Writer, trace: ZigStackTrace, comptime allow_ansi_colors: bool) !void { +pub fn printStackTrace(comptime Writer: type, writer: Writer, trace: RustStackTrace, comptime allow_ansi_colors: bool) !void { const stack = trace.frames(); if (stack.len > 0) { var vm = VirtualMachine.get(); @@ -2895,13 +2895,13 @@ pub fn printStackTrace(comptime Writer: type, writer: Writer, trace: ZigStackTra } } -pub export fn Bun__remapStackFramePositions(vm: *jsc.VirtualMachine, frames: [*]jsc.ZigStackFrame, frames_count: usize) void { +pub export fn Bun__remapStackFramePositions(vm: *jsc.VirtualMachine, frames: [*]jsc.RustStackFrame, frames_count: usize) void { // **Warning** this method can be called in the heap collector thread!! // https://github.com/oven-sh/bun/issues/17087 vm.remapStackFramePositions(frames, frames_count); } -pub fn remapStackFramePositions(this: *VirtualMachine, frames: [*]jsc.ZigStackFrame, frames_count: usize) void { +pub fn remapStackFramePositions(this: *VirtualMachine, frames: [*]jsc.RustStackFrame, frames_count: usize) void { if (frames_count == 0) return; // **Warning** this method can be called in the heap collector thread!! @@ -3006,7 +3006,7 @@ pub fn remapStackFramePositions(this: *VirtualMachine, frames: [*]jsc.ZigStackFr sm.last_ism = if (cached == .ism) cached.ism else null; } -fn remapOneFrameSlow(this: *VirtualMachine, frame: *jsc.ZigStackFrame, path: []const u8) void { +fn remapOneFrameSlow(this: *VirtualMachine, frame: *jsc.RustStackFrame, path: []const u8) void { if (this.resolveSourceMapping( path, frame.position.line, @@ -3026,16 +3026,16 @@ fn remapOneFrameSlow(this: *VirtualMachine, frame: *jsc.ZigStackFrame, path: []c frame.remapped = true; } -pub fn remapZigException( +pub fn remapRustException( this: *VirtualMachine, - exception: *ZigException, + exception: *RustException, error_instance: JSValue, exception_list: ?*ExceptionList, must_reset_parser_arena_later: *bool, - source_code_slice: *?ZigString.Slice, + source_code_slice: *?RustString.Slice, allow_source_code_preview: bool, ) void { - error_instance.toZigException(this.global, exception); + error_instance.toRustException(this.global, exception); var enable_source_code_preview = allow_source_code_preview and !(bun.feature_flag.BUN_DISABLE_SOURCE_CODE_PREVIEW.get() or bun.feature_flag.BUN_DISABLE_TRANSPILED_SOURCE_CODE_PREVIEW.get()); @@ -3063,7 +3063,7 @@ pub fn remapZigException( .{"processTicksAndRejections"}, }); - var frames: []jsc.ZigStackFrame = exception.stack.frames_ptr[0..exception.stack.frames_len]; + var frames: []jsc.RustStackFrame = exception.stack.frames_ptr[0..exception.stack.frames_len]; if (this.hide_bun_stackframes) { var start_index: ?usize = null; for (frames, 0..) |frame, i| { @@ -3175,7 +3175,7 @@ pub fn remapZigException( const code = code: { if (!enable_source_code_preview) { - break :code ZigString.Slice.empty; + break :code RustString.Slice.empty; } if (!top.remapped and lookup.source_map != null and lookup.source_map.?.isExternal()) { @@ -3186,7 +3186,7 @@ pub fn remapZigException( if (top_frame_is_builtin) { // Avoid printing "export default 'native'" - break :code ZigString.Slice.empty; + break :code RustString.Slice.empty; } var log = logger.Log.init(bun.default_allocator); defer log.deinit(); @@ -3213,11 +3213,11 @@ pub fn remapZigException( if (strings.getLinesInText( code.slice(), @intCast(last_line), - ZigException.Holder.source_lines_count, + RustException.Holder.source_lines_count, )) |lines_buf| { var lines = lines_buf.slice(); - var source_lines = exception.stack.source_lines_ptr[0..ZigException.Holder.source_lines_count]; - var source_line_numbers = exception.stack.source_lines_numbers[0..ZigException.Holder.source_lines_count]; + var source_lines = exception.stack.source_lines_ptr[0..RustException.Holder.source_lines_count]; + var source_line_numbers = exception.stack.source_lines_numbers[0..RustException.Holder.source_lines_count]; @memset(source_lines, String.empty); @memset(source_line_numbers, 0); @@ -3262,9 +3262,9 @@ pub fn remapZigException( } } -pub fn printExternallyRemappedZigException( +pub fn printExternallyRemappedRustException( this: *VirtualMachine, - zig_exception: *ZigException, + rust_exception: *RustException, formatter: ?*ConsoleObject.Formatter, comptime Writer: type, writer: Writer, @@ -3274,8 +3274,8 @@ pub fn printExternallyRemappedZigException( var default_formatter: ConsoleObject.Formatter = .{ .globalThis = this.global }; defer default_formatter.deinit(); try this.printErrorInstance( - .zig_exception, - zig_exception, + .rust_exception, + rust_exception, null, formatter orelse &default_formatter, Writer, @@ -3287,10 +3287,10 @@ pub fn printExternallyRemappedZigException( fn printErrorInstance( this: *VirtualMachine, - comptime mode: enum { js, zig_exception }, + comptime mode: enum { js, rust_exception }, error_instance: switch (mode) { .js => JSValue, - .zig_exception => *ZigException, + .rust_exception => *RustException, }, exception_list: ?*ExceptionList, formatter: *ConsoleObject.Formatter, @@ -3299,19 +3299,19 @@ fn printErrorInstance( comptime allow_ansi_color: bool, comptime allow_side_effects: bool, ) !void { - var exception_holder = if (mode == .js) ZigException.Holder.init(); - var exception = if (mode == .js) exception_holder.zigException() else error_instance; + var exception_holder = if (mode == .js) RustException.Holder.init(); + var exception = if (mode == .js) exception_holder.rustException() else error_instance; defer if (mode == .js) exception_holder.deinit(this); defer if (mode == .js) error_instance.ensureStillAlive(); - // The ZigException structure stores substrings of the source code, in + // The RustException structure stores substrings of the source code, in // which we need the lifetime of this data to outlive the inner call to - // remapZigException, but still get freed. - var source_code_slice: ?ZigString.Slice = null; + // remapRustException, but still get freed. + var source_code_slice: ?RustString.Slice = null; defer if (source_code_slice) |slice| slice.deinit(); if (mode == .js) { - this.remapZigException( + this.remapRustException( exception, error_instance, exception_list, @@ -3736,7 +3736,7 @@ fn printErrorNameAndMessage( // In Github Actions, emit an annotation that renders the error and location. // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message -pub noinline fn printGithubAnnotation(exception: *ZigException) void { +pub noinline fn printGithubAnnotation(exception: *RustException) void { @branchHint(.cold); const name = exception.name; const message = exception.message; @@ -3802,7 +3802,7 @@ pub noinline fn printGithubAnnotation(exception: *ZigException) void { } if (cursor > 0) { - const body = ZigString.initUTF8(msg[cursor..]); + const body = RustString.initUTF8(msg[cursor..]); writer.print("{f}", .{body.githubAction()}) catch {}; } } else { @@ -3916,7 +3916,7 @@ pub const IPCInstance = struct { data: IPC.SendQueue, has_disconnect_called: bool = false, - const node_cluster_binding = @import("../runtime/node/node_cluster_binding.zig"); + const node_cluster_binding = @import("../runtime/node/node_cluster_binding.rust"); pub fn ipc(this: *IPCInstance) ?*IPC.SendQueue { return &this.data; @@ -4097,22 +4097,22 @@ pub const ExitHandler = struct { const string = []const u8; -const Config = @import("./config.zig"); -const Counters = @import("./Counters.zig"); -const Fs = @import("../resolver/fs.zig"); -const IPC = @import("./ipc.zig"); -const Resolver = @import("../resolver/resolver.zig"); -const Runtime = @import("../js_parser/runtime.zig"); -const node_module_module = @import("./NodeModuleModule.zig"); +const Config = @import("./config.rust"); +const Counters = @import("./Counters.rust"); +const Fs = @import("../resolver/fs.rust"); +const IPC = @import("./ipc.rust"); +const Resolver = @import("../resolver/resolver.rust"); +const Runtime = @import("../js_parser/runtime.rust"); +const node_module_module = @import("./NodeModuleModule.rust"); const std = @import("std"); -const PackageManager = @import("../install/install.zig").PackageManager; -const URL = @import("../url/url.zig").URL; +const PackageManager = @import("../install/install.rust").PackageManager; +const URL = @import("../url/url.rust").URL; const Allocator = std.mem.Allocator; -const CPUProfiler = @import("./BunCPUProfiler.zig"); +const CPUProfiler = @import("./BunCPUProfiler.rust"); const CPUProfilerConfig = CPUProfiler.CPUProfilerConfig; -const HeapProfiler = @import("./BunHeapProfiler.zig"); +const HeapProfiler = @import("./BunHeapProfiler.rust"); const HeapProfilerConfig = HeapProfiler.HeapProfilerConfig; const bun = @import("bun"); @@ -4153,9 +4153,9 @@ const Node = jsc.Node; const ResolvedSource = jsc.ResolvedSource; const SavedSourceMap = jsc.SavedSourceMap; const VM = jsc.VM; -const ZigException = jsc.ZigException; -const ZigStackTrace = jsc.ZigStackTrace; -const ZigString = jsc.ZigString; +const RustException = jsc.RustException; +const RustStackTrace = jsc.RustStackTrace; +const RustString = jsc.RustString; const Bun = jsc.API.Bun; const ModuleLoader = jsc.ModuleLoader; diff --git a/src/jsc/WTF.zig b/src/jsc/WTF.zig index f8a6d387ba2..f3360830c71 100644 --- a/src/jsc/WTF.zig +++ b/src/jsc/WTF.zig @@ -62,7 +62,7 @@ pub const WTF = struct { return buffer[0..@intCast(res)]; } - pub const StringBuilder = @import("./StringBuilder.zig"); + pub const StringBuilder = @import("./StringBuilder.rust"); }; const std = @import("std"); diff --git a/src/jsc/ZigErrorType.zig b/src/jsc/ZigErrorType.zig index acb554889a6..e03e5353689 100644 --- a/src/jsc/ZigErrorType.zig +++ b/src/jsc/ZigErrorType.zig @@ -1,7 +1,7 @@ -pub const ZigErrorType = extern struct { +pub const RustErrorType = extern struct { code: ErrorCode, value: bun.jsc.JSValue, }; const bun = @import("bun"); -const ErrorCode = @import("./ErrorCode.zig").ErrorCode; +const ErrorCode = @import("./ErrorCode.rust").ErrorCode; diff --git a/src/jsc/ZigException.zig b/src/jsc/ZigException.zig index e5daba366f3..f8b9bcedce3 100644 --- a/src/jsc/ZigException.zig +++ b/src/jsc/ZigException.zig @@ -1,5 +1,5 @@ /// Represents a JavaScript exception with additional information -pub const ZigException = extern struct { +pub const RustException = extern struct { type: JSErrorCode, runtime_type: JSRuntimeType, @@ -14,7 +14,7 @@ pub const ZigException = extern struct { name: String, message: String, - stack: ZigStackTrace, + stack: RustStackTrace, exception: ?*anyopaque, @@ -24,13 +24,13 @@ pub const ZigException = extern struct { browser_url: String = .empty, - pub extern fn ZigException__collectSourceLines(jsValue: JSValue, global: *JSGlobalObject, exception: *ZigException) void; + pub extern fn RustException__collectSourceLines(jsValue: JSValue, global: *JSGlobalObject, exception: *RustException) void; - pub fn collectSourceLines(this: *ZigException, value: JSValue, global: *JSGlobalObject) void { - ZigException__collectSourceLines(value, global, this); + pub fn collectSourceLines(this: *RustException, value: JSValue, global: *JSGlobalObject) void { + RustException__collectSourceLines(value, global, this); } - pub fn deinit(this: *ZigException) void { + pub fn deinit(this: *RustException) void { this.syscall.deref(); this.system_code.deref(); this.path.deref(); @@ -56,15 +56,15 @@ pub const ZigException = extern struct { pub const source_lines_count = 6; source_line_numbers: [source_lines_count]i32, source_lines: [source_lines_count]String, - frames: [frame_count]ZigStackFrame, + frames: [frame_count]RustStackFrame, loaded: bool, - zig_exception: ZigException, + rust_exception: RustException, need_to_clear_parser_arena_on_deinit: bool = false, pub const Zero: Holder = Holder{ .frames = brk: { - var _frames: [frame_count]ZigStackFrame = undefined; - @memset(&_frames, ZigStackFrame.Zero); + var _frames: [frame_count]RustStackFrame = undefined; + @memset(&_frames, RustStackFrame.Zero); break :brk _frames; }, .source_line_numbers = brk: { @@ -78,7 +78,7 @@ pub const ZigException = extern struct { @memset(&lines, String.empty); break :brk lines; }, - .zig_exception = undefined, + .rust_exception = undefined, .loaded = false, }; @@ -88,22 +88,22 @@ pub const ZigException = extern struct { pub fn deinit(this: *Holder, vm: *jsc.VirtualMachine) void { if (this.loaded) { - this.zig_exception.deinit(); + this.rust_exception.deinit(); } if (this.need_to_clear_parser_arena_on_deinit) { vm.module_loader.resetArena(vm); } } - pub fn zigException(this: *Holder) *ZigException { + pub fn rustException(this: *Holder) *RustException { if (!this.loaded) { - this.zig_exception = ZigException{ + this.rust_exception = RustException{ .type = @as(JSErrorCode, @enumFromInt(255)), .runtime_type = JSRuntimeType.Nothing, .name = String.empty, .message = String.empty, .exception = null, - .stack = ZigStackTrace{ + .stack = RustStackTrace{ .source_lines_ptr = &this.source_lines, .source_lines_numbers = &this.source_line_numbers, .source_lines_len = source_lines_count, @@ -116,18 +116,18 @@ pub const ZigException = extern struct { this.loaded = true; } - return &this.zig_exception; + return &this.rust_exception; } }; - extern fn ZigException__fromException(*Exception) ZigException; - pub const fromException = ZigException__fromException; + extern fn RustException__fromException(*Exception) RustException; + pub const fromException = RustException__fromException; pub fn addToErrorList( - this: *ZigException, + this: *RustException, error_list: *std.array_list.Managed(api.JsException), root_path: string, - origin: ?*const ZigURL, + origin: ?*const RustURL, ) !void { const name_slice = this.name.toUTF8(bun.default_allocator); const message_slice = this.message.toUTF8(bun.default_allocator); @@ -167,7 +167,7 @@ pub const ZigException = extern struct { const string = []const u8; const std = @import("std"); -const ZigURL = @import("../url/url.zig").URL; +const RustURL = @import("../url/url.rust").URL; const bun = @import("bun"); const String = bun.String; @@ -179,5 +179,5 @@ const JSErrorCode = jsc.JSErrorCode; const JSGlobalObject = jsc.JSGlobalObject; const JSRuntimeType = jsc.JSRuntimeType; const JSValue = jsc.JSValue; -const ZigStackFrame = jsc.ZigStackFrame; -const ZigStackTrace = jsc.ZigStackTrace; +const RustStackFrame = jsc.RustStackFrame; +const RustStackTrace = jsc.RustStackTrace; diff --git a/src/jsc/ZigStackFrame.zig b/src/jsc/ZigStackFrame.zig index ecce2dbfb0b..96f8eb3a6a1 100644 --- a/src/jsc/ZigStackFrame.zig +++ b/src/jsc/ZigStackFrame.zig @@ -1,11 +1,11 @@ const string = []const u8; /// Represents a single frame in a stack trace -pub const ZigStackFrame = extern struct { +pub const RustStackFrame = extern struct { function_name: String, source_url: String, - position: ZigStackFramePosition, - code_type: ZigStackFrameCode, + position: RustStackFramePosition, + code_type: RustStackFrameCode, is_async: bool, /// This informs formatters whether to display as a blob URL or not @@ -14,12 +14,12 @@ pub const ZigStackFrame = extern struct { /// -1 means not set. jsc_stack_frame_index: i32 = -1, - pub fn deinit(this: *ZigStackFrame) void { + pub fn deinit(this: *RustStackFrame) void { this.function_name.deref(); this.source_url.deref(); } - pub fn toAPI(this: *const ZigStackFrame, root_path: string, origin: ?*const ZigURL, allocator: std.mem.Allocator) !api.StackFrame { + pub fn toAPI(this: *const RustStackFrame, root_path: string, origin: ?*const RustURL, allocator: std.mem.Allocator) !api.StackFrame { var frame: api.StackFrame = comptime std.mem.zeroes(api.StackFrame); if (!this.function_name.isEmpty()) { var slicer = this.function_name.toUTF8(allocator); @@ -42,9 +42,9 @@ pub const ZigStackFrame = extern struct { pub const SourceURLFormatter = struct { source_url: bun.String, - position: ZigStackFramePosition, + position: RustStackFramePosition, enable_color: bool, - origin: ?*const ZigURL, + origin: ?*const RustURL, exclude_line_column: bool = false, remapped: bool = false, root_path: string = "", @@ -140,7 +140,7 @@ pub const ZigStackFrame = extern struct { pub const NameFormatter = struct { function_name: String, - code_type: ZigStackFrameCode, + code_type: RustStackFrameCode, enable_color: bool, is_async: bool, @@ -212,7 +212,7 @@ pub const ZigStackFrame = extern struct { } }; - pub const Zero: ZigStackFrame = .{ + pub const Zero: RustStackFrame = .{ .function_name = .empty, .code_type = .None, .source_url = .empty, @@ -221,11 +221,11 @@ pub const ZigStackFrame = extern struct { .jsc_stack_frame_index = -1, }; - pub fn nameFormatter(this: *const ZigStackFrame, comptime enable_color: bool) NameFormatter { + pub fn nameFormatter(this: *const RustStackFrame, comptime enable_color: bool) NameFormatter { return NameFormatter{ .function_name = this.function_name, .code_type = this.code_type, .enable_color = enable_color, .is_async = this.is_async }; } - pub fn sourceURLFormatter(this: *const ZigStackFrame, root_path: string, origin: ?*const ZigURL, exclude_line_column: bool, comptime enable_color: bool) SourceURLFormatter { + pub fn sourceURLFormatter(this: *const RustStackFrame, root_path: string, origin: ?*const RustURL, exclude_line_column: bool, comptime enable_color: bool) SourceURLFormatter { return SourceURLFormatter{ .source_url = this.source_url, .exclude_line_column = exclude_line_column, @@ -239,7 +239,7 @@ pub const ZigStackFrame = extern struct { }; const std = @import("std"); -const ZigURL = @import("../url/url.zig").URL; +const RustURL = @import("../url/url.rust").URL; const bun = @import("bun"); const Output = bun.Output; @@ -248,5 +248,5 @@ const strings = bun.strings; const api = bun.schema.api; const jsc = bun.jsc; -const ZigStackFrameCode = jsc.ZigStackFrameCode; -const ZigStackFramePosition = jsc.ZigStackFramePosition; +const RustStackFrameCode = jsc.RustStackFrameCode; +const RustStackFramePosition = jsc.RustStackFramePosition; diff --git a/src/jsc/ZigStackFrameCode.zig b/src/jsc/ZigStackFrameCode.zig index 955fdab0cf5..445ec3ab381 100644 --- a/src/jsc/ZigStackFrameCode.zig +++ b/src/jsc/ZigStackFrameCode.zig @@ -1,4 +1,4 @@ -pub const ZigStackFrameCode = enum(u8) { +pub const RustStackFrameCode = enum(u8) { None = 0, /// 🏃 Eval = 1, @@ -14,7 +14,7 @@ pub const ZigStackFrameCode = enum(u8) { Constructor = 6, _, - pub fn emoji(this: ZigStackFrameCode) u21 { + pub fn emoji(this: RustStackFrameCode) u21 { return switch (this) { .Eval => 0x1F3C3, .Module => 0x1F4E6, @@ -26,7 +26,7 @@ pub const ZigStackFrameCode = enum(u8) { }; } - pub fn ansiColor(this: ZigStackFrameCode) []const u8 { + pub fn ansiColor(this: RustStackFrameCode) []const u8 { return switch (this) { .Eval => "\x1b[31m", .Module => "\x1b[36m", diff --git a/src/jsc/ZigStackFramePosition.zig b/src/jsc/ZigStackFramePosition.zig index eb16d9f5694..e8fa3081711 100644 --- a/src/jsc/ZigStackFramePosition.zig +++ b/src/jsc/ZigStackFramePosition.zig @@ -1,17 +1,17 @@ /// Represents a position in source code with line and column information -pub const ZigStackFramePosition = extern struct { +pub const RustStackFramePosition = extern struct { line: bun.Ordinal, column: bun.Ordinal, /// -1 if not present line_start_byte: c_int, - pub const invalid = ZigStackFramePosition{ + pub const invalid = RustStackFramePosition{ .line = .invalid, .column = .invalid, .line_start_byte = -1, }; - pub fn isInvalid(this: *const ZigStackFramePosition) bool { + pub fn isInvalid(this: *const RustStackFramePosition) bool { return std.mem.eql(u8, std.mem.asBytes(this), std.mem.asBytes(&invalid)); } diff --git a/src/jsc/ZigStackTrace.zig b/src/jsc/ZigStackTrace.zig index 0680022839e..72557c41f2a 100644 --- a/src/jsc/ZigStackTrace.zig +++ b/src/jsc/ZigStackTrace.zig @@ -1,13 +1,13 @@ const string = []const u8; /// Represents a JavaScript stack trace -pub const ZigStackTrace = extern struct { +pub const RustStackTrace = extern struct { source_lines_ptr: [*]bun.String, source_lines_numbers: [*]i32, source_lines_len: u8, source_lines_to_collect: u8, - frames_ptr: [*]ZigStackFrame, + frames_ptr: [*]RustStackFrame, frames_len: u8, frames_cap: u8, @@ -15,7 +15,7 @@ pub const ZigStackTrace = extern struct { /// If so, then .deref must be called on it to release the memory. referenced_source_provider: ?*SourceProvider = null, - pub fn fromFrames(frames_slice: []ZigStackFrame) ZigStackTrace { + pub fn fromFrames(frames_slice: []RustStackFrame) RustStackTrace { return .{ .source_lines_ptr = &[0]bun.String{}, .source_lines_numbers = &[0]i32{}, @@ -31,10 +31,10 @@ pub const ZigStackTrace = extern struct { } pub fn toAPI( - this: *const ZigStackTrace, + this: *const RustStackTrace, allocator: std.mem.Allocator, root_path: string, - origin: ?*const ZigURL, + origin: ?*const RustURL, ) !api.StackTrace { var stack_trace: api.StackTrace = comptime std.mem.zeroes(api.StackTrace); { @@ -83,21 +83,21 @@ pub const ZigStackTrace = extern struct { return stack_trace; } - pub fn frames(this: *const ZigStackTrace) []const ZigStackFrame { + pub fn frames(this: *const RustStackTrace) []const RustStackFrame { return this.frames_ptr[0..this.frames_len]; } - pub fn framesMutable(this: *ZigStackTrace) []ZigStackFrame { + pub fn framesMutable(this: *RustStackTrace) []RustStackFrame { return this.frames_ptr[0..this.frames_len]; } pub const SourceLineIterator = struct { - trace: *const ZigStackTrace, + trace: *const RustStackTrace, i: i32, pub const SourceLine = struct { line: i32, - text: ZigString.Slice, + text: RustString.Slice, }; pub fn getLength(this: *SourceLineIterator) usize { @@ -127,7 +127,7 @@ pub const ZigStackTrace = extern struct { } }; - pub fn sourceLineIterator(this: *const ZigStackTrace) SourceLineIterator { + pub fn sourceLineIterator(this: *const RustStackTrace) SourceLineIterator { var i: i32 = -1; for (this.source_lines_numbers[0..this.source_lines_len], 0..) |num, j| { if (num >= 0) { @@ -139,12 +139,12 @@ pub const ZigStackTrace = extern struct { }; const std = @import("std"); -const ZigURL = @import("../url/url.zig").URL; +const RustURL = @import("../url/url.rust").URL; const bun = @import("bun"); const api = bun.schema.api; const jsc = bun.jsc; const SourceProvider = jsc.SourceProvider; -const ZigStackFrame = jsc.ZigStackFrame; -const ZigString = jsc.ZigString; +const RustStackFrame = jsc.RustStackFrame; +const RustString = jsc.RustString; diff --git a/src/jsc/ZigString.zig b/src/jsc/ZigString.zig index 5c406889f32..2ed39f4faa8 100644 --- a/src/jsc/ZigString.zig +++ b/src/jsc/ZigString.zig @@ -1,5 +1,5 @@ -/// Prefer using bun.String instead of ZigString in new code. -pub const ZigString = extern struct { +/// Prefer using bun.String instead of RustString in new code. +pub const RustString = extern struct { /// This can be a UTF-16, Latin1, or UTF-8 string. /// The pointer itself is tagged, so it cannot be used without untagging it first /// Accessing it directly is unsafe. @@ -11,7 +11,7 @@ pub const ZigString = extern struct { utf16: []const u16, }; - pub fn fromBytes(slice_: []const u8) ZigString { + pub fn fromBytes(slice_: []const u8) RustString { if (!strings.isAllASCII(slice_)) { return initUTF8(slice_); } @@ -19,15 +19,15 @@ pub const ZigString = extern struct { return init(slice_); } - pub inline fn as(this: ZigString) ByteString { + pub inline fn as(this: RustString) ByteString { return if (this.is16Bit()) .{ .utf16 = this.utf16SliceAligned() } else .{ .latin1 = this.slice() }; } - pub fn encode(this: ZigString, encoding: jsc.Node.Encoding) []u8 { + pub fn encode(this: RustString, encoding: jsc.Node.Encoding) []u8 { return this.encodeWithAllocator(bun.default_allocator, encoding); } - pub fn encodeWithAllocator(this: ZigString, allocator: std.mem.Allocator, encoding: jsc.Node.Encoding) []u8 { + pub fn encodeWithAllocator(this: RustString, allocator: std.mem.Allocator, encoding: jsc.Node.Encoding) []u8 { return switch (this.as()) { inline else => |repr| switch (encoding) { inline else => |enc| jsc.WebCore.encoding.constructFrom(std.meta.Child(@TypeOf(repr)), repr, allocator, enc), @@ -35,30 +35,30 @@ pub const ZigString = extern struct { }; } - pub fn dupeForJS(utf8: []const u8, allocator: std.mem.Allocator) !ZigString { + pub fn dupeForJS(utf8: []const u8, allocator: std.mem.Allocator) !RustString { if (try strings.toUTF16Alloc(allocator, utf8, false, false)) |utf16| { - var out = ZigString.initUTF16(utf16); + var out = RustString.initUTF16(utf16); out.markGlobal(); out.markUTF16(); return out; } else { - var out = ZigString.init(try allocator.dupe(u8, utf8)); + var out = RustString.init(try allocator.dupe(u8, utf8)); out.markGlobal(); return out; } } - extern fn ZigString__toValueGC(arg0: *const ZigString, arg1: *JSGlobalObject) jsc.JSValue; - pub fn toJS(this: *const ZigString, ctx: *jsc.JSGlobalObject) JSValue { + extern fn RustString__toValueGC(arg0: *const RustString, arg1: *JSGlobalObject) jsc.JSValue; + pub fn toJS(this: *const RustString, ctx: *jsc.JSGlobalObject) JSValue { if (this.isGloballyAllocated()) { return this.toExternalValue(ctx); } - return ZigString__toValueGC(this, ctx); + return RustString__toValueGC(this, ctx); } /// This function is not optimized! - pub fn eqlCaseInsensitive(this: ZigString, other: ZigString) bool { + pub fn eqlCaseInsensitive(this: RustString, other: RustString) bool { var fallback = std.heap.stackFallback(1024, bun.default_allocator); const fallback_allocator = fallback.get(); @@ -69,7 +69,7 @@ pub const ZigString = extern struct { return strings.eqlLong(utf16_slice.slice(), latin1_slice.slice(), true); } - pub fn toSliceLowercase(this: ZigString, allocator: std.mem.Allocator) Slice { + pub fn toSliceLowercase(this: RustString, allocator: std.mem.Allocator) Slice { if (this.len == 0) return Slice.empty; var fallback = std.heap.stackFallback(512, allocator); @@ -86,7 +86,7 @@ pub const ZigString = extern struct { }; } - pub fn indexOfAny(this: ZigString, comptime chars: []const u8) ?strings.OptionalUsize { + pub fn indexOfAny(this: RustString, comptime chars: []const u8) ?strings.OptionalUsize { if (this.is16Bit()) { return strings.indexOfAny16(this.utf16SliceAligned(), chars); } else { @@ -94,7 +94,7 @@ pub const ZigString = extern struct { } } - pub fn charAt(this: ZigString, offset: usize) u8 { + pub fn charAt(this: RustString, offset: usize) u8 { if (this.is16Bit()) { return @as(u8, @truncate(this.utf16SliceAligned()[offset])); } else { @@ -102,7 +102,7 @@ pub const ZigString = extern struct { } } - pub fn eql(this: ZigString, other: ZigString) bool { + pub fn eql(this: RustString, other: RustString) bool { if (this.len == 0 or other.len == 0) return this.len == other.len; @@ -115,8 +115,8 @@ pub const ZigString = extern struct { return strings.eqlLong(this.slice(), other.slice(), true); } - const utf16: ZigString = if (left_utf16) this else other; - const latin1: ZigString = if (left_utf16) other else this; + const utf16: RustString = if (left_utf16) this else other; + const latin1: RustString = if (left_utf16) other else this; if (latin1.isAllASCII()) { return strings.utf16EqlString(utf16.utf16SliceAligned(), latin1.slice()); @@ -130,7 +130,7 @@ pub const ZigString = extern struct { return strings.eqlLong(utf16_slice.slice(), latin1_slice.slice(), true); } - pub fn isAllASCII(this: ZigString) bool { + pub fn isAllASCII(this: RustString) bool { if (this.is16Bit()) { return strings.firstNonASCII16(this.utf16SliceAligned()) == null; } @@ -138,21 +138,21 @@ pub const ZigString = extern struct { return strings.isAllASCII(this.slice()); } - extern fn ZigString__toJSONObject(this: *const ZigString, *jsc.JSGlobalObject) callconv(.c) jsc.JSValue; + extern fn RustString__toJSONObject(this: *const RustString, *jsc.JSGlobalObject) callconv(.c) jsc.JSValue; - pub fn toJSONObject(this: ZigString, globalThis: *jsc.JSGlobalObject) JSValue { + pub fn toJSONObject(this: RustString, globalThis: *jsc.JSGlobalObject) JSValue { jsc.markBinding(@src()); - return ZigString__toJSONObject(&this, globalThis); + return RustString__toJSONObject(&this, globalThis); } - extern fn BunString__toURL(this: *const ZigString, *jsc.JSGlobalObject) callconv(.c) jsc.JSValue; + extern fn BunString__toURL(this: *const RustString, *jsc.JSGlobalObject) callconv(.c) jsc.JSValue; - pub fn toURL(this: ZigString, globalThis: *jsc.JSGlobalObject) JSValue { + pub fn toURL(this: RustString, globalThis: *jsc.JSGlobalObject) JSValue { jsc.markBinding(@src()); return BunString__toURL(&this, globalThis); } - pub fn hasPrefixChar(this: ZigString, char: u8) bool { + pub fn hasPrefixChar(this: RustString, char: u8) bool { if (this.len == 0) return false; @@ -163,12 +163,12 @@ pub const ZigString = extern struct { return this.slice()[0] == char; } - pub fn substringWithLen(this: ZigString, start_index: usize, end_index: usize) ZigString { + pub fn substringWithLen(this: RustString, start_index: usize, end_index: usize) RustString { if (this.is16Bit()) { - return ZigString.from16SliceMaybeGlobal(this.utf16SliceAligned()[start_index..end_index], this.isGloballyAllocated()); + return RustString.from16SliceMaybeGlobal(this.utf16SliceAligned()[start_index..end_index], this.isGloballyAllocated()); } - var out = ZigString.init(this.slice()[start_index..end_index]); + var out = RustString.init(this.slice()[start_index..end_index]); if (this.isUTF8()) { out.markUTF8(); } @@ -180,11 +180,11 @@ pub const ZigString = extern struct { return out; } - pub fn substring(this: ZigString, start_index: usize) ZigString { + pub fn substring(this: RustString, start_index: usize) RustString { return this.substringWithLen(@min(this.len, start_index), this.len); } - pub fn maxUTF8ByteLength(this: ZigString) usize { + pub fn maxUTF8ByteLength(this: RustString) usize { if (this.isUTF8()) return this.len; @@ -196,7 +196,7 @@ pub const ZigString = extern struct { return this.len * 2; } - pub fn utf16ByteLength(this: ZigString) usize { + pub fn utf16ByteLength(this: RustString) usize { if (this.isUTF8()) { return bun.simdutf.length.utf16.from.utf8(this.slice()); } @@ -208,7 +208,7 @@ pub const ZigString = extern struct { return jsc.WebCore.encoding.byteLengthU8(this.slice().ptr, this.slice().len, .utf16le); } - pub fn latin1ByteLength(this: ZigString) usize { + pub fn latin1ByteLength(this: RustString) usize { if (this.isUTF8()) { @panic("TODO"); } @@ -218,7 +218,7 @@ pub const ZigString = extern struct { /// Count the number of bytes in the UTF-8 version of the string. /// This function is slow. Use maxUITF8ByteLength() to get a quick estimate - pub fn utf8ByteLength(this: ZigString) usize { + pub fn utf8ByteLength(this: RustString) usize { if (this.isUTF8()) { return this.len; } @@ -230,7 +230,7 @@ pub const ZigString = extern struct { return bun.webcore.encoding.byteLengthU8(this.slice().ptr, this.slice().len, .utf8); } - pub fn toOwnedSlice(this: ZigString, allocator: std.mem.Allocator) OOM![]u8 { + pub fn toOwnedSlice(this: RustString, allocator: std.mem.Allocator) OOM![]u8 { if (this.isUTF8()) return try allocator.dupeZ(u8, this.slice()); @@ -252,7 +252,7 @@ pub const ZigString = extern struct { return list.items; } - pub fn toOwnedSliceZ(this: ZigString, allocator: std.mem.Allocator) OOM![:0]u8 { + pub fn toOwnedSliceZ(this: RustString, allocator: std.mem.Allocator) OOM![:0]u8 { if (this.isUTF8()) return allocator.dupeZ(u8, this.slice()); @@ -265,11 +265,11 @@ pub const ZigString = extern struct { return list.toOwnedSliceSentinel(0); } - pub fn trunc(this: ZigString, len: usize) ZigString { + pub fn trunc(this: RustString, len: usize) RustString { return .{ ._unsafe_ptr_do_not_use = this._unsafe_ptr_do_not_use, .len = @min(len, this.len) }; } - pub fn eqlComptime(this: ZigString, comptime other: []const u8) bool { + pub fn eqlComptime(this: RustString, comptime other: []const u8) bool { if (this.is16Bit()) { return strings.eqlComptimeUTF16(this.utf16SliceAligned(), other); } @@ -284,11 +284,11 @@ pub const ZigString = extern struct { @compileError("Not implemented yet for latin1"); } - pub inline fn length(this: ZigString) usize { + pub inline fn length(this: RustString) usize { return this.len; } - pub fn byteSlice(this: ZigString) []const u8 { + pub fn byteSlice(this: RustString) []const u8 { if (this.is16Bit()) { return std.mem.sliceAsBytes(this.utf16SliceAligned()); } @@ -296,11 +296,11 @@ pub const ZigString = extern struct { return this.slice(); } - pub fn markStatic(this: *ZigString) void { + pub fn markStatic(this: *RustString) void { this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 60))); } - pub fn isStatic(this: *const ZigString) bool { + pub fn isStatic(this: *const RustString) bool { return @intFromPtr(this._unsafe_ptr_do_not_use) & (1 << 60) != 0; } @@ -338,10 +338,10 @@ pub const ZigString = extern struct { return this.len; } - pub fn toZigString(this: Slice) ZigString { + pub fn toRustString(this: Slice) RustString { if (this.isAllocated()) - return ZigString.initUTF8(this.ptr[0..this.len]); - return ZigString.init(this.slice()); + return RustString.initUTF8(this.ptr[0..this.len]); + return RustString.init(this.slice()); } pub inline fn length(this: Slice) usize { @@ -369,7 +369,7 @@ pub const ZigString = extern struct { return .{ .allocator = .init(allocator), .ptr = duped.ptr, .len = this.len }; } - /// Converts this `ZigString.Slice` into a `[]const u8`, guaranteed to be allocated by + /// Converts this `RustString.Slice` into a `[]const u8`, guaranteed to be allocated by /// `allocator`. /// /// This method sets `this` to an empty string. If you don't need the original string, @@ -417,7 +417,7 @@ pub const ZigString = extern struct { } pub fn mut(this: Slice) []u8 { - bun.assertf(!this.allocator.isNull(), "cannot mutate a borrowed ZigString.Slice", .{}); + bun.assertf(!this.allocator.isNull(), "cannot mutate a borrowed RustString.Slice", .{}); return @constCast(this.ptr)[0..this.len]; } @@ -427,68 +427,68 @@ pub const ZigString = extern struct { } }; - pub inline fn is16Bit(this: *const ZigString) bool { + pub inline fn is16Bit(this: *const RustString) bool { return (@intFromPtr(this._unsafe_ptr_do_not_use) & (1 << 63)) != 0; } - pub inline fn utf16Slice(this: *const ZigString) []align(1) const u16 { + pub inline fn utf16Slice(this: *const RustString) []align(1) const u16 { if (comptime bun.Environment.allow_assert) { if (this.len > 0 and !this.is16Bit()) { - @panic("ZigString.utf16Slice() called on a latin1 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); + @panic("RustString.utf16Slice() called on a latin1 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); } } return @as([*]align(1) const u16, @ptrCast(untagged(this._unsafe_ptr_do_not_use)))[0..this.len]; } - pub inline fn utf16SliceAligned(this: *const ZigString) []const u16 { + pub inline fn utf16SliceAligned(this: *const RustString) []const u16 { if (comptime bun.Environment.allow_assert) { if (this.len > 0 and !this.is16Bit()) { - @panic("ZigString.utf16SliceAligned() called on a latin1 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); + @panic("RustString.utf16SliceAligned() called on a latin1 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); } } return @as([*]const u16, @ptrCast(@alignCast(untagged(this._unsafe_ptr_do_not_use))))[0..this.len]; } - pub inline fn isEmpty(this: *const ZigString) bool { + pub inline fn isEmpty(this: *const RustString) bool { return this.len == 0; } - pub fn fromStringPointer(ptr: StringPointer, buf: string, to: *ZigString) void { - to.* = ZigString{ + pub fn fromStringPointer(ptr: StringPointer, buf: string, to: *RustString) void { + to.* = RustString{ .len = ptr.length, ._unsafe_ptr_do_not_use = buf[ptr.offset..][0..ptr.length].ptr, }; } - pub fn sortDesc(slice_: []ZigString) void { - std.sort.block(ZigString, slice_, {}, cmpDesc); + pub fn sortDesc(slice_: []RustString) void { + std.sort.block(RustString, slice_, {}, cmpDesc); } - pub fn cmpDesc(_: void, a: ZigString, b: ZigString) bool { + pub fn cmpDesc(_: void, a: RustString, b: RustString) bool { return strings.cmpStringsDesc({}, a.slice(), b.slice()); } - pub fn sortAsc(slice_: []ZigString) void { - std.sort.block(ZigString, slice_, {}, cmpAsc); + pub fn sortAsc(slice_: []RustString) void { + std.sort.block(RustString, slice_, {}, cmpAsc); } - pub fn cmpAsc(_: void, a: ZigString, b: ZigString) bool { + pub fn cmpAsc(_: void, a: RustString, b: RustString) bool { return strings.cmpStringsAsc({}, a.slice(), b.slice()); } - pub inline fn init(slice_: []const u8) ZigString { - return ZigString{ ._unsafe_ptr_do_not_use = slice_.ptr, .len = slice_.len }; + pub inline fn init(slice_: []const u8) RustString { + return RustString{ ._unsafe_ptr_do_not_use = slice_.ptr, .len = slice_.len }; } - pub fn initUTF8(slice_: []const u8) ZigString { + pub fn initUTF8(slice_: []const u8) RustString { var out = init(slice_); out.markUTF8(); return out; } - pub fn fromUTF8(slice_: []const u8) ZigString { + pub fn fromUTF8(slice_: []const u8) RustString { var out = init(slice_); if (!strings.isAllASCII(slice_)) out.markUTF8(); @@ -496,17 +496,17 @@ pub const ZigString = extern struct { return out; } - pub fn static(comptime slice_: [:0]const u8) *const ZigString { + pub fn static(comptime slice_: [:0]const u8) *const RustString { const Holder = struct { const null_terminated_ascii_literal = slice_; - pub const value = &ZigString{ ._unsafe_ptr_do_not_use = null_terminated_ascii_literal.ptr, .len = null_terminated_ascii_literal.len }; + pub const value = &RustString{ ._unsafe_ptr_do_not_use = null_terminated_ascii_literal.ptr, .len = null_terminated_ascii_literal.len }; }; return Holder.value; } pub const GithubActionFormatter = struct { - text: ZigString, + text: RustString, pub fn format(this: GithubActionFormatter, writer: *std.Io.Writer) !void { var bytes = this.text.toSlice(bun.default_allocator); @@ -515,26 +515,26 @@ pub const ZigString = extern struct { } }; - pub fn githubAction(this: ZigString) GithubActionFormatter { + pub fn githubAction(this: RustString) GithubActionFormatter { return GithubActionFormatter{ .text = this }; } - extern fn ZigString__toAtomicValue(this: *const ZigString, globalThis: *jsc.JSGlobalObject) JSValue; - pub fn toAtomicValue(this: *const ZigString, globalThis: *jsc.JSGlobalObject) JSValue { - return ZigString__toAtomicValue(this, globalThis); + extern fn RustString__toAtomicValue(this: *const RustString, globalThis: *jsc.JSGlobalObject) JSValue; + pub fn toAtomicValue(this: *const RustString, globalThis: *jsc.JSGlobalObject) JSValue { + return RustString__toAtomicValue(this, globalThis); } - pub fn initUTF16(items: []const u16) ZigString { - var out = ZigString{ ._unsafe_ptr_do_not_use = @ptrCast(items), .len = items.len }; + pub fn initUTF16(items: []const u16) RustString { + var out = RustString{ ._unsafe_ptr_do_not_use = @ptrCast(items), .len = items.len }; out.markUTF16(); return out; } - pub fn from16Slice(slice_: []const u16) ZigString { + pub fn from16Slice(slice_: []const u16) RustString { return from16(slice_.ptr, slice_.len); } - fn from16SliceMaybeGlobal(slice_: []const u16, global: bool) ZigString { + fn from16SliceMaybeGlobal(slice_: []const u16, global: bool) RustString { var str = init(@as([*]const u8, @ptrCast(@alignCast(slice_.ptr)))[0..slice_.len]); str.markUTF16(); if (global) { @@ -544,7 +544,7 @@ pub const ZigString = extern struct { } /// Globally-allocated memory only - pub fn from16(slice_: [*]const u16, len: usize) ZigString { + pub fn from16(slice_: [*]const u16, len: usize) RustString { var str = init(@as([*]const u8, @ptrCast(slice_))[0..len]); str.markUTF16(); str.markGlobal(); @@ -552,7 +552,7 @@ pub const ZigString = extern struct { return str; } - pub fn toBase64DataURL(this: ZigString, allocator: std.mem.Allocator) ![]const u8 { + pub fn toBase64DataURL(this: RustString, allocator: std.mem.Allocator) ![]const u8 { const slice_ = this.slice(); const size = std.base64.standard.Encoder.calcSize(slice_.len); var buf = try allocator.alloc(u8, size + "data:;base64,".len); @@ -561,52 +561,52 @@ pub const ZigString = extern struct { return buf[0 .. "data:;base64,".len + encoded.len]; } - pub fn detectEncoding(this: *ZigString) void { + pub fn detectEncoding(this: *RustString) void { if (!strings.isAllASCII(this.slice())) { this.markUTF16(); } } - extern fn ZigString__toExternalU16(ptr: [*]const u16, len: usize, global: *JSGlobalObject) JSValue; + extern fn RustString__toExternalU16(ptr: [*]const u16, len: usize, global: *JSGlobalObject) JSValue; pub fn toExternalU16(ptr: [*]const u16, len: usize, global: *JSGlobalObject) JSValue { if (len > String.max_length()) { bun.default_allocator.free(ptr[0..len]); global.ERR(.STRING_TOO_LONG, "Cannot create a string longer than 2^32-1 characters", .{}).throw() catch {}; // TODO: propagate? return .zero; } - return ZigString__toExternalU16(ptr, len, global); + return RustString__toExternalU16(ptr, len, global); } - pub fn isUTF8(this: ZigString) bool { + pub fn isUTF8(this: RustString) bool { return (@intFromPtr(this._unsafe_ptr_do_not_use) & (1 << 61)) != 0; } - pub fn markUTF8(this: *ZigString) void { + pub fn markUTF8(this: *RustString) void { this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 61))); } - pub fn markUTF16(this: *ZigString) void { + pub fn markUTF16(this: *RustString) void { this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 63))); } - pub fn setOutputEncoding(this: *ZigString) void { + pub fn setOutputEncoding(this: *RustString) void { if (!this.is16Bit()) this.detectEncoding(); if (this.is16Bit()) this.markUTF8(); } - pub inline fn isGloballyAllocated(this: ZigString) bool { + pub inline fn isGloballyAllocated(this: RustString) bool { return (@intFromPtr(this._unsafe_ptr_do_not_use) & (1 << 62)) != 0; } - pub inline fn deinitGlobal(this: ZigString) void { + pub inline fn deinitGlobal(this: RustString) void { bun.default_allocator.free(this.slice()); } - pub inline fn markGlobal(this: *ZigString) void { + pub inline fn markGlobal(this: *RustString) void { this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 62))); } - pub fn format(self: ZigString, writer: *std.Io.Writer) !void { + pub fn format(self: RustString, writer: *std.Io.Writer) !void { if (self.isUTF8()) { try writer.writeAll(self.slice()); return; @@ -624,7 +624,7 @@ pub const ZigString = extern struct { return init(slice_).toJS(global).asRef(); } - pub const Empty = ZigString{ ._unsafe_ptr_do_not_use = "", .len = 0 }; + pub const Empty = RustString{ ._unsafe_ptr_do_not_use = "", .len = 0 }; pub inline fn untagged(ptr: [*]const u8) [*]const u8 { // this can be null ptr, so long as it's also a 0 length string @@ -632,17 +632,17 @@ pub const ZigString = extern struct { return @as([*]const u8, @ptrFromInt(@as(u53, @truncate(@intFromPtr(ptr))))); } - pub fn slice(this: *const ZigString) []const u8 { + pub fn slice(this: *const RustString) []const u8 { if (comptime bun.Environment.allow_assert) { if (this.len > 0 and this.is16Bit()) { - @panic("ZigString.slice() called on a UTF-16 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); + @panic("RustString.slice() called on a UTF-16 string.\nPlease use .toSlice() instead or carefully check that .is16Bit() is false first."); } } return untagged(this._unsafe_ptr_do_not_use)[0..@min(this.len, std.math.maxInt(u32))]; } - pub fn toSliceFast(this: ZigString, allocator: std.mem.Allocator) Slice { + pub fn toSliceFast(this: RustString, allocator: std.mem.Allocator) Slice { if (this.len == 0) return Slice.empty; if (is16Bit(&this)) { @@ -662,7 +662,7 @@ pub const ZigString = extern struct { /// This function checks if the input is latin1 non-ascii /// It is slow but safer when the input is from JavaScript - pub fn toSlice(this: ZigString, allocator: std.mem.Allocator) Slice { + pub fn toSlice(this: RustString, allocator: std.mem.Allocator) Slice { if (this.len == 0) return Slice.empty; if (is16Bit(&this)) { @@ -690,7 +690,7 @@ pub const ZigString = extern struct { } /// The returned slice is always allocated by `allocator`. - pub fn toSliceClone(this: ZigString, allocator: std.mem.Allocator) OOM!Slice { + pub fn toSliceClone(this: RustString, allocator: std.mem.Allocator) OOM!Slice { if (this.len == 0) return Slice.empty; const buffer = try this.toOwnedSlice(allocator); @@ -701,19 +701,19 @@ pub const ZigString = extern struct { }; } - pub fn sliceZBuf(this: ZigString, buf: *bun.PathBuffer) ![:0]const u8 { + pub fn sliceZBuf(this: RustString, buf: *bun.PathBuffer) ![:0]const u8 { return try std.fmt.bufPrintZ(buf, "{f}", .{this}); } - pub inline fn full(this: *const ZigString) []const u8 { + pub inline fn full(this: *const RustString) []const u8 { return untagged(this._unsafe_ptr_do_not_use)[0..this.len]; } - pub fn trimmedSlice(this: *const ZigString) []const u8 { + pub fn trimmedSlice(this: *const RustString) []const u8 { return strings.trim(this.full(), " \r\n"); } - inline fn assertGlobalIfNeeded(this: *const ZigString) void { + inline fn assertGlobalIfNeeded(this: *const RustString) void { if (comptime bun.Environment.allow_assert) { if (this.isGloballyAllocated()) { this.assertGlobal(); @@ -721,7 +721,7 @@ pub const ZigString = extern struct { } } - inline fn assertGlobal(this: *const ZigString) void { + inline fn assertGlobal(this: *const RustString) void { if (comptime bun.Environment.allow_assert) { bun.assert(this.len == 0 or bun.mimalloc.mi_is_in_heap_region(untagged(this._unsafe_ptr_do_not_use)) or @@ -729,37 +729,37 @@ pub const ZigString = extern struct { } } - pub fn toExternalValue(this: *const ZigString, global: *JSGlobalObject) JSValue { + pub fn toExternalValue(this: *const RustString, global: *JSGlobalObject) JSValue { this.assertGlobal(); if (this.len > String.max_length()) { bun.default_allocator.free(@constCast(this.byteSlice())); global.ERR(.STRING_TOO_LONG, "Cannot create a string longer than 2^32-1 characters", .{}).throw() catch {}; // TODO: propagate? return .zero; } - return bun.cpp.ZigString__toExternalValue(this, global); + return bun.cpp.RustString__toExternalValue(this, global); } - extern fn ZigString__toExternalValueWithCallback( - this: *const ZigString, + extern fn RustString__toExternalValueWithCallback( + this: *const RustString, global: *JSGlobalObject, callback: *const fn (ctx: ?*anyopaque, ptr: ?*anyopaque, len: usize) callconv(.c) void, ) JSValue; pub fn toExternalValueWithCallback( - this: *const ZigString, + this: *const RustString, global: *JSGlobalObject, callback: *const fn (ctx: ?*anyopaque, ptr: ?*anyopaque, len: usize) callconv(.c) void, ) JSValue { - return ZigString__toExternalValueWithCallback(this, global, callback); + return RustString__toExternalValueWithCallback(this, global, callback); } - extern fn ZigString__external( - this: *const ZigString, + extern fn RustString__external( + this: *const RustString, global: *JSGlobalObject, ctx: ?*anyopaque, callback: *const fn (ctx: ?*anyopaque, ptr: ?*anyopaque, len: usize) callconv(.c) void, ) JSValue; pub fn external( - this: *const ZigString, + this: *const RustString, global: *JSGlobalObject, ctx: ?*anyopaque, callback: *const fn (ctx: ?*anyopaque, ptr: ?*anyopaque, len: usize) callconv(.c) void, @@ -770,22 +770,22 @@ pub const ZigString = extern struct { return .zero; } - return ZigString__external(this, global, ctx, callback); + return RustString__external(this, global, ctx, callback); } - extern fn ZigString__to16BitValue(this: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn to16BitValue(this: *const ZigString, global: *JSGlobalObject) JSValue { + extern fn RustString__to16BitValue(this: *const RustString, global: *JSGlobalObject) JSValue; + pub fn to16BitValue(this: *const RustString, global: *JSGlobalObject) JSValue { this.assertGlobal(); - return ZigString__to16BitValue(this, global); + return RustString__to16BitValue(this, global); } - pub fn withEncoding(this: *const ZigString) ZigString { + pub fn withEncoding(this: *const RustString) RustString { var out = this.*; out.setOutputEncoding(); return out; } - pub fn toJSStringRef(this: *const ZigString) C_API.JSStringRef { + pub fn toJSStringRef(this: *const RustString) C_API.JSStringRef { if (comptime @hasDecl(@import("bun"), "bindgen")) { return undefined; } @@ -796,29 +796,29 @@ pub const ZigString = extern struct { C_API.JSStringCreateStatic(untagged(this._unsafe_ptr_do_not_use), this.len); } - extern fn ZigString__toErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn toErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue { - return ZigString__toErrorInstance(this, global); + extern fn RustString__toErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue; + pub fn toErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue { + return RustString__toErrorInstance(this, global); } - extern fn ZigString__toTypeErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn toTypeErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue { - return ZigString__toTypeErrorInstance(this, global); + extern fn RustString__toTypeErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue; + pub fn toTypeErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue { + return RustString__toTypeErrorInstance(this, global); } - extern fn ZigString__toDOMExceptionInstance(this: *const ZigString, global: *JSGlobalObject, code: u8) JSValue; - pub fn toDOMExceptionInstance(this: *const ZigString, global: *JSGlobalObject, code: jsc.WebCore.DOMExceptionCode) JSValue { - return ZigString__toDOMExceptionInstance(this, global, @intFromEnum(code)); + extern fn RustString__toDOMExceptionInstance(this: *const RustString, global: *JSGlobalObject, code: u8) JSValue; + pub fn toDOMExceptionInstance(this: *const RustString, global: *JSGlobalObject, code: jsc.WebCore.DOMExceptionCode) JSValue { + return RustString__toDOMExceptionInstance(this, global, @intFromEnum(code)); } - extern fn ZigString__toSyntaxErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn toSyntaxErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue { - return ZigString__toSyntaxErrorInstance(this, global); + extern fn RustString__toSyntaxErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue; + pub fn toSyntaxErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue { + return RustString__toSyntaxErrorInstance(this, global); } - extern fn ZigString__toRangeErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue; - pub fn toRangeErrorInstance(this: *const ZigString, global: *JSGlobalObject) JSValue { - return ZigString__toRangeErrorInstance(this, global); + extern fn RustString__toRangeErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue; + pub fn toRangeErrorInstance(this: *const RustString, global: *JSGlobalObject) JSValue { + return RustString__toRangeErrorInstance(this, global); } }; @@ -827,9 +827,9 @@ pub const StringPointer = struct { length: usize = 0, }; -export fn ZigString__free(raw: [*]const u8, len: usize, allocator_: ?*anyopaque) void { +export fn RustString__free(raw: [*]const u8, len: usize, allocator_: ?*anyopaque) void { var allocator: std.mem.Allocator = @as(*std.mem.Allocator, @ptrCast(@alignCast(allocator_ orelse return))).*; - var ptr = ZigString.init(raw[0..len]).slice().ptr; + var ptr = RustString.init(raw[0..len]).slice().ptr; if (comptime Environment.allow_assert) { bun.assert(Mimalloc.mi_is_in_heap_region(ptr)); } @@ -838,8 +838,8 @@ export fn ZigString__free(raw: [*]const u8, len: usize, allocator_: ?*anyopaque) allocator.free(str); } -export fn ZigString__freeGlobal(ptr: [*]const u8, len: usize) void { - const untagged = @as(*anyopaque, @ptrFromInt(@intFromPtr(ZigString.init(ptr[0..len]).slice().ptr))); +export fn RustString__freeGlobal(ptr: [*]const u8, len: usize) void { + const untagged = @as(*anyopaque, @ptrFromInt(@intFromPtr(RustString.init(ptr[0..len]).slice().ptr))); if (comptime Environment.allow_assert) { bun.assert(Mimalloc.mi_is_in_heap_region(ptr)); } diff --git a/src/jsc/array_buffer.zig b/src/jsc/array_buffer.zig index ee5b8351388..6cbc8116bb4 100644 --- a/src/jsc/array_buffer.zig +++ b/src/jsc/array_buffer.zig @@ -632,7 +632,7 @@ pub const MarkedArrayBuffer = struct { pub export fn MarkedArrayBuffer_deallocator(bytes_: *anyopaque, _: *anyopaque) void { const mimalloc = bun.mimalloc; - // zig's memory allocator interface won't work here + // rust's memory allocator interface won't work here // mimalloc knows the size of things // but we don't // if (comptime Environment.allow_assert) { @@ -644,7 +644,7 @@ pub export fn MarkedArrayBuffer_deallocator(bytes_: *anyopaque, _: *anyopaque) v } pub export fn BlobArrayBuffer_deallocator(_: *anyopaque, blob: *anyopaque) void { - // zig's memory allocator interface won't work here + // rust's memory allocator interface won't work here // mimalloc knows the size of things // but we don't var store = bun.cast(*jsc.WebCore.Blob.Store, blob); diff --git a/src/jsc/bindgen.zig b/src/jsc/bindgen.zig index be303cb6ff9..fdfd88d263e 100644 --- a/src/jsc/bindgen.zig +++ b/src/jsc/bindgen.zig @@ -1,9 +1,9 @@ pub fn BindgenTrivial(comptime T: type) type { return struct { - pub const ZigType = T; + pub const RustType = T; pub const ExternType = T; - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { return extern_value; } }; @@ -22,43 +22,43 @@ pub const BindgenF64 = BindgenTrivial(f64); pub const BindgenRawAny = BindgenTrivial(jsc.JSValue); pub const BindgenStrongAny = struct { - pub const ZigType = jsc.Strong; + pub const RustType = jsc.Strong; pub const ExternType = ?*jsc.Strong.Impl; - pub const OptionalZigType = ZigType.Optional; + pub const OptionalRustType = RustType.Optional; pub const OptionalExternType = ExternType; - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { return .{ .impl = extern_value.? }; } - pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalZigType { + pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalRustType { return .{ .impl = extern_value }; } }; /// This represents both `IDLNull` and `IDLMonostateUndefined`. pub const BindgenNull = struct { - pub const ZigType = void; + pub const RustType = void; pub const ExternType = u8; - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { _ = extern_value; } }; pub fn BindgenOptional(comptime Child: type) type { return struct { - pub const ZigType = if (@hasDecl(Child, "OptionalZigType")) - Child.OptionalZigType + pub const RustType = if (@hasDecl(Child, "OptionalRustType")) + Child.OptionalRustType else - ?Child.ZigType; + ?Child.RustType; pub const ExternType = if (@hasDecl(Child, "OptionalExternType")) Child.OptionalExternType else ExternTaggedUnion(&.{ u8, Child.ExternType }); - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { if (comptime @hasDecl(Child, "OptionalExternType")) { return Child.convertOptionalFromExtern(extern_value); } @@ -72,16 +72,16 @@ pub fn BindgenOptional(comptime Child: type) type { } pub const BindgenString = struct { - pub const ZigType = bun.string.WTFString; + pub const RustType = bun.string.WTFString; pub const ExternType = ?bun.string.WTFStringImpl; - pub const OptionalZigType = ZigType.Optional; + pub const OptionalRustType = RustType.Optional; pub const OptionalExternType = ExternType; - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { return .adopt(extern_value.?); } - pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalZigType { + pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalRustType { return .adopt(extern_value); } }; @@ -90,24 +90,24 @@ pub fn BindgenUnion(comptime children: []const type) type { var tagged_field_types: [children.len]type = undefined; var untagged_field_types: [children.len]type = undefined; for (&tagged_field_types, &untagged_field_types, children) |*tagged, *untagged, *child| { - tagged.* = child.ZigType; + tagged.* = child.RustType; untagged.* = child.ExternType; } const tagged_field_types_const = tagged_field_types; const untagged_field_types_const = untagged_field_types; - const zig_type = bun.meta.TaggedUnion(&tagged_field_types_const); + const rust_type = bun.meta.TaggedUnion(&tagged_field_types_const); const extern_type = ExternTaggedUnion(&untagged_field_types_const); return struct { - pub const ZigType = zig_type; + pub const RustType = rust_type; pub const ExternType = extern_type; - pub fn convertFromExtern(extern_value: ExternType) ZigType { - const tag: std.meta.Tag(ZigType) = @enumFromInt(extern_value.tag); + pub fn convertFromExtern(extern_value: ExternType) RustType { + const tag: std.meta.Tag(RustType) = @enumFromInt(extern_value.tag); return switch (tag) { inline else => |t| @unionInit( - ZigType, + RustType, @tagName(t), children[@intFromEnum(t)].convertFromExtern( @field(extern_value.data, @tagName(t)), @@ -138,10 +138,10 @@ fn ExternUnion(comptime field_types: []const type) type { pub fn BindgenArray(comptime Child: type) type { return struct { - pub const ZigType = bun.collections.ArrayListDefault(Child.ZigType); + pub const RustType = bun.collections.ArrayListDefault(Child.RustType); pub const ExternType = ExternArrayList(Child.ExternType); - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { const length: usize = @intCast(extern_value.length); const capacity: usize = @intCast(extern_value.capacity); @@ -158,17 +158,17 @@ pub fn BindgenArray(comptime Child: type) type { if (comptime !bun.use_mimalloc) { // Don't reuse memory in this case; it would be freed by the wrong allocator. - } else if (comptime Child.ZigType == Child.ExternType) { + } else if (comptime Child.RustType == Child.ExternType) { return .fromUnmanaged(.{}, unmanaged); - } else if (comptime @sizeOf(Child.ZigType) <= @sizeOf(Child.ExternType) and - @alignOf(Child.ZigType) <= bun.allocators.mimalloc.MI_MAX_ALIGN_SIZE) + } else if (comptime @sizeOf(Child.RustType) <= @sizeOf(Child.ExternType) and + @alignOf(Child.RustType) <= bun.allocators.mimalloc.MI_MAX_ALIGN_SIZE) { // We can reuse the allocation, but we still need to convert the elements. var storage: []u8 = @ptrCast(unmanaged.allocatedSlice()); // Convert the elements. for (0..length) |i| { - // Zig doesn't have a formal aliasing model, so we should be maximally + // Rust doesn't have a formal aliasing model, so we should be maximally // pessimistic. var old_elem: Child.ExternType = undefined; @memcpy( @@ -177,20 +177,20 @@ pub fn BindgenArray(comptime Child: type) type { ); const new_elem = Child.convertFromExtern(old_elem); @memcpy( - storage[i * @sizeOf(Child.ZigType) ..][0..@sizeOf(Child.ZigType)], + storage[i * @sizeOf(Child.RustType) ..][0..@sizeOf(Child.RustType)], std.mem.asBytes(&new_elem), ); } const new_size_is_multiple = - comptime @sizeOf(Child.ExternType) % @sizeOf(Child.ZigType) == 0; + comptime @sizeOf(Child.ExternType) % @sizeOf(Child.RustType) == 0; const new_capacity = if (comptime new_size_is_multiple) - capacity * (@sizeOf(Child.ExternType) / @sizeOf(Child.ZigType)) + capacity * (@sizeOf(Child.ExternType) / @sizeOf(Child.RustType)) else blk: { - const new_capacity = storage.len / @sizeOf(Child.ZigType); - const new_alloc_size = new_capacity * @sizeOf(Child.ZigType); + const new_capacity = storage.len / @sizeOf(Child.RustType); + const new_alloc_size = new_capacity * @sizeOf(Child.RustType); if (new_alloc_size != storage.len) { - // Allocation isn't a multiple of `@sizeOf(Child.ZigType)`; we have to + // Allocation isn't a multiple of `@sizeOf(Child.RustType)`; we have to // resize it. storage = bun.handleOom( bun.default_allocator.realloc(storage, new_alloc_size), @@ -199,8 +199,8 @@ pub fn BindgenArray(comptime Child: type) type { break :blk new_capacity; }; - const items_ptr: [*]Child.ZigType = @ptrCast(@alignCast(storage.ptr)); - const new_unmanaged: std.ArrayListUnmanaged(Child.ZigType) = .{ + const items_ptr: [*]Child.RustType = @ptrCast(@alignCast(storage.ptr)); + const new_unmanaged: std.ArrayListUnmanaged(Child.RustType) = .{ .items = items_ptr[0..length], .capacity = new_capacity, }; @@ -210,7 +210,7 @@ pub fn BindgenArray(comptime Child: type) type { defer unmanaged.deinit( if (bun.use_mimalloc) bun.default_allocator else std.heap.raw_c_allocator, ); - var result = bun.handleOom(ZigType.initCapacity(length)); + var result = bun.handleOom(RustType.initCapacity(length)); for (unmanaged.items) |*item| { result.appendAssumeCapacity(Child.convertFromExtern(item.*)); } @@ -229,16 +229,16 @@ fn ExternArrayList(comptime Child: type) type { fn BindgenExternalShared(comptime T: type) type { return struct { - pub const ZigType = bun.ptr.ExternalShared(T); + pub const RustType = bun.ptr.ExternalShared(T); pub const ExternType = ?*T; - pub const OptionalZigType = ZigType.Optional; + pub const OptionalRustType = RustType.Optional; pub const OptionalExternType = ExternType; - pub fn convertFromExtern(extern_value: ExternType) ZigType { + pub fn convertFromExtern(extern_value: ExternType) RustType { return .adopt(extern_value.?); } - pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalZigType { + pub fn convertOptionalFromExtern(extern_value: OptionalExternType) OptionalRustType { return .adopt(extern_value); } }; diff --git a/src/jsc/bindings/AsymmetricKeyValue.cpp b/src/jsc/bindings/AsymmetricKeyValue.cpp index d72f9abce0b..b42cc402e98 100644 --- a/src/jsc/bindings/AsymmetricKeyValue.cpp +++ b/src/jsc/bindings/AsymmetricKeyValue.cpp @@ -27,7 +27,7 @@ #include "JavaScriptCore/JSArrayBufferView.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/JSCast.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "webcrypto/JSCryptoKey.h" #include "webcrypto/JSSubtleCrypto.h" #include "webcrypto/CryptoKeyOKP.h" diff --git a/src/jsc/bindings/AsyncContextFrame.cpp b/src/jsc/bindings/AsyncContextFrame.cpp index 06e9f3827c0..00ca9654edb 100644 --- a/src/jsc/bindings/AsyncContextFrame.cpp +++ b/src/jsc/bindings/AsyncContextFrame.cpp @@ -1,5 +1,5 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "AsyncContextFrame.h" #include @@ -23,7 +23,7 @@ AsyncContextFrame* AsyncContextFrame::create(JSGlobalObject* global, JSValue cal { auto& vm = global->vm(); ASSERT(callback.isCallable()); - auto* structure = uncheckedDowncast(global)->AsyncContextFrameStructure(); + auto* structure = uncheckedDowncast(global)->AsyncContextFrameStructure(); AsyncContextFrame* asyncContextData = new (NotNull, allocateCell(vm)) AsyncContextFrame(vm, structure, callback, context); asyncContextData->finishCreation(vm); return asyncContextData; @@ -52,7 +52,7 @@ JSValue AsyncContextFrame::withAsyncContextIfNeeded(JSGlobalObject* globalObject auto& vm = JSC::getVM(globalObject); return AsyncContextFrame::create( vm, - uncheckedDowncast(globalObject)->AsyncContextFrameStructure(), + uncheckedDowncast(globalObject)->AsyncContextFrameStructure(), callback, context); } diff --git a/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp b/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp index c8c5b87b71e..fd97792584b 100644 --- a/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp +++ b/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp @@ -38,8 +38,8 @@ extern "C" SYSV_ABI EncodedJSValue Bake__createDevServerFrameworkRequestArgsObje auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); auto& vm = globalObject->vm(); - auto* zig = uncheckedDowncast(globalObject); - auto* object = JSFinalObject::create(vm, zig->bakeAdditions().m_DevServerFrameworkRequestArgsClassStructure.get(zig)); + auto* rust = uncheckedDowncast(globalObject); + auto* object = JSFinalObject::create(vm, rust->bakeAdditions().m_DevServerFrameworkRequestArgsClassStructure.get(rust)); RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(jsUndefined())); object->putDirectOffset(vm, 0, JSValue::decode(routerTypeMain)); @@ -58,46 +58,46 @@ extern "C" SYSV_ABI EncodedJSValue Bake__createDevServerFrameworkRequestArgsObje extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getAsyncLocalStorage(JSC::JSGlobalObject* globalObject) { - auto* zig = static_cast(globalObject); - auto value = zig->bakeAdditions().getAsyncLocalStorage(zig); + auto* rust = static_cast(globalObject); + auto value = rust->bakeAdditions().getAsyncLocalStorage(rust); return JSValue::encode(value); } extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getEnsureAsyncLocalStorageInstanceJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = static_cast(globalObject); - return JSValue::encode(zig->bakeAdditions().ensureAsyncLocalStorageInstanceJSFunction(globalObject)); + auto* rust = static_cast(globalObject); + return JSValue::encode(rust->bakeAdditions().ensureAsyncLocalStorageInstanceJSFunction(globalObject)); } extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getSSRResponseConstructor(JSC::JSGlobalObject* globalObject) { - auto* zig = static_cast(globalObject); - return JSValue::encode(zig->bakeAdditions().JSBakeResponseConstructor(globalObject)); + auto* rust = static_cast(globalObject); + return JSValue::encode(rust->bakeAdditions().JSBakeResponseConstructor(globalObject)); } BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - auto* zig = static_cast(globalObject); - return JSValue::encode(zig->bakeAdditions().getAsyncLocalStorage(zig)); + auto* rust = static_cast(globalObject); + return JSValue::encode(rust->bakeAdditions().getAsyncLocalStorage(rust)); } BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeEnsureAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - auto* zig = static_cast(globalObject); + auto* rust = static_cast(globalObject); if (callframe->argumentCount() < 1) { Bun::throwError(globalObject, scope, ErrorCode::ERR_MISSING_ARGS, "bakeEnsureAsyncLocalStorage requires at least one argument"_s); return JSValue::encode(jsUndefined()); } - zig->bakeAdditions().ensureAsyncLocalStorageInstance(zig, callframe->argument(0)); + rust->bakeAdditions().ensureAsyncLocalStorageInstance(rust, callframe->argument(0)); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(jsUndefined()); } extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getBundleNewRouteJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = static_cast(globalObject); - auto value = zig->bakeAdditions().getBundleNewRouteJSFunction(zig); + auto* rust = static_cast(globalObject); + auto value = rust->bakeAdditions().getBundleNewRouteJSFunction(rust); return JSValue::encode(value); } @@ -136,8 +136,8 @@ BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetBundleNewRouteJSFunction, (JSC::JSGlob extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getNewRouteParamsJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = static_cast(globalObject); - auto value = zig->bakeAdditions().getNewRouteParamsJSFunction(zig); + auto* rust = static_cast(globalObject); + auto value = rust->bakeAdditions().getNewRouteParamsJSFunction(rust); return JSValue::encode(value); } diff --git a/src/jsc/bindings/Bindgen/ExternVectorTraits.h b/src/jsc/bindings/Bindgen/ExternVectorTraits.h index f6f62bc8f65..374a4e5adae 100644 --- a/src/jsc/bindings/Bindgen/ExternVectorTraits.h +++ b/src/jsc/bindings/Bindgen/ExternVectorTraits.h @@ -30,9 +30,9 @@ template void asanSetBufferSizeToFullCapacity(T* buffer, std::size_t length, std::size_t capacity) { #if ASAN_ENABLED - // Without this, ASan will complain if Zig touches memory in the range + // Without this, ASan will complain if Rust touches memory in the range // [storage + length, storage + capacity), which will always happen when freeing the - // memory in Debug mode when Zig writes 0xaa to it. + // memory in Debug mode when Rust writes 0xaa to it. __sanitizer_annotate_contiguous_container( buffer, // beg buffer + capacity, // end diff --git a/src/jsc/bindings/BufferEncodingType.h b/src/jsc/bindings/BufferEncodingType.h index 4052d23d1b0..ae53d2bd48e 100644 --- a/src/jsc/bindings/BufferEncodingType.h +++ b/src/jsc/bindings/BufferEncodingType.h @@ -4,7 +4,7 @@ namespace WebCore { -// must match src/runtime/node/types.zig#Encoding +// must match src/runtime/node/types.rust#Encoding enum class BufferEncodingType : uint8_t { utf8 = 0, ucs2 = 1, diff --git a/src/jsc/bindings/BunAnalyzeTranspiledModule.cpp b/src/jsc/bindings/BunAnalyzeTranspiledModule.cpp index f33f9469222..65954bc18a6 100644 --- a/src/jsc/bindings/BunAnalyzeTranspiledModule.cpp +++ b/src/jsc/bindings/BunAnalyzeTranspiledModule.cpp @@ -10,8 +10,8 @@ #include #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/ExceptionScope.h" -#include "ZigSourceProvider.h" -#include "ZigGlobalObject.h" +#include "RustSourceProvider.h" +#include "RustGlobalObject.h" #include "headers-handwritten.h" #include "IsolatedModuleCache.h" #include "BunAnalyzeTranspiledModule.h" @@ -39,8 +39,8 @@ Identifier getFromIdentifierArray(VM& vm, Identifier* identifierArray, uint32_t return identifierArray[n]; } -extern "C" JSModuleRecord* zig__ModuleInfoDeserialized__toJSModuleRecord(JSGlobalObject* globalObject, VM& vm, const Identifier& module_key, const SourceCode& source_code, VariableEnvironment& declared_variables, VariableEnvironment& lexical_variables, bun_ModuleInfoDeserialized* module_info); -extern "C" void zig__renderDiff(const char* expected_ptr, size_t expected_len, const char* received_ptr, size_t received_len, JSGlobalObject* globalObject); +extern "C" JSModuleRecord* rust__ModuleInfoDeserialized__toJSModuleRecord(JSGlobalObject* globalObject, VM& vm, const Identifier& module_key, const SourceCode& source_code, VariableEnvironment& declared_variables, VariableEnvironment& lexical_variables, bun_ModuleInfoDeserialized* module_info); +extern "C" void rust__renderDiff(const char* expected_ptr, size_t expected_len, const char* received_ptr, size_t received_len, JSGlobalObject* globalObject); extern "C" Identifier* JSC__IdentifierArray__create(size_t len) { @@ -161,7 +161,7 @@ extern "C" EncodedJSValue Bun__analyzeTranspiledModule(JSGlobalObject* globalObj VariableEnvironment declaredVariables = VariableEnvironment(); VariableEnvironment lexicalVariables = VariableEnvironment(); - auto provider = static_cast(sourceCode.provider()); + auto provider = static_cast(sourceCode.provider()); if (provider->m_resolvedSource.module_info == nullptr) { dataLog("[note] module_info is null for module: ", moduleKey.utf8(), "\n"); @@ -169,12 +169,12 @@ extern "C" EncodedJSValue Bun__analyzeTranspiledModule(JSGlobalObject* globalObj } auto* moduleInfo = static_cast(provider->m_resolvedSource.module_info); - auto moduleRecord = zig__ModuleInfoDeserialized__toJSModuleRecord(globalObject, vm, moduleKey, sourceCode, declaredVariables, lexicalVariables, moduleInfo); + auto moduleRecord = rust__ModuleInfoDeserialized__toJSModuleRecord(globalObject, vm, moduleKey, sourceCode, declaredVariables, lexicalVariables, moduleInfo); // Under --isolate the same SourceProvider is reused across globals via the // IsolatedModuleCache, so module_info must remain alive on the provider; // ~SourceProvider frees it. Otherwise, free now. - if (!Bun::IsolatedModuleCache::canUse(vm, uncheckedDowncast(globalObject)->bunVM())) { - zig__ModuleInfoDeserialized__deinit(moduleInfo); + if (!Bun::IsolatedModuleCache::canUse(vm, uncheckedDowncast(globalObject)->bunVM())) { + rust__ModuleInfoDeserialized__deinit(moduleInfo); provider->m_resolvedSource.module_info = nullptr; } if (moduleRecord == nullptr) { @@ -224,7 +224,7 @@ static EncodedJSValue fallbackParse(JSGlobalObject* globalObject, const Identifi dataLog(" ------", "\n"); dataLog(" BunAnalyzeTranspiledModule:", "\n"); - zig__renderDiff(expected.utf8().data(), expected.utf8().length(), actual.utf8().data(), actual.utf8().length(), globalObject); + rust__renderDiff(expected.utf8().data(), expected.utf8().length(), actual.utf8().data(), actual.utf8().length(), globalObject); RELEASE_AND_RETURN(scope, JSValue::encode(rejectWithError(createError(globalObject, WTF::String::fromLatin1("Imports different between parseFromSourceCode and fallbackParse"))))); } diff --git a/src/jsc/bindings/BunAnalyzeTranspiledModule.h b/src/jsc/bindings/BunAnalyzeTranspiledModule.h index 34fcb810df0..7c186c22f7b 100644 --- a/src/jsc/bindings/BunAnalyzeTranspiledModule.h +++ b/src/jsc/bindings/BunAnalyzeTranspiledModule.h @@ -1,2 +1,2 @@ struct bun_ModuleInfoDeserialized; -extern "C" void zig__ModuleInfoDeserialized__deinit(bun_ModuleInfoDeserialized* info); +extern "C" void rust__ModuleInfoDeserialized__deinit(bun_ModuleInfoDeserialized* info); diff --git a/src/jsc/bindings/BunCPUProfiler.cpp b/src/jsc/bindings/BunCPUProfiler.cpp index 3166d2ed9a8..b886d681fde 100644 --- a/src/jsc/bindings/BunCPUProfiler.cpp +++ b/src/jsc/bindings/BunCPUProfiler.cpp @@ -1,6 +1,6 @@ #include "root.h" #include "BunCPUProfiler.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" #include "BunString.h" #include diff --git a/src/jsc/bindings/BunClientData.cpp b/src/jsc/bindings/BunClientData.cpp index e18dc8ba6ac..c7981d623eb 100644 --- a/src/jsc/bindings/BunClientData.cpp +++ b/src/jsc/bindings/BunClientData.cpp @@ -34,7 +34,7 @@ using namespace JSC; RefPtr createBuiltinsSourceProvider(); JSHeapData::JSHeapData(Heap& heap) - : m_heapCellTypeForJSWorkerGlobalScope(JSC::IsoHeapCellType::Args()) + : m_heapCellTypeForJSWorkerGlobalScope(JSC::IsoHeapCellType::Args()) , m_heapCellTypeForNodeVMGlobalObject(JSC::IsoHeapCellType::Args()) , m_heapCellTypeForBakeGlobalObject(JSC::IsoHeapCellType::Args()) , m_heapCellTypeForNapiHandleScopeImpl(JSC::IsoHeapCellType::Args()) diff --git a/src/jsc/bindings/BunClientData.h b/src/jsc/bindings/BunClientData.h index e3d60c5a5ac..65ab313ef1f 100644 --- a/src/jsc/bindings/BunClientData.h +++ b/src/jsc/bindings/BunClientData.h @@ -26,13 +26,13 @@ class DOMWrapperWorld; #include #include "JSCTaskScheduler.h" #include "HTTPHeaderIdentifiers.h" -namespace Zig { +namespace Rust { class GlobalObject; } namespace WebCore { using namespace JSC; -using namespace Zig; +using namespace Rust; enum class UseCustomHeapCellType { Yes, No }; @@ -124,7 +124,7 @@ class JSVMClientData : public JSC::VM::ClientData { // Backing storage for Bun::IsolatedModuleCache (see IsolatedModuleCache.h). // All access should go through that class. Stored as the JSC base type to - // avoid pulling ZigSourceProvider.h into this header; the cache class + // avoid pulling RustSourceProvider.h into this header; the cache class // downcasts on lookup. Values hold strong refs by design: this map is the // only owner once the previous global is GC'd, so a weak map would empty // after every swap. diff --git a/src/jsc/bindings/BunCommonStrings.cpp b/src/jsc/bindings/BunCommonStrings.cpp index ea5351bd926..e991bd136bd 100644 --- a/src/jsc/bindings/BunCommonStrings.cpp +++ b/src/jsc/bindings/BunCommonStrings.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -45,7 +45,7 @@ void CommonStrings::visit(Visitor& visitor) template void CommonStrings::visit(JSC::AbstractSlotVisitor&); template void CommonStrings::visit(JSC::SlotVisitor&); -// Must be kept in sync with method.zig +// Must be kept in sync with method.rust enum class HTTPMethod : uint8_t { httpACL = 0, httpBIND = 1, @@ -86,7 +86,7 @@ enum class HTTPMethod : uint8_t { httpUNSUBSCRIBE = 35, }; -static JSC::JSValue toJS(Zig::GlobalObject* globalObject, HTTPMethod method) +static JSC::JSValue toJS(Rust::GlobalObject* globalObject, HTTPMethod method) { #define FOR_EACH_METHOD(method) \ case HTTPMethod::http##method: \ @@ -138,12 +138,12 @@ static JSC::JSValue toJS(Zig::GlobalObject* globalObject, HTTPMethod method) #undef FOR_EACH_METHOD } -extern "C" JSC::EncodedJSValue Bun__HTTPMethod__toJS(HTTPMethod method, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__HTTPMethod__toJS(HTTPMethod method, Rust::GlobalObject* globalObject) { return JSValue::encode(toJS(globalObject, method)); } -enum class CommonStringsForZig : uint8_t { +enum class CommonStringsForRust : uint8_t { IPv4 = 0, IPv6 = 1, IN4Loopback = 2, @@ -159,35 +159,35 @@ enum class CommonStringsForZig : uint8_t { binaryTypeUint8Array = 12, }; -static JSC::JSValue toJS(Zig::GlobalObject* globalObject, CommonStringsForZig commonString) +static JSC::JSValue toJS(Rust::GlobalObject* globalObject, CommonStringsForRust commonString) { auto& commonStrings = globalObject->commonStrings(); switch (commonString) { - case CommonStringsForZig::IPv4: + case CommonStringsForRust::IPv4: return commonStrings.IPv4String(globalObject); - case CommonStringsForZig::IPv6: + case CommonStringsForRust::IPv6: return commonStrings.IPv6String(globalObject); - case CommonStringsForZig::IN4Loopback: + case CommonStringsForRust::IN4Loopback: return commonStrings.IN4LoopbackString(globalObject); - case CommonStringsForZig::IN6Any: + case CommonStringsForRust::IN6Any: return commonStrings.IN6AnyString(globalObject); - case CommonStringsForZig::ipv4Lower: + case CommonStringsForRust::ipv4Lower: return commonStrings.ipv4LowerString(globalObject); - case CommonStringsForZig::ipv6Lower: + case CommonStringsForRust::ipv6Lower: return commonStrings.ipv6LowerString(globalObject); - case CommonStringsForZig::fetchDefault: + case CommonStringsForRust::fetchDefault: return globalObject->vm().smallStrings.defaultString(); - case CommonStringsForZig::fetchError: + case CommonStringsForRust::fetchError: return commonStrings.fetchErrorString(globalObject); - case CommonStringsForZig::fetchInclude: + case CommonStringsForRust::fetchInclude: return commonStrings.fetchIncludeString(globalObject); - case CommonStringsForZig::buffer: + case CommonStringsForRust::buffer: return commonStrings.bufferString(globalObject); - case CommonStringsForZig::binaryTypeArrayBuffer: + case CommonStringsForRust::binaryTypeArrayBuffer: return commonStrings.binaryTypeArrayBufferString(globalObject); - case CommonStringsForZig::binaryTypeNodeBuffer: + case CommonStringsForRust::binaryTypeNodeBuffer: return commonStrings.binaryTypeNodeBufferString(globalObject); - case CommonStringsForZig::binaryTypeUint8Array: + case CommonStringsForRust::binaryTypeUint8Array: return commonStrings.binaryTypeUint8ArrayString(globalObject); default: { ASSERT_NOT_REACHED(); @@ -196,12 +196,12 @@ static JSC::JSValue toJS(Zig::GlobalObject* globalObject, CommonStringsForZig co } } -extern "C" JSC::EncodedJSValue Bun__CommonStringsForZig__toJS(CommonStringsForZig commonString, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__CommonStringsForRust__toJS(CommonStringsForRust commonString, Rust::GlobalObject* globalObject) { return JSValue::encode(toJS(globalObject, commonString)); } -// Must be kept in sync with src/http/FetchCacheMode.zig +// Must be kept in sync with src/http/FetchCacheMode.rust enum class FetchCacheMode : uint8_t { Default = 0, NoStore = 1, @@ -211,7 +211,7 @@ enum class FetchCacheMode : uint8_t { OnlyIfCached = 5, }; -extern "C" JSC::EncodedJSValue Bun__FetchCacheMode__toJS(FetchCacheMode mode, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__FetchCacheMode__toJS(FetchCacheMode mode, Rust::GlobalObject* globalObject) { auto& commonStrings = globalObject->commonStrings(); switch (mode) { @@ -234,14 +234,14 @@ extern "C" JSC::EncodedJSValue Bun__FetchCacheMode__toJS(FetchCacheMode mode, Zi } } -// Must be kept in sync with src/http/FetchRedirect.zig +// Must be kept in sync with src/http/FetchRedirect.rust enum class FetchRedirect : uint8_t { Follow = 0, Manual = 1, Error = 2, }; -extern "C" JSC::EncodedJSValue Bun__FetchRedirect__toJS(FetchRedirect redirect, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__FetchRedirect__toJS(FetchRedirect redirect, Rust::GlobalObject* globalObject) { auto& commonStrings = globalObject->commonStrings(); switch (redirect) { @@ -258,7 +258,7 @@ extern "C" JSC::EncodedJSValue Bun__FetchRedirect__toJS(FetchRedirect redirect, } } -// Must be kept in sync with src/http/FetchRequestMode.zig +// Must be kept in sync with src/http/FetchRequestMode.rust enum class FetchRequestMode : uint8_t { SameOrigin = 0, NoCors = 1, @@ -266,7 +266,7 @@ enum class FetchRequestMode : uint8_t { Navigate = 3, }; -extern "C" JSC::EncodedJSValue Bun__FetchRequestMode__toJS(FetchRequestMode mode, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__FetchRequestMode__toJS(FetchRequestMode mode, Rust::GlobalObject* globalObject) { auto& commonStrings = globalObject->commonStrings(); switch (mode) { diff --git a/src/jsc/bindings/BunDebugger.cpp b/src/jsc/bindings/BunDebugger.cpp index ad3ef8bd8ed..a2a88643c94 100644 --- a/src/jsc/bindings/BunDebugger.cpp +++ b/src/jsc/bindings/BunDebugger.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -116,7 +116,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { this->status = ConnectionStatus::Connected; auto* globalObject = context.jsGlobalObject(); if (this->unrefOnDisconnect) { - Bun__eventLoop__incrementRefConcurrently(static_cast(globalObject)->bunVM(), 1); + Bun__eventLoop__incrementRefConcurrently(static_cast(globalObject)->bunVM(), 1); } globalObject->setInspectable(true); auto& inspector = globalObject->inspectorDebuggable(); @@ -146,7 +146,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { }; } - this->receiveMessagesOnInspectorThread(context, static_cast(globalObject), false); + this->receiveMessagesOnInspectorThread(context, static_cast(globalObject), false); } void connect() @@ -202,7 +202,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { if (connection->unrefOnDisconnect) { connection->unrefOnDisconnect = false; - Bun__eventLoop__incrementRefConcurrently(static_cast(context.jsGlobalObject())->bunVM(), -1); + Bun__eventLoop__incrementRefConcurrently(static_cast(context.jsGlobalObject())->bunVM(), -1); } }); } @@ -222,7 +222,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { static void runWhilePaused(JSGlobalObject& globalObject, bool& isDoneProcessingEvents) { - Zig::GlobalObject* global = static_cast(&globalObject); + Rust::GlobalObject* global = static_cast(&globalObject); Vector connections; { Locker locker(inspectorConnectionsLock); @@ -309,7 +309,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { wait.condition.notifyAll(); } - void receiveMessagesOnInspectorThread(ScriptExecutionContext& context, Zig::GlobalObject* globalObject, bool connectIfNeeded) + void receiveMessagesOnInspectorThread(ScriptExecutionContext& context, Rust::GlobalObject* globalObject, bool connectIfNeeded) { this->jsThreadMessageScheduledCount.store(0); WTF::Vector messages; @@ -349,7 +349,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { messages.clear(); } - void receiveMessagesOnDebuggerThread(ScriptExecutionContext& context, Zig::GlobalObject* debuggerGlobalObject) + void receiveMessagesOnDebuggerThread(ScriptExecutionContext& context, Rust::GlobalObject* debuggerGlobalObject) { debuggerThreadMessageScheduledCount.store(0); WTF::Vector messages; @@ -382,7 +382,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { if (this->debuggerThreadMessageScheduledCount++ == 0) { debuggerScriptExecutionContext->postTaskConcurrently([connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnDebuggerThread(context, static_cast(context.jsGlobalObject())); + connection->receiveMessagesOnDebuggerThread(context, static_cast(context.jsGlobalObject())); }); } } @@ -398,7 +398,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { if (this->jsThreadMessageScheduledCount++ == 0) { ScriptExecutionContext::postTaskTo(scriptExecutionContextIdentifier, [connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); + connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); }); } } @@ -414,7 +414,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { if (this->jsThreadMessageScheduledCount++ == 0) { ScriptExecutionContext::postTaskTo(scriptExecutionContextIdentifier, [connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); + connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); }); } } @@ -533,7 +533,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionDisconnect, (JSC::JSGlobalObject * globalObje const JSC::ClassInfo JSBunInspectorConnection::s_info = { "BunInspectorConnection"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBunInspectorConnection) }; -extern "C" unsigned int Bun__createJSDebugger(Zig::GlobalObject* globalObject) +extern "C" unsigned int Bun__createJSDebugger(Rust::GlobalObject* globalObject) { { Locker locker(inspectorConnectionsLock); @@ -590,7 +590,7 @@ extern "C" void BunDebugger__willHotReload() JSC_DEFINE_HOST_FUNCTION(jsFunctionCreateConnection, (JSGlobalObject * globalObject, CallFrame* callFrame)) { - auto* debuggerGlobalObject = dynamicDowncast(globalObject); + auto* debuggerGlobalObject = dynamicDowncast(globalObject); if (!debuggerGlobalObject) return JSValue::encode(jsUndefined()); @@ -618,7 +618,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionCreateConnection, (JSGlobalObject * globalObj return JSValue::encode(JSBunInspectorConnection::create(vm, JSBunInspectorConnection::createStructure(vm, globalObject, globalObject->objectPrototype()), connection)); } -extern "C" void Bun__startJSDebuggerThread(Zig::GlobalObject* debuggerGlobalObject, ScriptExecutionContextIdentifier scriptId, BunString* portOrPathString, int isAutomatic, bool isUrlServer) +extern "C" void Bun__startJSDebuggerThread(Rust::GlobalObject* debuggerGlobalObject, ScriptExecutionContextIdentifier scriptId, BunString* portOrPathString, int isAutomatic, bool isUrlServer) { if (!debuggerScriptExecutionContext) debuggerScriptExecutionContext = debuggerGlobalObject->scriptExecutionContext(); diff --git a/src/jsc/bindings/BunGlobalScope.cpp b/src/jsc/bindings/BunGlobalScope.cpp index 694e720fe5f..c0d2c77ec11 100644 --- a/src/jsc/bindings/BunGlobalScope.cpp +++ b/src/jsc/bindings/BunGlobalScope.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunGlobalScope.h" #include "JavaScriptCore/VM.h" #include "JavaScriptCore/VMTraps.h" diff --git a/src/jsc/bindings/BunHttp2CommonStrings.cpp b/src/jsc/bindings/BunHttp2CommonStrings.cpp index e1eba23d6aa..1d3bf9e5ab7 100644 --- a/src/jsc/bindings/BunHttp2CommonStrings.cpp +++ b/src/jsc/bindings/BunHttp2CommonStrings.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include diff --git a/src/jsc/bindings/BunIDLConvertBlob.h b/src/jsc/bindings/BunIDLConvertBlob.h index 2cb5a229756..29ef027a7de 100644 --- a/src/jsc/bindings/BunIDLConvertBlob.h +++ b/src/jsc/bindings/BunIDLConvertBlob.h @@ -2,7 +2,7 @@ #include "BunIDLTypes.h" #include "BunIDLConvertBase.h" #include "blob.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" namespace Bun { struct IDLBlobRef : IDLBunInterface {}; diff --git a/src/jsc/bindings/BunInjectedScriptHost.cpp b/src/jsc/bindings/BunInjectedScriptHost.cpp index f0669c80a2d..97f1e298068 100644 --- a/src/jsc/bindings/BunInjectedScriptHost.cpp +++ b/src/jsc/bindings/BunInjectedScriptHost.cpp @@ -1,7 +1,7 @@ #include "root.h" #include "BunInjectedScriptHost.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "DOMException.h" #include "JSDOMException.h" diff --git a/src/jsc/bindings/BunMarkdownMeta.cpp b/src/jsc/bindings/BunMarkdownMeta.cpp index 0950f1eb315..4940b20bdf4 100644 --- a/src/jsc/bindings/BunMarkdownMeta.cpp +++ b/src/jsc/bindings/BunMarkdownMeta.cpp @@ -53,7 +53,7 @@ Structure* createLinkMetaStructure(VM& vm, JSGlobalObject* globalObject) } // namespace Bun // ────────────────────────────────────────────────────────────────────────── -// extern "C" constructors — callable from MarkdownObject.zig +// extern "C" constructors — callable from MarkdownObject.rust // ────────────────────────────────────────────────────────────────────────── extern "C" JSC::EncodedJSValue BunMarkdownMeta__createListItem( @@ -64,7 +64,7 @@ extern "C" JSC::EncodedJSValue BunMarkdownMeta__createListItem( EncodedJSValue start, EncodedJSValue checked) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSObject* obj = constructEmptyObject(vm, global->JSMarkdownListItemMetaStructure()); @@ -83,7 +83,7 @@ extern "C" JSC::EncodedJSValue BunMarkdownMeta__createList( EncodedJSValue start, uint32_t depth) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSObject* obj = constructEmptyObject(vm, global->JSMarkdownListMetaStructure()); @@ -98,7 +98,7 @@ extern "C" JSC::EncodedJSValue BunMarkdownMeta__createCell( JSGlobalObject* globalObject, EncodedJSValue align) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSObject* obj = constructEmptyObject(vm, global->JSMarkdownCellMetaStructure()); @@ -112,7 +112,7 @@ extern "C" JSC::EncodedJSValue BunMarkdownMeta__createLink( EncodedJSValue href, EncodedJSValue title) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSObject* obj = constructEmptyObject(vm, global->JSMarkdownLinkMetaStructure()); diff --git a/src/jsc/bindings/BunMarkdownMeta.h b/src/jsc/bindings/BunMarkdownMeta.h index 8d24e9d0447..2d14e348e5b 100644 --- a/src/jsc/bindings/BunMarkdownMeta.h +++ b/src/jsc/bindings/BunMarkdownMeta.h @@ -2,7 +2,7 @@ #include "root.h" #include "headers.h" #include "JavaScriptCore/JSObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" using namespace JSC; diff --git a/src/jsc/bindings/BunMarkdownTagStrings.cpp b/src/jsc/bindings/BunMarkdownTagStrings.cpp index 7eb331e5741..cdacd30fbb3 100644 --- a/src/jsc/bindings/BunMarkdownTagStrings.cpp +++ b/src/jsc/bindings/BunMarkdownTagStrings.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -36,8 +36,8 @@ template void MarkdownTagStrings::visit(JSC::SlotVisitor&); } // namespace Bun -// C API for Zig bindings -extern "C" JSC::EncodedJSValue BunMarkdownTagStrings__getTagString(Zig::GlobalObject* globalObject, uint8_t tagIndex) +// C API for Rust bindings +extern "C" JSC::EncodedJSValue BunMarkdownTagStrings__getTagString(Rust::GlobalObject* globalObject, uint8_t tagIndex) { if (tagIndex >= MARKDOWN_TAG_STRINGS_COUNT) return JSC::JSValue::encode(JSC::jsUndefined()); diff --git a/src/jsc/bindings/BunObject+exports.h b/src/jsc/bindings/BunObject+exports.h index a9cb358ebd6..d9cf0bf7452 100644 --- a/src/jsc/bindings/BunObject+exports.h +++ b/src/jsc/bindings/BunObject+exports.h @@ -83,22 +83,22 @@ macro(zstdCompress) \ macro(zstdDecompress) \ -#define DECLARE_ZIG_BUN_OBJECT_CALLBACK(name) BUN_DECLARE_HOST_FUNCTION(BunObject_callback_##name); -FOR_EACH_CALLBACK(DECLARE_ZIG_BUN_OBJECT_CALLBACK); -#undef DECLARE_ZIG_BUN_OBJECT_CALLBACK +#define DECLARE_RUST_BUN_OBJECT_CALLBACK(name) BUN_DECLARE_HOST_FUNCTION(BunObject_callback_##name); +FOR_EACH_CALLBACK(DECLARE_RUST_BUN_OBJECT_CALLBACK); +#undef DECLARE_RUST_BUN_OBJECT_CALLBACK -// declaration for the exported function in BunObject.zig -#define DECLARE_ZIG_BUN_OBJECT_GETTER(name) extern "C" JSC::EncodedJSValue SYSV_ABI BunObject_lazyPropCb_##name(JSC::JSGlobalObject*, JSC::JSObject*); -FOR_EACH_GETTER(DECLARE_ZIG_BUN_OBJECT_GETTER); -#undef DECLARE_ZIG_BUN_OBJECT_GETTER +// declaration for the exported function in BunObject.rust +#define DECLARE_RUST_BUN_OBJECT_GETTER(name) extern "C" JSC::EncodedJSValue SYSV_ABI BunObject_lazyPropCb_##name(JSC::JSGlobalObject*, JSC::JSObject*); +FOR_EACH_GETTER(DECLARE_RUST_BUN_OBJECT_GETTER); +#undef DECLARE_RUST_BUN_OBJECT_GETTER -// definition of the C++ wrapper to call the Zig function -#define DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER(name) static JSC::JSValue BunObject_lazyPropCb_wrap_##name(JSC::VM &vm, JSC::JSObject *object) { \ +// definition of the C++ wrapper to call the Rust function +#define DEFINE_RUST_BUN_OBJECT_GETTER_WRAPPER(name) static JSC::JSValue BunObject_lazyPropCb_wrap_##name(JSC::VM &vm, JSC::JSObject *object) { \ return JSC::JSValue::decode(BunObject_lazyPropCb_##name(object->globalObject(), object)); \ } \ -FOR_EACH_GETTER(DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER); -#undef DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER +FOR_EACH_GETTER(DEFINE_RUST_BUN_OBJECT_GETTER_WRAPPER); +#undef DEFINE_RUST_BUN_OBJECT_GETTER_WRAPPER #undef FOR_EACH_GETTER #undef FOR_EACH_CALLBACK diff --git a/src/jsc/bindings/BunObject.cpp b/src/jsc/bindings/BunObject.cpp index 92a006ed723..4ff8c3fa109 100644 --- a/src/jsc/bindings/BunObject.cpp +++ b/src/jsc/bindings/BunObject.cpp @@ -2,7 +2,7 @@ #include "JavaScriptCore/HeapProfiler.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/ArgList.h" #include "JSDOMURL.h" #include "helpers.h" @@ -94,7 +94,7 @@ extern "C" bool has_bun_garbage_collector_flag_enabled; static JSValue BunObject_lazyPropCb_wrap_ArrayBufferSink(VM& vm, JSObject* bunObject) { - return uncheckedDowncast(bunObject->globalObject())->ArrayBufferSink(); + return uncheckedDowncast(bunObject->globalObject())->ArrayBufferSink(); } static JSValue constructCookieObject(VM& vm, JSObject* bunObject); @@ -104,7 +104,7 @@ static JSValue constructWebViewObject(VM& vm, JSObject* bunObject); static JSValue constructEnvObject(VM& vm, JSObject* object) { - return uncheckedDowncast(object->globalObject())->processEnvObject(); + return uncheckedDowncast(object->globalObject())->processEnvObject(); } static inline JSC::EncodedJSValue flattenArrayOfBuffersIntoArrayBufferOrUint8Array(JSGlobalObject* lexicalGlobalObject, JSValue arrayValue, size_t maxLength, bool asUint8Array) @@ -298,7 +298,7 @@ static JSValue constructBunVersionWithSha(VM& vm, JSObject*) static JSValue constructIsMainThread(VM&, JSObject* object) { - return jsBoolean(uncheckedDowncast(object->globalObject())->scriptExecutionContext()->isMainThread()); + return jsBoolean(uncheckedDowncast(object->globalObject())->scriptExecutionContext()->isMainThread()); } static JSValue constructPluginObject(VM& vm, JSObject* bunObject) @@ -347,7 +347,7 @@ JSValue constructBunFetchObject(VM& vm, JSObject* bunObject) { JSFunction* fetchFn = JSFunction::create(vm, bunObject->globalObject(), 1, "fetch"_s, Bun__fetch, ImplementationVisibility::Public, NoIntrinsic); - auto* globalObject = uncheckedDowncast(bunObject->globalObject()); + auto* globalObject = uncheckedDowncast(bunObject->globalObject()); fetchFn->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(vm, "preconnect"_s), 1, Bun__fetchPreconnect, ImplementationVisibility::Public, NoIntrinsic, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete | 0); @@ -356,7 +356,7 @@ JSValue constructBunFetchObject(VM& vm, JSObject* bunObject) static JSValue constructBunShell(VM& vm, JSObject* bunObject) { - auto* globalObject = uncheckedDowncast(bunObject->globalObject()); + auto* globalObject = uncheckedDowncast(bunObject->globalObject()); JSFunction* createParsedShellScript = JSFunction::create(vm, bunObject->globalObject(), 2, "createParsedShellScript"_s, BunObject_callback_createParsedShellScript, ImplementationVisibility::Private, NoIntrinsic); JSFunction* createShellInterpreterFunction = JSFunction::create(vm, bunObject->globalObject(), 1, "createShellInterpreter"_s, BunObject_callback_createShellInterpreter, ImplementationVisibility::Private, NoIntrinsic); JSC::JSFunction* createShellFn = JSC::JSFunction::create(vm, globalObject, shellCreateBunShellTemplateFunctionCodeGenerator(vm), globalObject); @@ -618,8 +618,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionJSONLParseChunk, (JSGlobalObject * globalObje errorValue = createSyntaxError(globalObject, "Failed to parse JSONL"_s); } - auto* zigGlobalObject = uncheckedDowncast(globalObject); - JSObject* resultObj = constructEmptyObject(vm, zigGlobalObject->jsonlParseResultStructure()); + auto* rustGlobalObject = uncheckedDowncast(globalObject); + JSObject* resultObj = constructEmptyObject(vm, rustGlobalObject->jsonlParseResultStructure()); resultObj->putDirectOffset(vm, 0, array); resultObj->putDirectOffset(vm, 1, jsNumber(readBytes)); resultObj->putDirectOffset(vm, 2, jsBoolean(result.status == JSC::StreamingJSONParseResult::Status::Complete)); @@ -1128,20 +1128,20 @@ static JSC_DEFINE_CUSTOM_SETTER(setBunObjectMain, (JSC::JSGlobalObject * globalO // LazyProperty wrappers for stdin/stderr/stdout static JSValue BunObject_lazyPropCb_wrap_stdin(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return zigGlobalObject->m_bunStdin.getInitializedOnMainThread(zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return rustGlobalObject->m_bunStdin.getInitializedOnMainThread(rustGlobalObject); } static JSValue BunObject_lazyPropCb_wrap_stderr(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return zigGlobalObject->m_bunStderr.getInitializedOnMainThread(zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return rustGlobalObject->m_bunStderr.getInitializedOnMainThread(rustGlobalObject); } static JSValue BunObject_lazyPropCb_wrap_stdout(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return zigGlobalObject->m_bunStdout.getInitializedOnMainThread(zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return rustGlobalObject->m_bunStdout.getInitializedOnMainThread(rustGlobalObject); } #include "BunObject.lut.h" @@ -1158,31 +1158,31 @@ const JSC::ClassInfo JSBunObject::s_info = { "Bun"_s, &Base::s_info, &bunObjectT static JSValue constructCookieObject(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return WebCore::JSCookie::getConstructor(vm, zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return WebCore::JSCookie::getConstructor(vm, rustGlobalObject); } static JSValue constructCookieMapObject(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return WebCore::JSCookieMap::getConstructor(vm, zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return WebCore::JSCookieMap::getConstructor(vm, rustGlobalObject); } static JSValue constructSecretsObject(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return Bun::createSecretsObject(vm, zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return Bun::createSecretsObject(vm, rustGlobalObject); } static JSValue constructWebViewObject(VM& vm, JSObject* bunObject) { - auto* zigGlobalObject = uncheckedDowncast(bunObject->globalObject()); - return zigGlobalObject->m_JSWebViewClassStructure.constructor(zigGlobalObject); + auto* rustGlobalObject = uncheckedDowncast(bunObject->globalObject()); + return rustGlobalObject->m_JSWebViewClassStructure.constructor(rustGlobalObject); } JSC::JSObject* createBunObject(VM& vm, JSObject* globalObject) { - return JSBunObject::create(vm, uncheckedDowncast(globalObject)); + return JSBunObject::create(vm, uncheckedDowncast(globalObject)); } static void exportBunObject(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* object, Vector& exportNames, JSC::MarkedArgumentBuffer& exportValues) @@ -1215,14 +1215,14 @@ static void exportBunObject(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC: } // namespace Bun -namespace Zig { +namespace Rust { void generateNativeModule_BunObject(JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, Vector& exportNames, JSC::MarkedArgumentBuffer& exportValues) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); auto* object = globalObject->bunObject(); @@ -1237,4 +1237,4 @@ void generateNativeModule_BunObject(JSC::JSGlobalObject* lexicalGlobalObject, Bun::exportBunObject(vm, globalObject, object, exportNames, exportValues); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/BunPlugin.cpp b/src/jsc/bindings/BunPlugin.cpp index b2a6bc6af2b..2232bcb5182 100644 --- a/src/jsc/bindings/BunPlugin.cpp +++ b/src/jsc/bindings/BunPlugin.cpp @@ -5,7 +5,7 @@ #include "JavaScriptCore/JSCast.h" #include "headers-handwritten.h" #include "helpers.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -35,7 +35,7 @@ #include "AsyncContextFrame.h" #include "ImportMetaObject.h" -namespace Zig { +namespace Rust { extern "C" void Bun__onDidAppendPlugin(void* bunVM, JSGlobalObject* globalObject); using OnAppendPluginCallback = void (*)(void*, JSGlobalObject* globalObject); @@ -143,7 +143,7 @@ static EncodedJSValue jsFunctionAppendVirtualModulePluginBody(JSC::JSGlobalObjec return {}; } - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); if (global->onLoadPlugins.virtualModules == nullptr) { global->onLoadPlugins.virtualModules = new BunPlugin::VirtualModuleMap; @@ -224,7 +224,7 @@ static JSC::EncodedJSValue jsFunctionAppendOnResolvePluginBody(JSC::JSGlobalObje static JSC::EncodedJSValue jsFunctionAppendOnResolvePluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) { - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); auto& plugins = global->onResolvePlugins; auto callback = Bun__onDidAppendPlugin; @@ -233,7 +233,7 @@ static JSC::EncodedJSValue jsFunctionAppendOnResolvePluginGlobal(JSC::JSGlobalOb static JSC::EncodedJSValue jsFunctionAppendOnLoadPluginGlobal(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target) { - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); auto& plugins = global->onLoadPlugins; auto callback = Bun__onDidAppendPlugin; @@ -393,7 +393,7 @@ JSC::JSObject* BunPlugin::Group::find(JSC::JSGlobalObject* globalObject, String& void BunPlugin::OnLoad::addModuleMock(JSC::VM& vm, const String& path, JSC::JSObject* mockObject) { - Zig::GlobalObject* globalObject = defaultGlobalObject(mockObject->globalObject()); + Rust::GlobalObject* globalObject = defaultGlobalObject(mockObject->globalObject()); if (globalObject->onLoadPlugins.virtualModules == nullptr) { globalObject->onLoadPlugins.virtualModules = new BunPlugin::VirtualModuleMap; @@ -502,7 +502,7 @@ BUN_DECLARE_HOST_FUNCTION(JSMock__jsModuleMock); extern "C" JSC_DEFINE_HOST_FUNCTION(JSMock__jsModuleMock, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callframe)) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); if (!globalObject) [[unlikely]] { scope.throwException(lexicalGlobalObject, JSC::createTypeError(lexicalGlobalObject, "Cannot run mock from a different global context"_s)); @@ -875,14 +875,14 @@ EncodedJSValue BunPlugin::OnResolve::run(JSC::JSGlobalObject* globalObject, BunS return JSValue::encode(JSC::jsUndefined()); } -} // namespace Zig +} // namespace Rust -extern "C" JSC::EncodedJSValue Bun__runOnResolvePlugins(Zig::GlobalObject* globalObject, BunString* namespaceString, BunString* path, BunString* from, BunPluginTarget target) +extern "C" JSC::EncodedJSValue Bun__runOnResolvePlugins(Rust::GlobalObject* globalObject, BunString* namespaceString, BunString* path, BunString* from, BunPluginTarget target) { return globalObject->onResolvePlugins.run(globalObject, namespaceString, path, from); } -extern "C" JSC::EncodedJSValue Bun__runOnLoadPlugins(Zig::GlobalObject* globalObject, BunString* namespaceString, BunString* path, BunPluginTarget target) +extern "C" JSC::EncodedJSValue Bun__runOnLoadPlugins(Rust::GlobalObject* globalObject, BunString* namespaceString, BunString* path, BunPluginTarget target) { return globalObject->onLoadPlugins.run(globalObject, namespaceString, path); } @@ -891,10 +891,10 @@ namespace Bun { Structure* createModuleMockStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { - return Zig::JSModuleMock::createStructure(vm, globalObject, prototype); + return Rust::JSModuleMock::createStructure(vm, globalObject, prototype); } -JSC::JSValue runVirtualModule(Zig::GlobalObject* globalObject, BunString* specifier, bool& wasModuleMock) +JSC::JSValue runVirtualModule(Rust::GlobalObject* globalObject, BunString* specifier, bool& wasModuleMock) { auto fallback = [&]() -> JSC::JSValue { return JSValue::decode(Bun__runVirtualModule(globalObject, specifier)); @@ -913,7 +913,7 @@ JSC::JSValue runVirtualModule(Zig::GlobalObject* globalObject, BunString* specif JSValue result; - if (Zig::JSModuleMock* moduleMock = dynamicDowncast(function)) { + if (Rust::JSModuleMock* moduleMock = dynamicDowncast(function)) { wasModuleMock = true; // module mock result = moduleMock->executeOnce(globalObject); @@ -956,7 +956,7 @@ JSC::JSValue runVirtualModule(Zig::GlobalObject* globalObject, BunString* specif BUN_DEFINE_HOST_FUNCTION(jsFunctionBunPluginClear, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - Zig::GlobalObject* global = static_cast(globalObject); + Rust::GlobalObject* global = static_cast(globalObject); global->onLoadPlugins.fileNamespace.clear(); global->onResolvePlugins.fileNamespace.clear(); global->onLoadPlugins.groups.clear(); diff --git a/src/jsc/bindings/BunPlugin.h b/src/jsc/bindings/BunPlugin.h index 45813832542..acaed983ee2 100644 --- a/src/jsc/bindings/BunPlugin.h +++ b/src/jsc/bindings/BunPlugin.h @@ -9,7 +9,7 @@ BUN_DECLARE_HOST_FUNCTION(jsFunctionBunPlugin); BUN_DECLARE_HOST_FUNCTION(jsFunctionBunPluginClear); -namespace Zig { +namespace Rust { using namespace JSC; @@ -101,9 +101,9 @@ class BunPlugin { class GlobalObject; -} // namespace Zig +} // namespace Rust namespace Bun { -JSC::JSValue runVirtualModule(Zig::GlobalObject*, BunString* specifier, bool& wasModuleMock); +JSC::JSValue runVirtualModule(Rust::GlobalObject*, BunString* specifier, bool& wasModuleMock); JSC::Structure* createModuleMockStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype); } diff --git a/src/jsc/bindings/BunProcess.cpp b/src/jsc/bindings/BunProcess.cpp index 6935f0cbbce..6f641fc67fd 100644 --- a/src/jsc/bindings/BunProcess.cpp +++ b/src/jsc/bindings/BunProcess.cpp @@ -29,7 +29,7 @@ #include "JavaScriptCore/PutPropertySlot.h" #include "ScriptExecutionContext.h" #include "headers-handwritten.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "FormatStackTraceForJS.h" #include "headers.h" #include "JSEnvironmentVariableMap.h" @@ -169,8 +169,8 @@ extern "C" bool Bun__ensureProcessIPCInitialized(JSGlobalObject*); extern "C" const char* Bun__githubURL; BUN_DECLARE_HOST_FUNCTION(Bun__Process__send); -extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global); -extern "C" void Process__emitErrorEvent(Zig::GlobalObject* global, EncodedJSValue value); +extern "C" void Process__emitDisconnectEvent(Rust::GlobalObject* global); +extern "C" void Process__emitErrorEvent(Rust::GlobalObject* global, EncodedJSValue value); extern "C" void Bun__suppressCrashOnProcessKillSelfIfDesired(); @@ -227,8 +227,8 @@ static JSValue constructVersions(VM& vm, JSObject* processObject) object->putDirect(vm, JSC::Identifier::fromString(vm, "picohttpparser"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_PICOHTTPPARSER)), 0); object->putDirect(vm, JSC::Identifier::fromString(vm, "uwebsockets"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_UWS)), 0); object->putDirect(vm, JSC::Identifier::fromString(vm, "webkit"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_WEBKIT)), 0); - // Zig version from CMake-generated header - object->putDirect(vm, JSC::Identifier::fromString(vm, "zig"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_ZIG)), 0); + // Rust version from CMake-generated header + object->putDirect(vm, JSC::Identifier::fromString(vm, "rust"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_RUST)), 0); // Use commit hash for zlib to match test expectations object->putDirect(vm, JSC::Identifier::fromString(vm, "zlib"_s), JSC::jsOwnedString(vm, ASCIILiteral::fromLiteralUnsafe(BUN_VERSION_ZLIB_HASH)), 0); @@ -389,7 +389,7 @@ extern "C" bool Bun__VM__allowAddons(void* vm); JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = static_cast(globalObject_); + Rust::GlobalObject* globalObject = static_cast(globalObject_); auto callCountAtStart = globalObject->napiModuleRegisterCallCount; auto scope = DECLARE_THROW_SCOPE(JSC::getVM(globalObject)); auto& vm = JSC::getVM(globalObject); @@ -451,7 +451,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, (JSC::JSGlobalObject * globalOb CString utf8; // Support embedded .node files - // See StandaloneModuleGraph.zig for what this "$bunfs" thing is + // See StandaloneModuleGraph.rust for what this "$bunfs" thing is #if OS(WINDOWS) #define StandaloneModuleGraph__base_path "B:/~BUN/"_s #else @@ -699,7 +699,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, (JSC::JSGlobalObject * globalOb #endif // TODO(@190n) look for node_register_module_vXYZ according to BuildOptions.reported_nodejs_version - // (bun/src/env.zig:36) and the table at https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json + // (bun/src/env.rust:36) and the table at https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json auto napi_register_module_v1 = reinterpret_cast(dlsym(handle, "napi_register_module_v1")); auto node_api_module_get_api_version_v1 = reinterpret_cast(dlsym(handle, "node_api_module_get_api_version_v1")); @@ -821,7 +821,7 @@ extern "C" double Bun__readOriginTimerStart(void*); extern "C" void Bun__VirtualMachine__exitDuringUncaughtException(void*); // https://github.com/nodejs/node/blob/1936160c31afc9780e4365de033789f39b7cbc0c/src/api/hooks.cc#L49 -extern "C" void Process__dispatchOnBeforeExit(Zig::GlobalObject* globalObject, uint8_t exitCode) +extern "C" void Process__dispatchOnBeforeExit(Rust::GlobalObject* globalObject, uint8_t exitCode) { if (!globalObject->hasProcessObject()) { return; @@ -840,7 +840,7 @@ extern "C" void Process__dispatchOnBeforeExit(Zig::GlobalObject* globalObject, u } } -extern "C" void Process__dispatchOnExit(Zig::GlobalObject* globalObject, uint8_t exitCode) +extern "C" void Process__dispatchOnExit(Rust::GlobalObject* globalObject, uint8_t exitCode) { if (!globalObject->hasProcessObject()) { return; @@ -863,16 +863,16 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExit, (JSC::JSGlobalObject * globalObje { auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobal = defaultGlobalObject(globalObject); - auto process = zigGlobal->processObject(); + auto* rustGlobal = defaultGlobalObject(globalObject); + auto process = rustGlobal->processObject(); auto code = callFrame->argument(0); setProcessExitCodeInner(globalObject, process, code); RETURN_IF_EXCEPTION(throwScope, {}); - auto exitCode = Bun__getExitCode(bunVM(zigGlobal)); - Process__dispatchOnExit(zigGlobal, exitCode); + auto exitCode = Bun__getExitCode(bunVM(rustGlobal)); + Process__dispatchOnExit(rustGlobal, exitCode); // process.reallyExit(exitCode); auto reallyExitVal = process->get(globalObject, Identifier::fromString(vm, "reallyExit"_s)); @@ -887,7 +887,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExit, (JSC::JSGlobalObject * globalObje JSC_DEFINE_HOST_FUNCTION(Process_setUncaughtExceptionCaptureCallback, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - auto* globalObject = static_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto arg0 = callFrame->argument(0); @@ -912,8 +912,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_setUncaughtExceptionCaptureCallback, (JSC::JSGl JSC_DEFINE_HOST_FUNCTION(Process_hasUncaughtExceptionCaptureCallback, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { - auto* zigGlobal = defaultGlobalObject(globalObject); - JSValue cb = zigGlobal->processObject()->getUncaughtExceptionCaptureCallback(); + auto* rustGlobal = defaultGlobalObject(globalObject); + JSValue cb = rustGlobal->processObject()->getUncaughtExceptionCaptureCallback(); if (cb.isEmpty() || !cb.isCell()) { return JSValue::encode(jsBoolean(false)); } @@ -925,7 +925,7 @@ extern "C" uint64_t Bun__readOriginTimer(void*); JSC_DEFINE_HOST_FUNCTION(Process_functionHRTime, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = static_cast(globalObject_); + Rust::GlobalObject* globalObject = static_cast(globalObject_); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -979,7 +979,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionHRTime, (JSC::JSGlobalObject * globalOb JSC_DEFINE_HOST_FUNCTION(Process_functionHRTimeBigInt, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = static_cast(globalObject_); + Rust::GlobalObject* globalObject = static_cast(globalObject_); return JSC::JSValue::encode(JSValue(JSC::JSBigInt::createFrom(globalObject, Bun__readOriginTimer(globalObject->bunVM())))); } @@ -992,7 +992,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionChdir, (JSC::JSGlobalObject * globalObj Bun::V::validateString(scope, globalObject, value, "directory"_s); RETURN_IF_EXCEPTION(scope, {}); - ZigString str = Zig::toZigString(value.toWTFString(globalObject)); + RustString str = Rust::toRustString(value.toWTFString(globalObject)); JSC::JSValue result = JSC::JSValue::decode(Bun__Process__setCwd(globalObject, &str)); RETURN_IF_EXCEPTION(scope, {}); @@ -1159,7 +1159,7 @@ bool isSignalName(WTF::String input) return signalNameToNumberMap->contains(input); } -extern "C" void Bun__onSignalForJS(int signalNumber, Zig::GlobalObject* globalObject) +extern "C" void Bun__onSignalForJS(int signalNumber, Rust::GlobalObject* globalObject) { Process* process = globalObject->processObject(); @@ -1193,7 +1193,7 @@ void signalHandler(uv_signal_t* signal, int signalNumber) // uv_signal_t callbacks fire on the uv_run thread (JS thread), but defer to avoid // re-entering JS from inside the libuv poll loop context->postTaskConcurrently([signalNumber](ScriptExecutionContext& context) { - Bun__onSignalForJS(signalNumber, uncheckedDowncast(context.jsGlobalObject())); + Bun__onSignalForJS(signalNumber, uncheckedDowncast(context.jsGlobalObject())); }); #else @@ -1204,9 +1204,9 @@ extern "C" void Bun__logUnhandledException(JSC::EncodedJSValue exception); extern "C" int Bun__handleUncaughtException(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSValue exception, int isRejection) { - if (!lexicalGlobalObject->inherits(Zig::GlobalObject::info())) + if (!lexicalGlobalObject->inherits(Rust::GlobalObject::info())) return false; - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto* process = globalObject->processObject(); auto& wrapped = process->wrapped(); auto& vm = JSC::getVM(globalObject); @@ -1323,9 +1323,9 @@ extern "C" void Bun__promises__emitUnhandledRejectionWarning(JSC::JSGlobalObject extern "C" int Bun__handleUnhandledRejection(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSValue reason, JSC::JSValue promise) { - if (!lexicalGlobalObject->inherits(Zig::GlobalObject::info())) + if (!lexicalGlobalObject->inherits(Rust::GlobalObject::info())) return false; - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto* process = globalObject->processObject(); auto eventType = Identifier::fromString(JSC::getVM(globalObject), "unhandledRejection"_s); @@ -1346,9 +1346,9 @@ extern "C" bool Bun__VM__allowRejectionHandledWarning(void* vm); extern "C" bool Bun__emitHandledPromiseEvent(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSValue promise) { auto scope = DECLARE_TOP_EXCEPTION_SCOPE(JSC::getVM(lexicalGlobalObject)); - if (!lexicalGlobalObject->inherits(Zig::GlobalObject::info())) + if (!lexicalGlobalObject->inherits(Rust::GlobalObject::info())) return false; - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto* process = globalObject->processObject(); auto eventType = Identifier::fromString(JSC::getVM(globalObject), "rejectionHandled"_s); @@ -1631,7 +1631,7 @@ static int persistStandardStream(int fd) JSC_DEFINE_HOST_FUNCTION(Process_functionExecve, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1761,7 +1761,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExecve, (JSGlobalObject * lexicalGlobal // featureful execve(2) (replace the current image rather than fork), and // POSIX_SPAWN_CLOEXEC_DEFAULT atomically closes every descriptor that // isn't explicitly inherited via file actions. This mirrors - // reloadProcess() in src/bun.zig. + // reloadProcess() in src/bun.rust. posix_spawnattr_t attrs; posix_spawn_file_actions_t actions; posix_spawnattr_init(&attrs); @@ -1851,7 +1851,7 @@ static bool isJSValueEqualToASCIILiteral(JSC::JSGlobalObject* globalObject, JSC: return view == literal; } -extern "C" void Bun__Process__emitWarning(Zig::GlobalObject* globalObject, EncodedJSValue warning, EncodedJSValue type, EncodedJSValue code, EncodedJSValue ctor) +extern "C" void Bun__Process__emitWarning(Rust::GlobalObject* globalObject, EncodedJSValue warning, EncodedJSValue type, EncodedJSValue code, EncodedJSValue ctor) { // ignoring return value -- emitWarning only ever returns undefined or throws (void)Process::emitWarning( @@ -1864,7 +1864,7 @@ extern "C" void Bun__Process__emitWarning(Zig::GlobalObject* globalObject, Encod JSValue Process::emitWarningErrorInstance(JSC::JSGlobalObject* lexicalGlobalObject, JSValue errorInstance) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); VM& vm = getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); auto* process = globalObject->processObject(); @@ -1895,7 +1895,7 @@ JSValue Process::emitWarningErrorInstance(JSC::JSGlobalObject* lexicalGlobalObje } JSValue Process::emitWarning(JSC::JSGlobalObject* lexicalGlobalObject, JSValue warning, JSValue type, JSValue code, JSValue ctor) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); VM& vm = getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSValue detail = jsUndefined(); @@ -1963,7 +1963,7 @@ JSValue Process::emitWarning(JSC::JSGlobalObject* lexicalGlobalObject, JSValue w if (ctor.toBoolean(globalObject)) { caller = ctor; } else { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto* process = globalObject->processObject(); caller = process->get(globalObject, Identifier::fromString(vm, String("emitWarning"_s))); RETURN_IF_EXCEPTION(scope, {}); @@ -1977,7 +1977,7 @@ JSValue Process::emitWarning(JSC::JSGlobalObject* lexicalGlobalObject, JSValue w JSC_DEFINE_HOST_FUNCTION(Process_emitWarning, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto warning = callFrame->argument(0); auto type = callFrame->argument(1); auto code = callFrame->argument(2); @@ -2046,7 +2046,7 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessConnected, (JSC::JSGlobalObject * lexicalGlob return false; } -static JSValue constructReportObjectComplete(VM& vm, Zig::GlobalObject* globalObject, const String& fileName) +static JSValue constructReportObjectComplete(VM& vm, Rust::GlobalObject* globalObject, const String& fileName) { auto scope = DECLARE_THROW_SCOPE(vm); #if !OS(WINDOWS) @@ -2424,7 +2424,7 @@ static JSValue constructReportObjectComplete(VM& vm, Zig::GlobalObject* globalOb } #else // OS(WINDOWS) // Forward declaration - implemented in BunProcessReportObjectWindows.cpp - JSValue constructReportObjectWindows(VM & vm, Zig::GlobalObject * globalObject, Process * process); + JSValue constructReportObjectWindows(VM & vm, Rust::GlobalObject * globalObject, Process * process); // Get the Process object - needed for accessing report settings Process* process = globalObject->processObject(); @@ -2437,7 +2437,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionGetReport, (JSGlobalObject * globalObje { auto& vm = JSC::getVM(globalObject); // TODO: node:vm - return JSValue::encode(constructReportObjectComplete(vm, uncheckedDowncast(globalObject), String())); + return JSValue::encode(constructReportObjectComplete(vm, uncheckedDowncast(globalObject), String())); } JSC_DEFINE_HOST_FUNCTION(Process_functionWriteReport, (JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) @@ -2451,7 +2451,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionWriteReport, (JSGlobalObject * globalOb static JSValue constructProcessReportObject(VM& vm, JSObject* processObject) { auto* globalObject = processObject->globalObject(); - // auto* globalObject = static_cast(lexicalGlobalObject); + // auto* globalObject = static_cast(lexicalGlobalObject); auto process = uncheckedDowncast(processObject); auto* report = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 10); @@ -2609,7 +2609,7 @@ static JSValue constructStdioWriteStream(JSC::JSGlobalObject* globalObject, JSC: auto result = JSC::profiledCall(globalObject, ProfilingReason::API, getStdioWriteStream, callData, globalObject->globalThis(), args); if (auto* exception = scope.exception()) { (void)scope.tryClearException(); - Zig::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); + Rust::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); return jsUndefined(); } @@ -2670,7 +2670,7 @@ static JSValue constructStdin(VM& vm, JSObject* processObject) auto result = JSC::profiledCall(globalObject, ProfilingReason::API, getStdinStream, callData, globalObject, args); if (auto* exception = scope.exception()) { (void)scope.tryClearException(); - Zig::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); + Rust::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); return jsUndefined(); } return result; @@ -2785,7 +2785,7 @@ static JSValue constructExecPath(VM& vm, JSObject* processObject) return JSValue::decode(Bun__Process__getExecPath(globalObject)); } -// get from zig +// get from rust extern "C" EncodedJSValue Bun__Process__getArgv(JSGlobalObject* lexicalGlobalObject) { auto* globalObject = defaultGlobalObject(lexicalGlobalObject); @@ -2925,7 +2925,7 @@ static JSValue constructRevision(VM& vm, JSObject* processObject) static JSValue constructEnv(VM& vm, JSObject* processObject) { - auto* globalObject = uncheckedDowncast(processObject->globalObject()); + auto* globalObject = uncheckedDowncast(processObject->globalObject()); return globalObject->processEnvObject(); } @@ -3166,12 +3166,12 @@ JSC_DEFINE_HOST_FUNCTION(Process_availableMemory, (JSGlobalObject * globalObject return JSValue::encode(JSValue {}); \ } -inline JSValue processBindingUtil(Zig::GlobalObject* globalObject, JSC::VM& vm) +inline JSValue processBindingUtil(Rust::GlobalObject* globalObject, JSC::VM& vm) { return globalObject->internalModuleRegistry()->requireId(globalObject, vm, InternalModuleRegistry::NodeUtilTypes); } -inline JSValue processBindingConfig(Zig::GlobalObject* globalObject, JSC::VM& vm) +inline JSValue processBindingConfig(Rust::GlobalObject* globalObject, JSC::VM& vm) { auto config = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 9); #ifdef BUN_DEBUG @@ -3202,7 +3202,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionBinding, (JSGlobalObject * jsGlobalObje { auto& vm = JSC::getVM(jsGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto globalObject = uncheckedDowncast(jsGlobalObject); + auto globalObject = uncheckedDowncast(jsGlobalObject); auto process = globalObject->processObject(); auto moduleName = callFrame->argument(0).toWTFString(globalObject); RETURN_IF_EXCEPTION(throwScope, {}); @@ -3253,10 +3253,10 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionReallyExit, (JSGlobalObject * globalObj RETURN_IF_EXCEPTION(throwScope, {}); } - auto* zigGlobal = defaultGlobalObject(globalObject); - Bun__Process__exit(zigGlobal, exitCode); + auto* rustGlobal = defaultGlobalObject(globalObject); + Bun__Process__exit(rustGlobal, exitCode); // Main-thread Bun__Process__exit is noreturn. In a worker it returns; the - // Zig WebWorker.exit() it called requests JSC termination (guarded so it's a + // Rust WebWorker.exit() it called requests JSC termination (guarded so it's a // no-op when re-entered from a process.on('exit') handler). throwScope.release(); return JSC::JSValue::encode(jsUndefined()); @@ -3351,9 +3351,9 @@ static Process* getProcessObject(JSC::JSGlobalObject* lexicalGlobalObject, JSVal // Handle "var memoryUsage = process.memoryUsage; memoryUsage()" if (!process) [[unlikely]] { // Handle calling this function from inside a node:vm - Zig::GlobalObject* zigGlobalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* rustGlobalObject = defaultGlobalObject(lexicalGlobalObject); - return zigGlobalObject->processObject(); + return rustGlobalObject->processObject(); } return process; @@ -3654,7 +3654,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionMemoryUsageRSS, (JSC::JSGlobalObject * JSC_DEFINE_HOST_FUNCTION(Process_functionOpenStdin, (JSGlobalObject * globalObject, CallFrame* callFrame)) { auto& vm = JSC::getVM(globalObject); - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto stdinValue = global->processObject()->getIfPropertyExists(globalObject, Identifier::fromString(vm, "stdin"_s)); @@ -3754,7 +3754,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_stubEmptyFunction, (JSGlobalObject * globalObje JSC_DEFINE_HOST_FUNCTION(Process_setSourceMapsEnabled, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3870,7 +3870,7 @@ void Process::queueNextTick(JSC::JSGlobalObject* globalObject, JSValue func, con this->queueNextTick(globalObject, argsBuffer); } -void Process::emitOnNextTick(Zig::GlobalObject* globalObject, ASCIILiteral eventName, JSValue event) +void Process::emitOnNextTick(Rust::GlobalObject* globalObject, ASCIILiteral eventName, JSValue event) { auto& vm = getVM(globalObject); auto* function = m_emitHelperFunction.getInitializedOnMainThread(this); @@ -3911,7 +3911,7 @@ static JSValue constructMainModuleProperty(VM& vm, JSObject* processObject) return mainModule; } -JSValue Process::constructNextTickFn(JSC::VM& vm, Zig::GlobalObject* globalObject) +JSValue Process::constructNextTickFn(JSC::VM& vm, Rust::GlobalObject* globalObject) { JSNextTickQueue* nextTickQueueObject; if (!globalObject->m_nextTickQueue) { @@ -3940,7 +3940,7 @@ JSValue Process::constructNextTickFn(JSC::VM& vm, Zig::GlobalObject* globalObjec static JSValue constructProcessNextTickFn(VM& vm, JSObject* processObject) { JSGlobalObject* lexicalGlobalObject = processObject->globalObject(); - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); return uncheckedDowncast(processObject)->constructNextTickFn(JSC::getVM(globalObject), globalObject); } @@ -4156,7 +4156,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionKill, (JSC::JSGlobalObject * globalObje return Bun::ERR::INVALID_ARG_TYPE(scope, globalObject, "signal"_s, "string or number"_s, signalValue); } - auto global = uncheckedDowncast(globalObject); + auto global = uncheckedDowncast(globalObject); auto& vm = JSC::getVM(global); JSValue _killFn = global->processObject()->get(globalObject, Identifier::fromString(vm, "_kill"_s)); RETURN_IF_EXCEPTION(scope, {}); @@ -4185,8 +4185,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionKill, (JSC::JSGlobalObject * globalObje JSC_DEFINE_HOST_FUNCTION(Process_functionLoadBuiltinModule, (JSGlobalObject * globalObject, CallFrame* callFrame)) { - auto* zigGlobalObject = uncheckedDowncast(globalObject); - VM& vm = zigGlobalObject->vm(); + auto* rustGlobalObject = uncheckedDowncast(globalObject); + VM& vm = rustGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSValue id = callFrame->argument(0); @@ -4194,11 +4194,11 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionLoadBuiltinModule, (JSGlobalObject * gl return Bun::ERR::INVALID_ARG_TYPE(scope, globalObject, "moduleName"_s, "string"_s, id); } - String idWtfStr = id.toWTFString(zigGlobalObject); + String idWtfStr = id.toWTFString(rustGlobalObject); RETURN_IF_EXCEPTION(scope, {}); BunString idStr = Bun::toString(idWtfStr); - JSValue fetchResult = Bun::resolveAndFetchBuiltinModule(zigGlobalObject, &idStr); + JSValue fetchResult = Bun::resolveAndFetchBuiltinModule(rustGlobalObject, &idStr); if (fetchResult) { RELEASE_AND_RETURN(scope, JSC::JSValue::encode(fetchResult)); } @@ -4209,8 +4209,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionLoadBuiltinModule, (JSGlobalObject * gl JSC_DEFINE_HOST_FUNCTION(Process_functionEmitHelper, (JSGlobalObject * globalObject, CallFrame* callFrame)) { auto& vm = JSC::getVM(globalObject); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - auto* process = zigGlobalObject->processObject(); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + auto* process = rustGlobalObject->processObject(); auto scope = DECLARE_THROW_SCOPE(vm); auto emit = process->get(globalObject, Identifier::fromString(vm, "emit"_s)); RETURN_IF_EXCEPTION(scope, {}); @@ -4224,7 +4224,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionEmitHelper, (JSGlobalObject * globalObj return JSValue::encode(ret); } -extern "C" void Process__emitMessageEvent(Zig::GlobalObject* global, EncodedJSValue value, EncodedJSValue handle) +extern "C" void Process__emitMessageEvent(Rust::GlobalObject* global, EncodedJSValue value, EncodedJSValue handle) { auto* process = global->processObject(); auto& vm = JSC::getVM(global); @@ -4238,7 +4238,7 @@ extern "C" void Process__emitMessageEvent(Zig::GlobalObject* global, EncodedJSVa } } -extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global) +extern "C" void Process__emitDisconnectEvent(Rust::GlobalObject* global) { auto* process = global->processObject(); auto& vm = JSC::getVM(global); @@ -4249,7 +4249,7 @@ extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global) } } -extern "C" void Process__emitErrorEvent(Zig::GlobalObject* global, EncodedJSValue value) +extern "C" void Process__emitErrorEvent(Rust::GlobalObject* global, EncodedJSValue value) { auto* process = global->processObject(); auto& vm = JSC::getVM(global); diff --git a/src/jsc/bindings/BunProcess.h b/src/jsc/bindings/BunProcess.h index 02b049ebf1e..38f8a4197d9 100644 --- a/src/jsc/bindings/BunProcess.h +++ b/src/jsc/bindings/BunProcess.h @@ -6,7 +6,7 @@ #include "BunClientData.h" #include "JSEventEmitter.h" -namespace Zig { +namespace Rust { class GlobalObject; } @@ -54,7 +54,7 @@ class Process : public WebCore::JSEventEmitter { static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; - JSValue constructNextTickFn(JSC::VM& vm, Zig::GlobalObject* globalObject); + JSValue constructNextTickFn(JSC::VM& vm, Rust::GlobalObject* globalObject); void queueNextTick(JSC::JSGlobalObject* globalObject, const ArgList& args); void queueNextTick(JSC::JSGlobalObject* globalObject, JSValue); void queueNextTick(JSC::JSGlobalObject* globalObject, JSValue, JSValue); @@ -64,7 +64,7 @@ class Process : public WebCore::JSEventEmitter { // Some Node.js events want to be emitted on the next tick rather than synchronously. // This is equivalent to `process.nextTick(() => process.emit(eventName, event))` from JavaScript. - void emitOnNextTick(Zig::GlobalObject* globalObject, ASCIILiteral eventName, JSValue event); + void emitOnNextTick(Rust::GlobalObject* globalObject, ASCIILiteral eventName, JSValue event); static JSValue emitWarningErrorInstance(JSC::JSGlobalObject* lexicalGlobalObject, JSValue errorInstance); static JSValue emitWarning(JSC::JSGlobalObject* lexicalGlobalObject, JSValue warning, JSValue type, JSValue code, JSValue ctor); diff --git a/src/jsc/bindings/BunProcessReportObjectWindows.cpp b/src/jsc/bindings/BunProcessReportObjectWindows.cpp index 48e24d14b64..297363ef9ae 100644 --- a/src/jsc/bindings/BunProcessReportObjectWindows.cpp +++ b/src/jsc/bindings/BunProcessReportObjectWindows.cpp @@ -3,7 +3,7 @@ #if OS(WINDOWS) #include "BunProcess.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "FormatStackTraceForJS.h" #include "headers.h" // For Bun__Process__createExecArgv and other exports #include "JavaScriptCore/JSCJSValue.h" @@ -38,7 +38,7 @@ using namespace JSC; // External functions extern "C" EncodedJSValue Bun__Process__createExecArgv(JSGlobalObject*); -JSValue constructReportObjectWindows(VM& vm, Zig::GlobalObject* globalObject, Process* process) +JSValue constructReportObjectWindows(VM& vm, Rust::GlobalObject* globalObject, Process* process) { auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/BunSecureContextCache.cpp b/src/jsc/bindings/BunSecureContextCache.cpp index c9004f3b4c3..b6a231bac26 100644 --- a/src/jsc/bindings/BunSecureContextCache.cpp +++ b/src/jsc/bindings/BunSecureContextCache.cpp @@ -1,15 +1,15 @@ #include "root.h" #include "BunSecureContextCache.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include using namespace JSC; -// Called from Zig (`SecureContext.intern`). Returns the cached JSSecureContext +// Called from Rust (`SecureContext.intern`). Returns the cached JSSecureContext // for `key` (low 64 bits of the config digest) or jsEmpty() if none / GC'd. -// The full 32-byte digest lives on the Zig SecureContext, so the caller does +// The full 32-byte digest lives on the Rust SecureContext, so the caller does // a content-equality check on hit to handle the (~2⁻⁶⁴) key-collision case. -extern "C" JSC::EncodedJSValue Bun__SecureContextCache__get(Zig::GlobalObject* global, uint64_t key) +extern "C" JSC::EncodedJSValue Bun__SecureContextCache__get(Rust::GlobalObject* global, uint64_t key) { auto& slot = global->m_secureContextCache; if (!slot) return JSValue::encode(JSValue()); @@ -17,7 +17,7 @@ extern "C" JSC::EncodedJSValue Bun__SecureContextCache__get(Zig::GlobalObject* g return JSValue::encode(obj ? JSValue(obj) : JSValue()); } -extern "C" void Bun__SecureContextCache__set(Zig::GlobalObject* global, uint64_t key, JSC::EncodedJSValue value) +extern "C" void Bun__SecureContextCache__set(Rust::GlobalObject* global, uint64_t key, JSC::EncodedJSValue value) { auto& slot = global->m_secureContextCache; if (!slot) slot = makeUnique(global->vm()); diff --git a/src/jsc/bindings/BunSecureContextCache.h b/src/jsc/bindings/BunSecureContextCache.h index 33aa6d2773f..843a276aceb 100644 --- a/src/jsc/bindings/BunSecureContextCache.h +++ b/src/jsc/bindings/BunSecureContextCache.h @@ -1,12 +1,12 @@ #pragma once -// Thin wrapper around `WeakGCMap` so ZigGlobalObject.h +// Thin wrapper around `WeakGCMap` so RustGlobalObject.h // can hold a `std::unique_ptr` without pulling in // WeakGCMap.h (this header is included from one .cpp file only). // // Backs the JS-side dedup of `tls.createSecureContext()`: same config digest // → same `JSSecureContext` cell while it's alive. The native `SSL_CTX*` cache -// (Zig `SSLContextCache`) is independent — BoringSSL's refcount is the single +// (Rust `SSLContextCache`) is independent — BoringSSL's refcount is the single // source of truth, so the two never need to coordinate. #include "root.h" diff --git a/src/jsc/bindings/BunString.cpp b/src/jsc/bindings/BunString.cpp index f458216bbb1..4bc51f36eaa 100644 --- a/src/jsc/bindings/BunString.cpp +++ b/src/jsc/bindings/BunString.cpp @@ -12,7 +12,7 @@ #include "wtf/SIMDUTF.h" #include "JSDOMURL.h" #include "DOMURL.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "IDLTypes.h" #include "mimalloc.h" @@ -45,41 +45,41 @@ using namespace JSC; extern "C" BunString BunString__fromBytes(const char* bytes, size_t length); -extern "C" [[ZIG_EXPORT(nothrow)]] bool Bun__WTFStringImpl__hasPrefix(const WTF::StringImpl* impl, const char* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] bool Bun__WTFStringImpl__hasPrefix(const WTF::StringImpl* impl, const char* bytes, size_t length) { return impl->startsWith({ bytes, length }); } -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__WTFStringImpl__deref(WTF::StringImpl* impl) +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__WTFStringImpl__deref(WTF::StringImpl* impl) { impl->deref(); } -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__WTFStringImpl__ref(WTF::StringImpl* impl) +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__WTFStringImpl__ref(WTF::StringImpl* impl) { impl->ref(); } // Cold path for the Rust-side inlined `deref()`: caller has already brought // the refcount to zero via `fetch_sub`, so this is destroy-only. -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__WTFStringImpl__destroy(WTF::StringImpl* impl) +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__WTFStringImpl__destroy(WTF::StringImpl* impl) { WTF::StringImpl::destroy(impl); } -extern "C" [[ZIG_EXPORT(nothrow)]] bool BunString__fromJS(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue, BunString* bunString) +extern "C" [[RUST_EXPORT(nothrow)]] bool BunString__fromJS(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue, BunString* bunString) { JSC::JSValue value = JSC::JSValue::decode(encodedValue); *bunString = Bun::toString(globalObject, value); return bunString->tag != BunStringTag::Dead; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__createAtom(const char* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__createAtom(const char* bytes, size_t length) { ASSERT(simdutf::validate_ascii(bytes, length)); auto atom = tryMakeAtomString(String(StringImpl::createWithoutCopying({ bytes, length }))); return { BunStringTag::WTFStringImpl, { .wtf = atom.releaseImpl().leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__tryCreateAtom(const char* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__tryCreateAtom(const char* bytes, size_t length) { if (simdutf::validate_ascii(bytes, length)) { auto atom = tryMakeAtomString(String(StringImpl::createWithoutCopying({ bytes, length }))); @@ -91,7 +91,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__tryCreateAtom(const char return { BunStringTag::Dead, {} }; } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__createUTF8ForJS(JSC::JSGlobalObject* globalObject, const char* ptr, size_t length) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__createUTF8ForJS(JSC::JSGlobalObject* globalObject, const char* ptr, size_t length) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -112,7 +112,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__createUT return JSValue::encode(jsString(vm, WTF::move(str))); } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__transferToJS(BunString* bunString, JSC::JSGlobalObject* globalObject) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__transferToJS(BunString* bunString, JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); @@ -146,7 +146,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__transfer } // int64_t max to say "not a number" -extern "C" [[ZIG_EXPORT(nothrow)]] int64_t BunString__toInt32(const BunString* bunString) +extern "C" [[RUST_EXPORT(nothrow)]] int64_t BunString__toInt32(const BunString* bunString) { if (bunString->tag == BunStringTag::Empty || bunString->tag == BunStringTag::Dead) { return std::numeric_limits::max(); @@ -183,12 +183,12 @@ JSC::JSString* toJS(JSC::JSGlobalObject* globalObject, BunString bunString) return JSC::jsString(globalObject->vm(), String(bunString.impl.wtf)); } - if (bunString.tag == BunStringTag::StaticZigString) { - return JSC::jsString(globalObject->vm(), Zig::toStringStatic(bunString.impl.zig)); + if (bunString.tag == BunStringTag::StaticRustString) { + return JSC::jsString(globalObject->vm(), Rust::toStringStatic(bunString.impl.rust)); } - if (bunString.tag == BunStringTag::ZigString) { - return Zig::toJSStringGC(bunString.impl.zig, globalObject); + if (bunString.tag == BunStringTag::RustString) { + return Rust::toJSStringGC(bunString.impl.rust, globalObject); } UNREACHABLE(); @@ -214,7 +214,7 @@ BunString fromJS(JSC::JSGlobalObject* globalObject, JSValue value) return { BunStringTag::WTFStringImpl, { .wtf = impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] void BunString__toThreadSafe(BunString* str) +extern "C" [[RUST_EXPORT(nothrow)]] void BunString__toThreadSafe(BunString* str) { if (str->tag == BunStringTag::WTFStringImpl) { auto* existing = str->impl.wtf; @@ -302,8 +302,8 @@ BunString toStringRef(WTF::StringImpl* wtfString) BunString toStringView(StringView view) { return { - BunStringTag::ZigString, - { .zig = toZigString(view) } + BunStringTag::RustString, + { .rust = toRustString(view) } }; } @@ -374,7 +374,7 @@ WTF::String toCrossThreadShareable(const WTF::String& string) } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__toJS(JSC::JSGlobalObject* globalObject, const BunString* bunString) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__toJS(JSC::JSGlobalObject* globalObject, const BunString* bunString) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -386,7 +386,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__toJS(JSC return JSValue::encode(result); } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16Unitialized(size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromUTF16Unitialized(size_t length) { ASSERT(length > 0); std::span ptr; @@ -397,7 +397,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16Unitialized(siz return { BunStringTag::WTFStringImpl, { .wtf = impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromLatin1Unitialized(size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromLatin1Unitialized(size_t length) { ASSERT(length > 0); std::span ptr; @@ -430,7 +430,7 @@ extern "C" BunString BunString__fromUTF8(const char* bytes, size_t length) return Bun::toString(impl.leakRef()); } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromLatin1(const char* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromLatin1(const char* bytes, size_t length) { ASSERT(length > 0); std::span ptr; @@ -443,7 +443,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromLatin1(const char* b return { BunStringTag::WTFStringImpl, { .wtf = impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16ToLatin1(const char16_t* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromUTF16ToLatin1(const char16_t* bytes, size_t length) { ASSERT(length > 0); ASSERT_WITH_MESSAGE(simdutf::validate_utf16le(bytes, length), "This function only accepts ascii UTF16 strings"); @@ -459,7 +459,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16ToLatin1(const return { BunStringTag::WTFStringImpl, { .wtf = impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16(const char16_t* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromUTF16(const char16_t* bytes, size_t length) { ASSERT(length > 0); std::span ptr; @@ -471,7 +471,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromUTF16(const char16_t return { BunStringTag::WTFStringImpl, { .wtf = impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] BunString BunString__fromBytes(const char* bytes, size_t length) +extern "C" [[RUST_EXPORT(nothrow)]] BunString BunString__fromBytes(const char* bytes, size_t length) { ASSERT(length > 0); if (simdutf::validate_ascii(bytes, length)) { @@ -499,7 +499,7 @@ extern "C" BunString BunString__createExternal(const char* bytes, size_t length, return { BunStringTag::WTFStringImpl, { .wtf = &impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__toJSON( +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__toJSON( JSC::JSGlobalObject* globalObject, BunString* bunString) { @@ -540,18 +540,18 @@ extern "C" JSC::EncodedJSValue BunString__createArray( return JSValue::encode(array); } -extern "C" [[ZIG_EXPORT(nothrow)]] void BunString__toWTFString(BunString* bunString) +extern "C" [[RUST_EXPORT(nothrow)]] void BunString__toWTFString(BunString* bunString) { WTF::String str; - if (bunString->tag == BunStringTag::ZigString) { - if (Zig::isTaggedExternalPtr(bunString->impl.zig.ptr)) { - str = Zig::toString(bunString->impl.zig); + if (bunString->tag == BunStringTag::RustString) { + if (Rust::isTaggedExternalPtr(bunString->impl.rust.ptr)) { + str = Rust::toString(bunString->impl.rust); } else { - str = Zig::toStringCopy(bunString->impl.zig); + str = Rust::toStringCopy(bunString->impl.rust); } - } else if (bunString->tag == BunStringTag::StaticZigString) { - str = Zig::toStringStatic(bunString->impl.zig); + } else if (bunString->tag == BunStringTag::StaticRustString) { + str = Rust::toStringStatic(bunString->impl.rust); } else { return; } @@ -579,7 +579,7 @@ extern "C" size_t URL__originLength(const char* latin1_slice, size_t len) extern "C" JSC::EncodedJSValue BunString__toJSDOMURL(JSC::JSGlobalObject* lexicalGlobalObject, BunString* bunString) { - auto& globalObject = *uncheckedDowncast(lexicalGlobalObject); + auto& globalObject = *uncheckedDowncast(lexicalGlobalObject); auto& vm = globalObject.vm(); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -770,14 +770,14 @@ size_t BunString::utf8ByteLength(const WTF::String& str) WTF::String BunString::toWTFString() const { - if (this->tag == BunStringTag::ZigString) { - if (Zig::isTaggedExternalPtr(this->impl.zig.ptr)) { - return Zig::toString(this->impl.zig); + if (this->tag == BunStringTag::RustString) { + if (Rust::isTaggedExternalPtr(this->impl.rust.ptr)) { + return Rust::toString(this->impl.rust); } else { - return Zig::toStringCopy(this->impl.zig); + return Rust::toStringCopy(this->impl.rust); } - } else if (this->tag == BunStringTag::StaticZigString) { - return Zig::toStringCopy(this->impl.zig); + } else if (this->tag == BunStringTag::StaticRustString) { + return Rust::toStringCopy(this->impl.rust); } else if (this->tag == BunStringTag::WTFStringImpl) { return WTF::String(this->impl.wtf); } @@ -792,8 +792,8 @@ void BunString::appendToBuilder(WTF::StringBuilder& builder) const return; } - if (this->tag == BunStringTag::ZigString || this->tag == BunStringTag::StaticZigString) { - Zig::appendToBuilder(this->impl.zig, builder); + if (this->tag == BunStringTag::RustString || this->tag == BunStringTag::StaticRustString) { + Rust::appendToBuilder(this->impl.rust, builder); return; } @@ -802,14 +802,14 @@ void BunString::appendToBuilder(WTF::StringBuilder& builder) const WTF::String BunString::toWTFString(ZeroCopyTag) const { - if (this->tag == BunStringTag::ZigString) { - if (Zig::isTaggedUTF8Ptr(this->impl.zig.ptr)) { - return Zig::toStringCopy(this->impl.zig); + if (this->tag == BunStringTag::RustString) { + if (Rust::isTaggedUTF8Ptr(this->impl.rust.ptr)) { + return Rust::toStringCopy(this->impl.rust); } else { - return Zig::toString(this->impl.zig); + return Rust::toString(this->impl.rust); } - } else if (this->tag == BunStringTag::StaticZigString) { - return Zig::toStringStatic(this->impl.zig); + } else if (this->tag == BunStringTag::StaticRustString) { + return Rust::toStringStatic(this->impl.rust); } else if (this->tag == BunStringTag::WTFStringImpl) { ASSERT(this->impl.wtf->refCount() > 0 && !this->impl.wtf->isEmpty()); return WTF::String(this->impl.wtf); @@ -831,26 +831,26 @@ WTF::String BunString::toWTFString(NonNullTag) const WTF::String BunString::transferToWTFString() { - if (this->tag == BunStringTag::ZigString) { - if (Zig::isTaggedUTF8Ptr(this->impl.zig.ptr)) { - auto str = Zig::toStringCopy(this->impl.zig); - *this = Zig::BunStringEmpty; + if (this->tag == BunStringTag::RustString) { + if (Rust::isTaggedUTF8Ptr(this->impl.rust.ptr)) { + auto str = Rust::toStringCopy(this->impl.rust); + *this = Rust::BunStringEmpty; return str; } else { - auto str = Zig::toString(this->impl.zig); - *this = Zig::BunStringEmpty; + auto str = Rust::toString(this->impl.rust); + *this = Rust::BunStringEmpty; return str; } - } else if (this->tag == BunStringTag::StaticZigString) { - auto str = Zig::toStringStatic(this->impl.zig); - *this = Zig::BunStringEmpty; + } else if (this->tag == BunStringTag::StaticRustString) { + auto str = Rust::toStringStatic(this->impl.rust); + *this = Rust::BunStringEmpty; return str; } else if (this->tag == BunStringTag::WTFStringImpl) { ASSERT(this->impl.wtf->refCount() > 0 && !this->impl.wtf->isEmpty()); auto str = WTF::String(this->impl.wtf); this->impl.wtf->deref(); - *this = Zig::BunStringEmpty; + *this = Rust::BunStringEmpty; return str; } @@ -879,7 +879,7 @@ extern "C" BunString BunString__createExternalGloballyAllocatedUTF16( return { BunStringTag::WTFStringImpl, { .wtf = &impl.leakRef() } }; } -extern "C" [[ZIG_EXPORT(nothrow)]] bool WTFStringImpl__isThreadSafe( +extern "C" [[RUST_EXPORT(nothrow)]] bool WTFStringImpl__isThreadSafe( const WTF::StringImpl* wtf) { if (wtf->isSymbol()) @@ -893,7 +893,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool WTFStringImpl__isThreadSafe( return true; } -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__WTFStringImpl__ensureHash(WTF::StringImpl* str) +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__WTFStringImpl__ensureHash(WTF::StringImpl* str) { str->hash(); } @@ -959,9 +959,9 @@ bool BunString::isEmpty() const switch (this->tag) { case BunStringTag::WTFStringImpl: return impl.wtf->isEmpty(); - case BunStringTag::ZigString: - case BunStringTag::StaticZigString: - return impl.zig.len == 0; + case BunStringTag::RustString: + case BunStringTag::StaticRustString: + return impl.rust.len == 0; default: return true; } diff --git a/src/jsc/bindings/BundlerMetafile.cpp b/src/jsc/bindings/BundlerMetafile.cpp index c21e641a366..6da7e89a077 100644 --- a/src/jsc/bindings/BundlerMetafile.cpp +++ b/src/jsc/bindings/BundlerMetafile.cpp @@ -8,7 +8,7 @@ #include "root.h" #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include diff --git a/src/jsc/bindings/CallSite.cpp b/src/jsc/bindings/CallSite.cpp index ffaaa5323cb..c924129fb0f 100644 --- a/src/jsc/bindings/CallSite.cpp +++ b/src/jsc/bindings/CallSite.cpp @@ -16,7 +16,7 @@ using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { const JSC::ClassInfo CallSite::s_info = { "CallSite"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(CallSite) }; @@ -97,7 +97,7 @@ JSC_DEFINE_HOST_FUNCTION(nativeFrameForTesting, (JSC::JSGlobalObject * globalObj return JSValue::encode(JSC::call(globalObject, function, JSC::ArgList(), "nativeFrameForTesting"_s)); } -JSValue createNativeFrameForTesting(Zig::GlobalObject* globalObject) +JSValue createNativeFrameForTesting(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); diff --git a/src/jsc/bindings/CallSite.h b/src/jsc/bindings/CallSite.h index 4d63a3b167b..6214726469b 100644 --- a/src/jsc/bindings/CallSite.h +++ b/src/jsc/bindings/CallSite.h @@ -14,7 +14,7 @@ using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { class JSCStackFrame; @@ -102,5 +102,5 @@ class CallSite final : public JSC::JSNonFinalObject { DECLARE_VISIT_CHILDREN; }; -JSValue createNativeFrameForTesting(Zig::GlobalObject* globalObject); +JSValue createNativeFrameForTesting(Rust::GlobalObject* globalObject); } diff --git a/src/jsc/bindings/CallSitePrototype.cpp b/src/jsc/bindings/CallSitePrototype.cpp index 5a537ecccb6..aac94b611a6 100644 --- a/src/jsc/bindings/CallSitePrototype.cpp +++ b/src/jsc/bindings/CallSitePrototype.cpp @@ -17,7 +17,7 @@ #include using namespace JSC; -namespace Zig { +namespace Rust { JSC_DECLARE_HOST_FUNCTION(callSiteProtoFuncGetThis); JSC_DECLARE_HOST_FUNCTION(callSiteProtoFuncGetTypeName); diff --git a/src/jsc/bindings/CallSitePrototype.h b/src/jsc/bindings/CallSitePrototype.h index 50307639908..85fea63150f 100644 --- a/src/jsc/bindings/CallSitePrototype.h +++ b/src/jsc/bindings/CallSitePrototype.h @@ -9,7 +9,7 @@ using namespace JSC; -namespace Zig { +namespace Rust { class CallSitePrototype final : public JSC::JSNonFinalObject { public: diff --git a/src/jsc/bindings/CodeCoverage.cpp b/src/jsc/bindings/CodeCoverage.cpp index 51ea142f9e4..9ea2a7f7eff 100644 --- a/src/jsc/bindings/CodeCoverage.cpp +++ b/src/jsc/bindings/CodeCoverage.cpp @@ -1,5 +1,5 @@ #include "root.h" -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" #include using namespace JSC; diff --git a/src/jsc/bindings/ConsoleObject.h b/src/jsc/bindings/ConsoleObject.h index 52032f44c36..1ffc2b2bddf 100644 --- a/src/jsc/bindings/ConsoleObject.h +++ b/src/jsc/bindings/ConsoleObject.h @@ -69,4 +69,4 @@ class ConsoleObject final : public JSC::ConsoleClient { bool m_profileRestoreBreakpointActiveValue { false }; }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/DOMFormData.cpp b/src/jsc/bindings/DOMFormData.cpp index e866c2704eb..d2c2b6ad869 100644 --- a/src/jsc/bindings/DOMFormData.cpp +++ b/src/jsc/bindings/DOMFormData.cpp @@ -69,15 +69,15 @@ String DOMFormData::toURLEncodedString() return WTF::URLParser::serialize(form); } -extern "C" void DOMFormData__forEach(DOMFormData* form, void* context, void (*callback)(void* context, ZigString*, void*, ZigString*, uint8_t)) +extern "C" void DOMFormData__forEach(DOMFormData* form, void* context, void (*callback)(void* context, RustString*, void*, RustString*, uint8_t)) { for (auto& item : form->items()) { - auto name = toZigString(item.name); + auto name = toRustString(item.name); if (auto value = std::get_if(&item.data)) { - auto value_ = toZigString(*value); + auto value_ = toRustString(*value); callback(context, &name, &value_, nullptr, 0); } else if (auto value = std::get_if>(&item.data)) { - auto filename = toZigString(value->get()->fileName()); + auto filename = toRustString(value->get()->fileName()); callback(context, &name, value->get()->impl(), &filename, 1); } } diff --git a/src/jsc/bindings/DOMWrapperWorld.cpp b/src/jsc/bindings/DOMWrapperWorld.cpp index b09b35e849a..2a662a124be 100644 --- a/src/jsc/bindings/DOMWrapperWorld.cpp +++ b/src/jsc/bindings/DOMWrapperWorld.cpp @@ -25,7 +25,7 @@ // #include "JSDOMWindow.h" #include "WebCoreJSClientData.h" // #include "WindowProxy.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include namespace WebCore { diff --git a/src/jsc/bindings/DOMWrapperWorld.h b/src/jsc/bindings/DOMWrapperWorld.h index a619c28e200..00b8cdd6297 100644 --- a/src/jsc/bindings/DOMWrapperWorld.h +++ b/src/jsc/bindings/DOMWrapperWorld.h @@ -23,7 +23,7 @@ #include "root.h" #include "DOMWrapperWorld-class.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace WebCore { @@ -50,10 +50,10 @@ inline bool isWorldCompatible(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSV inline DOMWrapperWorld& currentWorld(JSC::JSGlobalObject& lexicalGlobalObject) { - return uncheckedDowncast(&lexicalGlobalObject)->world(); + return uncheckedDowncast(&lexicalGlobalObject)->world(); } inline DOMWrapperWorld& worldForDOMObject(JSC::JSObject& object) { - return uncheckedDowncast(object.globalObject())->world(); + return uncheckedDowncast(object.globalObject())->world(); }; } diff --git a/src/jsc/bindings/DoubleFormatter.cpp b/src/jsc/bindings/DoubleFormatter.cpp index a0e096d859b..d11035ea7b0 100644 --- a/src/jsc/bindings/DoubleFormatter.cpp +++ b/src/jsc/bindings/DoubleFormatter.cpp @@ -8,7 +8,7 @@ using namespace WTF; /// Must be called with a buffer of exactly 124 /// Find the length by scanning for the 0 -extern "C" [[ZIG_EXPORT(nothrow)]] size_t WTF__dtoa(char* buf_124_bytes, double number) +extern "C" [[RUST_EXPORT(nothrow)]] size_t WTF__dtoa(char* buf_124_bytes, double number) { NumberToStringBuffer& buf = *reinterpret_cast(buf_124_bytes); return WTF::numberToStringAndSize(number, buf).size(); @@ -17,7 +17,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] size_t WTF__dtoa(char* buf_124_bytes, double /// This is the equivalent of the unary '+' operator on a JS string /// See https://262.ecma-international.org/14.0/#sec-stringtonumber /// Grammar: https://262.ecma-international.org/14.0/#prod-StringNumericLiteral -extern "C" [[ZIG_EXPORT(nothrow)]] double JSC__jsToNumber(const char* latin1_ptr, size_t len) +extern "C" [[RUST_EXPORT(nothrow)]] double JSC__jsToNumber(const char* latin1_ptr, size_t len) { return JSC::jsToNumber(WTF::StringView(latin1_ptr, len, true)); } diff --git a/src/jsc/bindings/ErrorCode.cpp b/src/jsc/bindings/ErrorCode.cpp index 346094c3d76..f5b32ac682d 100644 --- a/src/jsc/bindings/ErrorCode.cpp +++ b/src/jsc/bindings/ErrorCode.cpp @@ -1,7 +1,7 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "DOMException.h" #include "JavaScriptCore/Error.h" #include "JavaScriptCore/ErrorType.h" @@ -183,7 +183,7 @@ void ErrorCodeCache::finishCreation(VM& vm) } } -static ErrorCodeCache* errorCache(Zig::GlobalObject* globalObject) +static ErrorCodeCache* errorCache(Rust::GlobalObject* globalObject) { return static_cast(globalObject->nodeErrorCache()); } @@ -195,7 +195,7 @@ static Structure* createErrorStructure(JSC::VM& vm, JSGlobalObject* globalObject return ErrorInstance::createStructure(vm, globalObject, prototype); } -JSObject* ErrorCodeCache::createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options) +JSObject* ErrorCodeCache::createError(VM& vm, Rust::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options) { auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm); auto* cache = errorCache(globalObject); @@ -217,12 +217,12 @@ JSObject* ErrorCodeCache::createError(VM& vm, Zig::GlobalObject* globalObject, E return created_error; } -JSObject* createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, const String& message) +JSObject* createError(VM& vm, Rust::GlobalObject* globalObject, ErrorCode code, const String& message) { return errorCache(globalObject)->createError(vm, globalObject, code, jsString(vm, message), jsUndefined()); } -JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, const String& message) +JSObject* createError(Rust::GlobalObject* globalObject, ErrorCode code, const String& message) { return createError(globalObject->vm(), globalObject, code, message); } @@ -234,14 +234,14 @@ JSObject* createError(VM& vm, JSC::JSGlobalObject* globalObject, ErrorCode code, JSObject* createError(VM& vm, JSC::JSGlobalObject* globalObject, ErrorCode code, JSValue message) { - if (auto* zigGlobalObject = dynamicDowncast(globalObject)) - return createError(vm, zigGlobalObject, code, message, jsUndefined()); + if (auto* rustGlobalObject = dynamicDowncast(globalObject)) + return createError(vm, rustGlobalObject, code, message, jsUndefined()); auto* structure = createErrorStructure(vm, globalObject, errors[static_cast(code)].type, errors[static_cast(code)].name, errors[static_cast(code)].code); return JSC::ErrorInstance::create(globalObject, structure, message, jsUndefined(), nullptr, JSC::RuntimeType::TypeNothing, errors[static_cast(code)].type, true); } -JSC::JSObject* createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options) +JSC::JSObject* createError(VM& vm, Rust::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options) { return errorCache(globalObject)->createError(vm, globalObject, code, message, options); } @@ -251,7 +251,7 @@ JSObject* createError(JSC::JSGlobalObject* globalObject, ErrorCode code, const S return createError(globalObject->vm(), globalObject, code, message); } -JSObject* createError(Zig::JSGlobalObject* globalObject, ErrorCode code, JSC::JSValue message) +JSObject* createError(Rust::JSGlobalObject* globalObject, ErrorCode code, JSC::JSValue message) { auto& vm = JSC::getVM(globalObject); return createError(vm, globalObject, code, message); @@ -322,7 +322,7 @@ void JSValueToStringSafe(JSC::JSGlobalObject* globalObject, WTF::StringBuilder& case JSC::JSType::InternalFunctionType: case JSC::JSType::JSFunctionType: { auto& vm = JSC::getVM(globalObject); - auto name = Zig::functionName(vm, globalObject, cell->getObject()); + auto name = Rust::functionName(vm, globalObject, cell->getObject()); if (!name.isEmpty()) { builder.append("[Function: "_s); @@ -401,7 +401,7 @@ void determineSpecificType(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WTF:: } if (cell->isCallable()) { builder.append("function "_s); - auto name = Zig::functionName(vm, globalObject, cell->getObject()); + auto name = Rust::functionName(vm, globalObject, cell->getObject()); if (!name.isEmpty()) { builder.append(name); @@ -596,7 +596,7 @@ WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* gl return result.toString(); } -WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, const ZigString* arg_name_string, const ZigString* expected_type_string, JSValue actual_value) +WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, const RustString* arg_name_string, const RustString* expected_type_string, JSValue actual_value) { auto arg_name = std::span(arg_name_string->ptr, arg_name_string->len); ASSERT(WTF::charactersAreAllASCII(arg_name)); diff --git a/src/jsc/bindings/ErrorCode.h b/src/jsc/bindings/ErrorCode.h index c17dbf5d4b1..dbc9f5b2e26 100644 --- a/src/jsc/bindings/ErrorCode.h +++ b/src/jsc/bindings/ErrorCode.h @@ -1,7 +1,7 @@ // To add a new error code, put it in ErrorCode.ts #pragma once -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "root.h" #include #include @@ -52,7 +52,7 @@ class ErrorCodeCache : public JSC::JSInternalFieldObjectImpl { static ErrorCodeCache* create(VM& vm, Structure* structure); static Structure* createStructure(VM& vm, JSGlobalObject* globalObject); - JSObject* createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options); + JSObject* createError(VM& vm, Rust::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options); private: JS_EXPORT_PRIVATE ErrorCodeCache(VM&, Structure*); @@ -61,10 +61,10 @@ class ErrorCodeCache : public JSC::JSInternalFieldObjectImpl { }; JSC::EncodedJSValue throwError(JSC::JSGlobalObject* globalObject, JSC::ThrowScope& scope, ErrorCode code, const WTF::String& message); -JSC::JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, const WTF::String& message); +JSC::JSObject* createError(Rust::GlobalObject* globalObject, ErrorCode code, const WTF::String& message); JSC::JSObject* createError(JSC::JSGlobalObject* globalObject, ErrorCode code, const WTF::String& message); -JSC::JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, JSC::JSValue message); -JSC::JSObject* createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options); +JSC::JSObject* createError(Rust::GlobalObject* globalObject, ErrorCode code, JSC::JSValue message); +JSC::JSObject* createError(VM& vm, Rust::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options); JSC::JSValue toJS(JSC::JSGlobalObject*, ErrorCode); JSObject* createInvalidThisError(JSGlobalObject* globalObject, JSValue thisValue, const ASCIILiteral typeName); JSObject* createInvalidThisError(JSGlobalObject* globalObject, const String& message); diff --git a/src/jsc/bindings/ErrorStackFrame.cpp b/src/jsc/bindings/ErrorStackFrame.cpp index 806a340be24..9a40a48eff5 100644 --- a/src/jsc/bindings/ErrorStackFrame.cpp +++ b/src/jsc/bindings/ErrorStackFrame.cpp @@ -8,10 +8,10 @@ namespace Bun { using namespace JSC; -/// Adjust a `ZigStackFramePosition` by a number of bytes. This accounts for when the adjustment +/// Adjust a `RustStackFramePosition` by a number of bytes. This accounts for when the adjustment /// crosses line boundaries, and thus requires the source code in order to properly compute /// the result. -void adjustPositionBackwards(ZigStackFramePosition& pos, int amount, CodeBlock* code) +void adjustPositionBackwards(RustStackFramePosition& pos, int amount, CodeBlock* code) { if (pos.byte_position - amount < 0) { pos.line_zero_based = 0; @@ -62,11 +62,11 @@ void adjustPositionBackwards(ZigStackFramePosition& pos, int amount, CodeBlock* pos.byte_position -= amount; } -ZigStackFramePosition getAdjustedPositionForBytecode(JSC::CodeBlock* code, JSC::BytecodeIndex bc) +RustStackFramePosition getAdjustedPositionForBytecode(JSC::CodeBlock* code, JSC::BytecodeIndex bc) { auto expr = code->expressionInfoForBytecodeIndex(bc); - ZigStackFramePosition pos { + RustStackFramePosition pos { .line_zero_based = OrdinalNumber::fromOneBasedInt(expr.lineColumn.line).zeroBasedInt(), .column_zero_based = OrdinalNumber::fromOneBasedInt(expr.lineColumn.column).zeroBasedInt(), .byte_position = (int)expr.divot, diff --git a/src/jsc/bindings/ErrorStackFrame.h b/src/jsc/bindings/ErrorStackFrame.h index d7a04e83d6c..6edd038238b 100644 --- a/src/jsc/bindings/ErrorStackFrame.h +++ b/src/jsc/bindings/ErrorStackFrame.h @@ -4,6 +4,6 @@ namespace Bun { -ZigStackFramePosition getAdjustedPositionForBytecode(JSC::CodeBlock* code, JSC::BytecodeIndex bc); +RustStackFramePosition getAdjustedPositionForBytecode(JSC::CodeBlock* code, JSC::BytecodeIndex bc); } // namespace Bun diff --git a/src/jsc/bindings/ErrorStackTrace.cpp b/src/jsc/bindings/ErrorStackTrace.cpp index 96da9087707..e04b3af479a 100644 --- a/src/jsc/bindings/ErrorStackTrace.cpp +++ b/src/jsc/bindings/ErrorStackTrace.cpp @@ -29,7 +29,7 @@ using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { static ImplementationVisibility getImplementationVisibility(JSC::CodeBlock* codeBlock) { @@ -152,13 +152,13 @@ void JSCStackTrace::getFramesForCaller(JSC::VM& vm, JSC::CallFrame* callFrame, J JSC::JSObject* callerObject = caller.getObject(); auto* globalObject = callerObject->globalObject(); - WTF::String callerName = Zig::functionName(vm, globalObject, callerObject); + WTF::String callerName = Rust::functionName(vm, globalObject, callerObject); // Match V8: remove all frames up to and including the caller. If the caller // is not found anywhere in the sync portion of the stack, remove everything. // We match by cell identity first, then by name — name matching is needed // because a resumed async function's frame callee is the generator's `next` - // function (a different cell) but Zig::functionName still reports the + // function (a different cell) but Rust::functionName still reports the // original async function's name. size_t removeCount = stackTrace.size(); for (size_t i = 0; i < stackTrace.size(); i++) { @@ -169,7 +169,7 @@ void JSCStackTrace::getFramesForCaller(JSC::VM& vm, JSC::CallFrame* callFrame, J removeCount = i + 1; break; } - if (!callerName.isEmpty() && Zig::functionName(vm, globalObject, frame, FinalizerSafety::NotInFinalizer, nullptr) == callerName) { + if (!callerName.isEmpty() && Rust::functionName(vm, globalObject, frame, FinalizerSafety::NotInFinalizer, nullptr) == callerName) { removeCount = i + 1; break; } @@ -210,7 +210,7 @@ static bool isVisibleBuiltinFunction(JSC::CodeBlock* codeBlock) } const JSC::SourceCode& source = codeBlock->source(); - return !Zig::sourceURL(source).isEmpty(); + return !Rust::sourceURL(source).isEmpty(); } JSCStackFrame::JSCStackFrame(JSC::VM& vm, JSC::StackVisitor& visitor) @@ -351,14 +351,14 @@ ALWAYS_INLINE String JSCStackFrame::retrieveSourceURL() return String(sourceURLWasmString); } - auto url = Zig::sourceURL(m_codeBlock); + auto url = Rust::sourceURL(m_codeBlock); if (!url.isEmpty()) { return url; } if (m_callee && m_callee->isObject()) { if (auto* jsFunction = dynamicDowncast(m_callee)) { - WTF::String url = Zig::sourceURL(m_vm, jsFunction); + WTF::String url = Rust::sourceURL(m_vm, jsFunction); if (!url.isEmpty()) { return url; } @@ -393,12 +393,12 @@ ALWAYS_INLINE String JSCStackFrame::retrieveFunctionName() if (m_callee) { auto* calleeObject = m_callee->getObject(); if (calleeObject) { - return Zig::functionName(m_vm, calleeObject->globalObject(), calleeObject); + return Rust::functionName(m_vm, calleeObject->globalObject(), calleeObject); } } if (m_codeBlock) { - auto functionName = Zig::functionName(m_vm, m_codeBlock); + auto functionName = Rust::functionName(m_vm, m_codeBlock); if (!functionName.isEmpty()) { return functionName; } @@ -480,7 +480,7 @@ String sourceURL(JSC::CodeBlock* codeBlock) return String(); } - return Zig::sourceURL(*codeBlock); + return Rust::sourceURL(*codeBlock); } String sourceURL(JSC::VM& vm, const JSC::StackFrame& frame) @@ -526,7 +526,7 @@ String sourceURL(JSC::VM& vm, JSC::JSFunction* function) return String(); } - return Zig::sourceURL(jsExecutable->source()); + return Rust::sourceURL(jsExecutable->source()); } String functionName(JSC::VM& vm, JSC::CodeBlock* codeBlock) @@ -705,7 +705,7 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, const } if (auto* callee = frame.callee()) { if (auto* object = callee->getObject()) { - functionName = Zig::functionName(vm, lexicalGlobalObject, object); + functionName = Rust::functionName(vm, lexicalGlobalObject, object); if (flags) { if (auto* unlinkedCodeBlock = codeblock->unlinkedCodeBlock()) { @@ -724,13 +724,13 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, const } if (functionName.isEmpty()) { - functionName = Zig::functionName(vm, codeblock); + functionName = Rust::functionName(vm, codeblock); } } } else { if (auto* callee = frame.callee()) { if (auto* object = callee->getObject()) { - functionName = Zig::functionName(vm, lexicalGlobalObject, object); + functionName = Rust::functionName(vm, lexicalGlobalObject, object); } } } diff --git a/src/jsc/bindings/ErrorStackTrace.h b/src/jsc/bindings/ErrorStackTrace.h index 17c9dc6822e..96c5091fe75 100644 --- a/src/jsc/bindings/ErrorStackTrace.h +++ b/src/jsc/bindings/ErrorStackTrace.h @@ -9,12 +9,12 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { /* JSCStackFrame is an alternative to JSC::StackFrame, which provides the following advantages\changes: * - Also hold the call frame (ExecState). This is mainly used by CallSite to get "this value". diff --git a/src/jsc/bindings/EventLoopTaskNoContext.h b/src/jsc/bindings/EventLoopTaskNoContext.h index fede33f2603..a9fa80f5f32 100644 --- a/src/jsc/bindings/EventLoopTaskNoContext.h +++ b/src/jsc/bindings/EventLoopTaskNoContext.h @@ -1,6 +1,6 @@ #pragma once -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "root.h" namespace Bun { diff --git a/src/jsc/bindings/ExceptionCode.h b/src/jsc/bindings/ExceptionCode.h index 4b200cca6ae..f685aa87ce4 100644 --- a/src/jsc/bindings/ExceptionCode.h +++ b/src/jsc/bindings/ExceptionCode.h @@ -24,7 +24,7 @@ namespace WebCore { -// keep in sync with DOMExceptionCode in src/jsc/bindings/JSErrorCode.Zig +// keep in sync with DOMExceptionCode in src/jsc/bindings/JSErrorCode.Rust 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/jsc/bindings/ExposeNodeModuleGlobals.cpp b/src/jsc/bindings/ExposeNodeModuleGlobals.cpp index c00614bdde7..e536ba6527a 100644 --- a/src/jsc/bindings/ExposeNodeModuleGlobals.cpp +++ b/src/jsc/bindings/ExposeNodeModuleGlobals.cpp @@ -11,7 +11,7 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "InternalModuleRegistry.h" #pragma push_macro("assert") @@ -64,7 +64,7 @@ namespace ExposeNodeModuleGlobalGetters { #define DECL_GETTER(id, field) \ JSC_DEFINE_CUSTOM_GETTER(id, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) \ { \ - Zig::GlobalObject* thisObject = defaultGlobalObject(lexicalGlobalObject); \ + Rust::GlobalObject* thisObject = defaultGlobalObject(lexicalGlobalObject); \ JSC::VM& vm = thisObject->vm(); \ return JSC::JSValue::encode(thisObject->internalModuleRegistry()->requireId(thisObject, vm, field)); \ } @@ -73,7 +73,7 @@ FOREACH_EXPOSED_BUILTIN_IMR(DECL_GETTER) } // namespace ExposeNodeModuleGlobalGetters -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__ExposeNodeModuleGlobals(Zig::GlobalObject* globalObject) +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__ExposeNodeModuleGlobals(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); @@ -94,8 +94,8 @@ extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__ExposeNodeModuleGlobals(Zig::Global // Set up require(), module, __filename, __dirname on globalThis for the REPL. // Creates a CommonJS module object rooted at the given directory so require() resolves correctly. -extern "C" [[ZIG_EXPORT(check_slow)]] void Bun__REPL__setupGlobalRequire( - Zig::GlobalObject* globalObject, +extern "C" [[RUST_EXPORT(check_slow)]] void Bun__REPL__setupGlobalRequire( + Rust::GlobalObject* globalObject, const unsigned char* cwdPtr, size_t cwdLen) { diff --git a/src/jsc/bindings/FormatStackTraceForJS.cpp b/src/jsc/bindings/FormatStackTraceForJS.cpp index 459aa497baf..a663ccf0f6b 100644 --- a/src/jsc/bindings/FormatStackTraceForJS.cpp +++ b/src/jsc/bindings/FormatStackTraceForJS.cpp @@ -1,7 +1,7 @@ #include "root.h" #include "FormatStackTraceForJS.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" #include "JavaScriptCore/ArgList.h" @@ -29,7 +29,7 @@ using namespace WebCore; namespace Bun { -static JSValue formatStackTraceToJSValue(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites) +static JSValue formatStackTraceToJSValue(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -78,7 +78,7 @@ static JSValue formatStackTraceToJSValue(JSC::VM& vm, Zig::GlobalObject* globalO return jsString(vm, sb.toString()); } -static JSValue formatStackTraceToJSValue(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites, JSValue prepareStackTrace) +static JSValue formatStackTraceToJSValue(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites, JSValue prepareStackTrace) { auto scope = DECLARE_THROW_SCOPE(vm); auto stackStringValue = formatStackTraceToJSValue(vm, globalObject, lexicalGlobalObject, errorObject, callSites); @@ -117,10 +117,10 @@ static JSValue formatStackTraceToJSValue(JSC::VM& vm, Zig::GlobalObject* globalO return stackStringValue; } -static JSValue formatStackTraceToJSValueWithoutPrepareStackTrace(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites) +static JSValue formatStackTraceToJSValueWithoutPrepareStackTrace(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSObject* errorObject, JSC::JSArray* callSites) { JSValue prepareStackTrace = {}; - if (lexicalGlobalObject->inherits()) { + if (lexicalGlobalObject->inherits()) { if (auto prepare = globalObject->m_errorConstructorPrepareStackTraceValue.get()) { prepareStackTrace = prepare; } @@ -137,7 +137,7 @@ static JSValue formatStackTraceToJSValueWithoutPrepareStackTrace(JSC::VM& vm, Zi WTF::String formatStackTrace( JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, const WTF::String& name, const WTF::String& message, @@ -181,15 +181,15 @@ WTF::String formatStackTrace( // "".test(/[a-0]/); auto originalLine = WTF::OrdinalNumber::fromOneBasedInt(err->line()); - ZigStackFrame remappedFrame = {}; - memset(&remappedFrame, 0, sizeof(ZigStackFrame)); + RustStackFrame remappedFrame = {}; + memset(&remappedFrame, 0, sizeof(RustStackFrame)); remappedFrame.position.line_zero_based = originalLine.zeroBasedInt(); remappedFrame.position.column_zero_based = 0; String sourceURLForFrame = err->sourceURL(); - // If it's not a Zig::GlobalObject, don't bother source-mapping it. + // If it's not a Rust::GlobalObject, don't bother source-mapping it. if (globalObject && !sourceURLForFrame.isEmpty()) { // https://github.com/oven-sh/bun/issues/3595 if (!sourceURLForFrame.isEmpty()) { @@ -236,21 +236,21 @@ WTF::String formatStackTrace( sb.append("\n"_s); // Pass 1: collect (line, col, source_url) for frames that should be - // source-mapped, then batch the remap so the Zig side can resolve each + // source-mapped, then batch the remap so the Rust side can resolve each // file's map once instead of per frame. - WTF::Vector remappedFrames; + WTF::Vector remappedFrames; WTF::Vector sourceURLs; WTF::Vector originalLineColumns; remappedFrames.grow(framesCount); - memset(remappedFrames.begin(), 0, sizeof(ZigStackFrame) * framesCount); + memset(remappedFrames.begin(), 0, sizeof(RustStackFrame) * framesCount); sourceURLs.grow(framesCount); originalLineColumns.grow(framesCount); bool anyRemap = false; for (size_t i = 0; i < framesCount; i++) { StackFrame& frame = stackTrace.at(i); - ZigStackFrame& remappedFrame = remappedFrames[i]; - // Match `ZigStackFramePosition.invalid` exactly so the Zig batch loop's + RustStackFrame& remappedFrame = remappedFrames[i]; + // Match `RustStackFramePosition.invalid` exactly so the Rust batch loop's // `position.isInvalid()` skips frames we never populate (vm-context // frames, frames without line/col info). memset alone leaves // `line_start_byte = 0` which fails that byte-compare. @@ -270,7 +270,7 @@ WTF::String formatStackTrace( } } - sourceURLs[i] = Zig::sourceURL(vm, frame); + sourceURLs[i] = Rust::sourceURL(vm, frame); bool isDefinitelyNotRunninginNodeVMGlobalObject = globalObject == globalObjectForFrame; bool isDefaultGlobalObjectInAFinalizer = (globalObject && !lexicalGlobalObject && !errorInstance); @@ -293,7 +293,7 @@ WTF::String formatStackTrace( // re-derived from `frame`; only the remap output is read from pass 1. for (size_t i = 0; i < framesCount; i++) { StackFrame& frame = stackTrace.at(i); - ZigStackFrame& remappedFrame = remappedFrames[i]; + RustStackFrame& remappedFrame = remappedFrames[i]; unsigned int flags = static_cast(FunctionNameFlags::AddNewKeyword); JSC::JSGlobalObject* globalObjectForFrame = lexicalGlobalObject; @@ -305,7 +305,7 @@ WTF::String formatStackTrace( } } - WTF::String functionName = Zig::functionName(vm, globalObjectForFrame, frame, errorInstance ? Zig::FinalizerSafety::NotInFinalizer : Zig::FinalizerSafety::MustNotTriggerGC, &flags); + WTF::String functionName = Rust::functionName(vm, globalObjectForFrame, frame, errorInstance ? Rust::FinalizerSafety::NotInFinalizer : Rust::FinalizerSafety::MustNotTriggerGC, &flags); OrdinalNumber originalLine = {}; OrdinalNumber originalColumn = {}; OrdinalNumber displayLine = {}; @@ -393,7 +393,7 @@ WTF::String formatStackTrace( // error.stack calls this function static String computeErrorInfoWithoutPrepareStackTrace( JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, Vector& stackTrace, OrdinalNumber& line, @@ -425,7 +425,7 @@ static String computeErrorInfoWithoutPrepareStackTrace( return Bun::formatStackTrace(vm, globalObject, lexicalGlobalObject, name, message, line, column, sourceURL, stackTrace, errorInstance); } -static JSValue computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, Vector& stackFrames, OrdinalNumber& line, OrdinalNumber& column, String& sourceURL, JSObject* errorObject, JSObject* prepareStackTrace) +static JSValue computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, Vector& stackFrames, OrdinalNumber& line, OrdinalNumber& column, String& sourceURL, JSObject* errorObject, JSObject* prepareStackTrace) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -435,24 +435,24 @@ static JSValue computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObj MarkedArgumentBuffer callSites; // Create the call sites (one per frame) - Zig::createCallSitesFromFrames(globalObject, lexicalGlobalObject, stackTrace, callSites); + Rust::createCallSitesFromFrames(globalObject, lexicalGlobalObject, stackTrace, callSites); // We need to sourcemap it if it's a GlobalObject. const int n = stackTrace.size(); - WTF::Vector remappedFrames; + WTF::Vector remappedFrames; WTF::Vector sourceURLs; WTF::Vector didRemap; remappedFrames.grow(n); - memset(remappedFrames.begin(), 0, sizeof(ZigStackFrame) * n); + memset(remappedFrames.begin(), 0, sizeof(RustStackFrame) * n); sourceURLs.grow(n); didRemap.grow(n); bool anyRemap = false; for (int i = 0; i < n; i++) { - ZigStackFrame& frame = remappedFrames[i]; + RustStackFrame& frame = remappedFrames[i]; auto& stackFrame = stackFrames.at(i); - sourceURLs[i] = Zig::sourceURL(vm, stackFrame); + sourceURLs[i] = Rust::sourceURL(vm, stackFrame); didRemap[i] = false; frame.position.line_zero_based = -1; frame.position.column_zero_based = -1; @@ -493,7 +493,7 @@ static JSValue computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObj } for (int i = 0; i < n; i++) { - ZigStackFrame& frame = remappedFrames[i]; + RustStackFrame& frame = remappedFrames[i]; WTF::String sourceURLForFrame = didRemap[i] ? frame.source_url.toWTFString() : sourceURLs[i]; auto* callsite = uncheckedDowncast(callSites.at(i)); @@ -516,7 +516,7 @@ static JSValue computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObj static String computeErrorInfoToString(JSC::VM& vm, Vector& stackTrace, OrdinalNumber& line, OrdinalNumber& column, String& sourceURL) { - Zig::GlobalObject* globalObject = nullptr; + Rust::GlobalObject* globalObject = nullptr; JSC::JSGlobalObject* lexicalGlobalObject = nullptr; return computeErrorInfoWithoutPrepareStackTrace(vm, globalObject, lexicalGlobalObject, stackTrace, line, column, sourceURL, nullptr); @@ -526,10 +526,10 @@ static JSValue computeErrorInfoToJSValueWithoutSkipping(JSC::VM& vm, VectorglobalObject(); - globalObject = dynamicDowncast(lexicalGlobalObject); + globalObject = dynamicDowncast(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); // Error.prepareStackTrace - https://v8.dev/docs/stack-trace-api#customizing-stack-traces @@ -604,7 +604,7 @@ void computeLineColumnWithSourcemap(JSC::VM& vm, JSC::SourceProvider* _Nonnull s OrdinalNumber line = OrdinalNumber::fromOneBasedInt(lineColumn.line); OrdinalNumber column = OrdinalNumber::fromOneBasedInt(lineColumn.column); - ZigStackFrame frame = {}; + RustStackFrame frame = {}; frame.position.line_zero_based = line.zeroBasedInt(); frame.position.column_zero_based = column.zeroBasedInt(); frame.source_url = Bun::toStringRef(sourceURL); @@ -633,7 +633,7 @@ JSC::JSValue computeErrorInfoWrapperToJSValue(JSC::VM& vm, Vector& s JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncAppendStackTrace, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -723,7 +723,7 @@ JSC_DEFINE_CUSTOM_SETTER(errorInstanceLazyStackCustomSetter, (JSGlobalObject * g JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -784,9 +784,9 @@ JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalOb } // namespace Bun -namespace Zig { +namespace Rust { -void createCallSitesFromFrames(Zig::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSCStackTrace& stackTrace, MarkedArgumentBuffer& callSites) +void createCallSitesFromFrames(Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, JSCStackTrace& stackTrace, MarkedArgumentBuffer& callSites) { /* From v8's "Stack Trace API" (https://github.com/v8/v8/wiki/Stack-Trace-API): * "To maintain restrictions imposed on strict mode functions, frames that have a @@ -810,4 +810,4 @@ void createCallSitesFromFrames(Zig::GlobalObject* globalObject, JSC::JSGlobalObj } } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/FormatStackTraceForJS.h b/src/jsc/bindings/FormatStackTraceForJS.h index fc9515a4668..cf91a834fc4 100644 --- a/src/jsc/bindings/FormatStackTraceForJS.h +++ b/src/jsc/bindings/FormatStackTraceForJS.h @@ -44,10 +44,10 @@ class String; class OrdinalNumber; } // namespace WTF -namespace Zig { +namespace Rust { class GlobalObject; class JSCStackTrace; -} // namespace Zig +} // namespace Rust using JSC::EncodedJSValue; using JSC::PropertyName; @@ -60,7 +60,7 @@ constexpr size_t DEFAULT_ERROR_STACK_TRACE_LIMIT = 10; // Main stack trace formatting function WTF::String formatStackTrace( JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSGlobalObject* lexicalGlobalObject, const WTF::String& name, const WTF::String& message, @@ -85,13 +85,13 @@ JSC::JSValue computeErrorInfoWrapperToJSValue(JSC::VM& vm, WTF::Vector @@ -255,7 +255,7 @@ JSC_DEFINE_HOST_FUNCTION(jsResetCoverage, (JSC::JSGlobalObject * globalObject, J } // Register the fuzzilli() function on a Bun global object -void Bun__REPRL__registerFuzzilliFunctions(Zig::GlobalObject* globalObject) +void Bun__REPRL__registerFuzzilliFunctions(Rust::GlobalObject* globalObject) { JSC::VM& vm = globalObject->vm(); diff --git a/src/jsc/bindings/HTMLEntryPoint.cpp b/src/jsc/bindings/HTMLEntryPoint.cpp index 95d5d987b1b..3fe5a74eae7 100644 --- a/src/jsc/bindings/HTMLEntryPoint.cpp +++ b/src/jsc/bindings/HTMLEntryPoint.cpp @@ -4,11 +4,11 @@ #include #include "InternalModuleRegistry.h" #include "ModuleLoader.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include namespace Bun { using namespace JSC; -extern "C" JSPromise* Bun__loadHTMLEntryPoint(Zig::GlobalObject* globalObject) +extern "C" JSPromise* Bun__loadHTMLEntryPoint(Rust::GlobalObject* globalObject) { auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/IPC.cpp b/src/jsc/bindings/IPC.cpp index e4a60f60152..fb0b409a3b6 100644 --- a/src/jsc/bindings/IPC.cpp +++ b/src/jsc/bindings/IPC.cpp @@ -2,9 +2,9 @@ #include "headers-handwritten.h" #include "BunBuiltinNames.h" #include "WebCoreJSBuiltins.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue IPCSerialize(Zig::GlobalObject* global, JSC::EncodedJSValue message, JSC::EncodedJSValue handle) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue IPCSerialize(Rust::GlobalObject* global, JSC::EncodedJSValue message, JSC::EncodedJSValue handle) { auto& vm = JSC::getVM(global); auto scope = DECLARE_THROW_SCOPE(vm); @@ -20,7 +20,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue IPCSerialize(Zig::G return JSC::JSValue::encode(result); } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue IPCParse(Zig::GlobalObject* global, JSC::EncodedJSValue target, JSC::EncodedJSValue serialized, JSC::EncodedJSValue fd) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue IPCParse(Rust::GlobalObject* global, JSC::EncodedJSValue target, JSC::EncodedJSValue serialized, JSC::EncodedJSValue fd) { auto& vm = JSC::getVM(global); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/ImportMetaObject.cpp b/src/jsc/bindings/ImportMetaObject.cpp index da6e4cfe480..34b7d9d7f74 100644 --- a/src/jsc/bindings/ImportMetaObject.cpp +++ b/src/jsc/bindings/ImportMetaObject.cpp @@ -3,7 +3,7 @@ #include "headers.h" #include "ImportMetaObject.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ActiveDOMObject.h" #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" @@ -53,7 +53,7 @@ #include "isBuiltinModule.h" #include "WebCoreJSBuiltins.h" -namespace Zig { +namespace Rust { using namespace JSC; using namespace WebCore; @@ -73,9 +73,9 @@ static JSC::EncodedJSValue functionRequireResolve(JSC::JSGlobalObject* globalObj JSC::JSValue moduleName = callFrame->argument(0); auto doIt = [&](const WTF::String& fromStr) -> JSC::EncodedJSValue { - Zig::GlobalObject* zigGlobalObject = uncheckedDowncast(globalObject); - if (zigGlobalObject->onLoadPlugins.hasVirtualModules()) { - if (auto result = zigGlobalObject->onLoadPlugins.resolveVirtualModule(fromStr, String())) { + Rust::GlobalObject* rustGlobalObject = uncheckedDowncast(globalObject); + if (rustGlobalObject->onLoadPlugins.hasVirtualModules()) { + if (auto result = rustGlobalObject->onLoadPlugins.resolveVirtualModule(fromStr, String())) { if (fromStr == result.value()) return JSC::JSValue::encode(moduleName); @@ -143,13 +143,13 @@ ImportMetaObject* ImportMetaObject::create(JSC::VM& vm, JSC::JSGlobalObject* glo ImportMetaObject* ImportMetaObject::create(JSC::JSGlobalObject* globalObject, const WTF::String& url) { VM& vm = globalObject->vm(); - Zig::GlobalObject* zigGlobalObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* rustGlobalObject = uncheckedDowncast(globalObject); bool isBake = url.startsWith("bake:"_s); // Get the appropriate structure Structure* structure = isBake - ? zigGlobalObject->ImportMetaBakeObjectStructure() - : zigGlobalObject->ImportMetaObjectStructure(); + ? rustGlobalObject->ImportMetaBakeObjectStructure() + : rustGlobalObject->ImportMetaObjectStructure(); return create(vm, globalObject, structure, url); } @@ -194,7 +194,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireResolve, (JSC::JSGlobalObject * global extern "C" JSC::EncodedJSValue functionImportMeta__resolveSync(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -292,7 +292,7 @@ extern "C" JSC::EncodedJSValue functionImportMeta__resolveSyncPrivate(JSC::JSGlo { auto& vm = JSC::getVM(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = dynamicDowncast(lexicalGlobalObject); + auto* globalObject = dynamicDowncast(lexicalGlobalObject); JSC::JSValue moduleName = callFrame->argument(0); JSValue from = callFrame->argument(1); @@ -422,7 +422,7 @@ extern "C" JSC::EncodedJSValue functionImportMeta__resolveSyncPrivate(JSC::JSGlo JSC_DEFINE_HOST_FUNCTION(functionImportMeta__resolve, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -589,7 +589,7 @@ JSC_DEFINE_CUSTOM_SETTER(jsImportMetaObjectSetter_require, (JSGlobalObject * jsG JSC_DEFINE_CUSTOM_GETTER(jsImportMetaObjectGetter_env, (JSGlobalObject * jsGlobalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { - auto* globalObject = uncheckedDowncast(jsGlobalObject); + auto* globalObject = uncheckedDowncast(jsGlobalObject); return JSValue::encode(globalObject->m_processEnvObject.getInitializedOnMainThread(globalObject)); } diff --git a/src/jsc/bindings/ImportMetaObject.h b/src/jsc/bindings/ImportMetaObject.h index 4ec49bcda76..e3fefe339b9 100644 --- a/src/jsc/bindings/ImportMetaObject.h +++ b/src/jsc/bindings/ImportMetaObject.h @@ -4,7 +4,7 @@ #include "BunBuiltinNames.h" #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMWrapperCache.h" @@ -16,7 +16,7 @@ extern "C" JSC::EncodedJSValue Bun__resolveSyncWithPaths(JSC::JSGlobalObject* gl extern "C" JSC::EncodedJSValue Bun__resolveSyncWithSource(JSC::JSGlobalObject* global, JSC::EncodedJSValue specifier, BunString* from, bool is_esm, bool isUserRequireResolve); extern "C" JSC::EncodedJSValue Bun__resolveSyncWithStrings(JSC::JSGlobalObject* global, BunString* specifier, BunString* from, bool is_esm); -namespace Zig { +namespace Rust { using namespace JSC; using namespace WebCore; diff --git a/src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp b/src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp index 4cc5e4c6593..546504f1a10 100644 --- a/src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp +++ b/src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp @@ -11,7 +11,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Inspector { @@ -133,7 +133,7 @@ void InspectorBunFrontendDevServerAgent::consoleLog(int devServerId, char kind, m_frontendDispatcher->consoleLog(devServerId, kind, data); } -// C API implementations for Zig +// C API implementations for Rust extern "C" { void InspectorBunFrontendDevServerAgent__notifyClientConnected(InspectorBunFrontendDevServerAgent* agent, int devServerId, int connectionId) diff --git a/src/jsc/bindings/InspectorBunFrontendDevServerAgent.h b/src/jsc/bindings/InspectorBunFrontendDevServerAgent.h index 2ba0e332841..0c9aea0b182 100644 --- a/src/jsc/bindings/InspectorBunFrontendDevServerAgent.h +++ b/src/jsc/bindings/InspectorBunFrontendDevServerAgent.h @@ -50,7 +50,7 @@ class InspectorBunFrontendDevServerAgent final : public InspectorAgentBase, publ bool m_enabled { false }; }; -// C API for Zig to call +// C API for Rust to call extern "C" { void BunFrontendDevServerAgent__notifyClientConnected(InspectorBunFrontendDevServerAgent* agent, int connectionId); void BunFrontendDevServerAgent__notifyClientDisconnected(InspectorBunFrontendDevServerAgent* agent, int connectionId); diff --git a/src/jsc/bindings/InspectorHTTPServerAgent.cpp b/src/jsc/bindings/InspectorHTTPServerAgent.cpp index e1e12784982..bec0c4d1565 100644 --- a/src/jsc/bindings/InspectorHTTPServerAgent.cpp +++ b/src/jsc/bindings/InspectorHTTPServerAgent.cpp @@ -7,13 +7,13 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Inspector { WTF_MAKE_TZONE_ALLOCATED_IMPL(InspectorHTTPServerAgent); -// Zig bindings implementation +// Rust bindings implementation extern "C" { void Bun__HTTPServerAgent__setEnabled(Inspector::InspectorHTTPServerAgent* agent); @@ -177,29 +177,29 @@ void InspectorHTTPServerAgent::requestHandlerException(RefserverStarted(serverId, address->toWTFString(), startTime, serverInstance); } -[[ZIG_EXPORT(nothrow)]] void Bun__HTTPServerAgent__notifyServerStopped(Inspector::InspectorHTTPServerAgent* agent, ServerId serverId, double timestamp) +[[RUST_EXPORT(nothrow)]] void Bun__HTTPServerAgent__notifyServerStopped(Inspector::InspectorHTTPServerAgent* agent, ServerId serverId, double timestamp) { agent->serverStopped(serverId, timestamp); } -// This matches the Route extern struct in Zig +// This matches the Route extern struct in Rust struct Route { enum class Type : uint8_t { Default = 1, @@ -219,7 +219,7 @@ struct Route { BunString script_url; }; -[[ZIG_EXPORT(nothrow)]] void Bun__HTTPServerAgent__notifyServerRoutesUpdated(Inspector::InspectorHTTPServerAgent* agent, ServerId serverId, HotReloadId hotReloadId, +[[RUST_EXPORT(nothrow)]] void Bun__HTTPServerAgent__notifyServerRoutesUpdated(Inspector::InspectorHTTPServerAgent* agent, ServerId serverId, HotReloadId hotReloadId, Route* routes_ptr, size_t routes_len) { diff --git a/src/jsc/bindings/InspectorLifecycleAgent.cpp b/src/jsc/bindings/InspectorLifecycleAgent.cpp index 761f7a67891..0f68303c195 100644 --- a/src/jsc/bindings/InspectorLifecycleAgent.cpp +++ b/src/jsc/bindings/InspectorLifecycleAgent.cpp @@ -1,5 +1,5 @@ #include "InspectorLifecycleAgent.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -25,7 +25,7 @@ namespace Inspector { WTF_MAKE_TZONE_ALLOCATED_IMPL(InspectorLifecycleAgent); -// Zig bindings implementation +// Rust bindings implementation extern "C" { void Bun__LifecycleAgentEnable(Inspector::InspectorLifecycleAgent* agent); @@ -36,7 +36,7 @@ void Bun__LifecycleAgentReportReload(Inspector::InspectorLifecycleAgent* agent) agent->reportReload(); } -void Bun__LifecycleAgentReportError(Inspector::InspectorLifecycleAgent* agent, ZigException* exception) +void Bun__LifecycleAgentReportError(Inspector::InspectorLifecycleAgent* agent, RustException* exception) { ASSERT(exception); ASSERT(agent); @@ -100,7 +100,7 @@ void InspectorLifecycleAgent::reportReload() m_frontendDispatcher->reload(); } -void InspectorLifecycleAgent::reportError(ZigException& exception) +void InspectorLifecycleAgent::reportError(RustException& exception) { if (!m_enabled) return; @@ -117,7 +117,7 @@ void InspectorLifecycleAgent::reportError(ZigException& exception) } for (size_t i = 0; i < exception.stack.frames_len; i++) { - ZigStackFrame* frame = &exception.stack.frames_ptr[i]; + RustStackFrame* frame = &exception.stack.frames_ptr[i]; lineColumns->addItem(frame->position.line_zero_based + 1); lineColumns->addItem(frame->position.column_zero_based + 1); urls->addItem(frame->source_url.toWTFString()); diff --git a/src/jsc/bindings/InspectorLifecycleAgent.h b/src/jsc/bindings/InspectorLifecycleAgent.h index d598e7013b6..19f122d80b2 100644 --- a/src/jsc/bindings/InspectorLifecycleAgent.h +++ b/src/jsc/bindings/InspectorLifecycleAgent.h @@ -36,7 +36,7 @@ class InspectorLifecycleAgent final : public InspectorAgentBase, public Inspecto // Public API void reportReload(); - void reportError(ZigException&); + void reportError(RustException&); Protocol::ErrorStringOr preventExit(); Protocol::ErrorStringOr stopPreventingExit(); diff --git a/src/jsc/bindings/InspectorTestReporterAgent.cpp b/src/jsc/bindings/InspectorTestReporterAgent.cpp index 968e5faf6ee..468f2890d73 100644 --- a/src/jsc/bindings/InspectorTestReporterAgent.cpp +++ b/src/jsc/bindings/InspectorTestReporterAgent.cpp @@ -8,7 +8,7 @@ #include #include #include "ErrorStackTrace.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ModuleLoader.h" #include @@ -20,7 +20,7 @@ namespace Inspector { WTF_MAKE_TZONE_ALLOCATED_IMPL(InspectorTestReporterAgent); -// Zig bindings implementation +// Rust bindings implementation extern "C" { void Bun__TestReporterAgentEnable(Inspector::InspectorTestReporterAgent* agent); @@ -76,7 +76,7 @@ void Bun__TestReporterAgentReportTestStart(Inspector::InspectorTestReporterAgent } enum class BunTestStatus : uint8_t { - // this enum is kept in sync with zig Debugger.zig `pub const TestStatus` + // this enum is kept in sync with rust Debugger.rust `pub const TestStatus` Pass, Fail, Timeout, @@ -168,19 +168,19 @@ void InspectorTestReporterAgent::reportTestFound(JSC::CallFrame* callFrame, int JSC::SourceID sourceID = 0; String sourceURL; - ZigStackFrame remappedFrame = {}; + RustStackFrame remappedFrame = {}; auto* globalObject = &m_globalObject; auto& vm = JSC::getVM(globalObject); JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus { - if (Zig::isImplementationVisibilityPrivate(visitor)) + if (Rust::isImplementationVisibilityPrivate(visitor)) return WTF::IterationStatus::Continue; if (visitor->hasLineAndColumnInfo()) { lineColumn = visitor->computeLineAndColumn(); - String sourceURLForFrame = Zig::sourceURL(visitor); + String sourceURLForFrame = Rust::sourceURL(visitor); // Sometimes, the sourceURL is empty. // For example, pages in Next.js. diff --git a/src/jsc/bindings/InternalForTesting.cpp b/src/jsc/bindings/InternalForTesting.cpp index 7500c8ef706..2fdea0462f1 100644 --- a/src/jsc/bindings/InternalForTesting.cpp +++ b/src/jsc/bindings/InternalForTesting.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/JSCast.h" #include "JavaScriptCore/JSArrayBufferView.h" @@ -60,7 +60,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_BunString_toThreadSafeRefCountDelta, (JSC::J const unsigned before = original->refCount(); - // Give the BunString its own ref, mirroring how a Zig-side bun.String + // Give the BunString its own ref, mirroring how a Rust-side bun.String // owns one reference to the underlying StringImpl. original->ref(); BunString str = { BunStringTag::WTFStringImpl, { .wtf = original.ptr() } }; diff --git a/src/jsc/bindings/InternalForTesting.h b/src/jsc/bindings/InternalForTesting.h index a9b1c713c3e..3c693b0a896 100644 --- a/src/jsc/bindings/InternalForTesting.h +++ b/src/jsc/bindings/InternalForTesting.h @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/JSCJSValue.h" namespace Bun { diff --git a/src/jsc/bindings/InternalModuleRegistry.cpp b/src/jsc/bindings/InternalModuleRegistry.cpp index 37329fdde14..9a7f61bb1f9 100644 --- a/src/jsc/bindings/InternalModuleRegistry.cpp +++ b/src/jsc/bindings/InternalModuleRegistry.cpp @@ -1,5 +1,5 @@ #include "InternalModuleRegistry.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -182,7 +182,7 @@ JSC_DEFINE_HOST_FUNCTION(InternalModuleRegistry::jsCreateInternalModuleById, (JS auto throwScope = DECLARE_THROW_SCOPE(vm); auto id = callframe->argument(0).toUInt32(lexicalGlobalObject); - auto registry = uncheckedDowncast(lexicalGlobalObject)->internalModuleRegistry(); + auto registry = uncheckedDowncast(lexicalGlobalObject)->internalModuleRegistry(); auto mod = registry->createInternalModuleById(lexicalGlobalObject, vm, static_cast(id)); RETURN_IF_EXCEPTION(throwScope, {}); registry->internalField(static_cast(id)).set(vm, registry, mod); diff --git a/src/jsc/bindings/IsolatedModuleCache.cpp b/src/jsc/bindings/IsolatedModuleCache.cpp index 6a2ea070aaa..6bfc67856c1 100644 --- a/src/jsc/bindings/IsolatedModuleCache.cpp +++ b/src/jsc/bindings/IsolatedModuleCache.cpp @@ -1,7 +1,7 @@ #include "IsolatedModuleCache.h" #include "BunClientData.h" #include "ModuleLoader.h" -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" namespace Bun { @@ -16,17 +16,17 @@ bool IsolatedModuleCache::canUse(JSC::VM&, void* bunVM, const BunString* typeAtt return true; } -Zig::SourceProvider* IsolatedModuleCache::lookup(JSC::VM& vm, const WTF::String& key) +Rust::SourceProvider* IsolatedModuleCache::lookup(JSC::VM& vm, const WTF::String& key) { auto& cache = WebCore::clientData(vm)->isolationSourceProviderCache; auto it = cache.find(key); if (it == cache.end()) return nullptr; ASSERT(it->value); - return static_cast(it->value.get()); + return static_cast(it->value.get()); } -void IsolatedModuleCache::insert(JSC::VM& vm, const WTF::String& key, Zig::SourceProvider& provider) +void IsolatedModuleCache::insert(JSC::VM& vm, const WTF::String& key, Rust::SourceProvider& provider) { if (!isTagCacheable(static_cast(provider.m_resolvedSource.tag))) return; diff --git a/src/jsc/bindings/IsolatedModuleCache.h b/src/jsc/bindings/IsolatedModuleCache.h index 1ec1df7fae8..9527edc11fc 100644 --- a/src/jsc/bindings/IsolatedModuleCache.h +++ b/src/jsc/bindings/IsolatedModuleCache.h @@ -3,13 +3,13 @@ #include "root.h" #include "headers-handwritten.h" -namespace Zig { +namespace Rust { class SourceProvider; } namespace Bun { -// Per-VM cache mapping resolved specifier (absolute path) → Zig::SourceProvider, +// Per-VM cache mapping resolved specifier (absolute path) → Rust::SourceProvider, // populated only under `bun test --isolate`. Survives global swaps so a fresh // global's module fetch reuses an already-transpiled provider (and hits JSC's // CodeCache + Bun__analyzeTranspiledModule for module_info) instead of @@ -17,7 +17,7 @@ namespace Bun { // // Storage lives on JSVMClientData; this class is a stateless facade so the // gating, key, and tag-cacheability decisions live in exactly one place. The -// map stores Zig::SourceProvider directly (not a wrapper struct) — everything +// map stores Rust::SourceProvider directly (not a wrapper struct) — everything // callers need to branch on (sourceType(), m_resolvedSource.tag, module_info) // already lives on the provider. class IsolatedModuleCache { @@ -48,12 +48,12 @@ class IsolatedModuleCache { } } - static Zig::SourceProvider* lookup(JSC::VM&, const WTF::String& key); + static Rust::SourceProvider* lookup(JSC::VM&, const WTF::String& key); // Inserts only when isTagCacheable(provider.m_resolvedSource.tag); no-op // otherwise. Asserts isNewEntry — a duplicate insert means a lookup was // bypassed, which is exactly the gating bug this consolidation prevents. - static void insert(JSC::VM&, const WTF::String& key, Zig::SourceProvider&); + static void insert(JSC::VM&, const WTF::String& key, Rust::SourceProvider&); static void evict(JSC::VM&, const WTF::String& key); static void clear(JSC::VM&); diff --git a/src/jsc/bindings/JS2Native.cpp b/src/jsc/bindings/JS2Native.cpp index cd4a94fb371..c60690ec687 100644 --- a/src/jsc/bindings/JS2Native.cpp +++ b/src/jsc/bindings/JS2Native.cpp @@ -5,7 +5,7 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "GeneratedJS2Native.h" #include "wtf/Assertions.h" @@ -31,7 +31,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDollarLazy, (JSC::JSGlobalObject * lexicalGlobalObjec id <= JS2NATIVE_COUNT && id >= 0, "In call to $lazy, got invalid id '%d'. This is a bug in Bun's JS2Native code generator.", id); - Zig::GlobalObject* ptr = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* ptr = uncheckedDowncast(lexicalGlobalObject); return JSValue::encode(JS2NativeGenerated::callJS2Native(id, ptr)); } diff --git a/src/jsc/bindings/JSBakeResponse.cpp b/src/jsc/bindings/JSBakeResponse.cpp index 19330f92f51..3610e3d436d 100644 --- a/src/jsc/bindings/JSBakeResponse.cpp +++ b/src/jsc/bindings/JSBakeResponse.cpp @@ -12,8 +12,8 @@ #include #include #include "JSBakeResponse.h" -#include "ZigGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGlobalObject.h" +#include "RustGeneratedClasses.h" #if !OS(WINDOWS) #define JSC_CALLCONV "C" @@ -43,7 +43,7 @@ extern JSC_CALLCONV size_t Response__estimatedSize(void* ptr); bool isJSXElement(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject) { - auto* zigGlobal = static_cast(globalObject); + auto* rustGlobal = static_cast(globalObject); auto& vm = JSC::getVM(globalObject); // React does this: @@ -63,7 +63,7 @@ bool isJSXElement(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObjec JSC::JSValue typeofValue = object->get(globalObject, typeofProperty); RETURN_IF_EXCEPTION(scope, false); - if (typeofValue.isSymbol() && (typeofValue == zigGlobal->bakeAdditions().reactLegacyElementSymbol(zigGlobal) || typeofValue == zigGlobal->bakeAdditions().reactElementSymbol(zigGlobal))) { + if (typeofValue.isSymbol() && (typeofValue == rustGlobal->bakeAdditions().reactLegacyElementSymbol(rustGlobal) || typeofValue == rustGlobal->bakeAdditions().reactElementSymbol(rustGlobal))) { return true; } } @@ -76,7 +76,7 @@ extern "C" bool JSC__JSValue__isJSXElement(JSC::EncodedJSValue JSValue0, JSC::JS return isJSXElement(JSValue0, globalObject); } -extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES BakeResponse__createForSSR(Zig::GlobalObject* globalObject, void* ptr, uint8_t kind) +extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES BakeResponse__createForSSR(Rust::GlobalObject* globalObject, void* ptr, uint8_t kind) { Structure* structure = globalObject->bakeAdditions().JSBakeResponseStructure(globalObject); @@ -106,7 +106,7 @@ static const HashTableValue JSBakeResponseConstructorTableValues[] = { }; -JSBakeResponse* JSBakeResponse::create(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSBakeResponse* JSBakeResponse::create(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::Structure* structure, void* ctx) { JSBakeResponse* ptr = new (NotNull, JSC::allocateCell(vm)) JSBakeResponse(vm, structure, ctx); ptr->finishCreation(vm); @@ -195,7 +195,7 @@ class JSBakeResponseConstructor final : public JSC::InternalFunction { // Must be defined for each specialization class. static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSObject* newTarget = asObject(callFrame->newTarget()); @@ -236,7 +236,7 @@ class JSBakeResponseConstructor final : public JSC::InternalFunction { static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES call(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = static_cast(lexicalGlobalObject); JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -287,7 +287,7 @@ class JSBakeResponseConstructor final : public JSC::InternalFunction { const JSC::ClassInfo JSBakeResponse::s_info = { "Response"_s, &JSResponse::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBakeResponse) }; const JSC::ClassInfo JSBakeResponseConstructor::s_info = { ""_s, &JSC::InternalFunction::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBakeResponseConstructor) }; -Structure* createJSBakeResponseStructure(JSC::VM& vm, Zig::GlobalObject* globalObject, JSObject* prototype) +Structure* createJSBakeResponseStructure(JSC::VM& vm, Rust::GlobalObject* globalObject, JSObject* prototype) { auto structure = JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, 0), JSBakeResponse::info(), NonArray, 0); @@ -300,13 +300,13 @@ Structure* createJSBakeResponseStructure(JSC::VM& vm, Zig::GlobalObject* globalO void setupJSBakeResponseClassStructure(JSC::LazyClassStructure::Initializer& init) { - auto* zigGlobal = static_cast(init.global); - auto* prototype = JSC::constructEmptyObject(zigGlobal, zigGlobal->JSResponsePrototype()); + auto* rustGlobal = static_cast(init.global); + auto* prototype = JSC::constructEmptyObject(rustGlobal, rustGlobal->JSResponsePrototype()); auto* constructorStructure = JSBakeResponseConstructor::createStructure(init.vm, init.global, init.global->functionPrototype()); auto* constructor = JSBakeResponseConstructor::create(init.vm, constructorStructure, prototype); - auto* structure = createJSBakeResponseStructure(init.vm, zigGlobal, prototype); + auto* structure = createJSBakeResponseStructure(init.vm, rustGlobal, prototype); init.setPrototype(prototype); init.setStructure(structure); init.setConstructor(constructor); diff --git a/src/jsc/bindings/JSBakeResponse.h b/src/jsc/bindings/JSBakeResponse.h index 83cff3a956b..f470d8732fa 100644 --- a/src/jsc/bindings/JSBakeResponse.h +++ b/src/jsc/bindings/JSBakeResponse.h @@ -2,7 +2,7 @@ #include "JSCookieMap.h" #include "root.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "WebCoreJSBuiltins.h" namespace Bun { @@ -22,7 +22,7 @@ class JSBakeResponse : public JSResponse { DECLARE_VISIT_CHILDREN; DECLARE_INFO; - static JSBakeResponse* create(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::Structure* structure, void* ctx); + static JSBakeResponse* create(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::Structure* structure, void* ctx); static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype); JSBakeResponseKind kind() const { return m_kind; } diff --git a/src/jsc/bindings/JSBuffer.cpp b/src/jsc/bindings/JSBuffer.cpp index 3af7815ded4..66f5033a31b 100644 --- a/src/jsc/bindings/JSBuffer.cpp +++ b/src/jsc/bindings/JSBuffer.cpp @@ -2,7 +2,7 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "WebCoreJSBuiltins.h" #include "JavaScriptCore/ExceptionHelpers.h" #include "JavaScriptCore/JSString.h" @@ -665,7 +665,7 @@ static JSC::EncodedJSValue jsBufferConstructorFunction_allocBody(JSC::JSGlobalOb RELEASE_AND_RETURN(scope, JSC::JSValue::encode(uint8Array)); } - ZigString str = Zig::toZigString(view); + RustString str = Rust::toRustString(view); if (!Bun__Buffer_fill(&str, startPtr, end - start, encoding)) [[unlikely]] { return Bun::ERR::INVALID_ARG_VALUE(scope, lexicalGlobalObject, "value"_s, value); @@ -1438,7 +1438,7 @@ static JSC::EncodedJSValue jsBufferPrototypeFunction_fillBody(JSC::JSGlobalObjec switch (branch) { case StringBranch: { - ZigString str = Zig::toZigString(stringValue); + RustString str = Rust::toRustString(stringValue); if (str.len == 0) { memset(startPtr, 0, span); } else if (!Bun__Buffer_fill(&str, startPtr, span, encoding)) [[unlikely]] { @@ -2418,7 +2418,7 @@ static JSC::EncodedJSValue jsBufferPrototypeFunction_writeBody(JSC::JSGlobalObje RELEASE_AND_RETURN(scope, writeToBuffer(lexicalGlobalObject, castedThis, str, offset, length, encoding)); } -extern "C" JSC::EncodedJSValue JSBuffer__fromMmap(Zig::GlobalObject* globalObject, void* ptr, size_t length) +extern "C" JSC::EncodedJSValue JSBuffer__fromMmap(Rust::GlobalObject* globalObject, void* ptr, size_t length) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/JSBuffer.h b/src/jsc/bindings/JSBuffer.h index b9ce36ef18a..02c7f2eb267 100644 --- a/src/jsc/bindings/JSBuffer.h +++ b/src/jsc/bindings/JSBuffer.h @@ -32,7 +32,7 @@ extern "C" JSC::EncodedJSValue JSBuffer__bufferFromLength(JSC::JSGlobalObject* l extern "C" JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, size_t length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator); extern "C" JSC::EncodedJSValue Bun__encoding__toString(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject, Encoding encoding); extern "C" JSC::EncodedJSValue Bun__encoding__toStringUTF8(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject); -extern "C" bool Bun__Buffer_fill(ZigString*, void*, size_t, WebCore::BufferEncodingType); +extern "C" bool Bun__Buffer_fill(RustString*, void*, size_t, WebCore::BufferEncodingType); extern "C" bool JSBuffer__isBuffer(JSC::JSGlobalObject*, JSC::EncodedJSValue); namespace Bun { diff --git a/src/jsc/bindings/JSBufferList.cpp b/src/jsc/bindings/JSBufferList.cpp index bcbef33e0cc..8653f48482f 100644 --- a/src/jsc/bindings/JSBufferList.cpp +++ b/src/jsc/bindings/JSBufferList.cpp @@ -2,7 +2,7 @@ #include "JSBuffer.h" #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMOperation.h" #include "headers.h" #include "BunClientData.h" @@ -163,7 +163,7 @@ JSC::JSValue JSBufferList::_getString(JSC::VM& vm, JSC::JSGlobalObject* lexicalG JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, size_t total) { auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* subclassStructure = static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(); + auto* subclassStructure = static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(); if (total <= 0 || length() == 0) { // Buffer.alloc(0) @@ -444,7 +444,7 @@ JSC::EncodedJSValue JSBufferListConstructor::construct(JSC::JSGlobalObject* lexi { auto& vm = JSC::getVM(lexicalGlobalObject); JSBufferList* bufferList = JSBufferList::create( - vm, lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferListStructure()); + vm, lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferListStructure()); return JSC::JSValue::encode(bufferList); } @@ -454,9 +454,9 @@ void JSBufferListConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* const ClassInfo JSBufferListConstructor::s_info = { "BufferList"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBufferListConstructor) }; -JSValue getBufferList(Zig::GlobalObject* globalObject) +JSValue getBufferList(Rust::GlobalObject* globalObject) { - return static_cast(globalObject)->JSBufferList(); + return static_cast(globalObject)->JSBufferList(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/JSBufferList.h b/src/jsc/bindings/JSBufferList.h index 635312f270e..02fe86d64bd 100644 --- a/src/jsc/bindings/JSBufferList.h +++ b/src/jsc/bindings/JSBufferList.h @@ -2,7 +2,7 @@ #include "root.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace WebCore { using namespace JSC; @@ -168,6 +168,6 @@ class JSBufferListConstructor final : public JSC::InternalFunction { void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBufferListPrototype* prototype); }; -JSValue getBufferList(Zig::GlobalObject* globalObject); +JSValue getBufferList(Rust::GlobalObject* globalObject); } diff --git a/src/jsc/bindings/JSBunRequest.cpp b/src/jsc/bindings/JSBunRequest.cpp index e7608b24885..0a430128629 100644 --- a/src/jsc/bindings/JSBunRequest.cpp +++ b/src/jsc/bindings/JSBunRequest.cpp @@ -4,7 +4,7 @@ #include #include #include "JSBunRequest.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "AsyncContextFrame.h" #include #include "JSFetchHeaders.h" @@ -17,7 +17,7 @@ namespace Bun { -extern "C" SYSV_ABI JSC::EncodedJSValue Bun__JSRequest__createForBake(Zig::GlobalObject* globalObject, void* requestPtr) +extern "C" SYSV_ABI JSC::EncodedJSValue Bun__JSRequest__createForBake(Rust::GlobalObject* globalObject, void* requestPtr) { auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -96,7 +96,7 @@ JSObject* JSBunRequest::cookies() const return m_cookies.get(); } -extern "C" void* Request__clone(void* internalZigRequestPointer, JSGlobalObject* globalObject); +extern "C" void* Request__clone(void* internalRustRequestPointer, JSGlobalObject* globalObject); JSBunRequest* JSBunRequest::clone(JSC::VM& vm, JSGlobalObject* globalObject) { @@ -140,7 +140,7 @@ JSBunRequest* JSBunRequest::clone(JSC::VM& vm, JSGlobalObject* globalObject) RELEASE_AND_RETURN(throwScope, clone); } -extern "C" void Request__setCookiesOnRequestContext(void* internalZigRequestPointer, CookieMap* cookieMap); +extern "C" void Request__setCookiesOnRequestContext(void* internalRustRequestPointer, CookieMap* cookieMap); void JSBunRequest::setCookies(JSObject* cookies) { @@ -291,7 +291,7 @@ JSC_DEFINE_HOST_FUNCTION(jsJSBunRequestClone, (JSC::JSGlobalObject * globalObjec return JSValue::encode(clone); } -Structure* createJSBunRequestStructure(JSC::VM& vm, Zig::GlobalObject* globalObject) +Structure* createJSBunRequestStructure(JSC::VM& vm, Rust::GlobalObject* globalObject) { auto prototypeStructure = JSBunRequestPrototype::createStructure(vm, globalObject, globalObject->JSRequestPrototype()); auto* prototype = JSBunRequestPrototype::create(vm, globalObject, prototypeStructure); diff --git a/src/jsc/bindings/JSBunRequest.h b/src/jsc/bindings/JSBunRequest.h index 1eb26605a8f..8caff08e805 100644 --- a/src/jsc/bindings/JSBunRequest.h +++ b/src/jsc/bindings/JSBunRequest.h @@ -2,7 +2,7 @@ #include "JSCookieMap.h" #include "root.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" namespace Bun { using namespace JSC; @@ -46,6 +46,6 @@ class JSBunRequest : public JSRequest { mutable JSC::WriteBarrier m_cookies; }; -JSC::Structure* createJSBunRequestStructure(JSC::VM&, Zig::GlobalObject*); +JSC::Structure* createJSBunRequestStructure(JSC::VM&, Rust::GlobalObject*); } // namespace Bun diff --git a/src/jsc/bindings/JSBundlerPlugin.cpp b/src/jsc/bindings/JSBundlerPlugin.cpp index b12fa97a3d5..ce94e3da7cf 100644 --- a/src/jsc/bindings/JSBundlerPlugin.cpp +++ b/src/jsc/bindings/JSBundlerPlugin.cpp @@ -9,7 +9,7 @@ #include #include #include "helpers.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -47,7 +47,7 @@ extern "C" void OnBeforeParseResult__reset(OnBeforeParseResult* result); #define WRAP_BUNDLER_PLUGIN(argName) jsDoubleNumber(std::bit_cast(reinterpret_cast(argName))) #define UNWRAP_BUNDLER_PLUGIN(callFrame) reinterpret_cast(std::bit_cast(callFrame->argument(0).asDouble())) -/// These are callbacks defined in Zig and to be run after their associated JS version is run +/// These are callbacks defined in Rust and to be run after their associated JS version is run extern "C" void JSBundlerPlugin__addError(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue); extern "C" void JSBundlerPlugin__onLoadAsync(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue); extern "C" void JSBundlerPlugin__onResolveAsync(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::EncodedJSValue); @@ -540,7 +540,7 @@ extern "C" void JSBundlerPlugin__matchOnLoad(Bun::JSBundlerPlugin* plugin, const auto exception = scope.exception(); (void)scope.tryClearException(); if (!plugin->plugin.tombstoned) { - // which = 1 (Load). Zig's JSBundlerPlugin__addError casts ctx based on this value. + // which = 1 (Load). Rust's JSBundlerPlugin__addError casts ctx based on this value. plugin->plugin.addError( context, plugin, @@ -584,7 +584,7 @@ extern "C" void JSBundlerPlugin__matchOnResolve(Bun::JSBundlerPlugin* plugin, co auto exception = JSValue(scope.exception()); (void)scope.tryClearException(); if (!plugin->plugin.tombstoned) { - // which = 0 (Resolve). Zig's JSBundlerPlugin__addError casts ctx based on this value. + // which = 0 (Resolve). Rust's JSBundlerPlugin__addError casts ctx based on this value. plugin->plugin.addError( context, plugin, @@ -595,7 +595,7 @@ extern "C" void JSBundlerPlugin__matchOnResolve(Bun::JSBundlerPlugin* plugin, co } } -extern "C" Bun::JSBundlerPlugin* JSBundlerPlugin__create(Zig::GlobalObject* globalObject, BunPluginTarget target) +extern "C" Bun::JSBundlerPlugin* JSBundlerPlugin__create(Rust::GlobalObject* globalObject, BunPluginTarget target) { return JSBundlerPlugin::create( globalObject->vm(), diff --git a/src/jsc/bindings/JSBundlerPlugin.h b/src/jsc/bindings/JSBundlerPlugin.h index ee59d1e6144..b8dd685041c 100644 --- a/src/jsc/bindings/JSBundlerPlugin.h +++ b/src/jsc/bindings/JSBundlerPlugin.h @@ -144,4 +144,4 @@ class BundlerPlugin final { bool tombstoned { false }; }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/JSCTestingHelpers.cpp b/src/jsc/bindings/JSCTestingHelpers.cpp index 6807ad2b2ee..1e811589ef2 100644 --- a/src/jsc/bindings/JSCTestingHelpers.cpp +++ b/src/jsc/bindings/JSCTestingHelpers.cpp @@ -4,7 +4,7 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { using namespace JSC; @@ -49,7 +49,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionIsLatin1String, return {}; } -JSC::JSValue createJSCTestingHelpers(Zig::GlobalObject* globalObject) +JSC::JSValue createJSCTestingHelpers(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/JSCTestingHelpers.h b/src/jsc/bindings/JSCTestingHelpers.h index db46851b7a5..7b70a14862c 100644 --- a/src/jsc/bindings/JSCTestingHelpers.h +++ b/src/jsc/bindings/JSCTestingHelpers.h @@ -1,5 +1,5 @@ namespace Bun { -JSC::JSValue createJSCTestingHelpers(Zig::GlobalObject* global); +JSC::JSValue createJSCTestingHelpers(Rust::GlobalObject* global); } diff --git a/src/jsc/bindings/JSCommonJSExtensions.cpp b/src/jsc/bindings/JSCommonJSExtensions.cpp index eb8baaf5dee..31c72907698 100644 --- a/src/jsc/bindings/JSCommonJSExtensions.cpp +++ b/src/jsc/bindings/JSCommonJSExtensions.cpp @@ -1,5 +1,5 @@ #include "JSCommonJSExtensions.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunProcess.h" #include "ModuleLoader.h" #include "JSCommonJSModule.h" @@ -88,7 +88,7 @@ void JSCommonJSExtensions::finishCreation(JSC::VM& vm) Base::finishCreation(vm); ASSERT(inherits(info())); - Zig::GlobalObject* global = defaultGlobalObject(globalObject()); + Rust::GlobalObject* global = defaultGlobalObject(globalObject()); JSC::JSFunction* fnLoadJS = JSC::JSFunction::create( vm, global, @@ -136,16 +136,16 @@ void JSCommonJSExtensions::finishCreation(JSC::VM& vm) } extern "C" void NodeModuleModule__onRequireExtensionModify( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const BunString* key, BunLoaderType loader, JSC::JSValue value); extern "C" void NodeModuleModule__onRequireExtensionModifyNonFunction( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const BunString* key); -void onAssign(Zig::GlobalObject* globalObject, JSC::PropertyName propertyName, JSC::JSValue value) +void onAssign(Rust::GlobalObject* globalObject, JSC::PropertyName propertyName, JSC::JSValue value) { if (propertyName.isSymbol()) return; auto* name = propertyName.publicName(); @@ -201,7 +201,7 @@ bool JSCommonJSExtensions::deleteProperty(JSC::JSCell* cell, JSC::JSGlobalObject return deleted; } -extern "C" uint32_t JSCommonJSExtensions__appendFunction(Zig::GlobalObject* globalObject, JSC::JSValue value) +extern "C" uint32_t JSCommonJSExtensions__appendFunction(Rust::GlobalObject* globalObject, JSC::JSValue value) { JSCommonJSExtensions* extensions = globalObject->lazyRequireExtensionsObject(); extensions->m_registeredFunctions.append(JSC::WriteBarrier()); @@ -209,13 +209,13 @@ extern "C" uint32_t JSCommonJSExtensions__appendFunction(Zig::GlobalObject* glob return extensions->m_registeredFunctions.size() - 1; } -extern "C" void JSCommonJSExtensions__setFunction(Zig::GlobalObject* globalObject, uint32_t index, JSC::JSValue value) +extern "C" void JSCommonJSExtensions__setFunction(Rust::GlobalObject* globalObject, uint32_t index, JSC::JSValue value) { JSCommonJSExtensions* extensions = globalObject->lazyRequireExtensionsObject(); extensions->m_registeredFunctions[index].set(globalObject->vm(), globalObject, value); } -extern "C" uint32_t JSCommonJSExtensions__swapRemove(Zig::GlobalObject* globalObject, uint32_t index) +extern "C" uint32_t JSCommonJSExtensions__swapRemove(Rust::GlobalObject* globalObject, uint32_t index) { JSCommonJSExtensions* extensions = globalObject->lazyRequireExtensionsObject(); ASSERT(extensions->m_registeredFunctions.size() > 0); @@ -243,7 +243,7 @@ extern "C" uint32_t JSCommonJSExtensions__swapRemove(Zig::GlobalObject* globalOb JSC::EncodedJSValue builtinLoader(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame, BunLoaderType loaderType) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); JSC::JSObject* modValue = callFrame->argument(0).getObject(); if (!modValue) { throwTypeError(globalObject, scope, "Module._extensions['.js'] must be called with a CommonJS module object"_s); diff --git a/src/jsc/bindings/JSCommonJSModule.cpp b/src/jsc/bindings/JSCommonJSModule.cpp index dc1645e8778..5a6b3c45e9f 100644 --- a/src/jsc/bindings/JSCommonJSModule.cpp +++ b/src/jsc/bindings/JSCommonJSModule.cpp @@ -39,7 +39,7 @@ #include "root.h" #include "JavaScriptCore/SourceCode.h" #include "headers-handwritten.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -67,7 +67,7 @@ #include #include -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" #include #include "JSCommonJSModule.h" #include @@ -111,7 +111,7 @@ static bool canPerformFastEnumeration(Structure* s) extern "C" bool Bun__VM__specifierIsEvalEntryPoint(void*, EncodedJSValue); extern "C" void Bun__VM__setEntryPointEvalResultCJS(void*, EncodedJSValue); -static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObject, JSCommonJSModule* moduleObject, JSString* dirname, JSValue filename) +static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Rust::GlobalObject* globalObject, JSCommonJSModule* moduleObject, JSString* dirname, JSValue filename) { auto scope = DECLARE_THROW_SCOPE(vm); SourceCode code = WTF::move(moduleObject->sourceCode); @@ -201,7 +201,7 @@ static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObj if (auto* jsFunction = dynamicDowncast(fn)) { if (jsFunction->jsExecutable()->parameterCount() > 5) { // it expects ImportMetaObject - args.append(Zig::ImportMetaObject::create(globalObject, filename)); + args.append(Rust::ImportMetaObject::create(globalObject, filename)); } } @@ -217,7 +217,7 @@ static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObj return true; } -bool JSCommonJSModule::load(JSC::VM& vm, Zig::GlobalObject* globalObject) +bool JSCommonJSModule::load(JSC::VM& vm, Rust::GlobalObject* globalObject) { auto scope = DECLARE_THROW_SCOPE(vm); if (this->hasEvaluated || this->sourceCode.isNull()) { @@ -249,7 +249,7 @@ bool JSCommonJSModule::load(JSC::VM& vm, Zig::GlobalObject* globalObject) JSC_DEFINE_HOST_FUNCTION(jsFunctionEvaluateCommonJSModule, (JSGlobalObject * lexicalGlobalObject, CallFrame* callframe)) { auto& vm = JSC::getVM(lexicalGlobalObject); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); // These casts are jsDynamicCast because require.cache pollution + invalid // this calls can put arbitrary values here instead of JSCommonJSModule* @@ -323,7 +323,7 @@ JSC_DEFINE_HOST_FUNCTION(requireResolvePathsFunction, (JSGlobalObject * globalOb JSC_DEFINE_CUSTOM_GETTER(jsRequireCacheGetter, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(globalObject); return JSValue::encode(thisObject->lazyRequireCacheObject()); } @@ -341,7 +341,7 @@ JSC_DEFINE_CUSTOM_SETTER(jsRequireCacheSetter, JSC_DEFINE_CUSTOM_GETTER(jsRequireExtensionsGetter, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(globalObject); return JSValue::encode(thisObject->lazyRequireExtensionsObject()); } @@ -403,7 +403,7 @@ RequireFunctionPrototype* RequireFunctionPrototype::create( RequireFunctionPrototype* prototype = new (NotNull, JSC::allocateCell(vm)) RequireFunctionPrototype(vm, structure); prototype->finishCreation(vm); - prototype->putDirect(vm, vm.propertyNames->resolve, uncheckedDowncast(globalObject)->requireResolveFunctionUnbound(), 0); + prototype->putDirect(vm, vm.propertyNames->resolve, uncheckedDowncast(globalObject)->requireResolveFunctionUnbound(), 0); return prototype; } @@ -710,12 +710,12 @@ JSC_DEFINE_HOST_FUNCTION(functionJSCommonJSModule_compile, (JSGlobalObject * glo RETURN_IF_EXCEPTION(throwScope, {}); String wrappedString; - auto* zigGlobalObject = uncheckedDowncast(globalObject); - if (zigGlobalObject->hasOverriddenModuleWrapper) [[unlikely]] { + auto* rustGlobalObject = uncheckedDowncast(globalObject); + if (rustGlobalObject->hasOverriddenModuleWrapper) [[unlikely]] { wrappedString = makeString( - zigGlobalObject->m_moduleWrapperStart, + rustGlobalObject->m_moduleWrapperStart, sourceString, - zigGlobalObject->m_moduleWrapperEnd); + rustGlobalObject->m_moduleWrapperEnd); } else { wrappedString = makeString( "(function(exports,require,module,__filename,__dirname){"_s, @@ -744,7 +744,7 @@ JSC_DEFINE_HOST_FUNCTION(functionJSCommonJSModule_compile, (JSGlobalObject * glo WTF::NakedPtr exception; evaluateCommonJSModuleOnce( vm, - uncheckedDowncast(globalObject), + uncheckedDowncast(globalObject), moduleObject, jsString(vm, dirnameString), jsString(vm, filenameString)); @@ -868,11 +868,11 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionCreateCommonJSModule, (JSGlobalObject * globa ASSERT(hasEvaluated.isBoolean()); JSValue parent = callframe->uncheckedArgument(3); - return JSValue::encode(JSCommonJSModule::create(uncheckedDowncast(globalObject), id, object, hasEvaluated.isTrue(), parent)); + return JSValue::encode(JSCommonJSModule::create(uncheckedDowncast(globalObject), id, object, hasEvaluated.isTrue(), parent)); } JSCommonJSModule* JSCommonJSModule::create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* requireMapKey, JSValue exportsObject, bool hasEvaluated, @@ -914,7 +914,7 @@ JSCommonJSModule* JSCommonJSModule::create( } JSCommonJSModule* JSCommonJSModule::create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const WTF::String& key, JSValue exportsObject, bool hasEvaluated, @@ -1155,7 +1155,7 @@ void JSCommonJSModule::setExportsObject(JSC::JSValue exportsObject) } Structure* createCommonJSModuleStructure( - Zig::GlobalObject* globalObject) + Rust::GlobalObject* globalObject) { return JSCommonJSModule::createStructure(globalObject); } @@ -1230,7 +1230,7 @@ const JSC::ClassInfo JSCommonJSModule::s_info = { "Module"_s, &Base::s_info, nul const JSC::ClassInfo RequireResolveFunctionPrototype::s_info = { "resolve"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(RequireResolveFunctionPrototype) }; const JSC::ClassInfo RequireFunctionPrototype::s_info = { "require"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(RequireFunctionPrototype) }; -ALWAYS_INLINE EncodedJSValue finishRequireWithError(Zig::GlobalObject* globalObject, JSC::ThrowScope& throwScope, JSC::JSValue specifierValue) +ALWAYS_INLINE EncodedJSValue finishRequireWithError(Rust::GlobalObject* globalObject, JSC::ThrowScope& throwScope, JSC::JSValue specifierValue) { JSC::JSValue exception = throwScope.exception(); ASSERT(exception); @@ -1251,7 +1251,7 @@ ALWAYS_INLINE EncodedJSValue finishRequireWithError(Zig::GlobalObject* globalObj // JSCommonJSModule.$require(resolvedId, newModule, userArgumentCount, userOptions) JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireCommonJS, (JSGlobalObject * lexicalGlobalObject, CallFrame* callframe)) { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); ASSERT(callframe->argumentCount() == 4); @@ -1313,7 +1313,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireCommonJS, (JSGlobalObject * lexicalGlo JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireNativeModule, (JSGlobalObject * lexicalGlobalObject, CallFrame* callframe)) { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1348,7 +1348,7 @@ void RequireResolveFunctionPrototype::finishCreation(JSC::VM& vm) } void JSCommonJSModule::evaluate( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const WTF::String& key, ResolvedSource& source, bool isBuiltIn) @@ -1373,7 +1373,7 @@ void JSCommonJSModule::evaluate( } } - auto sourceProvider = Zig::SourceProvider::create(globalObject, source, JSC::SourceProviderSourceType::Program, isBuiltIn); + auto sourceProvider = Rust::SourceProvider::create(globalObject, source, JSC::SourceProviderSourceType::Program, isBuiltIn); this->ignoreESModuleAnnotation = source.tag == ResolvedSourceTagPackageJSONTypeModule; if (!isBuiltIn && !globalObject->hasOverriddenModuleWrapper && Bun::IsolatedModuleCache::canUse(vm, globalObject->bunVM())) { Bun::IsolatedModuleCache::insert(vm, key, sourceProvider.get()); @@ -1387,7 +1387,7 @@ void JSCommonJSModule::evaluate( } void JSCommonJSModule::evaluate( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, Ref&& sourceProvider, bool ignoreESModuleAnnotation) { @@ -1400,7 +1400,7 @@ void JSCommonJSModule::evaluate( } void JSCommonJSModule::evaluateWithPotentiallyOverriddenCompile( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const WTF::String& key, JSValue keyJSString, ResolvedSource& source) @@ -1449,7 +1449,7 @@ void JSCommonJSModule::evaluateWithPotentiallyOverriddenCompile( static JSC::SourceCode commonJSModuleSyntheticSourceCode(const SourceOrigin& sourceOrigin, const WTF::String& sourceURL); std::optional createCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSString* requireMapKey, ResolvedSource& source, bool isBuiltIn) @@ -1492,7 +1492,7 @@ std::optional createCommonJSModule( source.source_code = Bun::toStringRef(concat); } - auto sourceProvider = Zig::SourceProvider::create(globalObject, source, JSC::SourceProviderSourceType::Program, isBuiltIn); + auto sourceProvider = Rust::SourceProvider::create(globalObject, source, JSC::SourceProviderSourceType::Program, isBuiltIn); if (!isBuiltIn && !globalObject->hasOverriddenModuleWrapper && Bun::IsolatedModuleCache::canUse(vm, globalObject->bunVM())) { Bun::IsolatedModuleCache::insert(vm, sourceURL, sourceProvider.get()); } @@ -1509,7 +1509,7 @@ std::optional createCommonJSModule( requireMap->set(globalObject, filename, moduleObject); RETURN_IF_EXCEPTION(scope, {}); } else { - sourceOrigin = Zig::toSourceOrigin(sourceURL, isBuiltIn); + sourceOrigin = Rust::toSourceOrigin(sourceURL, isBuiltIn); } moduleObject->ignoreESModuleAnnotation = ignoreESModuleAnnotation; @@ -1525,7 +1525,7 @@ static JSC::SourceCode commonJSModuleSyntheticSourceCode(const SourceOrigin& sou const JSC::Identifier& moduleKey, Vector& exportNames, JSC::MarkedArgumentBuffer& exportValues) -> void { - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1567,7 +1567,7 @@ static JSC::SourceCode commonJSModuleSyntheticSourceCode(const SourceOrigin& sou } std::optional createCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* requireMapKey, Ref&& sourceProvider, bool ignoreESModuleAnnotation) @@ -1622,7 +1622,7 @@ JSObject* JSCommonJSModule::createBoundRequireFunction(VM& vm, JSGlobalObject* l { ASSERT(!pathString.startsWith("file://"_s)); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSString* filename = JSC::jsStringWithCache(vm, pathString); diff --git a/src/jsc/bindings/JSCommonJSModule.h b/src/jsc/bindings/JSCommonJSModule.h index eb7bf713307..04e465ef986 100644 --- a/src/jsc/bindings/JSCommonJSModule.h +++ b/src/jsc/bindings/JSCommonJSModule.h @@ -7,7 +7,7 @@ #include "wtf/NakedPtr.h" #include "BunClientData.h" -namespace Zig { +namespace Rust { class GlobalObject; } namespace JSC { @@ -87,10 +87,10 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject { static JSC::Structure* createStructure(JSC::JSGlobalObject* globalObject); - void evaluate(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource& resolvedSource, bool isBuiltIn); - void evaluate(Zig::GlobalObject* globalObject, Ref&& sourceProvider, bool ignoreESModuleAnnotation); - void evaluateWithPotentiallyOverriddenCompile(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, JSValue keyJSString, ResolvedSource& resolvedSource); - inline void evaluate(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource& resolvedSource) + void evaluate(Rust::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource& resolvedSource, bool isBuiltIn); + void evaluate(Rust::GlobalObject* globalObject, Ref&& sourceProvider, bool ignoreESModuleAnnotation); + void evaluateWithPotentiallyOverriddenCompile(Rust::GlobalObject* globalObject, const WTF::String& sourceURL, JSValue keyJSString, ResolvedSource& resolvedSource); + inline void evaluate(Rust::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource& resolvedSource) { return evaluate(globalObject, sourceURL, resolvedSource, false); } @@ -101,17 +101,17 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject { JSC::JSString* dirname, const JSC::SourceCode& sourceCode); static JSCommonJSModule* create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const WTF::String& key, JSValue exportsObject, bool hasEvaluated, JSValue parent); static JSCommonJSModule* create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* key, JSValue exportsObject, bool hasEvaluated, JSValue parent); static JSCommonJSModule* create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const WTF::String& key, ResolvedSource resolvedSource); @@ -130,7 +130,7 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject { JSValue idOrDot() { return m_id.get(); } JSValue filename() { return m_filename.get(); } - bool load(JSC::VM& vm, Zig::GlobalObject* globalObject); + bool load(JSC::VM& vm, Rust::GlobalObject* globalObject); DECLARE_INFO; DECLARE_VISIT_CHILDREN; @@ -162,22 +162,22 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject { }; JSC::Structure* createCommonJSModuleStructure( - Zig::GlobalObject* globalObject); + Rust::GlobalObject* globalObject); std::optional createCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierValue, ResolvedSource& source, bool isBuiltIn); std::optional createCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierValue, Ref&& provider, bool ignoreESModuleAnnotation); inline std::optional createCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierValue, ResolvedSource& source) { diff --git a/src/jsc/bindings/JSDOMExceptionHandling.cpp b/src/jsc/bindings/JSDOMExceptionHandling.cpp index ef3c4b60a32..310192fad61 100644 --- a/src/jsc/bindings/JSDOMExceptionHandling.cpp +++ b/src/jsc/bindings/JSDOMExceptionHandling.cpp @@ -73,7 +73,7 @@ void reportException(JSGlobalObject* lexicalGlobalObject, JSC::Exception* except // exceptionSourceURL = callFrame->sourceURL(); // } - Zig::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); + Rust::GlobalObject::reportUncaughtExceptionAtEventLoop(globalObject, exception); if (exceptionDetails) { auto errorMessage = retrieveErrorMessage(*lexicalGlobalObject, vm, exception->value(), scope); diff --git a/src/jsc/bindings/JSDOMFile.cpp b/src/jsc/bindings/JSDOMFile.cpp index ac3e0588cf8..5d76a7eea5e 100644 --- a/src/jsc/bindings/JSDOMFile.cpp +++ b/src/jsc/bindings/JSDOMFile.cpp @@ -1,5 +1,5 @@ #include "root.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include #include #include @@ -42,13 +42,13 @@ class JSDOMFile : public JSC::InternalFunction { static JSDOMFile* create(JSC::VM& vm, JSGlobalObject* globalObject) { - auto* zigGlobal = defaultGlobalObject(globalObject); - auto structure = createStructure(vm, globalObject, zigGlobal->functionPrototype()); + auto* rustGlobal = defaultGlobalObject(globalObject); + auto structure = createStructure(vm, globalObject, rustGlobal->functionPrototype()); auto* object = new (NotNull, JSC::allocateCell(vm)) JSDOMFile(vm, structure); object->finishCreation(vm); // This is not quite right. But we'll fix it if someone files an issue about it. - object->putDirect(vm, vm.propertyNames->prototype, zigGlobal->JSBlobPrototype(), JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + object->putDirect(vm, vm.propertyNames->prototype, rustGlobal->JSBlobPrototype(), JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); return object; } @@ -73,7 +73,7 @@ class JSDOMFile : public JSC::InternalFunction { if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = static_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); diff --git a/src/jsc/bindings/JSDOMGlobalObject.cpp b/src/jsc/bindings/JSDOMGlobalObject.cpp index c8970349ccb..84d3e1dd1dc 100644 --- a/src/jsc/bindings/JSDOMGlobalObject.cpp +++ b/src/jsc/bindings/JSDOMGlobalObject.cpp @@ -1,12 +1,12 @@ #include "JSDOMGlobalObject.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace WebCore { -Zig::GlobalObject* toJSDOMGlobalObject(ScriptExecutionContext& ctx, DOMWrapperWorld& world) +Rust::GlobalObject* toJSDOMGlobalObject(ScriptExecutionContext& ctx, DOMWrapperWorld& world) { - return uncheckedDowncast(ctx.jsGlobalObject()); + return uncheckedDowncast(ctx.jsGlobalObject()); } // static JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame, bool skipFirstFrame, bool lookUpFromVMEntryScope) diff --git a/src/jsc/bindings/JSDOMGlobalObject.h b/src/jsc/bindings/JSDOMGlobalObject.h index 8e55f27f615..d40c611d315 100644 --- a/src/jsc/bindings/JSDOMGlobalObject.h +++ b/src/jsc/bindings/JSDOMGlobalObject.h @@ -2,7 +2,7 @@ #include "root.h" -namespace Zig { +namespace Rust { class GlobalObject; } @@ -16,7 +16,7 @@ class GlobalObject; namespace WebCore { -Zig::GlobalObject* toJSDOMGlobalObject(ScriptExecutionContext& ctx, DOMWrapperWorld& world); +Rust::GlobalObject* toJSDOMGlobalObject(ScriptExecutionContext& ctx, DOMWrapperWorld& world); template JSClass* toJSDOMGlobalObject(JSC::VM& vm, JSC::JSValue value) diff --git a/src/jsc/bindings/JSDOMWrapper.h b/src/jsc/bindings/JSDOMWrapper.h index d60ac10f50b..e1d7e2d1f34 100644 --- a/src/jsc/bindings/JSDOMWrapper.h +++ b/src/jsc/bindings/JSDOMWrapper.h @@ -21,7 +21,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMGlobalObject.h" #include "NodeConstants.h" @@ -29,10 +29,10 @@ #include namespace WebCore { -using namespace Zig; +using namespace Rust; #ifndef RENAMED_JSDOM_GLOBAL_OBJECT #define RENAMED_JSDOM_GLOBAL_OBJECT -using JSDOMGlobalObject = Zig::GlobalObject; +using JSDOMGlobalObject = Rust::GlobalObject; } #endif class ScriptExecutionContext; diff --git a/src/jsc/bindings/JSEnvironmentVariableMap.cpp b/src/jsc/bindings/JSEnvironmentVariableMap.cpp index fd6cce51c70..eb5577dd585 100644 --- a/src/jsc/bindings/JSEnvironmentVariableMap.cpp +++ b/src/jsc/bindings/JSEnvironmentVariableMap.cpp @@ -1,5 +1,5 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" @@ -20,7 +20,7 @@ using namespace JSC; extern "C" size_t Bun__getEnvCount(JSGlobalObject* globalObject, void** list_ptr); extern "C" size_t Bun__getEnvKey(void* list, size_t index, unsigned char** out); -extern "C" bool Bun__getEnvValue(JSGlobalObject* globalObject, const ZigString* name, ZigString* value); +extern "C" bool Bun__getEnvValue(JSGlobalObject* globalObject, const RustString* name, RustString* value); extern "C" bool Bun__getEnvValueBunString(JSGlobalObject* globalObject, const BunString* name, BunString* value); extern "C" void Bun__setEnvValue(JSGlobalObject* globalObject, const BunString* name, const BunString* value); @@ -37,8 +37,8 @@ JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalOb if (!thisObject) [[unlikely]] return JSValue::encode(jsUndefined()); - ZigString name = toZigString(propertyName.publicName()); - ZigString value = { nullptr, 0 }; + RustString name = toRustString(propertyName.publicName()); + RustString value = { nullptr, 0 }; if (name.len == 0) [[unlikely]] return JSValue::encode(jsUndefined()); @@ -47,7 +47,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalOb return JSValue::encode(jsUndefined()); } - JSValue result = jsString(vm, Zig::toStringCopy(value)); + JSValue result = jsString(vm, Rust::toStringCopy(value)); thisObject->putDirect(vm, propertyName, result, 0); return JSValue::encode(result); } @@ -68,10 +68,10 @@ JSC_DEFINE_CUSTOM_SETTER(jsSetterEnvironmentVariable, (JSGlobalObject * globalOb } // Proxy-related env vars (HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase -// variants) are read by fetch()'s Zig-side proxy resolution via -// env_loader.getHttpProxyFor(). Writes from JS must sync back to the Zig env +// variants) are read by fetch()'s Rust-side proxy resolution via +// env_loader.getHttpProxyFor(). Writes from JS must sync back to the Rust env // map so runtime changes take effect. Unlike the generic getter, this does -// NOT cache on the JS object — the Zig env map is the single source of truth +// NOT cache on the JS object — the Rust env map is the single source of truth // so set-then-get stays consistent and the CustomAccessor isn't clobbered. JSC_DEFINE_CUSTOM_GETTER(jsGetterProxyEnvironmentVariable, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { @@ -140,8 +140,8 @@ JSC_DEFINE_CUSTOM_GETTER(jsTimeZoneEnvironmentVariableGetter, (JSGlobalObject * auto* clientData = WebCore::clientData(vm); - ZigString name = toZigString(propertyName.publicName()); - ZigString value = { nullptr, 0 }; + RustString name = toRustString(propertyName.publicName()); + RustString value = { nullptr, 0 }; auto hasExistingValue = thisObject->getIfPropertyExists(globalObject, clientData->builtinNames().dataPrivateName()); RETURN_IF_EXCEPTION(scope, {}); @@ -153,7 +153,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsTimeZoneEnvironmentVariableGetter, (JSGlobalObject * return JSValue::encode(jsUndefined()); } - JSValue out = jsString(vm, Zig::toStringCopy(value)); + JSValue out = jsString(vm, Rust::toStringCopy(value)); thisObject->putDirect(vm, clientData->builtinNames().dataPrivateName(), out, 0); return JSValue::encode(out); @@ -228,14 +228,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsNodeTLSRejectUnauthorizedGetter, (JSGlobalObject * gl return JSValue::encode(result); } - ZigString name = toZigString(propertyName.publicName()); - ZigString value = { nullptr, 0 }; + RustString name = toRustString(propertyName.publicName()); + RustString value = { nullptr, 0 }; if (!Bun__getEnvValue(globalObject, &name, &value) || value.len == 0) { return JSValue::encode(jsUndefined()); } - return JSValue::encode(jsString(vm, Zig::toStringCopy(value))); + return JSValue::encode(jsString(vm, Rust::toStringCopy(value))); } JSC_DEFINE_CUSTOM_SETTER(jsNodeTLSRejectUnauthorizedSetter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) @@ -282,14 +282,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsBunConfigVerboseFetchGetter, (JSGlobalObject * global return JSValue::encode(result); } - ZigString name = toZigString(propertyName.publicName()); - ZigString value = { nullptr, 0 }; + RustString name = toRustString(propertyName.publicName()); + RustString value = { nullptr, 0 }; if (!Bun__getEnvValue(globalObject, &name, &value) || value.len == 0) { return JSValue::encode(jsUndefined()); } - return JSValue::encode(jsString(vm, Zig::toStringCopy(value))); + return JSValue::encode(jsString(vm, Rust::toStringCopy(value))); } JSC_DEFINE_CUSTOM_SETTER(jsBunConfigVerboseFetchSetter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) @@ -344,7 +344,7 @@ JSC_DEFINE_HOST_FUNCTION(jsEditWindowsEnvVar, (JSGlobalObject * global, JSC::Cal } #endif -JSValue createEnvironmentVariablesMap(Zig::GlobalObject* globalObject) +JSValue createEnvironmentVariablesMap(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -370,7 +370,7 @@ JSValue createEnvironmentVariablesMap(Zig::GlobalObject* globalObject) bool hasNodeTLSRejectUnauthorized = false; bool hasBunConfigVerboseFetch = false; - // Proxy-related env vars need write-back to the Zig env map so that + // Proxy-related env vars need write-back to the Rust env map so that // fetch()'s getHttpProxyFor() observes runtime changes. static constexpr ASCIILiteral proxyVarNames[] = { "HTTP_PROXY"_s, @@ -440,10 +440,10 @@ JSValue createEnvironmentVariablesMap(Zig::GlobalObject* globalObject) // This causes strange issues when the environment variable name is an integer. if (chars[0] >= '0' && chars[0] <= '9') [[unlikely]] { if (auto index = parseIndex(identifier)) { - ZigString valueString = { nullptr, 0 }; - ZigString nameStr = toZigString(name); + RustString valueString = { nullptr, 0 }; + RustString nameStr = toRustString(name); if (Bun__getEnvValue(globalObject, &nameStr, &valueString)) { - JSValue value = jsString(vm, Zig::toStringCopy(valueString)); + JSValue value = jsString(vm, Rust::toStringCopy(valueString)); RETURN_IF_EXCEPTION(scope, {}); object->putDirectIndex(globalObject, *index, value, 0, PutDirectIndexLikePutDirect); RETURN_IF_EXCEPTION(scope, {}); @@ -485,7 +485,7 @@ JSValue createEnvironmentVariablesMap(Zig::GlobalObject* globalObject) for (size_t j = 0; j < proxyVarCount; j++) { // Known limitation: `delete process.env.NO_PROXY` removes the accessor - // without calling the setter, leaving Zig's env map stale (same as TZ). + // without calling the setter, leaving Rust's env map stale (same as TZ). // Use `process.env.NO_PROXY = ""` to unset. DontDelete would throw in // strict mode, so we leave it deletable and document the gap. unsigned attrs = JSC::PropertyAttribute::CustomAccessor | 0; diff --git a/src/jsc/bindings/JSEnvironmentVariableMap.h b/src/jsc/bindings/JSEnvironmentVariableMap.h index 0de7c81ba4f..c0946e72b74 100644 --- a/src/jsc/bindings/JSEnvironmentVariableMap.h +++ b/src/jsc/bindings/JSEnvironmentVariableMap.h @@ -1,6 +1,6 @@ #include "root.h" -namespace Zig { +namespace Rust { class GlobalObject; } @@ -10,6 +10,6 @@ class JSValue; namespace Bun { -JSC::JSValue createEnvironmentVariablesMap(Zig::GlobalObject* globalObject); +JSC::JSValue createEnvironmentVariablesMap(Rust::GlobalObject* globalObject); } diff --git a/src/jsc/bindings/JSFFIFunction.cpp b/src/jsc/bindings/JSFFIFunction.cpp index bbf982c37c7..bee0f5346c4 100644 --- a/src/jsc/bindings/JSFFIFunction.cpp +++ b/src/jsc/bindings/JSFFIFunction.cpp @@ -28,7 +28,7 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -43,10 +43,10 @@ class FFICallbackFunctionWrapper { public: JSC::Strong m_function; - JSC::Strong globalObject; + JSC::Strong globalObject; ~FFICallbackFunctionWrapper() = default; - FFICallbackFunctionWrapper(JSC::JSFunction* function, Zig::GlobalObject* globalObject) + FFICallbackFunctionWrapper(JSC::JSFunction* function, Rust::GlobalObject* globalObject) : m_function(globalObject->vm(), function) , globalObject(globalObject->vm(), globalObject) { @@ -58,7 +58,7 @@ extern "C" void FFICallbackFunctionWrapper_destroy(FFICallbackFunctionWrapper* w } extern "C" FFICallbackFunctionWrapper* Bun__createFFICallbackFunction( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::EncodedJSValue callbackFn) { auto* vm = &globalObject->vm(); @@ -71,15 +71,15 @@ extern "C" FFICallbackFunctionWrapper* Bun__createFFICallbackFunction( return wrapper; } -extern "C" Zig::JSFFIFunction* Bun__CreateFFIFunctionWithData(Zig::GlobalObject* globalObject, const ZigString* symbolName, unsigned argCount, Zig::FFIFunction functionPointer, void* data) +extern "C" Rust::JSFFIFunction* Bun__CreateFFIFunctionWithData(Rust::GlobalObject* globalObject, const RustString* symbolName, unsigned argCount, Rust::FFIFunction functionPointer, void* data) { auto& vm = JSC::getVM(globalObject); - Zig::JSFFIFunction* function = Zig::JSFFIFunction::create(vm, globalObject, argCount, symbolName != nullptr ? Zig::toStringCopy(*symbolName) : String(), functionPointer, JSC::NoIntrinsic); + Rust::JSFFIFunction* function = Rust::JSFFIFunction::create(vm, globalObject, argCount, symbolName != nullptr ? Rust::toStringCopy(*symbolName) : String(), functionPointer, JSC::NoIntrinsic); function->dataPtr = data; return function; } -extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionWithDataValue(Zig::GlobalObject* globalObject, const ZigString* symbolName, unsigned argCount, Zig::FFIFunction functionPointer, void* data) +extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionWithDataValue(Rust::GlobalObject* globalObject, const RustString* symbolName, unsigned argCount, Rust::FFIFunction functionPointer, void* data) { return JSC::JSValue::encode(Bun__CreateFFIFunctionWithData(globalObject, symbolName, argCount, functionPointer, data)); } @@ -87,7 +87,7 @@ extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionWithDataValue(Zig::GlobalOb extern "C" void* Bun__FFIFunction_getDataPtr(JSC::EncodedJSValue jsValue) { - Zig::JSFFIFunction* function = dynamicDowncast(JSC::JSValue::decode(jsValue)); + Rust::JSFFIFunction* function = dynamicDowncast(JSC::JSValue::decode(jsValue)); if (!function) return nullptr; @@ -97,17 +97,17 @@ extern "C" void* Bun__FFIFunction_getDataPtr(JSC::EncodedJSValue jsValue) extern "C" void Bun__FFIFunction_setDataPtr(JSC::EncodedJSValue jsValue, void* ptr) { - Zig::JSFFIFunction* function = dynamicDowncast(JSC::JSValue::decode(jsValue)); + Rust::JSFFIFunction* function = dynamicDowncast(JSC::JSValue::decode(jsValue)); if (!function) return; function->dataPtr = ptr; } -extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionValue(Zig::GlobalObject* globalObject, const ZigString* symbolName, unsigned argCount, Zig::FFIFunction functionPointer, bool addPtrField, void* symbolFromDynamicLibrary) +extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionValue(Rust::GlobalObject* globalObject, const RustString* symbolName, unsigned argCount, Rust::FFIFunction functionPointer, bool addPtrField, void* symbolFromDynamicLibrary) { if (addPtrField) { - auto* function = Zig::JSFFIFunction::createForFFI(globalObject->vm(), globalObject, argCount, symbolName != nullptr ? Zig::toStringCopy(*symbolName) : String(), reinterpret_cast(functionPointer)); + auto* function = Rust::JSFFIFunction::createForFFI(globalObject->vm(), globalObject, argCount, symbolName != nullptr ? Rust::toStringCopy(*symbolName) : String(), reinterpret_cast(functionPointer)); auto& vm = JSC::getVM(globalObject); // We should only expose the "ptr" field when it's a JSCallback for bun:ffi. // Not for internal usages of this function type. @@ -120,7 +120,7 @@ extern "C" JSC::EncodedJSValue Bun__CreateFFIFunctionValue(Zig::GlobalObject* gl return Bun__CreateFFIFunctionWithDataValue(globalObject, symbolName, argCount, functionPointer, nullptr); } -namespace Zig { +namespace Rust { using namespace JSC; const ClassInfo JSFFIFunction::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFFIFunction) }; @@ -149,7 +149,7 @@ void JSFFIFunction::finishCreation(VM& vm, NativeExecutable* executable, unsigne ASSERT(inherits(info())); } -JSFFIFunction* JSFFIFunction::create(VM& vm, Zig::GlobalObject* globalObject, unsigned length, const String& name, FFIFunction FFIFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) +JSFFIFunction* JSFFIFunction::create(VM& vm, Rust::GlobalObject* globalObject, unsigned length, const String& name, FFIFunction FFIFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) { NativeExecutable* executable = vm.getHostFunction(FFIFunction, ImplementationVisibility::Public, intrinsic, FFIFunction, nullptr, name); Structure* structure = globalObject->FFIFunctionStructure(); @@ -168,7 +168,7 @@ JSC_DEFINE_HOST_FUNCTION(JSFFIFunction::trampoline, (JSC::JSGlobalObject * globa #endif -JSFFIFunction* JSFFIFunction::createForFFI(VM& vm, Zig::GlobalObject* globalObject, unsigned length, const String& name, CFFIFunction FFIFunction) +JSFFIFunction* JSFFIFunction::createForFFI(VM& vm, Rust::GlobalObject* globalObject, unsigned length, const String& name, CFFIFunction FFIFunction) { #if OS(WINDOWS) NativeExecutable* executable = vm.getHostFunction(trampoline, ImplementationVisibility::Public, NoIntrinsic, trampoline, nullptr, name); @@ -213,7 +213,7 @@ FFI_Callback_threadsafe_call(FFICallbackFunctionWrapper& wrapper, size_t argCoun argsVec.append(args[i]); WebCore::ScriptExecutionContext::postTaskTo(globalObject->scriptExecutionContext()->identifier(), [argsVec = WTF::move(argsVec), wrapper](WebCore::ScriptExecutionContext& ctx) mutable { - auto* globalObject = uncheckedDowncast(ctx.jsGlobalObject()); + auto* globalObject = uncheckedDowncast(ctx.jsGlobalObject()); auto& vm = JSC::getVM(globalObject); JSC::MarkedArgumentBuffer arguments; auto* function = wrapper.m_function.get(); diff --git a/src/jsc/bindings/JSFFIFunction.h b/src/jsc/bindings/JSFFIFunction.h index 6eccae7b617..d21643c76e2 100644 --- a/src/jsc/bindings/JSFFIFunction.h +++ b/src/jsc/bindings/JSFFIFunction.h @@ -1,6 +1,6 @@ #pragma once -namespace Zig { +namespace Rust { class GlobalObject; } @@ -16,7 +16,7 @@ namespace JSC { class JSGlobalObject; } -namespace Zig { +namespace Rust { using namespace JSC; @@ -69,8 +69,8 @@ class JSFFIFunction final : public JSC::JSFunction { DECLARE_EXPORT_INFO; - JS_EXPORT_PRIVATE static JSFFIFunction* create(VM&, Zig::GlobalObject*, unsigned length, const String& name, FFIFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); - JS_EXPORT_PRIVATE static JSFFIFunction* createForFFI(VM&, Zig::GlobalObject*, unsigned length, const String& name, CFFIFunction); + JS_EXPORT_PRIVATE static JSFFIFunction* create(VM&, Rust::GlobalObject*, unsigned length, const String& name, FFIFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); + JS_EXPORT_PRIVATE static JSFFIFunction* createForFFI(VM&, Rust::GlobalObject*, unsigned length, const String& name, CFFIFunction); static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { diff --git a/src/jsc/bindings/JSMockFunction.cpp b/src/jsc/bindings/JSMockFunction.cpp index 1c1c7fe70f6..08d6820eafb 100644 --- a/src/jsc/bindings/JSMockFunction.cpp +++ b/src/jsc/bindings/JSMockFunction.cpp @@ -4,7 +4,7 @@ #include "JavaScriptCore/Error.h" #include "JSMockFunction.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -233,7 +233,7 @@ class JSMockFunction : public JSC::InternalFunction { using Base = JSC::InternalFunction; static constexpr unsigned StructureFlags = Base::StructureFlags; - static JSMockFunction* create(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::Structure* structure, CallbackKind kind = CallbackKind::Call) + static JSMockFunction* create(JSC::VM& vm, Rust::GlobalObject* globalObject, JSC::Structure* structure, CallbackKind kind = CallbackKind::Call) { JSMockFunction* function = new (NotNull, JSC::allocateCell(vm)) JSMockFunction(vm, structure, kind); function->finishCreation(vm); @@ -324,7 +324,7 @@ class JSMockFunction : public JSC::InternalFunction { mock.initLater( [](const JSC::LazyProperty::Initializer& init) { JSMockFunction* mock = init.owner; - Zig::GlobalObject* globalObject = uncheckedDowncast(mock->globalObject()); + Rust::GlobalObject* globalObject = uncheckedDowncast(mock->globalObject()); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSC::Structure* structure = globalObject->mockModule.mockObjectStructure.getInitializedOnMainThread(globalObject); @@ -509,7 +509,7 @@ DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSMockFunction); static void pushImpl(JSMockFunction* fn, JSGlobalObject* jsGlobalObject, JSMockImplementation::Kind kind, JSValue value) { - Zig::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); auto& vm = JSC::getVM(globalObject); if (auto* current = tryJSDynamicCast(fn->fallbackImplmentation)) { @@ -529,7 +529,7 @@ static void pushImpl(JSMockFunction* fn, JSGlobalObject* jsGlobalObject, JSMockI static void pushImplOnce(JSMockFunction* fn, JSGlobalObject* jsGlobalObject, JSMockImplementation::Kind kind, JSValue value) { - Zig::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); auto& vm = JSC::getVM(globalObject); JSMockImplementation* impl = JSMockImplementation::create(globalObject, globalObject->mockModule.mockImplementationStructure.getInitializedOnMainThread(globalObject), kind, value, true); @@ -616,7 +616,7 @@ static SpyWeakHandleOwner& weakValueHandleOwner() const ClassInfo JSMockFunctionPrototype::s_info = { "Mock"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMockFunctionPrototype) }; -extern "C" void JSMock__resetSpies(Zig::GlobalObject* globalObject) +extern "C" void JSMock__resetSpies(Rust::GlobalObject* globalObject) { if (!globalObject->mockModule.activeSpies) { return; @@ -639,7 +639,7 @@ extern "C" void JSMock__resetSpies(Zig::GlobalObject* globalObject) globalObject->mockModule.activeSpies.clear(); } -extern "C" void JSMock__clearAllMocks(Zig::GlobalObject* globalObject) +extern "C" void JSMock__clearAllMocks(Rust::GlobalObject* globalObject) { if (!globalObject->mockModule.activeMocks) { return; @@ -675,7 +675,7 @@ JSMockModule JSMockModule::create(JSC::JSGlobalObject* globalObject) }); mock.mockResultStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - Zig::GlobalObject* globalObject = uncheckedDowncast(init.owner); + Rust::GlobalObject* globalObject = uncheckedDowncast(init.owner); JSC::Structure* structure = globalObject->structureCache().emptyObjectStructureForPrototype( globalObject, globalObject->objectPrototype(), @@ -717,7 +717,7 @@ JSMockModule JSMockModule::create(JSC::JSGlobalObject* globalObject) }); mock.mockObjectStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - Zig::GlobalObject* globalObject = uncheckedDowncast(init.owner); + Rust::GlobalObject* globalObject = uncheckedDowncast(init.owner); auto* prototype = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype()); // `putDirectCustomAccessor` doesn't pass the `this` value as expected. unfortunatly we @@ -816,7 +816,7 @@ extern Structure* createMockResultStructure(JSC::VM& vm, JSC::JSGlobalObject* gl return structure; } -static JSValue createMockResult(JSC::VM& vm, Zig::GlobalObject* globalObject, const WTF::String& type, JSC::JSValue value) +static JSValue createMockResult(JSC::VM& vm, Rust::GlobalObject* globalObject, const WTF::String& type, JSC::JSValue value) { JSC::Structure* structure = globalObject->mockModule.mockResultStructure.getInitializedOnMainThread(globalObject); @@ -828,7 +828,7 @@ static JSValue createMockResult(JSC::VM& vm, Zig::GlobalObject* globalObject, co JSC_DEFINE_HOST_FUNCTION(jsMockFunctionCall, (JSGlobalObject * lexicalGlobalObject, CallFrame* callframe)) { - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); JSMockFunction* fn = dynamicDowncast(callframe->jsCallee()); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1038,7 +1038,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsMockFunctionGetter_protoImpl, (JSC::JSGlobalObject * return JSValue::encode(jsUndefined()); } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSMockFunction__getCalls(JSC::JSGlobalObject* globalThis, EncodedJSValue encodedValue) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSMockFunction__getCalls(JSC::JSGlobalObject* globalThis, EncodedJSValue encodedValue) { auto scope = DECLARE_THROW_SCOPE(globalThis->vm()); JSValue value = JSValue::decode(encodedValue); @@ -1047,7 +1047,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSMockFunction__get } return encodedJSUndefined(); } -extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSMockFunction__getReturns(JSC::JSGlobalObject* globalThis, EncodedJSValue encodedValue) +extern "C" [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSMockFunction__getReturns(JSC::JSGlobalObject* globalThis, EncodedJSValue encodedValue) { auto scope = DECLARE_THROW_SCOPE(globalThis->vm()); JSValue value = JSValue::decode(encodedValue); @@ -1115,7 +1115,7 @@ JSC_DEFINE_HOST_FUNCTION(jsMockFunctionMockRestore, (JSC::JSGlobalObject * globa JSC_DEFINE_HOST_FUNCTION(jsMockFunctionMockImplementation, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callframe)) { auto& vm = JSC::getVM(lexicalGlobalObject); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); JSValue thisValue = callframe->thisValue(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1137,7 +1137,7 @@ JSC_DEFINE_HOST_FUNCTION(jsMockFunctionMockImplementation, (JSC::JSGlobalObject JSC_DEFINE_HOST_FUNCTION(jsMockFunctionMockImplementationOnce, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callframe)) { auto& vm = JSC::getVM(lexicalGlobalObject); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); JSValue thisValue = callframe->thisValue(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1336,7 +1336,7 @@ DEFINE_VISIT_CHILDREN(MockWithImplementationCleanupData); MockWithImplementationCleanupData* MockWithImplementationCleanupData::create(JSC::JSGlobalObject* globalObject, JSMockFunction* fn, JSValue impl, JSValue tail, JSValue fallback) { - auto* obj = create(globalObject->vm(), static_cast(globalObject)->mockModule.mockWithImplementationCleanupDataStructure.getInitializedOnMainThread(globalObject)); + auto* obj = create(globalObject->vm(), static_cast(globalObject)->mockModule.mockWithImplementationCleanupDataStructure.getInitializedOnMainThread(globalObject)); obj->finishCreation(globalObject->vm(), fn, impl, tail, fallback); return obj; } @@ -1358,7 +1358,7 @@ JSC_DEFINE_HOST_FUNCTION(jsMockFunctionWithImplementationCleanup, (JSC::JSGlobal } JSC_DEFINE_HOST_FUNCTION(jsMockFunctionWithImplementation, (JSC::JSGlobalObject * jsGlobalObject, JSC::CallFrame* callframe)) { - Zig::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(jsGlobalObject); JSValue thisValue = callframe->thisValue(); JSMockFunction* thisObject = dynamicDowncast(thisValue); @@ -1431,14 +1431,14 @@ BUN_DEFINE_HOST_FUNCTION(JSMock__jsUseRealTimers, (JSC::JSGlobalObject * globalO return JSValue::encode(callframe->thisValue()); } -// Helper function for Zig to set the overriden Date.now() time -extern "C" [[ZIG_EXPORT(nothrow)]] void JSMock__setOverridenDateNow(JSC::JSGlobalObject* globalObject, double time_ms) +// Helper function for Rust to set the overriden Date.now() time +extern "C" [[RUST_EXPORT(nothrow)]] void JSMock__setOverridenDateNow(JSC::JSGlobalObject* globalObject, double time_ms) { globalObject->overridenDateNow = time_ms; } -// Helper function for Zig to get the current Unix epoch time in milliseconds -extern "C" [[ZIG_EXPORT(nothrow)]] double JSMock__getCurrentUnixTimeMs() +// Helper function for Rust to get the current Unix epoch time in milliseconds +extern "C" [[RUST_EXPORT(nothrow)]] double JSMock__getCurrentUnixTimeMs() { return WTF::WallTime::now().secondsSinceEpoch().milliseconds(); } @@ -1465,13 +1465,13 @@ BUN_DEFINE_HOST_FUNCTION(JSMock__jsSetSystemTime, (JSC::JSGlobalObject * globalO BUN_DEFINE_HOST_FUNCTION(JSMock__jsRestoreAllMocks, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - JSMock__resetSpies(uncheckedDowncast(globalObject)); + JSMock__resetSpies(uncheckedDowncast(globalObject)); return JSValue::encode(jsUndefined()); } BUN_DEFINE_HOST_FUNCTION(JSMock__jsClearAllMocks, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - JSMock__clearAllMocks(uncheckedDowncast(globalObject)); + JSMock__clearAllMocks(uncheckedDowncast(globalObject)); return JSValue::encode(jsUndefined()); } @@ -1480,7 +1480,7 @@ BUN_DEFINE_HOST_FUNCTION(JSMock__jsSpyOn, (JSC::JSGlobalObject * lexicalGlobalOb auto& vm = JSC::getVM(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = dynamicDowncast(lexicalGlobalObject); + auto* globalObject = dynamicDowncast(lexicalGlobalObject); if (!globalObject) [[unlikely]] { throwVMError(globalObject, scope, "Cannot run spyOn from a different global context"_s); return {}; @@ -1604,7 +1604,7 @@ BUN_DEFINE_HOST_FUNCTION(JSMock__jsSpyOn, (JSC::JSGlobalObject * lexicalGlobalOb BUN_DEFINE_HOST_FUNCTION(JSMock__jsMockFn, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callframe)) { auto& vm = JSC::getVM(lexicalGlobalObject); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSMockFunction* thisObject = JSMockFunction::create( diff --git a/src/jsc/bindings/JSMockFunction.h b/src/jsc/bindings/JSMockFunction.h index 2cfc44c89f0..e858be913eb 100644 --- a/src/jsc/bindings/JSMockFunction.h +++ b/src/jsc/bindings/JSMockFunction.h @@ -46,7 +46,7 @@ class JSMockModule final { // This list includes activeSpies JSC::Strong activeMocks; - // Called by Zig::GlobalObject::visitChildren + // Called by Rust::GlobalObject::visitChildren template void visit(Visitor& visitor); }; diff --git a/src/jsc/bindings/JSNodePerformanceHooksHistogram.cpp b/src/jsc/bindings/JSNodePerformanceHooksHistogram.cpp index b329eb2087f..6e72df7235f 100644 --- a/src/jsc/bindings/JSNodePerformanceHooksHistogram.cpp +++ b/src/jsc/bindings/JSNodePerformanceHooksHistogram.cpp @@ -3,7 +3,7 @@ #include "JSNodePerformanceHooksHistogram.h" #include "JSNodePerformanceHooksHistogramPrototype.h" #include "JSNodePerformanceHooksHistogramConstructor.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "BunString.h" #include "JSDOMExceptionHandling.h" diff --git a/src/jsc/bindings/JSNodePerformanceHooksHistogramConstructor.cpp b/src/jsc/bindings/JSNodePerformanceHooksHistogramConstructor.cpp index 0962a5aa228..85f687914b3 100644 --- a/src/jsc/bindings/JSNodePerformanceHooksHistogramConstructor.cpp +++ b/src/jsc/bindings/JSNodePerformanceHooksHistogramConstructor.cpp @@ -3,7 +3,7 @@ #include "JSNodePerformanceHooksHistogramConstructor.h" #include "JSNodePerformanceHooksHistogram.h" #include "JSNodePerformanceHooksHistogramPrototype.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "BunString.h" #include "wtf/text/ASCIILiteral.h" @@ -66,8 +66,8 @@ static JSNodePerformanceHooksHistogram* createHistogramInternal(JSGlobalObject* } } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(rustGlobalObject); RETURN_IF_EXCEPTION(scope, nullptr); return JSNodePerformanceHooksHistogram::create(vm, structure, globalObject, lowest, highest, figures); diff --git a/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.cpp b/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.cpp index dd071fca50a..69d41311077 100644 --- a/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.cpp +++ b/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.cpp @@ -413,8 +413,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_createHistogram, (JSGlobalObject * globalObj } } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(rustGlobalObject); RETURN_IF_EXCEPTION(scope, {}); JSNodePerformanceHooksHistogram* histogram = JSNodePerformanceHooksHistogram::create(vm, structure, globalObject, lowest, highest, figures); @@ -423,7 +423,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_createHistogram, (JSGlobalObject * globalObj return JSValue::encode(histogram); } -// Extern declarations for Timer.zig +// Extern declarations for Timer.rust extern "C" void Timer_enableEventLoopDelayMonitoring(void* vm, JSC::EncodedJSValue histogram, int32_t resolution); extern "C" void Timer_disableEventLoopDelayMonitoring(void* vm); @@ -445,8 +445,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_monitorEventLoopDelay, (JSGlobalObject * glo } // Create histogram with range for event loop delays (1ns to 1 hour) - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->m_JSNodePerformanceHooksHistogramClassStructure.get(rustGlobalObject); RETURN_IF_EXCEPTION(scope, {}); JSNodePerformanceHooksHistogram* histogram = JSNodePerformanceHooksHistogram::create( @@ -486,7 +486,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_enableEventLoopDelay, (JSGlobalObject * glob // Reset histogram data on enable histogram->reset(); - // Enable the event loop delay monitor in Timer.zig + // Enable the event loop delay monitor in Timer.rust Timer_enableEventLoopDelayMonitoring(bunVM(globalObject), JSValue::encode(histogram), resolution); RELEASE_AND_RETURN(scope, JSValue::encode(jsUndefined())); @@ -511,13 +511,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_disableEventLoopDelay, (JSGlobalObject * glo return JSValue::encode(jsUndefined()); } - // Call into Zig to disable monitoring + // Call into Rust to disable monitoring Timer_disableEventLoopDelayMonitoring(bunVM(globalObject)); return JSValue::encode(jsUndefined()); } -// Extern function for Zig to record delays +// Extern function for Rust to record delays extern "C" void JSNodePerformanceHooksHistogram_recordDelay(JSC::EncodedJSValue histogram, int64_t delay_ns) { if (!histogram || delay_ns <= 0) return; diff --git a/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.h b/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.h index ad165d5a3a7..e9a6614736d 100644 --- a/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.h +++ b/src/jsc/bindings/JSNodePerformanceHooksHistogramPrototype.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { diff --git a/src/jsc/bindings/JSPropertyIterator.cpp b/src/jsc/bindings/JSPropertyIterator.cpp index e4de689c18f..7d6943cdde4 100644 --- a/src/jsc/bindings/JSPropertyIterator.cpp +++ b/src/jsc/bindings/JSPropertyIterator.cpp @@ -1,7 +1,7 @@ #include "root.h" #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/JSType.h" #include "JavaScriptCore/EnumerationMode.h" #include "JavaScriptCore/ExceptionScope.h" @@ -55,9 +55,9 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje #if OS(WINDOWS) if (object->type() == JSC::ProxyObjectType) [[unlikely]] { // Check if we're actually iterating through the JSEnvironmentVariableMap's proxy. - auto* zigGlobal = defaultGlobalObject(globalObject); - if (zigGlobal->m_processEnvObject.isInitialized()) { - if (object == zigGlobal->m_processEnvObject.get(zigGlobal)) { + auto* rustGlobal = defaultGlobalObject(globalObject); + if (rustGlobal->m_processEnvObject.isInitialized()) { + if (object == rustGlobal->m_processEnvObject.get(rustGlobal)) { object->methodTable()->getOwnPropertyNames( object, globalObject, diff --git a/src/jsc/bindings/JSReactElement.cpp b/src/jsc/bindings/JSReactElement.cpp index b567c0542c3..c66d0c18f12 100644 --- a/src/jsc/bindings/JSReactElement.cpp +++ b/src/jsc/bindings/JSReactElement.cpp @@ -83,7 +83,7 @@ extern "C" JSC::EncodedJSValue JSReactElement__create( EncodedJSValue type, EncodedJSValue props) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSObject* element = constructEmptyObject(vm, global->JSReactElementStructure()); @@ -101,7 +101,7 @@ extern "C" JSC::EncodedJSValue JSReactElement__createFragment( uint8_t reactVersion, EncodedJSValue children) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); VM& vm = global->vm(); JSC::Symbol* fragmentSymbol = JSC::Symbol::create(vm, diff --git a/src/jsc/bindings/JSReactElement.h b/src/jsc/bindings/JSReactElement.h index c3e0e726c88..5b9a832e925 100644 --- a/src/jsc/bindings/JSReactElement.h +++ b/src/jsc/bindings/JSReactElement.h @@ -2,7 +2,7 @@ #include "root.h" #include "headers.h" #include "JavaScriptCore/JSObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" using namespace JSC; diff --git a/src/jsc/bindings/JSS3File.cpp b/src/jsc/bindings/JSS3File.cpp index aecfc1de924..ece778c2753 100644 --- a/src/jsc/bindings/JSS3File.cpp +++ b/src/jsc/bindings/JSS3File.cpp @@ -1,8 +1,8 @@ #include "root.h" -#include "ZigGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGlobalObject.h" +#include "RustGeneratedClasses.h" #include "JavaScriptCore/JSType.h" #include "JavaScriptCore/JSObject.h" diff --git a/src/jsc/bindings/JSS3File.h b/src/jsc/bindings/JSS3File.h index 8ba8c2839d8..d0fc47b6aac 100644 --- a/src/jsc/bindings/JSS3File.h +++ b/src/jsc/bindings/JSS3File.h @@ -1,6 +1,6 @@ #pragma once -namespace Zig { +namespace Rust { class GlobalObject; } diff --git a/src/jsc/bindings/JSSecrets.cpp b/src/jsc/bindings/JSSecrets.cpp index de855e55876..76482e72936 100644 --- a/src/jsc/bindings/JSSecrets.cpp +++ b/src/jsc/bindings/JSSecrets.cpp @@ -1,7 +1,7 @@ #include "ErrorCode.h" #include "root.h" #include "Secrets.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include @@ -234,7 +234,7 @@ struct SecretsJobOptions { } }; -// C interface implementation for Zig binding +// C interface implementation for Rust binding extern "C" { // Runs on the threadpool - does the actual platform API work @@ -315,7 +315,7 @@ void Bun__SecretsJobOptions__deinit(SecretsJobOptions* opts) delete opts; } -// Zig binding exports +// Rust binding exports void Bun__Secrets__scheduleJob(JSGlobalObject* global, SecretsJobOptions* opts, EncodedJSValue promise); } // extern "C" diff --git a/src/jsc/bindings/JSSocketAddressDTO.cpp b/src/jsc/bindings/JSSocketAddressDTO.cpp index 5ab09090a54..a7218f79f5f 100644 --- a/src/jsc/bindings/JSSocketAddressDTO.cpp +++ b/src/jsc/bindings/JSSocketAddressDTO.cpp @@ -13,7 +13,7 @@ static constexpr PropertyOffset addressOffset = 0; static constexpr PropertyOffset familyOffset = 1; static constexpr PropertyOffset portOffset = 2; -JSObject* create(Zig::GlobalObject* globalObject, JSString* value, int32_t port, bool isIPv6) +JSObject* create(Rust::GlobalObject* globalObject, JSString* value, int32_t port, bool isIPv6) { static const NeverDestroyed IPv4 = MAKE_STATIC_STRING_IMPL("IPv4"); static const NeverDestroyed IPv6 = MAKE_STATIC_STRING_IMPL("IPv6"); @@ -70,7 +70,7 @@ Structure* createStructure(VM& vm, JSGlobalObject* globalObject) extern "C" JSC::EncodedJSValue JSSocketAddressDTO__create(JSGlobalObject* globalObject, EncodedJSValue address, uint16_t port, bool isIPv6) { VM& vm = globalObject->vm(); - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); auto* af = isIPv6 ? global->commonStrings().IPv6String(global) : global->commonStrings().IPv4String(global); diff --git a/src/jsc/bindings/JSSocketAddressDTO.h b/src/jsc/bindings/JSSocketAddressDTO.h index 6fe868bac49..44d3050008f 100644 --- a/src/jsc/bindings/JSSocketAddressDTO.h +++ b/src/jsc/bindings/JSSocketAddressDTO.h @@ -3,7 +3,7 @@ #include "headers.h" #include "root.h" #include "JavaScriptCore/JSObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" using namespace JSC; @@ -11,7 +11,7 @@ namespace Bun { namespace JSSocketAddressDTO { Structure* createStructure(VM& vm, JSGlobalObject* globalObject); -JSObject* create(Zig::GlobalObject* globalObject, JSString* value, int port, bool isIPv6); +JSObject* create(Rust::GlobalObject* globalObject, JSString* value, int port, bool isIPv6); } // namespace JSSocketAddress } // namespace Bun diff --git a/src/jsc/bindings/JSStringDecoder.cpp b/src/jsc/bindings/JSStringDecoder.cpp index 23c7ac85be7..9491452f15e 100644 --- a/src/jsc/bindings/JSStringDecoder.cpp +++ b/src/jsc/bindings/JSStringDecoder.cpp @@ -3,7 +3,7 @@ #include #include #include "JavaScriptCore/ExceptionScope.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMOperation.h" #include "JSDOMAttribute.h" #include "headers.h" @@ -496,7 +496,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi JSStringDecoder* castedThis = jsStringDecoderCast(lexicalGlobalObject, JSC::JSValue::decode(thisValue), "lastChar"_s); RETURN_IF_EXCEPTION(scope, {}); auto buffer = ArrayBuffer::create({ castedThis->m_lastChar, 4 }); - auto* globalObject = static_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(buffer), 0, 4); RELEASE_AND_RETURN(scope, JSC::JSValue::encode(uint8Array)); } @@ -579,7 +579,7 @@ JSC::EncodedJSValue JSStringDecoderConstructor::construct(JSC::JSGlobalObject* l } } JSValue thisValue = callFrame->newTarget(); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); JSObject* newTarget = asObject(thisValue); auto* constructor = globalObject->JSStringDecoder(); Structure* structure = globalObject->JSStringDecoderStructure(); @@ -614,4 +614,4 @@ void JSStringDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObjec const ClassInfo JSStringDecoderConstructor::s_info = { "StringDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStringDecoderConstructor) }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/JSWrappingFunction.cpp b/src/jsc/bindings/JSWrappingFunction.cpp index 2fda7a7c169..35ace5487b6 100644 --- a/src/jsc/bindings/JSWrappingFunction.cpp +++ b/src/jsc/bindings/JSWrappingFunction.cpp @@ -1,5 +1,5 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSWrappingFunction.h" #include @@ -12,16 +12,16 @@ #include #include -namespace Zig { +namespace Rust { using namespace JSC; const ClassInfo JSWrappingFunction::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWrappingFunction) }; JS_EXPORT_PRIVATE JSWrappingFunction* JSWrappingFunction::create( VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const BunString* symbolName, - Zig::NativeFunctionPtr functionPointer, + Rust::NativeFunctionPtr functionPointer, JSC::JSValue wrappedFnValue) { JSC::JSObject* wrappedFn = wrappedFnValue.getObject(); @@ -59,7 +59,7 @@ void JSWrappingFunction::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSWrappingFunction); extern "C" JSC::EncodedJSValue Bun__JSWrappingFunction__create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, const BunString* symbolName, Bun::NativeFunctionPtr functionPointer, JSC::EncodedJSValue wrappedFnEncoded) @@ -72,7 +72,7 @@ extern "C" JSC::EncodedJSValue Bun__JSWrappingFunction__create( extern "C" JSC::EncodedJSValue Bun__JSWrappingFunction__getWrappedFunction( JSC::EncodedJSValue thisValueEncoded, - Zig::GlobalObject* globalObject) + Rust::GlobalObject* globalObject) { JSC::JSValue thisValue = JSC::JSValue::decode(thisValueEncoded); JSWrappingFunction* thisObject = dynamicDowncast(thisValue.asCell()); diff --git a/src/jsc/bindings/JSWrappingFunction.h b/src/jsc/bindings/JSWrappingFunction.h index 5b2aec591ba..72e1a9c27a2 100644 --- a/src/jsc/bindings/JSWrappingFunction.h +++ b/src/jsc/bindings/JSWrappingFunction.h @@ -1,6 +1,6 @@ #pragma once -namespace Zig { +namespace Rust { class GlobalObject; } @@ -16,7 +16,7 @@ namespace JSC { class JSGlobalObject; } -namespace Zig { +namespace Rust { using NativeFunctionPtr = SYSV_ABI JSC::EncodedJSValue (*)(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame); @@ -50,7 +50,7 @@ class JSWrappingFunction final : public JSC::JSFunction { } DECLARE_EXPORT_INFO; - static JSWrappingFunction* create(JSC::VM& vm, Zig::GlobalObject* globalObject, const BunString* symbolName, NativeFunctionPtr functionPointer, JSC::JSValue wrappedFn); + static JSWrappingFunction* create(JSC::VM& vm, Rust::GlobalObject* globalObject, const BunString* symbolName, NativeFunctionPtr functionPointer, JSC::JSValue wrappedFn); static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { diff --git a/src/jsc/bindings/JSX509Certificate.cpp b/src/jsc/bindings/JSX509Certificate.cpp index e5fe404bd4b..7e3042c5c18 100644 --- a/src/jsc/bindings/JSX509Certificate.cpp +++ b/src/jsc/bindings/JSX509Certificate.cpp @@ -9,7 +9,7 @@ #include "ErrorCode.h" #include "JSX509Certificate.h" #include "JSX509CertificatePrototype.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "wtf/Assertions.h" #include "wtf/SharedTask.h" #include "wtf/text/ASCIILiteral.h" @@ -155,10 +155,10 @@ JSC_DEFINE_HOST_FUNCTION(x509CertificateConstructorConstruct, (JSGlobalObject * return {}; } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->m_JSX509CertificateClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->m_JSX509CertificateClassStructure.get(rustGlobalObject); JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSX509CertificateClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSX509CertificateClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor X509Certificate cannot be invoked without 'new'"_s); return {}; @@ -1174,8 +1174,8 @@ extern "C" EncodedJSValue Bun__X509__toJSLegacyEncoding(X509* cert, JSGlobalObje extern "C" EncodedJSValue Bun__X509__toJS(X509* cert, JSGlobalObject* globalObject) { ncrypto::X509Pointer cert_ptr(cert); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - return JSValue::encode(JSX509Certificate::create(zigGlobalObject->vm(), zigGlobalObject->m_JSX509CertificateClassStructure.get(zigGlobalObject), globalObject, WTF::move(cert_ptr))); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + return JSValue::encode(JSX509Certificate::create(rustGlobalObject->vm(), rustGlobalObject->m_JSX509CertificateClassStructure.get(rustGlobalObject), globalObject, WTF::move(cert_ptr))); } JSC_DEFINE_HOST_FUNCTION(jsIsX509Certificate, (JSGlobalObject * globalObject, CallFrame* callFrame)) diff --git a/src/jsc/bindings/JSX509Certificate.h b/src/jsc/bindings/JSX509Certificate.h index 09843740871..a7a171eef2f 100644 --- a/src/jsc/bindings/JSX509Certificate.h +++ b/src/jsc/bindings/JSX509Certificate.h @@ -13,7 +13,7 @@ #include #include "KeyObject.h" -namespace Zig { +namespace Rust { class GlobalObject; } diff --git a/src/jsc/bindings/JSX509CertificateConstructor.cpp b/src/jsc/bindings/JSX509CertificateConstructor.cpp index 04b7fc1fb85..cc11626471c 100644 --- a/src/jsc/bindings/JSX509CertificateConstructor.cpp +++ b/src/jsc/bindings/JSX509CertificateConstructor.cpp @@ -1,7 +1,7 @@ #include "root.h" #include "JSX509CertificateConstructor.h" #include "JSX509Certificate.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include namespace Bun { diff --git a/src/jsc/bindings/JSX509CertificateConstructor.h b/src/jsc/bindings/JSX509CertificateConstructor.h index ee740d0ee1a..46d91127713 100644 --- a/src/jsc/bindings/JSX509CertificateConstructor.h +++ b/src/jsc/bindings/JSX509CertificateConstructor.h @@ -4,7 +4,7 @@ #include #include -namespace Zig { +namespace Rust { class GlobalObject; } diff --git a/src/jsc/bindings/JSX509CertificatePrototype.cpp b/src/jsc/bindings/JSX509CertificatePrototype.cpp index 9d45bf9ab15..1cab08a8dd8 100644 --- a/src/jsc/bindings/JSX509CertificatePrototype.cpp +++ b/src/jsc/bindings/JSX509CertificatePrototype.cpp @@ -3,7 +3,7 @@ #include "root.h" #include "JSDOMExceptionHandling.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ncrypto.h" #include "JSX509Certificate.h" #include "JSX509CertificatePrototype.h" diff --git a/src/jsc/bindings/ModuleLoader.cpp b/src/jsc/bindings/ModuleLoader.cpp index 30d7fe37d59..51eec309cb4 100644 --- a/src/jsc/bindings/ModuleLoader.cpp +++ b/src/jsc/bindings/ModuleLoader.cpp @@ -4,14 +4,14 @@ #include "JavaScriptCore/JSGlobalObject.h" #include "ModuleLoader.h" #include "JavaScriptCore/Identifier.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include #include #include -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" #include #include @@ -45,7 +45,7 @@ namespace Bun { using namespace JSC; -using namespace Zig; +using namespace Rust; using namespace WebCore; class ResolvedSourceCodeHolder { @@ -130,7 +130,7 @@ static JSC::SyntheticSourceProvider::SyntheticSourceGenerator generateInternalMo }; } -static OnLoadResult handleOnLoadObjectResult(Zig::GlobalObject* globalObject, JSC::JSObject* object) +static OnLoadResult handleOnLoadObjectResult(Rust::GlobalObject* globalObject, JSC::JSObject* object) { OnLoadResult result {}; result.type = OnLoadResultTypeObject; @@ -199,13 +199,13 @@ DEFINE_VISIT_CHILDREN(PendingVirtualModuleResult); PendingVirtualModuleResult* PendingVirtualModuleResult::create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer, bool wasModuleLock) { - auto* virtualModule = create(globalObject->vm(), static_cast(globalObject)->pendingVirtualModuleResultStructure()); + auto* virtualModule = create(globalObject->vm(), static_cast(globalObject)->pendingVirtualModuleResultStructure()); virtualModule->finishCreation(globalObject->vm(), specifier, referrer); virtualModule->wasModuleMock = wasModuleLock; return virtualModule; } -OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC::JSValue objectValue, BunString* specifier, bool wasModuleMock) +OnLoadResult handleOnLoadResultNotPromise(Rust::GlobalObject* globalObject, JSC::JSValue objectValue, BunString* specifier, bool wasModuleMock) { OnLoadResult result = {}; result.type = OnLoadResultTypeError; @@ -297,11 +297,11 @@ OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC:: if (contentsValue) { if (contentsValue.isString()) { if (JSC::JSString* contentsJSString = contentsValue.toStringOrNull(globalObject)) { - result.value.sourceText.string = Zig::toZigString(contentsJSString, globalObject); + result.value.sourceText.string = Rust::toRustString(contentsJSString, globalObject); result.value.sourceText.value = contentsValue; } } else if (JSC::JSArrayBufferView* view = dynamicDowncast(contentsValue)) { - result.value.sourceText.string = ZigString { reinterpret_cast(view->vector()), view->byteLength() }; + result.value.sourceText.string = RustString { reinterpret_cast(view->vector()), view->byteLength() }; result.value.sourceText.value = contentsValue; } } @@ -317,7 +317,7 @@ OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC:: return result; } -static OnLoadResult handleOnLoadResult(Zig::GlobalObject* globalObject, JSC::JSValue objectValue, BunString* specifier, bool wasModuleMock = false) +static OnLoadResult handleOnLoadResult(Rust::GlobalObject* globalObject, JSC::JSValue objectValue, BunString* specifier, bool wasModuleMock = false) { if (dynamicDowncast(objectValue)) { OnLoadResult result = {}; @@ -332,7 +332,7 @@ static OnLoadResult handleOnLoadResult(Zig::GlobalObject* globalObject, JSC::JSV template static JSValue handleVirtualModuleResult( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSValue virtualModuleResult, ErrorableResolvedSource* res, BunString* specifier, @@ -392,7 +392,7 @@ static JSValue handleVirtualModuleResult( RELEASE_AND_RETURN(scope, reject(JSValue::decode(res->result.err.value))); } - auto provider = Zig::SourceProvider::create(globalObject, res->result.value); + auto provider = Rust::SourceProvider::create(globalObject, res->result.value); return resolve(JSC::JSSourceCode::create(vm, JSC::SourceCode(provider))); } case OnLoadResultTypeError: { @@ -458,7 +458,7 @@ static JSValue handleVirtualModuleResult( } extern "C" void Bun__onFulfillAsyncModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::EncodedJSValue encodedPromiseValue, ErrorableResolvedSource* res, BunString* specifier, @@ -507,7 +507,7 @@ extern "C" void Bun__onFulfillAsyncModule( } } } else { - auto provider = Zig::SourceProvider::create(globalObject, res->result.value); + auto provider = Rust::SourceProvider::create(globalObject, res->result.value); if (Bun::IsolatedModuleCache::canUse(vm, globalObject->bunVM())) { Bun::IsolatedModuleCache::insert(vm, specifier->toWTFString(BunString::ZeroCopy), provider.get()); } @@ -517,7 +517,7 @@ extern "C" void Bun__onFulfillAsyncModule( } JSValue fetchBuiltinModuleWithoutResolution( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, ErrorableResolvedSource* res) { @@ -567,7 +567,7 @@ JSValue fetchBuiltinModuleWithoutResolution( } JSValue resolveAndFetchBuiltinModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier) { void* bunVM = globalObject->bunVM(); @@ -614,7 +614,7 @@ JSValue resolveAndFetchBuiltinModule( } void evaluateCommonJSCustomExtension( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSCommonJSModule* target, String filename, JSValue filenameValue, @@ -639,7 +639,7 @@ void evaluateCommonJSCustomExtension( } JSValue fetchCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSCommonJSModule* target, JSValue specifierValue, String specifierWtfString, @@ -799,7 +799,7 @@ template JSValue fetchCommonJSModuleNonBuiltin( void* bunVM, JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, JSC::JSValue specifierValue, BunString* referrer, @@ -869,7 +869,7 @@ JSValue fetchCommonJSModuleNonBuiltin( RELEASE_AND_RETURN(scope, target); } - auto&& provider = Zig::SourceProvider::create(globalObject, res->result.value); + auto&& provider = Rust::SourceProvider::create(globalObject, res->result.value); if (Bun::IsolatedModuleCache::canUse(vm, bunVM, typeAttribute)) Bun::IsolatedModuleCache::insert(vm, specifierWtfString, provider.get()); // provideFetch() now drives the C++ loader pipeline (parse -> module record) @@ -893,7 +893,7 @@ JSValue fetchCommonJSModuleNonBuiltin( template JSValue fetchCommonJSModuleNonBuiltin( void* bunVM, JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, JSC::JSValue specifierValue, BunString* referrer, @@ -906,7 +906,7 @@ template JSValue fetchCommonJSModuleNonBuiltin( template JSValue fetchCommonJSModuleNonBuiltin( void* bunVM, JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, JSC::JSValue specifierValue, BunString* referrer, @@ -921,7 +921,7 @@ extern "C" bool isBunTest; template static JSValue fetchESMSourceCode( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierJS, ErrorableResolvedSource* res, BunString* specifier, @@ -1015,7 +1015,7 @@ static JSValue fetchESMSourceCode( auto tag = res->result.value.tag; switch (tag) { case SyntheticModuleType::ESM: { - auto&& provider = Zig::SourceProvider::create(globalObject, res->result.value, JSC::SourceProviderSourceType::Module, true); + auto&& provider = Rust::SourceProvider::create(globalObject, res->result.value, JSC::SourceProviderSourceType::Module, true); if (useIsolationCacheForBuiltin) Bun::IsolatedModuleCache::insert(vm, moduleKey, provider.get()); RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, JSC::SourceCode(provider)))); @@ -1036,7 +1036,7 @@ static JSValue fetchESMSourceCode( auto source = JSC::SourceCode(JSC::SyntheticSourceProvider::create(generateInternalModuleSourceCode(globalObject, static_cast(tag & mask)), JSC::SourceOrigin(URL(makeString("builtins://"_s, moduleKey))), moduleKey)); RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTF::move(source)))); } else { - auto&& provider = Zig::SourceProvider::create(globalObject, res->result.value, JSC::SourceProviderSourceType::Module, true); + auto&& provider = Rust::SourceProvider::create(globalObject, res->result.value, JSC::SourceProviderSourceType::Module, true); if (useIsolationCacheForBuiltin) Bun::IsolatedModuleCache::insert(vm, moduleKey, provider.get()); RELEASE_AND_RETURN(scope, rejectOrResolve(JSC::JSSourceCode::create(vm, JSC::SourceCode(provider)))); @@ -1177,7 +1177,7 @@ static JSValue fetchESMSourceCode( RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTF::move(source)))); } - auto provider = Zig::SourceProvider::create(globalObject, res->result.value); + auto provider = Rust::SourceProvider::create(globalObject, res->result.value); if (useIsolationCache) { Bun::IsolatedModuleCache::insert(vm, specifier->toWTFString(BunString::ZeroCopy), provider.get()); } @@ -1185,7 +1185,7 @@ static JSValue fetchESMSourceCode( } JSValue fetchESMSourceCodeSync( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierJS, ErrorableResolvedSource* res, BunString* specifier, @@ -1196,7 +1196,7 @@ JSValue fetchESMSourceCodeSync( } JSValue fetchESMSourceCodeAsync( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::JSString* specifierJS, ErrorableResolvedSource* res, BunString* specifier, @@ -1242,7 +1242,7 @@ BUN_DEFINE_HOST_FUNCTION(jsFunctionOnLoadObjectResultResolve, (JSC::JSGlobalObje bool wasModuleMock = pendingModule->wasModuleMock; - JSC::JSValue result = handleVirtualModuleResult(static_cast(globalObject), objectResult, &res, &specifier, &referrer, wasModuleMock); + JSC::JSValue result = handleVirtualModuleResult(static_cast(globalObject), objectResult, &res, &specifier, &referrer, wasModuleMock); if (!scope.exception() && !res.success) [[unlikely]] { throwException(globalObject, scope, result); } diff --git a/src/jsc/bindings/ModuleLoader.h b/src/jsc/bindings/ModuleLoader.h index 5f8380c6724..df292c6bbb5 100644 --- a/src/jsc/bindings/ModuleLoader.h +++ b/src/jsc/bindings/ModuleLoader.h @@ -10,7 +10,7 @@ BUN_DECLARE_HOST_FUNCTION(jsFunctionOnLoadObjectResultResolve); BUN_DECLARE_HOST_FUNCTION(jsFunctionOnLoadObjectResultReject); BUN_DECLARE_HOST_FUNCTION(jsFunctionEvictIsolationSourceProviderCache); -namespace Zig { +namespace Rust { class GlobalObject; } @@ -30,7 +30,7 @@ const OnLoadResultType OnLoadResultTypeObject = 2; const OnLoadResultType OnLoadResultTypePromise = 3; struct CodeString { - ZigString string; + RustString string; JSC::JSValue value; BunLoaderType loader; }; @@ -92,7 +92,7 @@ class PendingVirtualModuleResult : public JSC::JSInternalFieldObjectImpl<3> { }; JSValue fetchESMSourceCodeSync( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSString* spceifierJS, ErrorableResolvedSource* res, BunString* specifier, @@ -100,7 +100,7 @@ JSValue fetchESMSourceCodeSync( BunString* typeAttribute); JSValue fetchESMSourceCodeAsync( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSString* spceifierJS, ErrorableResolvedSource* res, BunString* specifier, @@ -108,7 +108,7 @@ JSValue fetchESMSourceCodeAsync( BunString* typeAttribute); JSValue fetchCommonJSModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSCommonJSModule* moduleObject, JSValue specifierValue, String specifier, @@ -119,7 +119,7 @@ template JSValue fetchCommonJSModuleNonBuiltin( void* bunVM, JSC::VM& vm, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, JSC::JSValue specifierValue, BunString* referrer, @@ -131,11 +131,11 @@ JSValue fetchCommonJSModuleNonBuiltin( JSC::ThrowScope& scope); JSValue resolveAndFetchBuiltinModule( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier); JSValue fetchBuiltinModuleWithoutResolution( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, BunString* specifier, ErrorableResolvedSource* res); diff --git a/src/jsc/bindings/NapiClass.cpp b/src/jsc/bindings/NapiClass.cpp index 37381160e7e..3fbcc3206a0 100644 --- a/src/jsc/bindings/NapiClass.cpp +++ b/src/jsc/bindings/NapiClass.cpp @@ -2,7 +2,7 @@ #include "napi.h" #include -namespace Zig { +namespace Rust { template void NapiClass::visitChildrenImpl(JSCell* cell, Visitor& visitor) @@ -63,7 +63,7 @@ JSC_HOST_CALL_ATTRIBUTES JSC::EncodedJSValue NapiClass_ConstructorFunction(JSC:: } NAPICallFrame frame(globalObject, callFrame, napi->dataPtr(), newTarget); - Bun::NapiHandleScope handleScope(uncheckedDowncast(globalObject)); + Bun::NapiHandleScope handleScope(uncheckedDowncast(globalObject)); JSValue ret = toJS(napi->constructor()(napi->env(), frame.toNapi())); napi_set_last_error(napi->env(), napi_ok); @@ -107,7 +107,7 @@ void NapiClass::finishCreation(VM& vm, NativeExecutable* executable, const Strin Base::finishCreation(vm, executable, 0, name); ASSERT(inherits(info())); this->m_constructor = constructor; - auto globalObject = static_cast(this->globalObject()); + auto globalObject = static_cast(this->globalObject()); this->putDirect(vm, vm.propertyNames->name, jsString(vm, name), JSC::PropertyAttribute::DontEnum | 0); diff --git a/src/jsc/bindings/NapiRef.cpp b/src/jsc/bindings/NapiRef.cpp index 03660630b97..ef8f6f6af31 100644 --- a/src/jsc/bindings/NapiRef.cpp +++ b/src/jsc/bindings/NapiRef.cpp @@ -2,7 +2,7 @@ #include "napi.h" #include -namespace Zig { +namespace Rust { WTF_MAKE_TZONE_ALLOCATED_IMPL(NapiRef); diff --git a/src/jsc/bindings/NapiWeakValue.cpp b/src/jsc/bindings/NapiWeakValue.cpp index 0e6927d792a..e106e274ff8 100644 --- a/src/jsc/bindings/NapiWeakValue.cpp +++ b/src/jsc/bindings/NapiWeakValue.cpp @@ -1,6 +1,6 @@ #include "napi.h" -namespace Zig { +namespace Rust { NapiWeakValue::~NapiWeakValue() { diff --git a/src/jsc/bindings/NativePromiseContext.cpp b/src/jsc/bindings/NativePromiseContext.cpp index a68f4f1f109..190086476ce 100644 --- a/src/jsc/bindings/NativePromiseContext.cpp +++ b/src/jsc/bindings/NativePromiseContext.cpp @@ -1,8 +1,8 @@ #include "NativePromiseContext.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" -// Implemented in Zig (src/runtime/api/NativePromiseContext.zig). Switches on +// Implemented in Rust (src/runtime/api/NativePromiseContext.rust). Switches on // tag to release the ref on the right native type. extern "C" void Bun__NativePromiseContext__destroy(void* ctx, uint8_t tag); @@ -41,7 +41,7 @@ void NativePromiseContext::destroy(JSC::JSCell* cell) } // namespace Bun -extern "C" JSC::EncodedJSValue Bun__NativePromiseContext__create(Zig::GlobalObject* globalObject, void* ctx, uint8_t tag) +extern "C" JSC::EncodedJSValue Bun__NativePromiseContext__create(Rust::GlobalObject* globalObject, void* ctx, uint8_t tag) { auto& vm = JSC::getVM(globalObject); auto* cell = Bun::NativePromiseContext::create( diff --git a/src/jsc/bindings/NativePromiseContext.h b/src/jsc/bindings/NativePromiseContext.h index 5c42a0be561..b458a9560af 100644 --- a/src/jsc/bindings/NativePromiseContext.h +++ b/src/jsc/bindings/NativePromiseContext.h @@ -7,7 +7,7 @@ namespace Bun { // Opaque marker type so CompactPointerTuple's allowCompactPointers check -// passes. The actual pointee is one of several Zig-side native types; we +// passes. The actual pointee is one of several Rust-side native types; we // cast through void* at the boundary. struct NativePromiseContextPointee { WTF_ALLOW_STRUCT_COMPACT_POINTERS; @@ -36,7 +36,7 @@ class NativePromiseContext final : public JSC::JSCell { // CompactPointerTuple, so this cell adds only one pointer of storage // beyond the JSCell header. // - // Must stay in sync with Tag in src/runtime/api/NativePromiseContext.zig. + // Must stay in sync with Tag in src/runtime/api/NativePromiseContext.rust. enum class Tag : uint8_t { HTTPServerRequestContext, HTTPSServerRequestContext, diff --git a/src/jsc/bindings/NoOrphansTracker.cpp b/src/jsc/bindings/NoOrphansTracker.cpp index db887d214ec..a972d62a482 100644 --- a/src/jsc/bindings/NoOrphansTracker.cpp +++ b/src/jsc/bindings/NoOrphansTracker.cpp @@ -257,7 +257,7 @@ class NoOrphansTracker { // Scratch buffer for proc_listallpids; persisted across scans so a // fork-heavy script (e.g. `make -j`) isn't reallocating every NOTE_FORK. WTF::Vector m_pids; - int m_kq = -1; // borrowed; owned by Zig's spawnPosix + int m_kq = -1; // borrowed; owned by Rust's spawnPosix }; } // namespace Bun diff --git a/src/jsc/bindings/NodeAsyncHooks.cpp b/src/jsc/bindings/NodeAsyncHooks.cpp index 58beb067de3..cb0adb106d7 100644 --- a/src/jsc/bindings/NodeAsyncHooks.cpp +++ b/src/jsc/bindings/NodeAsyncHooks.cpp @@ -4,7 +4,7 @@ #include "JavaScriptCore/ObjectConstructor.h" #include "JavaScriptCore/ArrayConstructor.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { @@ -17,7 +17,7 @@ using namespace JSC; JSC_DEFINE_HOST_FUNCTION(jsCleanupLater, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { ASSERT(callFrame->argumentCount() == 0); - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); global->asyncHooksNeedsCleanup = true; global->resetOnEachMicrotaskTick(); return JSC::JSValue::encode(JSC::jsUndefined()); diff --git a/src/jsc/bindings/NodeAsyncHooks.h b/src/jsc/bindings/NodeAsyncHooks.h index 6dd8f458793..e8c7eabfe6a 100644 --- a/src/jsc/bindings/NodeAsyncHooks.h +++ b/src/jsc/bindings/NodeAsyncHooks.h @@ -1,5 +1,5 @@ #include "config.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include namespace Bun { diff --git a/src/jsc/bindings/NodeDirent.cpp b/src/jsc/bindings/NodeDirent.cpp index f6667116545..4bd55765e9b 100644 --- a/src/jsc/bindings/NodeDirent.cpp +++ b/src/jsc/bindings/NodeDirent.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { @@ -47,7 +47,7 @@ static const HashTableValue JSDirentPrototypeTableValues[] = { { "isSymbolicLink"_s, static_cast(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsDirentProtoFuncIsSymbolicLink, 0 } }, }; -static Structure* getStructure(Zig::GlobalObject* globalObject) +static Structure* getStructure(Rust::GlobalObject* globalObject) { return globalObject->m_JSDirentClassStructure.get(globalObject); } @@ -164,11 +164,11 @@ JSC_DEFINE_HOST_FUNCTION(constructDirent, (JSC::JSGlobalObject * globalObject, J JSValue type = callFrame->argument(1); JSValue path = callFrame->argument(2); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->m_JSDirentClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->m_JSDirentClassStructure.get(rustGlobalObject); auto* originalStructure = structure; JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSDirentClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSDirentClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { auto scope = DECLARE_THROW_SCOPE(vm); if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor Dirent cannot be invoked without 'new'"_s); @@ -197,7 +197,7 @@ JSC_DEFINE_HOST_FUNCTION(constructDirent, (JSC::JSGlobalObject * globalObject, J return JSValue::encode(object); } -static inline int32_t getType(JSC::VM& vm, JSValue value, Zig::GlobalObject* globalObject) +static inline int32_t getType(JSC::VM& vm, JSValue value, Rust::GlobalObject* globalObject) { JSObject* object = value.getObject(); if (!object) [[unlikely]] { @@ -323,12 +323,12 @@ void initJSDirentClassStructure(JSC::LazyClassStructure::Initializer& init) init.setConstructor(constructor); } -extern "C" JSC::EncodedJSValue Bun__JSDirentObjectConstructor(Zig::GlobalObject* globalobject) +extern "C" JSC::EncodedJSValue Bun__JSDirentObjectConstructor(Rust::GlobalObject* globalobject) { return JSValue::encode(globalobject->m_JSDirentClassStructure.constructor(globalobject)); } -extern "C" JSC::EncodedJSValue Bun__Dirent__toJS(Zig::GlobalObject* globalObject, int type, BunString* name, BunString* path, JSString** previousPath) +extern "C" JSC::EncodedJSValue Bun__Dirent__toJS(Rust::GlobalObject* globalObject, int type, BunString* name, BunString* path, JSString** previousPath) { auto& vm = globalObject->vm(); diff --git a/src/jsc/bindings/NodeFSStatBinding.cpp b/src/jsc/bindings/NodeFSStatBinding.cpp index e2cc3cf16eb..20de9b5aa48 100644 --- a/src/jsc/bindings/NodeFSStatBinding.cpp +++ b/src/jsc/bindings/NodeFSStatBinding.cpp @@ -18,7 +18,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/DateInstance.h" #if !OS(WINDOWS) #include @@ -157,7 +157,7 @@ static JSValue modeStatFunction(JSC::JSGlobalObject* globalObject, CallFrame* ca } template -Structure* getStructure(Zig::GlobalObject* globalObject) +Structure* getStructure(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatsBigIntClassStructure.getInitializedOnMainThread(globalObject); @@ -167,7 +167,7 @@ Structure* getStructure(Zig::GlobalObject* globalObject) } template -JSObject* getPrototype(Zig::GlobalObject* globalObject) +JSObject* getPrototype(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatsBigIntClassStructure.prototypeInitializedOnMainThread(globalObject); @@ -177,7 +177,7 @@ JSObject* getPrototype(Zig::GlobalObject* globalObject) } template -JSObject* getConstructor(Zig::GlobalObject* globalObject) +JSObject* getConstructor(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatsBigIntClassStructure.constructorInitializedOnMainThread(globalObject); @@ -598,7 +598,7 @@ JSC::Structure* createJSBigIntStatsObjectStructure(JSC::VM& vm, JSC::JSGlobalObj return structure; } -extern "C" JSC::EncodedJSValue Bun__createJSStatsObject(Zig::GlobalObject* globalObject, uint64_t dev, +extern "C" JSC::EncodedJSValue Bun__createJSStatsObject(Rust::GlobalObject* globalObject, uint64_t dev, uint64_t ino, uint64_t mode, uint64_t nlink, @@ -642,7 +642,7 @@ extern "C" JSC::EncodedJSValue Bun__createJSStatsObject(Zig::GlobalObject* globa return JSC::JSValue::encode(object); } -extern "C" JSC::EncodedJSValue Bun__createJSBigIntStatsObject(Zig::GlobalObject* globalObject, +extern "C" JSC::EncodedJSValue Bun__createJSBigIntStatsObject(Rust::GlobalObject* globalObject, uint64_t dev, uint64_t ino, uint64_t mode, @@ -817,7 +817,7 @@ inline JSValue constructJSStatsObject(JSC::JSGlobalObject* lexicalGlobalObject, { auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto* structure = getStructure(globalObject); auto* constructor = getConstructor(globalObject); @@ -825,7 +825,7 @@ inline JSValue constructJSStatsObject(JSC::JSGlobalObject* lexicalGlobalObject, if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = static_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); @@ -915,12 +915,12 @@ JSC_DEFINE_HOST_FUNCTION(callBigIntStats, (JSC::JSGlobalObject * lexicalGlobalOb return JSValue::encode(callJSStatsFunction(lexicalGlobalObject, callFrame)); } -extern "C" JSC::EncodedJSValue Bun__JSBigIntStatsObjectConstructor(Zig::GlobalObject* globalobject) +extern "C" JSC::EncodedJSValue Bun__JSBigIntStatsObjectConstructor(Rust::GlobalObject* globalobject) { return JSValue::encode(globalobject->m_JSStatsBigIntClassStructure.constructor(globalobject)); } -extern "C" JSC::EncodedJSValue Bun__JSStatsObjectConstructor(Zig::GlobalObject* globalobject) +extern "C" JSC::EncodedJSValue Bun__JSStatsObjectConstructor(Rust::GlobalObject* globalobject) { return JSValue::encode(globalobject->m_JSStatsClassStructure.constructor(globalobject)); } diff --git a/src/jsc/bindings/NodeFSStatFSBinding.cpp b/src/jsc/bindings/NodeFSStatFSBinding.cpp index 42278a6f1e0..8614d0b2f9a 100644 --- a/src/jsc/bindings/NodeFSStatFSBinding.cpp +++ b/src/jsc/bindings/NodeFSStatFSBinding.cpp @@ -17,7 +17,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { @@ -34,7 +34,7 @@ JSC_DECLARE_HOST_FUNCTION(constructStatFS); JSC_DECLARE_HOST_FUNCTION(constructBigIntStatFS); template -Structure* getStatFSStructure(Zig::GlobalObject* globalObject) +Structure* getStatFSStructure(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatFSBigIntClassStructure.getInitializedOnMainThread(globalObject); @@ -44,7 +44,7 @@ Structure* getStatFSStructure(Zig::GlobalObject* globalObject) } template -JSObject* getStatFSPrototype(Zig::GlobalObject* globalObject) +JSObject* getStatFSPrototype(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatFSBigIntClassStructure.prototypeInitializedOnMainThread(globalObject); @@ -54,7 +54,7 @@ JSObject* getStatFSPrototype(Zig::GlobalObject* globalObject) } template -JSObject* getStatFSConstructor(Zig::GlobalObject* globalObject) +JSObject* getStatFSConstructor(Rust::GlobalObject* globalObject) { if (isBigInt) { return globalObject->m_JSStatFSBigIntClassStructure.constructorInitializedOnMainThread(globalObject); @@ -249,7 +249,7 @@ JSC::Structure* createJSBigIntStatFSObjectStructure(JSC::VM& vm, JSC::JSGlobalOb return structure; } -extern "C" JSC::EncodedJSValue Bun__createJSStatFSObject(Zig::GlobalObject* globalObject, +extern "C" JSC::EncodedJSValue Bun__createJSStatFSObject(Rust::GlobalObject* globalObject, int64_t fstype, int64_t bsize, int64_t blocks, @@ -282,7 +282,7 @@ extern "C" JSC::EncodedJSValue Bun__createJSStatFSObject(Zig::GlobalObject* glob return JSC::JSValue::encode(object); } -extern "C" JSC::EncodedJSValue Bun__createJSBigIntStatFSObject(Zig::GlobalObject* globalObject, +extern "C" JSC::EncodedJSValue Bun__createJSBigIntStatFSObject(Rust::GlobalObject* globalObject, int64_t fstype, int64_t bsize, int64_t blocks, @@ -361,7 +361,7 @@ inline JSValue constructJSStatFSObject(JSC::JSGlobalObject* lexicalGlobalObject, { auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto* structure = getStatFSStructure(globalObject); auto* constructor = getStatFSConstructor(globalObject); @@ -369,7 +369,7 @@ inline JSValue constructJSStatFSObject(JSC::JSGlobalObject* lexicalGlobalObject, if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = static_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); @@ -417,12 +417,12 @@ JSC_DEFINE_HOST_FUNCTION(callBigIntStatFS, (JSC::JSGlobalObject * lexicalGlobalO return JSValue::encode(callJSStatFSFunction(lexicalGlobalObject, callFrame)); } -extern "C" JSC::EncodedJSValue Bun__JSBigIntStatFSObjectConstructor(Zig::GlobalObject* globalobject) +extern "C" JSC::EncodedJSValue Bun__JSBigIntStatFSObjectConstructor(Rust::GlobalObject* globalobject) { return JSValue::encode(globalobject->m_JSStatFSBigIntClassStructure.constructor(globalobject)); } -extern "C" JSC::EncodedJSValue Bun__JSStatFSObjectConstructor(Zig::GlobalObject* globalobject) +extern "C" JSC::EncodedJSValue Bun__JSStatFSObjectConstructor(Rust::GlobalObject* globalobject) { return JSValue::encode(globalobject->m_JSStatFSClassStructure.constructor(globalobject)); } diff --git a/src/jsc/bindings/NodeFetch.cpp b/src/jsc/bindings/NodeFetch.cpp index e4395e7ea7b..bab6a10554b 100644 --- a/src/jsc/bindings/NodeFetch.cpp +++ b/src/jsc/bindings/NodeFetch.cpp @@ -1,6 +1,6 @@ #include "root.h" #include "JSDOMGlobalObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSFetchHeaders.h" #include "JSDOMFormData.h" @@ -19,7 +19,7 @@ using namespace JSC; using namespace WebCore; // Ensure overriding globals doesn't impact usages. -JSC::JSValue createNodeFetchInternalBinding(Zig::GlobalObject* globalObject) +JSC::JSValue createNodeFetchInternalBinding(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); diff --git a/src/jsc/bindings/NodeFetch.h b/src/jsc/bindings/NodeFetch.h index ee4ee9875d8..6c01ad86030 100644 --- a/src/jsc/bindings/NodeFetch.h +++ b/src/jsc/bindings/NodeFetch.h @@ -2,6 +2,6 @@ namespace Bun { -JSC::JSValue createNodeFetchInternalBinding(Zig::GlobalObject*); +JSC::JSValue createNodeFetchInternalBinding(Rust::GlobalObject*); } diff --git a/src/jsc/bindings/NodeHTTP.cpp b/src/jsc/bindings/NodeHTTP.cpp index 26958180648..9dcc073dd93 100644 --- a/src/jsc/bindings/NodeHTTP.cpp +++ b/src/jsc/bindings/NodeHTTP.cpp @@ -1,6 +1,6 @@ #include "root.h" #include "JSDOMGlobalObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include "helpers.h" #include "BunClientData.h" @@ -15,10 +15,10 @@ #include "JSDOMExceptionHandling.h" #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "ScriptExecutionContext.h" #include "AsyncContextFrame.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include #include #include "JSSocketAddressDTO.h" @@ -434,7 +434,7 @@ extern "C" EncodedJSValue NodeHTTPResponse__createForJS(size_t any_server, JSC:: template static EncodedJSValue NodeHTTPServer__onRequest( size_t any_server, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSValue thisValue, JSValue callback, JSValue methodString, @@ -688,7 +688,7 @@ extern "C" void NodeHTTPServer__writeHead_https( extern "C" EncodedJSValue NodeHTTPServer__onRequest_http( size_t any_server, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, EncodedJSValue thisValue, EncodedJSValue callback, EncodedJSValue methodString, @@ -711,7 +711,7 @@ extern "C" EncodedJSValue NodeHTTPServer__onRequest_http( extern "C" EncodedJSValue NodeHTTPServer__onRequest_https( size_t any_server, - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, EncodedJSValue thisValue, EncodedJSValue callback, EncodedJSValue methodString, @@ -1002,7 +1002,7 @@ JSC_DEFINE_HOST_FUNCTION(jsHTTPSetHeader, (JSGlobalObject * globalObject, CallFr return JSValue::encode(jsUndefined()); } -JSValue createNodeHTTPInternalBinding(Zig::GlobalObject* globalObject) +JSValue createNodeHTTPInternalBinding(Rust::GlobalObject* globalObject) { auto* obj = constructEmptyObject(globalObject); VM& vm = globalObject->vm(); diff --git a/src/jsc/bindings/NodeHTTP.h b/src/jsc/bindings/NodeHTTP.h index 8035cc216c8..b799f1e055b 100644 --- a/src/jsc/bindings/NodeHTTP.h +++ b/src/jsc/bindings/NodeHTTP.h @@ -7,6 +7,6 @@ JSC_DECLARE_HOST_FUNCTION(jsHTTPGetHeader); JSC_DECLARE_HOST_FUNCTION(jsHTTPSetHeader); JSC::Structure* createNodeHTTPServerSocketStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject); -JSC::JSValue createNodeHTTPInternalBinding(Zig::GlobalObject*); +JSC::JSValue createNodeHTTPInternalBinding(Rust::GlobalObject*); } diff --git a/src/jsc/bindings/NodeTLS.cpp b/src/jsc/bindings/NodeTLS.cpp index 218c78cd993..a3e1668350b 100644 --- a/src/jsc/bindings/NodeTLS.cpp +++ b/src/jsc/bindings/NodeTLS.cpp @@ -5,7 +5,7 @@ #include "JavaScriptCore/ArrayConstructor.h" #include "libusockets.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "openssl/base.h" #include "openssl/bio.h" diff --git a/src/jsc/bindings/NodeTLS.h b/src/jsc/bindings/NodeTLS.h index c8948b6bf96..b24b6d32f0f 100644 --- a/src/jsc/bindings/NodeTLS.h +++ b/src/jsc/bindings/NodeTLS.h @@ -1,5 +1,5 @@ #include "config.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { diff --git a/src/jsc/bindings/NodeTimerObject.cpp b/src/jsc/bindings/NodeTimerObject.cpp index b534e41fedc..4cb459edc07 100644 --- a/src/jsc/bindings/NodeTimerObject.cpp +++ b/src/jsc/bindings/NodeTimerObject.cpp @@ -6,9 +6,9 @@ #include "JavaScriptCore/JSCast.h" #include "JavaScriptCore/JSObject.h" #include "JavaScriptCore/Heap.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include #include #include "JavaScriptCore/JSCJSValue.h" diff --git a/src/jsc/bindings/NodeURL.cpp b/src/jsc/bindings/NodeURL.cpp index 09af0674a4e..93f7a8cf8ea 100644 --- a/src/jsc/bindings/NodeURL.cpp +++ b/src/jsc/bindings/NodeURL.cpp @@ -141,7 +141,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDomainToUnicode, (JSC::JSGlobalObject * globalObject, return JSC::JSValue::encode(jsEmptyString(vm)); } -JSC::JSValue createNodeURLBinding(Zig::GlobalObject* globalObject) +JSC::JSValue createNodeURLBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/NodeURL.h b/src/jsc/bindings/NodeURL.h index 3252194123c..e08a08f7f4a 100644 --- a/src/jsc/bindings/NodeURL.h +++ b/src/jsc/bindings/NodeURL.h @@ -1,8 +1,8 @@ #include "config.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { -JSC::JSValue createNodeURLBinding(Zig::GlobalObject*); +JSC::JSValue createNodeURLBinding(Rust::GlobalObject*); } // namespace Bun diff --git a/src/jsc/bindings/NodeVM.cpp b/src/jsc/bindings/NodeVM.cpp index dae4e540c9d..b05c633e204 100644 --- a/src/jsc/bindings/NodeVM.cpp +++ b/src/jsc/bindings/NodeVM.cpp @@ -273,8 +273,8 @@ JSPromise* importModule(JSGlobalObject* globalObject, JSString* moduleName, RefP if (isUseMainContextDefaultLoaderConstant(globalObject, dynamicImportCallback)) { auto defer = fetcher->temporarilyUseDefaultLoader(); - Zig::GlobalObject* zigGlobalObject = defaultGlobalObject(globalObject); - RELEASE_AND_RETURN(scope, zigGlobalObject->moduleLoaderImportModule(zigGlobalObject, zigGlobalObject->moduleLoader(), moduleName, WTF::move(parameters), sourceOrigin)); + Rust::GlobalObject* rustGlobalObject = defaultGlobalObject(globalObject); + RELEASE_AND_RETURN(scope, rustGlobalObject->moduleLoaderImportModule(rustGlobalObject, rustGlobalObject->moduleLoader(), moduleName, WTF::move(parameters), sourceOrigin)); } else if (!dynamicImportCallback || !dynamicImportCallback.isCallable()) { throwException(globalObject, scope, createError(globalObject, ErrorCode::ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, "A dynamic import callback was not specified."_s)); return nullptr; @@ -601,8 +601,8 @@ NodeVMGlobalObject* getGlobalObjectFromContext(JSGlobalObject* globalObject, JSV } JSObject* context = asObject(contextValue); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSValue scopeValue = zigGlobalObject->vmModuleContextMap()->get(context); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSValue scopeValue = rustGlobalObject->vmModuleContextMap()->get(context); if (scopeValue.isUndefined()) { if (auto* specialSandbox = dynamicDowncast(context)) { return specialSandbox->parentGlobal(); @@ -647,9 +647,9 @@ JSC::EncodedJSValue INVALID_ARG_VALUE_VM_VARIATION(JSC::ThrowScope& throwScope, bool isContext(JSGlobalObject* globalObject, JSValue value) { - auto* zigGlobalObject = defaultGlobalObject(globalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); - if (zigGlobalObject->vmModuleContextMap()->has(asObject(value))) { + if (rustGlobalObject->vmModuleContextMap()->has(asObject(value))) { return true; } @@ -669,8 +669,8 @@ bool getContextArg(JSGlobalObject* globalObject, JSValue& contextArg) if (contextArg.isUndefined()) { contextArg = JSC::constructEmptyObject(globalObject); } else if (contextArg.isSymbol()) { - Zig::GlobalObject* zigGlobalObject = defaultGlobalObject(globalObject); - if (contextArg == zigGlobalObject->m_nodeVMDontContextify.get(zigGlobalObject)) { + Rust::GlobalObject* rustGlobalObject = defaultGlobalObject(globalObject); + if (contextArg == rustGlobalObject->m_nodeVMDontContextify.get(rustGlobalObject)) { contextArg = JSC::constructEmptyObject(globalObject); return true; } @@ -682,8 +682,8 @@ bool getContextArg(JSGlobalObject* globalObject, JSValue& contextArg) bool isUseMainContextDefaultLoaderConstant(JSGlobalObject* globalObject, JSValue value) { if (value.isSymbol()) { - Zig::GlobalObject* zigGlobalObject = defaultGlobalObject(globalObject); - if (value == zigGlobalObject->m_nodeVMUseMainContextDefaultLoader.get(zigGlobalObject)) { + Rust::GlobalObject* rustGlobalObject = defaultGlobalObject(globalObject); + if (value == rustGlobalObject->m_nodeVMUseMainContextDefaultLoader.get(rustGlobalObject)) { return true; } } @@ -781,10 +781,10 @@ void unsafeEvalNoop(JSGlobalObject*, const WTF::String&) {} static void promiseRejectionTrackerForNodeVM(JSGlobalObject* globalObject, JSC::JSPromise* promise, JSC::JSPromiseRejectionOperation operation) { - // Delegate to the parent Zig::GlobalObject so that unhandled rejections + // Delegate to the parent Rust::GlobalObject so that unhandled rejections // in VM contexts are reported to the main process (matching Node.js behavior) - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Zig::GlobalObject::promiseRejectionTracker(zigGlobalObject, promise, operation); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Rust::GlobalObject::promiseRejectionTracker(rustGlobalObject, promise, operation); } const JSC::GlobalObjectMethodTable& NodeVMGlobalObject::globalObjectMethodTable() @@ -829,7 +829,7 @@ void NodeVMGlobalObject::finishCreation(JSC::VM& vm) vm.ensureTerminationException(); - // Share the async context data with the parent Zig::GlobalObject. + // Share the async context data with the parent Rust::GlobalObject. // This is necessary because AsyncLocalStorage methods (run, getStore, etc.) are defined // in the parent realm and reference the parent's $asyncContext. However, microtask // processing (JSMicrotask.cpp) operates on this NodeVMGlobalObject's m_asyncContextData. @@ -1390,10 +1390,10 @@ JSC_DEFINE_HOST_FUNCTION(vmModule_createContext, (JSGlobalObject * globalObject, return JSValue::encode(sandbox); } - auto* zigGlobalObject = defaultGlobalObject(globalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); auto* targetContext = NodeVMGlobalObject::create(vm, - zigGlobalObject->NodeVMGlobalObjectStructure(), + rustGlobalObject->NodeVMGlobalObjectStructure(), contextOptions, importer); RETURN_IF_EXCEPTION(scope, {}); @@ -1402,10 +1402,10 @@ JSC_DEFINE_HOST_FUNCTION(vmModule_createContext, (JSGlobalObject * globalObject, targetContext->setContextifiedObject(sandbox); // Store context in WeakMap for isContext checks - zigGlobalObject->vmModuleContextMap()->set(vm, sandbox, targetContext); + rustGlobalObject->vmModuleContextMap()->set(vm, sandbox, targetContext); if (notContextified) { - auto* specialSandbox = NodeVMSpecialSandbox::create(vm, zigGlobalObject->NodeVMSpecialSandboxStructure(), targetContext); + auto* specialSandbox = NodeVMSpecialSandbox::create(vm, rustGlobalObject->NodeVMSpecialSandboxStructure(), targetContext); RETURN_IF_EXCEPTION(scope, {}); targetContext->setSpecialSandbox(specialSandbox); return JSValue::encode(targetContext->specialSandbox()); @@ -1502,7 +1502,7 @@ JSC_DEFINE_HOST_FUNCTION(vmIsModuleNamespaceObject, (JSGlobalObject * globalObje return JSValue::encode(jsBoolean(callFrame->argument(0).inherits(JSModuleNamespaceObject::info()))); } -JSC::JSValue createNodeVMBinding(Zig::GlobalObject* globalObject) +JSC::JSValue createNodeVMBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); auto* obj = constructEmptyObject(globalObject); @@ -1563,7 +1563,7 @@ JSC::JSValue createNodeVMBinding(Zig::GlobalObject* globalObject) return obj; } -void configureNodeVM(JSC::VM& vm, Zig::GlobalObject* globalObject) +void configureNodeVM(JSC::VM& vm, Rust::GlobalObject* globalObject) { globalObject->m_nodeVMDontContextify.initLater([](const LazyProperty::Initializer& init) { init.set(JSC::Symbol::createWithDescription(init.vm, "vm_dont_contextify"_s)); @@ -1789,8 +1789,8 @@ bool CompileFunctionOptions::fromJS(JSC::JSGlobalObject* globalObject, JSC::VM& return ERR::INVALID_ARG_INSTANCE(scope, globalObject, "options.parsingContext"_s, "Context"_s, parsingContextValue); JSObject* context = asObject(parsingContextValue); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSValue scopeValue = zigGlobalObject->vmModuleContextMap()->get(context); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSValue scopeValue = rustGlobalObject->vmModuleContextMap()->get(context); if (scopeValue.isUndefined()) return ERR::INVALID_ARG_INSTANCE(scope, globalObject, "options.parsingContext"_s, "Context"_s, parsingContextValue); diff --git a/src/jsc/bindings/NodeVM.h b/src/jsc/bindings/NodeVM.h index d16c0bae7cb..bc6d54fb4a9 100644 --- a/src/jsc/bindings/NodeVM.h +++ b/src/jsc/bindings/NodeVM.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunGlobalScope.h" #include @@ -150,9 +150,9 @@ class NodeVMGlobalObject final : public Bun::GlobalScope { }; // Helper functions to create vm contexts and run code -JSC::JSValue createNodeVMBinding(Zig::GlobalObject*); +JSC::JSValue createNodeVMBinding(Rust::GlobalObject*); Structure* createNodeVMGlobalObjectStructure(JSC::VM&); -void configureNodeVM(JSC::VM&, Zig::GlobalObject*); +void configureNodeVM(JSC::VM&, Rust::GlobalObject*); // VM module functions JSC_DECLARE_HOST_FUNCTION(vmModule_createContext); diff --git a/src/jsc/bindings/NodeVMScript.cpp b/src/jsc/bindings/NodeVMScript.cpp index d7cfa6157cb..9c254be5c52 100644 --- a/src/jsc/bindings/NodeVMScript.cpp +++ b/src/jsc/bindings/NodeVMScript.cpp @@ -111,9 +111,9 @@ constructScript(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue newT RETURN_IF_EXCEPTION(scope, JSValue::encode(jsUndefined())); } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - Structure* structure = zigGlobalObject->NodeVMScriptStructure(); - if (zigGlobalObject->NodeVMScript() != newTarget) [[unlikely]] { + auto* rustGlobalObject = defaultGlobalObject(globalObject); + Structure* structure = rustGlobalObject->NodeVMScriptStructure(); + if (rustGlobalObject->NodeVMScript() != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor Script cannot be invoked without 'new'"_s); return {}; @@ -585,15 +585,15 @@ JSC_DEFINE_HOST_FUNCTION(scriptRunInNewContext, (JSGlobalObject * globalObject, contextOptions.notContextified = notContextified; - auto* zigGlobalObject = defaultGlobalObject(globalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); JSObject* context = asObject(contextObjectValue); auto* targetContext = NodeVMGlobalObject::create(vm, - zigGlobalObject->NodeVMGlobalObjectStructure(), + rustGlobalObject->NodeVMGlobalObjectStructure(), contextOptions, importer); RETURN_IF_EXCEPTION(scope, {}); if (notContextified) { - auto* specialSandbox = NodeVMSpecialSandbox::create(vm, zigGlobalObject->NodeVMSpecialSandboxStructure(), targetContext); + auto* specialSandbox = NodeVMSpecialSandbox::create(vm, rustGlobalObject->NodeVMSpecialSandboxStructure(), targetContext); RETURN_IF_EXCEPTION(scope, {}); targetContext->setSpecialSandbox(specialSandbox); RELEASE_AND_RETURN(scope, runInContext(targetContext, script, targetContext->specialSandbox(), callFrame->argument(1))); diff --git a/src/jsc/bindings/NodeVMSourceTextModule.cpp b/src/jsc/bindings/NodeVMSourceTextModule.cpp index 2b83e9712a5..edebb176a50 100644 --- a/src/jsc/bindings/NodeVMSourceTextModule.cpp +++ b/src/jsc/bindings/NodeVMSourceTextModule.cpp @@ -102,11 +102,11 @@ NodeVMSourceTextModule* NodeVMSourceTextModule::create(VM& vm, JSGlobalObject* g SourceCode sourceCode(WTF::move(sourceProvider), lineOffset, columnOffset); - auto* zigGlobalObject = defaultGlobalObject(globalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); WTF::String identifier = identifierValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, nullptr); NodeVMSourceTextModule* ptr = new (NotNull, allocateCell(vm)) NodeVMSourceTextModule( - vm, zigGlobalObject->NodeVMSourceTextModuleStructure(), WTF::move(identifier), contextValue, + vm, rustGlobalObject->NodeVMSourceTextModuleStructure(), WTF::move(identifier), contextValue, WTF::move(sourceCode), moduleWrapper, initializeImportMeta); RETURN_IF_EXCEPTION(scope, nullptr); ptr->finishCreation(vm); diff --git a/src/jsc/bindings/NodeVMSyntheticModule.cpp b/src/jsc/bindings/NodeVMSyntheticModule.cpp index 444b0b465a4..8459d31677f 100644 --- a/src/jsc/bindings/NodeVMSyntheticModule.cpp +++ b/src/jsc/bindings/NodeVMSyntheticModule.cpp @@ -76,8 +76,8 @@ NodeVMSyntheticModule* NodeVMSyntheticModule::create(VM& vm, JSGlobalObject* glo RETURN_IF_EXCEPTION(scope, nullptr); } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - auto* structure = zigGlobalObject->NodeVMSyntheticModuleStructure(); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + auto* structure = rustGlobalObject->NodeVMSyntheticModuleStructure(); WTF::String identifier = identifierValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, nullptr); auto* ptr = new (NotNull, allocateCell(vm)) NodeVMSyntheticModule(vm, structure, WTF::move(identifier), contextValue, moduleWrapperValue, WTF::move(exportNames), syntheticEvaluationStepsValue); diff --git a/src/jsc/bindings/NodeValidator.cpp b/src/jsc/bindings/NodeValidator.cpp index b647beb090f..a4c485c0768 100644 --- a/src/jsc/bindings/NodeValidator.cpp +++ b/src/jsc/bindings/NodeValidator.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/ExceptionScope.h" diff --git a/src/jsc/bindings/NodeValidator.h b/src/jsc/bindings/NodeValidator.h index 2f6d76f65ca..6b0084e8fcb 100644 --- a/src/jsc/bindings/NodeValidator.h +++ b/src/jsc/bindings/NodeValidator.h @@ -2,7 +2,7 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "BufferEncodingType.h" #include "JavaScriptCore/JSCJSValue.h" diff --git a/src/jsc/bindings/Path.cpp b/src/jsc/bindings/Path.cpp index 91af4a73079..e00dd9aa978 100644 --- a/src/jsc/bindings/Path.cpp +++ b/src/jsc/bindings/Path.cpp @@ -2,7 +2,7 @@ #include "root.h" #include "headers.h" #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -10,7 +10,7 @@ #pragma mark - Node.js Path -namespace Zig { +namespace Rust { static JSC::JSObject* createPath(JSC::JSGlobalObject* globalThis, bool isWindows); @@ -31,7 +31,7 @@ using namespace JSC; using PathFunction = JSC::EncodedJSValue (*SYSV_ABI)(JSGlobalObject*, bool, EncodedJSValue*, uint16_t len); template -static inline JSC::EncodedJSValue createZigFunction(JSGlobalObject* globalObject, JSC::CallFrame* callFrame) +static inline JSC::EncodedJSValue createRustFunction(JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -48,7 +48,7 @@ static inline JSC::EncodedJSValue createZigFunction(JSGlobalObject* globalObject JSC_DEFINE_HOST_FUNCTION(jsFunctionName, \ (JSC::JSGlobalObject * globalObject, JSC::CallFrame * callFrame)) \ { \ - return createZigFunction(globalObject, callFrame); \ + return createRustFunction(globalObject, callFrame); \ } DEFINE_PATH_FUNCTION(jsFunctionPath_basenamePosix, Bun__Path__basename, false) @@ -112,7 +112,7 @@ static JSC::JSObject* createPath(JSGlobalObject* globalThis, bool isWindows) return path; } -} // namespace Zig +} // namespace Rust extern "C" JSC::EncodedJSValue PathParsedObject__create( JSC::JSGlobalObject* globalObject, @@ -122,7 +122,7 @@ extern "C" JSC::EncodedJSValue PathParsedObject__create( JSC::EncodedJSValue ext, JSC::EncodedJSValue name) { - auto* global = uncheckedDowncast(globalObject); + auto* global = uncheckedDowncast(globalObject); auto& vm = JSC::getVM(globalObject); JSC::JSObject* result = JSC::constructEmptyObject(vm, global->pathParsedObjectStructure()); result->putDirectOffset(vm, 0, JSC::JSValue::decode(root)); @@ -135,7 +135,7 @@ extern "C" JSC::EncodedJSValue PathParsedObject__create( namespace Bun { -JSC::JSValue createNodePathBinding(Zig::GlobalObject* globalObject) +JSC::JSValue createNodePathBinding(Rust::GlobalObject* globalObject) { auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -144,12 +144,12 @@ JSC::JSValue createNodePathBinding(Zig::GlobalObject* globalObject) binding->putDirectIndex( globalObject, (unsigned)0, - Zig::createPath(globalObject, false)); + Rust::createPath(globalObject, false)); RETURN_IF_EXCEPTION(scope, {}); binding->putDirectIndex( globalObject, (unsigned)1, - Zig::createPath(globalObject, true)); + Rust::createPath(globalObject, true)); RETURN_IF_EXCEPTION(scope, {}); return binding; } diff --git a/src/jsc/bindings/Path.h b/src/jsc/bindings/Path.h index edc73912c23..dd63aca8302 100644 --- a/src/jsc/bindings/Path.h +++ b/src/jsc/bindings/Path.h @@ -1,8 +1,8 @@ #include "config.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { -JSC::JSValue createNodePathBinding(Zig::GlobalObject* globalObject); +JSC::JSValue createNodePathBinding(Rust::GlobalObject* globalObject); } // namespace Bun diff --git a/src/jsc/bindings/ProcessBindingFs.cpp b/src/jsc/bindings/ProcessBindingFs.cpp index 1eb6e96afad..701a9e50eda 100644 --- a/src/jsc/bindings/ProcessBindingFs.cpp +++ b/src/jsc/bindings/ProcessBindingFs.cpp @@ -1,7 +1,7 @@ #include "ProcessBindingFs.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { using namespace JSC; diff --git a/src/jsc/bindings/ProcessBindingHTTPParser.cpp b/src/jsc/bindings/ProcessBindingHTTPParser.cpp index c4dfc88b0da..e80048ce86d 100644 --- a/src/jsc/bindings/ProcessBindingHTTPParser.cpp +++ b/src/jsc/bindings/ProcessBindingHTTPParser.cpp @@ -1,5 +1,5 @@ #include "ProcessBindingHTTPParser.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "llhttp/llhttp.h" namespace Bun { diff --git a/src/jsc/bindings/ProcessBindingTTYWrap.cpp b/src/jsc/bindings/ProcessBindingTTYWrap.cpp index 4dfbc306f14..21b46b6f870 100644 --- a/src/jsc/bindings/ProcessBindingTTYWrap.cpp +++ b/src/jsc/bindings/ProcessBindingTTYWrap.cpp @@ -196,7 +196,7 @@ JSC_DEFINE_HOST_FUNCTION(jsTTYSetMode, (JSC::JSGlobalObject * globalObject, Call auto flag = callFrame->argument(0); bool raw = flag.asBoolean(); - Zig::GlobalObject* global = uncheckedDowncast(globalObject); + Rust::GlobalObject* global = uncheckedDowncast(globalObject); return JSValue::encode(jsNumber(Source__setRawModeStdin(global->uvLoop(), raw))); #else @@ -451,7 +451,7 @@ class TTYWrapConstructor final : public JSC::InternalFunction { #if OS(WINDOWS) auto* handle = new UV::TTY(); memset(handle, 0, sizeof(UV::TTY)); - int rc = uv_tty_init(uncheckedDowncast(globalObject)->uvLoop(), handle->tty(), fd, 0); + int rc = uv_tty_init(uncheckedDowncast(globalObject)->uvLoop(), handle->tty(), fd, 0); if (rc < 0) { delete handle; throwTypeError(globalObject, scope, "Failed to initialize TTY handle"_s); @@ -492,12 +492,12 @@ class TTYWrapConstructor final : public JSC::InternalFunction { const ClassInfo TTYWrapConstructor::s_info = { "TTY"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TTYWrapConstructor) }; -JSValue createBunTTYFunctions(Zig::GlobalObject* globalObject) +JSValue createBunTTYFunctions(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto* obj = constructEmptyObject(globalObject); - obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "isatty"_s)), JSFunction::create(vm, globalObject, 0, "isatty"_s, Zig::jsFunctionTty_isatty, ImplementationVisibility::Public), 0); + obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "isatty"_s)), JSFunction::create(vm, globalObject, 0, "isatty"_s, Rust::jsFunctionTty_isatty, ImplementationVisibility::Public), 0); obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "setRawMode"_s)), JSFunction::create(vm, globalObject, 0, "ttySetMode"_s, jsTTYSetMode, ImplementationVisibility::Public), 0); @@ -511,7 +511,7 @@ JSValue createNodeTTYWrapObject(JSC::JSGlobalObject* globalObject) auto& vm = JSC::getVM(globalObject); auto* obj = constructEmptyObject(globalObject); - obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "isTTY"_s)), JSFunction::create(vm, globalObject, 0, "isatty"_s, Zig::jsFunctionTty_isatty, ImplementationVisibility::Public), 0); + obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "isTTY"_s)), JSFunction::create(vm, globalObject, 0, "isatty"_s, Rust::jsFunctionTty_isatty, ImplementationVisibility::Public), 0); TTYWrapPrototype* prototype = TTYWrapPrototype::create(vm, globalObject, TTYWrapPrototype::createStructure(vm, globalObject)); TTYWrapConstructor* constructor = TTYWrapConstructor::create(vm, globalObject, TTYWrapConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), prototype); diff --git a/src/jsc/bindings/ProcessBindingTTYWrap.h b/src/jsc/bindings/ProcessBindingTTYWrap.h index 53f82092da3..0ca29ccabc4 100644 --- a/src/jsc/bindings/ProcessBindingTTYWrap.h +++ b/src/jsc/bindings/ProcessBindingTTYWrap.h @@ -1,7 +1,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace JSC { class JSGlobalObject; @@ -10,7 +10,7 @@ class JSValue; namespace Bun { -JSC::JSValue createBunTTYFunctions(Zig::GlobalObject* globalObject); +JSC::JSValue createBunTTYFunctions(Rust::GlobalObject* globalObject); JSC::JSValue createNodeTTYWrapObject(JSC::JSGlobalObject* globalObject); JSC_DECLARE_HOST_FUNCTION(Process_functionInternalGetWindowSize); diff --git a/src/jsc/bindings/ProcessBindingUV.cpp b/src/jsc/bindings/ProcessBindingUV.cpp index d08c222e0e2..1fec95e2ab7 100644 --- a/src/jsc/bindings/ProcessBindingUV.cpp +++ b/src/jsc/bindings/ProcessBindingUV.cpp @@ -2,7 +2,7 @@ #include "JavaScriptCore/ArrayAllocationProfile.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/ThrowScope.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/ObjectConstructor.h" #include "JavaScriptCore/JSMap.h" #include "JavaScriptCore/JSMapInlines.h" diff --git a/src/jsc/bindings/S3Error.cpp b/src/jsc/bindings/S3Error.cpp index e16cca5fe02..63ff07b2523 100644 --- a/src/jsc/bindings/S3Error.cpp +++ b/src/jsc/bindings/S3Error.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "S3Error.h" namespace Bun { diff --git a/src/jsc/bindings/SQLClient.cpp b/src/jsc/bindings/SQLClient.cpp index 08f3561fc25..00ecdc92412 100644 --- a/src/jsc/bindings/SQLClient.cpp +++ b/src/jsc/bindings/SQLClient.cpp @@ -9,7 +9,7 @@ #include #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include "GCDefferalContext.h" @@ -135,8 +135,8 @@ static JSC::JSValue toJS(JSC::VM& vm, JSC::JSGlobalObject* globalObject, DataCel return jsNull(); break; case DataCellTag::Raw: { - Zig::GlobalObject* zigGlobal = uncheckedDowncast(globalObject); - auto* subclassStructure = zigGlobal->JSBufferSubclassStructure(); + Rust::GlobalObject* rustGlobal = uncheckedDowncast(globalObject); + auto* subclassStructure = rustGlobal->JSBufferSubclassStructure(); auto* uint8Array = JSC::JSUint8Array::createUninitialized(globalObject, subclassStructure, cell.value.raw.length); RETURN_IF_EXCEPTION(scope, {}); @@ -175,8 +175,8 @@ static JSC::JSValue toJS(JSC::VM& vm, JSC::JSGlobalObject* globalObject, DataCel break; } case DataCellTag::Bytea: { - Zig::GlobalObject* zigGlobal = uncheckedDowncast(globalObject); - auto* subclassStructure = zigGlobal->JSBufferSubclassStructure(); + Rust::GlobalObject* rustGlobal = uncheckedDowncast(globalObject); + auto* subclassStructure = rustGlobal->JSBufferSubclassStructure(); auto* uint8Array = JSC::JSUint8Array::createUninitialized(globalObject, subclassStructure, cell.value.bytea[1]); RETURN_IF_EXCEPTION(scope, {}); diff --git a/src/jsc/bindings/ScriptExecutionContext.cpp b/src/jsc/bindings/ScriptExecutionContext.cpp index 91ab2daf5d0..fbe52420bba 100644 --- a/src/jsc/bindings/ScriptExecutionContext.cpp +++ b/src/jsc/bindings/ScriptExecutionContext.cpp @@ -228,21 +228,21 @@ ScriptExecutionContext* executionContext(JSC::JSGlobalObject* globalObject) void ScriptExecutionContext::postTaskConcurrently(Function&& lambda) { auto* task = new EventLoopTask(WTF::move(lambda)); - static_cast(m_globalObject)->queueTaskConcurrently(task); + static_cast(m_globalObject)->queueTaskConcurrently(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(Function&& lambda) { auto* task = new EventLoopTask(WTF::move(lambda)); - static_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(EventLoopTask* task) { - static_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } -// Zig bindings +// Rust bindings extern "C" ScriptExecutionContextIdentifier ScriptExecutionContextIdentifier__forGlobalObject(JSC::JSGlobalObject* globalObject) { return defaultGlobalObject(globalObject)->scriptExecutionContext()->identifier(); diff --git a/src/jsc/bindings/Serialization.cpp b/src/jsc/bindings/Serialization.cpp index caaec599f81..f3924f0e031 100644 --- a/src/jsc/bindings/Serialization.cpp +++ b/src/jsc/bindings/Serialization.cpp @@ -8,7 +8,7 @@ using namespace JSC; using namespace WebCore; -// Must be synced with bindings.zig's JSValue.SerializedScriptValue.External +// Must be synced with bindings.rust's JSValue.SerializedScriptValue.External struct SerializedValueSlice { const uint8_t* bytes; size_t size; diff --git a/src/jsc/bindings/ServerRouteList.cpp b/src/jsc/bindings/ServerRouteList.cpp index 9150d93f96a..3a09398db8d 100644 --- a/src/jsc/bindings/ServerRouteList.cpp +++ b/src/jsc/bindings/ServerRouteList.cpp @@ -1,11 +1,11 @@ #include "root.h" #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "AsyncContextFrame.h" #include "ServerRouteList.h" #include "decodeURIComponentSIMD.h" @@ -19,7 +19,7 @@ using namespace WebCore; /** ServerRouteList holds all the callbacks used by routes in Bun.serve() - The easier approach would be an std.array_list.Managed of JSC.Strong in Zig, but that + The easier approach would be an std.array_list.Managed of JSC.Strong in Rust, but that would mean that now we're holding a Strong reference for every single callback. This would show up in profiling, and it's a lot of strong references. We could use a JSArray instead, but that would incur unnecessary @@ -47,7 +47,7 @@ class ServerRouteList final : public JSC::JSDestructibleObject { JSC::VM& vm, JSC::Structure* structure, std::span callbacks, - std::span paths) + std::span paths) { auto* routeList = new (NotNull, JSC::allocateCell(vm)) ServerRouteList(vm, structure, callbacks, paths); routeList->finishCreation(vm, callbacks, paths); @@ -89,14 +89,14 @@ class ServerRouteList final : public JSC::JSDestructibleObject { DECLARE_VISIT_CHILDREN; template - JSValue callRoute(Zig::GlobalObject* globalObject, uint32_t index, void* requestPtr, EncodedJSValue serverObject, EncodedJSValue* requestObject, Req* req); + JSValue callRoute(Rust::GlobalObject* globalObject, uint32_t index, void* requestPtr, EncodedJSValue serverObject, EncodedJSValue* requestObject, Req* req); private: Structure* structureForParamsObject(JSC::VM& vm, JSC::JSGlobalObject* globalObject, uint32_t index, std::span identifiers); template JSObject* paramsObjectForRoute(JSC::VM& vm, JSC::JSGlobalObject* globalObject, uint32_t index, Req* req); - ServerRouteList(JSC::VM& vm, JSC::Structure* structure, std::span callbacks, std::span paths) + ServerRouteList(JSC::VM& vm, JSC::Structure* structure, std::span callbacks, std::span paths) : Base(vm, structure) , m_routes(callbacks.size()) , m_paramsObjectStructures(paths.size()) @@ -110,7 +110,7 @@ class ServerRouteList final : public JSC::JSDestructibleObject { WTF::FixedVector m_pathIdentifierRanges; WTF::Vector m_pathIdentifiers; - void finishCreation(JSC::VM& vm, std::span callbacks, std::span paths) + void finishCreation(JSC::VM& vm, std::span callbacks, std::span paths) { Base::finishCreation(vm); ASSERT(callbacks.size() == paths.size()); @@ -123,8 +123,8 @@ class ServerRouteList final : public JSC::JSDestructibleObject { std::span pathIdentifierRanges = m_pathIdentifierRanges.mutableSpan(); for (size_t i = 0; i < paths.size(); i++) { - ZigString rawPath = paths[i]; - WTF::String path = Zig::toString(rawPath); + RustString rawPath = paths[i]; + WTF::String path = Rust::toString(rawPath); uint32_t originalIdentifierIndex = m_pathIdentifiers.size(); size_t startOfIdentifier = 0; size_t identifierCount = 0; @@ -183,8 +183,8 @@ Structure* ServerRouteList::structureForParamsObject(JSC::VM& vm, JSC::JSGlobalO } if (!m_paramsObjectStructures.at(index)) { - auto* zigGlobalObject = defaultGlobalObject(globalObject); - auto* prototype = zigGlobalObject->m_JSBunRequestParamsPrototype.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + auto* prototype = rustGlobalObject->m_JSBunRequestParamsPrototype.get(rustGlobalObject); unsigned inlineCapacity = std::min(identifiers.size(), static_cast(JSC::JSFinalObject::maxInlineCapacity)); auto* structure = Structure::create(vm, globalObject, prototype, TypeInfo(FinalObjectType, StructureFlags), JSFinalObject::info(), NonArray, inlineCapacity); @@ -241,7 +241,7 @@ JSObject* ServerRouteList::paramsObjectForRoute(JSC::VM& vm, JSC::JSGlobalObject } template -JSValue ServerRouteList::callRoute(Zig::GlobalObject* globalObject, uint32_t index, void* requestPtr, EncodedJSValue serverObject, EncodedJSValue* requestObject, Req* req) +JSValue ServerRouteList::callRoute(Rust::GlobalObject* globalObject, uint32_t index, void* requestPtr, EncodedJSValue serverObject, EncodedJSValue* requestObject, Req* req) { auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -266,7 +266,7 @@ JSValue ServerRouteList::callRoute(Zig::GlobalObject* globalObject, uint32_t ind } extern "C" JSC::EncodedJSValue Bun__ServerRouteList__callRoute( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, uint32_t index, void* requestPtr, JSC::EncodedJSValue serverObject, @@ -280,7 +280,7 @@ extern "C" JSC::EncodedJSValue Bun__ServerRouteList__callRoute( } extern "C" JSC::EncodedJSValue Bun__ServerRouteList__callRouteH3( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, uint32_t index, void* requestPtr, JSC::EncodedJSValue serverObject, @@ -293,19 +293,19 @@ extern "C" JSC::EncodedJSValue Bun__ServerRouteList__callRouteH3( return JSValue::encode(routeList->callRoute(globalObject, index, requestPtr, serverObject, requestObject, req)); } -extern "C" JSC::EncodedJSValue Bun__ServerRouteList__create(Zig::GlobalObject* globalObject, EncodedJSValue* callbacks, ZigString* paths, size_t pathsLength) +extern "C" JSC::EncodedJSValue Bun__ServerRouteList__create(Rust::GlobalObject* globalObject, EncodedJSValue* callbacks, RustString* paths, size_t pathsLength) { auto* structure = globalObject->m_ServerRouteListStructure.get(globalObject); - auto* routeList = ServerRouteList::create(globalObject->vm(), structure, std::span(callbacks, pathsLength), std::span(paths, pathsLength)); + auto* routeList = ServerRouteList::create(globalObject->vm(), structure, std::span(callbacks, pathsLength), std::span(paths, pathsLength)); return JSValue::encode(routeList); } -Structure* createServerRouteListStructure(JSC::VM& vm, Zig::GlobalObject* globalObject) +Structure* createServerRouteListStructure(JSC::VM& vm, Rust::GlobalObject* globalObject) { return ServerRouteList::createStructure(vm, globalObject); } -JSObject* createJSBunRequestParamsPrototype(JSC::VM& vm, Zig::GlobalObject* globalObject) +JSObject* createJSBunRequestParamsPrototype(JSC::VM& vm, Rust::GlobalObject* globalObject) { auto* prototype = constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure()); prototype->putDirect(vm, vm.propertyNames->toStringTagSymbol, jsString(vm, String("RequestParams"_s)), JSC::PropertyAttribute::DontEnum | 0); diff --git a/src/jsc/bindings/ServerRouteList.h b/src/jsc/bindings/ServerRouteList.h index f81169624d9..9b1e6016776 100644 --- a/src/jsc/bindings/ServerRouteList.h +++ b/src/jsc/bindings/ServerRouteList.h @@ -1,6 +1,6 @@ namespace Bun { -JSC::Structure* createServerRouteListStructure(JSC::VM&, Zig::GlobalObject*); -JSC::JSObject* createJSBunRequestParamsPrototype(JSC::VM&, Zig::GlobalObject*); +JSC::Structure* createServerRouteListStructure(JSC::VM&, Rust::GlobalObject*); +JSC::JSObject* createJSBunRequestParamsPrototype(JSC::VM&, Rust::GlobalObject*); } diff --git a/src/jsc/bindings/ShellBindings.cpp b/src/jsc/bindings/ShellBindings.cpp index f015c9280b4..9a1d4b239c2 100644 --- a/src/jsc/bindings/ShellBindings.cpp +++ b/src/jsc/bindings/ShellBindings.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" extern "C" SYSV_ABI size_t ShellInterpreter__estimatedSize(void* ptr); @@ -9,7 +9,7 @@ namespace Bun { using namespace JSC; using namespace WTF; -extern "C" SYSV_ABI EncodedJSValue Bun__createShellInterpreter(Zig::GlobalObject* _Nonnull globalObject, void* _Nonnull ptr, EncodedJSValue parsed_shell_script, EncodedJSValue resolve, EncodedJSValue reject) +extern "C" SYSV_ABI EncodedJSValue Bun__createShellInterpreter(Rust::GlobalObject* _Nonnull globalObject, void* _Nonnull ptr, EncodedJSValue parsed_shell_script, EncodedJSValue resolve, EncodedJSValue reject) { auto& vm = globalObject->vm(); const auto& existingArgs = uncheckedDowncast(JSValue::decode(parsed_shell_script))->values(); diff --git a/src/jsc/bindings/StringBuilderBinding.cpp b/src/jsc/bindings/StringBuilderBinding.cpp index 121d69bf7d3..cb9b7031fc6 100644 --- a/src/jsc/bindings/StringBuilderBinding.cpp +++ b/src/jsc/bindings/StringBuilderBinding.cpp @@ -2,8 +2,8 @@ #include "BunString.h" #include "headers-handwritten.h" -static_assert(sizeof(WTF::StringBuilder) == 24, "StringBuilder.zig assumes WTF::StringBuilder is 24 bytes"); -static_assert(alignof(WTF::StringBuilder) == 8, "StringBuilder.zig assumes WTF::StringBuilder is 8-byte aligned"); +static_assert(sizeof(WTF::StringBuilder) == 24, "StringBuilder.rust assumes WTF::StringBuilder is 24 bytes"); +static_assert(alignof(WTF::StringBuilder) == 8, "StringBuilder.rust assumes WTF::StringBuilder is 8-byte aligned"); extern "C" void StringBuilder__init(WTF::StringBuilder* ptr) { diff --git a/src/jsc/bindings/StrongRef.cpp b/src/jsc/bindings/StrongRef.cpp index 232b3ac1eea..07ab219bf79 100644 --- a/src/jsc/bindings/StrongRef.cpp +++ b/src/jsc/bindings/StrongRef.cpp @@ -4,7 +4,7 @@ #include #include "BunClientData.h" #include "wtf/DebugHeap.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" extern "C" void Bun__StrongRef__delete(JSC::JSValue* _Nonnull handleSlot) { diff --git a/src/jsc/bindings/TextCodecWrapper.cpp b/src/jsc/bindings/TextCodecWrapper.cpp index d7cbb9e7d47..87a325bfe82 100644 --- a/src/jsc/bindings/TextCodecWrapper.cpp +++ b/src/jsc/bindings/TextCodecWrapper.cpp @@ -1,7 +1,7 @@ #include "root.h" /* - * Wrapper functions for Text Codecs to allow access from Zig + * Wrapper functions for Text Codecs to allow access from Rust */ #include "TextCodec.h" diff --git a/src/jsc/bindings/TopExceptionScopeBinding.cpp b/src/jsc/bindings/TopExceptionScopeBinding.cpp index 19113d6fbb8..3c2d8b2e329 100644 --- a/src/jsc/bindings/TopExceptionScopeBinding.cpp +++ b/src/jsc/bindings/TopExceptionScopeBinding.cpp @@ -10,8 +10,8 @@ using JSC::TopExceptionScope; #define ExpectedTopExceptionScopeAlignment 8 #endif -static_assert(sizeof(TopExceptionScope) == ExpectedTopExceptionScopeSize, "TopExceptionScope.zig assumes TopExceptionScope is 56 bytes"); -static_assert(alignof(TopExceptionScope) == ExpectedTopExceptionScopeAlignment, "TopExceptionScope.zig assumes TopExceptionScope is 8-byte aligned"); +static_assert(sizeof(TopExceptionScope) == ExpectedTopExceptionScopeSize, "TopExceptionScope.rust assumes TopExceptionScope is 56 bytes"); +static_assert(alignof(TopExceptionScope) == ExpectedTopExceptionScopeAlignment, "TopExceptionScope.rust assumes TopExceptionScope is 8-byte aligned"); extern "C" void TopExceptionScope__construct( void* ptr, @@ -22,7 +22,7 @@ extern "C" void TopExceptionScope__construct( size_t size, size_t alignment) { - // validate that Zig is correct about what the size and alignment should be + // validate that Rust is correct about what the size and alignment should be ASSERT(size >= sizeof(TopExceptionScope)); ASSERT(alignment >= alignof(TopExceptionScope)); ASSERT((uintptr_t)ptr % alignment == 0); @@ -72,6 +72,6 @@ extern "C" void TopExceptionScope__assertNoException(void* ptr) { ASSERT((uintptr_t)ptr % alignof(TopExceptionScope) == 0); // this function assumes it should assert in all build modes, anything else would be confusing. - // Zig should only call TopExceptionScope__assertNoException if it wants the assertion. + // Rust should only call TopExceptionScope__assertNoException if it wants the assertion. static_cast(ptr)->releaseAssertNoException(); } diff --git a/src/jsc/bindings/URLSearchParams.cpp b/src/jsc/bindings/URLSearchParams.cpp index 7d5f9d225d8..d8354bd9435 100644 --- a/src/jsc/bindings/URLSearchParams.cpp +++ b/src/jsc/bindings/URLSearchParams.cpp @@ -31,9 +31,9 @@ namespace WebCore { -extern "C" JSC::EncodedJSValue URLSearchParams__create(JSDOMGlobalObject* globalObject, const ZigString* input) +extern "C" JSC::EncodedJSValue URLSearchParams__create(JSDOMGlobalObject* globalObject, const RustString* input) { - String str = Zig::toString(*input); + String str = Rust::toString(*input); auto result = URLSearchParams::create(str, nullptr); return JSC::JSValue::encode(WebCore::toJSNewlyCreated(globalObject, globalObject, WTF::move(result))); } @@ -43,14 +43,14 @@ extern "C" WebCore::URLSearchParams* URLSearchParams__fromJS(JSC::EncodedJSValue return WebCoreCast(value); } -// callback accepting a void* and a const ZigString*, returning void -typedef void (*URLSearchParams__toStringCallback)(void* ctx, const ZigString* str); +// callback accepting a void* and a const RustString*, returning void +typedef void (*URLSearchParams__toStringCallback)(void* ctx, const RustString* str); extern "C" void URLSearchParams__toString(WebCore::URLSearchParams* urlSearchParams, void* ctx, URLSearchParams__toStringCallback callback) { String str = urlSearchParams->toString(); - auto zig = Zig::toZigString(str); - callback(ctx, &zig); + auto rust = Rust::toRustString(str); + callback(ctx, &rust); } URLSearchParams::URLSearchParams(const String& init, DOMURL* associatedURL) diff --git a/src/jsc/bindings/Undici.cpp b/src/jsc/bindings/Undici.cpp index 55ed921c285..fbe51f02776 100644 --- a/src/jsc/bindings/Undici.cpp +++ b/src/jsc/bindings/Undici.cpp @@ -5,7 +5,7 @@ #include "JSURLSearchParams.h" #include "JSAbortSignal.h" #include "JSDOMGlobalObjectInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSFetchHeaders.h" #include "JSDOMFormData.h" @@ -29,7 +29,7 @@ using namespace JSC; using namespace WebCore; // Ensure overriding globals doesn't impact usages. -JSC::JSValue createUndiciInternalBinding(Zig::GlobalObject* globalObject) +JSC::JSValue createUndiciInternalBinding(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); diff --git a/src/jsc/bindings/Undici.h b/src/jsc/bindings/Undici.h index 7ad8f3430a7..911cc4d80aa 100644 --- a/src/jsc/bindings/Undici.h +++ b/src/jsc/bindings/Undici.h @@ -2,6 +2,6 @@ namespace Bun { -JSC::JSValue createUndiciInternalBinding(Zig::GlobalObject* globalObject); +JSC::JSValue createUndiciInternalBinding(Rust::GlobalObject* globalObject); } diff --git a/src/jsc/bindings/UtilInspect.cpp b/src/jsc/bindings/UtilInspect.cpp index ae09d5b11cd..6802782352c 100644 --- a/src/jsc/bindings/UtilInspect.cpp +++ b/src/jsc/bindings/UtilInspect.cpp @@ -5,7 +5,7 @@ #include "JavaScriptCore/JSString.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/JSGlobalObject.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/ObjectConstructor.h" namespace Bun { @@ -25,7 +25,7 @@ Structure* createUtilInspectOptionsStructure(VM& vm, JSC::JSGlobalObject* global return structure; } -JSObject* createInspectOptionsObject(VM& vm, Zig::GlobalObject* globalObject, unsigned max_depth, bool colors) +JSObject* createInspectOptionsObject(VM& vm, Rust::GlobalObject* globalObject, unsigned max_depth, bool colors) { JSFunction* stylizeFn = colors ? globalObject->utilInspectStylizeColorFunction() : globalObject->utilInspectStylizeNoColorFunction(); if (!stylizeFn) return nullptr; @@ -37,7 +37,7 @@ JSObject* createInspectOptionsObject(VM& vm, Zig::GlobalObject* globalObject, un } extern "C" JSC::EncodedJSValue JSC__JSValue__callCustomInspectFunction( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, JSC::EncodedJSValue encodedFunctionValue, JSC::EncodedJSValue encodedThisValue, unsigned depth, diff --git a/src/jsc/bindings/ZigException.cpp b/src/jsc/bindings/ZigException.cpp index fe293087a1d..cba970a0fa0 100644 --- a/src/jsc/bindings/ZigException.cpp +++ b/src/jsc/bindings/ZigException.cpp @@ -1,7 +1,7 @@ /** - * ZigException handling and error processing utilities. + * RustException handling and error processing utilities. * - * This file contains functions for converting JavaScript exceptions to Zig exceptions, + * This file contains functions for converting JavaScript exceptions to Rust exceptions, * processing stack traces, and collecting source lines. */ #include "root.h" @@ -31,7 +31,7 @@ #include "JavaScriptCore/JSString.h" #include "JavaScriptCore/StackFrame.h" #include "JavaScriptCore/VM.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" #include "JavaScriptCore/JSObjectInlines.h" @@ -63,19 +63,19 @@ enum PopulateStackTraceFlags { #define SYNTAX_ERROR_CODE 4 -using Zig::FinalizerSafety; +using Rust::FinalizerSafety; -static void populateStackFrameMetadata(JSC::VM& vm, JSC::JSGlobalObject* globalObject, const JSC::StackFrame& stackFrame, ZigStackFrame& frame, FinalizerSafety finalizerSafety) +static void populateStackFrameMetadata(JSC::VM& vm, JSC::JSGlobalObject* globalObject, const JSC::StackFrame& stackFrame, RustStackFrame& frame, FinalizerSafety finalizerSafety) { if (stackFrame.isWasmFrame()) { - frame.code_type = ZigStackFrameCodeWasm; + frame.code_type = RustStackFrameCodeWasm; - auto name = Zig::functionName(vm, globalObject, stackFrame, finalizerSafety, nullptr); + auto name = Rust::functionName(vm, globalObject, stackFrame, finalizerSafety, nullptr); if (!name.isEmpty()) { frame.function_name = Bun::toStringRef(name); } - auto sourceURL = Zig::sourceURL(vm, stackFrame); + auto sourceURL = Rust::sourceURL(vm, stackFrame); if (sourceURL != "[wasm code]"_s) { // [wasm code] is a useless source URL, so we don't bother to set it. // It is the default value JSC returns. @@ -84,25 +84,25 @@ static void populateStackFrameMetadata(JSC::VM& vm, JSC::JSGlobalObject* globalO return; } - auto sourceURL = Zig::sourceURL(vm, stackFrame); + auto sourceURL = Rust::sourceURL(vm, stackFrame); frame.source_url = Bun::toStringRef(sourceURL); auto m_codeBlock = stackFrame.codeBlock(); if (m_codeBlock) { switch (m_codeBlock->codeType()) { case JSC::EvalCode: { - frame.code_type = ZigStackFrameCodeEval; + frame.code_type = RustStackFrameCodeEval; return; } case JSC::ModuleCode: { - frame.code_type = ZigStackFrameCodeModule; + frame.code_type = RustStackFrameCodeModule; return; } case JSC::GlobalCode: { - frame.code_type = ZigStackFrameCodeGlobal; + frame.code_type = RustStackFrameCodeGlobal; return; } case JSC::FunctionCode: { - frame.code_type = !m_codeBlock->isConstructor() ? ZigStackFrameCodeFunction : ZigStackFrameCodeConstructor; + frame.code_type = !m_codeBlock->isConstructor() ? RustStackFrameCodeFunction : RustStackFrameCodeConstructor; break; } default: @@ -113,12 +113,12 @@ static void populateStackFrameMetadata(JSC::VM& vm, JSC::JSGlobalObject* globalO WTF::String functionName; if (finalizerSafety == FinalizerSafety::MustNotTriggerGC) { // Use the safe overload that avoids property access - functionName = Zig::functionName(vm, globalObject, stackFrame, finalizerSafety, nullptr); + functionName = Rust::functionName(vm, globalObject, stackFrame, finalizerSafety, nullptr); } else { // Use the richer callee-based path if (auto calleeCell = stackFrame.callee()) { if (auto* callee = calleeCell->getObject()) - functionName = Zig::functionName(vm, globalObject, callee); + functionName = Rust::functionName(vm, globalObject, callee); } } if (!functionName.isEmpty()) @@ -129,7 +129,7 @@ static void populateStackFrameMetadata(JSC::VM& vm, JSC::JSGlobalObject* globalO static void populateStackFramePosition(const JSC::StackFrame& stackFrame, BunString* source_lines, OrdinalNumber* source_line_numbers, uint8_t source_lines_count, - ZigStackFramePosition& position, JSC::SourceProvider** referenced_source_provider, PopulateStackTraceFlags flags) + RustStackFramePosition& position, JSC::SourceProvider** referenced_source_provider, PopulateStackTraceFlags flags) { auto code = stackFrame.codeBlock(); if (!code) @@ -156,7 +156,7 @@ static void populateStackFramePosition(const JSC::StackFrame& stackFrame, BunStr } auto location = Bun::getAdjustedPositionForBytecode(code, stackFrame.bytecodeIndex()); - memcpy(&position, &location, sizeof(ZigStackFramePosition)); + memcpy(&position, &location, sizeof(RustStackFramePosition)); if (flags == PopulateStackTraceFlags::OnlyPosition) return; @@ -224,8 +224,8 @@ static void populateStackFramePosition(const JSC::StackFrame& stackFrame, BunStr } } -static void populateStackFrame(JSC::VM& vm, ZigStackTrace& trace, const JSC::StackFrame& stackFrame, - ZigStackFrame& frame, bool is_top, JSC::SourceProvider** referenced_source_provider, JSC::JSGlobalObject* globalObject, PopulateStackTraceFlags flags, FinalizerSafety finalizerSafety) +static void populateStackFrame(JSC::VM& vm, RustStackTrace& trace, const JSC::StackFrame& stackFrame, + RustStackFrame& frame, bool is_top, JSC::SourceProvider** referenced_source_provider, JSC::JSGlobalObject* globalObject, PopulateStackTraceFlags flags, FinalizerSafety finalizerSafety) { if (flags == PopulateStackTraceFlags::OnlyPosition) { populateStackFrameMetadata(vm, globalObject, stackFrame, frame, finalizerSafety); @@ -421,7 +421,7 @@ class V8StackTraceIterator { } }; -static void populateStackTrace(JSC::VM& vm, const WTF::Vector& frames, ZigStackTrace& trace, JSC::JSGlobalObject* globalObject, PopulateStackTraceFlags flags, FinalizerSafety finalizerSafety = FinalizerSafety::NotInFinalizer) +static void populateStackTrace(JSC::VM& vm, const WTF::Vector& frames, RustStackTrace& trace, JSC::JSGlobalObject* globalObject, PopulateStackTraceFlags flags, FinalizerSafety finalizerSafety = FinalizerSafety::NotInFinalizer) { if (flags == PopulateStackTraceFlags::OnlyPosition) { uint8_t frame_i = 0; @@ -437,7 +437,7 @@ static void populateStackTrace(JSC::VM& vm, const WTF::Vector& if (stack_frame_i >= total_frame_count) break; - ZigStackFrame& frame = trace.frames_ptr[frame_i]; + RustStackFrame& frame = trace.frames_ptr[frame_i]; frame.jsc_stack_frame_index = static_cast(stack_frame_i); populateStackFrame(vm, trace, frames[stack_frame_i], frame, frame_i == 0, &trace.referenced_source_provider, globalObject, flags, finalizerSafety); stack_frame_i++; @@ -446,7 +446,7 @@ static void populateStackTrace(JSC::VM& vm, const WTF::Vector& trace.frames_len = frame_i; } else if (flags == PopulateStackTraceFlags::OnlySourceLines) { for (uint8_t i = 0; i < trace.frames_len; i++) { - ZigStackFrame& frame = trace.frames_ptr[i]; + RustStackFrame& frame = trace.frames_ptr[i]; // A call with flags set to OnlySourceLines always follows a call with flags set to OnlyPosition, // so jsc_stack_frame_index is always a valid value here. ASSERT(frame.jsc_stack_frame_index >= 0); @@ -473,7 +473,7 @@ static JSC::JSValue getNonObservable(JSC::VM& vm, JSC::JSGlobalObject* global, J return {}; } -static void fromErrorInstance(ZigException& except, JSC::JSGlobalObject* global, +static void fromErrorInstance(RustException& except, JSC::JSGlobalObject* global, JSC::ErrorInstance* err, const Vector* stackTrace, JSC::JSValue val, PopulateStackTraceFlags flags) { @@ -618,9 +618,9 @@ static void fromErrorInstance(ZigException& except, JSC::JSGlobalObject* global, current.is_async = frame.isAsync; if (frame.isConstructor) { - current.code_type = ZigStackFrameCodeConstructor; + current.code_type = RustStackFrameCodeConstructor; } else if (frame.isGlobalCode) { - current.code_type = ZigStackFrameCodeGlobal; + current.code_type = RustStackFrameCodeGlobal; } except.stack.frames_len += 1; @@ -700,7 +700,7 @@ static void fromErrorInstance(ZigException& except, JSC::JSGlobalObject* global, } } -void exceptionFromString(ZigException& except, JSC::JSValue value, JSC::JSGlobalObject* global) +void exceptionFromString(RustException& except, JSC::JSValue value, JSC::JSGlobalObject* global) { auto& vm = JSC::getVM(global); if (vm.hasPendingTerminationException()) [[unlikely]] { @@ -827,12 +827,12 @@ void exceptionFromString(ZigException& except, JSC::JSValue value, JSC::JSGlobal except.message = Bun::toStringRef(str); } -extern "C" void JSC__Exception__getStackTrace(JSC::Exception* arg0, JSC::JSGlobalObject* global, ZigStackTrace* trace) +extern "C" void JSC__Exception__getStackTrace(JSC::Exception* arg0, JSC::JSGlobalObject* global, RustStackTrace* trace) { populateStackTrace(arg0->vm(), arg0->stack(), *trace, global, PopulateStackTraceFlags::OnlyPosition); } -extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSValue__toZigException(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, ZigException* exception) +extern "C" [[RUST_EXPORT(check_slow)]] void JSC__JSValue__toRustException(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, RustException* exception) { JSC::JSValue value = JSC::JSValue::decode(jsException); if (value == JSC::JSValue {}) { @@ -867,7 +867,7 @@ extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSValue__toZigException(JSC::Enc exceptionFromString(*exception, value, global); } -extern "C" void ZigException__collectSourceLines(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, ZigException* exception) +extern "C" void RustException__collectSourceLines(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, RustException* exception) { JSC::JSValue value = JSC::JSValue::decode(jsException); if (value == JSC::JSValue {}) { diff --git a/src/jsc/bindings/ZigGlobalObject.cpp b/src/jsc/bindings/ZigGlobalObject.cpp index a7969dc8097..f6075d43bc6 100644 --- a/src/jsc/bindings/ZigGlobalObject.cpp +++ b/src/jsc/bindings/ZigGlobalObject.cpp @@ -1,6 +1,6 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" #include "JavaScriptCore/ArgList.h" #include "JavaScriptCore/JSCellButterfly.h" @@ -164,8 +164,8 @@ #include "WebCoreJSBuiltins.h" #include "webcrypto/JSCryptoKey.h" #include "webcrypto/JSSubtleCrypto.h" -#include "ZigGeneratedClasses.h" -#include "ZigSourceProvider.h" +#include "RustGeneratedClasses.h" +#include "RustSourceProvider.h" #include "UtilInspect.h" #include "Base64Helpers.h" #include "wtf/text/OrdinalNumber.h" @@ -268,7 +268,7 @@ extern "C" unsigned getJSCBytecodeCacheVersion() // Declare fuzzilli function registration from FuzzilliREPRL.cpp #ifdef FUZZILLI_ENABLED -extern "C" void Bun__REPRL__registerFuzzilliFunctions(Zig::GlobalObject*); +extern "C" void Bun__REPRL__registerFuzzilliFunctions(Rust::GlobalObject*); #endif extern "C" void JSCInitialize(const char* envp[], size_t envc, void (*onCrash)(const char* ptr, size_t length), bool evalMode, bool oneShotStartup) @@ -278,7 +278,7 @@ extern "C" void JSCInitialize(const char* envp[], size_t envc, void (*onCrash)(c std::call_once(jsc_init_flag, [evalMode, oneShotStartup, envp, envc, onCrash]() { JSC::Config::enableRestrictedOptions(); - std::set_terminate([]() { Zig__GlobalObject__onCrash(); }); + std::set_terminate([]() { Rust__GlobalObject__onCrash(); }); WTF::initializeMainThread(); // Use JSC::initialize with a callback to set Options during initialization. @@ -352,9 +352,9 @@ extern "C" void JSCInitialize(const char* envp[], size_t envc, void (*onCrash)(c extern "C" void* Bun__getVM(); -extern "C" void Bun__setDefaultGlobalObject(Zig::GlobalObject* globalObject); +extern "C" void Bun__setDefaultGlobalObject(Rust::GlobalObject* globalObject); -// Declare the Zig functions for LazyProperty initializers +// Declare the Rust functions for LazyProperty initializers extern "C" JSC::EncodedJSValue BunObject__createBunStdin(JSC::JSGlobalObject*); extern "C" JSC::EncodedJSValue BunObject__createBunStderr(JSC::JSGlobalObject*); extern "C" JSC::EncodedJSValue BunObject__createBunStdout(JSC::JSGlobalObject*); @@ -416,7 +416,7 @@ JSC::Structure* GlobalObject::createStructure(JSC::VM& vm) return structure; } -void Zig::GlobalObject::resetOnEachMicrotaskTick() +void Rust::GlobalObject::resetOnEachMicrotaskTick() { auto& vm = this->vm(); if (this->asyncHooksNeedsCleanup) { @@ -435,7 +435,7 @@ extern "C" size_t Bun__reported_memory_size; // executionContextId: -1 for main thread // executionContextId: maxInt32 for macros // executionContextId: >-1 for workers -extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr) +extern "C" JSC::JSGlobalObject* Rust__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr) { auto heapSize = miniMode ? JSC::HeapType::Small : JSC::HeapType::Large; RefPtr vmPtr = JSC::VM::tryCreate(heapSize); @@ -480,32 +480,32 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, WebCore::JSVMClientData::create(&vm, Bun__getVM()); - const auto createGlobalObject = [&]() -> Zig::GlobalObject* { + const auto createGlobalObject = [&]() -> Rust::GlobalObject* { if (executionContextId == std::numeric_limits::max() || executionContextId > 1) [[unlikely]] { - auto* structure = Zig::GlobalObject::createStructure(vm); + auto* structure = Rust::GlobalObject::createStructure(vm); if (!structure) [[unlikely]] { return nullptr; } - return Zig::GlobalObject::create( + return Rust::GlobalObject::create( vm, structure, static_cast(executionContextId)); } else if (evalMode) { - auto* structure = Zig::EvalGlobalObject::createStructure(vm); + auto* structure = Rust::EvalGlobalObject::createStructure(vm); if (!structure) [[unlikely]] { return nullptr; } - return Zig::EvalGlobalObject::create( + return Rust::EvalGlobalObject::create( vm, structure, - &Zig::EvalGlobalObject::globalObjectMethodTable()); + &Rust::EvalGlobalObject::globalObjectMethodTable()); } else { - auto* structure = Zig::GlobalObject::createStructure(vm); + auto* structure = Rust::GlobalObject::createStructure(vm); if (!structure) [[unlikely]] { return nullptr; } - return Zig::GlobalObject::create( + return Rust::GlobalObject::create( vm, structure); } @@ -523,7 +523,7 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, JSC::gcProtect(globalObject); #ifdef FUZZILLI_ENABLED - Bun__REPRL__registerFuzzilliFunctions(static_cast(globalObject)); + Bun__REPRL__registerFuzzilliFunctions(static_cast(globalObject)); #endif vm.setOnComputeErrorInfo(computeErrorInfoWrapperToString); @@ -582,10 +582,10 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, return globalObject; } -// Create a fresh Zig::GlobalObject on the *same* JSC::VM as `oldGlobal`, then unprotect +// Create a fresh Rust::GlobalObject on the *same* JSC::VM as `oldGlobal`, then unprotect // the old one so GC can reclaim its module graph. Used by `bun test --isolate` to give // each test file a clean global without paying for a new JSC::VM. -extern "C" JSC::JSGlobalObject* Zig__GlobalObject__createForTestIsolation(Zig::GlobalObject* oldGlobal, void* console_client) +extern "C" JSC::JSGlobalObject* Rust__GlobalObject__createForTestIsolation(Rust::GlobalObject* oldGlobal, void* console_client) { JSC::VM& vm = oldGlobal->vm(); JSC::JSLockHolder locker(vm); @@ -610,11 +610,11 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__createForTestIsolation(Zig::G oldContext->removeFromContextsMap(); oldContext->regenerateIdentifier(); - auto* structure = Zig::GlobalObject::createStructure(vm); + auto* structure = Rust::GlobalObject::createStructure(vm); if (!structure) [[unlikely]] { BUN_PANIC("Failed to allocate global object structure for test isolation"); } - auto* globalObject = Zig::GlobalObject::create(vm, structure, inheritedId); + auto* globalObject = Rust::GlobalObject::create(vm, structure, inheritedId); if (!globalObject) [[unlikely]] { BUN_PANIC("Failed to allocate global object for test isolation"); } @@ -625,7 +625,7 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__createForTestIsolation(Zig::G Bun__setDefaultGlobalObject(globalObject); JSC::gcProtect(globalObject); - // NapiEnv holds a raw Zig::GlobalObject*; deferred napi finalizers for + // NapiEnv holds a raw Rust::GlobalObject*; deferred napi finalizers for // the old global's objects run on the next event-loop tick — after this // function returns and the old global is collectable — and would write // into the dead cell via NapiHandleScope::open. Point those envs at the @@ -644,7 +644,7 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__createForTestIsolation(Zig::G JSC_DEFINE_HOST_FUNCTION(functionFulfillModuleSync, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -744,7 +744,7 @@ JSC_DEFINE_HOST_FUNCTION(functionEsmRegistryEvaluatedKeys, (JSC::JSGlobalObject JSC_DEFINE_HOST_FUNCTION(functionEsmLoadSync, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSValue keyValue = callFrame->argument(0); @@ -831,30 +831,30 @@ JSC_DEFINE_HOST_FUNCTION(functionEsmLoadSync, (JSC::JSGlobalObject * lexicalGlob return JSValue::encode(ns); } -extern "C" void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject*) +extern "C" void* Rust__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject*) { // The JSC module loader registry is no longer a JS Map; snapshot/restore - // is no longer supported. The only Zig declaration of this symbol has no + // is no longer supported. The only Rust declaration of this symbol has no // callers, so this is dead code kept for ABI compatibility. return nullptr; } -extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject*, void*) +extern "C" bool Rust__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject*, void*) { - // See Zig__GlobalObject__getModuleRegistryMap above. + // See Rust__GlobalObject__getModuleRegistryMap above. return false; } #define WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ConstructorName) \ JSValue ConstructorName##ConstructorCallback(VM& vm, JSObject* lexicalGlobalObject) \ { \ - return WebCore::JS##ConstructorName::getConstructor(vm, uncheckedDowncast(lexicalGlobalObject)); \ + return WebCore::JS##ConstructorName::getConstructor(vm, uncheckedDowncast(lexicalGlobalObject)); \ } \ JSC_DEFINE_CUSTOM_GETTER(ConstructorName##_getter, \ (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \ JSC::PropertyName)) \ { \ - return JSC::JSValue::encode(WebCore::JS##ConstructorName::getConstructor(lexicalGlobalObject->vm(), uncheckedDowncast(lexicalGlobalObject))); \ + return JSC::JSValue::encode(WebCore::JS##ConstructorName::getConstructor(lexicalGlobalObject->vm(), uncheckedDowncast(lexicalGlobalObject))); \ } String GlobalObject::defaultAgentClusterID() @@ -870,20 +870,20 @@ String GlobalObject::agentClusterID() const return defaultAgentClusterID(); } -namespace Zig { +namespace Rust { using namespace WebCore; static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); - // Same reasoning as Zig__GlobalObject__createForTestIsolation: keep the + // Same reasoning as Rust__GlobalObject__createForTestIsolation: keep the // concurrent marker from walking the new global while finishCreation/init // is still populating it. JSC::DeferGC deferGC(vm); - Zig::GlobalObject* shadow = Zig::GlobalObject::create( + Rust::GlobalObject* shadow = Rust::GlobalObject::create( vm, - Zig::GlobalObject::createStructure(vm), + Rust::GlobalObject::createStructure(vm), ScriptExecutionContext::generateIdentifier()); shadow->setConsole(shadow); @@ -891,9 +891,9 @@ static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObjec } extern "C" int Bun__VM__scriptExecutionStatus(void*); -JSC::ScriptExecutionStatus Zig::GlobalObject::scriptExecutionStatus(JSC::JSGlobalObject* globalObject, JSC::JSObject*) +JSC::ScriptExecutionStatus Rust::GlobalObject::scriptExecutionStatus(JSC::JSGlobalObject* globalObject, JSC::JSObject*) { - switch (Bun__VM__scriptExecutionStatus(uncheckedDowncast(globalObject)->bunVM())) { + switch (Bun__VM__scriptExecutionStatus(uncheckedDowncast(globalObject)->bunVM())) { case 0: return JSC::ScriptExecutionStatus::Running; case 1: @@ -928,7 +928,7 @@ const JSC::GlobalObjectMethodTable& GlobalObject::globalObjectMethodTable() nullptr, // defaultLanguage &compileStreaming, &instantiateStreaming, - &Zig::deriveShadowRealmGlobalObject, + &Rust::deriveShadowRealmGlobalObject, &codeForEval, // codeForEval &canCompileStrings, // canCompileStrings &trustedScriptStructure, // trustedScriptStructure @@ -956,7 +956,7 @@ const JSC::GlobalObjectMethodTable& EvalGlobalObject::globalObjectMethodTable() nullptr, // defaultLanguage &compileStreaming, &instantiateStreaming, - &Zig::deriveShadowRealmGlobalObject, + &Rust::deriveShadowRealmGlobalObject, &codeForEval, // codeForEval &canCompileStrings, // canCompileStrings &trustedScriptStructure, // trustedScriptStructure @@ -1030,12 +1030,12 @@ void GlobalObject::reportUncaughtExceptionAtEventLoop(JSGlobalObject* globalObje Bun__reportUnhandledError(globalObject, JSValue::encode(JSValue(exception))); } -extern "C" void Bun__handleHandledPromise(Zig::GlobalObject* JSGlobalObject, JSC::JSPromise* promise); +extern "C" void Bun__handleHandledPromise(Rust::GlobalObject* JSGlobalObject, JSC::JSPromise* promise); void GlobalObject::promiseRejectionTracker(JSGlobalObject* obj, JSC::JSPromise* promise, JSC::JSPromiseRejectionOperation operation) { - // Zig__GlobalObject__promiseRejectionTracker( + // Rust__GlobalObject__promiseRejectionTracker( // obj, prom, reject == JSC::JSPromiseRejectionOperation::Reject ? 0 : 1); // Do this in C++ for now @@ -1065,7 +1065,7 @@ JSC_DEFINE_CUSTOM_GETTER(errorConstructorPrepareStackTraceGetter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); if (thisObject->m_errorConstructorPrepareStackTraceValue) { return JSValue::encode(thisObject->m_errorConstructorPrepareStackTraceValue.get()); } @@ -1078,7 +1078,7 @@ JSC_DEFINE_CUSTOM_SETTER(errorConstructorPrepareStackTraceSetter, JSC::EncodedJSValue encodedValue, JSC::PropertyName property)) { auto& vm = JSC::getVM(lexicalGlobalObject); - Zig::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); JSValue value = JSValue::decode(encodedValue); if (value == thisObject->m_errorConstructorPrepareStackTraceInternalValue.get(thisObject)) { thisObject->m_errorConstructorPrepareStackTraceValue.clear(); @@ -1095,7 +1095,7 @@ JSC_DEFINE_CUSTOM_GETTER(globalOnMessage, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); + Rust::GlobalObject* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); return JSValue::encode(eventHandlerAttribute(thisObject->eventTarget(), eventNames().messageEvent, thisObject->world())); } @@ -1103,7 +1103,7 @@ JSC_DEFINE_CUSTOM_GETTER(globalOnError, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); + Rust::GlobalObject* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); return JSValue::encode(eventHandlerAttribute(thisObject->eventTarget(), eventNames().errorEvent, thisObject->world())); } @@ -1113,7 +1113,7 @@ JSC_DEFINE_CUSTOM_SETTER(setGlobalOnMessage, { auto& vm = JSC::getVM(lexicalGlobalObject); JSValue value = JSValue::decode(encodedValue); - auto* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); + auto* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); setEventHandlerAttribute(thisObject->eventTarget(), eventNames().messageEvent, value, *thisObject); vm.writeBarrier(thisObject, value); ensureStillAliveHere(value); @@ -1126,7 +1126,7 @@ JSC_DEFINE_CUSTOM_SETTER(setGlobalOnError, { auto& vm = JSC::getVM(lexicalGlobalObject); JSValue value = JSValue::decode(encodedValue); - auto* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); + auto* thisObject = uncheckedDowncast(JSValue::decode(thisValue)); setEventHandlerAttribute(thisObject->eventTarget(), eventNames().errorEvent, value, *thisObject); vm.writeBarrier(thisObject, value); ensureStillAliveHere(value); @@ -1142,7 +1142,7 @@ JSC_DEFINE_CUSTOM_GETTER(functionLazyLoadStreamPrototypeMap_getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - Zig::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(lexicalGlobalObject); return JSC::JSValue::encode( thisObject->readableStreamNativeMap()); } @@ -1151,10 +1151,10 @@ JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - return JSC::JSValue::encode(uncheckedDowncast(lexicalGlobalObject)->JSBufferConstructor()); + return JSC::JSValue::encode(uncheckedDowncast(lexicalGlobalObject)->JSBufferConstructor()); } -// This macro defines the getter needed for ZigGlobalObject.lut.h +// This macro defines the getter needed for RustGlobalObject.lut.h // "ConstructorCallback" is a PropertyCallback // it also defines "_getter" which is the getter for a JSC::CustomGetterSetter WEBCORE_GENERATED_CONSTRUCTOR_GETTER(AbortController); @@ -1444,7 +1444,7 @@ extern "C" JSC::EncodedJSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* subclassStructure = isBuffer ? static_cast(globalObject)->JSBufferSubclassStructure() : globalObject->typedArrayStructureWithTypedArrayType(); + auto* subclassStructure = isBuffer ? static_cast(globalObject)->JSBufferSubclassStructure() : globalObject->typedArrayStructureWithTypedArrayType(); JSC::JSUint8Array* array = JSC::JSUint8Array::createUninitialized(globalObject, subclassStructure, len); RETURN_IF_EXCEPTION(scope, {}); @@ -1517,7 +1517,7 @@ JSC_DEFINE_HOST_FUNCTION(functionCreateUninitializedArrayBuffer, RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTF::move(arrayBuffer)))); } -static inline JSC::EncodedJSValue jsFunctionAddEventListenerBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Zig::GlobalObject* castedThis) +static inline JSC::EncodedJSValue jsFunctionAddEventListenerBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Rust::GlobalObject* castedThis) { auto& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1543,10 +1543,10 @@ static inline JSC::EncodedJSValue jsFunctionAddEventListenerBody(JSC::JSGlobalOb JSC_DEFINE_HOST_FUNCTION(jsFunctionAddEventListener, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - return jsFunctionAddEventListenerBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); + return jsFunctionAddEventListenerBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); } -static inline JSC::EncodedJSValue jsFunctionRemoveEventListenerBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Zig::GlobalObject* castedThis) +static inline JSC::EncodedJSValue jsFunctionRemoveEventListenerBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Rust::GlobalObject* castedThis) { auto& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1572,10 +1572,10 @@ static inline JSC::EncodedJSValue jsFunctionRemoveEventListenerBody(JSC::JSGloba JSC_DEFINE_HOST_FUNCTION(jsFunctionRemoveEventListener, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - return jsFunctionRemoveEventListenerBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); + return jsFunctionRemoveEventListenerBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); } -static inline JSC::EncodedJSValue jsFunctionDispatchEventBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Zig::GlobalObject* castedThis) +static inline JSC::EncodedJSValue jsFunctionDispatchEventBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Rust::GlobalObject* castedThis) { auto& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1592,12 +1592,12 @@ static inline JSC::EncodedJSValue jsFunctionDispatchEventBody(JSC::JSGlobalObjec JSC_DEFINE_HOST_FUNCTION(jsFunctionDispatchEvent, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - return jsFunctionDispatchEventBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); + return jsFunctionDispatchEventBody(lexicalGlobalObject, callFrame, dynamicDowncast(lexicalGlobalObject)); } JSC_DEFINE_CUSTOM_GETTER(getterSubtleCrypto, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { - return JSValue::encode(static_cast(lexicalGlobalObject)->subtleCrypto()); + return JSValue::encode(static_cast(lexicalGlobalObject)->subtleCrypto()); } extern "C" JSC::EncodedJSValue ExpectMatcherUtils_createSigleton(JSC::JSGlobalObject* lexicalGlobalObject); @@ -1719,12 +1719,12 @@ JSC_DEFINE_HOST_FUNCTION(isAbortSignal, (JSGlobalObject*, CallFrame* callFrame)) } extern "C" JSC::EncodedJSValue Bun__Jest__createTestModuleObject(JSC::JSGlobalObject*); -extern "C" JSC::EncodedJSValue Bun__Jest__testModuleObject(Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__Jest__testModuleObject(Rust::GlobalObject* globalObject) { return JSValue::encode(globalObject->lazyTestModuleObject()); } -extern "C" napi_env ZigGlobalObject__makeNapiEnvForFFI(Zig::GlobalObject* globalObject) +extern "C" napi_env RustGlobalObject__makeNapiEnvForFFI(Rust::GlobalObject* globalObject) { return globalObject->makeNapiEnvForFFI(); } @@ -1972,7 +1972,7 @@ void GlobalObject::finishCreation(VM& vm) m_commonJSModuleObjectStructure.initLater( [](const Initializer& init) { - init.set(Bun::createCommonJSModuleStructure(static_cast(init.owner))); + init.set(Bun::createCommonJSModuleStructure(static_cast(init.owner))); }); m_JSSocketAddressDTOStructure.initLater( @@ -2013,7 +2013,7 @@ void GlobalObject::finishCreation(VM& vm) v8::shim::GlobalInternals::create( init.vm, v8::shim::GlobalInternals::createStructure(init.vm, init.owner), - dynamicDowncast(init.owner))); + dynamicDowncast(init.owner))); }); m_JSStatsClassStructure.initLater( @@ -2040,7 +2040,7 @@ void GlobalObject::finishCreation(VM& vm) [](const JSC::LazyProperty::Initializer& init) { init.set( createMemoryFootprintStructure( - init.vm, static_cast(init.owner))); + init.vm, static_cast(init.owner))); }); m_errorConstructorPrepareStackTraceInternalValue.initLater( @@ -2064,7 +2064,7 @@ void GlobalObject::finishCreation(VM& vm) m_JSBufferSubclassStructure.initLater( [](const Initializer& init) { auto scope = DECLARE_TOP_EXCEPTION_SCOPE(init.vm); - auto* globalObject = static_cast(init.owner); + auto* globalObject = static_cast(init.owner); auto* baseStructure = globalObject->typedArrayStructureWithTypedArrayType(); JSC::Structure* subclassStructure = JSC::InternalFunction::createSubclassStructure(globalObject, globalObject->JSBufferConstructor(), baseStructure); scope.assertNoExceptionExceptTermination(); @@ -2073,7 +2073,7 @@ void GlobalObject::finishCreation(VM& vm) m_JSResizableOrGrowableSharedBufferSubclassStructure.initLater( [](const Initializer& init) { auto scope = DECLARE_TOP_EXCEPTION_SCOPE(init.vm); - auto* globalObject = static_cast(init.owner); + auto* globalObject = static_cast(init.owner); auto* baseStructure = globalObject->resizableOrGrowableSharedTypedArrayStructureWithTypedArrayType(); JSC::Structure* subclassStructure = JSC::InternalFunction::createSubclassStructure(globalObject, globalObject->JSBufferConstructor(), baseStructure); scope.assertNoExceptionExceptTermination(); @@ -2087,7 +2087,7 @@ void GlobalObject::finishCreation(VM& vm) m_utilInspectFunction.initLater( [](const Initializer& init) { auto scope = DECLARE_THROW_SCOPE(init.vm); - JSValue nodeUtilValue = uncheckedDowncast(init.owner)->internalModuleRegistry()->requireId(init.owner, init.vm, Bun::InternalModuleRegistry::Field::NodeUtil); + JSValue nodeUtilValue = uncheckedDowncast(init.owner)->internalModuleRegistry()->requireId(init.owner, init.vm, Bun::InternalModuleRegistry::Field::NodeUtil); RETURN_IF_EXCEPTION(scope, ); RELEASE_ASSERT(nodeUtilValue.isObject()); auto prop = nodeUtilValue.getObject()->getIfPropertyExists(init.owner, Identifier::fromString(init.vm, "inspect"_s)); @@ -2114,7 +2114,7 @@ void GlobalObject::finishCreation(VM& vm) [](const Initializer& init) { auto scope = DECLARE_THROW_SCOPE(init.vm); JSC::MarkedArgumentBuffer args; - args.append(uncheckedDowncast(init.owner)->utilInspectFunction()); + args.append(uncheckedDowncast(init.owner)->utilInspectFunction()); RETURN_IF_EXCEPTION(scope, ); JSC::JSFunction* getStylize = JSC::JSFunction::create(init.vm, init.owner, utilInspectGetStylizeWithColorCodeGenerator(init.vm), init.owner); @@ -2240,17 +2240,17 @@ void GlobalObject::finishCreation(VM& vm) m_ServerRouteListStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Bun::createServerRouteListStructure(init.vm, static_cast(init.owner))); + init.set(Bun::createServerRouteListStructure(init.vm, static_cast(init.owner))); }); m_JSBunRequestParamsPrototype.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Bun::createJSBunRequestParamsPrototype(init.vm, static_cast(init.owner))); + init.set(Bun::createJSBunRequestParamsPrototype(init.vm, static_cast(init.owner))); }); m_JSBunRequestStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Bun::createJSBunRequestStructure(init.vm, static_cast(init.owner))); + init.set(Bun::createJSBunRequestStructure(init.vm, static_cast(init.owner))); }); m_NapiHandleScopeImplStructure.initLater([](const JSC::LazyProperty::Initializer& init) { @@ -2277,7 +2277,7 @@ void GlobalObject::finishCreation(VM& vm) m_subtleCryptoObject.initLater( [](const JSC::LazyProperty::Initializer& init) { - auto& global = *static_cast(init.owner); + auto& global = *static_cast(init.owner); if (!global.m_subtleCrypto) { global.m_subtleCrypto = &WebCore::SubtleCrypto::create(global.scriptExecutionContext()).leakRef(); @@ -2288,7 +2288,7 @@ void GlobalObject::finishCreation(VM& vm) m_NapiClassStructure.initLater( [](LazyClassStructure::Initializer& init) { - init.setStructure(Zig::NapiClass::createStructure(init.vm, init.global, init.global->functionPrototype())); + init.setStructure(Rust::NapiClass::createStructure(init.vm, init.global, init.global->functionPrototype())); }); m_JSArrayBufferControllerPrototype.initLater( @@ -2323,13 +2323,13 @@ void GlobalObject::finishCreation(VM& vm) m_performanceObject.initLater( [](const JSC::LazyProperty::Initializer& init) { - auto* globalObject = static_cast(init.owner); + auto* globalObject = static_cast(init.owner); init.set(toJS(init.owner, globalObject, globalObject->performance().get()).getObject()); }); m_processEnvObject.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Bun::createEnvironmentVariablesMap(static_cast(init.owner)).getObject()); + init.set(Bun::createEnvironmentVariablesMap(static_cast(init.owner)).getObject()); }); m_processObject.initLater( @@ -2418,12 +2418,12 @@ void GlobalObject::finishCreation(VM& vm) m_importMetaObjectStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Zig::ImportMetaObject::createStructure(init.vm, init.owner)); + init.set(Rust::ImportMetaObject::createStructure(init.vm, init.owner)); }); m_importMetaBakeObjectStructure.initLater( [](const JSC::LazyProperty::Initializer& init) { - init.set(Zig::ImportMetaObject::createStructure(init.vm, init.owner, true)); + init.set(Rust::ImportMetaObject::createStructure(init.vm, init.owner, true)); }); m_asyncBoundFunctionStructure.initLater( @@ -2501,7 +2501,7 @@ void GlobalObject::finishCreation(VM& vm) m_JSCryptoKey.initLater( [](const JSC::LazyProperty::Initializer& init) { - Zig::GlobalObject* globalObject = static_cast(init.owner); + Rust::GlobalObject* globalObject = static_cast(init.owner); auto* prototype = JSCryptoKey::createPrototype(init.vm, *globalObject); auto* structure = JSCryptoKey::createStructure(init.vm, init.owner, JSValue(prototype)); init.set(structure); @@ -2551,7 +2551,7 @@ void GlobalObject::finishCreation(VM& vm) m_JSFFIFunctionStructure.initLater( [](LazyClassStructure::Initializer& init) { - init.setStructure(Zig::JSFFIFunction::createStructure(init.vm, init.global, init.global->functionPrototype())); + init.setStructure(Rust::JSFFIFunction::createStructure(init.vm, init.global, init.global->functionPrototype())); }); // Initialize LazyProperties for stdin/stderr/stdout @@ -2578,7 +2578,7 @@ void GlobalObject::finishCreation(VM& vm) JSC_DEFINE_CUSTOM_GETTER(JSDOMFileConstructor_getter, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, PropertyName)) { - Zig::GlobalObject* bunGlobalObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* bunGlobalObject = uncheckedDowncast(globalObject); return JSValue::encode( bunGlobalObject->JSDOMFileConstructor()); } @@ -2621,7 +2621,7 @@ JSC_DEFINE_CUSTOM_GETTER(getConsoleStdout, (JSGlobalObject * globalObject, Encod { auto& vm = JSC::getVM(globalObject); auto console = JSValue::decode(thisValue).getObject(); - auto global = uncheckedDowncast(globalObject); + auto global = uncheckedDowncast(globalObject); // instead of calling the constructor builtin, go through the process.stdout getter to ensure it's only created once. auto stdoutValue = global->processObject()->get(globalObject, Identifier::fromString(vm, "stdout"_s)); @@ -2636,7 +2636,7 @@ JSC_DEFINE_CUSTOM_GETTER(getConsoleStderr, (JSGlobalObject * globalObject, Encod { auto& vm = JSC::getVM(globalObject); auto console = JSValue::decode(thisValue).getObject(); - auto global = uncheckedDowncast(globalObject); + auto global = uncheckedDowncast(globalObject); // instead of calling the constructor builtin, go through the process.stdout getter to ensure it's only created once. auto stderrValue = global->processObject()->get(globalObject, Identifier::fromString(vm, "stderr"_s)); @@ -2662,7 +2662,7 @@ JSC_DEFINE_CUSTOM_GETTER(getConsoleStderr, (JSGlobalObject * globalObject, Encod JSC_DEFINE_CUSTOM_GETTER(getterName, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue, PropertyName name)) \ { \ auto& vm = JSC::getVM(lexicalGlobalObject); \ - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); \ + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); \ JSC::JSFunction* fn = globalObject->putDirectBuiltinFunction(vm, globalObject, name, codeGenerator(vm), (attributes)); \ return JSValue::encode(fn); \ } @@ -2742,7 +2742,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionCheckBufferRead, (JSC::JSGlobalObject * globa } extern "C" EncodedJSValue Bun__assignStreamIntoResumableSink(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue stream, JSC::EncodedJSValue sink) { - Zig::GlobalObject* globalThis = static_cast(globalObject); + Rust::GlobalObject* globalThis = static_cast(globalObject); return globalThis->assignStreamToResumableSink(JSValue::decode(stream), JSValue::decode(sink)); } EncodedJSValue GlobalObject::assignStreamToResumableSink(JSValue stream, JSValue sink) @@ -2802,7 +2802,7 @@ JSC_DEFINE_CUSTOM_GETTER(functionLazyNavigatorGetter, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { - return JSC::JSValue::encode(static_cast(globalObject)->navigatorObject()); + return JSC::JSValue::encode(static_cast(globalObject)->navigatorObject()); } JSC::GCClient::IsoSubspace* GlobalObject::subspaceForImpl(JSC::VM& vm) @@ -2822,12 +2822,12 @@ BUN_DECLARE_HOST_FUNCTION(WebCore__confirm); JSValue GlobalObject_getPerformanceObject(VM& vm, JSObject* globalObject) { - return uncheckedDowncast(globalObject)->performanceObject(); + return uncheckedDowncast(globalObject)->performanceObject(); } JSValue GlobalObject_getGlobalThis(VM& vm, JSObject* globalObject) { - return uncheckedDowncast(globalObject)->globalThis(); + return uncheckedDowncast(globalObject)->globalThis(); } // This is like `putDirectBuiltinFunction` but for the global static list. @@ -2973,7 +2973,7 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm) // ===================== start conditional builtin globals ===================== // These functions register globals based on runtime conditions (e.g. CLI flags, -// environment variables, etc.). See `Run.addConditionalGlobals()` in bun_js.zig +// environment variables, etc.). See `Run.addConditionalGlobals()` in bun_js.rust // for where these are called. /// `globalThis.gc()` is an alias for `Bun.gc(true)` @@ -2982,12 +2982,12 @@ extern "C" size_t Bun__gc(void* vm, bool sync); JSC_DEFINE_HOST_FUNCTION(functionJsGc, (JSC::JSGlobalObject * global, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = defaultGlobalObject(global); + Rust::GlobalObject* globalObject = defaultGlobalObject(global); Bun__gc(globalObject->bunVM(), true); return JSValue::encode(jsUndefined()); } -extern "C" [[ZIG_EXPORT(nothrow)]] void JSC__JSGlobalObject__addGc(JSC::JSGlobalObject* globalObject) +extern "C" [[RUST_EXPORT(nothrow)]] void JSC__JSGlobalObject__addGc(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); globalObject->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(vm, "gc"_s), 0, functionJsGc, ImplementationVisibility::Public, JSC::NoIntrinsic, PropertyAttribute::DontEnum | 0); @@ -3043,12 +3043,12 @@ uint8_t GlobalObject::drainMicrotasks() return 0; } -extern "C" uint8_t JSC__JSGlobalObject__drainMicrotasks(Zig::GlobalObject* globalObject) +extern "C" uint8_t JSC__JSGlobalObject__drainMicrotasks(Rust::GlobalObject* globalObject) { return globalObject->drainMicrotasks(); } -extern "C" EncodedJSValue JSC__JSGlobalObject__getHTTP2CommonString(Zig::GlobalObject* globalObject, uint32_t hpack_index) +extern "C" EncodedJSValue JSC__JSGlobalObject__getHTTP2CommonString(Rust::GlobalObject* globalObject, uint32_t hpack_index) { auto value = globalObject->http2CommonStrings().getStringFromHPackIndex(hpack_index, globalObject); if (value != nullptr) { @@ -3072,7 +3072,7 @@ template static void visitGlobalObjectMember(Visitor& vi // The two unique_ptr members (m_builtinInternalFunctions, m_constructors) are // populated in the constructor initializer list, so in steady state this is // never null. The guard exists because the concurrent marker can visit a - // Zig::GlobalObject picked up via conservative stack scan while its own + // Rust::GlobalObject picked up via conservative stack scan while its own // IsoSubspace slot is being recycled from a previously-destroyed global whose // unique_ptr members were reset to null by ~unique_ptr(); until placement-new // re-initializes them there is a brief window where the pointer reads as null. @@ -3114,11 +3114,11 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor) thisObject->visitAdditionalChildrenInGCThread(visitor); } -extern "C" bool JSGlobalObject__setTimeZone(JSC::JSGlobalObject* globalObject, const ZigString* timeZone) +extern "C" bool JSGlobalObject__setTimeZone(JSC::JSGlobalObject* globalObject, const RustString* timeZone) { auto& vm = JSC::getVM(globalObject); - if (WTF::setTimeZoneOverride(Zig::toString(*timeZone))) { + if (WTF::setTimeZoneOverride(Rust::toString(*timeZone))) { vm.dateCache.resetIfNecessarySlow(); return true; } @@ -3151,7 +3151,7 @@ extern "C" void JSGlobalObject__clearTerminationException(JSC::JSGlobalObject* g extern "C" void Bun__queueTask(JSC::JSGlobalObject*, WebCore::EventLoopTask* task); extern "C" void Bun__queueTaskConcurrently(JSC::JSGlobalObject*, WebCore::EventLoopTask* task); -extern "C" [[ZIG_EXPORT(check_slow)]] void Bun__performTask(Zig::GlobalObject* globalObject, WebCore::EventLoopTask* task) +extern "C" [[RUST_EXPORT(check_slow)]] void Bun__performTask(Rust::GlobalObject* globalObject, WebCore::EventLoopTask* task) { task->performTask(*globalObject->scriptExecutionContext()); } @@ -3178,7 +3178,7 @@ void GlobalObject::queueTaskConcurrently(WebCore::EventLoopTask* task) Bun__queueTaskConcurrently(this, task); } -extern "C" void Bun__handleRejectedPromise(Zig::GlobalObject* JSGlobalObject, JSC::JSPromise* promise); +extern "C" void Bun__handleRejectedPromise(Rust::GlobalObject* JSGlobalObject, JSC::JSPromise* promise); void GlobalObject::handleRejectedPromises() { @@ -3228,13 +3228,13 @@ template void GlobalObject::visitOutputConstraints(JSCell*, SlotVisitor&); // void GlobalObject::destroy(JSCell* cell) // { -// uncheckedDowncast(cell)->Zig::GlobalObject::~Zig::GlobalObject(); +// uncheckedDowncast(cell)->Rust::GlobalObject::~Rust::GlobalObject(); // } // template // void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor) // { -// Zig::GlobalObject* thisObject = uncheckedDowncast(cell); +// Rust::GlobalObject* thisObject = uncheckedDowncast(cell); // ASSERT_GC_OBJECT_INHERITS(thisObject, info()); // Base::visitChildren(thisObject, visitor); @@ -3255,7 +3255,7 @@ template void GlobalObject::visitOutputConstraints(JSCell*, SlotVisitor&); // thisObject->m_builtinInternalFunctions.visit(visitor); // } -// DEFINE_VISIT_CHILDREN(Zig::GlobalObject); +// DEFINE_VISIT_CHILDREN(Rust::GlobalObject); void GlobalObject::reload() { @@ -3272,13 +3272,13 @@ void GlobalObject::reload() } } -extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0) +extern "C" [[RUST_EXPORT(check_slow)]] void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0) { - Zig::GlobalObject* globalObject = static_cast(arg0); + Rust::GlobalObject* globalObject = static_cast(arg0); globalObject->reload(); } -extern "C" void JSC__JSGlobalObject__queueMicrotaskCallback(Zig::GlobalObject* globalObject, void* ptr, MicrotaskCallback callback) +extern "C" void JSC__JSGlobalObject__queueMicrotaskCallback(Rust::GlobalObject* globalObject, void* ptr, MicrotaskCallback callback) { JSFunction* function = globalObject->nativeMicrotaskTrampoline(); @@ -3298,7 +3298,7 @@ JSC::Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* jsGlobalObject JSModuleLoader* loader, JSValue key, JSValue referrer, RefPtr, bool) { - Zig::GlobalObject* globalObject = static_cast(jsGlobalObject); + Rust::GlobalObject* globalObject = static_cast(jsGlobalObject); ErrorableString res; res.success = false; @@ -3357,7 +3357,7 @@ JSC::Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* jsGlobalObject } BunString queryString = { BunStringTag::Empty, nullptr }; - Zig__GlobalObject__resolve(&res, globalObject, &keyZ, &referrerZ, &queryString); + Rust__GlobalObject__resolve(&res, globalObject, &keyZ, &referrerZ, &queryString); keyZ.deref(); referrerZ.deref(); @@ -3385,7 +3385,7 @@ JSC::JSPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* jsGlobalO RefPtr parameters, const SourceOrigin& sourceOrigin) { - auto* globalObject = static_cast(jsGlobalObject); + auto* globalObject = static_cast(jsGlobalObject); VM& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3449,7 +3449,7 @@ JSC::JSPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* jsGlobalO auto sourceOriginZ = Bun::toStringRef(sourceOriginStringHolder); - Zig__GlobalObject__resolve(&resolved, globalObject, &moduleNameZ, &sourceOriginZ, &queryString); + Rust__GlobalObject__resolve(&resolved, globalObject, &moduleNameZ, &sourceOriginZ, &queryString); // If resolution failed, make sure it becomes a pending exception if (!resolved.success && !scope.exception()) [[unlikely]] { @@ -3546,13 +3546,13 @@ JSC::JSPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, memset(&res.result, 0, sizeof res.result); // require(esm) needs the entire dependency graph to load without yielding - // to microtasks. The async fetch path goes through Zig's transpiler thread + // to microtasks. The async fetch path goes through Rust's transpiler thread // pool; route to the synchronous fetch instead so the returned promise is // already fulfilled and the loader keeps draining its private queue (see // JSModuleLoader::loadModuleSync / VM::m_synchronousModuleQueue). if (vm.m_synchronousModuleQueue) { JSValue result = Bun::fetchESMSourceCodeSync( - static_cast(globalObject), + static_cast(globalObject), moduleKeyJS, &res, &moduleKeyBun, @@ -3567,7 +3567,7 @@ JSC::JSPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, } JSValue result = Bun::fetchESMSourceCodeAsync( - static_cast(globalObject), + static_cast(globalObject), moduleKeyJS, &res, &moduleKeyBun, @@ -3588,7 +3588,7 @@ JSC::JSObject* GlobalObject::moduleLoaderCreateImportMetaProperties(JSGlobalObje JSModuleRecord* record, RefPtr) { - return Zig::ImportMetaObject::create(globalObject, key); + return Rust::ImportMetaObject::create(globalObject, key); } JSC::JSValue GlobalObject::moduleLoaderEvaluate(JSGlobalObject* lexicalGlobalObject, @@ -3608,7 +3608,7 @@ JSC::JSValue EvalGlobalObject::moduleLoaderEvaluate(JSGlobalObject* lexicalGloba JSValue moduleRecordValue, RefPtr scriptFetcher, JSValue sentValue, JSValue resumeMode) { - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3616,7 +3616,7 @@ JSC::JSValue EvalGlobalObject::moduleLoaderEvaluate(JSGlobalObject* lexicalGloba WTF::move(scriptFetcher), sentValue, resumeMode); // The new C++ loader propagates the module body's throw out of // evaluateNonVirtual; the old JS-side ModuleLoader.js swallowed it before - // dispatching here. Don't call back into Zig (which opens an + // dispatching here. Don't call back into Rust (which opens an // ExceptionValidationScope) with an exception still pending. RETURN_IF_EXCEPTION(scope, result); @@ -3631,7 +3631,7 @@ JSC::JSValue EvalGlobalObject::moduleLoaderEvaluate(JSGlobalObject* lexicalGloba // // Instead, when the module yielded, capture the async capability's // promise. Its resolution value is the module's final completion - // value; the --print loop in bun.js.zig already unwraps promises + // value; the --print loop in bun.js.rust already unwraps promises // via asAnyPromise + Bun__onResolveEntryPointResult. JSC::JSValue valueToStore = result; if (auto* moduleRecord = dynamicDowncast(moduleRecordValue)) { @@ -3648,7 +3648,7 @@ JSC::JSValue EvalGlobalObject::moduleLoaderEvaluate(JSGlobalObject* lexicalGloba return result; } -extern "C" JSC::EncodedJSValue Zig__GlobalObject__getBodyStreamOrBytesForWasmStreaming(JSGlobalObject*, EncodedJSValue response, JSC::Wasm::StreamingCompiler* compiler); +extern "C" JSC::EncodedJSValue Rust__GlobalObject__getBodyStreamOrBytesForWasmStreaming(JSGlobalObject*, EncodedJSValue response, JSC::Wasm::StreamingCompiler* compiler); extern "C" void JSC__Wasm__StreamingCompiler__addBytes(JSC::Wasm::StreamingCompiler* compiler, const uint8_t* spanPtr, size_t spanSize) { @@ -3669,7 +3669,7 @@ static JSC::JSPromise* handleResponseOnStreamingAction(JSGlobalObject* lexicalGl // getBodyStreamOrBytesForWasmStreaming throws the proper exception. Since this is being // executed in a .then(...) callback, throwing is perfectly fine. - auto readableStreamMaybe = JSC::JSValue::decode(Zig__GlobalObject__getBodyStreamOrBytesForWasmStreaming( + auto readableStreamMaybe = JSC::JSValue::decode(Rust__GlobalObject__getBodyStreamOrBytesForWasmStreaming( globalObject, JSC::JSValue::encode(source), compiler.ptr())); RETURN_IF_EXCEPTION(scope, nullptr); @@ -3704,7 +3704,7 @@ JSC::JSPromise* GlobalObject::instantiateStreaming(JSGlobalObject* globalObject, return handleResponseOnStreamingAction(globalObject, source, JSC::Wasm::CompilerMode::FullCompile, importObject, WTF::move(compileOptions)); } -GlobalObject::PromiseFunctions GlobalObject::promiseHandlerID(Zig::FFIFunction handler) +GlobalObject::PromiseFunctions GlobalObject::promiseHandlerID(Rust::FFIFunction handler) { if (handler == BunServe__onResolvePlugins) { return GlobalObject::PromiseFunctions::BunServe__Plugins__onResolve; @@ -3855,7 +3855,7 @@ void GlobalObject::adoptNapiEnvsForTestIsolation(GlobalObject* oldGlobal) void GlobalObject::setNodeWorkerEnvironmentData(JSMap* data) { m_nodeWorkerEnvironmentData.set(vm(), this, data); } -extern "C" void Zig__GlobalObject__destructOnExit(Zig::GlobalObject* globalObject) +extern "C" void Rust__GlobalObject__destructOnExit(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); if (vm.entryScope) { @@ -3870,13 +3870,13 @@ extern "C" void Zig__GlobalObject__destructOnExit(Zig::GlobalObject* globalObjec vm.derefSuppressingSaferCPPChecking(); } -#include "ZigGeneratedClasses+lazyStructureImpl.h" -#include "ZigGlobalObject.lut.h" +#include "RustGeneratedClasses+lazyStructureImpl.h" +#include "RustGlobalObject.lut.h" const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject"_s, &Base::s_info, &bunGlobalObjectTable, nullptr, CREATE_METHOD_TABLE(GlobalObject) }; -} // namespace Zig +} // namespace Rust JSC_DEFINE_HOST_FUNCTION(jsFunctionNotImplemented, (JSGlobalObject * leixcalGlobalObject, CallFrame* callFrame)) { diff --git a/src/jsc/bindings/ZigGlobalObject.h b/src/jsc/bindings/ZigGlobalObject.h index ec74c45e6c4..e6fc23f8b89 100644 --- a/src/jsc/bindings/ZigGlobalObject.h +++ b/src/jsc/bindings/ZigGlobalObject.h @@ -6,8 +6,8 @@ // TODO: rename this to BunGlobalObject #pragma once -#ifndef ZIG_GLOBAL_OBJECT -#define ZIG_GLOBAL_OBJECT +#ifndef RUST_GLOBAL_OBJECT +#define RUST_GLOBAL_OBJECT namespace JSC { class Structure; @@ -89,17 +89,17 @@ extern "C" bool Bun__VirtualMachine__isShuttingDown(void* /* BunVM */); #if OS(WINDOWS) #include -extern "C" uv_loop_t* Bun__ZigGlobalObject__uvLoop(void* /* BunVM */); +extern "C" uv_loop_t* Bun__RustGlobalObject__uvLoop(void* /* BunVM */); #endif -namespace Zig { +namespace Rust { class JSCStackTrace; using JSDOMStructureMap = UncheckedKeyHashMap>; using DOMGuardedObjectSet = UncheckedKeyHashSet; -#define ZIG_GLOBAL_OBJECT_DEFINED +#define RUST_GLOBAL_OBJECT_DEFINED class GlobalObject : public Bun::GlobalScope { using Base = Bun::GlobalScope; @@ -354,7 +354,7 @@ class GlobalObject : public Bun::GlobalScope { #if OS(WINDOWS) uv_loop_t* uvLoop() const { - return Bun__ZigGlobalObject__uvLoop(m_bunVM); + return Bun__RustGlobalObject__uvLoop(m_bunVM); } #endif bool isThreadLocalDefaultGlobalObject = false; @@ -467,7 +467,7 @@ class GlobalObject : public Bun::GlobalScope { // - Make sure the type can be written with no commas in its name. This is because a type with // commas will count as two macro parameters instead of one. You can add a `using` declaration // like above to create an alias for a complex template type without a comma. - // - Make sure `visitGlobalObjectMember` in `ZigGlobalObject.cpp` can handle your type. + // - Make sure `visitGlobalObjectMember` in `RustGlobalObject.cpp` can handle your type. // Currently it has overloads to handle: // // - any class with a `visit` method (this covers LazyProperty and LazyClassStructure) @@ -750,7 +750,7 @@ class GlobalObject : public Bun::GlobalScope { Bun::CommonStrings& commonStrings() { return m_commonStrings; } Bun::Http2CommonStrings& http2CommonStrings() { return m_http2CommonStrings; } Bun::MarkdownTagStrings& markdownTagStrings() { return m_markdownTagStrings; } -#include "ZigGeneratedClasses+lazyStructureHeader.h" +#include "RustGeneratedClasses+lazyStructureHeader.h" void finishCreation(JSC::VM&); @@ -801,11 +801,11 @@ class EvalGlobalObject : public GlobalObject { } }; -} // namespace Zig +} // namespace Rust namespace Bun { -ALWAYS_INLINE void* vm(Zig::GlobalObject* globalObject) +ALWAYS_INLINE void* vm(Rust::GlobalObject* globalObject) { return globalObject->bunVM(); } @@ -825,42 +825,42 @@ ALWAYS_INLINE void* vm(JSC::JSGlobalObject* lexicalGlobalObject) #ifndef RENAMED_JSDOM_GLOBAL_OBJECT #define RENAMED_JSDOM_GLOBAL_OBJECT namespace WebCore { -using JSDOMGlobalObject = Zig::GlobalObject; +using JSDOMGlobalObject = Rust::GlobalObject; } #endif // Do not use this directly. namespace ___private___ { -extern "C" Zig::GlobalObject* Bun__getDefaultGlobalObject(); -inline Zig::GlobalObject* getDefaultGlobalObject() +extern "C" Rust::GlobalObject* Bun__getDefaultGlobalObject(); +inline Rust::GlobalObject* getDefaultGlobalObject() { return Bun__getDefaultGlobalObject(); } } -inline Zig::GlobalObject* defaultGlobalObject(JSC::JSGlobalObject* lexicalGlobalObject) +inline Rust::GlobalObject* defaultGlobalObject(JSC::JSGlobalObject* lexicalGlobalObject) { - auto* globalObject = dynamicDowncast(lexicalGlobalObject); + auto* globalObject = dynamicDowncast(lexicalGlobalObject); if (!globalObject) { return ___private___::getDefaultGlobalObject(); } return globalObject; } -inline Zig::GlobalObject* defaultGlobalObject() +inline Rust::GlobalObject* defaultGlobalObject() { return ___private___::getDefaultGlobalObject(); } inline void* bunVM(JSC::JSGlobalObject* lexicalGlobalObject) { - if (auto* globalObject = dynamicDowncast(lexicalGlobalObject)) { + if (auto* globalObject = dynamicDowncast(lexicalGlobalObject)) { return globalObject->bunVM(); } return WebCore::clientData(lexicalGlobalObject->vm())->bunVM; } -inline void* bunVM(Zig::GlobalObject* globalObject) +inline void* bunVM(Rust::GlobalObject* globalObject) { return globalObject->bunVM(); } @@ -868,10 +868,10 @@ inline void* bunVM(Zig::GlobalObject* globalObject) JSC_DECLARE_HOST_FUNCTION(jsFunctionNotImplemented); JSC_DECLARE_HOST_FUNCTION(jsFunctionCreateFunctionThatMasqueradesAsUndefined); -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBlob(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToText(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToArrayBuffer(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToBytes(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToJSON(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToBlob(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); #endif diff --git a/src/jsc/bindings/ZigGlobalObject.lut.txt b/src/jsc/bindings/ZigGlobalObject.lut.txt index 9ccc124f252..d141de1d885 100644 --- a/src/jsc/bindings/ZigGlobalObject.lut.txt +++ b/src/jsc/bindings/ZigGlobalObject.lut.txt @@ -1,6 +1,6 @@ -// In a separate file because processing ZigGlobalObject.cpp takes 15+ seconds +// In a separate file because processing RustGlobalObject.cpp takes 15+ seconds -/* Source for ZigGlobalObject.lut.h +/* Source for RustGlobalObject.lut.h @begin bunGlobalObjectTable addEventListener jsFunctionAddEventListener Function 2 alert WebCore__alert Function 1 diff --git a/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h b/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h index 19ff293f93a..c2f3c00acc8 100644 --- a/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h +++ b/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h @@ -1,7 +1,7 @@ // GENERATED FILE #pragma once -namespace Zig { +namespace Rust { /* -- BEGIN DOMCall DEFINITIONS -- */ @@ -30,4 +30,4 @@ static void DOMCall__FFI__ptr__put(JSC::JSGlobalObject* globalObject, JSC::Encod /* -- END DOMCall DEFINITIONS-- */ -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/ZigLazyStaticFunctions.h b/src/jsc/bindings/ZigLazyStaticFunctions.h index 38033b52d19..78d1f44a8c2 100644 --- a/src/jsc/bindings/ZigLazyStaticFunctions.h +++ b/src/jsc/bindings/ZigLazyStaticFunctions.h @@ -2,13 +2,13 @@ #pragma once #include "root.h" -namespace Zig { +namespace Rust { class GlobalObject; class JSFFIFunction; class LazyStaticFunctions { public: - void init(Zig::GlobalObject* globalObject); + void init(Rust::GlobalObject* globalObject); template void visit(Visitor& visitor); @@ -18,4 +18,4 @@ class LazyStaticFunctions { /* -- END FUNCTION DEFINITIONS-- */ }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/ZigSourceProvider.cpp b/src/jsc/bindings/ZigSourceProvider.cpp index e7191e21141..b31d5ef1047 100644 --- a/src/jsc/bindings/ZigSourceProvider.cpp +++ b/src/jsc/bindings/ZigSourceProvider.cpp @@ -2,11 +2,11 @@ #include "helpers.h" -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" #include "BunAnalyzeTranspiledModule.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "wtf/Assertions.h" #include @@ -17,7 +17,7 @@ #include #include -namespace Zig { +namespace Rust { using Base = JSC::SourceProvider; using BytecodeCacheGenerator = JSC::BytecodeCacheGenerator; @@ -71,7 +71,7 @@ extern "C" void Bun__addSourceProviderSourceMap(void* bun_vm, SourceProvider* op extern "C" void Bun__removeSourceProviderSourceMap(void* bun_vm, SourceProvider* opaque_source_provider, BunString* specifier); Ref SourceProvider::create( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, ResolvedSource& resolvedSource, JSC::SourceProviderSourceType sourceType, bool isBuiltin) @@ -172,10 +172,10 @@ SourceProvider::~SourceProvider() Bun__removeSourceProviderSourceMap(m_bunVM, this, &str); } if (m_resolvedSource.module_info != nullptr) { - zig__ModuleInfoDeserialized__deinit(static_cast(m_resolvedSource.module_info)); + rust__ModuleInfoDeserialized__deinit(static_cast(m_resolvedSource.module_info)); m_resolvedSource.module_info = nullptr; } - // The Rust/Zig side hands these as +1 (RuntimeTranspilerStore::run_from_js_thread: + // The Rust/Rust side hands these as +1 (RuntimeTranspilerStore::run_from_js_thread: // `out.dupeRef()` / `out.createIfDifferent(..)`; ModuleLoader paths likewise). // #9521 removed the early deref in `create()` because these strings are still // read after that point; the matching deref belongs here, once all uses are done. @@ -400,9 +400,9 @@ int SourceProvider::readCache(JSC::VM& vm, const JSC::SourceCode& sourceCode) // } } -extern "C" BunString ZigSourceProvider__getSourceSlice(SourceProvider* provider) +extern "C" BunString RustSourceProvider__getSourceSlice(SourceProvider* provider) { return Bun::toStringView(provider->source()); } -}; // namespace Zig +}; // namespace Rust diff --git a/src/jsc/bindings/ZigSourceProvider.h b/src/jsc/bindings/ZigSourceProvider.h index ccbb659c734..df76008cfef 100644 --- a/src/jsc/bindings/ZigSourceProvider.h +++ b/src/jsc/bindings/ZigSourceProvider.h @@ -16,7 +16,7 @@ class SourceProvider; #include #include -namespace Zig { +namespace Rust { class GlobalObject; @@ -37,7 +37,7 @@ class SourceProvider final : public JSC::SourceProvider { public: static Ref create( - Zig::GlobalObject*, + Rust::GlobalObject*, ResolvedSource& resolvedSource, JSC::SourceProviderSourceType sourceType = JSC::SourceProviderSourceType::Module, bool isBuiltIn = false); @@ -79,4 +79,4 @@ class SourceProvider final : public JSC::SourceProvider { unsigned m_hash = 0; }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/bindings.cpp b/src/jsc/bindings/bindings.cpp index 22ac3806337..ff9e079a6cd 100644 --- a/src/jsc/bindings/bindings.cpp +++ b/src/jsc/bindings/bindings.cpp @@ -77,7 +77,7 @@ #include "JavaScriptCore/VM.h" #include "JavaScriptCore/WasmFaultSignalHandler.h" #include "JavaScriptCore/Watchdog.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "helpers.h" #include "JavaScriptCore/JSObjectInlines.h" @@ -132,7 +132,7 @@ #include "DOMFormData.h" #include "JSDOMFormData.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "JavaScriptCore/JSMapInlines.h" #include @@ -177,7 +177,7 @@ using namespace WebCore; typedef uint8_t ExpectFlags; -// Note: keep this in sync with Expect.Flags implementation in zig (at expect.zig) +// Note: keep this in sync with Expect.Flags implementation in rust (at expect.rust) // clang disable unused warning #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-variable" @@ -580,10 +580,10 @@ AsymmetricMatcherResult matchAsymmetricMatcher(JSGlobalObject* globalObject, JSV } template -static void handlePromise(PromiseType* promise, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue ctx, Zig::FFIFunction resolverFunction, Zig::FFIFunction rejecterFunction) +static void handlePromise(PromiseType* promise, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue ctx, Rust::FFIFunction resolverFunction, Rust::FFIFunction rejecterFunction) { - auto globalThis = static_cast(globalObject); + auto globalThis = static_cast(globalObject); if constexpr (!isInternal) { JSFunction* performPromiseThenFunction = globalObject->performPromiseThenFunction(); @@ -1549,7 +1549,7 @@ std::optional specialObjectsDequal(JSC::JSGlobalObject* globalObject, Mark break; } // globalThis is only equal to globalThis - // NOTE: globalThis from JS is a JSGlobalProxy (GlobalProxyType) wrapping Zig::GlobalObject (GlobalObjectType) + // NOTE: globalThis from JS is a JSGlobalProxy (GlobalProxyType) wrapping Rust::GlobalObject (GlobalObjectType) case GlobalObjectType: { if (c1Type != c2Type) return false; auto* g1 = dynamicDowncast(c1); @@ -1757,11 +1757,11 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createEmpty() headers->relaxAdoptionRequirement(); return headers; } -void WebCore__FetchHeaders__append(WebCore::FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2, +void WebCore__FetchHeaders__append(WebCore::FetchHeaders* headers, const RustString* arg1, const RustString* arg2, JSC::JSGlobalObject* lexicalGlobalObject) { auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); - WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->append(Zig::toString(*arg1), Zig::toString(*arg2))); + WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->append(Rust::toString(*arg1), Rust::toString(*arg2))); RELEASE_AND_RETURN(throwScope, ); } WebCore::FetchHeaders* WebCore__FetchHeaders__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* vm) @@ -1825,7 +1825,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject* JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject) { - Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = static_cast(lexicalGlobalObject); ASSERT_NO_PENDING_EXCEPTION(globalObject); bool needsMemoryCost = headers->hasOneRef(); @@ -1843,7 +1843,7 @@ JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* arg1) { auto throwScope = DECLARE_THROW_SCOPE(arg1->vm()); - Zig::GlobalObject* globalObject = static_cast(arg1); + Rust::GlobalObject* globalObject = static_cast(arg1); auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); WebCore::propagateException(*arg1, throwScope, clone->fill(*headers)); return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTF::move(clone))); @@ -1925,14 +1925,14 @@ void WebCore__FetchHeaders__count(WebCore::FetchHeaders* headers, uint32_t* coun *buf_len = i; } -typedef struct ZigSliceString { +typedef struct RustSliceString { const unsigned char* ptr; size_t len; -} ZigSliceString; +} RustSliceString; typedef struct PicoHTTPHeader { - ZigSliceString name; - ZigSliceString value; + RustSliceString name; + RustSliceString value; } PicoHTTPHeader; typedef struct PicoHTTPHeaders { @@ -2038,15 +2038,15 @@ void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0) arg0->deref(); } -WebCore::FetchHeaders* WebCore__FetchHeaders__createValueNotJS(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t count) +WebCore::FetchHeaders* WebCore__FetchHeaders__createValueNotJS(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const RustString* arg3, uint32_t count) { auto throwScope = DECLARE_THROW_SCOPE(arg0->vm()); Vector> pairs; pairs.reserveCapacity(count); - ZigString buf = *arg3; + RustString buf = *arg3; for (uint32_t i = 0; i < count; i++) { - WTF::String name = Zig::toStringCopy(buf, arg1[i]); - WTF::String value = Zig::toStringCopy(buf, arg2[i]); + WTF::String name = Rust::toStringCopy(buf, arg1[i]); + WTF::String value = Rust::toStringCopy(buf, arg2[i]); pairs.unsafeAppendWithoutCapacityCheck(KeyValuePair(name, value)); } @@ -2060,58 +2060,58 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createValueNotJS(JSC::JSGlobalObje return headers; } -JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t count) +JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const RustString* arg3, uint32_t count) { auto throwScope = DECLARE_THROW_SCOPE(arg0->vm()); Vector> pairs; pairs.reserveCapacity(count); - ZigString buf = *arg3; + RustString buf = *arg3; for (uint32_t i = 0; i < count; i++) { - WTF::String name = Zig::toStringCopy(buf, arg1[i]); - WTF::String value = Zig::toStringCopy(buf, arg2[i]); + WTF::String name = Rust::toStringCopy(buf, arg1[i]); + WTF::String value = Rust::toStringCopy(buf, arg2[i]); pairs.unsafeAppendWithoutCapacityCheck(KeyValuePair(name, value)); } Ref headers = WebCore::FetchHeaders::create(); WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTF::move(pairs)))); - JSValue value = WebCore::toJSNewlyCreated(arg0, static_cast(arg0), WTF::move(headers)); + JSValue value = WebCore::toJSNewlyCreated(arg0, static_cast(arg0), WTF::move(headers)); JSFetchHeaders* fetchHeaders = uncheckedDowncast(value); fetchHeaders->computeMemoryCost(); return JSC::JSValue::encode(fetchHeaders); } -void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* headers, const ZigString* arg1, ZigString* arg2, JSC::JSGlobalObject* global) +void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* headers, const RustString* arg1, RustString* arg2, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); - auto result = headers->get(Zig::toString(*arg1)); + auto result = headers->get(Rust::toString(*arg1)); if (result.hasException()) WebCore::propagateException(*global, throwScope, result.releaseException()); else - *arg2 = Zig::toZigString(result.releaseReturnValue()); + *arg2 = Rust::toRustString(result.releaseReturnValue()); } -bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* headers, const ZigString* arg1, JSC::JSGlobalObject* global) +bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* headers, const RustString* arg1, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); - auto result = headers->has(Zig::toString(*arg1)); + auto result = headers->has(Rust::toString(*arg1)); if (result.hasException()) { WebCore::propagateException(*global, throwScope, result.releaseException()); return false; } else return result.releaseReturnValue(); } -extern "C" void WebCore__FetchHeaders__put(WebCore::FetchHeaders* headers, HTTPHeaderName name, const ZigString* arg2, JSC::JSGlobalObject* global) +extern "C" void WebCore__FetchHeaders__put(WebCore::FetchHeaders* headers, HTTPHeaderName name, const RustString* arg2, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); throwScope.assertNoException(); // can't throw an exception when there's already one. - WebCore::propagateException(*global, throwScope, headers->set(name, Zig::toStringCopy(*arg2))); + WebCore::propagateException(*global, throwScope, headers->set(name, Rust::toStringCopy(*arg2))); } -void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* headers, const ZigString* arg1, JSC::JSGlobalObject* global) +void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* headers, const RustString* arg1, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); WebCore::propagateException(*global, throwScope, - headers->remove(Zig::toString(*arg1))); + headers->remove(Rust::toString(*arg1))); } void WebCore__FetchHeaders__fastRemove_(WebCore::FetchHeaders* headers, unsigned char headerName) @@ -2119,14 +2119,14 @@ void WebCore__FetchHeaders__fastRemove_(WebCore::FetchHeaders* headers, unsigned headers->fastRemove(static_cast(headerName)); } -void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* headers, unsigned char headerName, ZigString* arg2) +void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* headers, unsigned char headerName, RustString* arg2) { auto str = headers->fastGet(static_cast(headerName)); if (!str) { return; } - *arg2 = Zig::toZigString(str); + *arg2 = Rust::toRustString(str); } WebCore::DOMURL* WebCore__DOMURL__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* vm) @@ -2134,16 +2134,16 @@ WebCore::DOMURL* WebCore__DOMURL__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* v return WebCoreCast(JSValue0); } -[[ZIG_EXPORT(nothrow)]] void WebCore__DOMURL__href_(WebCore::DOMURL* domURL, ZigString* arg1) +[[RUST_EXPORT(nothrow)]] void WebCore__DOMURL__href_(WebCore::DOMURL* domURL, RustString* arg1) { const WTF::URL& href = domURL->href(); - *arg1 = Zig::toZigString(href.string()); + *arg1 = Rust::toRustString(href.string()); } -[[ZIG_EXPORT(nothrow)]] void WebCore__DOMURL__pathname_(WebCore::DOMURL* domURL, ZigString* arg1) +[[RUST_EXPORT(nothrow)]] void WebCore__DOMURL__pathname_(WebCore::DOMURL* domURL, RustString* arg1) { const WTF::URL& href = domURL->href(); const WTF::StringView& pathname = href.path(); - *arg1 = Zig::toZigString(pathname); + *arg1 = Rust::toRustString(pathname); } BunString WebCore__DOMURL__fileSystemPath(WebCore::DOMURL* arg0, int* errorCode) @@ -2194,10 +2194,10 @@ extern "C" JSC::EncodedJSValue JSC__JSValue__unwrapBoxedPrimitive(JSGlobalObject return JSValue::encode(object); } -extern "C" JSC::EncodedJSValue ZigString__toJSONObject(const ZigString* strPtr, JSC::JSGlobalObject* globalObject) +extern "C" JSC::EncodedJSValue RustString__toJSONObject(const RustString* strPtr, JSC::JSGlobalObject* globalObject) { ASSERT_NO_PENDING_EXCEPTION(globalObject); - auto str = Zig::toString(*strPtr); + auto str = Rust::toString(*strPtr); auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); if (str.isNull()) { @@ -2243,7 +2243,7 @@ JSC::EncodedJSValue JSGlobalObject__createOutOfMemoryError(JSC::JSGlobalObject* // Walk a promise's reaction chain to find the async generators awaiting it, // and collect them as async StackFrames. Used when an error is created from -// native code at the top of the event loop (e.g. runFromJSThread in node_fs.zig) +// native code at the top of the event loop (e.g. runFromJSThread in node_fs.rust) // where there's no JS call stack, but the promise being rejected has an await // chain that tells us where the user's code is. // @@ -2575,7 +2575,7 @@ double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC::EncodedJSValue value if (auto* object = dynamicDowncast(cell)) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - scope.release(); // zig binding handles exceptions + scope.release(); // rust binding handles exceptions JSValue lengthValue = object->getIfPropertyExists(globalObject, globalObject->vm().propertyNames->length); RETURN_IF_EXCEPTION(scope, 0); if (lengthValue) { @@ -2588,11 +2588,11 @@ double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC::EncodedJSValue value return std::numeric_limits::infinity(); } -[[ZIG_EXPORT(check_slow)]] -void JSC__JSObject__putRecord(JSC::JSObject* object, JSC::JSGlobalObject* global, ZigString* key, ZigString* values, size_t valuesLen) +[[RUST_EXPORT(check_slow)]] +void JSC__JSObject__putRecord(JSC::JSObject* object, JSC::JSGlobalObject* global, RustString* key, RustString* values, size_t valuesLen) { auto scope = DECLARE_THROW_SCOPE(global->vm()); - auto ident = Identifier::fromString(global->vm(), Zig::toStringCopy(*key)); + auto ident = Identifier::fromString(global->vm(), Rust::toStringCopy(*key)); JSC::PropertyDescriptor descriptor; descriptor.setEnumerable(1); @@ -2600,14 +2600,14 @@ void JSC__JSObject__putRecord(JSC::JSObject* object, JSC::JSGlobalObject* global descriptor.setWritable(1); if (valuesLen == 1) { - descriptor.setValue(JSC::jsString(global->vm(), Zig::toStringCopy(values[0]))); + descriptor.setValue(JSC::jsString(global->vm(), Rust::toStringCopy(values[0]))); } else { // Pre-convert all strings to JSValues before entering ObjectInitializationScope, // since jsString() allocates GC cells which is not allowed inside the scope. MarkedArgumentBuffer strings; for (size_t i = 0; i < valuesLen; ++i) { - strings.append(JSC::jsString(global->vm(), Zig::toStringCopy(values[i]))); + strings.append(JSC::jsString(global->vm(), Rust::toStringCopy(values[i]))); } JSC::JSArray* array = nullptr; @@ -2633,13 +2633,13 @@ void JSC__JSObject__putRecord(JSC::JSObject* object, JSC::JSGlobalObject* global object->putDirect(global->vm(), ident, descriptor.value()); scope.release(); } -void JSC__JSValue__putRecord(JSC::EncodedJSValue objectValue, JSC::JSGlobalObject* global, ZigString* key, - ZigString* values, size_t valuesLen) +void JSC__JSValue__putRecord(JSC::EncodedJSValue objectValue, JSC::JSGlobalObject* global, RustString* key, + RustString* values, size_t valuesLen) { JSC::JSValue objValue = JSC::JSValue::decode(objectValue); JSC::JSObject* object = objValue.asCell()->getObject(); auto scope = DECLARE_THROW_SCOPE(global->vm()); - auto ident = Zig::toIdentifier(*key, global); + auto ident = Rust::toIdentifier(*key, global); JSC::PropertyDescriptor descriptor; descriptor.setEnumerable(1); @@ -2647,14 +2647,14 @@ void JSC__JSValue__putRecord(JSC::EncodedJSValue objectValue, JSC::JSGlobalObjec descriptor.setWritable(1); if (valuesLen == 1) { - descriptor.setValue(JSC::jsString(global->vm(), Zig::toString(values[0]))); + descriptor.setValue(JSC::jsString(global->vm(), Rust::toString(values[0]))); } else { // Pre-convert all strings to JSValues before entering ObjectInitializationScope, // since jsString() allocates GC cells which is not allowed inside the scope. MarkedArgumentBuffer strings; for (size_t i = 0; i < valuesLen; ++i) { - strings.append(JSC::jsString(global->vm(), Zig::toString(values[i]))); + strings.append(JSC::jsString(global->vm(), Rust::toString(values[i]))); } JSC::JSArray* array = nullptr; @@ -2710,13 +2710,13 @@ void JSC__JSFunction__optimizeSoon(JSC::EncodedJSValue JSValue0) JSC::optimizeNextInvocation(value); } -bool JSC__JSFunction__getSourceCode(JSC::EncodedJSValue JSValue0, ZigString* outSourceCode) +bool JSC__JSFunction__getSourceCode(JSC::EncodedJSValue JSValue0, RustString* outSourceCode) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (JSC::JSFunction* func = dynamicDowncast(value)) { auto* sourceCode = func->sourceCode(); if (sourceCode != nullptr) { // native functions have no source code - *outSourceCode = Zig::toZigString(sourceCode->view()); + *outSourceCode = Rust::toRustString(sourceCode->view()); return true; } return false; @@ -2783,7 +2783,7 @@ JSC::JSPromise* JSC__JSPromise__create(JSC::JSGlobalObject* arg0) } // TODO: prevent this from allocating so much memory -void JSC__JSValue___then(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue arg2, Zig::FFIFunction ArgFn3, Zig::FFIFunction ArgFn4) +void JSC__JSValue___then(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue arg2, Rust::FFIFunction ArgFn3, Rust::FFIFunction ArgFn4) { auto* cell = JSC::JSValue::decode(JSValue0).asCell(); @@ -2793,11 +2793,11 @@ void JSC__JSValue___then(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1 } } -JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* globalObject, const ZigString* arg1) +JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* globalObject, const RustString* arg1) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); - WTF::String string = Zig::toString(*arg1); + WTF::String string = Rust::toString(*arg1); auto symbol = vm.privateSymbolRegistry().symbolForKey(string); JSC::Identifier ident = JSC::Identifier::fromUid(symbol); JSC::JSValue result = globalObject->getIfPropertyExists(globalObject, ident); @@ -2805,19 +2805,19 @@ JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* gl return JSC::JSValue::encode(result); } -JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* globalObject, const ZigString* arg1, JSC::EncodedJSValue JSValue2) +JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* globalObject, const RustString* arg1, JSC::EncodedJSValue JSValue2) { auto& vm = JSC::getVM(globalObject); - WTF::String string = Zig::toString(*arg1); + WTF::String string = Rust::toString(*arg1); auto symbol = vm.privateSymbolRegistry().symbolForKey(string); JSC::Identifier ident = JSC::Identifier::fromUid(symbol); globalObject->putDirect(vm, ident, JSC::JSValue::decode(JSValue2), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::DontEnum); return JSValue2; } -void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* global, ZigString* arg1) +void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* global, RustString* arg1) { - const JSC::Identifier identifier = Zig::toIdentifier(*arg1, global); + const JSC::Identifier identifier = Rust::toIdentifier(*arg1, global); global->moduleLoader()->removeEntry(identifier); } @@ -3025,14 +3025,14 @@ JSC::EncodedJSValue JSC__JSValue__getDirectIndex(JSC::EncodedJSValue jsValue, JS } JSC::EncodedJSValue JSC__JSObject__getDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, - const ZigString* arg2) + const RustString* arg2) { - return JSC::JSValue::encode(arg0->getDirect(arg1->vm(), Zig::toIdentifier(*arg2, arg1))); + return JSC::JSValue::encode(arg0->getDirect(arg1->vm(), Rust::toIdentifier(*arg2, arg1))); } -void JSC__JSObject__putDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const ZigString* key, +void JSC__JSObject__putDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const RustString* key, JSC::EncodedJSValue value) { - auto prop = Zig::toIdentifier(*key, arg1); + auto prop = Rust::toIdentifier(*key, arg1); arg0->putDirect(arg1->vm(), prop, JSC::JSValue::decode(value)); } @@ -3052,10 +3052,10 @@ JSC::JSObject* JSC__JSCell__toObject(JSC::JSCell* cell, JSC::JSGlobalObject* glo #pragma mark - JSC::JSString -void JSC__JSString__toZigString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSString__toRustString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, RustString* arg2) { auto value = arg0->value(arg1); - *arg2 = Zig::toZigString(value.data.impl()); + *arg2 = Rust::toRustString(value.data.impl()); // We don't need to assert here because ->value returns a reference to the same string as the one owned by the JSString. } @@ -3123,7 +3123,7 @@ JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObj } } -[[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue ReadableStream__empty(Zig::GlobalObject* globalObject) +[[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue ReadableStream__empty(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3134,7 +3134,7 @@ JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObj return JSValue::encode(emptyStream); } -[[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue ReadableStream__used(Zig::GlobalObject* globalObject) +[[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue ReadableStream__used(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3145,16 +3145,16 @@ JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObj return JSValue::encode(usedStream); } -JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* message, const ZigString* arg1, +JSC::EncodedJSValue JSC__JSValue__createRangeError(const RustString* message, const RustString* arg1, JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); - ZigString code = *arg1; - JSC::JSObject* rangeError = Zig::getRangeErrorInstance(message, globalObject).asCell()->getObject(); + RustString code = *arg1; + JSC::JSObject* rangeError = Rust::getRangeErrorInstance(message, globalObject).asCell()->getObject(); if (code.len > 0) { auto clientData = WebCore::clientData(vm); - JSC::JSValue codeValue = Zig::toJSString(code, globalObject); + JSC::JSValue codeValue = Rust::toJSString(code, globalObject); rangeError->putDirect(vm, clientData->builtinNames().codePublicName(), codeValue, JSC::PropertyAttribute::ReadOnly | 0); } @@ -3162,24 +3162,24 @@ JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* message, con return JSC::JSValue::encode(rangeError); } -JSC::EncodedJSValue JSC__JSValue__createTypeError(const ZigString* message, const ZigString* arg1, +JSC::EncodedJSValue JSC__JSValue__createTypeError(const RustString* message, const RustString* arg1, JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); - ZigString code = *arg1; - JSC::JSObject* typeError = Zig::getTypeErrorInstance(message, globalObject).asCell()->getObject(); + RustString code = *arg1; + JSC::JSObject* typeError = Rust::getTypeErrorInstance(message, globalObject).asCell()->getObject(); if (code.len > 0) { auto clientData = WebCore::clientData(vm); - JSC::JSValue codeValue = Zig::toJSString(code, globalObject); + JSC::JSValue codeValue = Rust::toJSString(code, globalObject); typeError->putDirect(vm, clientData->builtinNames().codePublicName(), codeValue, 0); } return JSC::JSValue::encode(typeError); } -JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* globalObject, ZigString* keys, - ZigString* values, size_t initialCapacity, bool clone) +JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* globalObject, RustString* keys, + RustString* values, size_t initialCapacity, bool clone) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3192,14 +3192,14 @@ JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* globalObject, if (!clone) { for (size_t i = 0; i < initialCapacity; ++i) { object->putDirect( - vm, JSC::PropertyName(JSC::Identifier::fromString(vm, Zig::toString(keys[i]))), - Zig::toJSStringGC(values[i], globalObject), 0); + vm, JSC::PropertyName(JSC::Identifier::fromString(vm, Rust::toString(keys[i]))), + Rust::toJSStringGC(values[i], globalObject), 0); RETURN_IF_EXCEPTION(scope, {}); } } else { for (size_t i = 0; i < initialCapacity; ++i) { - object->putDirect(vm, JSC::PropertyName(Zig::toIdentifier(keys[i], globalObject)), - Zig::toJSStringGC(values[i], globalObject), 0); + object->putDirect(vm, JSC::PropertyName(Rust::toIdentifier(keys[i], globalObject)), + Rust::toJSStringGC(values[i], globalObject), 0); RETURN_IF_EXCEPTION(scope, {}); } } @@ -3408,12 +3408,12 @@ CPP_DECL void JSC__JSValue__push(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObje JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObject* globalObject, const JSValue* errors, size_t errors_count, - const ZigString* arg3) + const RustString* arg3) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); - WTF::String message = Zig::toString(*arg3); + WTF::String message = Rust::toString(*arg3); JSC::JSValue cause = JSC::jsUndefined(); JSC::JSArray* array = nullptr; { @@ -3445,7 +3445,7 @@ JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateErrorWithArray(JSC::JSGl return JSC::JSValue::encode(JSC::createAggregateError(vm, errorStructure, array, messageString, cause, nullptr, JSC::TypeNothing, false)); } -JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) +JSC::EncodedJSValue RustString__toAtomicValue(const RustString* arg0, JSC::JSGlobalObject* arg1) { if (arg0->len == 0) { return JSC::JSValue::encode(JSC::jsEmptyString(arg1->vm())); @@ -3461,16 +3461,16 @@ JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGloba } } - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), makeAtomString(Zig::toStringCopy(*arg0)))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), makeAtomString(Rust::toStringCopy(*arg0)))); } -JSC::EncodedJSValue ZigString__to16BitValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) +JSC::EncodedJSValue RustString__to16BitValue(const RustString* arg0, JSC::JSGlobalObject* arg1) { auto str = WTF::String::fromUTF8(std::span { arg0->ptr, arg0->len }); return JSC::JSValue::encode(JSC::jsString(arg1->vm(), str)); } -JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, JSC::JSGlobalObject* global) +JSC::EncodedJSValue RustString__toExternalU16(const uint16_t* arg0, size_t len, JSC::JSGlobalObject* global) { if (len == 0) { return JSC::JSValue::encode(JSC::jsEmptyString(global->vm())); @@ -3482,17 +3482,17 @@ JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, J } // This must be a globally allocated string -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue ZigString__toExternalValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue RustString__toExternalValue(const RustString* arg0, JSC::JSGlobalObject* arg1) { - ZigString str = *arg0; + RustString str = *arg0; if (str.len == 0) { return JSC::JSValue::encode(JSC::jsEmptyString(arg1->vm())); } - if (Zig::isTaggedUTF16Ptr(str.ptr)) { - auto ref = String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, Zig::untagVoid(str.ptr), free_global_string)); + if (Rust::isTaggedUTF16Ptr(str.ptr)) { + auto ref = String(ExternalStringImpl::create({ reinterpret_cast(Rust::untag(str.ptr)), str.len }, Rust::untagVoid(str.ptr), free_global_string)); return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::move(ref))); } else { - auto ref = String(ExternalStringImpl::create({ Zig::untag(str.ptr), str.len }, Zig::untagVoid(str.ptr), free_global_string)); + auto ref = String(ExternalStringImpl::create({ Rust::untag(str.ptr), str.len }, Rust::untagVoid(str.ptr), free_global_string)); return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::move(ref))); } } @@ -3502,12 +3502,12 @@ VirtualMachine* JSC__JSGlobalObject__bunVM(JSC::JSGlobalObject* arg0) return reinterpret_cast(WebCore::clientData(arg0->vm())->bunVM); } -JSC::EncodedJSValue ZigString__toValueGC(const ZigString* arg0, JSC::JSGlobalObject* arg1) +JSC::EncodedJSValue RustString__toValueGC(const RustString* arg0, JSC::JSGlobalObject* arg1) { - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), Zig::toStringCopy(*arg0))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), Rust::toStringCopy(*arg0))); } -void JSC__JSValue__toZigString(JSC::EncodedJSValue JSValue0, ZigString* arg1, JSC::JSGlobalObject* arg2) +void JSC__JSValue__toRustString(JSC::EncodedJSValue JSValue0, RustString* arg1, JSC::JSGlobalObject* arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -3530,58 +3530,58 @@ void JSC__JSValue__toZigString(JSC::EncodedJSValue JSValue0, ZigString* arg1, JS if (str->is8Bit()) { arg1->ptr = str->span8().data(); } else { - arg1->ptr = Zig::taggedUTF16Ptr(str->span16().data()); + arg1->ptr = Rust::taggedUTF16Ptr(str->span16().data()); } arg1->len = str->length(); } -JSC::EncodedJSValue ZigString__external(const ZigString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(void* arg0, void* arg1, size_t arg2)) +JSC::EncodedJSValue RustString__external(const RustString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(void* arg0, void* arg1, size_t arg2)) { - ZigString str + RustString str = *arg0; - if (Zig::isTaggedUTF16Ptr(str.ptr)) { - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, arg2, ArgFn3)))); + if (Rust::isTaggedUTF16Ptr(str.ptr)) { + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Rust::untag(str.ptr)), str.len }, arg2, ArgFn3)))); } else { - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, arg2, ArgFn3)))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Rust::untag(str.ptr)), str.len }, arg2, ArgFn3)))); } } -JSC::EncodedJSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC::JSGlobalObject* arg1, void (*ArgFn2)(void* arg2, void* arg0, size_t arg1)) +JSC::EncodedJSValue RustString__toExternalValueWithCallback(const RustString* arg0, JSC::JSGlobalObject* arg1, void (*ArgFn2)(void* arg2, void* arg0, size_t arg1)) { - ZigString str + RustString str = *arg0; - if (Zig::isTaggedUTF16Ptr(str.ptr)) { - return JSC::JSValue::encode(JSC::jsOwnedString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, nullptr, ArgFn2)))); + if (Rust::isTaggedUTF16Ptr(str.ptr)) { + return JSC::JSValue::encode(JSC::jsOwnedString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Rust::untag(str.ptr)), str.len }, nullptr, ArgFn2)))); } else { - return JSC::JSValue::encode(JSC::jsOwnedString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, nullptr, ArgFn2)))); + return JSC::JSValue::encode(JSC::jsOwnedString(arg1->vm(), WTF::String(ExternalStringImpl::create({ reinterpret_cast(Rust::untag(str.ptr)), str.len }, nullptr, ArgFn2)))); } } -JSC::EncodedJSValue ZigString__toErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +JSC::EncodedJSValue RustString__toErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { - return JSC::JSValue::encode(Zig::getErrorInstance(str, globalObject)); + return JSC::JSValue::encode(Rust::getErrorInstance(str, globalObject)); } -JSC::EncodedJSValue ZigString__toTypeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +JSC::EncodedJSValue RustString__toTypeErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { - return JSC::JSValue::encode(Zig::getTypeErrorInstance(str, globalObject)); + return JSC::JSValue::encode(Rust::getTypeErrorInstance(str, globalObject)); } -JSC::EncodedJSValue ZigString__toDOMExceptionInstance(const ZigString* str, JSC::JSGlobalObject* globalObject, WebCore::ExceptionCode code) +JSC::EncodedJSValue RustString__toDOMExceptionInstance(const RustString* str, JSC::JSGlobalObject* globalObject, WebCore::ExceptionCode code) { return JSValue::encode(createDOMException(globalObject, code, toStringCopy(*str))); } -JSC::EncodedJSValue ZigString__toSyntaxErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +JSC::EncodedJSValue RustString__toSyntaxErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { - return JSC::JSValue::encode(Zig::getSyntaxErrorInstance(str, globalObject)); + return JSC::JSValue::encode(Rust::getSyntaxErrorInstance(str, globalObject)); } -JSC::EncodedJSValue ZigString__toRangeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +JSC::EncodedJSValue RustString__toRangeErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { - return JSC::JSValue::encode(Zig::getRangeErrorInstance(str, globalObject)); + return JSC::JSValue::encode(Rust::getRangeErrorInstance(str, globalObject)); } static JSC::EncodedJSValue resolverFunctionCallback(JSC::JSGlobalObject* globalObject, @@ -3675,7 +3675,7 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void RELEASE_AND_RETURN(scope, JSValue::encode(resolved)); } -[[ZIG_EXPORT(check_slow)]] void JSC__JSPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue2) +[[RUST_EXPORT(check_slow)]] void JSC__JSPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue2) { JSValue value = JSC::JSValue::decode(JSValue2); ASSERT_WITH_MESSAGE(!value.isEmpty(), "Promise.reject cannot be called with a empty JSValue"); @@ -3693,7 +3693,7 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void arg0->reject(vm, globalObject, exception); } -[[ZIG_EXPORT(check_slow)]] void JSC__JSPromise__rejectAsHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) +[[RUST_EXPORT(check_slow)]] void JSC__JSPromise__rejectAsHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { ASSERT_WITH_MESSAGE(arg0->inherits(), "Argument is not a promise"); ASSERT_WITH_MESSAGE(arg0->status() == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected"); @@ -3707,7 +3707,7 @@ JSC::JSPromise* JSC__JSPromise__rejectedPromise(JSC::JSGlobalObject* arg0, JSC:: return JSC::JSPromise::rejectedPromise(arg0, JSC::JSValue::decode(JSValue1)); } -[[ZIG_EXPORT(check_slow)]] void JSC__JSPromise__resolve(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) +[[RUST_EXPORT(check_slow)]] void JSC__JSPromise__resolve(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { JSValue target = JSValue::decode(JSValue2); @@ -3755,7 +3755,7 @@ void JSC__JSPromise__rejectOnNextTickWithHandled(JSC::JSPromise* promise, JSC::J } promise->internalField(JSC::JSPromise::Field::Flags).set(vm, promise, jsNumber(flags | JSC::JSPromise::isFirstResolvingFunctionCalledFlag)); - auto* globalObject = uncheckedDowncast(promise->globalObject()); + auto* globalObject = uncheckedDowncast(promise->globalObject()); auto rejectPromiseFunction = globalObject->rejectPromiseFunction(); auto asyncContext = globalObject->m_asyncContextData.get()->getInternalField(0); @@ -3789,7 +3789,7 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec return promise; } -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSPromise__result(JSC::JSPromise* promise, JSC::VM* arg1) +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSPromise__result(JSC::JSPromise* promise, JSC::VM* arg1) { auto& vm = *arg1; @@ -3811,7 +3811,7 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec } } -[[ZIG_EXPORT(nothrow)]] uint32_t JSC__JSPromise__status(const JSC::JSPromise* arg0) +[[RUST_EXPORT(nothrow)]] uint32_t JSC__JSPromise__status(const JSC::JSPromise* arg0) { switch (arg0->status()) { case JSC::JSPromise::Status::Pending: @@ -3824,11 +3824,11 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec return 255; } } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSPromise__isHandled(const JSC::JSPromise* arg0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSPromise__isHandled(const JSC::JSPromise* arg0) { return arg0->isHandled(); } -[[ZIG_EXPORT(nothrow)]] void JSC__JSPromise__setHandled(JSC::JSPromise* promise) +[[RUST_EXPORT(nothrow)]] void JSC__JSPromise__setHandled(JSC::JSPromise* promise) { promise->markAsHandled(); } @@ -3841,7 +3841,7 @@ JSC::JSPromise* JSC__JSInternalPromise__create(JSC::JSGlobalObject* globalObject return JSC::JSPromise::create(vm, globalObject->promiseStructure()); } -[[ZIG_EXPORT(check_slow)]] +[[RUST_EXPORT(check_slow)]] void JSC__JSInternalPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue2) { JSValue value = JSC::JSValue::decode(JSValue2); @@ -3875,7 +3875,7 @@ JSC::JSPromise* JSC__JSInternalPromise__rejectedPromise(JSC::JSGlobalObject* arg return JSC::JSPromise::rejectedPromise(arg0, JSC::JSValue::decode(JSValue1)); } -[[ZIG_EXPORT(check_slow)]] +[[RUST_EXPORT(check_slow)]] void JSC__JSInternalPromise__resolve(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { arg0->resolve(arg1, arg1->vm(), JSC::JSValue::decode(JSValue2)); @@ -3940,7 +3940,7 @@ JSC::VM* JSC__JSGlobalObject__vm(JSC::JSGlobalObject* arg0) { return &arg0->vm() void JSC__JSGlobalObject__handleRejectedPromises(JSC::JSGlobalObject* arg0) { - return uncheckedDowncast(arg0)->handleRejectedPromises(); + return uncheckedDowncast(arg0)->handleRejectedPromises(); } #pragma mark - JSC::JSValue @@ -3968,23 +3968,23 @@ bool JSC__JSValue__isException(JSC::EncodedJSValue JSValue0, JSC::VM* arg1) { return dynamicDowncast(JSC::JSValue::decode(JSValue0)) != nullptr; } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isAnyInt(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isAnyInt(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isBigInt(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isBigInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isBigInt(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isBigInt32(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isBigInt32(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isBigInt32(); } -void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3) +void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const RustString* arg2, JSC::EncodedJSValue JSValue3) { JSC::JSObject* object = JSC::JSValue::decode(JSValue0).asCell()->getObject(); - object->putDirect(arg1->vm(), Zig::toIdentifier(*arg2, arg1), JSC::JSValue::decode(JSValue3)); + object->putDirect(arg1->vm(), Rust::toIdentifier(*arg2, arg1), JSC::JSValue::decode(JSValue3)); } void JSC__JSValue__putToPropertyKey(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue arg2, JSC::EncodedJSValue arg3) @@ -4000,7 +4000,7 @@ void JSC__JSValue__putToPropertyKey(JSC::EncodedJSValue JSValue0, JSC::JSGlobalO object->putDirectMayBeIndex(arg1, pkey, value); } -extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSValue__putMayBeIndex(JSC::EncodedJSValue target, JSC::JSGlobalObject* globalObject, const BunString* key, JSC::EncodedJSValue value) +extern "C" [[RUST_EXPORT(check_slow)]] void JSC__JSValue__putMayBeIndex(JSC::EncodedJSValue target, JSC::JSGlobalObject* globalObject, const BunString* key, JSC::EncodedJSValue value) { auto& vm = JSC::getVM(globalObject); ThrowScope scope = DECLARE_THROW_SCOPE(vm); @@ -4013,7 +4013,7 @@ extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSValue__putMayBeIndex(JSC::Enco RETURN_IF_EXCEPTION(scope, ); } -extern "C" bool JSC__JSValue__deleteProperty(JSC::EncodedJSValue target, JSC::JSGlobalObject* globalObject, const ZigString* key) +extern "C" bool JSC__JSValue__deleteProperty(JSC::EncodedJSValue target, JSC::JSGlobalObject* globalObject, const RustString* key) { JSC::JSValue targetValue = JSC::JSValue::decode(target); if (!targetValue.isObject()) @@ -4023,7 +4023,7 @@ extern "C" bool JSC__JSValue__deleteProperty(JSC::EncodedJSValue target, JSC::JS auto scope = DECLARE_THROW_SCOPE(vm); JSC::JSObject* object = targetValue.getObject(); - bool result = object->deleteProperty(globalObject, Zig::toIdentifier(*key, globalObject)); + bool result = object->deleteProperty(globalObject, Rust::toIdentifier(*key, globalObject)); RETURN_IF_EXCEPTION(scope, false); return result; } @@ -4045,8 +4045,8 @@ bool JSC__JSValue__isClass(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* ar } return false; } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isCell(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCell(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isCustomGetterSetter(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isCell(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCell(); } +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isCustomGetterSetter(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCustomGetterSetter(); } @@ -4084,61 +4084,61 @@ void JSC__JSValue__forEach(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* ar }); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isCallable(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isCallable(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCallable(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isGetterSetter(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isGetterSetter(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isGetterSetter(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isHeapBigInt(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isHeapBigInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isHeapBigInt(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isInt32(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isInt32(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isInt32(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isInt32AsAnyInt(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isInt32AsAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isInt32AsAnyInt(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isNull(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNull(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isNumber(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isNull(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNull(); } +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isNumber(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNumber(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isObject(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isObject(JSC::EncodedJSValue JSValue0) { return JSValue0 != 0 && JSC::JSValue::decode(JSValue0).isObject(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isPrimitive(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isPrimitive(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isPrimitive(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isSymbol(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isSymbol(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isSymbol(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isUInt32AsAnyInt(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isUInt32AsAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUInt32AsAnyInt(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isUndefined(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isUndefined(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUndefined(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isUndefinedOrNull(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isUndefinedOrNull(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUndefinedOrNull(); } -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsEmptyString(JSC::JSGlobalObject* arg0) +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsEmptyString(JSC::JSGlobalObject* arg0) { return JSC::JSValue::encode(JSC::jsEmptyString(arg0->vm())); } -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0) +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } @@ -4154,7 +4154,7 @@ JSC::EncodedJSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0) +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } @@ -4163,7 +4163,7 @@ JSC::EncodedJSValue JSC__JSValue__jsNumberFromUint64(uint64_t arg0) return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -[[ZIG_EXPORT(nothrow)]] int64_t JSC__JSValue__toInt64(JSC::EncodedJSValue val) +[[RUST_EXPORT(nothrow)]] int64_t JSC__JSValue__toInt64(JSC::EncodedJSValue val) { JSC::JSValue value = JSC::JSValue::decode(val); ASSERT(value.isHeapBigInt() || value.isNumber()); @@ -4294,14 +4294,14 @@ uint64_t JSC__JSValue__toUInt64NoTruncate(JSC::EncodedJSValue val) return 0; } -JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* globalObject, const ZigString* arg1, - const ZigString* arg2, JSC::EncodedJSValue JSValue3, +JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* globalObject, const RustString* arg1, + const RustString* arg2, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); JSC::JSObject* object = JSC::constructEmptyObject(globalObject); - auto key1 = Zig::toIdentifier(*arg1, globalObject); + auto key1 = Rust::toIdentifier(*arg1, globalObject); JSC::PropertyDescriptor descriptor1; JSC::PropertyDescriptor descriptor2; @@ -4310,7 +4310,7 @@ JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* globalObjec descriptor1.setWritable(1); descriptor1.setValue(JSC::JSValue::decode(JSValue3)); - auto key2 = Zig::toIdentifier(*arg2, globalObject); + auto key2 = Rust::toIdentifier(*arg2, globalObject); descriptor2.setEnumerable(1); descriptor2.setConfigurable(1); @@ -4330,7 +4330,7 @@ JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* globalObjec // Returns empty for exception, returns deleted if not found. // Be careful when handling the return value. // Cannot handle numeric index property names! If it is possible that this will be a integer index, use JSC__JSValue__getPropertyValue instead -[[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsImpl(JSC::EncodedJSValue JSValue0, +[[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsImpl(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, const unsigned char* arg1, size_t arg2) { @@ -4545,7 +4545,7 @@ JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC::EncodedJSValu return {}; } -void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, RustString* arg2) { JSC::JSValue symbolValue = JSC::JSValue::decode(symbolValue_); @@ -4557,21 +4557,21 @@ void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue symbolValue_, JSC::J auto result = symbol->description(); if (!result.isEmpty()) { - *arg2 = Zig::toZigString(result); + *arg2 = Rust::toRustString(result); } else { - *arg2 = ZigStringEmpty; + *arg2 = RustStringEmpty; } } -JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* globalObject, ZigString* arg2) +JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* globalObject, RustString* arg2) { auto& vm = JSC::getVM(globalObject); - WTF::String string = Zig::toString(*arg2); + WTF::String string = Rust::toString(*arg2); return JSC::JSValue::encode(JSC::Symbol::create(vm, vm.symbolRegistry().symbolForKey(string))); } -bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, ZigString* arg2) +bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, RustString* arg2) { JSC::JSValue symbolValue = JSC::JSValue::decode(symbolValue_); JSC::VM& vm = arg1->vm(); @@ -4584,7 +4584,7 @@ bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalO if (!uid.symbolRegistry()) return false; - *arg2 = Zig::toZigString(JSC::jsString(vm, String { uid }), arg1); + *arg2 = Rust::toRustString(JSC::jsString(vm, String { uid }), arg1); return true; } @@ -4603,7 +4603,7 @@ CPP_DECL double Bun__JSValue__toNumber(JSC::EncodedJSValue JSValue0, JSC::JSGlob } // truncates values larger than int32 -[[ZIG_EXPORT(check_slow)]] int32_t JSC__JSValue__coerceToInt32(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) +[[RUST_EXPORT(check_slow)]] int32_t JSC__JSValue__coerceToInt32(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (value.isCell() && value.isHeapBigInt()) { @@ -4612,7 +4612,7 @@ CPP_DECL double Bun__JSValue__toNumber(JSC::EncodedJSValue JSValue0, JSC::JSGlob return value.toInt32(arg1); } -[[ZIG_EXPORT(check_slow)]] int64_t JSC__JSValue__coerceToInt64(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) +[[RUST_EXPORT(check_slow)]] int64_t JSC__JSValue__coerceToInt64(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSValue value = JSValue::decode(JSValue0); if (value.isCell() && value.isHeapBigInt()) { @@ -4637,7 +4637,7 @@ JSC::EncodedJSValue JSC__JSValue__getErrorsProperty(JSC::EncodedJSValue JSValue0 return JSC::JSValue::encode(obj->getDirect(global->vm(), global->vm().propertyNames->errors)); } -[[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsTDZValue() +[[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSValue__jsTDZValue() { return JSC::JSValue::encode(JSC::jsTDZValue()); }; @@ -4648,13 +4648,13 @@ JSC::JSObject* JSC__JSValue__toObject(JSC::EncodedJSValue JSValue0, JSC::JSGloba return value.toObject(arg1); } -[[ZIG_EXPORT(null_is_throw)]] JSC::JSString* JSC__JSValue__toStringOrNull(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) +[[RUST_EXPORT(null_is_throw)]] JSC::JSString* JSC__JSValue__toStringOrNull(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return value.toStringOrNull(arg1); } -[[ZIG_EXPORT(check_slow)]] bool JSC__JSValue__toMatch(JSC::EncodedJSValue regexValue, JSC::JSGlobalObject* global, JSC::EncodedJSValue value) +[[RUST_EXPORT(check_slow)]] bool JSC__JSValue__toMatch(JSC::EncodedJSValue regexValue, JSC::JSGlobalObject* global, JSC::EncodedJSValue value) { ASSERT_NO_PENDING_EXCEPTION(global); JSC::JSValue regex = JSC::JSValue::decode(regexValue); @@ -4691,7 +4691,7 @@ void JSC__VM__releaseWeakRefs(JSC::VM* arg0) arg0->finalizeSynchronousJSExecution(); } -void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2) { JSValue value = JSValue::decode(JSValue0); JSC::JSCell* cell = value.asCell(); @@ -4713,11 +4713,11 @@ void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObjec auto calculated = JSObject::calculatedClassName(obj); if (calculated.length() > 0) { - *arg2 = Zig::toZigString(calculated); + *arg2 = Rust::toRustString(calculated); return; } - *arg2 = Zig::toZigString(view); + *arg2 = Rust::toRustString(view); } bool JSC__JSValue__getClassInfoName(JSValue value, const uint8_t** outPtr, size_t* outLen) @@ -4730,7 +4730,7 @@ bool JSC__JSValue__getClassInfoName(JSValue value, const uint8_t** outPtr, size_ return false; } -void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2) { JSC::JSObject* obj = JSC::JSValue::decode(JSValue0).getObject(); JSC::VM& vm = arg1->vm(); @@ -4747,7 +4747,7 @@ void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalOb if (name && name.isString()) { auto str = name.toWTFString(arg1); if (!str.isEmpty()) { - *arg2 = Zig::toZigString(str); + *arg2 = Rust::toRustString(str); return; } } @@ -4756,25 +4756,25 @@ void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalOb WTF::String actualName = function->name(vm); if (!actualName.isEmpty() || function->isHostOrBuiltinFunction()) { - *arg2 = Zig::toZigString(actualName); + *arg2 = Rust::toRustString(actualName); return; } actualName = function->jsExecutable()->name().string(); - *arg2 = Zig::toZigString(actualName); + *arg2 = Rust::toRustString(actualName); return; } if (JSC::InternalFunction* function = dynamicDowncast(obj)) { - *arg2 = Zig::toZigString(function->name()); + *arg2 = Rust::toRustString(function->name()); return; } arg2->len = 0; } -[[ZIG_EXPORT(check_slow)]] void JSC__JSValue__getName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, BunString* arg2) +[[RUST_EXPORT(check_slow)]] void JSC__JSValue__getName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, BunString* arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (!value.isObject()) { @@ -4861,7 +4861,7 @@ size_t JSC__VM__runGC(JSC::VM* vm, bool sync) return vm->heap.sizeAfterLastFullCollection(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__VM__isJITEnabled() +[[RUST_EXPORT(nothrow)]] bool JSC__VM__isJITEnabled() { return JSC::Options::useJIT(); } @@ -4900,7 +4900,7 @@ void JSC__VM__holdAPILock(JSC::VM* arg0, void* ctx, void (*callback)(void* arg0) } // The following two functions are copied 1:1 from JSLockHolder to provide a -// new, more ergonomic binding for interacting with the lock from Zig +// new, more ergonomic binding for interacting with the lock from Rust // https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/runtime/JSLock.cpp extern "C" void JSC__VM__getAPILock(JSC::VM* vm) @@ -4956,18 +4956,18 @@ bool JSC__VM__isEntered(JSC::VM* arg0) return (*arg0).isEntered(); } -[[ZIG_EXPORT(nothrow)]] +[[RUST_EXPORT(nothrow)]] bool JSC__VM__isTerminationException(JSC::VM* vm, JSC::Exception* exception) { return vm->isTerminationException(exception); } -[[ZIG_EXPORT(nothrow)]] +[[RUST_EXPORT(nothrow)]] void JSC__VM__clearHasTerminationRequest(JSC::VM* vm) { vm->clearHasTerminationRequest(); } -[[ZIG_EXPORT(nothrow)]] +[[RUST_EXPORT(nothrow)]] bool JSC__VM__hasTerminationRequest(JSC::VM* vm) { return vm->hasTerminationRequest(); @@ -5058,7 +5058,7 @@ JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObj return JSC::JSValue::encode(value); } -// This enum must match the zig enum in src/jsc/bindings/JSValue.zig JSValue.BuiltinName +// This enum must match the rust enum in src/jsc/bindings/JSValue.rust JSValue.BuiltinName enum class BuiltinNamesMap : uint8_t { method, headers, @@ -5220,7 +5220,7 @@ extern "C" void JSGlobalObject__throwStackOverflow(JSC::JSGlobalObject* globalOb } template -static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, RustString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { ASSERT_NO_PENDING_EXCEPTION(globalObject); JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -5283,7 +5283,7 @@ static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC: } visitedProperties.append(Identifier::fromUid(vm, prop)); - ZigString key = toZigString(prop); + RustString key = toRustString(prop); JSC::JSValue propertyValue = JSValue(); if (objectToUse == object) { @@ -5384,7 +5384,7 @@ static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC: continue; visitedProperties.append(property); - ZigString key = toZigString(property.isSymbol() && !property.isPrivateName() ? property.impl() : property.string()); + RustString key = toRustString(property.isSymbol() && !property.isPrivateName() ? property.impl() : property.string()); JSC::JSValue propertyValue = jsUndefined(); @@ -5456,17 +5456,17 @@ static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC: } } -[[ZIG_EXPORT(check_slow)]] void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)([[ZIG_NONNULL]] JSC::JSGlobalObject* arg0, void* ctx, [[ZIG_NONNULL]] ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +[[RUST_EXPORT(check_slow)]] void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)([[RUST_NONNULL]] JSC::JSGlobalObject* arg0, void* ctx, [[RUST_NONNULL]] RustString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC__JSValue__forEachPropertyImpl(JSValue0, globalObject, arg2, iter); } -extern "C" void JSC__JSValue__forEachPropertyNonIndexed(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +extern "C" void JSC__JSValue__forEachPropertyNonIndexed(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, RustString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC__JSValue__forEachPropertyImpl(JSValue0, globalObject, arg2, iter); } -extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInUInt64Range(JSC::EncodedJSValue value, uint64_t max, uint64_t min) +extern "C" [[RUST_EXPORT(nothrow)]] bool JSC__isBigIntInUInt64Range(JSC::EncodedJSValue value, uint64_t max, uint64_t min) { JSValue jsValue = JSValue::decode(value); if (!jsValue.isHeapBigInt()) @@ -5481,7 +5481,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInUInt64Range(JSC::EncodedJ return result == JSBigInt::ComparisonResult::LessThan || result == JSBigInt::ComparisonResult::Equal; } -extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInInt64Range(JSC::EncodedJSValue value, int64_t max, int64_t min) +extern "C" [[RUST_EXPORT(nothrow)]] bool JSC__isBigIntInInt64Range(JSC::EncodedJSValue value, int64_t max, int64_t min) { JSValue jsValue = JSValue::decode(value); if (!jsValue.isHeapBigInt()) @@ -5496,7 +5496,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInInt64Range(JSC::EncodedJS return result == JSBigInt::ComparisonResult::LessThan || result == JSBigInt::ComparisonResult::Equal; } -[[ZIG_EXPORT(check_slow)]] void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)([[ZIG_NONNULL]] JSC::JSGlobalObject* arg0, void* ctx, [[ZIG_NONNULL]] ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +[[RUST_EXPORT(check_slow)]] void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)([[RUST_NONNULL]] JSC::JSGlobalObject* arg0, void* ctx, [[RUST_NONNULL]] RustString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -5571,7 +5571,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInInt64Range(JSC::EncodedJS } const WTF::StringImpl* name = property.isSymbol() && !property.isPrivateName() ? property.impl() : property.string().impl(); - ZigString key = toZigString(name); + RustString key = toRustString(name); JSC::EnsureStillAliveScope ensureStillAliveScope(propertyValue); // TODO: properly propagate exception upwards @@ -5580,7 +5580,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool JSC__isBigIntInInt64Range(JSC::EncodedJS properties.releaseData(); } -[[ZIG_EXPORT(nothrow)]] bool JSC__JSValue__isConstructor(JSC::EncodedJSValue JSValue0) +[[RUST_EXPORT(nothrow)]] bool JSC__JSValue__isConstructor(JSC::EncodedJSValue JSValue0) { JSValue value = JSValue::decode(JSValue0); return value.isConstructor(); @@ -5631,7 +5631,7 @@ extern "C" size_t JSC__VM__externalMemorySize(JSC::VM* vm) extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4) { - Zig::GlobalObject* globalObject = static_cast(arg0); + Rust::GlobalObject* globalObject = static_cast(arg0); JSValue microtaskArgs[] = { JSValue::decode(JSValue1), globalObject->m_asyncContextData.get()->getInternalField(0), @@ -5677,7 +5677,7 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0 extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC::JSGlobalObject* globalObject) { - Zig::GlobalObject* thisObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(globalObject); auto* context = thisObject->scriptExecutionContext(); RefPtr abortSignal = WebCore::AbortSignal::create(context); return abortSignal.leakRef(); @@ -5685,7 +5685,7 @@ extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC::JSGlobalObject* extern "C" JSC::EncodedJSValue WebCore__AbortSignal__create(JSC::JSGlobalObject* globalObject) { - Zig::GlobalObject* thisObject = uncheckedDowncast(globalObject); + Rust::GlobalObject* thisObject = uncheckedDowncast(globalObject); auto* context = thisObject->scriptExecutionContext(); auto abortSignal = WebCore::AbortSignal::create(context); @@ -5833,13 +5833,13 @@ extern "C" JSC::EncodedJSValue JSC__JSValue__getOwnByValue(JSC::EncodedJSValue v } } -extern "C" [[ZIG_EXPORT(check_slow)]] double Bun__parseDate(JSC::JSGlobalObject* globalObject, BunString* str) +extern "C" [[RUST_EXPORT(check_slow)]] double Bun__parseDate(JSC::JSGlobalObject* globalObject, BunString* str) { auto& vm = JSC::getVM(globalObject); return vm.dateCache.parseDate(globalObject, vm, str->toWTFString()); } -extern "C" [[ZIG_EXPORT(check_slow)]] double Bun__gregorianDateTimeToMS(JSC::JSGlobalObject* globalObject, int year, int month, int day, int hour, int minute, int second, int millisecond, bool localTime) +extern "C" [[RUST_EXPORT(check_slow)]] double Bun__gregorianDateTimeToMS(JSC::JSGlobalObject* globalObject, int year, int month, int day, int hour, int minute, int second, int millisecond, bool localTime) { auto& vm = JSC::getVM(globalObject); WTF::GregorianDateTime dateTime; @@ -5852,7 +5852,7 @@ extern "C" [[ZIG_EXPORT(check_slow)]] double Bun__gregorianDateTimeToMS(JSC::JSG return vm.dateCache.gregorianDateTimeToMS(dateTime, millisecond, localTime ? WTF::TimeType::LocalTime : WTF::TimeType::UTCTime); } -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__msToGregorianDateTime(JSC::JSGlobalObject* globalObject, double ms, bool localTime, +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__msToGregorianDateTime(JSC::JSGlobalObject* globalObject, double ms, bool localTime, int* year, int* month, int* day, int* hour, int* minute, int* second, int* weekday) { auto& vm = JSC::getVM(globalObject); @@ -5934,12 +5934,12 @@ extern "C" int JSC__JSValue__DateNowISOString(JSC::JSGlobalObject* globalObject, #pragma mark - WebCore::DOMFormData -CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, ZigString* arg1, ZigString* arg2) +CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, RustString* arg1, RustString* arg2) { arg0->append(toStringCopy(*arg1), toStringCopy(*arg2)); } -CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, void* blobValueInner, ZigString* fileName) +CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, RustString* arg2, void* blobValueInner, RustString* fileName) { RefPtr blob = WebCore::Blob::create(blobValueInner); arg0->append(toStringCopy(*arg2), blob, toStringCopy(*fileName)); @@ -5952,16 +5952,16 @@ CPP_DECL size_t WebCore__DOMFormData__count(WebCore::DOMFormData* arg0) extern "C" void DOMFormData__toQueryString( DOMFormData* formData, void* ctx, - void (*callback)(void* ctx, ZigString* encoded)) + void (*callback)(void* ctx, RustString* encoded)) { auto str = formData->toURLEncodedString(); - ZigString encoded = toZigString(str); + RustString encoded = toRustString(str); callback(ctx, &encoded); } -CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1) +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, RustString* arg1) { - Zig::GlobalObject* globalObject = static_cast(arg0); + Rust::GlobalObject* globalObject = static_cast(arg0); // don't need to copy the string because it internally does. auto str = toString(*arg1); // toString() in helpers.h returns an empty string when the input exceeds @@ -5977,7 +5977,7 @@ CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlo CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0) { - Zig::GlobalObject* globalObject = static_cast(arg0); + Rust::GlobalObject* globalObject = static_cast(arg0); auto formData = DOMFormData::create(globalObject->scriptExecutionContext()); return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTF::move(formData))); } @@ -5989,7 +5989,7 @@ CPP_DECL WebCore::DOMFormData* WebCore__DOMFormData__fromJS(JSC::EncodedJSValue #pragma mark - JSC::JSMap -CPP_DECL [[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSMap__create(JSC::JSGlobalObject* arg0) +CPP_DECL [[RUST_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSMap__create(JSC::JSGlobalObject* arg0) { return JSC::JSValue::encode(JSC::JSMap::create(arg0->vm(), arg0->mapStructure())); } @@ -5997,7 +5997,7 @@ CPP_DECL [[ZIG_EXPORT(nothrow)]] JSC::EncodedJSValue JSC__JSMap__create(JSC::JSG // JSMap::get never returns JSValue::zero, even in the case of an exception. The // best we can, therefore, do is manually test for exceptions. // NOLINTNEXTLINE(bun-bindgen-force-zero_is_throw-for-jsvalue) -CPP_DECL [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSC__JSMap__get(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) +CPP_DECL [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSC__JSMap__get(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { auto& vm = JSC::getVM(arg1); const JSC::JSValue key = JSC::JSValue::decode(JSValue2); @@ -6010,29 +6010,29 @@ CPP_DECL [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue JSC__JSMap__get(JSC:: return JSC::JSValue::encode(value); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] bool JSC__JSMap__has(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) +CPP_DECL [[RUST_EXPORT(check_slow)]] bool JSC__JSMap__has(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { const JSC::JSValue value = JSC::JSValue::decode(JSValue2); return map->has(arg1, value); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] bool JSC__JSMap__remove(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) +CPP_DECL [[RUST_EXPORT(check_slow)]] bool JSC__JSMap__remove(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { const JSC::JSValue value = JSC::JSValue::decode(JSValue2); return map->remove(arg1, value); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] void JSC__JSMap__clear(JSC::JSMap* map, JSC::JSGlobalObject* arg1) +CPP_DECL [[RUST_EXPORT(check_slow)]] void JSC__JSMap__clear(JSC::JSMap* map, JSC::JSGlobalObject* arg1) { map->clear(arg1); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] void JSC__JSMap__set(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3) +CPP_DECL [[RUST_EXPORT(check_slow)]] void JSC__JSMap__set(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3) { map->set(arg1, JSC::JSValue::decode(JSValue2), JSC::JSValue::decode(JSValue3)); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] uint32_t JSC__JSMap__size(JSC::JSMap* map, JSC::JSGlobalObject* arg1) +CPP_DECL [[RUST_EXPORT(check_slow)]] uint32_t JSC__JSMap__size(JSC::JSMap* map, JSC::JSGlobalObject* arg1) { return map->size(); } @@ -6068,21 +6068,21 @@ extern "C" EncodedJSValue JSC__createRangeError(JSC::JSGlobalObject* globalObjec extern "C" EncodedJSValue ExpectMatcherUtils__getSingleton(JSC::JSGlobalObject* globalObject_) { - Zig::GlobalObject* globalObject = static_cast(globalObject_); + Rust::GlobalObject* globalObject = static_cast(globalObject_); return JSValue::encode(globalObject->m_testMatcherUtilsObject.getInitializedOnMainThread(globalObject)); } extern "C" EncodedJSValue Expect__getPrototype(JSC::JSGlobalObject* globalObject) { - return JSValue::encode(static_cast(globalObject)->JSExpectPrototype()); + return JSValue::encode(static_cast(globalObject)->JSExpectPrototype()); } extern "C" EncodedJSValue ExpectStatic__getPrototype(JSC::JSGlobalObject* globalObject) { - return JSValue::encode(static_cast(globalObject)->JSExpectStaticPrototype()); + return JSValue::encode(static_cast(globalObject)->JSExpectStaticPrototype()); } -extern "C" EncodedJSValue JSFunction__createFromZig( +extern "C" EncodedJSValue JSFunction__createFromRust( JSC::JSGlobalObject* global, BunString fn_name, NativeFunction implementation, @@ -6158,12 +6158,12 @@ CPP_DECL bool JSC__GetterSetter__isSetterNull(JSC::GetterSetter* gettersetter) return gettersetter->isSetterNull(); } -CPP_DECL [[ZIG_EXPORT(nothrow)]] bool JSC__CustomGetterSetter__isGetterNull(JSC::CustomGetterSetter* gettersetter) +CPP_DECL [[RUST_EXPORT(nothrow)]] bool JSC__CustomGetterSetter__isGetterNull(JSC::CustomGetterSetter* gettersetter) { return gettersetter->getter() == nullptr; } -CPP_DECL [[ZIG_EXPORT(nothrow)]] bool JSC__CustomGetterSetter__isSetterNull(JSC::CustomGetterSetter* gettersetter) +CPP_DECL [[RUST_EXPORT(nothrow)]] bool JSC__CustomGetterSetter__isSetterNull(JSC::CustomGetterSetter* gettersetter) { return gettersetter->setter() == nullptr; } @@ -6173,7 +6173,7 @@ CPP_DECL JSC::EncodedJSValue Bun__ProxyObject__getInternalField(JSC::EncodedJSVa return JSValue::encode(uncheckedDowncast(JSValue::decode(value))->internalField((ProxyObject::Field)id).get()); } -CPP_DECL [[ZIG_EXPORT(nothrow)]] void JSC__SourceProvider__deref(JSC::SourceProvider* provider) +CPP_DECL [[RUST_EXPORT(nothrow)]] void JSC__SourceProvider__deref(JSC::SourceProvider* provider) { provider->deref(); } @@ -6193,17 +6193,17 @@ CPP_DECL void Bun__CallFrame__getCallerSrcLoc(JSC::CallFrame* callFrame, JSC::JS JSC::LineColumn lineColumn; String sourceURL; - ZigStackFrame remappedFrame = {}; + RustStackFrame remappedFrame = {}; JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus { - if (Zig::isImplementationVisibilityPrivate(visitor)) + if (Rust::isImplementationVisibilityPrivate(visitor)) return WTF::IterationStatus::Continue; if (visitor->hasLineAndColumnInfo()) { lineColumn = visitor->computeLineAndColumn(); - sourceURL = Zig::sourceURL(visitor); + sourceURL = Rust::sourceURL(visitor); return WTF::IterationStatus::Done; } @@ -6294,7 +6294,7 @@ extern "C" double Bun__JSC__operationMathPow(double x, double y) } #if !ENABLE(EXCEPTION_SCOPE_VERIFICATION) -extern "C" [[ZIG_EXPORT(nothrow)]] bool Bun__RETURN_IF_EXCEPTION(JSC::JSGlobalObject* globalObject) +extern "C" [[RUST_EXPORT(nothrow)]] bool Bun__RETURN_IF_EXCEPTION(JSC::JSGlobalObject* globalObject) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); RETURN_IF_EXCEPTION(scope, true); @@ -6302,7 +6302,7 @@ extern "C" [[ZIG_EXPORT(nothrow)]] bool Bun__RETURN_IF_EXCEPTION(JSC::JSGlobalOb } #endif -CPP_DECL [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue Bun__JSValue__bind(JSC::EncodedJSValue functionToBindEncoded, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue bindThisArgEncoded, const BunString* name, double length, JSC::EncodedJSValue* args, size_t args_len) +CPP_DECL [[RUST_EXPORT(zero_is_throw)]] JSC::EncodedJSValue Bun__JSValue__bind(JSC::EncodedJSValue functionToBindEncoded, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue bindThisArgEncoded, const BunString* name, double length, JSC::EncodedJSValue* args, size_t args_len) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -6319,7 +6319,7 @@ CPP_DECL [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue Bun__JSValue__bind(JS RELEASE_AND_RETURN(scope, JSC::JSValue::encode(boundFunction)); } -CPP_DECL [[ZIG_EXPORT(check_slow)]] void Bun__JSValue__setPrototypeDirect(JSC::EncodedJSValue valueEncoded, JSC::EncodedJSValue prototypeEncoded, JSC::JSGlobalObject* globalObject) +CPP_DECL [[RUST_EXPORT(check_slow)]] void Bun__JSValue__setPrototypeDirect(JSC::EncodedJSValue valueEncoded, JSC::EncodedJSValue prototypeEncoded, JSC::JSGlobalObject* globalObject) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -6331,18 +6331,18 @@ CPP_DECL [[ZIG_EXPORT(check_slow)]] void Bun__JSValue__setPrototypeDirect(JSC::E return; } -CPP_DECL [[ZIG_EXPORT(nothrow)]] unsigned int Bun__CallFrame__getLineNumber(JSC::CallFrame* callFrame, JSC::JSGlobalObject* globalObject) +CPP_DECL [[RUST_EXPORT(nothrow)]] unsigned int Bun__CallFrame__getLineNumber(JSC::CallFrame* callFrame, JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); JSC::LineColumn lineColumn; String sourceURL; JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus { - if (Zig::isImplementationVisibilityPrivate(visitor)) + if (Rust::isImplementationVisibilityPrivate(visitor)) return WTF::IterationStatus::Continue; if (visitor->hasLineAndColumnInfo()) { - String currentSourceURL = Zig::sourceURL(visitor); + String currentSourceURL = Rust::sourceURL(visitor); if (!currentSourceURL.startsWith("builtin://"_s) && !currentSourceURL.startsWith("node:"_s)) { lineColumn = visitor->computeLineAndColumn(); @@ -6354,7 +6354,7 @@ CPP_DECL [[ZIG_EXPORT(nothrow)]] unsigned int Bun__CallFrame__getLineNumber(JSC: }); if (!sourceURL.isEmpty() && lineColumn.line > 0) { - ZigStackFrame remappedFrame = {}; + RustStackFrame remappedFrame = {}; remappedFrame.position.line_zero_based = lineColumn.line - 1; remappedFrame.position.column_zero_based = lineColumn.column; remappedFrame.source_url = Bun::toStringRef(sourceURL); @@ -6413,7 +6413,7 @@ extern "C" JSC::EncodedJSValue Bun__REPL__evaluate( return JSC::JSValue::encode(JSC::jsUndefined()); } - // Note: _ is now set in Zig code (repl.zig) after extracting the value from + // Note: _ is now set in Rust code (repl.rust) after extracting the value from // the REPL transform wrapper. We don't set it here anymore. return JSC::JSValue::encode(result); @@ -6498,7 +6498,7 @@ extern "C" JSC::EncodedJSValue Bun__REPL__formatValue( auto scope = DECLARE_THROW_SCOPE(vm); // Get the util.inspect function from the global object - auto* bunGlobal = uncheckedDowncast(globalObject); + auto* bunGlobal = uncheckedDowncast(globalObject); JSC::JSValue inspectFn = bunGlobal->utilInspectFunction(); if (!inspectFn || !inspectFn.isCallable()) { diff --git a/src/jsc/bindings/blob.cpp b/src/jsc/bindings/blob.cpp index 1bdbf7598ab..048b1688533 100644 --- a/src/jsc/bindings/blob.cpp +++ b/src/jsc/bindings/blob.cpp @@ -1,5 +1,5 @@ #include "blob.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" extern "C" JSC::EncodedJSValue SYSV_ABI Blob__create(JSC::JSGlobalObject* globalObject, void* impl); extern "C" void Blob__setAsFile(void* impl, BunString* filename); diff --git a/src/jsc/bindings/c-bindings.cpp b/src/jsc/bindings/c-bindings.cpp index a20749bef69..4a5a386d633 100644 --- a/src/jsc/bindings/c-bindings.cpp +++ b/src/jsc/bindings/c-bindings.cpp @@ -757,7 +757,7 @@ extern "C" int32_t open_as_nonblocking_tty(int32_t fd, int32_t mode) #endif -extern "C" [[ZIG_EXPORT(nothrow)]] size_t Bun__ramSize() +extern "C" [[RUST_EXPORT(nothrow)]] size_t Bun__ramSize() { // This value is cached internally. return WTF::ramSize(); diff --git a/src/jsc/bindings/headers-cpp.h b/src/jsc/bindings/headers-cpp.h index 1453b0a0fb1..d6e2386b253 100644 --- a/src/jsc/bindings/headers-cpp.h +++ b/src/jsc/bindings/headers-cpp.h @@ -145,13 +145,13 @@ extern "C" const size_t JSC__ThrowScope_object_align_ = alignof(JSC::ThrowScope) extern "C" const size_t JSC__TopExceptionScope_object_size_ = sizeof(JSC::TopExceptionScope); extern "C" const size_t JSC__TopExceptionScope_object_align_ = alignof(JSC::TopExceptionScope); -#ifndef INCLUDED__ZigGlobalObject_h_ -#define INCLUDED__ZigGlobalObject_h_ -#include ""ZigGlobalObject.h"" +#ifndef INCLUDED__RustGlobalObject_h_ +#define INCLUDED__RustGlobalObject_h_ +#include ""RustGlobalObject.h"" #endif -extern "C" const size_t Zig__GlobalObject_object_size_ = sizeof(Zig::GlobalObject); -extern "C" const size_t Zig__GlobalObject_object_align_ = alignof(Zig::GlobalObject); +extern "C" const size_t Rust__GlobalObject_object_size_ = sizeof(Rust::GlobalObject); +extern "C" const size_t Rust__GlobalObject_object_align_ = alignof(Rust::GlobalObject); #ifndef INCLUDED_Path_h #define INCLUDED_Path_h @@ -166,8 +166,8 @@ extern "C" const size_t Bun__Path_object_align_ = alignof(Bun__Path); #include ""ConsoleObject.h"" #endif -extern "C" const size_t Bun__ConsoleObject_object_size_ = sizeof(Zig::ConsoleClient); -extern "C" const size_t Bun__ConsoleObject_object_align_ = alignof(Zig::ConsoleClient); +extern "C" const size_t Bun__ConsoleObject_object_size_ = sizeof(Rust::ConsoleClient); +extern "C" const size_t Bun__ConsoleObject_object_align_ = alignof(Rust::ConsoleClient); #ifndef INCLUDED_ #define INCLUDED_ @@ -185,6 +185,6 @@ extern "C" const size_t Bun__Timer_object_align_ = alignof(Bun__Timer); extern "C" const size_t Bun__BodyValueBufferer_object_size_ = sizeof(Bun__BodyValueBufferer); extern "C" const size_t Bun__BodyValueBufferer_object_align_ = alignof(Bun__BodyValueBufferer); -const size_t sizes[39] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::DOMFormData), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(JSC::JSModuleLoader), sizeof(WebCore::AbortSignal), sizeof(JSC::JSPromise), sizeof(JSC::JSPromise), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(JSC::JSMap), sizeof(JSC::JSValue), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::TopExceptionScope), sizeof(FFI__ptr), sizeof(Reader__u8), sizeof(Reader__u16), sizeof(Reader__u32), sizeof(Reader__ptr), sizeof(Reader__i8), sizeof(Reader__i16), sizeof(Reader__i32), sizeof(Reader__f32), sizeof(Reader__f64), sizeof(Reader__i64), sizeof(Reader__u64), sizeof(Reader__intptr), sizeof(Zig::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink), sizeof(FileSink), sizeof(FileSink)}; +const size_t sizes[39] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::DOMFormData), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(JSC::JSModuleLoader), sizeof(WebCore::AbortSignal), sizeof(JSC::JSPromise), sizeof(JSC::JSPromise), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(JSC::JSMap), sizeof(JSC::JSValue), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::TopExceptionScope), sizeof(FFI__ptr), sizeof(Reader__u8), sizeof(Reader__u16), sizeof(Reader__u32), sizeof(Reader__ptr), sizeof(Reader__i8), sizeof(Reader__i16), sizeof(Reader__i32), sizeof(Reader__f32), sizeof(Reader__f64), sizeof(Reader__i64), sizeof(Reader__u64), sizeof(Reader__intptr), sizeof(Rust::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink), sizeof(FileSink), sizeof(FileSink)}; -const size_t aligns[39] = {alignof(JSC::JSObject), alignof(WebCore::DOMURL), alignof(WebCore::DOMFormData), alignof(WebCore::FetchHeaders), alignof(SystemError), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(JSC::JSModuleLoader), alignof(WebCore::AbortSignal), alignof(JSC::JSPromise), alignof(JSC::JSPromise), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(JSC::JSMap), alignof(JSC::JSValue), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::TopExceptionScope), alignof(FFI__ptr), alignof(Reader__u8), alignof(Reader__u16), alignof(Reader__u32), alignof(Reader__ptr), alignof(Reader__i8), alignof(Reader__i16), alignof(Reader__i32), alignof(Reader__f32), alignof(Reader__f64), alignof(Reader__i64), alignof(Reader__u64), alignof(Reader__intptr), alignof(Zig::GlobalObject), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink), alignof(FileSink), alignof(FileSink)}; +const size_t aligns[39] = {alignof(JSC::JSObject), alignof(WebCore::DOMURL), alignof(WebCore::DOMFormData), alignof(WebCore::FetchHeaders), alignof(SystemError), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(JSC::JSModuleLoader), alignof(WebCore::AbortSignal), alignof(JSC::JSPromise), alignof(JSC::JSPromise), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(JSC::JSMap), alignof(JSC::JSValue), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::TopExceptionScope), alignof(FFI__ptr), alignof(Reader__u8), alignof(Reader__u16), alignof(Reader__u32), alignof(Reader__ptr), alignof(Reader__i8), alignof(Reader__i16), alignof(Reader__i32), alignof(Reader__f32), alignof(Reader__f64), alignof(Reader__i64), alignof(Reader__u64), alignof(Reader__intptr), alignof(Rust::GlobalObject), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink), alignof(FileSink), alignof(FileSink)}; diff --git a/src/jsc/bindings/headers-handwritten.h b/src/jsc/bindings/headers-handwritten.h index ee53c919fd8..bc3d75d6dd1 100644 --- a/src/jsc/bindings/headers-handwritten.h +++ b/src/jsc/bindings/headers-handwritten.h @@ -7,7 +7,7 @@ #ifndef HEADERS_HANDWRITTEN #define HEADERS_HANDWRITTEN -typedef uint16_t ZigErrorCode; +typedef uint16_t RustErrorCode; typedef struct VirtualMachine VirtualMachine; // exists to make headers.h happy typedef struct CppWebSocket CppWebSocket; @@ -16,15 +16,15 @@ namespace WTF { class String; } -typedef struct ZigString { +typedef struct RustString { const unsigned char* ptr; size_t len; -} ZigString; +} RustString; #ifndef __cplusplus typedef uint8_t BunStringTag; typedef union BunStringImpl { - ZigString zig; + RustString rust; void* wtf; } BunStringImpl; @@ -35,19 +35,19 @@ class String; } typedef union BunStringImpl { - ZigString zig; + RustString rust; WTF::StringImpl* wtf; } BunStringImpl; enum class BunStringTag : uint8_t { Dead = 0, WTFStringImpl = 1, - ZigString = 2, - StaticZigString = 3, + RustString = 2, + StaticRustString = 3, Empty = 4, }; -/// Mirrors `bun.uws.ResponseKind` in src/uws_sys/uws.zig. +/// Mirrors `bun.uws.ResponseKind` in src/uws_sys/uws.rust. enum class UWSResponseKind : int32_t { TCP = 0, SSL = 1, @@ -73,8 +73,8 @@ typedef struct BunString { // Zero copy is kind of a lie. // We clone it if it's non-ASCII UTF-8. // We don't clone it if it was marked as static - // if it was a ZigString, it still allocates a WTF::StringImpl. - // It's only truly zero-copy if it was already a WTFStringImpl (which it is if it came from JS and we didn't use ZigString) + // if it was a RustString, it still allocates a WTF::StringImpl. + // It's only truly zero-copy if it was already a WTFStringImpl (which it is if it came from JS and we didn't use RustString) WTF::String toWTFString(ZeroCopyTag) const; // If the string is empty, this will ensure m_impl is non-null by @@ -92,21 +92,21 @@ typedef struct BunString { } BunString; -typedef struct ZigErrorType { - ZigErrorCode code; +typedef struct RustErrorType { + RustErrorCode code; JSC::EncodedJSValue value; -} ZigErrorType; -typedef union ErrorableZigStringResult { - ZigString value; - ZigErrorType err; -} ErrorableZigStringResult; -typedef struct ErrorableZigString { - ErrorableZigStringResult result; +} RustErrorType; +typedef union ErrorableRustStringResult { + RustString value; + RustErrorType err; +} ErrorableRustStringResult; +typedef struct ErrorableRustString { + ErrorableRustStringResult result; bool success; -} ErrorableZigString; +} ErrorableRustString; typedef union ErrorableStringResult { BunString value; - ZigErrorType err; + RustErrorType err; } ErrorableStringResult; typedef struct ErrorableString { ErrorableStringResult result; @@ -134,7 +134,7 @@ typedef struct ResolvedSource { static const uint32_t ResolvedSourceTagPackageJSONTypeModule = 1; typedef union ErrorableResolvedSourceResult { ResolvedSource value; - ZigErrorType err; + RustErrorType err; } ErrorableResolvedSourceResult; typedef struct ErrorableResolvedSource { ErrorableResolvedSourceResult result; @@ -161,19 +161,19 @@ const BunPluginTarget BunPluginTargetBrowser = 1; const BunPluginTarget BunPluginTargetNode = 2; const BunPluginTarget BunPluginTargetMax = BunPluginTargetNode; -typedef uint8_t ZigStackFrameCode; -const ZigStackFrameCode ZigStackFrameCodeNone = 0; -const ZigStackFrameCode ZigStackFrameCodeEval = 1; -const ZigStackFrameCode ZigStackFrameCodeModule = 2; -const ZigStackFrameCode ZigStackFrameCodeFunction = 3; -const ZigStackFrameCode ZigStackFrameCodeGlobal = 4; -const ZigStackFrameCode ZigStackFrameCodeWasm = 5; -const ZigStackFrameCode ZigStackFrameCodeConstructor = 6; +typedef uint8_t RustStackFrameCode; +const RustStackFrameCode RustStackFrameCodeNone = 0; +const RustStackFrameCode RustStackFrameCodeEval = 1; +const RustStackFrameCode RustStackFrameCodeModule = 2; +const RustStackFrameCode RustStackFrameCodeFunction = 3; +const RustStackFrameCode RustStackFrameCodeGlobal = 4; +const RustStackFrameCode RustStackFrameCodeWasm = 5; +const RustStackFrameCode RustStackFrameCodeConstructor = 6; extern "C" void __attribute((__noreturn__)) Bun__panic(const char* message, size_t length); #define BUN_PANIC(message) Bun__panic(message, sizeof(message) - 1) -typedef struct ZigStackFramePosition { +typedef struct RustStackFramePosition { int32_t line_zero_based; int32_t column_zero_based; int32_t byte_position; @@ -186,18 +186,18 @@ typedef struct ZigStackFramePosition { { return OrdinalNumber::fromZeroBasedInt(this->line_zero_based); } -} ZigStackFramePosition; +} RustStackFramePosition; -typedef struct ZigStackFrame { +typedef struct RustStackFrame { BunString function_name; BunString source_url; - ZigStackFramePosition position; - ZigStackFrameCode code_type; + RustStackFramePosition position; + RustStackFrameCode code_type; bool is_async; bool remapped; int32_t jsc_stack_frame_index; - ZigStackFrame() + RustStackFrame() : function_name {} , source_url {} , position {} @@ -207,20 +207,20 @@ typedef struct ZigStackFrame { , jsc_stack_frame_index(-1) { } -} ZigStackFrame; +} RustStackFrame; -typedef struct ZigStackTrace { +typedef struct RustStackTrace { BunString* source_lines_ptr; OrdinalNumber* source_lines_numbers; uint8_t source_lines_len; uint8_t source_lines_to_collect; - ZigStackFrame* frames_ptr; + RustStackFrame* frames_ptr; uint8_t frames_len; uint8_t frames_cap; JSC::SourceProvider* referenced_source_provider; -} ZigStackTrace; +} RustStackTrace; -typedef struct ZigException { +typedef struct RustException { unsigned char type; uint16_t runtime_type; int errno_; @@ -229,11 +229,11 @@ typedef struct ZigException { BunString path; BunString name; BunString message; - ZigStackTrace stack; + RustStackTrace stack; void* exception; bool remapped; int fd; -} ZigException; +} RustException; typedef uint8_t JSErrorCode; const JSErrorCode JSErrorCodeError = 0; @@ -248,7 +248,7 @@ const JSErrorCode JSErrorCodeOutOfMemoryError = 8; const JSErrorCode JSErrorCodeStackOverflow = 253; const JSErrorCode JSErrorCodeUserErrorCode = 254; -// Must be kept in sync with bun.schema.api.Loader in schema.zig +// Must be kept in sync with bun.schema.api.Loader in schema.rust typedef uint8_t BunLoaderType; const BunLoaderType BunLoaderTypeNone = 254; const BunLoaderType BunLoaderTypeJSX = 1; @@ -359,15 +359,15 @@ typedef struct { extern "C" const char* Bun__userAgent; -extern "C" ZigErrorCode Zig_ErrorCodeParserError; +extern "C" RustErrorCode Rust_ErrorCodeParserError; -extern "C" void ZigString__free(const unsigned char* ptr, size_t len, void* allocator); +extern "C" void RustString__free(const unsigned char* ptr, size_t len, void* allocator); extern "C" bool Bun__transpileVirtualModule( JSC::JSGlobalObject* global, const BunString* specifier, const BunString* referrer, - ZigString* sourceCode, + RustString* sourceCode, BunLoaderType loader, ErrorableResolvedSource* result); @@ -403,13 +403,13 @@ extern "C" const char* Bun__version; extern "C" const char* Bun__version_with_sha; // Version exports removed - now handled by CMake-generated header (bun_dependency_versions.h) -// Only keep the ones still exported from Zig +// Only keep the ones still exported from Rust extern "C" const char* Bun__versions_uws; extern "C" const char* Bun__versions_usockets; extern "C" const char* Bun__version_sha; -extern "C" void ZigString__freeGlobal(const unsigned char* ptr, size_t len); +extern "C" void RustString__freeGlobal(const unsigned char* ptr, size_t len); extern "C" size_t Bun__encoding__writeLatin1(const unsigned char* ptr, size_t len, unsigned char* to, size_t other_len, Encoding encoding); extern "C" size_t Bun__encoding__writeUTF16(const char16_t* ptr, size_t len, unsigned char* to, size_t other_len, Encoding encoding); @@ -472,7 +472,7 @@ bool Bun__deepMatch( bool replacePropsWithAsymmetricMatchers, bool isMatchingObjectContaining); -extern "C" void Bun__remapStackFramePositions(void*, ZigStackFrame*, size_t); +extern "C" void Bun__remapStackFramePositions(void*, RustStackFrame*, size_t); namespace Inspector { class ScriptArguments; diff --git a/src/jsc/bindings/headers.h b/src/jsc/bindings/headers.h index c85e7379065..8a27f9b446b 100644 --- a/src/jsc/bindings/headers.h +++ b/src/jsc/bindings/headers.h @@ -8,12 +8,12 @@ #define AUTO_EXTERN_C extern "C" #ifdef WIN32 - #define AUTO_EXTERN_C_ZIG extern "C" + #define AUTO_EXTERN_C_RUST extern "C" #else - #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) + #define AUTO_EXTERN_C_RUST extern "C" __attribute__((weak)) #endif -#define ZIG_DECL AUTO_EXTERN_C_ZIG +#define RUST_DECL AUTO_EXTERN_C_RUST #define CPP_DECL AUTO_EXTERN_C #define CPP_SIZE AUTO_EXTERN_C @@ -46,37 +46,37 @@ class DOMURL; CPP_DECL JSC::EncodedJSValue JSC__JSObject__create(JSC::JSGlobalObject* arg0, size_t arg1, void* arg2, void(* ArgFn3)(void* arg0, JSC::JSObject* arg1, JSC::JSGlobalObject* arg2)); CPP_DECL size_t JSC__JSObject__getArrayLength(JSC::JSObject* arg0); -CPP_DECL JSC::EncodedJSValue JSC__JSObject__getDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const ZigString* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSObject__getDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const RustString* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSObject__getIndex(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2); -CPP_DECL void JSC__JSObject__putRecord(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); -CPP_DECL JSC::EncodedJSValue ZigString__external(const ZigString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)); -CPP_DECL JSC::EncodedJSValue ZigString__to16BitValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC::JSGlobalObject* arg2); -CPP_DECL JSC::EncodedJSValue ZigString__toExternalValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC::JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)); -CPP_DECL JSC::EncodedJSValue ZigString__toRangeErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toSyntaxErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toTypeErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL JSC::EncodedJSValue ZigString__toValueGC(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__JSObject__putRecord(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, RustString* arg2, RustString* arg3, size_t arg4); +CPP_DECL JSC::EncodedJSValue RustString__external(const RustString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)); +CPP_DECL JSC::EncodedJSValue RustString__to16BitValue(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toAtomicValue(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toErrorInstance(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue RustString__toExternalValue(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toExternalValueWithCallback(const RustString* arg0, JSC::JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)); +CPP_DECL JSC::EncodedJSValue RustString__toRangeErrorInstance(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toSyntaxErrorInstance(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toTypeErrorInstance(const RustString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue RustString__toValueGC(const RustString* arg0, JSC::JSGlobalObject* arg1); CPP_DECL WebCore::DOMURL* WebCore__DOMURL__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); CPP_DECL BunString WebCore__DOMURL__fileSystemPath(WebCore::DOMURL* arg0, int* errorCode); -CPP_DECL void WebCore__DOMURL__href_(WebCore::DOMURL* arg0, ZigString* arg1); -CPP_DECL void WebCore__DOMURL__pathname_(WebCore::DOMURL* arg0, ZigString* arg1); +CPP_DECL void WebCore__DOMURL__href_(WebCore::DOMURL* arg0, RustString* arg1); +CPP_DECL void WebCore__DOMURL__pathname_(WebCore::DOMURL* arg0, RustString* arg1); #pragma mark - WebCore::DOMFormData -CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, ZigString* arg1, ZigString* arg2); -CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, void* arg3, ZigString* arg4); +CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, RustString* arg1, RustString* arg2); +CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, RustString* arg2, void* arg3, RustString* arg4); CPP_DECL size_t WebCore__DOMFormData__count(WebCore::DOMFormData* arg0); CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0); -CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1); +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, RustString* arg1); CPP_DECL WebCore::DOMFormData* _fromJS(JSC::EncodedJSValue JSValue0); #pragma mark - WebCore::FetchHeaders -CPP_DECL void WebCore__FetchHeaders__append(WebCore::FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2, JSC::JSGlobalObject* arg3); +CPP_DECL void WebCore__FetchHeaders__append(WebCore::FetchHeaders* arg0, const RustString* arg1, const RustString* arg2, JSC::JSGlobalObject* arg3); CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); @@ -87,15 +87,15 @@ CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGloba CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void* arg0); CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1); CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromH3(void* arg1); -CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t arg4); +CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const RustString* arg3, uint32_t arg4); CPP_DECL void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0); -CPP_DECL void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* arg0, unsigned char arg1, ZigString* arg2); +CPP_DECL void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* arg0, unsigned char arg1, RustString* arg2); CPP_DECL bool WebCore__FetchHeaders__fastHas_(WebCore::FetchHeaders* arg0, unsigned char arg1); CPP_DECL void WebCore__FetchHeaders__fastRemove_(WebCore::FetchHeaders* arg0, unsigned char arg1); -CPP_DECL void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* arg0, const ZigString* arg1, ZigString* arg2, JSC::JSGlobalObject* arg3); -CPP_DECL bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* arg0, const RustString* arg1, RustString* arg2, JSC::JSGlobalObject* arg3); +CPP_DECL bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* arg0, const RustString* arg1, JSC::JSGlobalObject* arg2); CPP_DECL bool WebCore__FetchHeaders__isEmpty(WebCore::FetchHeaders* arg0); -CPP_DECL void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* arg0, const RustString* arg1, JSC::JSGlobalObject* arg2); CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); CPP_DECL void WebCore__FetchHeaders__toUWSResponse(WebCore::FetchHeaders* arg0, UWSResponseKind kind, void* arg2); CPP_DECL JSC::EncodedJSValue SystemError__toErrorInstance(const SystemError* arg0, JSC::JSGlobalObject* arg1); @@ -113,7 +113,7 @@ CPP_DECL bool JSC__JSString__is8Bit(const JSC::JSString* arg0); CPP_DECL void JSC__JSString__iterator(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, void* arg2); CPP_DECL size_t JSC__JSString__length(const JSC::JSString* arg0); CPP_DECL JSC::JSObject* JSC__JSString__toObject(JSC::JSString* arg0, JSC::JSGlobalObject* arg1); -CPP_DECL void JSC__JSString__toZigString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL void JSC__JSString__toRustString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, RustString* arg2); #pragma mark - JSC::JSModuleLoader @@ -177,13 +177,13 @@ CPP_DECL JSC::EncodedJSValue Bun__REPL__formatValue(JSC::JSGlobalObject* globalO #pragma mark - JSC::JSGlobalObject CPP_DECL VirtualMachine* JSC__JSGlobalObject__bunVM(JSC::JSGlobalObject* arg0); -CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObject* arg0, const JSC::JSValue* arg1, size_t arg2, const ZigString* arg3); -CPP_DECL void JSC__JSGlobalObject__createSyntheticModule_(JSC::JSGlobalObject* arg0, ZigString* arg1, size_t arg2, JSC::EncodedJSValue* arg3, size_t arg4); -CPP_DECL void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* arg0, ZigString* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObject* arg0, const JSC::JSValue* arg1, size_t arg2, const RustString* arg3); +CPP_DECL void JSC__JSGlobalObject__createSyntheticModule_(JSC::JSGlobalObject* arg0, RustString* arg1, size_t arg2, JSC::EncodedJSValue* arg3, size_t arg4); +CPP_DECL void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* arg0, RustString* arg1); CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC::JSGlobalObject* arg0); -CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* arg0, const ZigString* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* arg0, const RustString* arg1); CPP_DECL void JSC__JSGlobalObject__handleRejectedPromises(JSC::JSGlobalObject* arg0); -CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* arg0, const ZigString* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* arg0, const RustString* arg1, JSC::EncodedJSValue JSValue2); CPP_DECL void JSC__JSGlobalObject__addGc(JSC::JSGlobalObject* globalObject); CPP_DECL void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3); CPP_DECL void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0); @@ -211,11 +211,11 @@ CPP_DECL int64_t JSC__JSValue__coerceToInt64(JSC::EncodedJSValue JSValue0, JSC:: CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyArray(JSC::JSGlobalObject* arg0, size_t arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyObject(JSC::JSGlobalObject* arg0, size_t arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createInternalPromise(JSC::JSGlobalObject* arg0); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* arg0, const ZigString* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* arg0, const RustString* arg1, const RustString* arg2, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRangeError(const RustString* arg0, const RustString* arg1, JSC::JSGlobalObject* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRopeString(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__createStringArray(JSC::JSGlobalObject* arg0, const ZigString* arg1, size_t arg2, bool arg3); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__createTypeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createStringArray(JSC::JSGlobalObject* arg0, const RustString* arg1, size_t arg2, bool arg3); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createTypeError(const RustString* arg0, const RustString* arg1, JSC::JSGlobalObject* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObject* arg0, size_t arg1); CPP_DECL bool JSC__JSValue__deepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); CPP_DECL bool JSC__JSValue__eqlCell(JSC::EncodedJSValue JSValue0, JSC::JSCell* arg1); @@ -223,22 +223,22 @@ CPP_DECL bool JSC__JSValue__eqlValue(JSC::EncodedJSValue JSValue0, JSC::EncodedJ CPP_DECL JSC::EncodedJSValue JSC__JSValue__fastGet(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, unsigned char arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__fastGetDirect_(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, unsigned char arg2); CPP_DECL void JSC__JSValue__forEach(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::VM* arg0, JSC::JSGlobalObject* arg1, void* arg2, JSC::EncodedJSValue JSValue3)); -CPP_DECL void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); -CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* arg0, ZigString* arg1, ZigString* arg2, size_t arg3, bool arg4); +CPP_DECL void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, RustString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); +CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, RustString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* arg0, RustString* arg1, RustString* arg2, size_t arg3, bool arg4); CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromInt64NoTruncate(JSC::JSGlobalObject* arg0, int64_t arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromUInt64NoTruncate(JSC::JSGlobalObject* arg0, uint64_t arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromTimevalNoTruncate(JSC::JSGlobalObject* arg0, int64_t nsec, int64_t sec); CPP_DECL JSC::EncodedJSValue JSC__JSValue__bigIntSum(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); -CPP_DECL void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__getErrorsProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); CPP_DECL double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); -CPP_DECL void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__getPrototype(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); -CPP_DECL void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2); CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC::EncodedJSValue JSValue0); -CPP_DECL bool JSC__JSValue__hasOwnProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString arg2); +CPP_DECL bool JSC__JSValue__hasOwnProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString arg2); CPP_DECL bool JSC__JSValue__isAggregateError(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); CPP_DECL bool JSC__JSValue__isAnyError(JSC::EncodedJSValue JSValue0); CPP_DECL bool JSC__JSValue__isAnyInt(JSC::EncodedJSValue JSValue0); @@ -278,13 +278,13 @@ CPP_DECL JSC::EncodedJSValue JSC__JSValue__keys(JSC::JSGlobalObject* arg0, JSC:: CPP_DECL JSC::EncodedJSValue JSC__JSValue__values(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue arg1); CPP_DECL JSC::EncodedJSValue JSC__JSValue__parseJSON(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); CPP_DECL void JSC__JSValue__push(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); -CPP_DECL void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3); +CPP_DECL void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const RustString* arg2, JSC::EncodedJSValue JSValue3); CPP_DECL void JSC__JSValue__putIndex(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, JSC::EncodedJSValue JSValue3); -CPP_DECL void JSC__JSValue__putRecord(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); +CPP_DECL void JSC__JSValue__putRecord(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2, RustString* arg3, size_t arg4); CPP_DECL bool JSC__JSValue__strictDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); CPP_DECL bool JSC__JSValue__stringIncludes(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* arg0, ZigString* arg1); -CPP_DECL bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* arg0, RustString* arg1); +CPP_DECL bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustString* arg2); CPP_DECL bool JSC__JSValue__toBoolean(JSC::EncodedJSValue JSValue0); CPP_DECL JSC::EncodedJSValue JSC__JSValue__toError_(JSC::EncodedJSValue JSValue0); CPP_DECL int32_t JSC__JSValue__toInt32(JSC::EncodedJSValue JSValue0); @@ -294,8 +294,8 @@ CPP_DECL JSC::JSObject* JSC__JSValue__toObject(JSC::EncodedJSValue JSValue0, JSC CPP_DECL JSC::JSString* JSC__JSValue__toString(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); CPP_DECL JSC::JSString* JSC__JSValue__toStringOrNull(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); CPP_DECL uint64_t JSC__JSValue__toUInt64NoTruncate(JSC::EncodedJSValue JSValue0); -CPP_DECL void JSC__JSValue__toZigException(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigException* arg2); -CPP_DECL void JSC__JSValue__toZigString(JSC::EncodedJSValue JSValue0, ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL void JSC__JSValue__toRustException(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, RustException* arg2); +CPP_DECL void JSC__JSValue__toRustString(JSC::EncodedJSValue JSValue0, RustString* arg1, JSC::JSGlobalObject* arg2); #pragma mark - JSC::VM @@ -430,19 +430,19 @@ extern "C" JSC::EncodedJSValue SYSV_ABI Reader__intptr__slowpath(JSC::JSGlobalOb #endif -#pragma mark - Zig::GlobalObject +#pragma mark - Rust::GlobalObject -CPP_DECL JSC::JSGlobalObject* Zig__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, bool arg3, void* arg4); -CPP_DECL void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject* arg0); -CPP_DECL bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject* arg0, void* arg1); +CPP_DECL JSC::JSGlobalObject* Rust__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, bool arg3, void* arg4); +CPP_DECL void* Rust__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject* arg0); +CPP_DECL bool Rust__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject* arg0, void* arg1); #ifdef __cplusplus -ZIG_DECL void Zig__GlobalObject__fetch(ErrorableResolvedSource* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3); -ZIG_DECL void Zig__GlobalObject__onCrash(); -ZIG_DECL JSC::EncodedJSValue Zig__GlobalObject__promiseRejectionTracker(JSC::JSGlobalObject* arg0, JSC::JSPromise* arg1, uint32_t JSPromiseRejectionOperation2); -ZIG_DECL JSC::EncodedJSValue Zig__GlobalObject__reportUncaughtException(JSC::JSGlobalObject* arg0, JSC::Exception* arg1); -ZIG_DECL void Zig__GlobalObject__resolve(ErrorableString* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3, BunString* arg4); +RUST_DECL void Rust__GlobalObject__fetch(ErrorableResolvedSource* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3); +RUST_DECL void Rust__GlobalObject__onCrash(); +RUST_DECL JSC::EncodedJSValue Rust__GlobalObject__promiseRejectionTracker(JSC::JSGlobalObject* arg0, JSC::JSPromise* arg1, uint32_t JSPromiseRejectionOperation2); +RUST_DECL JSC::EncodedJSValue Rust__GlobalObject__reportUncaughtException(JSC::JSGlobalObject* arg0, JSC::Exception* arg1); +RUST_DECL void Rust__GlobalObject__resolve(ErrorableString* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3, BunString* arg4); #endif @@ -470,14 +470,14 @@ CPP_DECL void ArrayBufferSink__onReady(JSC::EncodedJSValue JSValue0, JSC::Encode #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue ArrayBufferSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue ArrayBufferSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__construct); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI ArrayBufferSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void ArrayBufferSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI ArrayBufferSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void ArrayBufferSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__flush); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__start); -ZIG_DECL void ArrayBufferSink__updateRef(void* arg0, bool arg1); +RUST_DECL void ArrayBufferSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__write); #endif @@ -489,14 +489,14 @@ CPP_DECL void HTTPSResponseSink__onReady(JSC::EncodedJSValue JSValue0, JSC::Enco #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue HTTPSResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue HTTPSResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__construct); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI HTTPSResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void HTTPSResponseSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI HTTPSResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void HTTPSResponseSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__flush); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__start); -ZIG_DECL void HTTPSResponseSink__updateRef(void* arg0, bool arg1); +RUST_DECL void HTTPSResponseSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__write); #endif @@ -508,14 +508,14 @@ CPP_DECL void HTTPResponseSink__onReady(JSC::EncodedJSValue JSValue0, JSC::Encod #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue HTTPResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue HTTPResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__construct); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI HTTPResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void HTTPResponseSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI HTTPResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void HTTPResponseSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__flush); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__start); -ZIG_DECL void HTTPResponseSink__updateRef(void* arg0, bool arg1); +RUST_DECL void HTTPResponseSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__write); #endif @@ -527,14 +527,14 @@ CPP_DECL void FileSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValu #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__construct); BUN_DECLARE_HOST_FUNCTION(FileSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void FileSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void FileSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(FileSink__flush); BUN_DECLARE_HOST_FUNCTION(FileSink__start); -ZIG_DECL void FileSink__updateRef(void* arg0, bool arg1); +RUST_DECL void FileSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__write); #endif @@ -547,14 +547,14 @@ CPP_DECL void FileSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValu #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__construct); BUN_DECLARE_HOST_FUNCTION(FileSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void FileSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void FileSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(FileSink__flush); BUN_DECLARE_HOST_FUNCTION(FileSink__start); -ZIG_DECL void FileSink__updateRef(void* arg0, bool arg1); +RUST_DECL void FileSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__write); #endif @@ -567,14 +567,14 @@ CPP_DECL void NetworkSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSV #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue NetworkSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue NetworkSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(NetworkSink__construct); BUN_DECLARE_HOST_FUNCTION(NetworkSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI NetworkSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void NetworkSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI NetworkSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void NetworkSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(NetworkSink__flush); BUN_DECLARE_HOST_FUNCTION(NetworkSink__start); -ZIG_DECL void NetworkSink__updateRef(void* arg0, bool arg1); +RUST_DECL void NetworkSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(NetworkSink__write); #endif @@ -587,21 +587,21 @@ CPP_DECL void H3ResponseSink__onReady(JSC::EncodedJSValue JSValue0, JSC::Encoded #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue H3ResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); +RUST_DECL JSC::EncodedJSValue H3ResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(H3ResponseSink__construct); BUN_DECLARE_HOST_FUNCTION(H3ResponseSink__end); -ZIG_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI H3ResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); -ZIG_DECL void H3ResponseSink__finalize(void* arg0); +RUST_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI H3ResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); +RUST_DECL void H3ResponseSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(H3ResponseSink__flush); BUN_DECLARE_HOST_FUNCTION(H3ResponseSink__start); -ZIG_DECL void H3ResponseSink__updateRef(void* arg0, bool arg1); +RUST_DECL void H3ResponseSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(H3ResponseSink__write); #endif #ifdef __cplusplus -ZIG_DECL void Bun__WebSocketHTTPClient__cancel(WebSocketHTTPClient* arg0); -ZIG_DECL WebSocketHTTPClient* Bun__WebSocketHTTPClient__connect( +RUST_DECL void Bun__WebSocketHTTPClient__cancel(WebSocketHTTPClient* arg0); +RUST_DECL WebSocketHTTPClient* Bun__WebSocketHTTPClient__connect( JSC::JSGlobalObject* globalObject, CppWebSocket* websocket, const BunString* host, uint16_t port, const BunString* path, const BunString* protocols, BunString* headerNames, BunString* headerValues, size_t headerCount, @@ -612,13 +612,13 @@ ZIG_DECL WebSocketHTTPClient* Bun__WebSocketHTTPClient__connect( const BunString* targetAuthorization, const BunString* unixSocketPath, bool offerPerMessageDeflate); -ZIG_DECL size_t Bun__WebSocketHTTPClient__memoryCost(WebSocketHTTPClient* arg0); +RUST_DECL size_t Bun__WebSocketHTTPClient__memoryCost(WebSocketHTTPClient* arg0); #endif #ifdef __cplusplus -ZIG_DECL void Bun__WebSocketHTTPSClient__cancel(WebSocketHTTPSClient* arg0); -ZIG_DECL WebSocketHTTPSClient* Bun__WebSocketHTTPSClient__connect( +RUST_DECL void Bun__WebSocketHTTPSClient__cancel(WebSocketHTTPSClient* arg0); +RUST_DECL WebSocketHTTPSClient* Bun__WebSocketHTTPSClient__connect( JSC::JSGlobalObject* globalObject, CppWebSocket* websocket, const BunString* host, uint16_t port, const BunString* path, const BunString* protocols, BunString* headerNames, BunString* headerValues, size_t headerCount, @@ -629,52 +629,52 @@ ZIG_DECL WebSocketHTTPSClient* Bun__WebSocketHTTPSClient__connect( const BunString* targetAuthorization, const BunString* unixSocketPath, bool offerPerMessageDeflate); -ZIG_DECL size_t Bun__WebSocketHTTPSClient__memoryCost(WebSocketHTTPSClient* arg0); +RUST_DECL size_t Bun__WebSocketHTTPSClient__memoryCost(WebSocketHTTPSClient* arg0); // Parse TLS options from JavaScript object using SSLConfig.fromJS -ZIG_DECL void* Bun__WebSocket__parseSSLConfig(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue tlsValue); +RUST_DECL void* Bun__WebSocket__parseSSLConfig(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue tlsValue); // Free an SSLConfig previously returned by Bun__WebSocket__parseSSLConfig -ZIG_DECL void Bun__WebSocket__freeSSLConfig(void* sslConfig); +RUST_DECL void Bun__WebSocket__freeSSLConfig(void* sslConfig); #endif #ifdef __cplusplus -ZIG_DECL void Bun__WebSocketClient__cancel(WebSocketClient* arg0); -ZIG_DECL void Bun__WebSocketClient__close(WebSocketClient* arg0, uint16_t arg1, const ZigString* arg2); -ZIG_DECL void Bun__WebSocketClient__finalize(WebSocketClient* arg0); -ZIG_DECL void* Bun__WebSocketClient__init(CppWebSocket* arg0, void* arg1, JSC::JSGlobalObject* arg2, unsigned char* arg3, size_t arg4, const PerMessageDeflateParams* arg5, void* customSSLCtx); -ZIG_DECL void Bun__WebSocketClient__writeBinaryData(WebSocketClient* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); -ZIG_DECL void Bun__WebSocketClient__writeString(WebSocketClient* arg0, const ZigString* arg1, unsigned char arg2); -ZIG_DECL size_t Bun__WebSocketClient__memoryCost(WebSocketClient* arg0); +RUST_DECL void Bun__WebSocketClient__cancel(WebSocketClient* arg0); +RUST_DECL void Bun__WebSocketClient__close(WebSocketClient* arg0, uint16_t arg1, const RustString* arg2); +RUST_DECL void Bun__WebSocketClient__finalize(WebSocketClient* arg0); +RUST_DECL void* Bun__WebSocketClient__init(CppWebSocket* arg0, void* arg1, JSC::JSGlobalObject* arg2, unsigned char* arg3, size_t arg4, const PerMessageDeflateParams* arg5, void* customSSLCtx); +RUST_DECL void Bun__WebSocketClient__writeBinaryData(WebSocketClient* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); +RUST_DECL void Bun__WebSocketClient__writeString(WebSocketClient* arg0, const RustString* arg1, unsigned char arg2); +RUST_DECL size_t Bun__WebSocketClient__memoryCost(WebSocketClient* arg0); #endif #ifdef __cplusplus -ZIG_DECL void Bun__WebSocketClientTLS__cancel(WebSocketClientTLS* arg0); -ZIG_DECL void Bun__WebSocketClientTLS__close(WebSocketClientTLS* arg0, uint16_t arg1, const ZigString* arg2); -ZIG_DECL void Bun__WebSocketClientTLS__finalize(WebSocketClientTLS* arg0); -ZIG_DECL void* Bun__WebSocketClientTLS__init(CppWebSocket* arg0, void* arg1, JSC::JSGlobalObject* arg2, unsigned char* arg3, size_t arg4, const PerMessageDeflateParams* arg5, void* customSSLCtx); -ZIG_DECL void Bun__WebSocketClientTLS__writeBinaryData(WebSocketClientTLS* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); -ZIG_DECL void Bun__WebSocketClientTLS__writeString(WebSocketClientTLS* arg0, const ZigString* arg1, unsigned char arg2); -ZIG_DECL size_t Bun__WebSocketClientTLS__memoryCost(WebSocketClientTLS* arg0); +RUST_DECL void Bun__WebSocketClientTLS__cancel(WebSocketClientTLS* arg0); +RUST_DECL void Bun__WebSocketClientTLS__close(WebSocketClientTLS* arg0, uint16_t arg1, const RustString* arg2); +RUST_DECL void Bun__WebSocketClientTLS__finalize(WebSocketClientTLS* arg0); +RUST_DECL void* Bun__WebSocketClientTLS__init(CppWebSocket* arg0, void* arg1, JSC::JSGlobalObject* arg2, unsigned char* arg3, size_t arg4, const PerMessageDeflateParams* arg5, void* customSSLCtx); +RUST_DECL void Bun__WebSocketClientTLS__writeBinaryData(WebSocketClientTLS* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); +RUST_DECL void Bun__WebSocketClientTLS__writeString(WebSocketClientTLS* arg0, const RustString* arg1, unsigned char arg2); +RUST_DECL size_t Bun__WebSocketClientTLS__memoryCost(WebSocketClientTLS* arg0); #endif #ifdef __cplusplus -ZIG_DECL /*[[noreturn]]*/ void Bun__Process__exit(JSC::JSGlobalObject* arg0, uint8_t arg1); // TODO(@190n) figure out why with a real [[noreturn]] annotation this trips ASan before calling the function -ZIG_DECL JSC::EncodedJSValue Bun__Process__createArgv(JSC::JSGlobalObject* arg0); -ZIG_DECL JSC::EncodedJSValue Bun__Process__createArgv0(JSC::JSGlobalObject* arg0); -ZIG_DECL JSC::EncodedJSValue Bun__Process__getCwd(JSC::JSGlobalObject* arg0); -ZIG_DECL JSC::EncodedJSValue Bun__Process__createExecArgv(JSC::JSGlobalObject* arg0); -ZIG_DECL JSC::EncodedJSValue Bun__Process__getExecPath(JSC::JSGlobalObject* arg0); -ZIG_DECL void Bun__Process__getTitle(JSC::JSGlobalObject* arg0, BunString* arg1); -ZIG_DECL void Bun__Process__setTitle(JSC::JSGlobalObject* arg0, BunString* arg1); -ZIG_DECL JSC::EncodedJSValue Bun__Process__setCwd(JSC::JSGlobalObject* arg0, ZigString* arg1); -ZIG_DECL JSC::EncodedJSValue Bun__Process__getEval(JSC::JSGlobalObject* arg0); +RUST_DECL /*[[noreturn]]*/ void Bun__Process__exit(JSC::JSGlobalObject* arg0, uint8_t arg1); // TODO(@190n) figure out why with a real [[noreturn]] annotation this trips ASan before calling the function +RUST_DECL JSC::EncodedJSValue Bun__Process__createArgv(JSC::JSGlobalObject* arg0); +RUST_DECL JSC::EncodedJSValue Bun__Process__createArgv0(JSC::JSGlobalObject* arg0); +RUST_DECL JSC::EncodedJSValue Bun__Process__getCwd(JSC::JSGlobalObject* arg0); +RUST_DECL JSC::EncodedJSValue Bun__Process__createExecArgv(JSC::JSGlobalObject* arg0); +RUST_DECL JSC::EncodedJSValue Bun__Process__getExecPath(JSC::JSGlobalObject* arg0); +RUST_DECL void Bun__Process__getTitle(JSC::JSGlobalObject* arg0, BunString* arg1); +RUST_DECL void Bun__Process__setTitle(JSC::JSGlobalObject* arg0, BunString* arg1); +RUST_DECL JSC::EncodedJSValue Bun__Process__setCwd(JSC::JSGlobalObject* arg0, RustString* arg1); +RUST_DECL JSC::EncodedJSValue Bun__Process__getEval(JSC::JSGlobalObject* arg0); #endif -CPP_DECL ZigException ZigException__fromException(JSC::Exception* arg0); +CPP_DECL RustException RustException__fromException(JSC::Exception* arg0); #pragma mark - Bun::ConsoleObject @@ -702,14 +702,14 @@ extern "C" SYSV_ABI void Bun__ConsoleObject__timeStamp(void* arg0, JSC::JSGlobal #ifdef __cplusplus -ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearImmediate(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearInterval(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearTimeout(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); -ZIG_DECL int32_t Bun__Timer__getNextID(); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__setInterval(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments, JSC::EncodedJSValue countdown); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__setTimeout(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments, JSC::EncodedJSValue countdown); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__sleep(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue promise, JSC::EncodedJSValue countdown); -ZIG_DECL JSC::EncodedJSValue Bun__Timer__setImmediate(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments); +RUST_DECL JSC::EncodedJSValue Bun__Timer__clearImmediate(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +RUST_DECL JSC::EncodedJSValue Bun__Timer__clearInterval(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +RUST_DECL JSC::EncodedJSValue Bun__Timer__clearTimeout(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +RUST_DECL int32_t Bun__Timer__getNextID(); +RUST_DECL JSC::EncodedJSValue Bun__Timer__setInterval(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments, JSC::EncodedJSValue countdown); +RUST_DECL JSC::EncodedJSValue Bun__Timer__setTimeout(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments, JSC::EncodedJSValue countdown); +RUST_DECL JSC::EncodedJSValue Bun__Timer__sleep(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue promise, JSC::EncodedJSValue countdown); +RUST_DECL JSC::EncodedJSValue Bun__Timer__setImmediate(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments); #endif diff --git a/src/jsc/bindings/helpers.h b/src/jsc/bindings/helpers.h index cb9bc987755..b5337347ae9 100644 --- a/src/jsc/bindings/helpers.h +++ b/src/jsc/bindings/helpers.h @@ -13,7 +13,7 @@ #include #include -namespace Zig { +namespace Rust { class GlobalObject; } @@ -25,7 +25,7 @@ class GlobalObject; extern "C" size_t Bun__stringSyntheticAllocationLimit; extern "C" const char* Bun__errnoName(int); -namespace Zig { +namespace Rust { // 8 bit byte // we tag the final two bits @@ -69,11 +69,11 @@ static void free_global_string(void* str, void* ptr, unsigned len) if (ptr == nullptr) return; - ZigString__freeGlobal(reinterpret_cast(ptr), len); + RustString__freeGlobal(reinterpret_cast(ptr), len); } // Switching to AtomString doesn't yield a perf benefit because we're recreating it each time. -static const WTF::String toString(ZigString str) +static const WTF::String toString(RustString str) { if (str.len == 0 || str.ptr == nullptr) { return WTF::String(); @@ -118,7 +118,7 @@ static const WTF::String toString(ZigString str) { reinterpret_cast(untag(str.ptr)), str.len })); } -static WTF::AtomString toAtomString(ZigString str) +static WTF::AtomString toAtomString(RustString str) { if (!isTaggedUTF16Ptr(str.ptr)) { @@ -128,7 +128,7 @@ static WTF::AtomString toAtomString(ZigString str) } } -static const WTF::String toString(ZigString str, StringPointer ptr) +static const WTF::String toString(RustString str, StringPointer ptr) { if (str.len == 0 || str.ptr == nullptr || ptr.len == 0) { return WTF::String(); @@ -156,7 +156,7 @@ static const WTF::String toString(ZigString str, StringPointer ptr) { &reinterpret_cast(untag(str.ptr))[ptr.off], ptr.len })); } -static const WTF::String toStringCopy(ZigString str, StringPointer ptr) +static const WTF::String toStringCopy(RustString str, StringPointer ptr) { if (str.len == 0 || str.ptr == nullptr || ptr.len == 0) { return WTF::String(); @@ -184,7 +184,7 @@ static const WTF::String toStringCopy(ZigString str, StringPointer ptr) std::span { &reinterpret_cast(untag(str.ptr))[ptr.off], ptr.len })); } -static const WTF::String toStringCopy(ZigString str) +static const WTF::String toStringCopy(RustString str) { if (str.len == 0 || str.ptr == nullptr) { return WTF::String(); @@ -219,7 +219,7 @@ static const WTF::String toStringCopy(ZigString str) } } -static void appendToBuilder(ZigString str, WTF::StringBuilder& builder) +static void appendToBuilder(RustString str, WTF::StringBuilder& builder) { if (str.len == 0 || str.ptr == nullptr) { return; @@ -245,22 +245,22 @@ static void appendToBuilder(ZigString str, WTF::StringBuilder& builder) builder.append({ untag(str.ptr), str.len }); } -static WTF::String toStringNotConst(ZigString str) { return toString(str); } +static WTF::String toStringNotConst(RustString str) { return toString(str); } -static const JSC::JSString* toJSString(ZigString str, JSC::JSGlobalObject* global) +static const JSC::JSString* toJSString(RustString str, JSC::JSGlobalObject* global) { return JSC::jsOwnedString(global->vm(), toString(str)); } -static JSC::JSString* toJSStringGC(ZigString str, JSC::JSGlobalObject* global) +static JSC::JSString* toJSStringGC(RustString str, JSC::JSGlobalObject* global) { return JSC::jsString(global->vm(), toStringCopy(str)); } -static const ZigString ZigStringEmpty = ZigString { (unsigned char*)"", 0 }; +static const RustString RustStringEmpty = RustString { (unsigned char*)"", 0 }; static const unsigned char __dot_char = '.'; -static const ZigString ZigStringCwd = ZigString { &__dot_char, 1 }; -static const BunString BunStringCwd = BunString { BunStringTag::StaticZigString, ZigStringCwd }; +static const RustString RustStringCwd = RustString { &__dot_char, 1 }; +static const BunString BunStringCwd = BunString { BunStringTag::StaticRustString, RustStringCwd }; static const BunString BunStringEmpty = BunString { BunStringTag::Empty, nullptr }; static const unsigned char* taggedUTF16Ptr(const char16_t* ptr) @@ -268,88 +268,88 @@ static const unsigned char* taggedUTF16Ptr(const char16_t* ptr) return reinterpret_cast(reinterpret_cast(ptr) | (static_cast(1) << 63)); } -static ZigString toZigString(WTF::String* str) +static RustString toRustString(WTF::String* str) { return str->isEmpty() - ? ZigStringEmpty - : ZigString { str->is8Bit() ? str->span8().data() : taggedUTF16Ptr(str->span16().data()), + ? RustStringEmpty + : RustString { str->is8Bit() ? str->span8().data() : taggedUTF16Ptr(str->span16().data()), str->length() }; } -static ZigString toZigString(WTF::StringImpl& str) +static RustString toRustString(WTF::StringImpl& str) { return str.isEmpty() - ? ZigStringEmpty - : ZigString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), + ? RustStringEmpty + : RustString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), str.length() }; } -// Overload for `StringImpl*` so callers like `toZigString(string.impl())` resolve here +// Overload for `StringImpl*` so callers like `toRustString(string.impl())` resolve here // instead of implicitly constructing a temporary `WTF::StringView` (which, in debug builds // with CHECK_STRINGVIEW_LIFETIME, takes a lock and heap-allocates an UnderlyingString entry). -static ZigString toZigString(const WTF::StringImpl* str) +static RustString toRustString(const WTF::StringImpl* str) { return (!str || str->isEmpty()) - ? ZigStringEmpty - : ZigString { str->is8Bit() ? str->span8().data() : taggedUTF16Ptr(str->span16().data()), + ? RustStringEmpty + : RustString { str->is8Bit() ? str->span8().data() : taggedUTF16Ptr(str->span16().data()), str->length() }; } -static ZigString toZigString(WTF::StringView& str) +static RustString toRustString(WTF::StringView& str) { return str.isEmpty() - ? ZigStringEmpty - : ZigString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), + ? RustStringEmpty + : RustString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), str.length() }; } -static ZigString toZigString(const WTF::StringView& str) +static RustString toRustString(const WTF::StringView& str) { return str.isEmpty() - ? ZigStringEmpty - : ZigString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), + ? RustStringEmpty + : RustString { str.is8Bit() ? str.span8().data() : taggedUTF16Ptr(str.span16().data()), str.length() }; } -static ZigString toZigString(JSC::JSString& str, JSC::JSGlobalObject* global) +static RustString toRustString(JSC::JSString& str, JSC::JSGlobalObject* global) { if (str.isSubstring()) { - return toZigString(str.view(global)); + return toRustString(str.view(global)); } - return toZigString(str.value(global)); + return toRustString(str.value(global)); } -static ZigString toZigString(JSC::JSString* str, JSC::JSGlobalObject* global) +static RustString toRustString(JSC::JSString* str, JSC::JSGlobalObject* global) { if (str->isSubstring()) { - return toZigString(str->view(global)); + return toRustString(str->view(global)); } - return toZigString(str->value(global)); + return toRustString(str->value(global)); } -static ZigString toZigString(JSC::Identifier& str, JSC::JSGlobalObject* global) +static RustString toRustString(JSC::Identifier& str, JSC::JSGlobalObject* global) { - return toZigString(str.string()); + return toRustString(str.string()); } -static ZigString toZigString(JSC::Identifier* str, JSC::JSGlobalObject* global) +static RustString toRustString(JSC::Identifier* str, JSC::JSGlobalObject* global) { - return toZigString(str->string()); + return toRustString(str->string()); } -static WTF::StringView toStringView(ZigString str) +static WTF::StringView toStringView(RustString str) { return WTF::StringView(std::span { untag(str.ptr), str.len }); } -static void throwException(JSC::ThrowScope& scope, ZigErrorType err, JSC::JSGlobalObject* global) +static void throwException(JSC::ThrowScope& scope, RustErrorType err, JSC::JSGlobalObject* global) { scope.throwException(global, JSC::Exception::create(global->vm(), JSC::JSValue::decode(err.value))); } -static ZigString toZigString(JSC::JSValue val, JSC::JSGlobalObject* global) +static RustString toRustString(JSC::JSValue val, JSC::JSGlobalObject* global) { auto scope = DECLARE_THROW_SCOPE(global->vm()); auto* str = val.toString(global); @@ -357,20 +357,20 @@ static ZigString toZigString(JSC::JSValue val, JSC::JSGlobalObject* global) if (scope.exception()) [[unlikely]] { (void)scope.tryClearException(); scope.release(); - return ZigStringEmpty; + return RustStringEmpty; } auto view = str->view(global); if (scope.exception()) [[unlikely]] { (void)scope.tryClearException(); scope.release(); - return ZigStringEmpty; + return RustStringEmpty; } - return toZigString(view); + return toRustString(view); } -static const WTF::String toStringStatic(ZigString str) +static const WTF::String toStringStatic(RustString str) { if (str.len == 0 || str.ptr == nullptr) { return WTF::String(); @@ -391,7 +391,7 @@ static const WTF::String toStringStatic(ZigString str) return WTF::String(AtomStringImpl::add(std::span { untagged, str.len })); } -static JSC::JSValue getErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +static JSC::JSValue getErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { WTF::String message = toString(*str); if (message.isNull() && str->len > 0) [[unlikely]] { @@ -405,7 +405,7 @@ static JSC::JSValue getErrorInstance(const ZigString* str, JSC::JSGlobalObject* return result; } -static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +static JSC::JSValue getTypeErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createTypeError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -413,7 +413,7 @@ static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC::JSGlobalObje return result; } -static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +static JSC::JSValue getSyntaxErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createSyntaxError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -421,7 +421,7 @@ static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC::JSGlobalOb return result; } -static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) +static JSC::JSValue getRangeErrorInstance(const RustString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createRangeError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -429,17 +429,17 @@ static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC::JSGlobalObj return result; } -static const JSC::Identifier toIdentifier(ZigString str, JSC::JSGlobalObject* global) +static const JSC::Identifier toIdentifier(RustString str, JSC::JSGlobalObject* global) { if (str.len == 0 || str.ptr == nullptr) { return global->vm().propertyNames->emptyIdentifier; } - WTF::String wtfstr = Zig::isTaggedExternalPtr(str.ptr) ? toString(str) : Zig::toStringCopy(str); + WTF::String wtfstr = Rust::isTaggedExternalPtr(str.ptr) ? toString(str) : Rust::toStringCopy(str); JSC::Identifier id = JSC::Identifier::fromString(global->vm(), wtfstr); return id; } -}; // namespace Zig +}; // namespace Rust JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral message, ASCIILiteral syscall, int err); JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral syscall, int err); diff --git a/src/jsc/bindings/image_coregraphics_shim.cpp b/src/jsc/bindings/image_coregraphics_shim.cpp index b92628805e2..ae1deb537c9 100644 --- a/src/jsc/bindings/image_coregraphics_shim.cpp +++ b/src/jsc/bindings/image_coregraphics_shim.cpp @@ -1,16 +1,16 @@ // CoreGraphics / ImageIO backend for Bun.Image — implemented entirely in C++. // -// Calling dlsym'd CG/ImageIO functions through Zig function pointers crashed +// Calling dlsym'd CG/ImageIO functions through Rust function pointers crashed // on x86_64 macOS (arm64 was fine). Rather than thunking call-by-call, this // file owns every framework call: clang generates the SysV/AAPCS64 prologues -// natively, and the Zig boundary is two extern-C entry points with only +// natively, and the Rust boundary is two extern-C entry points with only // scalar/pointer args. // // Decode renders to RGBA via vImage rather than CGBitmapContext+DrawImage: // CGBitmapContext refuses non-premultiplied alpha, so the old draw-then- // unpremultiply path lost ±1 LSB on RGB wherever α<255 — and worse, the // default source-over blend composited the image *over* whatever the caller's -// uninitialised buffer held (0xAA in Zig debug). vImageBuffer_InitWithCGImage +// uninitialised buffer held (0xAA in Rust debug). vImageBuffer_InitWithCGImage // converts to a caller-chosen pixel format directly — including straight // alpha — so PNG round-trip stays byte-exact and we drop the manual unpremul // loop. Encode likewise wraps the straight-alpha buffer in a CGImage via @@ -260,7 +260,7 @@ enum : int32_t { CG_OK = 0, // Decode `bytes[0..len)` into a caller-allocated RGBA8 buffer. // Two-phase: pass `out=nullptr` to get dimensions; then call again with a -// buffer of `w*h*4` to fill it. Avoids allocating in C++ so the Zig side owns +// buffer of `w*h*4` to fill it. Avoids allocating in C++ so the Rust side owns // the buffer in `bun.default_allocator` like every other decode path. int32_t bun_coregraphics_decode(const uint8_t* bytes, size_t len, uint64_t max_pixels, uint32_t* out_w, uint32_t* out_h, uint8_t* out) @@ -314,7 +314,7 @@ int32_t bun_coregraphics_decode(const uint8_t* bytes, size_t len, uint64_t max_p auto rc = s->vImageBuffer_InitWithCGImage(&buf, &fmt, nullptr, r.img, kBunVImageNoAllocate); // The contract is that kvImageNoAllocate honours buf.data exactly, but be // defensive: an OS that ignored the flag would set buf.data to its own - // malloc and leave `out` uninitialised, which on a Zig debug build is + // malloc and leave `out` uninitialised, which on a Rust debug build is // 0xAA — that's the garbage we shipped before the constant was fixed. if (rc != 0 || buf.data != out) return CG_DECODE_FAILED; return CG_OK; @@ -334,7 +334,7 @@ int32_t bun_coregraphics_encode(const uint8_t* rgba, uint32_t width, uint32_t he Pool pool(s); // Thread-local pending result so the size-probe and the copy-out share one // encode. Safe: each WorkPool thread runs at most one PipelineTask at a - // time, and the two calls are back-to-back in codecs.zig. + // time, and the two calls are back-to-back in codecs.rust. thread_local CFRef pending = nullptr; if (out && pending) { long n = s->CFDataGetLength(pending); @@ -425,7 +425,7 @@ int32_t bun_coregraphics_encode(const uint8_t* rgba, uint32_t width, uint32_t he // ── Geometry via vImage ──────────────────────────────────────────────────── // -// These take packed RGBA8 (rowBytes = w*4) on both ends so the Zig side can +// These take packed RGBA8 (rowBytes = w*4) on both ends so the Rust side can // keep allocating with `bun.default_allocator`. The ARGB8888 kernels are // channel-order agnostic for 4×u8, so RGBA works without a permute. They run // on Apple's AMX units on M-series — typically 2-4× the Highway path — and we @@ -555,7 +555,7 @@ int64_t bun_coregraphics_clipboard_change_count() } // extern "C" #else -// Non-Apple: stubs so the link succeeds; Zig only references these under +// Non-Apple: stubs so the link succeeds; Rust only references these under // Environment.isMac so they're dead code, but LTO needs the definitions. extern "C" int bun_coregraphics_decode(const void*, unsigned long, unsigned long long, void*, void*, void*) { return 1; } extern "C" int bun_coregraphics_encode(const void*, unsigned, unsigned, int, int, void*, void*) { return 1; } diff --git a/src/jsc/bindings/image_resize.cpp b/src/jsc/bindings/image_resize.cpp index 9f75f745efa..97560443b1f 100644 --- a/src/jsc/bindings/image_resize.cpp +++ b/src/jsc/bindings/image_resize.cpp @@ -245,7 +245,7 @@ static void FlipVImpl(const uint8_t* HWY_RESTRICT src, size_t w, size_t h, uint8 // Nearest-palette index for one RGBA point. Squared Euclidean over all four // channels; SIMD across palette entries (4 entries' R/G/B/A laid out as // contiguous u8, so we load 16 at a time and compute 4 distances per step on -// targets where Lanes(u32) ≥ 4). Used by quantize.zig's Floyd–Steinberg +// targets where Lanes(u32) ≥ 4). Used by quantize.rust's Floyd–Steinberg // mapper — the diffusion itself is serial, but this inner search is hot and // parallelisable. static uint32_t NearestPaletteImpl(const uint8_t* HWY_RESTRICT palette, uint32_t k, @@ -502,7 +502,7 @@ struct ScratchLayout { extern "C" { -// How many bytes of scratch the resize needs. Caller (Zig) allocates this +// How many bytes of scratch the resize needs. Caller (Rust) allocates this // alongside the output in ONE bun.default_allocator block — zero mallocs in // this TU. size_t bun_image_resize_scratch_size(int32_t src_w, int32_t src_h, int32_t dst_w, int32_t dst_h, int32_t filter_kind) diff --git a/src/jsc/bindings/image_wic_shim.cpp b/src/jsc/bindings/image_wic_shim.cpp index 83562d265ac..c685841aa4e 100644 --- a/src/jsc/bindings/image_wic_shim.cpp +++ b/src/jsc/bindings/image_wic_shim.cpp @@ -1,6 +1,6 @@ // Thin C wrapper around the one WIC interaction whose ABI is too fiddly to -// hand-roll from Zig: IPropertyBag2::Write with a VARIANT. The rest of the -// WIC backend (vtable-shaped COM calls) lives in src/image/backend_wic.zig +// hand-roll from Rust: IPropertyBag2::Write with a VARIANT. The rest of the +// WIC backend (vtable-shaped COM calls) lives in src/image/backend_wic.rust // because those are plain function-pointer tables and have been stable; this // file exists so the SDK's own definition of VARIANT (with its // union/BRECORD/DECIMAL padding) is the source of truth instead of an extern @@ -8,7 +8,7 @@ // // Kept header-light: only the option name + a float go in, so if we later // need more knobs (CompressionQuality, HeifCompressionMethod) they're one -// branch each rather than a Zig-side VARIANT for every type. +// branch each rather than a Rust-side VARIANT for every type. #if defined(_WIN32) @@ -54,7 +54,7 @@ extern "C" int32_t bun_wic_propbag_write_u8(void* props, const wchar_t* name, ui } #else -// Stubs so the symbols exist everywhere; backend_wic.zig is Windows-only so +// Stubs so the symbols exist everywhere; backend_wic.rust is Windows-only so // these are never called, but the linker wants them. extern "C" int bun_wic_propbag_write_f32(void*, const void*, float) { return 0; } extern "C" int bun_wic_propbag_write_u8(void*, const void*, unsigned char) { return 0; } diff --git a/src/jsc/bindings/js_classes.ts b/src/jsc/bindings/js_classes.ts index 989f69cbb4e..6789cea8c6b 100644 --- a/src/jsc/bindings/js_classes.ts +++ b/src/jsc/bindings/js_classes.ts @@ -2,7 +2,7 @@ export default [ // class list for $inherits*() builtins, eg. $inheritsBlob() // tests if a value is an instanceof a native class in a robust cross-realm manner // source-of-truth impl in src/codegen/generate-classes.ts - // result in build/debug/codegen/ZigGeneratedClasses.cpp + // result in build/debug/codegen/RustGeneratedClasses.cpp ["Blob"], ["ReadableStream", "JSReadableStream.h"], ["WritableStream", "JSWritableStream.h"], diff --git a/src/jsc/bindings/napi.cpp b/src/jsc/bindings/napi.cpp index e4d7edeb0aa..802c3b6ea7a 100644 --- a/src/jsc/bindings/napi.cpp +++ b/src/jsc/bindings/napi.cpp @@ -6,7 +6,7 @@ #include "JavaScriptCore/DateInstance.h" #include "JavaScriptCore/JSCast.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/SourceCode.h" #include "js_native_api.h" @@ -77,7 +77,7 @@ #include "AsyncContextFrame.h" using namespace JSC; -using namespace Zig; +using namespace Rust; // Every NAPI function should use this at the start. It does the following: // - if NAPI_VERBOSE is 1, log that the function was called @@ -294,7 +294,7 @@ static uint32_t getPropertyAttributes(const napi_property_descriptor& prop) return result; } -void NAPICallFrame::extract(size_t* argc, napi_value* argv, napi_value* this_arg, void** data, Zig::GlobalObject* globalObject) +void NAPICallFrame::extract(size_t* argc, napi_value* argv, napi_value* this_arg, void** data, Rust::GlobalObject* globalObject) { if (this_arg != nullptr) { @@ -322,7 +322,7 @@ void NAPICallFrame::extract(size_t* argc, napi_value* argv, napi_value* this_arg void Napi::defineProperty(napi_env env, JSC::JSObject* to, const napi_property_descriptor& property, bool isInstance, JSC::ThrowScope& scope) { - Zig::GlobalObject* globalObject = env->globalObject(); + Rust::GlobalObject* globalObject = env->globalObject(); JSC::VM& vm = JSC::getVM(globalObject); void* dataPtr = property.data; @@ -636,7 +636,7 @@ extern "C" napi_status napi_create_arraybuffer(napi_env env, NAPI_CHECK_ENV_NOT_IN_GC(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto& vm = JSC::getVM(globalObject); // Node probably doesn't create uninitialized array buffers @@ -723,7 +723,7 @@ extern "C" napi_status napi_get_named_property(napi_env env, napi_value object, } extern "C" size_t Bun__napi_module_register_count; -void Napi::executePendingNapiModule(Zig::GlobalObject* globalObject) +void Napi::executePendingNapiModule(Rust::GlobalObject* globalObject) { JSC::VM& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -808,7 +808,7 @@ void Napi::executePendingNapiModule(Zig::GlobalObject* globalObject) extern "C" void napi_module_register(napi_module* mod) { - Zig::GlobalObject* globalObject = defaultGlobalObject(); + Rust::GlobalObject* globalObject = defaultGlobalObject(); JSC::VM& vm = JSC::getVM(globalObject); // Increment this one even if the module is invalid so that functionDlopen // knows that napi_module_register was attempted @@ -916,7 +916,7 @@ extern "C" napi_status napi_remove_wrap(napi_env env, napi_value js_object, // may be null auto* napi_instance = dynamicDowncast(jsc_object); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto& vm = JSC::getVM(globalObject); NapiRef* ref = getWrapContentsIfExists(vm, globalObject, jsc_object); NAPI_RETURN_EARLY_IF_FALSE(env, ref, napi_invalid_arg); @@ -951,7 +951,7 @@ extern "C" napi_status napi_unwrap(napi_env env, napi_value js_object, JSObject* jsc_object = jsc_value.getObject(); NAPI_RETURN_EARLY_IF_FALSE(env, jsc_object, napi_object_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto& vm = JSC::getVM(globalObject); NapiRef* ref = getWrapContentsIfExists(vm, globalObject, jsc_object); NAPI_RETURN_EARLY_IF_FALSE(env, ref, napi_invalid_arg); @@ -970,7 +970,7 @@ extern "C" napi_status napi_create_function(napi_env env, const char* utf8name, NAPI_CHECK_ARG(env, result); NAPI_CHECK_ARG(env, cb); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); auto name = WTF::String(); @@ -999,7 +999,7 @@ extern "C" napi_status napi_get_cb_info( NAPI_CHECK_ARG(env, cbinfo); auto* callFrame = reinterpret_cast(cbinfo); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); callFrame->extract(argc, argv, this_arg, data, globalObject); NAPI_RETURN_SUCCESS(env); @@ -1010,7 +1010,7 @@ napi_define_properties(napi_env env, napi_value object, size_t property_count, const napi_property_descriptor* properties) { NAPI_PREAMBLE_NO_THROW_SCOPE(env); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); NAPI_RETURN_IF_EXCEPTION_WITH_SCOPE(env, throwScope); @@ -1148,7 +1148,7 @@ extern "C" napi_status napi_add_finalizer(napi_env env, napi_value js_object, NAPI_CHECK_ENV_NOT_IN_GC(env); NAPI_CHECK_ARG(env, js_object); NAPI_CHECK_ARG(env, finalize_cb); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSC::JSValue objectValue = toJS(js_object); @@ -1266,7 +1266,7 @@ extern "C" napi_status napi_detach_arraybuffer(napi_env env, { NAPI_PREAMBLE(env); NAPI_CHECK_ENV_NOT_IN_GC(env); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSC::JSArrayBuffer* jsArrayBuffer = dynamicDowncast(toJS(arraybuffer)); @@ -1453,7 +1453,7 @@ node_api_create_external_string_latin1(napi_env env, NAPI_LOG("latin1 string finalizer"); env->doFinalizer(finalize_callback, str, hint); }); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTF::move(impl))); ensureStillAliveHere(out); @@ -1489,7 +1489,7 @@ node_api_create_external_string_utf16(napi_env env, NAPI_LOG("utf16 string finalizer"); env->doFinalizer(finalize_callback, str, hint); }); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTF::move(impl))); ensureStillAliveHere(out); @@ -1591,7 +1591,7 @@ extern "C" napi_status napi_object_freeze(napi_env env, napi_value object_value) JSC::JSValue value = toJS(object_value); NAPI_RETURN_EARLY_IF_FALSE(env, value.isObject(), napi_object_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::JSObject* object = uncheckedDowncast(value); objectConstructorFreeze(globalObject, object); @@ -1606,7 +1606,7 @@ extern "C" napi_status napi_object_seal(napi_env env, napi_value object_value) JSC::JSValue value = toJS(object_value); NAPI_RETURN_EARLY_IF_FALSE(env, value.isObject(), napi_object_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::JSObject* object = uncheckedDowncast(value); objectConstructorSeal(globalObject, object); @@ -1620,7 +1620,7 @@ extern "C" napi_status napi_get_global(napi_env env, napi_value* result) NAPI_PREAMBLE(env); NAPI_CHECK_ENV_NOT_IN_GC(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); // TODO change to global? or find another way to avoid JSGlobalProxy *result = toNapi(globalObject->globalThis(), globalObject); NAPI_RETURN_SUCCESS(env); @@ -1659,7 +1659,7 @@ extern "C" napi_status napi_create_dataview(napi_env env, size_t length, napi_value* result) { NAPI_PREAMBLE_NO_THROW_SCOPE(env); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto scope = DECLARE_THROW_SCOPE(JSC::getVM(globalObject)); RETURN_IF_EXCEPTION(scope, napi_set_last_error(env, napi_pending_exception)); NAPI_CHECK_ARG(env, arraybuffer); @@ -1709,7 +1709,7 @@ static JSC::TypedArrayType getTypedArrayTypeFromNAPI(napi_typedarray_type type) } static JSC::JSArrayBufferView* createArrayBufferView( - Zig::GlobalObject* globalObject, + Rust::GlobalObject* globalObject, napi_typedarray_type type, RefPtr&& arrayBuffer, size_t byteOffset, @@ -1753,7 +1753,7 @@ extern "C" napi_status napi_create_typedarray( napi_value* result) { NAPI_PREAMBLE(env); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); NAPI_RETURN_IF_EXCEPTION(env); NAPI_CHECK_ARG(env, arraybuffer); NAPI_CHECK_ARG(env, result); @@ -1786,7 +1786,7 @@ extern "C" napi_status napi_create_typedarray( NAPI_RETURN_SUCCESS(env); } -namespace Zig { +namespace Rust { extern "C" napi_status napi_get_all_property_names( napi_env env, napi_value objectNapi, napi_key_collection_mode key_mode, @@ -1882,7 +1882,7 @@ extern "C" napi_status napi_define_class(napi_env env, NAPI_CHECK_ARG(env, constructor); NAPI_RETURN_EARLY_IF_FALSE(env, properties || property_count == 0, napi_invalid_arg); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); size_t len = length; if (len == NAPI_AUTO_LENGTH) { @@ -1907,7 +1907,7 @@ extern "C" napi_status napi_coerce_to_string(napi_env env, napi_value value, NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::JSValue jsValue = toJS(value); JSC::EnsureStillAliveScope ensureStillAlive(jsValue); @@ -1927,7 +1927,7 @@ extern "C" napi_status napi_coerce_to_bool(napi_env env, napi_value value, napi_ NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSValue jsValue = toJS(value); // might throw @@ -1944,7 +1944,7 @@ extern "C" napi_status napi_coerce_to_number(napi_env env, napi_value value, nap NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSValue jsValue = toJS(value); // might throw @@ -1961,7 +1961,7 @@ extern "C" napi_status napi_coerce_to_object(napi_env env, napi_value value, nap NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSValue jsValue = toJS(value); // might throw @@ -1982,7 +1982,7 @@ extern "C" napi_status napi_get_property_names(napi_env env, napi_value object, JSObject* jsObject = jsValue.getObject(); NAPI_RETURN_EARLY_IF_FALSE(env, jsObject, napi_object_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::EnsureStillAliveScope ensureStillAlive(jsValue); JSValue value = JSC::allPropertyKeys(globalObject, jsObject, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude); @@ -2000,7 +2000,7 @@ extern "C" napi_status napi_create_buffer(napi_env env, size_t length, NAPI_PREAMBLE(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto* subclassStructure = globalObject->JSBufferSubclassStructure(); // In Node.js, napi_create_buffer is uninitialized memory. @@ -2064,7 +2064,7 @@ extern "C" napi_status napi_create_external_buffer(napi_env env, size_t length, // before arm(), orphaning a GC cell with a disarmed destructor. NAPI_RETURN_EARLY_IF_FALSE(env, !env->hasPendingException(), napi_pending_exception); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); auto* subclassStructure = globalObject->JSBufferSubclassStructure(); @@ -2114,7 +2114,7 @@ extern "C" napi_status napi_create_external_arraybuffer(napi_env env, void* exte // still points at external_data with a disarmed destructor. NAPI_RETURN_EARLY_IF_FALSE(env, !env->hasPendingException(), napi_pending_exception); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); // Uses NapiExternalBufferDestructor instead of createSharedTask so that @@ -2218,7 +2218,7 @@ extern "C" napi_status napi_get_value_int64(napi_env env, napi_value value, int6 NAPI_RETURN_SUCCESS(env); } -// must match src/runtime/node/types.zig#Encoding, which matches WebCore::BufferEncodingType +// must match src/runtime/node/types.rust#Encoding, which matches WebCore::BufferEncodingType enum class NapiStringEncoding : uint8_t { utf8 = static_cast(WebCore::BufferEncodingType::utf8), utf16 = static_cast(WebCore::BufferEncodingType::utf16le), @@ -2243,7 +2243,7 @@ napi_status napi_get_value_string_any_encoding(napi_env env, napi_value napiValu JSValue jsValue = toJS(napiValue); NAPI_RETURN_EARLY_IF_FALSE(env, jsValue.isString(), napi_string_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSString* jsString = jsValue.toString(globalObject); NAPI_RETURN_IF_VM_EXCEPTION(env); const auto view = jsString->view(globalObject); @@ -2396,7 +2396,7 @@ extern "C" napi_status napi_create_object(napi_env env, napi_value* result) NAPI_CHECK_ENV_NOT_IN_GC(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSValue value = JSValue(NapiPrototype::create(vm, globalObject->NapiPrototypeStructure())); @@ -2415,7 +2415,7 @@ extern "C" napi_status napi_create_external(napi_env env, void* data, NAPI_PREAMBLE(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); auto* structure = globalObject->NapiExternalStructure(); @@ -2655,7 +2655,7 @@ extern "C" napi_status napi_run_script(napi_env env, napi_value script, JSValue scriptValue = toJS(script); NAPI_RETURN_EARLY_IF_FALSE(env, scriptValue.isString(), napi_string_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2728,7 +2728,7 @@ extern "C" napi_status napi_create_bigint_words(napi_env env, // JSBigInt::createWithLength's size argument is unsigned int. NAPI_RETURN_EARLY_IF_FALSE(env, word_count <= UINT_MAX, napi_invalid_arg); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); auto& vm = env->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -2762,7 +2762,7 @@ extern "C" napi_status napi_create_symbol(napi_env env, napi_value description, NAPI_CHECK_ENV_NOT_IN_GC(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSC::JSValue descriptionValue = toJS(description); @@ -2800,7 +2800,7 @@ extern "C" napi_status napi_new_instance(napi_env env, napi_value constructor, JSC::CallData constructData = getConstructData(constructorObject); NAPI_RETURN_EARLY_IF_FALSE(env, constructData.type != JSC::CallData::Type::None, napi_function_expected); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSC::MarkedArgumentBuffer args; @@ -2819,7 +2819,7 @@ extern "C" napi_status napi_instanceof(napi_env env, napi_value object, napi_val NAPI_PREAMBLE_NO_THROW_SCOPE(env); NAPI_CHECK_ARG(env, result); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSValue objectValue = toJS(object); JSValue constructorValue = toJS(constructor); @@ -2858,14 +2858,14 @@ extern "C" napi_status napi_call_function(napi_env env, napi_value recv, // Ideally, funcValue is never of type AsyncContextFrame, as that type // should never be exposed to user-code. To preserve async local storage // contexts across napi_threadsafe_callback, AsyncContextFrame is created. - // An alternative here would be to unwrap the frame in napi.zig + // An alternative here would be to unwrap the frame in napi.rust // ThreadSafeCallback.call, but doing the work assigning and restoring the - // global state is not trivial since there are no Zig bindings for that. + // global state is not trivial since there are no Rust bindings for that. // Most, if not all, threadsafe callbacks will not pass the callback to JS, // they will just call it with this function. NAPI_RETURN_EARLY_IF_FALSE(env, funcValue.isCallable() || dynamicDowncast(funcValue), napi_invalid_arg); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSC::VM& vm = JSC::getVM(globalObject); JSC::MarkedArgumentBuffer args; @@ -2895,7 +2895,7 @@ extern "C" napi_status napi_type_tag_object(napi_env env, napi_value value, cons NAPI_PREAMBLE(env); NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, type_tag); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSObject* js_object = toJS(value).getObject(); NAPI_RETURN_EARLY_IF_FALSE(env, js_object, napi_object_expected); JSValue napiTypeTagValue = globalObject->napiTypeTags()->get(js_object); @@ -2915,7 +2915,7 @@ extern "C" napi_status napi_check_object_type_tag(napi_env env, napi_value value NAPI_PREAMBLE(env); NAPI_CHECK_ARG(env, value); NAPI_CHECK_ARG(env, type_tag); - Zig::GlobalObject* globalObject = toJS(env); + Rust::GlobalObject* globalObject = toJS(env); JSObject* js_object = toJS(value).getObject(); NAPI_RETURN_EARLY_IF_FALSE(env, js_object, napi_object_expected); diff --git a/src/jsc/bindings/napi.h b/src/jsc/bindings/napi.h index a1f54ceef48..28436052101 100644 --- a/src/jsc/bindings/napi.h +++ b/src/jsc/bindings/napi.h @@ -11,7 +11,7 @@ #include "node_api.h" #include #include "JSFFIFunction.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "napi_handle_scope.h" #include "napi_finalizer.h" #include "wtf/Assertions.h" @@ -23,7 +23,7 @@ #include #include -extern "C" void napi_internal_register_cleanup_zig(napi_env env); +extern "C" void napi_internal_register_cleanup_rust(napi_env env); extern "C" void napi_internal_suppress_crash_on_abort_if_desired(); extern "C" void Bun__crashHandler(const char* message, size_t message_len); @@ -174,15 +174,15 @@ struct NapiEnv : public WTF::RefCounted { WTF_MAKE_STRUCT_TZONE_ALLOCATED(NapiEnv); public: - NapiEnv(Zig::GlobalObject* globalObject, const napi_module& napiModule) + NapiEnv(Rust::GlobalObject* globalObject, const napi_module& napiModule) : m_globalObject(globalObject) , m_napiModule(napiModule) , m_vm(JSC::getVM(globalObject)) { - napi_internal_register_cleanup_zig(this); + napi_internal_register_cleanup_rust(this); } - static Ref create(Zig::GlobalObject* globalObject, const napi_module& napiModule) + static Ref create(Rust::GlobalObject* globalObject, const napi_module& napiModule) { return adoptRef(*new NapiEnv(globalObject, napiModule)); } @@ -379,8 +379,8 @@ struct NapiEnv : public WTF::RefCounted { return static_cast(m_pendingException); } - inline Zig::GlobalObject* globalObject() const { return m_globalObject; } - // `bun test --isolate` creates a fresh Zig::GlobalObject per file and + inline Rust::GlobalObject* globalObject() const { return m_globalObject; } + // `bun test --isolate` creates a fresh Rust::GlobalObject per file and // gcUnprotect()s the previous one. NapiEnv outlives its owning global — // GC-enqueued NapiFinalizerTasks hold a Ref and run on the event // loop *after* the swap. Finalizer.run opens a NapiHandleScope via @@ -390,7 +390,7 @@ struct NapiEnv : public WTF::RefCounted { // segfault when the marker later walks it). The isolation swap calls this // to point surviving envs at the new global before unprotecting the old // one. - inline void retargetGlobalObject(Zig::GlobalObject* newGlobal) + inline void retargetGlobalObject(Rust::GlobalObject* newGlobal) { ASSERT(&JSC::getVM(newGlobal) == &m_vm); m_globalObject = newGlobal; @@ -491,7 +491,7 @@ struct NapiEnv : public WTF::RefCounted { }; private: - Zig::GlobalObject* m_globalObject = nullptr; + Rust::GlobalObject* m_globalObject = nullptr; napi_module m_napiModule; // ListHashSet preserves insertion order so cleanup() can run finalizers in reverse // (LIFO), matching Node.js teardown semantics for napi_wrap references. @@ -575,11 +575,11 @@ class NapiRefSelfDeletingWeakHandleOwner final : public JSC::WeakHandleOwner { // If a module registered itself by calling napi_module_register in a static constructor, run this // to run the module's entrypoint. -void executePendingNapiModule(Zig::GlobalObject* globalObject); +void executePendingNapiModule(Rust::GlobalObject* globalObject); } -namespace Zig { +namespace Rust { using namespace JSC; static inline JSValue toJS(napi_value val) @@ -587,12 +587,12 @@ static inline JSValue toJS(napi_value val) return JSC::JSValue::decode(reinterpret_cast(val)); } -static inline Zig::GlobalObject* toJS(napi_env val) +static inline Rust::GlobalObject* toJS(napi_env val) { return val->globalObject(); } -static inline napi_value toNapi(JSC::JSValue val, Zig::GlobalObject* globalObject) +static inline napi_value toNapi(JSC::JSValue val, Rust::GlobalObject* globalObject) { if (val.isCell()) { if (auto* scope = globalObject->m_currentNapiHandleScopeImpl.get()) { @@ -940,7 +940,7 @@ class NAPICallFrame { // and receives the actual count of args. napi_value* argv, // [out] Array of values napi_value* this_arg, // [out] Receives the JS 'this' arg for the call - void** data, Zig::GlobalObject* globalObject); + void** data, Rust::GlobalObject* globalObject); JSValue newTarget() { diff --git a/src/jsc/bindings/napi_external.h b/src/jsc/bindings/napi_external.h index 2d104fceb81..68aa829a2a2 100644 --- a/src/jsc/bindings/napi_external.h +++ b/src/jsc/bindings/napi_external.h @@ -104,4 +104,4 @@ class NapiExternal : public JSC::JSDestructibleObject { #endif }; -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/bindings/napi_handle_scope.cpp b/src/jsc/bindings/napi_handle_scope.cpp index e691becdbec..aa477b7bb44 100644 --- a/src/jsc/bindings/napi_handle_scope.cpp +++ b/src/jsc/bindings/napi_handle_scope.cpp @@ -1,7 +1,7 @@ #include "napi_handle_scope.h" #include "napi.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { @@ -81,7 +81,7 @@ NapiHandleScopeImpl::Slot* NapiHandleScopeImpl::reserveSlot() return &m_storage.last(); } -NapiHandleScopeImpl* NapiHandleScope::open(Zig::GlobalObject* globalObject, bool escapable) +NapiHandleScopeImpl* NapiHandleScope::open(Rust::GlobalObject* globalObject, bool escapable) { auto& vm = JSC::getVM(globalObject); // Do not create a new handle scope while a finalizer is in progress @@ -104,7 +104,7 @@ NapiHandleScopeImpl* NapiHandleScope::open(Zig::GlobalObject* globalObject, bool return impl; } -void NapiHandleScope::close(Zig::GlobalObject* globalObject, NapiHandleScopeImpl* current) +void NapiHandleScope::close(Rust::GlobalObject* globalObject, NapiHandleScopeImpl* current) { NAPI_LOG_CURRENT_FUNCTION; // napi handle scopes may be null pointers if created inside a finalizer @@ -120,7 +120,7 @@ void NapiHandleScope::close(Zig::GlobalObject* globalObject, NapiHandleScopeImpl } } -NapiHandleScope::NapiHandleScope(Zig::GlobalObject* globalObject) +NapiHandleScope::NapiHandleScope(Rust::GlobalObject* globalObject) : m_globalObject(globalObject) , m_impl(NapiHandleScope::open(globalObject, false)) { diff --git a/src/jsc/bindings/napi_handle_scope.h b/src/jsc/bindings/napi_handle_scope.h index a0047166378..8b871982b4f 100644 --- a/src/jsc/bindings/napi_handle_scope.h +++ b/src/jsc/bindings/napi_handle_scope.h @@ -74,19 +74,19 @@ class NapiHandleScopeImpl : public JSC::JSCell { // Wrapper class used to open a new handle scope and close it when this instance goes out of scope class NapiHandleScope { public: - NapiHandleScope(Zig::GlobalObject* globalObject); + NapiHandleScope(Rust::GlobalObject* globalObject); ~NapiHandleScope(); // Create a new handle scope in the given environment - static NapiHandleScopeImpl* open(Zig::GlobalObject* globalObject, bool escapable); + static NapiHandleScopeImpl* open(Rust::GlobalObject* globalObject, bool escapable); // Closes the most recently created handle scope in the given environment and restores the old one. // Asserts that `current` is the active handle scope. - static void close(Zig::GlobalObject* globalObject, NapiHandleScopeImpl* current); + static void close(Rust::GlobalObject* globalObject, NapiHandleScopeImpl* current); private: NapiHandleScopeImpl* m_impl; - Zig::GlobalObject* m_globalObject; + Rust::GlobalObject* m_globalObject; }; // Create a new handle scope in the given environment diff --git a/src/jsc/bindings/napi_type_tag.cpp b/src/jsc/bindings/napi_type_tag.cpp index b05385b18ce..5cd63b9af74 100644 --- a/src/jsc/bindings/napi_type_tag.cpp +++ b/src/jsc/bindings/napi_type_tag.cpp @@ -1,6 +1,6 @@ #include "napi_type_tag.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { diff --git a/src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp b/src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp index aa658846aa4..57b9ca96e26 100644 --- a/src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp +++ b/src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp @@ -1,7 +1,7 @@ #include "JSNodeHTTPServerSocket.h" #include "JSNodeHTTPServerSocketPrototype.h" -#include "ZigGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGlobalObject.h" +#include "RustGeneratedClasses.h" #include "DOMIsoSubspaces.h" #include "ScriptExecutionContext.h" #include "helpers.h" @@ -11,8 +11,8 @@ #include #include -extern "C" void Bun__NodeHTTPResponse_setClosed(void* zigResponse); -extern "C" void Bun__NodeHTTPResponse_onClose(void* zigResponse, JSC::EncodedJSValue jsValue); +extern "C" void Bun__NodeHTTPResponse_setClosed(void* rustResponse); +extern "C" void Bun__NodeHTTPResponse_onClose(void* rustResponse, JSC::EncodedJSValue jsValue); extern "C" void us_socket_free_stream_buffer(us_socket_stream_buffer_t* streamBuffer); extern "C" uint64_t uws_res_get_remote_address_info(void* res, const char** dest, int* port, bool* is_ipv6); extern "C" uint64_t uws_res_get_local_address_info(void* res, const char** dest, int* port, bool* is_ipv6); @@ -39,7 +39,7 @@ JSNodeHTTPServerSocket* JSNodeHTTPServerSocket::create(JSC::VM& vm, JSC::Structu return object; } -JSNodeHTTPServerSocket* JSNodeHTTPServerSocket::create(JSC::VM& vm, Zig::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response) +JSNodeHTTPServerSocket* JSNodeHTTPServerSocket::create(JSC::VM& vm, Rust::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response) { auto* structure = globalObject->m_JSNodeHTTPServerSocketStructure.getInitializedOnMainThread(globalObject); return create(vm, structure, socket, is_ssl, response); @@ -134,7 +134,7 @@ void JSNodeHTTPServerSocket::onClose() } // This function can be called during GC! - Zig::GlobalObject* globalObject = static_cast(this->globalObject()); + Rust::GlobalObject* globalObject = static_cast(this->globalObject()); if (!functionToCallOnClose) { if (auto* res = this->currentResponseObject.get(); res != nullptr && res->m_ctx != nullptr) { Bun__NodeHTTPResponse_onClose(res->m_ctx, JSValue::encode(res)); @@ -182,7 +182,7 @@ void JSNodeHTTPServerSocket::onClose() void JSNodeHTTPServerSocket::onDrain() { // This function can be called during GC! - Zig::GlobalObject* globalObject = static_cast(this->globalObject()); + Rust::GlobalObject* globalObject = static_cast(this->globalObject()); if (!functionToCallOnDrain) { return; } @@ -234,7 +234,7 @@ void JSNodeHTTPServerSocket::onDrain() void JSNodeHTTPServerSocket::onData(const char* data, int length, bool last) { // This function can be called during GC! - Zig::GlobalObject* globalObject = static_cast(this->globalObject()); + Rust::GlobalObject* globalObject = static_cast(this->globalObject()); if (!functionToCallOnData) { return; } @@ -343,7 +343,7 @@ extern "C" JSC::EncodedJSValue Bun__getNodeHTTPServerSocketThisValue(bool is_ssl return JSValue::encode(getNodeHTTPServerSocket(socket)); } -extern "C" JSC::EncodedJSValue Bun__createNodeHTTPServerSocketForClientError(bool isSSL, us_socket_t* us_socket, Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__createNodeHTTPServerSocketForClientError(bool isSSL, us_socket_t* us_socket, Rust::GlobalObject* globalObject) { auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/node/JSNodeHTTPServerSocket.h b/src/jsc/bindings/node/JSNodeHTTPServerSocket.h index 111a27ac1d4..7208284401b 100644 --- a/src/jsc/bindings/node/JSNodeHTTPServerSocket.h +++ b/src/jsc/bindings/node/JSNodeHTTPServerSocket.h @@ -53,7 +53,7 @@ class JSNodeHTTPServerSocket : public JSC::JSDestructibleObject { JSC::Strong strongThis = {}; static JSNodeHTTPServerSocket* create(JSC::VM& vm, JSC::Structure* structure, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response); - static JSNodeHTTPServerSocket* create(JSC::VM& vm, Zig::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response); + static JSNodeHTTPServerSocket* create(JSC::VM& vm, Rust::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response); static void destroy(JSC::JSCell* cell) { diff --git a/src/jsc/bindings/node/JSNodeHTTPServerSocketPrototype.cpp b/src/jsc/bindings/node/JSNodeHTTPServerSocketPrototype.cpp index 0ed176ffae7..fc1b2d04a68 100644 --- a/src/jsc/bindings/node/JSNodeHTTPServerSocketPrototype.cpp +++ b/src/jsc/bindings/node/JSNodeHTTPServerSocketPrototype.cpp @@ -1,8 +1,8 @@ #include "JSNodeHTTPServerSocketPrototype.h" #include "JSNodeHTTPServerSocket.h" #include "JSSocketAddressDTO.h" -#include "ZigGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGlobalObject.h" +#include "RustGeneratedClasses.h" #include "helpers.h" #include #include diff --git a/src/jsc/bindings/node/crypto/CryptoPrimes.h b/src/jsc/bindings/node/crypto/CryptoPrimes.h index 1f8f36fd605..e6df342505c 100644 --- a/src/jsc/bindings/node/crypto/CryptoPrimes.h +++ b/src/jsc/bindings/node/crypto/CryptoPrimes.h @@ -22,7 +22,7 @@ struct CheckPrimeJobCtx { WTF_MAKE_TZONE_ALLOCATED(CheckPrimeJobCtx); }; -// Opaque struct created zig land +// Opaque struct created rust land struct CheckPrimeJob { static CheckPrimeJob* create(JSC::JSGlobalObject*, ncrypto::BignumPointer candidate, int32_t checks, JSC::JSValue callback); static void createAndSchedule(JSC::JSGlobalObject* globalObject, ncrypto::BignumPointer candidate, int32_t checks, JSC::JSValue callback); @@ -48,7 +48,7 @@ struct GeneratePrimeJobCtx { WTF_MAKE_TZONE_ALLOCATED(GeneratePrimeJobCtx); }; -// Opaque struct created zig land +// Opaque struct created rust land struct GeneratePrimeJob { static GeneratePrimeJob* create(JSC::JSGlobalObject*, int32_t size, bool safe, ncrypto::BignumPointer prime, ncrypto::BignumPointer add, ncrypto::BignumPointer rem, bool bigint, JSC::JSValue callback); static void createAndSchedule(JSC::JSGlobalObject*, int32_t size, bool safe, ncrypto::BignumPointer prime, ncrypto::BignumPointer add, ncrypto::BignumPointer rem, bool bigint, JSC::JSValue callback); diff --git a/src/jsc/bindings/node/crypto/CryptoUtil.cpp b/src/jsc/bindings/node/crypto/CryptoUtil.cpp index c2459d44033..aef04c1206c 100644 --- a/src/jsc/bindings/node/crypto/CryptoUtil.cpp +++ b/src/jsc/bindings/node/crypto/CryptoUtil.cpp @@ -19,18 +19,18 @@ namespace Bun { using namespace JSC; using namespace ncrypto; -namespace ExternZigHash { +namespace ExternRustHash { struct Hasher; -extern "C" Hasher* Bun__CryptoHasherExtern__getByName(Zig::GlobalObject* globalObject, const char* name, size_t nameLen); -Hasher* getByName(Zig::GlobalObject* globalObject, const StringView& name) +extern "C" Hasher* Bun__CryptoHasherExtern__getByName(Rust::GlobalObject* globalObject, const char* name, size_t nameLen); +Hasher* getByName(Rust::GlobalObject* globalObject, const StringView& name) { auto utf8 = name.utf8(); return Bun__CryptoHasherExtern__getByName(globalObject, utf8.data(), utf8.length()); } -extern "C" Hasher* Bun__CryptoHasherExtern__getFromOther(Zig::GlobalObject* global, Hasher* hasher); -Hasher* getFromOther(Zig::GlobalObject* globalObject, Hasher* hasher) +extern "C" Hasher* Bun__CryptoHasherExtern__getFromOther(Rust::GlobalObject* global, Hasher* hasher); +Hasher* getFromOther(Rust::GlobalObject* globalObject, Hasher* hasher) { return Bun__CryptoHasherExtern__getFromOther(globalObject, hasher); } @@ -47,8 +47,8 @@ bool update(Hasher* hasher, std::span data) return Bun__CryptoHasherExtern__update(hasher, data.data(), data.size()); } -extern "C" uint32_t Bun__CryptoHasherExtern__digest(Hasher* hasher, Zig::GlobalObject* globalObject, uint8_t* out, size_t outLen); -uint32_t digest(Hasher* hasher, Zig::GlobalObject* globalObject, std::span out) +extern "C" uint32_t Bun__CryptoHasherExtern__digest(Hasher* hasher, Rust::GlobalObject* globalObject, uint8_t* out, size_t outLen); +uint32_t digest(Hasher* hasher, Rust::GlobalObject* globalObject, std::span out) { return Bun__CryptoHasherExtern__digest(hasher, globalObject, out.data(), out.size()); } @@ -59,7 +59,7 @@ uint32_t getDigestSize(Hasher* hasher) return Bun__CryptoHasherExtern__getDigestSize(hasher); } -}; // namespace ExternZigHash +}; // namespace ExternRustHash namespace StringBytes { diff --git a/src/jsc/bindings/node/crypto/CryptoUtil.h b/src/jsc/bindings/node/crypto/CryptoUtil.h index c8e7c07b1b4..118308f5022 100644 --- a/src/jsc/bindings/node/crypto/CryptoUtil.h +++ b/src/jsc/bindings/node/crypto/CryptoUtil.h @@ -17,17 +17,17 @@ enum class DSASigEnc { Invalid, }; -namespace ExternZigHash { +namespace ExternRustHash { struct Hasher; -Hasher* getByName(Zig::GlobalObject* globalObject, const StringView& name); -Hasher* getFromOther(Zig::GlobalObject* globalObject, Hasher* hasher); +Hasher* getByName(Rust::GlobalObject* globalObject, const StringView& name); +Hasher* getFromOther(Rust::GlobalObject* globalObject, Hasher* hasher); void destroy(Hasher* hasher); bool update(Hasher* hasher, std::span data); -uint32_t digest(Hasher* hasher, Zig::GlobalObject* globalObject, std::span out); +uint32_t digest(Hasher* hasher, Rust::GlobalObject* globalObject, std::span out); uint32_t getDigestSize(Hasher* hasher); -}; // namespace ExternZigHash +}; // namespace ExternRustHash namespace StringBytes { EncodedJSValue encode(JSGlobalObject* lexicalGlobalObject, ThrowScope& scope, std::span bytes, BufferEncodingType encoding); diff --git a/src/jsc/bindings/node/crypto/JSCipher.cpp b/src/jsc/bindings/node/crypto/JSCipher.cpp index 40d70c3197b..5671275e13a 100644 --- a/src/jsc/bindings/node/crypto/JSCipher.cpp +++ b/src/jsc/bindings/node/crypto/JSCipher.cpp @@ -2,7 +2,7 @@ #include "JSCipherPrototype.h" #include "JSCipherConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSCipherConstructor.cpp b/src/jsc/bindings/node/crypto/JSCipherConstructor.cpp index 6261433f5fb..0caa3e452a0 100644 --- a/src/jsc/bindings/node/crypto/JSCipherConstructor.cpp +++ b/src/jsc/bindings/node/crypto/JSCipherConstructor.cpp @@ -216,8 +216,8 @@ JSC_DEFINE_HOST_FUNCTION(constructCipher, (JSC::JSGlobalObject * globalObject, J throwCryptoError(globalObject, scope, ERR_get_error(), "Failed to initialize cipher"_s); } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSCipherClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSCipherClassStructure.get(rustGlobalObject); return JSC::JSValue::encode(JSCipher::create(vm, structure, globalObject, cipherKind, WTF::move(ctx), authTagLength, maxMessageSize)); } diff --git a/src/jsc/bindings/node/crypto/JSDiffieHellman.cpp b/src/jsc/bindings/node/crypto/JSDiffieHellman.cpp index 3c5758e07f5..29154f32080 100644 --- a/src/jsc/bindings/node/crypto/JSDiffieHellman.cpp +++ b/src/jsc/bindings/node/crypto/JSDiffieHellman.cpp @@ -2,7 +2,7 @@ #include "JSDiffieHellmanPrototype.h" #include "JSDiffieHellmanConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSDiffieHellmanConstructor.cpp b/src/jsc/bindings/node/crypto/JSDiffieHellmanConstructor.cpp index 8c281c45ce9..5c7ba6e21bf 100644 --- a/src/jsc/bindings/node/crypto/JSDiffieHellmanConstructor.cpp +++ b/src/jsc/bindings/node/crypto/JSDiffieHellmanConstructor.cpp @@ -167,8 +167,8 @@ JSC_DEFINE_HOST_FUNCTION(constructDiffieHellman, (JSC::JSGlobalObject * globalOb } // Get the appropriate structure and create the DiffieHellman object - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSDiffieHellmanClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSDiffieHellmanClassStructure.get(rustGlobalObject); return JSC::JSValue::encode(JSDiffieHellman::create(vm, structure, globalObject, WTF::move(dh))); } diff --git a/src/jsc/bindings/node/crypto/JSDiffieHellmanGroup.cpp b/src/jsc/bindings/node/crypto/JSDiffieHellmanGroup.cpp index 5d05e6467a5..7f38663c766 100644 --- a/src/jsc/bindings/node/crypto/JSDiffieHellmanGroup.cpp +++ b/src/jsc/bindings/node/crypto/JSDiffieHellmanGroup.cpp @@ -2,7 +2,7 @@ #include "JSDiffieHellmanGroupPrototype.h" #include "JSDiffieHellmanGroupConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp b/src/jsc/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp index 6e232aa85ab..4c8231f5beb 100644 --- a/src/jsc/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp +++ b/src/jsc/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp @@ -5,7 +5,7 @@ #include "ErrorCode.h" #include "NodeValidator.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bun { @@ -44,11 +44,11 @@ JSC_DEFINE_HOST_FUNCTION(constructDiffieHellmanGroup, (JSC::JSGlobalObject * glo } // Get the appropriate structure and create the DiffieHellmanGroup object - auto* zigGlobalObject = dynamicDowncast(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSDiffieHellmanGroupClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = dynamicDowncast(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSDiffieHellmanGroupClassStructure.get(rustGlobalObject); JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSDiffieHellmanGroupClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSDiffieHellmanGroupClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { auto scope = DECLARE_THROW_SCOPE(vm); if (!newTarget) { throwError(globalObject, scope, ErrorCode::ERR_INVALID_THIS, "Class constructor DiffieHellmanGroup cannot be invoked without 'new'"_s); diff --git a/src/jsc/bindings/node/crypto/JSECDH.cpp b/src/jsc/bindings/node/crypto/JSECDH.cpp index 28d642c4e4e..d58fa5e2f18 100644 --- a/src/jsc/bindings/node/crypto/JSECDH.cpp +++ b/src/jsc/bindings/node/crypto/JSECDH.cpp @@ -2,7 +2,7 @@ #include "JSECDHPrototype.h" #include "JSECDHConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSECDHConstructor.cpp b/src/jsc/bindings/node/crypto/JSECDHConstructor.cpp index f65e45710de..4d10c7662b1 100644 --- a/src/jsc/bindings/node/crypto/JSECDHConstructor.cpp +++ b/src/jsc/bindings/node/crypto/JSECDHConstructor.cpp @@ -68,8 +68,8 @@ JSC_DEFINE_HOST_FUNCTION(constructECDH, (JSC::JSGlobalObject * globalObject, JSC return Bun::ERR::CRYPTO_OPERATION_FAILED(scope, globalObject, "Failed to create key using named curve"_s); } - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSECDHClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSECDHClassStructure.get(rustGlobalObject); const EC_GROUP* group = key.getGroup(); return JSC::JSValue::encode(JSECDH::create(vm, structure, globalObject, WTF::move(key), group)); diff --git a/src/jsc/bindings/node/crypto/JSHash.cpp b/src/jsc/bindings/node/crypto/JSHash.cpp index 86fb0b855b8..dcbb2070ac6 100644 --- a/src/jsc/bindings/node/crypto/JSHash.cpp +++ b/src/jsc/bindings/node/crypto/JSHash.cpp @@ -36,8 +36,8 @@ void JSHash::destroy(JSC::JSCell* cell) JSHash::~JSHash() { - if (m_zigHasher) { - ExternZigHash::destroy(m_zigHasher); + if (m_rustHasher) { + ExternRustHash::destroy(m_rustHasher); } } @@ -97,10 +97,10 @@ bool JSHash::init(JSC::JSGlobalObject* globalObject, ThrowScope& scope, const EV return true; } -bool JSHash::initZig(JSGlobalObject* globalObject, ThrowScope& scope, ExternZigHash::Hasher* hasher, std::optional xofLen) +bool JSHash::initRust(JSGlobalObject* globalObject, ThrowScope& scope, ExternRustHash::Hasher* hasher, std::optional xofLen) { - m_zigHasher = hasher; - m_mdLen = ExternZigHash::getDigestSize(hasher); + m_rustHasher = hasher; + m_mdLen = ExternRustHash::getDigestSize(hasher); if (m_mdLen == 0) { return false; @@ -124,8 +124,8 @@ bool JSHash::update(std::span input) return m_ctx.digestUpdate(buffer); } - if (m_zigHasher) { - return ExternZigHash::update(m_zigHasher, input); + if (m_rustHasher) { + return ExternRustHash::update(m_rustHasher, input); } return false; @@ -241,14 +241,14 @@ JSC_DEFINE_HOST_FUNCTION(jsHashProtoFuncDigest, (JSC::JSGlobalObject * lexicalGl uint32_t len = hash->m_mdLen; - if (hash->m_zigHasher) { + if (hash->m_rustHasher) { if (hash->m_digestBuffer.size() > 0 || len == 0) { RELEASE_AND_RETURN(scope, StringBytes::encode(lexicalGlobalObject, scope, hash->m_digestBuffer.span().subspan(0, hash->m_mdLen), encoding)); } uint32_t maxDigestLen = std::max((uint32_t)EVP_MAX_MD_SIZE, len); hash->m_digestBuffer.resizeToFit(maxDigestLen); - auto totalDigestLen = ExternZigHash::digest(hash->m_zigHasher, globalObject, hash->m_digestBuffer.mutableSpan()); + auto totalDigestLen = ExternRustHash::digest(hash->m_rustHasher, globalObject, hash->m_digestBuffer.mutableSpan()); if (!totalDigestLen) { throwCryptoError(lexicalGlobalObject, scope, ERR_get_error(), "Failed to finalize digest"_s); return {}; @@ -285,12 +285,12 @@ JSC_DEFINE_HOST_FUNCTION(constructHash, (JSC::JSGlobalObject * globalObject, JSC JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSHashClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSHashClassStructure.get(rustGlobalObject); // Handle new target JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSHashClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSHashClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor Hash cannot be invoked without 'new'"_s); return {}; @@ -309,15 +309,15 @@ JSC_DEFINE_HOST_FUNCTION(constructHash, (JSC::JSGlobalObject * globalObject, JSC // If clone, check m_finalized before anything else. JSHash* original = nullptr; const EVP_MD* md = nullptr; - ExternZigHash::Hasher* zigHasher = nullptr; + ExternRustHash::Hasher* rustHasher = nullptr; if (algorithmOrHashInstanceValue.inherits(JSHash::info())) { original = dynamicDowncast(algorithmOrHashInstanceValue); if (!original || original->m_finalized) { return Bun::ERR::CRYPTO_HASH_FINALIZED(scope, globalObject); } - if (original->m_zigHasher) { - zigHasher = ExternZigHash::getFromOther(zigGlobalObject, original->m_zigHasher); + if (original->m_rustHasher) { + rustHasher = ExternRustHash::getFromOther(rustGlobalObject, original->m_rustHasher); } else { md = original->m_ctx.getDigest(); } @@ -330,11 +330,11 @@ JSC_DEFINE_HOST_FUNCTION(constructHash, (JSC::JSGlobalObject * globalObject, JSC md = ncrypto::getDigestByName(algorithm); if (!md) { - zigHasher = ExternZigHash::getByName(zigGlobalObject, algorithm); + rustHasher = ExternRustHash::getByName(rustGlobalObject, algorithm); } } - if (md == nullptr && zigHasher == nullptr) [[unlikely]] { + if (md == nullptr && rustHasher == nullptr) [[unlikely]] { throwCryptoError(globalObject, scope, ERR_get_error(), "Digest method not supported"_s); return {}; } @@ -355,8 +355,8 @@ JSC_DEFINE_HOST_FUNCTION(constructHash, (JSC::JSGlobalObject * globalObject, JSC JSHash* hash = JSHash::create(vm, structure); - if (zigHasher) { - if (!hash->initZig(globalObject, scope, zigHasher, xofLen)) { + if (rustHasher) { + if (!hash->initRust(globalObject, scope, rustHasher, xofLen)) { throwCryptoError(globalObject, scope, 0, "Digest method not supported"_s); return {}; } diff --git a/src/jsc/bindings/node/crypto/JSHash.h b/src/jsc/bindings/node/crypto/JSHash.h index d6ee1b8fb78..0e02b9f97d2 100644 --- a/src/jsc/bindings/node/crypto/JSHash.h +++ b/src/jsc/bindings/node/crypto/JSHash.h @@ -41,7 +41,7 @@ class JSHash final : public JSC::JSDestructibleObject { void finishCreation(JSC::VM& vm); bool init(JSC::JSGlobalObject* globalObject, ThrowScope& scope, const EVP_MD* md, std::optional xofLen); - bool initZig(JSGlobalObject* globalObject, ThrowScope& scope, ExternZigHash::Hasher* hasher, std::optional xofLen); + bool initRust(JSGlobalObject* globalObject, ThrowScope& scope, ExternRustHash::Hasher* hasher, std::optional xofLen); bool update(std::span input); ncrypto::EVPMDCtxPointer m_ctx; @@ -51,7 +51,7 @@ class JSHash final : public JSC::JSDestructibleObject { Vector m_digestBuffer; - ExternZigHash::Hasher* m_zigHasher { nullptr }; + ExternRustHash::Hasher* m_rustHasher { nullptr }; }; class JSHashPrototype final : public JSC::JSNonFinalObject { diff --git a/src/jsc/bindings/node/crypto/JSHmac.cpp b/src/jsc/bindings/node/crypto/JSHmac.cpp index 1cbf2ab2df3..7ce8858c717 100644 --- a/src/jsc/bindings/node/crypto/JSHmac.cpp +++ b/src/jsc/bindings/node/crypto/JSHmac.cpp @@ -235,12 +235,12 @@ JSC_DEFINE_HOST_FUNCTION(constructHmac, (JSC::JSGlobalObject * globalObject, JSC JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSHmacClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSHmacClassStructure.get(rustGlobalObject); // Handle new target JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSHmacClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSHmacClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor Hmac cannot be invoked without 'new'"_s); return {}; diff --git a/src/jsc/bindings/node/crypto/JSKeyObject.cpp b/src/jsc/bindings/node/crypto/JSKeyObject.cpp index fecf27d7e52..95533141f1c 100644 --- a/src/jsc/bindings/node/crypto/JSKeyObject.cpp +++ b/src/jsc/bindings/node/crypto/JSKeyObject.cpp @@ -2,7 +2,7 @@ #include "JSKeyObjectPrototype.h" #include "JSKeyObjectConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSKeyObjectConstructor.cpp b/src/jsc/bindings/node/crypto/JSKeyObjectConstructor.cpp index 709b95f70b8..9451cd140a2 100644 --- a/src/jsc/bindings/node/crypto/JSKeyObjectConstructor.cpp +++ b/src/jsc/bindings/node/crypto/JSKeyObjectConstructor.cpp @@ -14,7 +14,7 @@ #include "JSSecretKeyObject.h" #include "JSPublicKeyObject.h" #include "JSPrivateKeyObject.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "CryptoKeyAES.h" #include "CryptoKeyHMAC.h" #include "CryptoKeyRaw.h" diff --git a/src/jsc/bindings/node/crypto/JSPrivateKeyObject.cpp b/src/jsc/bindings/node/crypto/JSPrivateKeyObject.cpp index b92f405e9cd..8fd7a095133 100644 --- a/src/jsc/bindings/node/crypto/JSPrivateKeyObject.cpp +++ b/src/jsc/bindings/node/crypto/JSPrivateKeyObject.cpp @@ -2,7 +2,7 @@ #include "JSPrivateKeyObjectPrototype.h" #include "JSKeyObjectConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSPublicKeyObject.cpp b/src/jsc/bindings/node/crypto/JSPublicKeyObject.cpp index 650108fee62..082671f5658 100644 --- a/src/jsc/bindings/node/crypto/JSPublicKeyObject.cpp +++ b/src/jsc/bindings/node/crypto/JSPublicKeyObject.cpp @@ -2,7 +2,7 @@ #include "JSPublicKeyObjectPrototype.h" #include "JSKeyObjectConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSSecretKeyObject.cpp b/src/jsc/bindings/node/crypto/JSSecretKeyObject.cpp index d125fb90ac3..f10ac528f25 100644 --- a/src/jsc/bindings/node/crypto/JSSecretKeyObject.cpp +++ b/src/jsc/bindings/node/crypto/JSSecretKeyObject.cpp @@ -2,7 +2,7 @@ #include "JSSecretKeyObjectPrototype.h" #include "JSSecretKeyObjectConstructor.h" #include "DOMIsoSubspaces.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/jsc/bindings/node/crypto/JSSign.cpp b/src/jsc/bindings/node/crypto/JSSign.cpp index 91d52748e04..e555f315080 100644 --- a/src/jsc/bindings/node/crypto/JSSign.cpp +++ b/src/jsc/bindings/node/crypto/JSSign.cpp @@ -2,7 +2,7 @@ #include "JavaScriptCore/JSArrayBufferView.h" #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/JSType.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "JSDOMExceptionHandling.h" #include @@ -491,11 +491,11 @@ JSC_DEFINE_HOST_FUNCTION(constructSign, (JSC::JSGlobalObject * globalObject, JSC JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSSignClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSSignClassStructure.get(rustGlobalObject); JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSSignClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSSignClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor Sign cannot be invoked without 'new'"_s); return {}; diff --git a/src/jsc/bindings/node/crypto/JSVerify.cpp b/src/jsc/bindings/node/crypto/JSVerify.cpp index 4b493c1878e..b93bf5f27c9 100644 --- a/src/jsc/bindings/node/crypto/JSVerify.cpp +++ b/src/jsc/bindings/node/crypto/JSVerify.cpp @@ -3,7 +3,7 @@ #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/JSType.h" #include "SubtleCrypto.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include "JSDOMExceptionHandling.h" #include diff --git a/src/jsc/bindings/node/crypto/KeyObject.cpp b/src/jsc/bindings/node/crypto/KeyObject.cpp index b2a44dc72c6..cc1fc237d9a 100644 --- a/src/jsc/bindings/node/crypto/KeyObject.cpp +++ b/src/jsc/bindings/node/crypto/KeyObject.cpp @@ -2,7 +2,7 @@ #include "JSPublicKeyObject.h" #include "JSPrivateKeyObject.h" #include "helpers.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "CryptoUtil.h" #include "ErrorCode.h" #include "NodeValidator.h" diff --git a/src/jsc/bindings/node/crypto/node_crypto_binding.cpp b/src/jsc/bindings/node/crypto/node_crypto_binding.cpp index e8c2d019dad..d8c7e935478 100644 --- a/src/jsc/bindings/node/crypto/node_crypto_binding.cpp +++ b/src/jsc/bindings/node/crypto/node_crypto_binding.cpp @@ -3,7 +3,7 @@ #include "JavaScriptCore/JSArrayBufferView.h" #include "JavaScriptCore/JSCJSValue.h" #include "JavaScriptCore/JSCast.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "webcrypto/JSCryptoKey.h" #include "webcrypto/JSSubtleCrypto.h" #include "webcrypto/CryptoKeyOKP.h" @@ -197,7 +197,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCertExportChallenge, (JSC::JSGlobalObject * lexicalGl return JSValue::encode(jsEmptyString(vm)); } - auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTF::move(result), 0, cert.len); + auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTF::move(result), 0, cert.len); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(bufferResult); @@ -322,7 +322,7 @@ JSC_DEFINE_HOST_FUNCTION(jsGetCipherInfo, (JSC::JSGlobalObject * lexicalGlobalOb return JSValue::encode(result); } -JSValue createNodeCryptoBinding(Zig::GlobalObject* globalObject) +JSValue createNodeCryptoBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); JSObject* obj = constructEmptyObject(globalObject); diff --git a/src/jsc/bindings/node/crypto/node_crypto_binding.h b/src/jsc/bindings/node/crypto/node_crypto_binding.h index 252784808ff..1f7c77f15ac 100644 --- a/src/jsc/bindings/node/crypto/node_crypto_binding.h +++ b/src/jsc/bindings/node/crypto/node_crypto_binding.h @@ -7,6 +7,6 @@ namespace Bun { -JSC::JSValue createNodeCryptoBinding(Zig::GlobalObject* globalObject); +JSC::JSValue createNodeCryptoBinding(Rust::GlobalObject* globalObject); } // namespace Bun diff --git a/src/jsc/bindings/node/http/JSConnectionsListConstructor.cpp b/src/jsc/bindings/node/http/JSConnectionsListConstructor.cpp index 1ecf281e1d8..e9300d7babe 100644 --- a/src/jsc/bindings/node/http/JSConnectionsListConstructor.cpp +++ b/src/jsc/bindings/node/http/JSConnectionsListConstructor.cpp @@ -1,6 +1,6 @@ #include "JSConnectionsListConstructor.h" #include "JSConnectionsList.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include namespace Bun { diff --git a/src/jsc/bindings/node/http/JSHTTPParserConstructor.cpp b/src/jsc/bindings/node/http/JSHTTPParserConstructor.cpp index d1838b079ea..0b2c67a74e8 100644 --- a/src/jsc/bindings/node/http/JSHTTPParserConstructor.cpp +++ b/src/jsc/bindings/node/http/JSHTTPParserConstructor.cpp @@ -1,6 +1,6 @@ #include "JSHTTPParserConstructor.h" #include "JSHTTPParser.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ProcessBindingHTTPParser.h" namespace Bun { diff --git a/src/jsc/bindings/node/http/JSHTTPParserPrototype.cpp b/src/jsc/bindings/node/http/JSHTTPParserPrototype.cpp index 8ccb5df4ace..8746e76320c 100644 --- a/src/jsc/bindings/node/http/JSHTTPParserPrototype.cpp +++ b/src/jsc/bindings/node/http/JSHTTPParserPrototype.cpp @@ -1,7 +1,7 @@ #include "JSHTTPParserPrototype.h" #include "JSHTTPParser.h" #include "JSConnectionsList.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMExceptionHandling.h" #include diff --git a/src/jsc/bindings/node/http/NodeHTTPParser.cpp b/src/jsc/bindings/node/http/NodeHTTPParser.cpp index 487210cdd51..79ab12cf871 100644 --- a/src/jsc/bindings/node/http/NodeHTTPParser.cpp +++ b/src/jsc/bindings/node/http/NodeHTTPParser.cpp @@ -3,7 +3,7 @@ #include "helpers.h" #include "JSConnectionsList.h" #include "JSHTTPParser.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "uv.h" namespace Bun { diff --git a/src/jsc/bindings/objects.h b/src/jsc/bindings/objects.h index 246cc3fc577..7fdb0c42192 100644 --- a/src/jsc/bindings/objects.h +++ b/src/jsc/bindings/objects.h @@ -7,7 +7,7 @@ // // #include -// namespace Zig { +// namespace Rust { // class ModulePrototype final : public JSC::JSNonFinalObject { // public: @@ -23,10 +23,10 @@ // return &vm.plainObjectSpace; // } -// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) +// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* rustBase) // { // ModulePrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) ModulePrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); +// !!rustBase ? object->finishCreation(vm, globalObject, rustBase) : object->finishCreation(vm, globalObject); // return object; // } @@ -38,13 +38,13 @@ // return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); // } -// void* m_zigBase; +// void* m_rustBase; // private: // ModulePrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; +// m_rustBase = nullptr; // }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); +// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* rustBase); // void finishCreation(JSC::VM&, JSC::JSGlobalObject*); // }; @@ -63,10 +63,10 @@ // return &vm.plainObjectSpace; // } -// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) +// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* rustBase) // { // ModulePrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) ModulePrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); +// !!rustBase ? object->finishCreation(vm, globalObject, rustBase) : object->finishCreation(vm, globalObject); // return object; // } @@ -78,20 +78,20 @@ // return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); // } -// void* m_zigBase; +// void* m_rustBase; // private: // ModulePrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; +// m_rustBase = nullptr; // }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); +// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* rustBase); // void finishCreation(JSC::VM&, JSC::JSGlobalObject*); // }; // } -// namespace Zig { +// namespace Rust { // class HeadersPrototype final : public JSC::JSNonFinalObject { // public: @@ -107,10 +107,10 @@ // return &vm.plainObjectSpace; // } -// static HeadersPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) +// static HeadersPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* rustBase) // { // HeadersPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) HeadersPrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); +// !!rustBase ? object->finishCreation(vm, globalObject, rustBase) : object->finishCreation(vm, globalObject); // return object; // } @@ -135,13 +135,13 @@ // return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); // } -// void* m_zigBase; +// void* m_rustBase; // private: // HeadersPrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; +// m_rustBase = nullptr; // }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); +// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* rustBase); // void finishCreation(JSC::VM&, JSC::JSGlobalObject*); // }; @@ -218,10 +218,10 @@ // return &vm.plainObjectSpace; // } -// static RequestPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) +// static RequestPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* rustBase) // { // RequestPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) RequestPrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); +// !!rustBase ? object->finishCreation(vm, globalObject, rustBase) : object->finishCreation(vm, globalObject); // return object; // } @@ -240,13 +240,13 @@ // return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); // } -// void* m_zigBase; +// void* m_rustBase; // private: // RequestPrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; +// m_rustBase = nullptr; // }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); +// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* rustBase); // void finishCreation(JSC::VM&, JSC::JSGlobalObject*); // }; diff --git a/src/jsc/bindings/root-pch.h b/src/jsc/bindings/root-pch.h index d4614fee3aa..ea8a298c9b1 100644 --- a/src/jsc/bindings/root-pch.h +++ b/src/jsc/bindings/root-pch.h @@ -8,7 +8,7 @@ // root.h is guaranteed to be the first thing parsed (the PCH wrapper // force-includes it). If they lived in root.h itself, a TU whose first // explicit include is BunClientData.h would re-enter root.h mid-parse and -// reach ZigGlobalObject.h before WebCore::clientData() is declared. The PCH +// reach RustGlobalObject.h before WebCore::clientData() is declared. The PCH // path is fine; --unifiedSources=false would not be. #include "root.h" @@ -17,4 +17,4 @@ // (-ftime-trace). Editing either already triggers a near-full rebuild via // depfiles, so precompiling them costs nothing extra incrementally. #include "BunClientData.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" diff --git a/src/jsc/bindings/root.h b/src/jsc/bindings/root.h index 93e70d3859c..796b9ff7242 100644 --- a/src/jsc/bindings/root.h +++ b/src/jsc/bindings/root.h @@ -99,7 +99,7 @@ #endif // can be nothrow | zero_is_throw | check_slow -#define ZIG_EXPORT(...) -#define ZIG_NONNULL +#define RUST_EXPORT(...) +#define RUST_NONNULL #endif diff --git a/src/jsc/bindings/sliceAnsi.cpp b/src/jsc/bindings/sliceAnsi.cpp index 600b5764a90..d3b1f10f88d 100644 --- a/src/jsc/bindings/sliceAnsi.cpp +++ b/src/jsc/bindings/sliceAnsi.cpp @@ -6,7 +6,7 @@ #include #include -// Zig exports for visible width and grapheme break +// Rust exports for visible width and grapheme break extern "C" uint8_t Bun__codepointWidth(uint32_t cp, bool ambiguous_as_wide); extern "C" bool Bun__graphemeBreak(uint32_t cp1, uint32_t cp2, uint8_t* state); extern "C" bool Bun__isEmojiPresentation(uint32_t cp); @@ -17,13 +17,13 @@ namespace Bun { using namespace WTF; // Shared SIMD/SGR helpers live in ANSIHelpers.h. We keep a local -// GraphemeWidthState mirror of visible.zig's GraphemeState because these are +// GraphemeWidthState mirror of visible.rust's GraphemeState because these are // called per-codepoint in the hot loop — extern-call overhead would hurt more // than the ~80 lines of duplication. Drift is caught by tests that assert // Bun.stringWidth(s) == width of Bun.sliceAnsi(s, 0, N) for edge cases. // ============================================================================ -// Grapheme-aware Visible Width (mirrors visible.zig GraphemeState; see above) +// Grapheme-aware Visible Width (mirrors visible.rust GraphemeState; see above) // ============================================================================ struct GraphemeWidthState { @@ -86,7 +86,7 @@ struct GraphemeWidthState { if (keycap) return 2; if (regionalIndicator) - return 1; // Single (unpaired) regional indicator is width 1 — matches visible.zig + return 1; // Single (unpaired) regional indicator is width 1 — matches visible.rust if (emojiBase && (skinTone || zwj)) return 2; if (vs15 || vs16) { @@ -101,7 +101,7 @@ struct GraphemeWidthState { } return 1; } - // Match visible.zig GraphemeState.width() exactly: return accumulated width + // Match visible.rust GraphemeState.width() exactly: return accumulated width // (may be 0 for zero-width-only clusters like U+200B ZWSP). return static_cast(nonEmojiWidth); } diff --git a/src/jsc/bindings/sqlite/JSSQLStatement.cpp b/src/jsc/bindings/sqlite/JSSQLStatement.cpp index 2b71e5266f8..7961b7bbe60 100644 --- a/src/jsc/bindings/sqlite/JSSQLStatement.cpp +++ b/src/jsc/bindings/sqlite/JSSQLStatement.cpp @@ -1601,7 +1601,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementPrepareStatementFunction, (JSC::JSGlobalO int64_t memoryChange = sqlite_malloc_amount - currentMemoryUsage; JSSQLStatement* sqlStatement = JSSQLStatement::create( - static_cast(lexicalGlobalObject), statement, databases()[handle], memoryChange); + static_cast(lexicalGlobalObject), statement, databases()[handle], memoryChange); if (internalFlagsValue.isInt32()) { const int32_t internalFlags = internalFlagsValue.asInt32(); @@ -1862,7 +1862,7 @@ void JSSQLStatementConstructor::finishCreation(VM& vm) Base::finishCreation(vm); // TODO: use LazyClassStructure? - auto* instanceObject = JSSQLStatement::create(static_cast(globalObject()), nullptr, nullptr); + auto* instanceObject = JSSQLStatement::create(static_cast(globalObject()), nullptr, nullptr); JSValue proto = instanceObject->getPrototype(globalObject()); this->putDirect(vm, vm.propertyNames->prototype, proto, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); @@ -2811,7 +2811,7 @@ void JSSQLStatement::visitOutputConstraints(JSCell* cell, Visitor& visitor) template void JSSQLStatement::visitOutputConstraints(JSCell*, AbstractSlotVisitor&); template void JSSQLStatement::visitOutputConstraints(JSCell*, SlotVisitor&); -JSValue createJSSQLStatementConstructor(Zig::GlobalObject* globalObject) +JSValue createJSSQLStatementConstructor(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); JSObject* object = JSC::constructEmptyObject(globalObject); diff --git a/src/jsc/bindings/sqlite/JSSQLStatement.h b/src/jsc/bindings/sqlite/JSSQLStatement.h index 975ccbacd34..68a1ae6e91d 100644 --- a/src/jsc/bindings/sqlite/JSSQLStatement.h +++ b/src/jsc/bindings/sqlite/JSSQLStatement.h @@ -26,7 +26,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include #include @@ -84,6 +84,6 @@ class JSSQLStatementConstructor final : public JSC::JSFunction { static_assert(sizeof(JSSQLStatementConstructor) == sizeof(JSFunction), "Allocate JSSQLStatementConstructor in JSFunction IsoSubspace"); Structure* createJSSQLStatementStructure(JSGlobalObject* globalObject); -JSValue createJSSQLStatementConstructor(Zig::GlobalObject* globalObject); +JSValue createJSSQLStatementConstructor(Rust::GlobalObject* globalObject); } // namespace WebCore diff --git a/src/jsc/bindings/v8/AGENTS.md b/src/jsc/bindings/v8/AGENTS.md index 27ecc27d658..6e58b1e79d3 100644 --- a/src/jsc/bindings/v8/AGENTS.md +++ b/src/jsc/bindings/v8/AGENTS.md @@ -101,11 +101,11 @@ Local NewClass::New(Isolate* isolate, /* parameters */) For each new C++ method, you must add the mangled symbol names to multiple files: -#### a. Add to `src/napi/napi.zig` +#### a. Add to `src/napi/napi.rust` Find the `V8API` struct (around line 1801) and add entries for both GCC/Clang and MSVC: -```zig +```rust const V8API = if (!bun.Environment.isWindows) struct { // ... existing functions ... pub extern fn _ZN2v88NewClass3NewEPNS_7IsolateE/* parameters */() *anyopaque; @@ -278,7 +278,7 @@ 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. +**Symbol Not Found**: Ensure mangled names are correctly added to `napi.rust` and symbol files. **Segmentation Fault**: Usually indicates inline V8 functions are reading incorrect memory layouts. Check `Map` setup and `ObjectLayout` structure. diff --git a/src/jsc/bindings/v8/CLAUDE.md b/src/jsc/bindings/v8/CLAUDE.md index 27ecc27d658..6e58b1e79d3 100644 --- a/src/jsc/bindings/v8/CLAUDE.md +++ b/src/jsc/bindings/v8/CLAUDE.md @@ -101,11 +101,11 @@ Local NewClass::New(Isolate* isolate, /* parameters */) For each new C++ method, you must add the mangled symbol names to multiple files: -#### a. Add to `src/napi/napi.zig` +#### a. Add to `src/napi/napi.rust` Find the `V8API` struct (around line 1801) and add entries for both GCC/Clang and MSVC: -```zig +```rust const V8API = if (!bun.Environment.isWindows) struct { // ... existing functions ... pub extern fn _ZN2v88NewClass3NewEPNS_7IsolateE/* parameters */() *anyopaque; @@ -278,7 +278,7 @@ 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. +**Symbol Not Found**: Ensure mangled names are correctly added to `napi.rust` and symbol files. **Segmentation Fault**: Usually indicates inline V8 functions are reading incorrect memory layouts. Check `Map` setup and `ObjectLayout` structure. diff --git a/src/jsc/bindings/v8/V8Array.cpp b/src/jsc/bindings/v8/V8Array.cpp index 2e6dcf09eea..79526953b47 100644 --- a/src/jsc/bindings/v8/V8Array.cpp +++ b/src/jsc/bindings/v8/V8Array.cpp @@ -25,7 +25,7 @@ namespace v8 { // Array::New with elements and length Local Array::New(Isolate* isolate, Local* elements, size_t length) { - Zig::GlobalObject* globalObject = isolate->globalObject(); + Rust::GlobalObject* globalObject = isolate->globalObject(); auto& vm = isolate->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -53,7 +53,7 @@ Local Array::New(Isolate* isolate, Local* elements, size_t length) // Array::New with just length Local Array::New(Isolate* isolate, int length) { - Zig::GlobalObject* globalObject = isolate->globalObject(); + Rust::GlobalObject* globalObject = isolate->globalObject(); auto& vm = isolate->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -69,7 +69,7 @@ MaybeLocal Array::New(Local context, size_t length, std::function()> next_value_callback) { Isolate* isolate = context->GetIsolate(); - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); auto& vm = isolate->vm(); EscapableHandleScope handleScope(isolate); @@ -123,7 +123,7 @@ void Array::CheckCast(Value* obj) Maybe Array::Iterate(Local context, IterationCallback callback, void* callback_data) { const JSArray* jsArray = localToObjectPointer(); - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); auto& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); diff --git a/src/jsc/bindings/v8/V8Context.h b/src/jsc/bindings/v8/V8Context.h index c92ca0dfdd8..b0363a150a2 100644 --- a/src/jsc/bindings/v8/V8Context.h +++ b/src/jsc/bindings/v8/V8Context.h @@ -1,13 +1,13 @@ #pragma once -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "V8Data.h" namespace v8 { class Isolate; -// Context is always a reinterpret pointer to Zig::GlobalObject, so that functions accepting a +// Context is always a reinterpret pointer to Rust::GlobalObject, so that functions accepting a // Context can quickly access JSC data class Context : public Data { public: @@ -18,14 +18,14 @@ class Context : public Data { return localToCell()->vm(); } - const Zig::GlobalObject* globalObject() const + const Rust::GlobalObject* globalObject() const { - return dynamicDowncast(localToCell()); + return dynamicDowncast(localToCell()); } - Zig::GlobalObject* globalObject() + Rust::GlobalObject* globalObject() { - return dynamicDowncast(localToCell()); + return dynamicDowncast(localToCell()); } HandleScope* currentHandleScope() const diff --git a/src/jsc/bindings/v8/V8Function.cpp b/src/jsc/bindings/v8/V8Function.cpp index 9277e184f58..0328c6547ec 100644 --- a/src/jsc/bindings/v8/V8Function.cpp +++ b/src/jsc/bindings/v8/V8Function.cpp @@ -29,7 +29,7 @@ Local Function::GetName() const RELEASE_ASSERT_NOT_REACHED("v8::Function::GetName called on invalid type"); } - auto* globalObject = uncheckedDowncast(localToObjectPointer()->globalObject()); + auto* globalObject = uncheckedDowncast(localToObjectPointer()->globalObject()); auto* handleScope = globalObject->V8GlobalInternals()->currentHandleScope(); auto* jsString = JSC::jsString(globalObject->vm(), wtfString); return handleScope->createLocal(globalObject->vm(), jsString); diff --git a/src/jsc/bindings/v8/V8Isolate.cpp b/src/jsc/bindings/v8/V8Isolate.cpp index 2f6928b49a8..32e393a9515 100644 --- a/src/jsc/bindings/v8/V8Isolate.cpp +++ b/src/jsc/bindings/v8/V8Isolate.cpp @@ -1,7 +1,7 @@ #include "V8Isolate.h" #include "V8HandleScope.h" #include "shim/GlobalInternals.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "real_v8.h" #include "v8_compatibility_assertions.h" diff --git a/src/jsc/bindings/v8/V8Isolate.h b/src/jsc/bindings/v8/V8Isolate.h index 5069cbd3e94..40e23e78d4f 100644 --- a/src/jsc/bindings/v8/V8Isolate.h +++ b/src/jsc/bindings/v8/V8Isolate.h @@ -34,7 +34,7 @@ class Isolate final { BUN_EXPORT Local GetCurrentContext(); - Zig::GlobalObject* globalObject() { return m_globalObject; } + Rust::GlobalObject* globalObject() { return m_globalObject; } JSC::VM& vm() { return globalObject()->vm(); } shim::GlobalInternals* globalInternals() { return m_globalInternals; } HandleScope* currentHandleScope(); @@ -48,7 +48,7 @@ class Isolate final { TaggedPointer* falseSlot() { return &m_roots[Isolate::kFalseValueRootIndex]; } shim::GlobalInternals* m_globalInternals; - Zig::GlobalObject* m_globalObject; + Rust::GlobalObject* m_globalObject; uintptr_t m_padding[78]; diff --git a/src/jsc/bindings/v8/V8Object.cpp b/src/jsc/bindings/v8/V8Object.cpp index a244f62adc7..dd63020ab9f 100644 --- a/src/jsc/bindings/v8/V8Object.cpp +++ b/src/jsc/bindings/v8/V8Object.cpp @@ -39,7 +39,7 @@ Local Object::New(Isolate* isolate) Maybe Object::Set(Local context, Local key, Local value) { - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); JSObject* object = localToObjectPointer(); JSValue k = key->localToJSValue(); JSValue v = value->localToJSValue(); @@ -60,7 +60,7 @@ Maybe Object::Set(Local context, Local key, Local v Maybe Object::Set(Local context, uint32_t index, Local value) { - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); JSObject* object = localToObjectPointer(); JSValue v = value->localToJSValue(); auto& vm = JSC::getVM(globalObject); @@ -77,7 +77,7 @@ Maybe Object::Set(Local context, uint32_t index, Local val MaybeLocal Object::Get(Local context, Local key) { - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); JSObject* object = localToObjectPointer(); JSValue k = key->localToJSValue(); auto& vm = JSC::getVM(globalObject); @@ -98,7 +98,7 @@ MaybeLocal Object::Get(Local context, Local key) MaybeLocal Object::Get(Local context, uint32_t index) { - Zig::GlobalObject* globalObject = context->globalObject(); + Rust::GlobalObject* globalObject = context->globalObject(); JSObject* object = localToObjectPointer(); auto& vm = JSC::getVM(globalObject); @@ -119,7 +119,7 @@ void Object::SetInternalField(int index, Local data) RELEASE_ASSERT(fields, "object has no internal fields"); RELEASE_ASSERT(index >= 0 && index < fields->size(), "internal field index is out of bounds"); JSObject* js_object = localToObjectPointer(); - auto* globalObject = dynamicDowncast(js_object->globalObject()); + auto* globalObject = dynamicDowncast(js_object->globalObject()); fields->at(index).set(globalObject->vm(), localToCell(), data->localToJSValue()); } @@ -132,7 +132,7 @@ Local Object::SlowGetInternalField(int index) { auto* fields = getInternalFieldsContainer(this); JSObject* js_object = localToObjectPointer(); - auto* globalObject = dynamicDowncast(js_object->globalObject()); + auto* globalObject = dynamicDowncast(js_object->globalObject()); HandleScope* handleScope = globalObject->V8GlobalInternals()->currentHandleScope(); if (fields && index >= 0 && index < fields->size()) { auto& field = fields->at(index); diff --git a/src/jsc/bindings/v8/shim/FunctionTemplate.cpp b/src/jsc/bindings/v8/shim/FunctionTemplate.cpp index 6de66fabebf..3b0774a5db1 100644 --- a/src/jsc/bindings/v8/shim/FunctionTemplate.cpp +++ b/src/jsc/bindings/v8/shim/FunctionTemplate.cpp @@ -59,7 +59,7 @@ JSC::EncodedJSValue FunctionTemplate::functionCall(JSC::JSGlobalObject* globalOb { auto* callee = dynamicDowncast(callFrame->jsCallee()); auto* functionTemplate = callee->functionTemplate(); - auto* isolate = uncheckedDowncast(globalObject)->V8GlobalInternals()->isolate(); + auto* isolate = uncheckedDowncast(globalObject)->V8GlobalInternals()->isolate(); auto& vm = JSC::getVM(globalObject); WTF::Vector args(callFrame->argumentCount() + 1); @@ -88,7 +88,7 @@ JSC::EncodedJSValue FunctionTemplate::functionCall(JSC::JSGlobalObject* globalOb ImplicitArgs implicit_args = { .unused = nullptr, .isolate = isolate, - // Context is always a reinterpret pointer to Zig::GlobalObject + // Context is always a reinterpret pointer to Rust::GlobalObject .context = reinterpret_cast(globalObject), .return_value = TaggedPointer(), // target holds the Function being called, which contains the FunctionTemplate diff --git a/src/jsc/bindings/v8/shim/GlobalInternals.cpp b/src/jsc/bindings/v8/shim/GlobalInternals.cpp index 7145ecf8ce4..a8e7b42e5ee 100644 --- a/src/jsc/bindings/v8/shim/GlobalInternals.cpp +++ b/src/jsc/bindings/v8/shim/GlobalInternals.cpp @@ -24,7 +24,7 @@ namespace JSCastingHelpers = JSC::JSCastingHelpers; const ClassInfo GlobalInternals::s_info = { "GlobalInternals"_s, nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(GlobalInternals) }; -GlobalInternals* GlobalInternals::create(VM& vm, Structure* structure, Zig::GlobalObject* globalObject) +GlobalInternals* GlobalInternals::create(VM& vm, Structure* structure, Rust::GlobalObject* globalObject) { GlobalInternals* internals = new (NotNull, JSC::allocateCell(vm)) GlobalInternals(vm, structure, globalObject); internals->finishCreation(vm); diff --git a/src/jsc/bindings/v8/shim/GlobalInternals.h b/src/jsc/bindings/v8/shim/GlobalInternals.h index e55ac4af20f..307f4bec56b 100644 --- a/src/jsc/bindings/v8/shim/GlobalInternals.h +++ b/src/jsc/bindings/v8/shim/GlobalInternals.h @@ -17,7 +17,7 @@ class GlobalInternals : public JSC::JSCell { public: using Base = JSC::JSCell; - static GlobalInternals* create(JSC::VM& vm, JSC::Structure* structure, Zig::GlobalObject* globalObject); + static GlobalInternals* create(JSC::VM& vm, JSC::Structure* structure, Rust::GlobalObject* globalObject); static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -72,7 +72,7 @@ class GlobalInternals : public JSC::JSCell { friend class ::v8::Context; private: - Zig::GlobalObject* m_globalObject; + Rust::GlobalObject* m_globalObject; JSC::LazyClassStructure m_objectTemplateStructure; JSC::LazyClassStructure m_handleScopeBufferStructure; JSC::LazyClassStructure m_functionTemplateStructure; @@ -88,7 +88,7 @@ class GlobalInternals : public JSC::JSCell { Isolate m_isolate; void finishCreation(JSC::VM& vm); - GlobalInternals(JSC::VM& vm, JSC::Structure* structure, Zig::GlobalObject* globalObject) + GlobalInternals(JSC::VM& vm, JSC::Structure* structure, Rust::GlobalObject* globalObject) : Base(vm, structure) , m_currentHandleScope(nullptr) , m_undefinedValue(Oddball::Kind::kUndefined) diff --git a/src/jsc/bindings/v8/v8.h b/src/jsc/bindings/v8/v8.h index 8ed2c62f8a2..8a66a714eb8 100644 --- a/src/jsc/bindings/v8/v8.h +++ b/src/jsc/bindings/v8/v8.h @@ -1,6 +1,6 @@ #pragma once -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #define V8_UNIMPLEMENTED() \ do { \ diff --git a/src/jsc/bindings/webcore/AbortController.h b/src/jsc/bindings/webcore/AbortController.h index 580f6810ea8..030a983b629 100644 --- a/src/jsc/bindings/webcore/AbortController.h +++ b/src/jsc/bindings/webcore/AbortController.h @@ -27,7 +27,7 @@ #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ScriptWrappable.h" #include @@ -37,7 +37,7 @@ namespace JSC { class JSValue; } -namespace Zig { +namespace Rust { class GlobalObject; } @@ -58,7 +58,7 @@ class AbortController final : public ScriptWrappable, public RefCounted protectedSignal() const; - void abort(Zig::GlobalObject&, JSC::JSValue reason); + void abort(Rust::GlobalObject&, JSC::JSValue reason); WebCoreOpaqueRoot opaqueRoot(); diff --git a/src/jsc/bindings/webcore/AbortSignal.h b/src/jsc/bindings/webcore/AbortSignal.h index 1442edfe880..2bac972ccf6 100644 --- a/src/jsc/bindings/webcore/AbortSignal.h +++ b/src/jsc/bindings/webcore/AbortSignal.h @@ -31,7 +31,7 @@ #include "EventTarget.h" #include "JSValueInWrappedObject.h" #include "JavaScriptCore/JSGlobalObject.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "wtf/DebugHeap.h" #include "wtf/FastMalloc.h" #include diff --git a/src/jsc/bindings/webcore/DOMClientIsoSubspaces.h b/src/jsc/bindings/webcore/DOMClientIsoSubspaces.h index f14c788bd57..30eeb0a6b91 100644 --- a/src/jsc/bindings/webcore/DOMClientIsoSubspaces.h +++ b/src/jsc/bindings/webcore/DOMClientIsoSubspaces.h @@ -76,7 +76,7 @@ class DOMClientIsoSubspaces { std::unique_ptr m_clientSubspaceForWasmStreamingCompiler; std::unique_ptr m_clientSubspaceForJSWebView; -#include "ZigGeneratedClasses+DOMClientIsoSubspaces.h" +#include "RustGeneratedClasses+DOMClientIsoSubspaces.h" /* --- bun --- */ std::unique_ptr m_clientSubspaceForDOMException; diff --git a/src/jsc/bindings/webcore/DOMIsoSubspaces.h b/src/jsc/bindings/webcore/DOMIsoSubspaces.h index c67afb40065..5200b0d0168 100644 --- a/src/jsc/bindings/webcore/DOMIsoSubspaces.h +++ b/src/jsc/bindings/webcore/DOMIsoSubspaces.h @@ -72,7 +72,7 @@ class DOMIsoSubspaces { std::unique_ptr m_subspaceForJSNodePerformanceHooksHistogram; std::unique_ptr m_subspaceForWasmStreamingCompiler; std::unique_ptr m_subspaceForJSWebView; -#include "ZigGeneratedClasses+DOMIsoSubspaces.h" +#include "RustGeneratedClasses+DOMIsoSubspaces.h" /*-- BUN --*/ // std::unique_ptr m_subspaceForTouch; @@ -926,7 +926,7 @@ class DOMIsoSubspaces { std::unique_ptr m_subspaceForEventTarget; std::unique_ptr m_subspaceForEventEmitter; - std::unique_ptr m_subspaceForZigGlobalObject; + std::unique_ptr m_subspaceForRustGlobalObject; std::unique_ptr m_subspaceForExposedToWorkerAndWindow; std::unique_ptr m_subspaceForURLSearchParams; diff --git a/src/jsc/bindings/webcore/JSCallbackData.cpp b/src/jsc/bindings/webcore/JSCallbackData.cpp index afb8caffb8b..cd1966e7f1f 100644 --- a/src/jsc/bindings/webcore/JSCallbackData.cpp +++ b/src/jsc/bindings/webcore/JSCallbackData.cpp @@ -28,7 +28,7 @@ #include "config.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSCallbackData.h" diff --git a/src/jsc/bindings/webcore/JSDOMConstructorBase.h b/src/jsc/bindings/webcore/JSDOMConstructorBase.h index 6bd8ba5e894..979296e118c 100644 --- a/src/jsc/bindings/webcore/JSDOMConstructorBase.h +++ b/src/jsc/bindings/webcore/JSDOMConstructorBase.h @@ -22,7 +22,7 @@ #include "JSDOMGlobalObject.h" #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" namespace WebCore { diff --git a/src/jsc/bindings/webcore/JSDOMConvertBase.h b/src/jsc/bindings/webcore/JSDOMConvertBase.h index d67a7135059..55b059d167b 100644 --- a/src/jsc/bindings/webcore/JSDOMConvertBase.h +++ b/src/jsc/bindings/webcore/JSDOMConvertBase.h @@ -26,7 +26,7 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMGlobalObject.h" #include "JSDOMExceptionHandling.h" #include "JSDOMConvertResult.h" diff --git a/src/jsc/bindings/webcore/JSDOMFormData.cpp b/src/jsc/bindings/webcore/JSDOMFormData.cpp index 6a82857015f..7dd8207ad17 100644 --- a/src/jsc/bindings/webcore/JSDOMFormData.cpp +++ b/src/jsc/bindings/webcore/JSDOMFormData.cpp @@ -54,7 +54,7 @@ #include #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "GCDefferalContext.h" namespace WebCore { diff --git a/src/jsc/bindings/webcore/JSDOMGlobalObjectInlines.h b/src/jsc/bindings/webcore/JSDOMGlobalObjectInlines.h index 313b14aa206..65885f2ce93 100644 --- a/src/jsc/bindings/webcore/JSDOMGlobalObjectInlines.h +++ b/src/jsc/bindings/webcore/JSDOMGlobalObjectInlines.h @@ -32,14 +32,14 @@ namespace WebCore { template -inline JSC::JSObject* getDOMConstructor(JSC::VM& vm, const Zig::GlobalObject& globalObject) +inline JSC::JSObject* getDOMConstructor(JSC::VM& vm, const Rust::GlobalObject& globalObject) { - // No locking is necessary unless we need to add a new constructor to Zig::GlobalObject::constructors(). + // No locking is necessary unless we need to add a new constructor to Rust::GlobalObject::constructors(). if (JSC::JSObject* constructor = globalObject.constructors().array()[static_cast(constructorID)].get()) return constructor; - JSC::JSObject* constructor = ConstructorClass::create(vm, ConstructorClass::createStructure(vm, const_cast(globalObject), ConstructorClass::prototypeForStructure(vm, globalObject)), const_cast(globalObject)); + JSC::JSObject* constructor = ConstructorClass::create(vm, ConstructorClass::createStructure(vm, const_cast(globalObject), ConstructorClass::prototypeForStructure(vm, globalObject)), const_cast(globalObject)); ASSERT(!globalObject.constructors().array()[static_cast(constructorID)].get()); - Zig::GlobalObject& mutableGlobalObject = const_cast(globalObject); + Rust::GlobalObject& mutableGlobalObject = const_cast(globalObject); mutableGlobalObject.constructors().array()[static_cast(constructorID)].set(vm, &globalObject, constructor); return constructor; } diff --git a/src/jsc/bindings/webcore/JSErrorEvent.cpp b/src/jsc/bindings/webcore/JSErrorEvent.cpp index f23fd3bfd67..c6101885fe0 100644 --- a/src/jsc/bindings/webcore/JSErrorEvent.cpp +++ b/src/jsc/bindings/webcore/JSErrorEvent.cpp @@ -21,7 +21,7 @@ #include "config.h" #include "JSErrorEvent.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ActiveDOMObject.h" #include "ExtendedDOMClientIsoSubspaces.h" diff --git a/src/jsc/bindings/webcore/JSEventEmitter.cpp b/src/jsc/bindings/webcore/JSEventEmitter.cpp index 25168b83f17..9de2e8418e9 100644 --- a/src/jsc/bindings/webcore/JSEventEmitter.cpp +++ b/src/jsc/bindings/webcore/JSEventEmitter.cpp @@ -151,7 +151,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventEmitterDOMConstru } Structure* structure = JSEventEmitter::createStructure(vm, lexicalGlobalObject, jsValue); JSEventEmitter* instance - = JSEventEmitter::create(structure, static_cast(lexicalGlobalObject), object.copyRef()); + = JSEventEmitter::create(structure, static_cast(lexicalGlobalObject), object.copyRef()); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSValue::encode(instance)); } diff --git a/src/jsc/bindings/webcore/JSEventEmitterCustom.cpp b/src/jsc/bindings/webcore/JSEventEmitterCustom.cpp index 1e29e1a25aa..b269407206d 100644 --- a/src/jsc/bindings/webcore/JSEventEmitterCustom.cpp +++ b/src/jsc/bindings/webcore/JSEventEmitterCustom.cpp @@ -4,7 +4,7 @@ #include "EventEmitter.h" #include "JSDOMWrapperCache.h" #include "JSEventListener.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "JSDOMConstructor.h" #include "JSDOMConvertBase.h" @@ -67,7 +67,7 @@ JSEventEmitter* jsEventEmitterCastFast(VM& vm, JSC::JSGlobalObject* lexicalGloba // TODO: properly propagate exception upwards (^ getIfPropertyExists) auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm); - auto* globalObject = static_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); auto impl = EventEmitter::create(*globalObject->scriptExecutionContext()); impl->setThisObject(thisObject); diff --git a/src/jsc/bindings/webcore/JSEventListener.cpp b/src/jsc/bindings/webcore/JSEventListener.cpp index e1d7f4eb3eb..fd240bfd3e1 100644 --- a/src/jsc/bindings/webcore/JSEventListener.cpp +++ b/src/jsc/bindings/webcore/JSEventListener.cpp @@ -133,7 +133,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionEmitUncaughtException, (JSC::JSGlobalObject * } JSC_DEFINE_HOST_FUNCTION(jsFunctionEmitUncaughtExceptionNextTick, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); Bun::Process* process = globalObject->processObject(); auto exception = callFrame->argument(0); auto func = JSFunction::create(globalObject->vm(), globalObject, 1, String(), jsFunctionEmitUncaughtException, JSC::ImplementationVisibility::Private); diff --git a/src/jsc/bindings/webcore/JSEventTargetCustom.cpp b/src/jsc/bindings/webcore/JSEventTargetCustom.cpp index 2dc97930715..6e8e92bdd53 100644 --- a/src/jsc/bindings/webcore/JSEventTargetCustom.cpp +++ b/src/jsc/bindings/webcore/JSEventTargetCustom.cpp @@ -76,7 +76,7 @@ JSEventTargetWrapper jsEventTargetCast(VM& vm, JSValue thisValue) if (!object) return {}; } - if (auto* global = dynamicDowncast(object)) + if (auto* global = dynamicDowncast(object)) return { global->eventTarget(), *global }; return {}; diff --git a/src/jsc/bindings/webcore/JSMIMEBindings.cpp b/src/jsc/bindings/webcore/JSMIMEBindings.cpp index e4cc9dab9d7..81ed80d994e 100644 --- a/src/jsc/bindings/webcore/JSMIMEBindings.cpp +++ b/src/jsc/bindings/webcore/JSMIMEBindings.cpp @@ -3,14 +3,14 @@ #include "JSMIMEType.h" #include "JavaScriptCore/JSObject.h" #include "JavaScriptCore/JSCJSValueInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace WebCore { using namespace JSC; // Create the combined MIME binding object with both MIMEParams and MIMEType -JSValue createMIMEBinding(Zig::GlobalObject* globalObject) +JSValue createMIMEBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); JSObject* obj = constructEmptyObject(globalObject); diff --git a/src/jsc/bindings/webcore/JSMIMEBindings.h b/src/jsc/bindings/webcore/JSMIMEBindings.h index 453364e8f14..054098b7413 100644 --- a/src/jsc/bindings/webcore/JSMIMEBindings.h +++ b/src/jsc/bindings/webcore/JSMIMEBindings.h @@ -2,13 +2,13 @@ #include "root.h" -namespace Zig { +namespace Rust { class GlobalObject; } namespace WebCore { // Function to create a unified MIME binding object -JSC::JSValue createMIMEBinding(Zig::GlobalObject* globalObject); +JSC::JSValue createMIMEBinding(Rust::GlobalObject* globalObject); } // namespace WebCore diff --git a/src/jsc/bindings/webcore/JSMIMEParams.cpp b/src/jsc/bindings/webcore/JSMIMEParams.cpp index 9ba34573cb8..3a7d59cd0c8 100644 --- a/src/jsc/bindings/webcore/JSMIMEParams.cpp +++ b/src/jsc/bindings/webcore/JSMIMEParams.cpp @@ -17,7 +17,7 @@ #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include "wtf/ASCIICType.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "NodeValidator.h" // For Bun::V:: #include "ErrorCode.h" // For Bun::ERR:: #include "JavaScriptCore/JSMapInlines.h" @@ -657,11 +657,11 @@ JSC_DEFINE_HOST_FUNCTION(constructMIMEParams, (JSGlobalObject * globalObject, Ca JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSMIMEParamsClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSMIMEParamsClassStructure.get(rustGlobalObject); JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSMIMEParamsClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSMIMEParamsClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor MIMEParams cannot be invoked without 'new'"_s); return {}; @@ -712,7 +712,7 @@ void setupJSMIMEParamsClassStructure(LazyClassStructure::Initializer& init) init.setConstructor(constructor); } -JSValue createJSMIMEBinding(Zig::GlobalObject* globalObject) +JSValue createJSMIMEBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); JSObject* obj = constructEmptyObject(globalObject); diff --git a/src/jsc/bindings/webcore/JSMIMEParams.h b/src/jsc/bindings/webcore/JSMIMEParams.h index a40bbe8fa8b..ff0dcaeeb0f 100644 --- a/src/jsc/bindings/webcore/JSMIMEParams.h +++ b/src/jsc/bindings/webcore/JSMIMEParams.h @@ -88,7 +88,7 @@ class JSMIMEParamsConstructor final : public JSC::InternalFunction { // Function to setup the structures lazily void setupJSMIMEParamsClassStructure(JSC::LazyClassStructure::Initializer&); -JSC::JSValue createJSMIMEBinding(Zig::GlobalObject* globalObject); +JSC::JSValue createJSMIMEBinding(Rust::GlobalObject* globalObject); bool parseMIMEParamsString(JSGlobalObject* globalObject, JSMap* map, StringView input); } // namespace WebCore diff --git a/src/jsc/bindings/webcore/JSMIMEType.cpp b/src/jsc/bindings/webcore/JSMIMEType.cpp index de7e66ccfe8..7e03bfaace7 100644 --- a/src/jsc/bindings/webcore/JSMIMEType.cpp +++ b/src/jsc/bindings/webcore/JSMIMEType.cpp @@ -15,7 +15,7 @@ #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include "wtf/ASCIICType.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "NodeValidator.h" // For Bun::V:: #include "ErrorCode.h" // For Bun::ERR:: #include "JavaScriptCore/JSMapInlines.h" @@ -539,11 +539,11 @@ JSC_DEFINE_HOST_FUNCTION(constructMIMEType, (JSGlobalObject * globalObject, Call JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSC::Structure* structure = zigGlobalObject->m_JSMIMETypeClassStructure.get(zigGlobalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSC::Structure* structure = rustGlobalObject->m_JSMIMETypeClassStructure.get(rustGlobalObject); JSC::JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSMIMETypeClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSMIMETypeClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { if (!newTarget) { throwTypeError(globalObject, scope, "Class constructor MIMEType cannot be invoked without 'new'"_s); return {}; @@ -570,7 +570,7 @@ JSC_DEFINE_HOST_FUNCTION(constructMIMEType, (JSGlobalObject * globalObject, Call // 3. Create and parse parameters // We need the structure for JSMIMEParams to create the map and the instance - JSC::Structure* paramsStructure = zigGlobalObject->m_JSMIMEParamsClassStructure.get(zigGlobalObject); + JSC::Structure* paramsStructure = rustGlobalObject->m_JSMIMEParamsClassStructure.get(rustGlobalObject); JSMap* paramsMap = JSMap::create(vm, globalObject->mapStructure()); RETURN_IF_EXCEPTION(scope, {}); // OOM check for map diff --git a/src/jsc/bindings/webcore/JSPerformance.cpp b/src/jsc/bindings/webcore/JSPerformance.cpp index 4aed2e5e663..e3cad387f51 100644 --- a/src/jsc/bindings/webcore/JSPerformance.cpp +++ b/src/jsc/bindings/webcore/JSPerformance.cpp @@ -285,7 +285,7 @@ void JSPerformance::finishCreation(VM& vm) this->putDirect( vm, JSC::Identifier::fromString(vm, "timeOrigin"_s), - jsNumber(Bun__readOriginTimerStart(static_cast(this->globalObject())->bunVM())), + jsNumber(Bun__readOriginTimerStart(static_cast(this->globalObject())->bunVM())), PropertyAttribute::ReadOnly | 0); } diff --git a/src/jsc/bindings/webcore/JSPerformanceObserverCallback.cpp b/src/jsc/bindings/webcore/JSPerformanceObserverCallback.cpp index db1050173bf..b719dff218b 100644 --- a/src/jsc/bindings/webcore/JSPerformanceObserverCallback.cpp +++ b/src/jsc/bindings/webcore/JSPerformanceObserverCallback.cpp @@ -28,7 +28,7 @@ #include "JSPerformanceObserver.h" #include "JSPerformanceObserverEntryList.h" #include "ScriptExecutionContext.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace WebCore { using namespace JSC; diff --git a/src/jsc/bindings/webcore/JSReadableStream.cpp b/src/jsc/bindings/webcore/JSReadableStream.cpp index d1eb55a7192..a24df965f1b 100644 --- a/src/jsc/bindings/webcore/JSReadableStream.cpp +++ b/src/jsc/bindings/webcore/JSReadableStream.cpp @@ -38,9 +38,9 @@ #include #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "JavaScriptCore/BuiltinNames.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "WebCoreJSBuiltins.h" namespace WebCore { @@ -96,7 +96,7 @@ JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncText, (JSGlobalObject * global return {}; } - return ZigGlobalObject__readableStreamToText(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); + return RustGlobalObject__readableStreamToText(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncBytes, (JSGlobalObject * globalObject, CallFrame* callFrame)) @@ -109,7 +109,7 @@ JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncBytes, (JSGlobalObject * globa return {}; } - return ZigGlobalObject__readableStreamToBytes(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); + return RustGlobalObject__readableStreamToBytes(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncJSON, (JSGlobalObject * globalObject, CallFrame* callFrame)) @@ -122,7 +122,7 @@ JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncJSON, (JSGlobalObject * global return {}; } - return ZigGlobalObject__readableStreamToJSON(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); + return RustGlobalObject__readableStreamToJSON(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncBlob, (JSGlobalObject * globalObject, CallFrame* callFrame)) @@ -135,7 +135,7 @@ JSC_DEFINE_HOST_FUNCTION(jsReadableStreamProtoFuncBlob, (JSGlobalObject * global return {}; } - return ZigGlobalObject__readableStreamToBlob(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); + return RustGlobalObject__readableStreamToBlob(defaultGlobalObject(globalObject), JSValue::encode(thisObject)); } using JSReadableStreamDOMConstructor = JSDOMBuiltinConstructor; diff --git a/src/jsc/bindings/webcore/JSWebSocket.cpp b/src/jsc/bindings/webcore/JSWebSocket.cpp index 1cdac6e59df..3feace0b529 100644 --- a/src/jsc/bindings/webcore/JSWebSocket.cpp +++ b/src/jsc/bindings/webcore/JSWebSocket.cpp @@ -26,7 +26,7 @@ #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" #include "IDLTypes.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "JSDOMAttribute.h" #include "JSDOMBinding.h" #include "JSDOMConstructor.h" @@ -204,7 +204,7 @@ static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalG { auto& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = uncheckedDowncast(lexicalGlobalObject); + auto* globalObject = uncheckedDowncast(lexicalGlobalObject); auto* context = globalObject->scriptExecutionContext(); if (!context) [[unlikely]] return throwConstructorScriptExecutionContextUnavailableError(*lexicalGlobalObject, throwScope, "WebSocket"_s); @@ -213,7 +213,7 @@ static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalG Vector protocols; int rejectUnauthorized = -1; - // Zig heap SSLConfig. RAII — freed on any early return, moved into + // Rust heap SSLConfig. RAII — freed on any early return, moved into // WebSocket::create() on success. WebSocketSSLConfigPtr sslConfig; auto headersInit = std::optional>, IDLRecord>>::ReturnType>(); @@ -254,7 +254,7 @@ static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalG } } - // Parse TLS options using Zig's SSLConfig.fromJS for full TLS option support + // Parse TLS options using Rust's SSLConfig.fromJS for full TLS option support JSValue tlsOptionsValue = Bun::getOwnPropertyIfExists(globalObject, options, PropertyName(Identifier::fromString(vm, "tls"_s))); RETURN_IF_EXCEPTION(throwScope, {}); if (tlsOptionsValue && !tlsOptionsValue.isUndefinedOrNull() && tlsOptionsValue.isObject()) { @@ -267,7 +267,7 @@ static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalG } } - // Parse full TLS options using Zig's SSLConfig.fromJS + // Parse full TLS options using Rust's SSLConfig.fromJS sslConfig = WebSocketSSLConfigPtr { Bun__WebSocket__parseSSLConfig(globalObject, JSValue::encode(tlsOptionsValue)) }; RETURN_IF_EXCEPTION(throwScope, {}); } @@ -1038,7 +1038,7 @@ WebSocket* JSWebSocket::toWrapped(JSC::VM&, JSC::JSValue value) } // https://github.com/oven-sh/bun/issues/11866 -JSC::JSValue getWebSocketConstructor(Zig::GlobalObject* globalObject) +JSC::JSValue getWebSocketConstructor(Rust::GlobalObject* globalObject) { return WebCore::JSWebSocket::getConstructor(globalObject->vm(), globalObject); } diff --git a/src/jsc/bindings/webcore/JSWebSocket.h b/src/jsc/bindings/webcore/JSWebSocket.h index 46f4a2ab1bc..535cabf39aa 100644 --- a/src/jsc/bindings/webcore/JSWebSocket.h +++ b/src/jsc/bindings/webcore/JSWebSocket.h @@ -97,6 +97,6 @@ template<> struct JSDOMWrapperConverterTraits { using ToWrappedReturnType = WebSocket*; }; -JSC::JSValue getWebSocketConstructor(Zig::GlobalObject* globalObject); +JSC::JSValue getWebSocketConstructor(Rust::GlobalObject* globalObject); } // namespace WebCore diff --git a/src/jsc/bindings/webcore/MessagePort.cpp b/src/jsc/bindings/webcore/MessagePort.cpp index f152366907f..39955821e20 100644 --- a/src/jsc/bindings/webcore/MessagePort.cpp +++ b/src/jsc/bindings/webcore/MessagePort.cpp @@ -187,7 +187,7 @@ void MessagePort::dispatchOneMessage(ScriptExecutionContext& context, MessageWit Ref vm = globalObject->vm(); auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm); - if (Zig::GlobalObject::scriptExecutionStatus(globalObject, globalObject) != ScriptExecutionStatus::Running) + if (Rust::GlobalObject::scriptExecutionStatus(globalObject, globalObject) != ScriptExecutionStatus::Running) return; auto ports = MessagePort::entanglePorts(context, WTF::move(message.transferredPorts)); diff --git a/src/jsc/bindings/webcore/PerformanceMark.cpp b/src/jsc/bindings/webcore/PerformanceMark.cpp index 6ddda4c5f8b..3038f2c9428 100644 --- a/src/jsc/bindings/webcore/PerformanceMark.cpp +++ b/src/jsc/bindings/webcore/PerformanceMark.cpp @@ -41,7 +41,7 @@ namespace WebCore { static double performanceNow(ScriptExecutionContext& scriptExecutionContext) { - return static_cast(Bun__readOriginTimer(uncheckedDowncast(scriptExecutionContext.globalObject())->bunVM())) / 1000000; + return static_cast(Bun__readOriginTimer(uncheckedDowncast(scriptExecutionContext.globalObject())->bunVM())) / 1000000; } ExceptionOr> PerformanceMark::create(JSC::JSGlobalObject& globalObject, ScriptExecutionContext& scriptExecutionContext, const String& name, std::optional&& markOptions) diff --git a/src/jsc/bindings/webcore/PerformanceObserver.cpp b/src/jsc/bindings/webcore/PerformanceObserver.cpp index 38aab5a0958..9effcfc774c 100644 --- a/src/jsc/bindings/webcore/PerformanceObserver.cpp +++ b/src/jsc/bindings/webcore/PerformanceObserver.cpp @@ -47,7 +47,7 @@ PerformanceObserver::PerformanceObserver(ScriptExecutionContext& scriptExecution // m_performance = &workerGlobalScope.performance(); // } else // ASSERT_NOT_REACHED(); - m_performance = uncheckedDowncast(scriptExecutionContext.globalObject())->performance(); + m_performance = uncheckedDowncast(scriptExecutionContext.globalObject())->performance(); } void PerformanceObserver::disassociate() diff --git a/src/jsc/bindings/webcore/ReadableStream.cpp b/src/jsc/bindings/webcore/ReadableStream.cpp index fab95a7a532..656ca330687 100644 --- a/src/jsc/bindings/webcore/ReadableStream.cpp +++ b/src/jsc/bindings/webcore/ReadableStream.cpp @@ -35,8 +35,8 @@ #include "JSReadableStreamSource.h" #include "WebCoreJSClientData.h" #include "WebCoreJSBuiltins.h" -#include "ZigGlobalObject.h" -#include "ZigGeneratedClasses.h" +#include "RustGlobalObject.h" +#include "RustGeneratedClasses.h" #include "helpers.h" #include "BunClientData.h" #include "IDLTypes.h" @@ -270,7 +270,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionTransferToNativeReadableStream, (JSGlobalObje using namespace JSC; using namespace WebCore; -extern "C" bool ReadableStream__tee(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream1, JSC::EncodedJSValue* possibleReadableStream2) +extern "C" bool ReadableStream__tee(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream1, JSC::EncodedJSValue* possibleReadableStream2) { auto* readableStream = dynamicDowncast(JSC::JSValue::decode(possibleReadableStream)); if (!readableStream) [[unlikely]] @@ -321,7 +321,7 @@ extern "C" bool ReadableStream__tee(JSC::EncodedJSValue possibleReadableStream, return true; } -extern "C" void ReadableStream__cancel(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" void ReadableStream__cancel(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject) { auto* readableStream = dynamicDowncast(JSC::JSValue::decode(possibleReadableStream)); if (!readableStream) [[unlikely]] @@ -338,7 +338,7 @@ extern "C" void ReadableStream__cancel(JSC::EncodedJSValue possibleReadableStrea // Like ReadableStream__cancel but forwards an arbitrary JS reason verbatim to // the stream's cancel algorithm instead of synthesizing a DOMException. Used // by fetch() to honor AbortSignal.reason when cancelling a request body. -extern "C" void ReadableStream__cancelWithReason(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject, JSC::EncodedJSValue encodedReason) +extern "C" void ReadableStream__cancelWithReason(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject, JSC::EncodedJSValue encodedReason) { auto* readableStream = dynamicDowncast(JSC::JSValue::decode(possibleReadableStream)); if (!readableStream) [[unlikely]] @@ -357,7 +357,7 @@ extern "C" void ReadableStream__cancelWithReason(JSC::EncodedJSValue possibleRea invokeReadableStreamFunction(*globalObject, privateName, JSC::jsUndefined(), arguments); } -extern "C" void ReadableStream__detach(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" void ReadableStream__detach(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject) { auto value = JSC::JSValue::decode(possibleReadableStream); if (value.isEmpty() || !value.isCell()) @@ -371,20 +371,20 @@ extern "C" void ReadableStream__detach(JSC::EncodedJSValue possibleReadableStrea readableStream->setDisturbed(true); } -extern "C" bool ReadableStream__isDisturbed(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" bool ReadableStream__isDisturbed(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject) { ASSERT(globalObject); return WebCore::ReadableStream::isDisturbed(globalObject, dynamicDowncast(JSC::JSValue::decode(possibleReadableStream))); } -extern "C" bool ReadableStream__isLocked(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" bool ReadableStream__isLocked(JSC::EncodedJSValue possibleReadableStream, Rust::GlobalObject* globalObject) { ASSERT(globalObject); WebCore::JSReadableStream* stream = dynamicDowncast(JSValue::decode(possibleReadableStream)); return stream != nullptr && WebCore::ReadableStream::isLocked(globalObject, stream); } -extern "C" int32_t ReadableStreamTag__tagged(Zig::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream, void** ptr) +extern "C" int32_t ReadableStreamTag__tagged(Rust::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream, void** ptr) { ASSERT(globalObject); JSC::JSObject* object = JSValue::decode(*possibleReadableStream).getObject(); @@ -475,7 +475,7 @@ extern "C" int32_t ReadableStreamTag__tagged(Zig::GlobalObject* globalObject, JS return 0; } -extern "C" JSC::EncodedJSValue ZigGlobalObject__createNativeReadableStream(Zig::GlobalObject* globalObject, JSC::EncodedJSValue nativePtr) +extern "C" JSC::EncodedJSValue RustGlobalObject__createNativeReadableStream(Rust::GlobalObject* globalObject, JSC::EncodedJSValue nativePtr) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -492,7 +492,7 @@ extern "C" JSC::EncodedJSValue ZigGlobalObject__createNativeReadableStream(Zig:: return JSValue::encode(result); } -static inline JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBufferBody(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +static inline JSC::EncodedJSValue RustGlobalObject__readableStreamToArrayBufferBody(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -530,12 +530,12 @@ static inline JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBufferBo RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(promise)); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToArrayBuffer(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { - return ZigGlobalObject__readableStreamToArrayBufferBody(static_cast(globalObject), readableStreamValue); + return RustGlobalObject__readableStreamToArrayBufferBody(static_cast(globalObject), readableStreamValue); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToBytes(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -573,7 +573,7 @@ extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBytes(Zig::Globa RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(promise)); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToText(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -596,7 +596,7 @@ extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToText(Zig::Global return JSC::JSValue::encode(result); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToFormData(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue, JSC::EncodedJSValue contentTypeValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToFormData(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue, JSC::EncodedJSValue contentTypeValue) { auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -620,7 +620,7 @@ extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToFormData(Zig::Gl return JSC::JSValue::encode(result); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToJSON(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -643,7 +643,7 @@ extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToJSON(Zig::Global return JSC::JSValue::encode(result); } -extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBlob(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) +extern "C" JSC::EncodedJSValue RustGlobalObject__readableStreamToBlob(Rust::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -677,7 +677,7 @@ JSC_DEFINE_HOST_FUNCTION(functionReadableStreamToArrayBuffer, (JSC::JSGlobalObje } auto readableStreamValue = callFrame->uncheckedArgument(0); - return ZigGlobalObject__readableStreamToArrayBufferBody(static_cast(globalObject), JSValue::encode(readableStreamValue)); + return RustGlobalObject__readableStreamToArrayBufferBody(static_cast(globalObject), JSValue::encode(readableStreamValue)); } JSC_DEFINE_HOST_FUNCTION(functionReadableStreamToBytes, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) @@ -691,5 +691,5 @@ JSC_DEFINE_HOST_FUNCTION(functionReadableStreamToBytes, (JSC::JSGlobalObject * g } auto readableStreamValue = callFrame->uncheckedArgument(0); - return ZigGlobalObject__readableStreamToBytes(static_cast(globalObject), JSValue::encode(readableStreamValue)); + return RustGlobalObject__readableStreamToBytes(static_cast(globalObject), JSValue::encode(readableStreamValue)); } diff --git a/src/jsc/bindings/webcore/SerializedScriptValue.cpp b/src/jsc/bindings/webcore/SerializedScriptValue.cpp index f1e72f3fa24..bbce64150f5 100644 --- a/src/jsc/bindings/webcore/SerializedScriptValue.cpp +++ b/src/jsc/bindings/webcore/SerializedScriptValue.cpp @@ -106,9 +106,9 @@ #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "blob.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "JSX509Certificate.h" #include "ncrypto.h" #include "JSKeyObject.h" @@ -2688,7 +2688,7 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in) // a DataCloneError. // NapiPrototype is allowed because napi_create_object should behave // like a plain object from JS's perspective (matches Node.js). - if (inObject->classInfo() != JSFinalObject::info() && inObject->classInfo() != Zig::NapiPrototype::info()) + if (inObject->classInfo() != JSFinalObject::info() && inObject->classInfo() != Rust::NapiPrototype::info()) return SerializationReturnCode::DataCloneError; inputObjectStack.append(inObject); indexStack.append(0); diff --git a/src/jsc/bindings/webcore/WebSocket.cpp b/src/jsc/bindings/webcore/WebSocket.cpp index ddfbe3da854..56c23f7c090 100644 --- a/src/jsc/bindings/webcore/WebSocket.cpp +++ b/src/jsc/bindings/webcore/WebSocket.cpp @@ -35,7 +35,7 @@ #include "headers.h" #include "blob.h" #include "BunString.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "CloseEvent.h" #include // #include "ContentSecurityPolicy.h" @@ -549,8 +549,8 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr // Materialize host/path as WTF::String so the BunString wrappers hold a // stable WTFStringImpl backing (preserving 8-bit vs UTF-16 encoding). - // ZigString wrappers over non-ASCII Latin1/UTF-16 data lose the encoding - // tag and corrupt the HTTP upgrade request build in Zig. + // RustString wrappers over non-ASCII Latin1/UTF-16 data lose the encoding + // tag and corrupt the HTTP upgrade request build in Rust. String hostString = m_url.host().toString(); auto resource = resourceName(m_url); String unixSocketPathString; @@ -603,7 +603,7 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr port = userPort.value(); } - // Hold WTF::Strings so the BunString wrappers stay valid for the Zig call. + // Hold WTF::Strings so the BunString wrappers stay valid for the Rust call. Vector headerNameStrings; Vector headerValueStrings; Vector headerNames; @@ -694,7 +694,7 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr } BunString targetAuth = Bun::toString(targetAuthorization); - // Pass SSLConfig pointer to Zig (ownership transferred - Zig will deinit when connection closes) + // Pass SSLConfig pointer to Rust (ownership transferred - Rust will deinit when connection closes) // After this call, m_sslConfig should not be used by C++ anymore void* sslConfig = m_sslConfig.release(); @@ -885,15 +885,15 @@ void WebSocket::sendWebSocketString(const String& message, const Opcode op) { switch (m_connectedWebSocketKind) { case ConnectedWebSocketKind::Client: { - auto zigStr = Zig::toZigString(message); - Bun__WebSocketClient__writeString(this->m_connectedWebSocket.client, &zigStr, static_cast(op)); + auto rustStr = Rust::toRustString(message); + Bun__WebSocketClient__writeString(this->m_connectedWebSocket.client, &rustStr, static_cast(op)); // this->m_connectedWebSocket.client->send({ baseAddress, length }, opCode); // this->m_bufferedAmount = this->m_connectedWebSocket.client->getBufferedAmount(); break; } case ConnectedWebSocketKind::ClientSSL: { - auto zigStr = Zig::toZigString(message); - Bun__WebSocketClientTLS__writeString(this->m_connectedWebSocket.clientSSL, &zigStr, static_cast(op)); + auto rustStr = Rust::toRustString(message); + Bun__WebSocketClientTLS__writeString(this->m_connectedWebSocket.clientSSL, &rustStr, static_cast(op)); break; } // case ConnectedWebSocketKind::Server: { @@ -917,7 +917,7 @@ void WebSocket::sendWebSocketString(const String& message, const Opcode op) // Called from close()/terminate() while m_state == CONNECTING. // -// The Zig-side upgrade client's cancel() clears its back-pointer to us +// The Rust-side upgrade client's cancel() clears its back-pointer to us // without calling didAbruptClose, so none of didConnect / // didFailWithErrorCode / didClose will ever fire for this socket. We // must therefore finish the close ourselves: cancel the upgrade, queue @@ -991,15 +991,15 @@ ExceptionOr WebSocket::close(std::optional optionalCode, c m_state = CLOSING; switch (m_connectedWebSocketKind) { case ConnectedWebSocketKind::Client: { - ZigString reasonZigStr = Zig::toZigString(reason); - Bun__WebSocketClient__close(this->m_connectedWebSocket.client, code, &reasonZigStr); + RustString reasonRustStr = Rust::toRustString(reason); + Bun__WebSocketClient__close(this->m_connectedWebSocket.client, code, &reasonRustStr); updateHasPendingActivity(); // this->m_bufferedAmount = this->m_connectedWebSocket.client->getBufferedAmount(); break; } case ConnectedWebSocketKind::ClientSSL: { - ZigString reasonZigStr = Zig::toZigString(reason); - Bun__WebSocketClientTLS__close(this->m_connectedWebSocket.clientSSL, code, &reasonZigStr); + RustString reasonRustStr = Rust::toRustString(reason); + Bun__WebSocketClientTLS__close(this->m_connectedWebSocket.clientSSL, code, &reasonRustStr); updateHasPendingActivity(); // this->m_bufferedAmount = this->m_connectedWebSocket.clientSSL->getBufferedAmount(); break; @@ -1500,7 +1500,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa context->postTask([name = eventName, buffer = WTF::move(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { size_t length = buffer->byteLength(); auto* globalObject = context.jsGlobalObject(); - auto* subclassStructure = static_cast(globalObject)->JSBufferSubclassStructure(); + auto* subclassStructure = static_cast(globalObject)->JSBufferSubclassStructure(); JSUint8Array* uint8array = JSUint8Array::create(globalObject, subclassStructure, buffer.copyRef(), 0, length); JSC::EnsureStillAliveScope ensureStillAlive(uint8array); MessageEvent::Init init; @@ -1896,9 +1896,9 @@ extern "C" void WebSocket__didClose(WebCore::WebSocket* webSocket, uint16_t erro webSocket->didClose(0, errorCode, WTF::move(wtf_reason)); } -extern "C" void WebSocket__didReceiveText(WebCore::WebSocket* webSocket, bool clone, const ZigString* str) +extern "C" void WebSocket__didReceiveText(WebCore::WebSocket* webSocket, bool clone, const RustString* str) { - WTF::String wtf_str = clone ? Zig::toStringCopy(*str) : Zig::toString(*str); + WTF::String wtf_str = clone ? Rust::toStringCopy(*str) : Rust::toString(*str); webSocket->didReceiveMessage(WTF::move(wtf_str)); } extern "C" void WebSocket__didReceiveBytes(WebCore::WebSocket* webSocket, const uint8_t* bytes, size_t len, const uint8_t op) diff --git a/src/jsc/bindings/webcore/WebSocket.h b/src/jsc/bindings/webcore/WebSocket.h index 0d4335054f9..9186c8e2241 100644 --- a/src/jsc/bindings/webcore/WebSocket.h +++ b/src/jsc/bindings/webcore/WebSocket.h @@ -60,10 +60,10 @@ namespace WebCore { class Blob; -// Move-only owning handle for the Zig heap-allocated SSLConfig returned by +// Move-only owning handle for the Rust heap-allocated SSLConfig returned by // Bun__WebSocket__parseSSLConfig. The SSLConfig holds duped cert/key/CA // strings, so every exception / early-return path between parsing and the -// Zig upgrade client taking ownership must free it. Wrapping the raw `void*` +// Rust upgrade client taking ownership must free it. Wrapping the raw `void*` // in this RAII type lets normal C++ destruction handle all of those paths // without ad-hoc scope guards or manual frees at each call site. class WebSocketSSLConfigPtr { @@ -91,7 +91,7 @@ class WebSocketSSLConfigPtr { explicit operator bool() const { return m_ptr != nullptr; } - // Transfer ownership out to the Zig upgrade client; after this the + // Transfer ownership out to the Rust upgrade client; after this the // destructor is a no-op. void* release() { return std::exchange(m_ptr, nullptr); } @@ -344,7 +344,7 @@ class WebSocket final : public RefCounted, public EventTargetWithInli ConnectedWebSocketKind m_connectedWebSocketKind { ConnectedWebSocketKind::None }; size_t m_pendingActivityCount { 0 }; - // TLS options (Zig heap SSLConfig — ownership is released to the Zig + // TLS options (Rust heap SSLConfig — ownership is released to the Rust // upgrade client in connect(); freed by ~WebSocketSSLConfigPtr otherwise). WebSocketSSLConfigPtr m_sslConfig; diff --git a/src/jsc/bindings/webcore/WebSocketDeflate.h b/src/jsc/bindings/webcore/WebSocketDeflate.h index 2ac79e8614d..b8448cd76d1 100644 --- a/src/jsc/bindings/webcore/WebSocketDeflate.h +++ b/src/jsc/bindings/webcore/WebSocketDeflate.h @@ -2,7 +2,7 @@ #include #include -// This must match the layout of WebSocketDeflate.Params in WebSocketDeflate.zig +// This must match the layout of WebSocketDeflate.Params in WebSocketDeflate.rust typedef struct { uint8_t server_max_window_bits; uint8_t client_max_window_bits; diff --git a/src/jsc/bindings/webcore/Worker.cpp b/src/jsc/bindings/webcore/Worker.cpp index 9c06ac70eed..088804c2082 100644 --- a/src/jsc/bindings/webcore/Worker.cpp +++ b/src/jsc/bindings/webcore/Worker.cpp @@ -50,12 +50,12 @@ namespace WebCore { WTF_MAKE_TZONE_ALLOCATED_IMPL(Worker); -// ---- Zig FFI ----------------------------------------------------------------------------------- -// The Zig WebWorker struct is owned by this Worker (freed in ~Worker) and drives the worker -// thread. See src/jsc/web_worker.zig for the matching side of each entry point. +// ---- Rust FFI ----------------------------------------------------------------------------------- +// The Rust WebWorker struct is owned by this Worker (freed in ~Worker) and drives the worker +// thread. See src/jsc/web_worker.rust for the matching side of each entry point. extern "C" { -// Allocate the Zig WebWorker, take a keep-alive on the parent event loop, and spawn the worker +// Allocate the Rust WebWorker, take a keep-alive on the parent event loop, and spawn the worker // thread. Returns null (and sets errorMessage) on any failure; nothing needs cleanup in that case. void* WebWorker__create( Worker* worker, @@ -87,7 +87,7 @@ void WebWorker__setRef(void* worker, bool ref); // thread. void WebWorker__releaseParentPollRef(void* worker); -// Free the Zig WebWorker struct. Called from ~Worker. +// Free the Rust WebWorker struct. Called from ~Worker. void WebWorker__destroy(void* worker); } // extern "C" @@ -273,7 +273,7 @@ void Worker::enqueueToParent(MessageWithMessagePorts&& message) // sender. A sustained producer (e.g. a tight postMessage loop) would otherwise // make every per-message pop a contended acquire. template -static inline bool drainInbox(Worker::MessageInbox& inbox, Zig::GlobalObject* globalObject, ScriptExecutionContext& context, Dispatch&& dispatch) +static inline bool drainInbox(Worker::MessageInbox& inbox, Rust::GlobalObject* globalObject, ScriptExecutionContext& context, Dispatch&& dispatch) { size_t limit; Deque batch; @@ -326,7 +326,7 @@ static inline bool drainInbox(Worker::MessageInbox& inbox, Zig::GlobalObject* gl void Worker::drainToWorker(ScriptExecutionContext& context) { - auto* globalObject = uncheckedDowncast(context.jsGlobalObject()); + auto* globalObject = uncheckedDowncast(context.jsGlobalObject()); if (!globalObject) { Locker locker { m_toWorker.lock }; m_toWorker.drainScheduled.store(false, std::memory_order_relaxed); @@ -412,7 +412,7 @@ bool Worker::postTaskToWorkerGlobalScope(Function // ---- Worker-thread entry points --------------------------------------------- -void Worker::dispatchOnline(Zig::GlobalObject* workerGlobalObject) +void Worker::dispatchOnline(Rust::GlobalObject* workerGlobalObject) { // Pending→Running under the same lock postTaskToWorkerGlobalScope uses, so // a message post racing this transition either queues (drained below by @@ -460,7 +460,7 @@ static inline void workerScheduleInitialDrain(Worker& worker, Worker::MessageInb worker.drainToWorker(ctx); } -void Worker::fireEarlyMessages(Zig::GlobalObject* workerGlobalObject) +void Worker::fireEarlyMessages(Rust::GlobalObject* workerGlobalObject) { auto tasks = [&]() { Locker lock(m_pendingTasksMutex); @@ -494,7 +494,7 @@ void Worker::dispatchErrorWithMessage(WTF::String message) }); } -bool Worker::dispatchErrorWithValue(Zig::GlobalObject* workerGlobalObject, JSValue value) +bool Worker::dispatchErrorWithValue(Rust::GlobalObject* workerGlobalObject, JSValue value) { auto serialized = SerializedScriptValue::create(*workerGlobalObject, value, SerializationForStorage::No, SerializationErrorMode::NonThrowing); if (!serialized) @@ -548,9 +548,9 @@ bool Worker::dispatchExit(int32_t exitCode) }); } -// ---- extern "C" shims (called from Zig) ------------------------------------- +// ---- extern "C" shims (called from Rust) ------------------------------------- -extern "C" void WebWorker__teardownJSCVM(Zig::GlobalObject* globalObject) +extern "C" void WebWorker__teardownJSCVM(Rust::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); vm.setHasTerminationRequest(); @@ -567,10 +567,10 @@ extern "C" void WebWorker__teardownJSCVM(Zig::GlobalObject* globalObject) vm.heap.collectNow(JSC::Sync, JSC::CollectionScope::Full); - // Drop the single ref taken by `Zig__GlobalObject__create` + // Drop the single ref taken by `Rust__GlobalObject__create` // (`vmPtr->refSuppressingSaferCPPChecking()`), bringing the VM refcount // to zero — `~VM` runs here while the API lock is still held by this - // thread, exactly as in the Zig build (where `pthread_exit` skipped the + // thread, exactly as in the Rust build (where `pthread_exit` skipped the // outer `JSLockHolder` destructor and a second `deref` here released its // abandoned ref). The Rust port acquires the API lock manually with no // extra VM ref (see `WebWorker::thread_main`), so a second `deref` would @@ -583,17 +583,17 @@ extern "C" void WebWorker__dispatchExit(Worker* worker, int32_t exitCode) worker->dispatchExit(exitCode); } -extern "C" void WebWorker__dispatchOnline(Worker* worker, Zig::GlobalObject* globalObject) +extern "C" void WebWorker__dispatchOnline(Worker* worker, Rust::GlobalObject* globalObject) { worker->dispatchOnline(globalObject); } -extern "C" void WebWorker__fireEarlyMessages(Worker* worker, Zig::GlobalObject* globalObject) +extern "C" void WebWorker__fireEarlyMessages(Worker* worker, Rust::GlobalObject* globalObject) { worker->fireEarlyMessages(globalObject); } -extern "C" void WebWorker__dispatchError(Zig::GlobalObject* globalObject, Worker* worker, BunString message, JSC::EncodedJSValue errorValue) +extern "C" void WebWorker__dispatchError(Rust::GlobalObject* globalObject, Worker* worker, BunString message, JSC::EncodedJSValue errorValue) { JSValue error = JSC::JSValue::decode(errorValue); ErrorEvent::Init init; @@ -643,7 +643,7 @@ JSC_DEFINE_HOST_FUNCTION(jsReceiveMessageOnPort, (JSGlobalObject * lexicalGlobal return Bun::throwError(lexicalGlobalObject, scope, Bun::ErrorCode::ERR_INVALID_ARG_TYPE, "The \"port\" argument must be a MessagePort instance"_s); } -JSValue createNodeWorkerThreadsBinding(Zig::GlobalObject* globalObject) +JSValue createNodeWorkerThreadsBinding(Rust::GlobalObject* globalObject) { VM& vm = globalObject->vm(); @@ -706,7 +706,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPostMessage, JSC::VM& vm = leixcalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - Zig::GlobalObject* globalObject = dynamicDowncast(leixcalGlobalObject); + Rust::GlobalObject* globalObject = dynamicDowncast(leixcalGlobalObject); if (!globalObject) [[unlikely]] return JSValue::encode(jsUndefined()); diff --git a/src/jsc/bindings/webcore/Worker.h b/src/jsc/bindings/webcore/Worker.h index ccca3fc29e7..0382b9c1d19 100644 --- a/src/jsc/bindings/webcore/Worker.h +++ b/src/jsc/bindings/webcore/Worker.h @@ -49,9 +49,9 @@ struct WorkerOptions; /// Parent-side handle for a Web or Node worker thread. /// -/// Lifetime / ownership (see also the header comment in web_worker.zig): +/// Lifetime / ownership (see also the header comment in web_worker.rust): /// -/// JSWorker (GC'd JSCell) ──Ref──► Worker ──owns──► Zig WebWorker +/// JSWorker (GC'd JSCell) ──Ref──► Worker ──owns──► Rust WebWorker /// parent thread ThreadSafeRefCounted default_allocator /// /// Refs held on this object: @@ -62,7 +62,7 @@ struct WorkerOptions; /// worker thread (EventListenerMap is single-threaded) /// - transient Ref{*this} captured by posted tasks /// -/// impl_ (Zig WebWorker*) is owned by this object and freed in ~Worker(), so +/// impl_ (Rust WebWorker*) is owned by this object and freed in ~Worker(), so /// terminate()/ref()/unref() can never see a dangling pointer while JS holds /// the wrapper. /// @@ -86,7 +86,7 @@ struct WorkerOptions; /// accepts and silently drops the message, matching browser/Node semantics. /// /// m_terminateRequested is orthogonal: set once by terminate(), gates -/// dispatchEvent()/setKeepAlive(), and is mirrored into the Zig side via +/// dispatchEvent()/setKeepAlive(), and is mirrored into the Rust side via /// WebWorker__notifyNeedTermination so the worker loop can observe it. class Worker final : public ThreadSafeRefCounted, public EventTargetWithInlineData, private ContextDestructionObserver { WTF_MAKE_TZONE_ALLOCATED(Worker); @@ -127,10 +127,10 @@ class Worker final : public ThreadSafeRefCounted, public EventTargetWith WorkerOptions& options() { return m_options; } // -- Worker-thread entry points (each posts to m_parentContextId) -------- - void dispatchOnline(Zig::GlobalObject* workerGlobalObject); - void fireEarlyMessages(Zig::GlobalObject* workerGlobalObject); + void dispatchOnline(Rust::GlobalObject* workerGlobalObject); + void fireEarlyMessages(Rust::GlobalObject* workerGlobalObject); void dispatchErrorWithMessage(WTF::String message); - bool dispatchErrorWithValue(Zig::GlobalObject* workerGlobalObject, JSValue value); + bool dispatchErrorWithValue(Rust::GlobalObject* workerGlobalObject, JSValue value); bool dispatchExit(int32_t exitCode); // Post a task to the parent's ScriptExecutionContext by stable identifier. @@ -185,13 +185,13 @@ class Worker final : public ThreadSafeRefCounted, public EventTargetWith // once the worker VM is up). const ScriptExecutionContextIdentifier m_clientIdentifier; - // Owned Zig WebWorker*. Written once in create(), read only on the parent + // Owned Rust WebWorker*. Written once in create(), read only on the parent // thread (terminate/setKeepAlive) or in the close task (also parent thread). // Freed in ~Worker(). Never null once create() returns successfully. void* impl_ { nullptr }; }; -JSValue createNodeWorkerThreadsBinding(Zig::GlobalObject* globalObject); +JSValue createNodeWorkerThreadsBinding(Rust::GlobalObject* globalObject); JSC_DECLARE_HOST_FUNCTION(jsFunctionPostMessage); diff --git a/src/jsc/bindings/wrapAnsi.cpp b/src/jsc/bindings/wrapAnsi.cpp index 54a2d615eb7..343703478f7 100644 --- a/src/jsc/bindings/wrapAnsi.cpp +++ b/src/jsc/bindings/wrapAnsi.cpp @@ -8,7 +8,7 @@ #include #include -// Zig exports for visible width calculation +// Rust exports for visible width calculation extern "C" size_t Bun__visibleWidthExcludeANSI_utf16(const uint16_t* ptr, size_t len, bool ambiguous_as_wide); extern "C" size_t Bun__visibleWidthExcludeANSI_latin1(const uint8_t* ptr, size_t len); extern "C" uint8_t Bun__codepointWidth(uint32_t cp, bool ambiguous_as_wide); @@ -38,7 +38,7 @@ struct WrapAnsiOptions { }; // ============================================================================ -// String Width Calculation (using Zig implementation) +// String Width Calculation (using Rust implementation) // ============================================================================ template diff --git a/src/jsc/bindings/wtf-bindings.cpp b/src/jsc/bindings/wtf-bindings.cpp index 0d4968f805f..d32f05888b0 100644 --- a/src/jsc/bindings/wtf-bindings.cpp +++ b/src/jsc/bindings/wtf-bindings.cpp @@ -264,12 +264,12 @@ size_t toISOString(JSC::VM& vm, double date, char in[64]) static thread_local WTF::StackBounds stackBoundsForCurrentThread = WTF::StackBounds::emptyBounds(); -extern "C" [[ZIG_EXPORT(nothrow)]] void Bun__StackCheck__initialize() +extern "C" [[RUST_EXPORT(nothrow)]] void Bun__StackCheck__initialize() { stackBoundsForCurrentThread = WTF::StackBounds::currentThreadStackBounds(); } -extern "C" [[ZIG_EXPORT(nothrow)]] void* Bun__StackCheck__getMaxStack() +extern "C" [[RUST_EXPORT(nothrow)]] void* Bun__StackCheck__getMaxStack() { return stackBoundsForCurrentThread.end(); } diff --git a/src/jsc/bun_string_jsc.zig b/src/jsc/bun_string_jsc.zig index f0ec79f482a..fe69cb557b5 100644 --- a/src/jsc/bun_string_jsc.zig +++ b/src/jsc/bun_string_jsc.zig @@ -150,9 +150,9 @@ fn sliceWithUnderlyingStringToJSWithOptions(this: *SliceWithUnderlyingString, gl if (bun.strings.toUTF16Alloc(bun.default_allocator, this.utf8.slice(), false, false) catch null) |utf16| { this.utf8.deinit(); this.utf8 = .{}; - return jsc.ZigString.toExternalU16(utf16.ptr, utf16.len, globalObject); + return jsc.RustString.toExternalU16(utf16.ptr, utf16.len, globalObject); } else { - const js_value = ZigString.init(this.utf8.slice()).toExternalValue( + const js_value = RustString.init(this.utf8.slice()).toExternalValue( globalObject, ); this.utf8 = .{}; @@ -229,7 +229,7 @@ pub const UnicodeTestingAPIs = struct { /// Used in JS tests, see `internal-for-testing.ts`. /// Exercises the `sentinel = true` path of `toUTF16AllocForReal`, which is /// otherwise only reachable from Windows-only code (`bun build --compile` - /// metadata in `src/windows.zig`). + /// metadata in `src/windows.rust`). pub fn toUTF16AllocSentinel(globalThis: *bun.jsc.JSGlobalObject, callframe: *bun.jsc.CallFrame) bun.JSError!bun.jsc.JSValue { const arguments = callframe.arguments(); if (arguments.len < 1) { @@ -262,4 +262,4 @@ const String = bun.String; const strings = bun.strings; const jsc = bun.jsc; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; diff --git a/src/jsc/event_loop.zig b/src/jsc/event_loop.zig index f43114231e5..62e5c7ce1fb 100644 --- a/src/jsc/event_loop.zig +++ b/src/jsc/event_loop.zig @@ -539,7 +539,7 @@ pub fn tick(this: *EventLoop) void { /// process exit) without running user JavaScript via the global microtask queue. /// /// `tickQueueWithCount` unconditionally calls `drainMicrotasksWithGlobal` after -/// every task (Task.zig), which drains the shared JSC microtask queue and can +/// every task (Task.rust), which drains the shared JSC microtask queue and can /// execute arbitrary user JS. This method sets a flag to suppress that drain. pub fn tickTasksOnly(this: *EventLoop) void { this.tickConcurrent(); @@ -685,15 +685,15 @@ pub fn getActiveTasks(globalObject: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun. const event_loop = vm.event_loop; const result = jsc.JSValue.createEmptyObject(globalObject, 3); - result.put(globalObject, jsc.ZigString.static("activeTasks"), jsc.JSValue.jsNumber(vm.active_tasks)); - result.put(globalObject, jsc.ZigString.static("concurrentRef"), jsc.JSValue.jsNumber(event_loop.concurrent_ref.load(.seq_cst))); + result.put(globalObject, jsc.RustString.static("activeTasks"), jsc.JSValue.jsNumber(vm.active_tasks)); + result.put(globalObject, jsc.RustString.static("concurrentRef"), jsc.JSValue.jsNumber(event_loop.concurrent_ref.load(.seq_cst))); // Get num_polls from uws loop (POSIX) or active_handles from libuv (Windows) const num_polls: i32 = if (Environment.isWindows) @intCast(bun.windows.libuv.Loop.get().active_handles) else uws.Loop.get().num_polls; - result.put(globalObject, jsc.ZigString.static("numPolls"), jsc.JSValue.jsNumber(num_polls)); + result.put(globalObject, jsc.RustString.static("numPolls"), jsc.JSValue.jsNumber(num_polls)); return result; } @@ -704,37 +704,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("./ConcurrentPromiseTask.zig").ConcurrentPromiseTask; -pub const WorkTask = @import("./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("./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("../event_loop/ConcurrentTask.zig"); -pub const GarbageCollectionController = @import("./GarbageCollectionController.zig"); -pub const DeferredTaskQueue = @import("../event_loop/DeferredTaskQueue.zig"); +pub const AnyEventLoop = @import("../event_loop/AnyEventLoop.rust").AnyEventLoop; +pub const ConcurrentPromiseTask = @import("./ConcurrentPromiseTask.rust").ConcurrentPromiseTask; +pub const WorkTask = @import("./WorkTask.rust").WorkTask; +pub const AnyTask = @import("../event_loop/AnyTask.rust"); +pub const ManagedTask = @import("../event_loop/ManagedTask.rust"); +pub const AnyTaskWithExtraContext = @import("../event_loop/AnyTaskWithExtraContext.rust"); +pub const CppTask = @import("./CppTask.rust").CppTask; +pub const ConcurrentCppTask = @import("./CppTask.rust").ConcurrentCppTask; +pub const JSCScheduler = @import("./JSCScheduler.rust"); +pub const Task = @import("./Task.rust").Task; +pub const ConcurrentTask = @import("../event_loop/ConcurrentTask.rust"); +pub const GarbageCollectionController = @import("./GarbageCollectionController.rust"); +pub const DeferredTaskQueue = @import("../event_loop/DeferredTaskQueue.rust"); pub const DeferredRepeatingTask = DeferredTaskQueue.DeferredRepeatingTask; -pub const PosixSignalHandle = @import("./PosixSignalHandle.zig"); +pub const PosixSignalHandle = @import("./PosixSignalHandle.rust"); pub const PosixSignalTask = PosixSignalHandle.PosixSignalTask; -pub const MiniEventLoop = @import("../event_loop/MiniEventLoop.zig"); +pub const MiniEventLoop = @import("../event_loop/MiniEventLoop.rust"); pub const MiniVM = MiniEventLoop.MiniVM; pub const JsVM = MiniEventLoop.JsVM; pub const EventLoopKind = MiniEventLoop.EventLoopKind; pub const AbstractVM = MiniEventLoop.AbstractVM; -pub const EventLoopHandle = @import("./EventLoopHandle.zig").EventLoopHandle; -pub const EventLoopTask = @import("./EventLoopHandle.zig").EventLoopTask; -pub const EventLoopTaskPtr = @import("./EventLoopHandle.zig").EventLoopTaskPtr; +pub const EventLoopHandle = @import("./EventLoopHandle.rust").EventLoopHandle; +pub const EventLoopTask = @import("./EventLoopHandle.rust").EventLoopTask; +pub const EventLoopTaskPtr = @import("./EventLoopHandle.rust").EventLoopTaskPtr; -pub const WorkPool = @import("../threading/work_pool.zig").WorkPool; -pub const WorkPoolTask = @import("../threading/work_pool.zig").Task; +pub const WorkPool = @import("../threading/work_pool.rust").WorkPool; +pub const WorkPoolTask = @import("../threading/work_pool.rust").Task; const std = @import("std"); -const tickQueueWithCount = @import("./Task.zig").tickQueueWithCount; +const tickQueueWithCount = @import("./Task.rust").tickQueueWithCount; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/jsc/fmt_jsc.zig b/src/jsc/fmt_jsc.zig index c625f8f2e5c..f6cc1f9f4f7 100644 --- a/src/jsc/fmt_jsc.zig +++ b/src/jsc/fmt_jsc.zig @@ -1,5 +1,5 @@ //! Bindgen target for `fmt_jsc.bind.ts`. The actual formatters live in -//! `src/bun_core/fmt.zig`; only the JS-facing wrapper that takes a +//! `src/bun_core/fmt.rust`; only the JS-facing wrapper that takes a //! `*JSGlobalObject` lives here so `bun_core/` stays JSC-free. pub const js_bindings = struct { diff --git a/src/jsc/headergen/sizegen.cpp b/src/jsc/headergen/sizegen.cpp index 890bac5fc0a..f367efa6a55 100644 --- a/src/jsc/headergen/sizegen.cpp +++ b/src/jsc/headergen/sizegen.cpp @@ -5,7 +5,7 @@ using namespace std; #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "Path.h" @@ -31,12 +31,12 @@ int main() { cout << "// These are the byte sizes for the different object types with " "bindings in JavaScriptCore.\n"; cout << "// This allows us to safely return stack allocated C++ types to " - "Zig.\n"; + "Rust.\n"; cout << "// It is only safe to do this when these sizes are correct.\n"; cout << "// That means:\n"; cout << "// 1. We can't dynamically link JavaScriptCore\n"; cout << "// 2. It's important that this is run whenever JavaScriptCore is " - "updated or the bindings on the Zig side change.\n"; + "updated or the bindings on the Rust side change.\n"; cout << "// Failure to do so will lead to undefined behavior and probably " "some frustrated people.\n"; cout << "// --- Regenerate this: --- \n"; diff --git a/src/jsc/host_fn.zig b/src/jsc/host_fn.zig index d5c5d4d0b11..b4a5eb357ee 100644 --- a/src/jsc/host_fn.zig +++ b/src/jsc/host_fn.zig @@ -3,9 +3,9 @@ pub const JSHostFn = fn (*JSGlobalObject, *CallFrame) callconv(jsc.conv) JSValue; /// To allow usage of `try` for error handling, Bun provides `toJSHostFn` to /// wrap this type into a JSHostFn. -pub const JSHostFnZig = fn (*JSGlobalObject, *CallFrame) bun.JSError!JSValue; +pub const JSHostFnRust = fn (*JSGlobalObject, *CallFrame) bun.JSError!JSValue; -pub fn JSHostFnZigWithContext(comptime ContextType: type) type { +pub fn JSHostFnRustWithContext(comptime ContextType: type) type { return fn (*ContextType, *JSGlobalObject, *CallFrame) bun.JSError!JSValue; } @@ -13,7 +13,7 @@ pub fn JSHostFunctionTypeWithContext(comptime ContextType: type) type { return fn (*ContextType, *JSGlobalObject, *CallFrame) callconv(jsc.conv) JSValue; } -pub fn toJSHostFn(comptime functionToWrap: JSHostFnZig) JSHostFn { +pub fn toJSHostFn(comptime functionToWrap: JSHostFnRust) JSHostFn { return struct { pub fn function(globalThis: *JSGlobalObject, callframe: *CallFrame) callconv(jsc.conv) JSValue { return toJSHostFnResult(globalThis, functionToWrap(globalThis, callframe)); @@ -21,7 +21,7 @@ pub fn toJSHostFn(comptime functionToWrap: JSHostFnZig) JSHostFn { }.function; } -pub fn toJSHostFnWithContext(comptime ContextType: type, comptime Function: JSHostFnZigWithContext(ContextType)) JSHostFunctionTypeWithContext(ContextType) { +pub fn toJSHostFnWithContext(comptime ContextType: type, comptime Function: JSHostFnRustWithContext(ContextType)) JSHostFunctionTypeWithContext(ContextType) { return struct { pub fn function(ctx: *ContextType, globalThis: *JSGlobalObject, callframe: *CallFrame) callconv(jsc.conv) JSValue { return toJSHostFnResult(globalThis, Function(ctx, globalThis, callframe)); @@ -178,7 +178,7 @@ pub fn voidFromJSError(err: bun.JSError, globalThis: *jsc.JSGlobalObject) void { error.JSTerminated => {}, } // TODO: catch exception, declare throw scope, re-throw - // c++ needs to be able to see that zig functions can throw for BUN_JSC_validateExceptionChecks + // c++ needs to be able to see that rust functions can throw for BUN_JSC_validateExceptionChecks } pub fn wrap1(comptime func: anytype) @"return": { @@ -268,7 +268,7 @@ pub fn wrap4v(comptime func: anytype) @"return": { const private = struct { pub extern fn Bun__CreateFFIFunctionWithDataValue( *JSGlobalObject, - ?*const ZigString, + ?*const RustString, argCount: u32, function: *const JSHostFn, data: *anyopaque, @@ -276,7 +276,7 @@ const private = struct { pub extern fn Bun__CreateFFIFunctionValue( globalObject: *JSGlobalObject, - symbolName: ?*const ZigString, + symbolName: ?*const RustString, argCount: u32, function: *const JSHostFn, add_ptr_field: bool, @@ -289,7 +289,7 @@ const private = struct { pub fn NewRuntimeFunction( globalObject: *JSGlobalObject, - symbolName: ?*const ZigString, + symbolName: ?*const RustString, argCount: u32, functionPointer: *const JSHostFn, add_ptr_property: bool, @@ -311,9 +311,9 @@ pub fn setFunctionData(function: JSValue, value: ?*anyopaque) void { pub fn NewFunctionWithData( globalObject: *JSGlobalObject, - symbolName: ?*const ZigString, + symbolName: ?*const RustString, argCount: u32, - comptime function: JSHostFnZig, + comptime function: JSHostFnRust, data: *anyopaque, ) JSValue { jsc.markBinding(@src()); @@ -456,7 +456,7 @@ pub fn DOMCall( const Slowpath = @field(Container, functionName); const SlowpathType = @TypeOf(@field(Container, functionName)); - // Zig doesn't support @frameAddress(1) + // Rust doesn't support @frameAddress(1) // so we have to add a small wrapper fujnction pub fn slowpath( globalObject: *jsc.JSGlobalObject, @@ -579,7 +579,7 @@ pub fn wrapInstanceMethod( args[i] = null; } }, - jsc.ZigString => { + jsc.RustString => { var string_value = eater(&iter) orelse { iter.deinit(); return globalThis.throwInvalidArguments("Missing argument", .{}); @@ -590,7 +590,7 @@ pub fn wrapInstanceMethod( return globalThis.throwInvalidArguments("Expected string", .{}); } - args[i] = try string_value.getZigString(globalThis); + args[i] = try string_value.getRustString(globalThis); }, ?bun.api.HTMLRewriter.ContentOptions => { if (iter.nextEat()) |content_arg| { @@ -655,7 +655,7 @@ pub fn wrapStaticMethod( comptime Container: type, comptime name: string, comptime auto_protect: bool, -) jsc.JSHostFnZig { +) jsc.JSHostFnRust { return struct { const FunctionType = @TypeOf(@field(Container, name)); const FunctionTypeInfo: std.builtin.Type.Fn = @typeInfo(FunctionType).@"fn"; @@ -732,7 +732,7 @@ pub fn wrapStaticMethod( args[i] = null; } }, - jsc.ZigString => { + jsc.RustString => { var string_value = eater(&iter) orelse { iter.deinit(); return globalThis.throwInvalidArguments("Missing argument", .{}); @@ -743,7 +743,7 @@ pub fn wrapStaticMethod( return globalThis.throwInvalidArguments("Expected string", .{}); } - args[i] = try string_value.getZigString(globalThis); + args[i] = try string_value.getRustString(globalThis); }, ?bun.api.HTMLRewriter.ContentOptions => { if (iter.nextEat()) |content_arg| { @@ -804,4 +804,4 @@ const jsc = bun.jsc; const CallFrame = jsc.CallFrame; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/jsc/hot_reloader.zig b/src/jsc/hot_reloader.zig index 1b7aaf5df17..ea29f2dae7b 100644 --- a/src/jsc/hot_reloader.zig +++ b/src/jsc/hot_reloader.zig @@ -71,7 +71,7 @@ pub const WatchReloader = NewHotReloader(VirtualMachine, jsc.EventLoop, true); /// would re-run every test affected by any uncommitted change, not just /// the one that was just edited). /// -/// Set by `test_command.zig` on the main thread before the watcher thread +/// Set by `test_command.rust` on the main thread before the watcher thread /// starts; after that point only the watcher thread touches it. Its /// contents are written to `watch_changed_trigger_file` immediately /// before `reloadProcess`; the new process reads and deletes that file. @@ -81,7 +81,7 @@ pub var watch_changed_paths: ?*bun.StringSet = null; /// the changed-path list into. The same path is exported via the /// `BUN_INTERNAL_TEST_CHANGED_TRIGGER_FILE` env var so the restarted /// process can find it. Set alongside `watch_changed_paths` by -/// `test_command.zig`; the string must outlive the process. +/// `test_command.rust`; the string must outlive the process. pub var watch_changed_trigger_file: ?[:0]const u8 = null; fn recordChangedPath(path: []const u8) void { diff --git a/src/jsc/ipc.zig b/src/jsc/ipc.zig index ae932d7635b..d5929e39e68 100644 --- a/src/jsc/ipc.zig +++ b/src/jsc/ipc.zig @@ -758,7 +758,7 @@ pub const SendQueue = struct { log("IPC call continueSend() from empty item", .{}); return continueSend(this, global, reason); } - // log("sending ipc message: '{'}' (has_handle={})", .{ std.zig.fmtString(to_send), first.handle != null }); + // log("sending ipc message: '{'}' (has_handle={})", .{ std.rust.fmtString(to_send), first.handle != null }); bun.assert(!this.write_in_progress); this.write_in_progress = true; this._write(to_send, if (first.handle) |handle| handle.fd else null); @@ -829,7 +829,7 @@ pub const SendQueue = struct { const payload_length = serialize(self.mode, &msg.data, global, value, is_internal) catch return .failure; bun.assert(msg.data.list.items.len == start_offset + payload_length); - // log("enqueueing ipc message: '{'}'", .{std.zig.fmtString(msg.data.list.items[start_offset..])}); + // log("enqueueing ipc message: '{'}'", .{std.rust.fmtString(msg.data.list.items[start_offset..])}); log("IPC call continueSend() from serializeAndSend", .{}); self.continueSend(global, .new_message_appended); @@ -844,7 +844,7 @@ pub const SendQueue = struct { if (item.data.list.items.len > 100) { log(" {d}|{d}", .{ item.data.cursor, item.data.list.items.len - item.data.cursor }); } else { - log(" \"{f}\"|\"{f}\"", .{ std.zig.fmtString(item.data.list.items[0..item.data.cursor]), std.zig.fmtString(item.data.list.items[item.data.cursor..]) }); + log(" \"{f}\"|\"{f}\"", .{ std.rust.fmtString(item.data.list.items[0..item.data.cursor]), std.rust.fmtString(item.data.list.items[item.data.cursor..]) }); } } } @@ -1041,7 +1041,7 @@ pub fn doSend(ipc: ?*SendQueue, globalObject: *jsc.JSGlobalObject, callFrame: *j } } - var zig_handle: ?Handle = null; + var rust_handle: ?Handle = null; if (!handle.isUndefinedOrNull()) { if (bun.jsc.API.Listener.fromJS(handle)) |listener| { log("got listener", .{}); @@ -1049,7 +1049,7 @@ pub fn doSend(ipc: ?*SendQueue, globalObject: *jsc.JSGlobalObject, callFrame: *j .uws => |socket_uws| { // may need to handle ssl case const fd = socket_uws.getSocket().getFd(); - zig_handle = .init(fd, handle); + rust_handle = .init(fd, handle); }, .namedPipe => |namedPipe| { _ = namedPipe; @@ -1061,11 +1061,11 @@ pub fn doSend(ipc: ?*SendQueue, globalObject: *jsc.JSGlobalObject, callFrame: *j } } - const status = ipc_data.serializeAndSend(globalObject, message, .external, callback, zig_handle); + const status = ipc_data.serializeAndSend(globalObject, message, .external, callback, rust_handle); if (status == .failure) { const ex = globalObject.createTypeErrorInstance("process.send() failed", .{}); - ex.put(globalObject, jsc.ZigString.static("syscall"), try bun.String.static("write").toJS(globalObject)); + ex.put(globalObject, jsc.RustString.static("syscall"), try bun.String.static("write").toJS(globalObject)); return doSendErr(globalObject, callback, ex, from); } @@ -1191,7 +1191,7 @@ fn handleIPCMessage(send_queue: *SendQueue, message: DecodedIPCMessage, globalTh fn onData2(send_queue: *SendQueue, all_data: []const u8) void { var data = all_data; - // log("onData '{'}'", .{std.zig.fmtString(data)}); + // log("onData '{'}'", .{std.rust.fmtString(data)}); // In the VirtualMachine case, `globalThis` is an optional, in case // the vm is freed before the socket closes. @@ -1529,9 +1529,9 @@ pub fn ipcParse(globalObject: *jsc.JSGlobalObject, target: jsc.JSValue, serializ const string = []const u8; -const node_cluster_binding = @import("../runtime/node/node_cluster_binding.zig"); +const node_cluster_binding = @import("../runtime/node/node_cluster_binding.rust"); const std = @import("std"); -const JSONLineBuffer = @import("./JSONLineBuffer.zig").JSONLineBuffer; +const JSONLineBuffer = @import("./JSONLineBuffer.rust").JSONLineBuffer; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/jsc/jsc.zig b/src/jsc/jsc.zig index 66c995ad137..c3c11d3f6e6 100644 --- a/src/jsc/jsc.zig +++ b/src/jsc/jsc.zig @@ -1,5 +1,5 @@ //! Bindings to JavaScriptCore and other JavaScript primatives such as -//! VirtualMachine, JSGlobalObject (Zig::GlobalObject), and the event loop. +//! VirtualMachine, JSGlobalObject (Rust::GlobalObject), and the event loop. //! //! Web and runtime-specific APIs should go in `bun.webcore` and `bun.api`. //! @@ -12,26 +12,26 @@ else .c; /// Web Template Framework -pub const wtf = @import("./WTF.zig").WTF; +pub const wtf = @import("./WTF.rust").WTF; -/// Binding for JSCInitialize in ZigGlobalObject.cpp +/// Binding for JSCInitialize in RustGlobalObject.cpp pub fn initialize(eval_mode: bool) void { markBinding(@src()); bun.analytics.Features.jsc += 1; // `one_shot_startup` is wired up by the Rust runtime (`bun_jsc::initialize`); - // the legacy Zig entry point keeps the default multi-threaded configuration. + // the legacy Rust entry point keeps the default multi-threaded configuration. JSCInitialize(std.os.environ.ptr, std.os.environ.len, onJSCInvalidEnvVar, eval_mode, false); } -pub const JSValue = @import("./JSValue.zig").JSValue; +pub const JSValue = @import("./JSValue.rust").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("./host_fn.zig"); +// for error handling, Bun provides toJSHostFn to wrap JSHostFnRust into JSHostFn. +pub const host_fn = @import("./host_fn.rust"); pub const JSHostFn = host_fn.JSHostFn; -pub const JSHostFnZig = host_fn.JSHostFnZig; -pub const JSHostFnZigWithContext = host_fn.JSHostFnZigWithContext; +pub const JSHostFnRust = host_fn.JSHostFnRust; +pub const JSHostFnRustWithContext = host_fn.JSHostFnRustWithContext; pub const JSHostFunctionTypeWithContext = host_fn.JSHostFunctionTypeWithContext; pub const toJSHostFn = host_fn.toJSHostFn; pub const toJSHostFnResult = host_fn.toJSHostFnResult; @@ -41,94 +41,94 @@ pub const fromJSHostCall = host_fn.fromJSHostCall; pub const fromJSHostCallGeneric = host_fn.fromJSHostCallGeneric; // JSC Classes Bindings -pub const AnyPromise = @import("./AnyPromise.zig").AnyPromise; -pub const array_buffer = @import("./array_buffer.zig"); +pub const AnyPromise = @import("./AnyPromise.rust").AnyPromise; +pub const array_buffer = @import("./array_buffer.rust"); pub const ArrayBuffer = array_buffer.ArrayBuffer; pub const MarkedArrayBuffer = array_buffer.MarkedArrayBuffer; pub const JSCArrayBuffer = array_buffer.JSCArrayBuffer; -pub const CachedBytecode = @import("./CachedBytecode.zig").CachedBytecode; -pub const CallFrame = @import("./CallFrame.zig").CallFrame; -pub const CommonAbortReason = @import("./CommonAbortReason.zig").CommonAbortReason; -pub const CommonStrings = @import("./CommonStrings.zig").CommonStrings; -pub const CustomGetterSetter = @import("./CustomGetterSetter.zig").CustomGetterSetter; -pub const DOMFormData = @import("./DOMFormData.zig").DOMFormData; -pub const DOMURL = @import("./DOMURL.zig").DOMURL; -pub const DecodedJSValue = @import("./DecodedJSValue.zig").DecodedJSValue; -pub const DeferredError = @import("./DeferredError.zig").DeferredError; -pub const GetterSetter = @import("./GetterSetter.zig").GetterSetter; -pub const JSArray = @import("./JSArray.zig").JSArray; -pub const JSArrayIterator = @import("./JSArrayIterator.zig").JSArrayIterator; -pub const JSCell = @import("./JSCell.zig").JSCell; -pub const JSFunction = @import("./JSFunction.zig").JSFunction; -pub const JSGlobalObject = @import("./JSGlobalObject.zig").JSGlobalObject; -pub const JSInternalPromise = @import("./JSInternalPromise.zig").JSInternalPromise; -pub const JSMap = @import("./JSMap.zig").JSMap; -pub const JSModuleLoader = @import("./JSModuleLoader.zig").JSModuleLoader; -pub const JSObject = @import("./JSObject.zig").JSObject; -pub const JSPromise = @import("./JSPromise.zig").JSPromise; -pub const JSPromiseRejectionOperation = @import("./JSPromiseRejectionOperation.zig").JSPromiseRejectionOperation; -pub const JSRef = @import("./JSRef.zig").JSRef; -pub const JSString = @import("./JSString.zig").JSString; -pub const JSUint8Array = @import("./JSUint8Array.zig").JSUint8Array; -pub const JSBigInt = @import("./JSBigInt.zig").JSBigInt; -pub const RefString = @import("./RefString.zig"); -pub const ScriptExecutionStatus = @import("./ScriptExecutionStatus.zig").ScriptExecutionStatus; -pub const SourceType = @import("./SourceType.zig").SourceType; -pub const Strong = @import("./Strong.zig"); -pub const SystemError = @import("./SystemError.zig").SystemError; -pub const URL = @import("./URL.zig").URL; -pub const URLSearchParams = @import("./URLSearchParams.zig").URLSearchParams; -pub const VM = @import("./VM.zig").VM; -pub const Weak = @import("./Weak.zig").Weak; -pub const WeakRefType = @import("./Weak.zig").WeakRefType; -pub const Exception = @import("./Exception.zig").Exception; -pub const SourceProvider = @import("./SourceProvider.zig").SourceProvider; -pub const TopExceptionScope = @import("./TopExceptionScope.zig").TopExceptionScope; -pub const ExceptionValidationScope = @import("./TopExceptionScope.zig").ExceptionValidationScope; -pub const MarkedArgumentBuffer = @import("./MarkedArgumentBuffer.zig").MarkedArgumentBuffer; -pub const RegularExpression = @import("./RegularExpression.zig").RegularExpression; +pub const CachedBytecode = @import("./CachedBytecode.rust").CachedBytecode; +pub const CallFrame = @import("./CallFrame.rust").CallFrame; +pub const CommonAbortReason = @import("./CommonAbortReason.rust").CommonAbortReason; +pub const CommonStrings = @import("./CommonStrings.rust").CommonStrings; +pub const CustomGetterSetter = @import("./CustomGetterSetter.rust").CustomGetterSetter; +pub const DOMFormData = @import("./DOMFormData.rust").DOMFormData; +pub const DOMURL = @import("./DOMURL.rust").DOMURL; +pub const DecodedJSValue = @import("./DecodedJSValue.rust").DecodedJSValue; +pub const DeferredError = @import("./DeferredError.rust").DeferredError; +pub const GetterSetter = @import("./GetterSetter.rust").GetterSetter; +pub const JSArray = @import("./JSArray.rust").JSArray; +pub const JSArrayIterator = @import("./JSArrayIterator.rust").JSArrayIterator; +pub const JSCell = @import("./JSCell.rust").JSCell; +pub const JSFunction = @import("./JSFunction.rust").JSFunction; +pub const JSGlobalObject = @import("./JSGlobalObject.rust").JSGlobalObject; +pub const JSInternalPromise = @import("./JSInternalPromise.rust").JSInternalPromise; +pub const JSMap = @import("./JSMap.rust").JSMap; +pub const JSModuleLoader = @import("./JSModuleLoader.rust").JSModuleLoader; +pub const JSObject = @import("./JSObject.rust").JSObject; +pub const JSPromise = @import("./JSPromise.rust").JSPromise; +pub const JSPromiseRejectionOperation = @import("./JSPromiseRejectionOperation.rust").JSPromiseRejectionOperation; +pub const JSRef = @import("./JSRef.rust").JSRef; +pub const JSString = @import("./JSString.rust").JSString; +pub const JSUint8Array = @import("./JSUint8Array.rust").JSUint8Array; +pub const JSBigInt = @import("./JSBigInt.rust").JSBigInt; +pub const RefString = @import("./RefString.rust"); +pub const ScriptExecutionStatus = @import("./ScriptExecutionStatus.rust").ScriptExecutionStatus; +pub const SourceType = @import("./SourceType.rust").SourceType; +pub const Strong = @import("./Strong.rust"); +pub const SystemError = @import("./SystemError.rust").SystemError; +pub const URL = @import("./URL.rust").URL; +pub const URLSearchParams = @import("./URLSearchParams.rust").URLSearchParams; +pub const VM = @import("./VM.rust").VM; +pub const Weak = @import("./Weak.rust").Weak; +pub const WeakRefType = @import("./Weak.rust").WeakRefType; +pub const Exception = @import("./Exception.rust").Exception; +pub const SourceProvider = @import("./SourceProvider.rust").SourceProvider; +pub const TopExceptionScope = @import("./TopExceptionScope.rust").TopExceptionScope; +pub const ExceptionValidationScope = @import("./TopExceptionScope.rust").ExceptionValidationScope; +pub const MarkedArgumentBuffer = @import("./MarkedArgumentBuffer.rust").MarkedArgumentBuffer; +pub const RegularExpression = @import("./RegularExpression.rust").RegularExpression; // JavaScript-related -pub const Errorable = @import("./Errorable.zig").Errorable; -pub const ResolvedSource = @import("./ResolvedSource.zig").ResolvedSource; -pub const ErrorCode = @import("./ErrorCode.zig").ErrorCode; -pub const JSErrorCode = @import("./JSErrorCode.zig").JSErrorCode; -pub const ZigErrorType = @import("./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("./EventType.zig").EventType; -pub const JSRuntimeType = @import("./JSRuntimeType.zig").JSRuntimeType; -pub const ZigStackFrameCode = @import("./ZigStackFrameCode.zig").ZigStackFrameCode; +pub const Errorable = @import("./Errorable.rust").Errorable; +pub const ResolvedSource = @import("./ResolvedSource.rust").ResolvedSource; +pub const ErrorCode = @import("./ErrorCode.rust").ErrorCode; +pub const JSErrorCode = @import("./JSErrorCode.rust").JSErrorCode; +pub const RustErrorType = @import("./RustErrorType.rust").RustErrorType; +pub const Debugger = @import("./Debugger.rust"); +pub const SavedSourceMap = @import("./SavedSourceMap.rust"); +pub const VirtualMachine = @import("./VirtualMachine.rust"); +pub const ModuleLoader = @import("./ModuleLoader.rust"); +pub const RareData = @import("./rare_data.rust"); +pub const EventType = @import("./EventType.rust").EventType; +pub const JSRuntimeType = @import("./JSRuntimeType.rust").JSRuntimeType; +pub const RustStackFrameCode = @import("./RustStackFrameCode.rust").RustStackFrameCode; pub const ErrorableResolvedSource = Errorable(ResolvedSource); -pub const ErrorableZigString = Errorable(ZigString); +pub const ErrorableRustString = Errorable(RustString); pub const ErrorableJSValue = Errorable(JSValue); pub const ErrorableString = Errorable(bun.String); -pub const ZigStackTrace = @import("./ZigStackTrace.zig").ZigStackTrace; -pub const ZigStackFrame = @import("./ZigStackFrame.zig").ZigStackFrame; -pub const ZigStackFramePosition = @import("./ZigStackFramePosition.zig").ZigStackFramePosition; -pub const ZigException = @import("./ZigException.zig").ZigException; +pub const RustStackTrace = @import("./RustStackTrace.rust").RustStackTrace; +pub const RustStackFrame = @import("./RustStackFrame.rust").RustStackFrame; +pub const RustStackFramePosition = @import("./RustStackFramePosition.rust").RustStackFramePosition; +pub const RustException = @import("./RustException.rust").RustException; -pub const ConsoleObject = @import("./ConsoleObject.zig"); +pub const ConsoleObject = @import("./ConsoleObject.rust"); pub const Formatter = ConsoleObject.Formatter; -pub const hot_reloader = @import("./hot_reloader.zig"); +pub const hot_reloader = @import("./hot_reloader.rust"); // TODO: move into bun.api -pub const Jest = @import("../runtime/test_runner/jest.zig"); -pub const TestScope = @import("../runtime/test_runner/jest.zig").TestScope; -pub const Expect = @import("../runtime/test_runner/expect.zig"); -pub const Snapshot = @import("../runtime/test_runner/snapshot.zig"); +pub const Jest = @import("../runtime/test_runner/jest.rust"); +pub const TestScope = @import("../runtime/test_runner/jest.rust").TestScope; +pub const Expect = @import("../runtime/test_runner/expect.rust"); +pub const Snapshot = @import("../runtime/test_runner/snapshot.rust"); -pub const js_property_iterator = @import("./JSPropertyIterator.zig"); +pub const js_property_iterator = @import("./JSPropertyIterator.rust"); 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.rust"); pub const AbstractVM = EventLoop.AbstractVM; pub const AnyEventLoop = EventLoop.AnyEventLoop; pub const AnyTask = EventLoop.AnyTask; @@ -156,11 +156,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("./javascript_core_c_api.rust"); /// Deprecated: Remove all of these please. -pub const Sizes = @import("./sizes.zig"); +pub const Sizes = @import("./sizes.rust"); /// Deprecated: Use `bun.String` -pub const ZigString = @import("./ZigString.zig").ZigString; +pub const RustString = @import("./RustString.rust").RustString; /// Deprecated: Use `bun.webcore` pub const WebCore = bun.webcore; /// Deprecated: Use `bun.api` @@ -187,12 +187,12 @@ pub const Subprocess = bun.api.Subprocess; /// 1. `bun src/codegen/generate-classes.ts` /// 2. Scan for **/*.classes.ts files in src/ /// 3. Generate a JS wrapper for each class in: -/// - Zig: generated_classes.zig -/// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp -/// 4. For the Zig code to successfully compile: -/// - Add it to generated_classes_list.zig +/// - Rust: generated_classes.rust +/// - C++: RustGeneratedClasses.h, RustGeneratedClasses.cpp +/// 4. For the Rust code to successfully compile: +/// - Add it to generated_classes_list.rust /// - Expose the generated methods: -/// ```zig +/// ```rust /// pub const js = JSC.Codegen.JSMyClassName; /// pub const toJS = js.toJS; /// pub const fromJS = js.fromJS; @@ -200,10 +200,10 @@ pub const Subprocess = bun.api.Subprocess; /// ``` /// 5. `bun run build` /// -pub const Codegen = @import("ZigGeneratedClasses"); -pub const GeneratedClassesList = @import("./generated_classes_list.zig").Classes; +pub const Codegen = @import("RustGeneratedClasses"); +pub const GeneratedClassesList = @import("./generated_classes_list.rust").Classes; -pub const RuntimeTranspilerCache = @import("./RuntimeTranspilerCache.zig").RuntimeTranspilerCache; +pub const RuntimeTranspilerCache = @import("./RuntimeTranspilerCache.rust").RuntimeTranspilerCache; /// Track whether an object should keep the event loop alive pub const Ref = struct { diff --git a/src/jsc/modules/AbortControllerModuleModule.h b/src/jsc/modules/AbortControllerModuleModule.h index 0f97df6ddc8..ebaea673af8 100644 --- a/src/jsc/modules/AbortControllerModuleModule.h +++ b/src/jsc/modules/AbortControllerModuleModule.h @@ -6,7 +6,7 @@ using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { inline void generateNativeModule_AbortControllerModule( JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, @@ -14,7 +14,7 @@ inline void generateNativeModule_AbortControllerModule( JSC::MarkedArgumentBuffer& exportValues) { - Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); + Rust::GlobalObject* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto* abortController = WebCore::JSAbortController::getConstructor(vm, globalObject).getObject(); @@ -49,4 +49,4 @@ inline void generateNativeModule_AbortControllerModule( vm, vm.propertyNames->defaultKeyword, abortController, static_cast(PropertyAttribute::DontDelete)); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/BunAppModule.h b/src/jsc/modules/BunAppModule.h index e4c82f4e5e8..54045df9d54 100644 --- a/src/jsc/modules/BunAppModule.h +++ b/src/jsc/modules/BunAppModule.h @@ -4,7 +4,7 @@ #include "_NativeModule.h" #include "BakeAdditionsToGlobalObject.h" -namespace Zig { +namespace Rust { using namespace WebCore; using namespace JSC; @@ -12,12 +12,12 @@ DEFINE_NATIVE_MODULE(BunApp) { INIT_NATIVE_MODULE(1); - auto* zig = static_cast(globalObject); - JSValue ssrResponseConstructor = zig->bakeAdditions().JSBakeResponseConstructor(zig); + auto* rust = static_cast(globalObject); + JSValue ssrResponseConstructor = rust->bakeAdditions().JSBakeResponseConstructor(rust); put(JSC::Identifier::fromString(vm, "Response"_s), ssrResponseConstructor); RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/BunJSCModule.h b/src/jsc/modules/BunJSCModule.h index deb683bb80d..25666768f9b 100644 --- a/src/jsc/modules/BunJSCModule.h +++ b/src/jsc/modules/BunJSCModule.h @@ -44,7 +44,7 @@ #endif #include "JSDOMConvertBase.h" -#include "ZigSourceProvider.h" +#include "RustSourceProvider.h" #include "mimalloc.h" extern "C" char* mi_stats_get_json(size_t, char*); extern "C" char* mi_heap_dump_json(bool include_blocks, bool hash_addresses); @@ -411,7 +411,7 @@ JSC_DEFINE_HOST_FUNCTION(functionCreateMemoryFootprint, VM& vm = globalObject->vm(); JSC::JSObject* object = JSC::constructEmptyObject( - vm, uncheckedDowncast(globalObject)->memoryFootprintStructure()); + vm, uncheckedDowncast(globalObject)->memoryFootprintStructure()); object->putDirectOffset(vm, 0, jsNumber(current_rss)); object->putDirectOffset(vm, 1, jsNumber(peak_rss)); @@ -891,7 +891,7 @@ JSC_DEFINE_HOST_FUNCTION(functionCodeCoverageForFile, RETURN_IF_EXCEPTION(throwScope, {}); bool ignoreSourceMap = callFrame->argument(1).toBoolean(globalObject); - auto sourceID = Zig::sourceIDForSourceURL(fileName); + auto sourceID = Rust::sourceIDForSourceURL(fileName); if (!sourceID) { throwException(globalObject, throwScope, createError(globalObject, "No source for file"_s)); @@ -997,7 +997,7 @@ JSC_DEFINE_HOST_FUNCTION(functionPercentAvailableMemoryInUse, (JSGlobalObject * @end */ -namespace Zig { +namespace Rust { DEFINE_NATIVE_MODULE(BunJSC) { INIT_NATIVE_MODULE(36); @@ -1044,4 +1044,4 @@ DEFINE_NATIVE_MODULE(BunJSC) RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/BunObjectModule.h b/src/jsc/modules/BunObjectModule.h index c5aefa3e94a..0029cf8edd0 100644 --- a/src/jsc/modules/BunObjectModule.h +++ b/src/jsc/modules/BunObjectModule.h @@ -1,8 +1,8 @@ -namespace Zig { +namespace Rust { void generateNativeModule_BunObject(JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, Vector& exportNames, JSC::MarkedArgumentBuffer& exportValues); -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/BunTestModule.h b/src/jsc/modules/BunTestModule.h index b5c5c84b670..d7bbc8de404 100644 --- a/src/jsc/modules/BunTestModule.h +++ b/src/jsc/modules/BunTestModule.h @@ -1,5 +1,5 @@ -namespace Zig { +namespace Rust { void generateNativeModule_BunTest( JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, @@ -7,7 +7,7 @@ void generateNativeModule_BunTest( JSC::MarkedArgumentBuffer& exportValues) { auto& vm = JSC::getVM(lexicalGlobalObject); - auto globalObject = uncheckedDowncast(lexicalGlobalObject); + auto globalObject = uncheckedDowncast(lexicalGlobalObject); auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm); JSObject* object = globalObject->lazyTestModuleObject(); @@ -37,4 +37,4 @@ void generateNativeModule_BunTest( } } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeBufferModule.h b/src/jsc/modules/NodeBufferModule.h index c679ae05d49..568904a2e28 100644 --- a/src/jsc/modules/NodeBufferModule.h +++ b/src/jsc/modules/NodeBufferModule.h @@ -10,7 +10,7 @@ #include "wtf/SIMDUTF.h" #include -namespace Zig { +namespace Rust { using namespace WebCore; using namespace JSC; @@ -139,13 +139,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNotImplemented, JSC_DEFINE_CUSTOM_GETTER(jsGetter_INSPECT_MAX_BYTES, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { - auto globalObject = static_cast(lexicalGlobalObject); + auto globalObject = static_cast(lexicalGlobalObject); return JSValue::encode(jsNumber(globalObject->INSPECT_MAX_BYTES)); } JSC_DEFINE_CUSTOM_SETTER(jsSetter_INSPECT_MAX_BYTES, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) { - auto globalObject = static_cast(lexicalGlobalObject); + auto globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); auto val = JSValue::decode(value); @@ -216,4 +216,4 @@ DEFINE_NATIVE_MODULE(NodeBuffer) put(JSC::Identifier::fromString(vm, "isUtf8"_s), JSC::JSFunction::create(vm, globalObject, 1, "isUtf8"_s, jsBufferConstructorFunction_isUtf8, ImplementationVisibility::Public, NoIntrinsic, jsBufferConstructorFunction_isUtf8)); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeConstantsModule.h b/src/jsc/modules/NodeConstantsModule.h index 66ad8b92c2c..86c347255d7 100644 --- a/src/jsc/modules/NodeConstantsModule.h +++ b/src/jsc/modules/NodeConstantsModule.h @@ -46,7 +46,7 @@ #include #endif -namespace Zig { +namespace Rust { using namespace WebCore; DEFINE_NATIVE_MODULE(NodeConstants) @@ -991,4 +991,4 @@ DEFINE_NATIVE_MODULE(NodeConstants) // RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeModuleModule.cpp b/src/jsc/modules/NodeModuleModule.cpp index 8415a05e2bc..af78af11d12 100644 --- a/src/jsc/modules/NodeModuleModule.cpp +++ b/src/jsc/modules/NodeModuleModule.cpp @@ -17,12 +17,12 @@ #include "JSCommonJSExtensions.h" #include "PathInlines.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "headers.h" #include "ErrorCode.h" #include "GeneratedNodeModuleModule.h" -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" namespace Bun { @@ -160,8 +160,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNodeModuleModuleConstructor, JSString* dirname = jsEmptyString(vm); - // TODO: handle when JSGlobalObject !== Zig::GlobalObject, such as in node:vm - Structure* structure = static_cast(globalObject) + // TODO: handle when JSGlobalObject !== Rust::GlobalObject, such as in node:vm + Structure* structure = static_cast(globalObject) ->CommonJSModuleObjectStructure(); // TODO: handle ShadowRealm, node:vm, new.target, subclasses @@ -622,13 +622,13 @@ JSC_DEFINE_CUSTOM_SETTER(setterRequireFunction, static JSValue getModuleCacheObject(VM& vm, JSObject* moduleObject) { - return uncheckedDowncast(moduleObject->globalObject()) + return uncheckedDowncast(moduleObject->globalObject()) ->lazyRequireCacheObject(); } static JSValue getModuleExtensionsObject(VM& vm, JSObject* moduleObject) { - return uncheckedDowncast(moduleObject->globalObject()) + return uncheckedDowncast(moduleObject->globalObject()) ->lazyRequireExtensionsObject(); } @@ -647,10 +647,10 @@ static JSValue getPathCacheObject(VM& vm, JSObject* moduleObject) static JSValue getSourceMapFunction(VM& vm, JSObject* moduleObject) { auto* globalObject = defaultGlobalObject(moduleObject->globalObject()); - auto* zigGlobalObject = globalObject; + auto* rustGlobalObject = globalObject; // Return the actual SourceMap constructor from code generation - return zigGlobalObject->JSSourceMapConstructor(); + return rustGlobalObject->JSSourceMapConstructor(); } static JSValue getBuiltinModulesObject(VM& vm, JSObject* moduleObject) @@ -701,7 +701,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionSetCJSWrapperItem, (JSGlobalObject * globalOb auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); JSValue a = callFrame->argument(0); JSValue b = callFrame->argument(1); - Zig::GlobalObject* global = defaultGlobalObject(globalObject); + Rust::GlobalObject* global = defaultGlobalObject(globalObject); String aString = a.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, {}); String bString = b.toWTFString(globalObject); @@ -813,7 +813,7 @@ JSC_DEFINE_CUSTOM_GETTER(moduleRunMain, } extern "C" void Bun__VirtualMachine__setOverrideModuleRunMain(void* bunVM, bool isOriginal); -extern "C" JSC::EncodedJSValue NodeModuleModule__callOverriddenRunMain(Zig::GlobalObject* global, JSValue argv1) +extern "C" JSC::EncodedJSValue NodeModuleModule__callOverriddenRunMain(Rust::GlobalObject* global, JSValue argv1) { auto overrideHandler = uncheckedDowncast(global->m_moduleRunMainFunction.get(global)); MarkedArgumentBuffer args; @@ -944,7 +944,7 @@ class JSModuleConstructor : public JSC::InternalFunction { } static JSModuleConstructor* create(JSC::VM& vm, - Zig::GlobalObject* globalObject) + Rust::GlobalObject* globalObject) { auto* structure = createStructure(vm, globalObject, globalObject->functionPrototype()); @@ -1004,8 +1004,8 @@ extern "C" JSC::EncodedJSValue Bun__createNodeModuleSourceMapEntryObject( JSC::EncodedJSValue encodedName) { auto& vm = globalObject->vm(); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSObject* object = JSC::constructEmptyObject(vm, zigGlobalObject->m_nodeModuleSourceMapEntryStructure.getInitializedOnMainThread(zigGlobalObject)); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSObject* object = JSC::constructEmptyObject(vm, rustGlobalObject->m_nodeModuleSourceMapEntryStructure.getInitializedOnMainThread(rustGlobalObject)); object->putDirectOffset(vm, 0, JSC::JSValue::decode(encodedGeneratedLine)); object->putDirectOffset(vm, 1, JSC::JSValue::decode(encodedGeneratedColumn)); object->putDirectOffset(vm, 2, JSC::JSValue::decode(encodedOriginalLine)); @@ -1040,8 +1040,8 @@ extern "C" JSC::EncodedJSValue Bun__createNodeModuleSourceMapOriginObject( JSC::EncodedJSValue encodedSource) { auto& vm = globalObject->vm(); - auto* zigGlobalObject = defaultGlobalObject(globalObject); - JSObject* object = JSC::constructEmptyObject(vm, zigGlobalObject->m_nodeModuleSourceMapOriginStructure.getInitializedOnMainThread(zigGlobalObject)); + auto* rustGlobalObject = defaultGlobalObject(globalObject); + JSObject* object = JSC::constructEmptyObject(vm, rustGlobalObject->m_nodeModuleSourceMapOriginStructure.getInitializedOnMainThread(rustGlobalObject)); object->putDirectOffset(vm, 0, JSC::JSValue::decode(encodedName)); object->putDirectOffset(vm, 1, JSC::JSValue::decode(encodedLine)); object->putDirectOffset(vm, 2, JSC::JSValue::decode(encodedColumn)); @@ -1050,26 +1050,26 @@ extern "C" JSC::EncodedJSValue Bun__createNodeModuleSourceMapOriginObject( } void addNodeModuleConstructorProperties(JSC::VM& vm, - Zig::GlobalObject* globalObject) + Rust::GlobalObject* globalObject) { globalObject->m_nodeModuleConstructor.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSObject* moduleConstructor = JSModuleConstructor::create( - init.vm, static_cast(init.owner)); + init.vm, static_cast(init.owner)); init.set(moduleConstructor); }); globalObject->m_nodeModuleSourceMapEntryStructure.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { init.set(createNodeModuleSourceMapEntryStructure(init.vm, init.owner)); }); globalObject->m_nodeModuleSourceMapOriginStructure.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { init.set(createNodeModuleSourceMapOriginStructure(init.vm, init.owner)); }); globalObject->m_moduleRunMainFunction.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSFunction* runMainFunction = JSFunction::create( init.vm, init.owner, 2, "runMain"_s, jsFunctionRunMain, JSC::ImplementationVisibility::Public, @@ -1078,7 +1078,7 @@ void addNodeModuleConstructorProperties(JSC::VM& vm, }); globalObject->m_moduleResolveFilenameFunction.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSFunction* resolveFilenameFunction = JSFunction::create( init.vm, init.owner, 2, "_resolveFilename"_s, jsFunctionResolveFileName, JSC::ImplementationVisibility::Public, @@ -1087,7 +1087,7 @@ void addNodeModuleConstructorProperties(JSC::VM& vm, }); globalObject->m_modulePrototypeUnderscoreCompileFunction.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSFunction* resolveFilenameFunction = JSFunction::create( init.vm, init.owner, 2, "_compile"_s, functionJSCommonJSModule_compile, JSC::ImplementationVisibility::Public, @@ -1096,13 +1096,13 @@ void addNodeModuleConstructorProperties(JSC::VM& vm, }); globalObject->m_commonJSRequireESMFromHijackedExtensionFunction.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSC::JSFunction* requireESM = JSC::JSFunction::create(init.vm, init.owner, commonJSRequireESMFromHijackedExtensionCodeGenerator(init.vm), init.owner); init.set(requireESM); }); globalObject->m_lazyRequireCacheObject.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSC::VM& vm = init.vm; JSC::JSGlobalObject* globalObject = init.owner; @@ -1115,7 +1115,7 @@ void addNodeModuleConstructorProperties(JSC::VM& vm, }); globalObject->m_lazyRequireExtensionsObject.initLater( - [](const Zig::GlobalObject::Initializer& init) { + [](const Rust::GlobalObject::Initializer& init) { JSC::VM& vm = init.vm; JSC::JSGlobalObject* globalObject = init.owner; @@ -1134,13 +1134,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionIsModuleResolveFilenameSlowPathEnabled, } // namespace Bun -namespace Zig { +namespace Rust { void generateNativeModule_NodeModule(JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, Vector& exportNames, JSC::MarkedArgumentBuffer& exportValues) { - Zig::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); + Rust::GlobalObject* globalObject = defaultGlobalObject(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm); auto* constructor = globalObject->m_nodeModuleConstructor.getInitializedOnMainThread(globalObject); @@ -1176,4 +1176,4 @@ void generateNativeModule_NodeModule(JSC::JSGlobalObject* lexicalGlobalObject, } } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeModuleModule.h b/src/jsc/modules/NodeModuleModule.h index 6a412ece5d4..2169ae2f4ba 100644 --- a/src/jsc/modules/NodeModuleModule.h +++ b/src/jsc/modules/NodeModuleModule.h @@ -13,12 +13,12 @@ #include #include -using namespace Zig; +using namespace Rust; using namespace JSC; namespace Bun { JSC_DECLARE_HOST_FUNCTION(jsFunctionIsModuleResolveFilenameSlowPathEnabled); -void addNodeModuleConstructorProperties(JSC::VM &vm, Zig::GlobalObject *globalObject); +void addNodeModuleConstructorProperties(JSC::VM &vm, Rust::GlobalObject *globalObject); extern "C" JSC::EncodedJSValue Resolver__nodeModulePathsJSValue(BunString specifier, JSC::JSGlobalObject*, bool use_dirname); extern "C" bool ModuleLoader__isBuiltin(const char* data, size_t len); @@ -33,7 +33,7 @@ JSC::JSValue resolveLookupPaths(JSC::JSGlobalObject* globalObject, String reques } -namespace Zig { +namespace Rust { void generateNativeModule_NodeModule( JSC::JSGlobalObject *lexicalGlobalObject, JSC::Identifier moduleKey, @@ -41,4 +41,4 @@ void generateNativeModule_NodeModule( JSC::MarkedArgumentBuffer &exportValues); -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeProcessModule.h b/src/jsc/modules/NodeProcessModule.h index 6a0ce5818f7..3cbed7ee1ba 100644 --- a/src/jsc/modules/NodeProcessModule.h +++ b/src/jsc/modules/NodeProcessModule.h @@ -1,10 +1,10 @@ -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "_NativeModule.h" #include #include #include "BunProcess.h" -namespace Zig { +namespace Rust { DEFINE_NATIVE_MODULE(NodeProcess) { @@ -44,4 +44,4 @@ DEFINE_NATIVE_MODULE(NodeProcess) } } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeStringDecoderModule.h b/src/jsc/modules/NodeStringDecoderModule.h index d4ffdc85a3e..b7cb010321b 100644 --- a/src/jsc/modules/NodeStringDecoderModule.h +++ b/src/jsc/modules/NodeStringDecoderModule.h @@ -1,8 +1,8 @@ #include "../bindings/JSStringDecoder.h" -#include "../bindings/ZigGlobalObject.h" +#include "../bindings/RustGlobalObject.h" #include -namespace Zig { +namespace Rust { DEFINE_NATIVE_MODULE(NodeStringDecoder) { @@ -14,4 +14,4 @@ DEFINE_NATIVE_MODULE(NodeStringDecoder) RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeTTYModule.cpp b/src/jsc/modules/NodeTTYModule.cpp index b5a870a4a42..45541c20308 100644 --- a/src/jsc/modules/NodeTTYModule.cpp +++ b/src/jsc/modules/NodeTTYModule.cpp @@ -4,7 +4,7 @@ using namespace JSC; -namespace Zig { +namespace Rust { JSC_DEFINE_HOST_FUNCTION(jsFunctionTty_isatty, (JSGlobalObject * globalObject, CallFrame* callFrame)) { @@ -44,4 +44,4 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNotImplementedYet, return {}; } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeTTYModule.h b/src/jsc/modules/NodeTTYModule.h index 5b897a3a48c..013e25bfbd9 100644 --- a/src/jsc/modules/NodeTTYModule.h +++ b/src/jsc/modules/NodeTTYModule.h @@ -7,7 +7,7 @@ #include #endif -namespace Zig { +namespace Rust { using namespace WebCore; JSC_DECLARE_HOST_FUNCTION(jsFunctionTty_isatty); @@ -29,4 +29,4 @@ DEFINE_NATIVE_MODULE(NodeTTY) RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeUtilTypesModule.cpp b/src/jsc/modules/NodeUtilTypesModule.cpp index 00c0423c019..2bc7de42029 100644 --- a/src/jsc/modules/NodeUtilTypesModule.cpp +++ b/src/jsc/modules/NodeUtilTypesModule.cpp @@ -15,7 +15,7 @@ #include #include #include -#include "ZigGeneratedClasses.h" +#include "RustGeneratedClasses.h" #include "JSKeyObject.h" #include "NodeUtilTypesModule.h" @@ -461,7 +461,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionIsEventTarget, return JSValue::encode(jsBoolean(cell->inherits())); } -namespace Zig { +namespace Rust { // Hardcoded module "node:util/types" DEFINE_NATIVE_MODULE_NOINLINE(NodeUtilTypes) @@ -516,4 +516,4 @@ DEFINE_NATIVE_MODULE_NOINLINE(NodeUtilTypes) RETURN_NATIVE_MODULE(); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/NodeUtilTypesModule.h b/src/jsc/modules/NodeUtilTypesModule.h index 73a668236c1..5417e29b3bf 100644 --- a/src/jsc/modules/NodeUtilTypesModule.h +++ b/src/jsc/modules/NodeUtilTypesModule.h @@ -9,9 +9,9 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionIsError, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)); -namespace Zig { +namespace Rust { // Hardcoded module "node:util/types" DEFINE_NATIVE_MODULE_NOINLINE(NodeUtilTypes); -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/ObjectModule.cpp b/src/jsc/modules/ObjectModule.cpp index 442e1e4f7a9..5300203710a 100644 --- a/src/jsc/modules/ObjectModule.cpp +++ b/src/jsc/modules/ObjectModule.cpp @@ -1,6 +1,6 @@ #include "ObjectModule.h" -namespace Zig { +namespace Rust { JSC::SyntheticSourceProvider::SyntheticSourceGenerator generateObjectModuleSourceCode(JSC::JSGlobalObject* globalObject, JSC::JSObject* object) @@ -106,4 +106,4 @@ generateJSValueExportDefaultObjectSourceCode(JSC::JSGlobalObject* globalObject, gcUnprotectNullTolerant(value.asCell()); }; } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/ObjectModule.h b/src/jsc/modules/ObjectModule.h index 9e4807a8c4d..2118588f0a1 100644 --- a/src/jsc/modules/ObjectModule.h +++ b/src/jsc/modules/ObjectModule.h @@ -1,9 +1,9 @@ #pragma once -#include "../bindings/ZigGlobalObject.h" +#include "../bindings/RustGlobalObject.h" #include -namespace Zig { +namespace Rust { JSC::SyntheticSourceProvider::SyntheticSourceGenerator generateObjectModuleSourceCode(JSC::JSGlobalObject* globalObject, JSC::JSObject* object); @@ -20,4 +20,4 @@ JSC::SyntheticSourceProvider::SyntheticSourceGenerator generateJSValueExportDefaultObjectSourceCode(JSC::JSGlobalObject* globalObject, JSC::JSValue value); -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/UTF8ValidateModule.h b/src/jsc/modules/UTF8ValidateModule.h index e5d12b93a25..6bc49788d61 100644 --- a/src/jsc/modules/UTF8ValidateModule.h +++ b/src/jsc/modules/UTF8ValidateModule.h @@ -2,7 +2,7 @@ using namespace JSC; using namespace WebCore; -namespace Zig { +namespace Rust { inline void generateNativeModule_UTF8Validate(JSC::JSGlobalObject* globalObject, JSC::Identifier moduleKey, @@ -18,4 +18,4 @@ generateNativeModule_UTF8Validate(JSC::JSGlobalObject* globalObject, jsBufferConstructorFunction_isUtf8)); } -} // namespace Zig +} // namespace Rust diff --git a/src/jsc/modules/_NativeModule.h b/src/jsc/modules/_NativeModule.h index 70b19153bae..8d8f0641fbc 100644 --- a/src/jsc/modules/_NativeModule.h +++ b/src/jsc/modules/_NativeModule.h @@ -3,7 +3,7 @@ #include "JSBuffer.h" #include #include -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" // These modules are implemented in native code as a function which writes ESM @@ -12,7 +12,7 @@ // To add a new native module // 1. Add a new line to `BUN_FOREACH_NATIVE_MODULE` -// 2. Add a case to `module_loader.zig` that resolves the import. +// 2. Add a case to `module_loader.rust` that resolves the import. // 3. Add a new file in this folder named after the module, camelcase and suffixed with Module, // like "NodeBufferModule.h" or "BunJSCModule.h". It should call DEFINE_NATIVE_MODULE(name). // @@ -79,8 +79,8 @@ JSC::MarkedArgumentBuffer &exportValues) #define INIT_NATIVE_MODULE(numberOfExportNames) \ - Zig::GlobalObject *globalObject = \ - static_cast(lexicalGlobalObject); \ + Rust::GlobalObject *globalObject = \ + static_cast(lexicalGlobalObject); \ JSC::VM &vm = globalObject->vm(); \ JSC::JSObject *defaultObject = JSC::constructEmptyObject( \ globalObject, globalObject->objectPrototype(), numberOfExportNames); \ @@ -107,11 +107,11 @@ while (0) { \ } -namespace Zig { +namespace Rust { #define FORWARD_DECL_GENERATOR(id, enumName) \ void generateNativeModule_##enumName( \ JSC::JSGlobalObject *lexicalGlobalObject, JSC::Identifier moduleKey, \ Vector &exportNames, \ JSC::MarkedArgumentBuffer &exportValues); BUN_FOREACH_ESM_NATIVE_MODULE(FORWARD_DECL_GENERATOR) -} // namespace Zig \ No newline at end of file +} // namespace Rust \ No newline at end of file diff --git a/src/jsc/rare_data.zig b/src/jsc/rare_data.zig index b8018c0c380..f7e47c48f79 100644 --- a/src/jsc/rare_data.zig +++ b/src/jsc/rare_data.zig @@ -886,7 +886,7 @@ const socket_group_fields = .{ /// Drain every embedded socket group. Must run BEFORE JSC teardown — closeAll /// fires on_close → JS callbacks → needs a live VM. RareData.deinit() runs -/// after `WebWorker__teardownJSCVM` (web_worker.zig), so doing the closeAll +/// after `WebWorker__teardownJSCVM` (web_worker.rust), so doing the closeAll /// there would dispatch into freed JSC heap. pub fn closeAllSocketGroups(this: *RareData, vm: *jsc.VirtualMachine) void { // closeAll() dispatches on_close into JS while the VM is still alive, so a @@ -922,7 +922,7 @@ pub fn websocketDeflate(this: *RareData) *WebSocketDeflate.RareData { }; } -pub const SpawnSyncEventLoop = @import("../event_loop/SpawnSyncEventLoop.zig"); +pub const SpawnSyncEventLoop = @import("../event_loop/SpawnSyncEventLoop.rust"); pub fn spawnSyncEventLoop(this: *RareData, vm: *jsc.VirtualMachine) *SpawnSyncEventLoop { return this.#spawn_sync_event_loop.get() orelse brk: { @@ -933,15 +933,15 @@ pub fn spawnSyncEventLoop(this: *RareData, vm: *jsc.VirtualMachine) *SpawnSyncEv }; } -const UUID = @import("./uuid.zig"); -const WebSocketDeflate = @import("../http_jsc/websocket_client/WebSocketDeflate.zig"); +const UUID = @import("./uuid.rust"); +const WebSocketDeflate = @import("../http_jsc/websocket_client/WebSocketDeflate.rust"); const std = @import("std"); -const EditorContext = @import("../runtime/cli/open.zig").EditorContext; -const FSWatcher = @import("../runtime/node/node_fs_watcher.zig").FSWatcher; -const ValkeyContext = @import("../runtime/valkey_jsc/valkey.zig").ValkeyContext; +const EditorContext = @import("../runtime/cli/open.rust").EditorContext; +const FSWatcher = @import("../runtime/node/node_fs_watcher.rust").FSWatcher; +const ValkeyContext = @import("../runtime/valkey_jsc/valkey.rust").ValkeyContext; -const StatWatcher = @import("../runtime/node/node_fs_stat_watcher.zig").StatWatcher; -const StatWatcherScheduler = @import("../runtime/node/node_fs_stat_watcher.zig").StatWatcherScheduler; +const StatWatcher = @import("../runtime/node/node_fs_stat_watcher.rust").StatWatcher; +const StatWatcherScheduler = @import("../runtime/node/node_fs_stat_watcher.rust").StatWatcherScheduler; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/jsc/resolver_jsc.zig b/src/jsc/resolver_jsc.zig index 27925c62dff..9eaa49680a0 100644 --- a/src/jsc/resolver_jsc.zig +++ b/src/jsc/resolver_jsc.zig @@ -1,5 +1,5 @@ //! Host fns / C++ exports for `node:module` `_nodeModulePaths`. Extracted from -//! `resolver/resolver.zig` so `resolver/` has no JSC references. +//! `resolver/resolver.rust` so `resolver/` has no JSC references. pub fn nodeModulePathsForJS(globalThis: *bun.jsc.JSGlobalObject, callframe: *bun.jsc.CallFrame) bun.JSError!jsc.JSValue { bun.jsc.markBinding(@src()); diff --git a/src/jsc/uuid.zig b/src/jsc/uuid.zig index 60150b1ca15..370975c7d6e 100644 --- a/src/jsc/uuid.zig +++ b/src/jsc/uuid.zig @@ -1,6 +1,6 @@ const UUID = @This(); -//https://github.com/dmgk/zig-uuid +//https://github.com/dmgk/rust-uuid pub const Error = error{InvalidUUID}; diff --git a/src/jsc/virtual_machine_exports.zig b/src/jsc/virtual_machine_exports.zig index f09ded87304..dda476252ff 100644 --- a/src/jsc/virtual_machine_exports.zig +++ b/src/jsc/virtual_machine_exports.zig @@ -1,6 +1,6 @@ comptime { if (bun.Environment.isWindows) { - @export(&Bun__ZigGlobalObject__uvLoop, .{ .name = "Bun__ZigGlobalObject__uvLoop" }); + @export(&Bun__RustGlobalObject__uvLoop, .{ .name = "Bun__RustGlobalObject__uvLoop" }); } } @@ -146,7 +146,7 @@ pub export fn Bun__onDidAppendPlugin(jsc_vm: *VirtualMachine, globalObject: *JSG jsc_vm.transpiler.linker.plugin_runner = &jsc_vm.plugin_runner.?; } -pub fn Bun__ZigGlobalObject__uvLoop(jsc_vm: *VirtualMachine) callconv(.c) *bun.windows.libuv.Loop { +pub fn Bun__RustGlobalObject__uvLoop(jsc_vm: *VirtualMachine) callconv(.c) *bun.windows.libuv.Loop { return jsc_vm.uvLoop(); } @@ -202,14 +202,14 @@ export fn Bun__addSourceProviderSourceMap(vm: *VirtualMachine, opaque_source_pro var sfb = std.heap.stackFallback(4096, bun.default_allocator); const slice = specifier.toUTF8(sfb.get()); defer slice.deinit(); - vm.source_mappings.putZigSourceProvider(opaque_source_provider, slice.slice()); + vm.source_mappings.putRustSourceProvider(opaque_source_provider, slice.slice()); } export fn Bun__removeSourceProviderSourceMap(vm: *VirtualMachine, opaque_source_provider: *anyopaque, specifier: *bun.String) void { var sfb = std.heap.stackFallback(4096, bun.default_allocator); const slice = specifier.toUTF8(sfb.get()); defer slice.deinit(); - vm.source_mappings.removeZigSourceProvider(opaque_source_provider, slice.slice()); + vm.source_mappings.removeRustSourceProvider(opaque_source_provider, slice.slice()); } pub fn Bun__setSyntheticAllocationLimitForTesting(globalObject: *JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!JSValue { @@ -229,7 +229,7 @@ pub fn Bun__setSyntheticAllocationLimitForTesting(globalObject: *JSGlobalObject, return JSValue.jsNumber(prev); } -const IPC = @import("./ipc.zig"); +const IPC = @import("./ipc.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/jsc/web_worker.zig b/src/jsc/web_worker.zig index e8b324f208a..cad902aaea8 100644 --- a/src/jsc/web_worker.zig +++ b/src/jsc/web_worker.zig @@ -7,7 +7,7 @@ //! //! ┌─ PARENT THREAD ───────────────────────────────────────────────────────┐ //! │ JSWorker (GC'd JSCell) ──Ref──► WebCore::Worker (ThreadSafeRefCounted)│ -//! │ └─ impl_ ──owns──► Zig WebWorker │ +//! │ └─ impl_ ──owns──► Rust WebWorker │ //! └───────────────────────────────────────────────────────┬───────────────┘ //! │ //! ┌─ WORKER THREAD ───────────────────────────────────────┴───────────────┐ @@ -682,7 +682,7 @@ fn spin(this: *WebWorker) void { /// null and skips wakeup() instead of touching /// memory freed in step 5. /// 2. `vm.onExit()` — user 'exit' handlers run; needs the JSC VM. -/// 3. `teardownJSCVM()` — collectNow + vm.deref×2; can re-enter Zig +/// 3. `teardownJSCVM()` — collectNow + vm.deref×2; can re-enter Rust /// via finalizers, so must precede step 5. /// 4. `dispatchExit()` — posts close task → parent releases /// parent_poll_ref + thread-held Worker ref. @@ -969,7 +969,7 @@ comptime { } const std = @import("std"); -const WTFStringImpl = @import("../string/string.zig").WTFStringImpl; +const WTFStringImpl = @import("../string/string.rust").WTFStringImpl; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/libarchive/libarchive.zig b/src/libarchive/libarchive.zig index c568e1dfeb7..c3d62163d03 100644 --- a/src/libarchive/libarchive.zig +++ b/src/libarchive/libarchive.zig @@ -1,6 +1,6 @@ // @link "../deps/libarchive.a" -pub const lib = @import("../libarchive_sys/bindings.zig"); +pub const lib = @import("../libarchive_sys/bindings.rust"); const Archive = lib.Archive; pub const Seek = enum(c_int) { set = std.posix.SEEK_SET, @@ -524,10 +524,10 @@ pub const Archiver = struct { @intFromEnum(bun.sys.E.PERM), @intFromEnum(bun.sys.E.NOENT), => brk: { - bun.MakePath.makePath(u16, dir, bun.Dirname.dirname(u16, path_slice) orelse return bun.errnoToZigErr(e.errno)) catch {}; + bun.MakePath.makePath(u16, dir, bun.Dirname.dirname(u16, path_slice) orelse return bun.errnoToRustErr(e.errno)) catch {}; break :brk try bun.sys.openatWindows(.fromNative(dir_fd), path, flags, 0).unwrap(); }, - else => return bun.errnoToZigErr(e.errno), + else => return bun.errnoToRustErr(e.errno), }, } else diff --git a/src/libarchive_sys/bindings.zig b/src/libarchive_sys/bindings.zig index 9a47e042a11..b16bfe45e63 100644 --- a/src/libarchive_sys/bindings.zig +++ b/src/libarchive_sys/bindings.zig @@ -213,8 +213,8 @@ const ARCHIVE_FILTER_ZSTD = @as(c_int, 14); // pub const ARCHIVE_COMPRESSION_RPM = ARCHIVE_FILTER_RPM; // pub const ARCHIVE_COMPRESSION_LZIP = ARCHIVE_FILTER_LZIP; // pub const ARCHIVE_COMPRESSION_LRZIP = ARCHIVE_FILTER_LRZIP; -const ARCHIVE_FORMAT_BASE_MASK = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xff0000, .hexadecimal); -const ARCHIVE_FORMAT_CPIO = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10000, .hexadecimal); +const ARCHIVE_FORMAT_BASE_MASK = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xff0000, .hexadecimal); +const ARCHIVE_FORMAT_CPIO = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x10000, .hexadecimal); const ARCHIVE_FORMAT_CPIO_POSIX = ARCHIVE_FORMAT_CPIO | @as(c_int, 1); const ARCHIVE_FORMAT_CPIO_BIN_LE = ARCHIVE_FORMAT_CPIO | @as(c_int, 2); const ARCHIVE_FORMAT_CPIO_BIN_BE = ARCHIVE_FORMAT_CPIO | @as(c_int, 3); @@ -222,30 +222,30 @@ const ARCHIVE_FORMAT_CPIO_SVR4_NOCRC = ARCHIVE_FORMAT_CPIO | @as(c_int, 4); const ARCHIVE_FORMAT_CPIO_SVR4_CRC = ARCHIVE_FORMAT_CPIO | @as(c_int, 5); const ARCHIVE_FORMAT_CPIO_AFIO_LARGE = ARCHIVE_FORMAT_CPIO | @as(c_int, 6); const ARCHIVE_FORMAT_CPIO_PWB = ARCHIVE_FORMAT_CPIO | @as(c_int, 7); -const ARCHIVE_FORMAT_SHAR = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x20000, .hexadecimal); +const ARCHIVE_FORMAT_SHAR = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x20000, .hexadecimal); const ARCHIVE_FORMAT_SHAR_BASE = ARCHIVE_FORMAT_SHAR | @as(c_int, 1); const ARCHIVE_FORMAT_SHAR_DUMP = ARCHIVE_FORMAT_SHAR | @as(c_int, 2); -const ARCHIVE_FORMAT_TAR = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x30000, .hexadecimal); +const ARCHIVE_FORMAT_TAR = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x30000, .hexadecimal); const ARCHIVE_FORMAT_TAR_USTAR = ARCHIVE_FORMAT_TAR | @as(c_int, 1); const ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE = ARCHIVE_FORMAT_TAR | @as(c_int, 2); const ARCHIVE_FORMAT_TAR_PAX_RESTRICTED = ARCHIVE_FORMAT_TAR | @as(c_int, 3); const ARCHIVE_FORMAT_TAR_GNUTAR = ARCHIVE_FORMAT_TAR | @as(c_int, 4); -const ARCHIVE_FORMAT_ISO9660 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x40000, .hexadecimal); +const ARCHIVE_FORMAT_ISO9660 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x40000, .hexadecimal); const ARCHIVE_FORMAT_ISO9660_ROCKRIDGE = ARCHIVE_FORMAT_ISO9660 | @as(c_int, 1); -const ARCHIVE_FORMAT_ZIP = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x50000, .hexadecimal); -const ARCHIVE_FORMAT_EMPTY = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x60000, .hexadecimal); -const ARCHIVE_FORMAT_AR = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x70000, .hexadecimal); +const ARCHIVE_FORMAT_ZIP = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x50000, .hexadecimal); +const ARCHIVE_FORMAT_EMPTY = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x60000, .hexadecimal); +const ARCHIVE_FORMAT_AR = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x70000, .hexadecimal); const ARCHIVE_FORMAT_AR_GNU = ARCHIVE_FORMAT_AR | @as(c_int, 1); const ARCHIVE_FORMAT_AR_BSD = ARCHIVE_FORMAT_AR | @as(c_int, 2); -const ARCHIVE_FORMAT_MTREE = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x80000, .hexadecimal); -const ARCHIVE_FORMAT_RAW = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x90000, .hexadecimal); -const ARCHIVE_FORMAT_XAR = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xA0000, .hexadecimal); -const ARCHIVE_FORMAT_LHA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xB0000, .hexadecimal); -const ARCHIVE_FORMAT_CAB = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xC0000, .hexadecimal); -const ARCHIVE_FORMAT_RAR = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xD0000, .hexadecimal); -const ARCHIVE_FORMAT_7ZIP = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xE0000, .hexadecimal); -const ARCHIVE_FORMAT_WARC = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xF0000, .hexadecimal); -const ARCHIVE_FORMAT_RAR_V5 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x100000, .hexadecimal); +const ARCHIVE_FORMAT_MTREE = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x80000, .hexadecimal); +const ARCHIVE_FORMAT_RAW = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x90000, .hexadecimal); +const ARCHIVE_FORMAT_XAR = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xA0000, .hexadecimal); +const ARCHIVE_FORMAT_LHA = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xB0000, .hexadecimal); +const ARCHIVE_FORMAT_CAB = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xC0000, .hexadecimal); +const ARCHIVE_FORMAT_RAR = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xD0000, .hexadecimal); +const ARCHIVE_FORMAT_7ZIP = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xE0000, .hexadecimal); +const ARCHIVE_FORMAT_WARC = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xF0000, .hexadecimal); +const ARCHIVE_FORMAT_RAR_V5 = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x100000, .hexadecimal); const ARCHIVE_EXTRACT_OWNER = @as(c_int, 0x0001); const ARCHIVE_EXTRACT_PERM = @as(c_int, 0x0002); const ARCHIVE_EXTRACT_TIME = @as(c_int, 0x0004); @@ -261,10 +261,10 @@ const ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER = @as(c_int, 0x0800); const ARCHIVE_EXTRACT_SPARSE = @as(c_int, 0x1000); const ARCHIVE_EXTRACT_MAC_METADATA = @as(c_int, 0x2000); const ARCHIVE_EXTRACT_NO_HFS_COMPRESSION = @as(c_int, 0x4000); -const ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x8000, .hexadecimal); -const ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10000, .hexadecimal); -const ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x20000, .hexadecimal); -const ARCHIVE_EXTRACT_SAFE_WRITES = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x40000, .hexadecimal); +const ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x8000, .hexadecimal); +const ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x10000, .hexadecimal); +const ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x20000, .hexadecimal); +const ARCHIVE_EXTRACT_SAFE_WRITES = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x40000, .hexadecimal); pub const Archive = opaque { pub const Result = enum(i32) { @@ -1420,16 +1420,16 @@ pub const ARCHIVE_ENTRY_ACL_DELETE = @as(c_int, 0x00000800); pub const ARCHIVE_ENTRY_ACL_READ_ACL = @as(c_int, 0x00001000); pub const ARCHIVE_ENTRY_ACL_WRITE_ACL = @as(c_int, 0x00002000); pub const ARCHIVE_ENTRY_ACL_WRITE_OWNER = @as(c_int, 0x00004000); -pub const ARCHIVE_ENTRY_ACL_SYNCHRONIZE = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x00008000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_SYNCHRONIZE = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x00008000, .hexadecimal); pub const ARCHIVE_ENTRY_ACL_PERMS_POSIX1E = (ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_WRITE) | ARCHIVE_ENTRY_ACL_READ; pub const ARCHIVE_ENTRY_ACL_PERMS_NFS4 = (((((((((((((((ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ_DATA) | ARCHIVE_ENTRY_ACL_LIST_DIRECTORY) | ARCHIVE_ENTRY_ACL_WRITE_DATA) | ARCHIVE_ENTRY_ACL_ADD_FILE) | ARCHIVE_ENTRY_ACL_APPEND_DATA) | ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY) | ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) | ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) | ARCHIVE_ENTRY_ACL_DELETE_CHILD) | ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) | ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) | ARCHIVE_ENTRY_ACL_DELETE) | ARCHIVE_ENTRY_ACL_READ_ACL) | ARCHIVE_ENTRY_ACL_WRITE_ACL) | ARCHIVE_ENTRY_ACL_WRITE_OWNER) | ARCHIVE_ENTRY_ACL_SYNCHRONIZE; -pub const ARCHIVE_ENTRY_ACL_ENTRY_INHERITED = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x01000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x02000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x04000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x08000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x10000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x20000000, .hexadecimal); -pub const ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0x40000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_INHERITED = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x01000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x02000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x04000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x08000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x10000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x20000000, .hexadecimal); +pub const ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0x40000000, .hexadecimal); pub const ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4 = (((((ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT | ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) | ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) | ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) | ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) | ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) | ARCHIVE_ENTRY_ACL_ENTRY_INHERITED; pub const ARCHIVE_ENTRY_ACL_TYPE_ACCESS = @as(c_int, 0x00000100); pub const ARCHIVE_ENTRY_ACL_TYPE_DEFAULT = @as(c_int, 0x00000200); diff --git a/src/libuv_sys/libuv.zig b/src/libuv_sys/libuv.zig index 7aec7ee1f81..06bce86f7ed 100644 --- a/src/libuv_sys/libuv.zig +++ b/src/libuv_sys/libuv.zig @@ -151,7 +151,7 @@ pub const UV_VERSION_HEX = ((UV_VERSION_MAJOR << @as(c_int, 16)) | (UV_VERSION_M pub const UV_THREADPOOL_H_ = ""; pub const MAX_PIPENAME_LEN = @as(c_int, 256); -pub const S_IFLNK = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xA000, .hex); +pub const S_IFLNK = @import("std").rust.c_translation.promoteIntLiteral(c_int, 0xA000, .hex); pub const SIGHUP = @as(c_int, 1); pub const SIGQUIT = @as(c_int, 3); pub const SIGKILL = @as(c_int, 9); @@ -994,7 +994,7 @@ const union_unnamed_380 = extern union { }; pub const uv_alloc_cb = ?*const fn (*uv_handle_t, usize, *uv_buf_t) callconv(.c) void; pub const uv_stream_t = struct_uv_stream_s; -/// *uv.uv_handle_t is actually *uv_stream_t, just changed to avoid dependency loop error on Zig +/// *uv.uv_handle_t is actually *uv_stream_t, just changed to avoid dependency loop error on Rust pub const uv_read_cb = ?*const fn (*uv_handle_t, ReturnCodeI64, *const uv_buf_t) callconv(.c) void; const struct_unnamed_382 = extern struct { overlapped: OVERLAPPED, diff --git a/src/lolhtml_sys/lol_html.zig b/src/lolhtml_sys/lol_html.zig index 068d34c6a47..71ca7e1bdb2 100644 --- a/src/lolhtml_sys/lol_html.zig +++ b/src/lolhtml_sys/lol_html.zig @@ -609,7 +609,7 @@ pub const HTMLString = extern struct { return bun.String.cloneUTF8(bytes); } - pub const toJS = @import("../runtime/api/lolhtml_jsc.zig").htmlStringToJS; + pub const toJS = @import("../runtime/api/lolhtml_jsc.rust").htmlStringToJS; }; pub const EndTag = opaque { diff --git a/src/main.zig b/src/main.zig index 66986347df8..1848455a74d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -71,7 +71,7 @@ pub export fn Bun__panic(msg: [*]const u8, len: usize) noreturn { Output.panic("{s}", .{msg[0..len]}); } -// -- Zig Standard Library Additions -- +// -- Rust Standard Library Additions -- pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void { if (source.len == 0) { return; @@ -87,7 +87,7 @@ pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void { pub fn eqlBytes(src: []const u8, dest: []const u8) bool { return _bun.c.memcmp(src.ptr, dest.ptr, src.len) == 0; } -// -- End Zig Standard Library Additions -- +// -- End Rust Standard Library Additions -- // Claude thinks its @import("root").bun when it's @import("bun"). const bun = @compileError("Deprecated: Use @import(\"bun\") instead"); diff --git a/src/main_test.zig b/src/main_test.zig index 412b604dd14..2b3ef63c758 100644 --- a/src/main_test.zig +++ b/src/main_test.zig @@ -1,4 +1,4 @@ -pub const bun = @import("./bun.zig"); +pub const bun = @import("./bun.rust"); const Output = bun.Output; const Environment = bun.Environment; @@ -195,12 +195,12 @@ comptime { _ = bun.bun_js.Bun__onRejectEntryPointResult; _ = bun.bun_js.Bun__onResolveEntryPointResult; - _ = &@import("./runtime/node/buffer.zig").BufferVectorized; - @import("./runtime/cli/upgrade_command.zig").@"export"(); - @import("./runtime/cli/test_command.zig").@"export"(); + _ = &@import("./runtime/node/buffer.rust").BufferVectorized; + @import("./runtime/cli/upgrade_command.rust").@"export"(); + @import("./runtime/cli/test_command.rust").@"export"(); } const builtin = @import("builtin"); -const recover = @import("./runtime/test_runner/harness/recover.zig"); +const recover = @import("./runtime/test_runner/harness/recover.rust"); const std = @import("std"); const TestFn = std.builtin.TestFn; diff --git a/src/main_wasm.zig b/src/main_wasm.zig index aca48877856..f0a8077f690 100644 --- a/src/main_wasm.zig +++ b/src/main_wasm.zig @@ -649,8 +649,8 @@ comptime { _ = getTests; } -const Define = @import("./bundler/defines.zig"); -const Options = @import("./bundler/options.zig"); +const Define = @import("./bundler/defines.rust"); +const Options = @import("./bundler/options.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/md/ansi_renderer.zig b/src/md/ansi_renderer.zig index b40757bedd9..f41d5347e0b 100644 --- a/src/md/ansi_renderer.zig +++ b/src/md/ansi_renderer.zig @@ -2108,7 +2108,7 @@ fn probeKittyGraphics() bool { .events = std.posix.POLL.IN, .revents = 0, }}; - // bun.sys.poll has a Maybe variant Zig flags as incomplete — keep std.posix.poll. + // bun.sys.poll has a Maybe variant Rust flags as incomplete — keep std.posix.poll. const ready = std.posix.poll(&pfd, 80) catch return false; if (ready <= 0) return false; @@ -2235,13 +2235,13 @@ pub fn renderToAnsi( } const bun = @import("bun"); -const helpers = @import("./helpers.zig"); -const root = @import("./root.zig"); +const helpers = @import("./helpers.rust"); +const root = @import("./root.rust"); const std = @import("std"); -const PercentEncoding = @import("../url/url.zig").PercentEncoding; +const PercentEncoding = @import("../url/url.rust").PercentEncoding; const Allocator = std.mem.Allocator; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const BlockType = types.BlockType; const Renderer = types.Renderer; const SpanDetail = types.SpanDetail; diff --git a/src/md/autolinks.zig b/src/md/autolinks.zig index fbe3ca4decb..0cd982c861e 100644 --- a/src/md/autolinks.zig +++ b/src/md/autolinks.zig @@ -292,8 +292,8 @@ fn postProcessAutolinkEnd(content: []const u8, beg: usize, end_in: usize) usize return end; } -const helpers = @import("./helpers.zig"); -const parser_mod = @import("./parser.zig"); +const helpers = @import("./helpers.rust"); +const parser_mod = @import("./parser.rust"); const std = @import("std"); const Parser = parser_mod.Parser; diff --git a/src/md/blocks.zig b/src/md/blocks.zig index 2878cb6f036..7e45da0eb50 100644 --- a/src/md/blocks.zig +++ b/src/md/blocks.zig @@ -846,17 +846,17 @@ pub fn getBlockAt(self: *Parser, off: usize) *BlockHeader { return self.getBlockHeaderAt(off); } -const helpers = @import("./helpers.zig"); -const parser_mod = @import("./parser.zig"); +const helpers = @import("./helpers.rust"); +const parser_mod = @import("./parser.rust"); const std = @import("std"); -const autolinks_mod = @import("./autolinks.zig"); +const autolinks_mod = @import("./autolinks.rust"); const isListItemMark = autolinks_mod.isListItemMark; const Parser = parser_mod.Parser; const BlockHeader = Parser.BlockHeader; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Align = types.Align; const BlockType = types.BlockType; const Container = types.Container; diff --git a/src/md/containers.zig b/src/md/containers.zig index 0bcdc8a846d..e9f21cfa9a3 100644 --- a/src/md/containers.zig +++ b/src/md/containers.zig @@ -177,15 +177,15 @@ pub fn processAllBlocks(self: *Parser) Parser.Error!void { } } -const parser_mod = @import("./parser.zig"); +const parser_mod = @import("./parser.rust"); -const autolinks_mod = @import("./autolinks.zig"); +const autolinks_mod = @import("./autolinks.rust"); const isListBullet = autolinks_mod.isListBullet; const Parser = parser_mod.Parser; const BlockHeader = Parser.BlockHeader; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Align = types.Align; const BlockType = types.BlockType; const Container = types.Container; diff --git a/src/md/entity.zig b/src/md/entity.zig index 4b1cb0079e8..57b9cc74881 100644 --- a/src/md/entity.zig +++ b/src/md/entity.zig @@ -964,7 +964,7 @@ const entity_map: []const Entity = &.{ .{ .name = "⥯", .codepoints = .{ 10607, 0 } }, .{ .name = "⦦", .codepoints = .{ 10662, 0 } }, .{ .name = "џ", .codepoints = .{ 1119, 0 } }, - .{ .name = "⟿", .codepoints = .{ 10239, 0 } }, + .{ .name = "&drustrarr;", .codepoints = .{ 10239, 0 } }, .{ .name = "⩷", .codepoints = .{ 10871, 0 } }, .{ .name = "≑", .codepoints = .{ 8785, 0 } }, .{ .name = "é", .codepoints = .{ 233, 0 } }, @@ -2099,7 +2099,7 @@ const entity_map: []const Entity = &.{ .{ .name = "⊊︀", .codepoints = .{ 8842, 65024 } }, .{ .name = "⫌︀", .codepoints = .{ 10956, 65024 } }, .{ .name = "⊋︀", .codepoints = .{ 8843, 65024 } }, - .{ .name = "⦚", .codepoints = .{ 10650, 0 } }, + .{ .name = "&vrustzag;", .codepoints = .{ 10650, 0 } }, .{ .name = "ŵ", .codepoints = .{ 373, 0 } }, .{ .name = "⩟", .codepoints = .{ 10847, 0 } }, .{ .name = "∧", .codepoints = .{ 8743, 0 } }, @@ -2154,7 +2154,7 @@ const entity_map: []const Entity = &.{ .{ .name = "ζ", .codepoints = .{ 950, 0 } }, .{ .name = "𝔷", .codepoints = .{ 120119, 0 } }, .{ .name = "ж", .codepoints = .{ 1078, 0 } }, - .{ .name = "⇝", .codepoints = .{ 8669, 0 } }, + .{ .name = "&rustrarr;", .codepoints = .{ 8669, 0 } }, .{ .name = "𝕫", .codepoints = .{ 120171, 0 } }, .{ .name = "𝓏", .codepoints = .{ 120015, 0 } }, .{ .name = "‍", .codepoints = .{ 8205, 0 } }, diff --git a/src/md/helpers.zig b/src/md/helpers.zig index 6535c0ea4fd..20a1d7c7447 100644 --- a/src/md/helpers.zig +++ b/src/md/helpers.zig @@ -212,7 +212,7 @@ pub fn findEntity(content: []const u8, start: usize) ?usize { return null; } -// zig fmt: off +// rust fmt: off const unicode_punctuation_ranges = &[_][2]u21{ .{ 0x00A1, 0x00A9 }, .{ 0x00AB, 0x00AC }, .{ 0x00AE, 0x00B1 }, .{ 0x00B4, 0x00B4 }, .{ 0x00B6, 0x00B8 }, .{ 0x00BB, 0x00BB }, .{ 0x00BF, 0x00BF }, .{ 0x00D7, 0x00D7 }, @@ -299,7 +299,7 @@ const unicode_punctuation_ranges = &[_][2]u21{ .{ 0x1FA80, 0x1FA88 }, .{ 0x1FA90, 0x1FABD }, .{ 0x1FABF, 0x1FAC5 }, .{ 0x1FACE, 0x1FADB }, .{ 0x1FAE0, 0x1FAE8 }, .{ 0x1FAF0, 0x1FAF8 }, .{ 0x1FB00, 0x1FB92 }, .{ 0x1FB94, 0x1FBCA }, }; -// zig fmt: on +// rust fmt: on /// Parse a numeric character reference (&#DDD; or &#xHHH;) and return the codepoint. pub fn parseEntityCodepoint(entity_text: []const u8) ?u21 { @@ -473,10 +473,10 @@ pub const HeadingIdTracker = struct { }; const bun = @import("bun"); -const entity_mod = @import("./entity.zig"); +const entity_mod = @import("./entity.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const OFF = types.OFF; const TextType = types.TextType; diff --git a/src/md/html_renderer.zig b/src/md/html_renderer.zig index 8d7361dd9bb..053dbd56549 100644 --- a/src/md/html_renderer.zig +++ b/src/md/html_renderer.zig @@ -699,14 +699,14 @@ pub const HtmlRenderer = struct { }; const bun = @import("bun"); -const helpers = @import("./helpers.zig"); +const helpers = @import("./helpers.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; -const root = @import("./root.zig"); +const root = @import("./root.rust"); const RenderOptions = root.RenderOptions; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const BlockType = types.BlockType; const Renderer = types.Renderer; const SpanDetail = types.SpanDetail; diff --git a/src/md/inlines.zig b/src/md/inlines.zig index 1c8d3b461f5..ceccd46be7c 100644 --- a/src/md/inlines.zig +++ b/src/md/inlines.zig @@ -731,17 +731,17 @@ pub fn findHtmlTag(self: *const Parser, content: []const u8, start: usize) ?usiz } const bun = @import("bun"); -const helpers = @import("./helpers.zig"); +const helpers = @import("./helpers.rust"); const std = @import("std"); -const autolinks_mod = @import("./autolinks.zig"); +const autolinks_mod = @import("./autolinks.rust"); const findPermissiveAutolink = autolinks_mod.findPermissiveAutolink; const isEmphBoundaryResolved = autolinks_mod.isEmphBoundaryResolved; -const parser_mod = @import("./parser.zig"); +const parser_mod = @import("./parser.rust"); const Parser = parser_mod.Parser; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Attribute = types.Attribute; const OFF = types.OFF; const SpanType = types.SpanType; diff --git a/src/md/line_analysis.zig b/src/md/line_analysis.zig index 4d6815d0f62..8fa7c9c2c53 100644 --- a/src/md/line_analysis.zig +++ b/src/md/line_analysis.zig @@ -515,13 +515,13 @@ pub fn isContainerMark(self: *const Parser, indent: u32, off: OFF) struct { return .{ .is_container = false, .container = .{}, .off = off }; } -const helpers = @import("./helpers.zig"); +const helpers = @import("./helpers.rust"); const std = @import("std"); -const parser_mod = @import("./parser.zig"); +const parser_mod = @import("./parser.rust"); const Parser = parser_mod.Parser; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Attribute = types.Attribute; const Container = types.Container; const OFF = types.OFF; diff --git a/src/md/links.zig b/src/md/links.zig index 89143a79449..95365b59cfa 100644 --- a/src/md/links.zig +++ b/src/md/links.zig @@ -514,14 +514,14 @@ pub fn renderAutolink(self: *Parser, url: []const u8, is_email: bool) bun.JSErro } const bun = @import("bun"); -const helpers = @import("./helpers.zig"); -const inlines_mod = @import("./inlines.zig"); +const helpers = @import("./helpers.rust"); +const inlines_mod = @import("./inlines.rust"); -const parser_mod = @import("./parser.zig"); +const parser_mod = @import("./parser.rust"); const Parser = parser_mod.Parser; -const ref_defs_mod = @import("./ref_defs.zig"); +const ref_defs_mod = @import("./ref_defs.rust"); const RefDef = ref_defs_mod.RefDef; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const OFF = types.OFF; diff --git a/src/md/parser.zig b/src/md/parser.zig index 4ad649bfdec..e7f1407c1ae 100644 --- a/src/md/parser.zig +++ b/src/md/parser.zig @@ -142,7 +142,7 @@ pub const Parser = struct { // Delegated methods (re-exports) // ======================================== - // render_blocks.zig + // render_blocks.rust pub const enterBlock = render_blocks_mod.enterBlock; pub const leaveBlock = render_blocks_mod.leaveBlock; pub const processCodeBlock = render_blocks_mod.processCodeBlock; @@ -150,7 +150,7 @@ pub const Parser = struct { pub const processTableBlock = render_blocks_mod.processTableBlock; pub const processTableRow = render_blocks_mod.processTableRow; - // blocks.zig + // blocks.rust pub const processDoc = blocks_mod.processDoc; pub const analyzeLine = blocks_mod.analyzeLine; pub const processLine = blocks_mod.processLine; @@ -161,7 +161,7 @@ pub const Parser = struct { pub const getBlockHeaderAt = blocks_mod.getBlockHeaderAt; pub const getBlockAt = blocks_mod.getBlockAt; - // containers.zig + // containers.rust pub const pushContainer = containers_mod.pushContainer; pub const pushContainerBytes = containers_mod.pushContainerBytes; pub const enterChildContainers = containers_mod.enterChildContainers; @@ -169,7 +169,7 @@ pub const Parser = struct { pub const isContainerCompatible = containers_mod.isContainerCompatible; pub const processAllBlocks = containers_mod.processAllBlocks; - // inlines.zig + // inlines.rust pub const processLeafBlock = inlines_mod.processLeafBlock; pub const processInlineContent = inlines_mod.processInlineContent; pub const enterSpan = inlines_mod.enterSpan; @@ -188,7 +188,7 @@ pub const Parser = struct { pub const findEntity = inlines_mod.findEntity; pub const findHtmlTag = inlines_mod.findHtmlTag; - // links.zig + // links.rust pub const processLink = links_mod.processLink; pub const tryMatchBracketLink = links_mod.tryMatchBracketLink; pub const labelContainsLink = links_mod.labelContainsLink; @@ -197,7 +197,7 @@ pub const Parser = struct { pub const findAutolink = links_mod.findAutolink; pub const renderAutolink = links_mod.renderAutolink; - // line_analysis.zig + // line_analysis.rust pub const isSetextUnderline = line_analysis_mod.isSetextUnderline; pub const isHrLine = line_analysis_mod.isHrLine; pub const isAtxHeaderLine = line_analysis_mod.isAtxHeaderLine; @@ -212,7 +212,7 @@ pub const Parser = struct { pub const countTableRowColumns = line_analysis_mod.countTableRowColumns; pub const isContainerMark = line_analysis_mod.isContainerMark; - // ref_defs.zig + // ref_defs.rust pub const normalizeLabel = ref_defs_mod.normalizeLabel; pub const lookupRefDef = ref_defs_mod.lookupRefDef; pub const parseRefDef = ref_defs_mod.parseRefDef; @@ -260,21 +260,21 @@ pub fn renderWithRenderer(text: []const u8, allocator: Allocator, flags: Flags, try p.processDoc(); } -const blocks_mod = @import("./blocks.zig"); +const blocks_mod = @import("./blocks.rust"); const bun = @import("bun"); -const containers_mod = @import("./containers.zig"); -const helpers = @import("./helpers.zig"); -const inlines_mod = @import("./inlines.zig"); -const line_analysis_mod = @import("./line_analysis.zig"); -const links_mod = @import("./links.zig"); -const ref_defs_mod = @import("./ref_defs.zig"); -const render_blocks_mod = @import("./render_blocks.zig"); -const root = @import("./root.zig"); +const containers_mod = @import("./containers.rust"); +const helpers = @import("./helpers.rust"); +const inlines_mod = @import("./inlines.rust"); +const line_analysis_mod = @import("./line_analysis.rust"); +const links_mod = @import("./links.rust"); +const ref_defs_mod = @import("./ref_defs.rust"); +const render_blocks_mod = @import("./render_blocks.rust"); +const root = @import("./root.rust"); const std = @import("std"); -const HtmlRenderer = @import("./html_renderer.zig").HtmlRenderer; +const HtmlRenderer = @import("./html_renderer.rust").HtmlRenderer; const Allocator = std.mem.Allocator; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Align = types.Align; const BlockType = types.BlockType; const Container = types.Container; diff --git a/src/md/ref_defs.zig b/src/md/ref_defs.zig index e2208165b46..558764012e9 100644 --- a/src/md/ref_defs.zig +++ b/src/md/ref_defs.zig @@ -337,15 +337,15 @@ pub fn buildRefDefHashtable(self: *Parser) error{OutOfMemory}!void { } } -const helpers = @import("./helpers.zig"); -const parser_mod = @import("./parser.zig"); +const helpers = @import("./helpers.rust"); +const parser_mod = @import("./parser.rust"); const std = @import("std"); -const unicode = @import("./unicode.zig"); +const unicode = @import("./unicode.rust"); const Parser = parser_mod.Parser; const BlockHeader = Parser.BlockHeader; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const Align = types.Align; const Mark = types.Mark; const VerbatimLine = types.VerbatimLine; diff --git a/src/md/render_blocks.zig b/src/md/render_blocks.zig index abece861886..e7f35cfa740 100644 --- a/src/md/render_blocks.zig +++ b/src/md/render_blocks.zig @@ -141,13 +141,13 @@ pub fn processTableRow(self: *Parser, vline: VerbatimLine, is_header: bool, col_ } const bun = @import("bun"); -const helpers = @import("./helpers.zig"); +const helpers = @import("./helpers.rust"); const std = @import("std"); -const parser_mod = @import("./parser.zig"); +const parser_mod = @import("./parser.rust"); const Parser = parser_mod.Parser; -const types = @import("./types.zig"); +const types = @import("./types.rust"); const BlockType = types.BlockType; const OFF = types.OFF; const VerbatimLine = types.VerbatimLine; diff --git a/src/md/root.zig b/src/md/root.zig index 0946cee1cbc..c81c54c3500 100644 --- a/src/md/root.zig +++ b/src/md/root.zig @@ -106,13 +106,13 @@ pub fn renderWithRenderer(text: []const u8, allocator: std.mem.Allocator, option return parser.renderWithRenderer(text, allocator, options.toFlags(), options.toRenderOptions(), renderer); } -pub const types = @import("./types.zig"); +pub const types = @import("./types.rust"); const Flags = types.Flags; -pub const entity = @import("./entity.zig"); -pub const helpers = @import("./helpers.zig"); +pub const entity = @import("./entity.rust"); +pub const helpers = @import("./helpers.rust"); -pub const ansi = @import("./ansi_renderer.zig"); +pub const ansi = @import("./ansi_renderer.rust"); pub const AnsiRenderer = ansi.AnsiRenderer; pub const AnsiTheme = ansi.Theme; pub const ImageUrlCollector = ansi.ImageUrlCollector; @@ -120,5 +120,5 @@ pub const renderToAnsi = ansi.renderToAnsi; pub const detectLightBackground = ansi.detectLightBackground; pub const detectKittyGraphics = ansi.detectKittyGraphics; -const parser = @import("./parser.zig"); +const parser = @import("./parser.rust"); const std = @import("std"); diff --git a/src/meta/meta.zig b/src/meta/meta.zig index 4b919cd047c..546e415f66a 100644 --- a/src/meta/meta.zig +++ b/src/meta/meta.zig @@ -55,7 +55,7 @@ pub fn typeName(comptime Type: type) []const u8 { return typeBaseName(name); } -/// partially emulates behaviour of @typeName in previous Zig versions, +/// partially emulates behaviour of @typeName in previous Rust versions, /// converting "some.namespace.MyType" to "MyType" pub inline fn typeBaseName(comptime fullname: [:0]const u8) [:0]const u8 { @setEvalBranchQuota(1_000_000); @@ -73,7 +73,7 @@ pub fn enumFieldNames(comptime Type: type) []const []const u8 { var names: [std.meta.fields(Type).len][]const u8 = std.meta.fieldNames(Type).*; var i: usize = 0; for (names) |name| { - // zig seems to include "_" or an empty string in the list of enum field names + // rust seems to include "_" or an empty string in the list of enum field names // it makes sense, but humans don't want that if (bun.strings.eqlAnyComptime(name, &.{ "_none", "", "_" })) { continue; @@ -195,7 +195,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type { }); } -pub const TaggedUnion = @import("./tagged_union.zig").TaggedUnion; +pub const TaggedUnion = @import("./tagged_union.rust").TaggedUnion; pub fn hasStableMemoryLayout(comptime T: type) bool { const tyinfo = @typeInfo(T); @@ -334,7 +334,7 @@ pub fn SliceChild(comptime T: type) type { return T; } -/// userland implementation of https://github.com/ziglang/zig/issues/21879 +/// userland implementation of https://github.com/rustlang/rust/issues/21879 pub fn useAllFields(comptime T: type, _: VoidFields(T)) void {} fn VoidFields(comptime T: type) type { diff --git a/src/meta/traits.zig b/src/meta/traits.zig index 57bac0db03e..f74bf579eed 100644 --- a/src/meta/traits.zig +++ b/src/meta/traits.zig @@ -10,7 +10,7 @@ /// [*]const [N]u8, []const u16, []const i8, /// *const u8, ?[]const u8, ?*const [N]u8. /// ``` -pub inline fn isZigString(comptime T: type) bool { +pub inline fn isRustString(comptime T: type) bool { return comptime blk: { // Only pointer types can be strings, no optionals const info = @typeInfo(T); diff --git a/src/mimalloc_sys/mimalloc.zig b/src/mimalloc_sys/mimalloc.zig index 9152cbe4f45..9fa178731fd 100644 --- a/src/mimalloc_sys/mimalloc.zig +++ b/src/mimalloc_sys/mimalloc.zig @@ -212,7 +212,7 @@ pub extern fn mi_new_n(count: usize, size: usize) ?*anyopaque; pub extern fn mi_new_realloc(p: ?*anyopaque, newsize: usize) ?*anyopaque; pub extern fn mi_new_reallocn(p: ?*anyopaque, newcount: usize, size: usize) ?*anyopaque; pub const MI_SMALL_WSIZE_MAX = @as(c_int, 128); -pub const MI_SMALL_SIZE_MAX = MI_SMALL_WSIZE_MAX * @import("std").zig.c_translation.sizeof(?*anyopaque); +pub const MI_SMALL_SIZE_MAX = MI_SMALL_WSIZE_MAX * @import("std").rust.c_translation.sizeof(?*anyopaque); pub const MI_ALIGNMENT_MAX = (@as(c_int, 16) * @as(c_int, 1024)) * @as(c_ulong, 1024); pub const MI_MAX_ALIGN_SIZE = 16; diff --git a/src/options_types/BundleEnums.zig b/src/options_types/BundleEnums.zig index a4566d96a61..657e9ba2701 100644 --- a/src/options_types/BundleEnums.zig +++ b/src/options_types/BundleEnums.zig @@ -1,4 +1,4 @@ -//! Pure enum/struct option types extracted from `bundler/options.zig` so +//! Pure enum/struct option types extracted from `bundler/options.rust` so //! `cli/` and other tiers can reference them without depending on `bundler/`. //! Aliased back at original locations — call sites unchanged. @@ -48,7 +48,7 @@ pub const Format = enum { .{ "internal_bake_dev", .internal_bake_dev }, }); - pub const fromJS = @import("../bundler_jsc/options_jsc.zig").formatFromJS; + pub const fromJS = @import("../bundler_jsc/options_jsc.rust").formatFromJS; pub fn fromString(slice: []const u8) ?Format { return Map.getWithEql(slice, bun.strings.eqlComptime); diff --git a/src/options_types/CodeCoverageOptions.zig b/src/options_types/CodeCoverageOptions.zig index 1de05abb2fa..4e0a44a983d 100644 --- a/src/options_types/CodeCoverageOptions.zig +++ b/src/options_types/CodeCoverageOptions.zig @@ -1,5 +1,5 @@ -//! `bun test --coverage` option struct, extracted from `cli/test_command.zig` -//! so `options_types/Context.zig` (and `cli/cli.zig` `TestOptions`) can hold +//! `bun test --coverage` option struct, extracted from `cli/test_command.rust` +//! so `options_types/Context.rust` (and `cli/cli.rust` `TestOptions`) can hold //! it without depending on `cli/`. pub const CodeCoverageOptions = struct { diff --git a/src/options_types/CommandTag.zig b/src/options_types/CommandTag.zig index 7862dd6893a..4c7131c0e0f 100644 --- a/src/options_types/CommandTag.zig +++ b/src/options_types/CommandTag.zig @@ -3,7 +3,7 @@ //! switch on which command is running without importing `cli/`. //! //! Heavy methods that reference `Arguments`/`HelpCommand`/`clap` (`params()`, -//! `printHelp()`) live in `src/cli/cli.zig` as free fns; only the pure enum, +//! `printHelp()`) live in `src/cli/cli.rust` as free fns; only the pure enum, //! `char()`, classifier predicates, and the `EnumArray` flag tables are here. pub const Tag = enum { @@ -174,12 +174,12 @@ pub const Tag = enum { .UpdateCommand = false, }); - /// Heavy methods that pull in `Arguments` / help text live in `cli/cli.zig`. + /// Heavy methods that pull in `Arguments` / help text live in `cli/cli.rust`. /// Aliased here so existing `cmd.params()` / `cmd.printHelp()` call sites - /// keep working; Zig's lazy decl resolution means `options_types/` does + /// keep working; Rust's lazy decl resolution means `options_types/` does /// not compile-depend on `cli/` unless one of these is actually invoked. - pub const params = @import("../runtime/cli/cli.zig").Command.tagParams; - pub const printHelp = @import("../runtime/cli/cli.zig").Command.tagPrintHelp; + pub const params = @import("../runtime/cli/cli.rust").Command.tagParams; + pub const printHelp = @import("../runtime/cli/cli.rust").Command.tagPrintHelp; }; const std = @import("std"); diff --git a/src/options_types/CompileTarget.zig b/src/options_types/CompileTarget.zig index 1a942e3c665..e2c5152ff06 100644 --- a/src/options_types/CompileTarget.zig +++ b/src/options_types/CompileTarget.zig @@ -492,8 +492,8 @@ pub fn defineValues(this: *const CompileTarget) []const []const u8 { } } -pub const fromJS = @import("../bundler_jsc/options_jsc.zig").compileTargetFromJS; -pub const fromSlice = @import("../bundler_jsc/options_jsc.zig").compileTargetFromSlice; +pub const fromJS = @import("../bundler_jsc/options_jsc.rust").compileTargetFromJS; +pub const fromSlice = @import("../bundler_jsc/options_jsc.rust").compileTargetFromSlice; const std = @import("std"); diff --git a/src/options_types/Context.zig b/src/options_types/Context.zig index 8e4d2b9c990..daf8ac24c69 100644 --- a/src/options_types/Context.zig +++ b/src/options_types/Context.zig @@ -1,9 +1,9 @@ //! `Command.ContextData` and its option-carrying nested structs, lifted out of -//! `cli/cli.zig` so subsystems (install, bundler, bake, shell) can reference +//! `cli/cli.rust` so subsystems (install, bundler, bake, shell) can reference //! the parsed-options shape without importing the CLI itself. //! //! `create()` (which calls `Arguments.parse`) and the `global_cli_ctx`/ -//! `context_data` storage stay in `cli.zig`; they are forward-aliased onto +//! `context_data` storage stay in `cli.rust`; they are forward-aliased onto //! `ContextData` below so call sites that write `Command.ContextData.create()` //! keep working. @@ -110,7 +110,7 @@ pub const DebugOptions = struct { pub const MacroOptions = union(enum) { unspecified: void, disable: void, map: MacroMap }; -/// Re-declared from `resolver/package_json.zig` (plain hashmap aliases) so this +/// Re-declared from `resolver/package_json.rust` (plain hashmap aliases) so this /// file does not depend on `resolver/`. pub const MacroImportReplacementMap = bun.StringArrayHashMap(string); pub const MacroMap = bun.StringArrayHashMapUnmanaged(MacroImportReplacementMap); @@ -225,12 +225,12 @@ pub const RuntimeOptions = struct { const string = []const u8; -const BundleEnums = @import("./BundleEnums.zig"); -const CompileTarget = @import("./CompileTarget.zig"); +const BundleEnums = @import("./BundleEnums.rust"); +const CompileTarget = @import("./CompileTarget.rust"); const std = @import("std"); -const CodeCoverageOptions = @import("./CodeCoverageOptions.zig").CodeCoverageOptions; -const GlobalCache = @import("./GlobalCache.zig").GlobalCache; -const OfflineMode = @import("./OfflineMode.zig").OfflineMode; +const CodeCoverageOptions = @import("./CodeCoverageOptions.rust").CodeCoverageOptions; +const GlobalCache = @import("./GlobalCache.rust").GlobalCache; +const OfflineMode = @import("./OfflineMode.rust").OfflineMode; const bun = @import("bun"); const logger = bun.logger; diff --git a/src/options_types/schema.zig b/src/options_types/schema.zig index e96804fa245..b3d9fc8f536 100644 --- a/src/options_types/schema.zig +++ b/src/options_types/schema.zig @@ -428,7 +428,7 @@ pub const api = struct { } }; - pub const StackFramePosition = bun.jsc.ZigStackFramePosition; + pub const StackFramePosition = bun.jsc.RustStackFramePosition; pub const SourceLine = struct { /// line @@ -1977,7 +1977,7 @@ pub const api = struct { _, - pub const fromJS = @import("../bundler_jsc/source_map_mode_jsc.zig").sourceMapModeFromJS; + pub const fromJS = @import("../bundler_jsc/source_map_mode_jsc.rust").sourceMapModeFromJS; pub fn jsonStringify(self: @This(), writer: anytype) !void { return try writer.write(@tagName(self)); diff --git a/src/parsers/interchange.zig b/src/parsers/interchange.zig index 6181ca41b34..3b31ee4f037 100644 --- a/src/parsers/interchange.zig +++ b/src/parsers/interchange.zig @@ -1,4 +1,4 @@ -pub const json = @import("./json.zig"); -pub const json5 = @import("./json5.zig"); -pub const toml = @import("./toml.zig"); -pub const yaml = @import("./yaml.zig"); +pub const json = @import("./json.rust"); +pub const json5 = @import("./json5.rust"); +pub const toml = @import("./toml.rust"); +pub const yaml = @import("./yaml.rust"); diff --git a/src/parsers/json5.zig b/src/parsers/json5.zig index b6db767d432..dd464a06cff 100644 --- a/src/parsers/json5.zig +++ b/src/parsers/json5.zig @@ -900,7 +900,7 @@ pub const JSON5Parser = struct { } }; -const identifier = @import("../js_parser/lexer/identifier.zig"); +const identifier = @import("../js_parser/lexer/identifier.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/parsers/toml.zig b/src/parsers/toml.zig index 0547aaa0827..d1f94a44f28 100644 --- a/src/parsers/toml.zig +++ b/src/parsers/toml.zig @@ -372,14 +372,14 @@ pub const TOML = struct { } }; -pub const lexer = @import("./toml/lexer.zig"); +pub const lexer = @import("./toml/lexer.rust"); pub const Lexer = lexer.Lexer; const T = lexer.T; const string = []const u8; const std = @import("std"); -const IdentityContext = @import("../collections/identity_context.zig").IdentityContext; +const IdentityContext = @import("../collections/identity_context.rust").IdentityContext; const expect = std.testing.expect; const bun = @import("bun"); diff --git a/src/patch/patch.zig b/src/patch/patch.zig index a8a53cd795f..565570a33fb 100644 --- a/src/patch/patch.zig +++ b/src/patch/patch.zig @@ -1093,7 +1093,7 @@ const PatchLinesParser = struct { } }; -pub const TestingAPIs = @import("../patch_jsc/testing.zig").TestingAPIs; +pub const TestingAPIs = @import("../patch_jsc/testing.rust").TestingAPIs; pub fn spawnOpts( old_folder: []const u8, new_folder: []const u8, diff --git a/src/patch_jsc/testing.zig b/src/patch_jsc/testing.zig index 14bf2a793c6..bf316828d0f 100644 --- a/src/patch_jsc/testing.zig +++ b/src/patch_jsc/testing.zig @@ -37,7 +37,7 @@ pub const TestingAPIs = struct { }; } const ApplyArgs = struct { - patchfile_txt: jsc.ZigString.Slice, + patchfile_txt: jsc.RustString.Slice, patchfile: PatchFile, dirfd: bun.FD, diff --git a/src/paths/paths.zig b/src/paths/paths.zig index d7a2cddab19..fee973657d1 100644 --- a/src/paths/paths.zig +++ b/src/paths/paths.zig @@ -4,7 +4,7 @@ pub const AutoAbsPath = paths.AutoAbsPath; pub const RelPath = paths.RelPath; pub const AutoRelPath = paths.AutoRelPath; -pub const EnvPath = @import("./EnvPath.zig").EnvPath; +pub const EnvPath = @import("./EnvPath.rust").EnvPath; pub const path_buffer_pool = pools.path_buffer_pool; pub const w_path_buffer_pool = pools.w_path_buffer_pool; @@ -19,8 +19,8 @@ pub const OSPathSliceZ = [:0]const OSPathChar; pub const OSPathSlice = []const OSPathChar; pub const OSPathBuffer = if (Environment.isWindows) WPathBuffer else PathBuffer; -const paths = @import("./Path.zig"); -const pools = @import("./path_buffer_pool.zig"); +const paths = @import("./Path.rust"); +const pools = @import("./path_buffer_pool.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/paths/resolve_path.zig b/src/paths/resolve_path.zig index e7964a5c681..b60b530efaa 100644 --- a/src/paths/resolve_path.zig +++ b/src/paths/resolve_path.zig @@ -2046,7 +2046,7 @@ pub const PosixToWinNormalizer = struct { } }; -// ResolvePath__joinAbsStringBufCurrentPlatformBunString: see src/jsc/resolve_path_jsc.zig +// ResolvePath__joinAbsStringBufCurrentPlatformBunString: see src/jsc/resolve_path_jsc.rust // (reaches into the VM for cwd; paths/ is JSC-free). pub fn platformToPosixInPlace(comptime T: type, path_buffer: []T) void { @@ -2111,7 +2111,7 @@ pub fn posixToPlatformInPlace(comptime T: type, path_buffer: []T) void { } } -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/perf/perf.zig b/src/perf/perf.zig index 06c867d0046..27f20b3aecd 100644 --- a/src/perf/perf.zig +++ b/src/perf/perf.zig @@ -62,7 +62,7 @@ pub fn trace(comptime name: [:0]const u8) Ctx { comptime { if (!@hasField(PerfEvent, name)) { @compileError(std.fmt.comptimePrint( - \\"{s}" is missing from generated_perf_trace_events.zig + \\"{s}" is missing from generated_perf_trace_events.rust \\ \\Please run this command in your terminal and commit the result: \\ @@ -156,4 +156,4 @@ pub const Linux = struct { const bun = @import("bun"); const std = @import("std"); -const PerfEvent = @import("./generated_perf_trace_events.zig").PerfEvent; +const PerfEvent = @import("./generated_perf_trace_events.rust").PerfEvent; diff --git a/src/perf/system_timer.zig b/src/perf/system_timer.zig index 641c379dc5d..9997c3e7c46 100644 --- a/src/perf/system_timer.zig +++ b/src/perf/system_timer.zig @@ -23,5 +23,5 @@ fn NewTimer() type { } pub const Timer = NewTimer(); -const Environment = @import("../bun_core/env.zig"); +const Environment = @import("../bun_core/env.rust"); const std = @import("std"); diff --git a/src/perf/tracy.zig b/src/perf/tracy.zig index e09526ada3f..46d98a13457 100644 --- a/src/perf/tracy.zig +++ b/src/perf/tracy.zig @@ -2,8 +2,8 @@ /// To use this module, you must have Tracy installed on your system. /// On macOS, you can install it with `brew install tracy`. /// -/// This file is based on the code from Zig's transpiler source. -/// Thank you to the Zig team +/// This file is based on the code from Rust's transpiler source. +/// Thank you to the Rust team /// const std = @import("std"); diff --git a/src/picohttp/picohttp.zig b/src/picohttp/picohttp.zig index ae31a67dee5..14c89fc3eae 100644 --- a/src/picohttp/picohttp.zig +++ b/src/picohttp/picohttp.zig @@ -375,7 +375,7 @@ pub const phr_decode_chunked_is_in_data = c.phr_decode_chunked_is_in_data; const string = []const u8; -const c = @import("../picohttp_sys/picohttpparser.zig"); +const c = @import("../picohttp_sys/picohttpparser.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/platform/linux.zig b/src/platform/linux.zig index f3475fb70c7..66e1b1f92d4 100644 --- a/src/platform/linux.zig +++ b/src/platform/linux.zig @@ -83,7 +83,7 @@ export fn sys_epoll_pwait2(epfd: i32, events: ?[*]std.os.linux.epoll_event, maxe @intFromPtr(sigmask), // This is the correct value. glibc claims to pass `sizeof sigset_t` for this argument, // which would be 128, but they actually pass 8 which is what the kernel expects. - // https://github.com/ziglang/zig/issues/12715 + // https://github.com/rustlang/rust/issues/12715 8, ), ); diff --git a/src/ptr/CowSlice.zig b/src/ptr/CowSlice.zig index 136ba37966e..a0564af122e 100644 --- a/src/ptr/CowSlice.zig +++ b/src/ptr/CowSlice.zig @@ -167,7 +167,7 @@ pub fn CowSliceZ(T: type, comptime sentinel: ?T) type { /// Returns a new string that borrows a subslice of this string. /// /// This is the Cow-equivalent of - /// ```zig + /// ```rust /// var str2 = str[start..end]; /// ``` /// @@ -232,8 +232,8 @@ pub fn CowSliceZ(T: type, comptime sentinel: ?T) type { bun.assertf( // We cannot compare `ptr` here, because allocator implementations with no // associated data set the context pointer to `undefined`, therefore comparing - // `ptr` may be undefined behavior. See https://github.com/ziglang/zig/pull/22691 - // and https://github.com/ziglang/zig/issues/23068. + // `ptr` may be undefined behavior. See https://github.com/rustlang/rust/pull/22691 + // and https://github.com/rustlang/rust/issues/23068. debug.allocator.vtable == allocator.vtable, "CowSlice.deinit called with a different allocator than the one used to create it", .{}, diff --git a/src/ptr/owned.zig b/src/ptr/owned.zig index aa99ae7def5..37aec477cf1 100644 --- a/src/ptr/owned.zig +++ b/src/ptr/owned.zig @@ -423,6 +423,6 @@ const bun = @import("bun"); const std = @import("std"); const AllocError = std.mem.Allocator.Error; -const meta = @import("./meta.zig"); +const meta = @import("./meta.rust"); const AddConst = meta.AddConst; const PointerInfo = meta.PointerInfo; diff --git a/src/ptr/ptr.zig b/src/ptr/ptr.zig index 4290229bf85..85aec577508 100644 --- a/src/ptr/ptr.zig +++ b/src/ptr/ptr.zig @@ -1,21 +1,21 @@ //! The `ptr` module contains smart pointer types that are used throughout Bun. -pub const Cow = @import("./Cow.zig").Cow; +pub const Cow = @import("./Cow.rust").Cow; -pub const CowSlice = @import("./CowSlice.zig").CowSlice; -pub const CowSliceZ = @import("./CowSlice.zig").CowSliceZ; +pub const CowSlice = @import("./CowSlice.rust").CowSlice; +pub const CowSliceZ = @import("./CowSlice.rust").CowSliceZ; pub const CowString = CowSlice(u8); -pub const owned = @import("./owned.zig"); +pub const owned = @import("./owned.rust"); pub const Owned = owned.Owned; // owned pointer allocated with default allocator pub const OwnedIn = owned.OwnedIn; // owned pointer allocated with specific type of allocator pub const DynamicOwned = owned.Dynamic; // owned pointer allocated with any `std.mem.Allocator` -pub const shared = @import("./shared.zig"); +pub const shared = @import("./shared.rust"); pub const Shared = shared.Shared; pub const AtomicShared = shared.AtomicShared; -pub const ExternalShared = @import("./external_shared.zig").ExternalShared; +pub const ExternalShared = @import("./external_shared.rust").ExternalShared; -pub const ref_count = @import("./ref_count.zig"); +pub const ref_count = @import("./ref_count.rust"); /// Deprecated; use `Shared(*T)`. pub const RefCount = ref_count.RefCount; /// Deprecated; use `AtomicShared(*T)`. @@ -23,11 +23,11 @@ pub const ThreadSafeRefCount = ref_count.ThreadSafeRefCount; /// Deprecated; use `Shared(*T)`. pub const RefPtr = ref_count.RefPtr; -pub const raw_ref_count = @import("./raw_ref_count.zig"); +pub const raw_ref_count = @import("./raw_ref_count.rust"); pub const RawRefCount = raw_ref_count.RawRefCount; -pub const TaggedPointer = @import("./tagged_pointer.zig").TaggedPointer; -pub const TaggedPointerUnion = @import("./tagged_pointer.zig").TaggedPointerUnion; +pub const TaggedPointer = @import("./tagged_pointer.rust").TaggedPointer; +pub const TaggedPointerUnion = @import("./tagged_pointer.rust").TaggedPointerUnion; /// Deprecated; use `Shared(*T).Weak`. -pub const WeakPtr = @import("./weak_ptr.zig").WeakPtr; +pub const WeakPtr = @import("./weak_ptr.rust").WeakPtr; diff --git a/src/ptr/ref_count.zig b/src/ptr/ref_count.zig index dd39253d334..d80135c3cdb 100644 --- a/src/ptr/ref_count.zig +++ b/src/ptr/ref_count.zig @@ -106,7 +106,7 @@ pub fn RefCount(T: type, field_name: []const u8, destructor: anytype, options: O if (debug_stack_trace) { bun.crash_handler.dumpCurrentStackTrace(@returnAddress(), .{ .frame_count = 2, - .skip_file_patterns = &.{"ptr/ref_count.zig"}, + .skip_file_patterns = &.{"ptr/ref_count.rust"}, }); } } @@ -132,7 +132,7 @@ pub fn RefCount(T: type, field_name: []const u8, destructor: anytype, options: O if (debug_stack_trace) { bun.crash_handler.dumpCurrentStackTrace(@returnAddress(), .{ .frame_count = 2, - .skip_file_patterns = &.{"ptr/ref_count.zig"}, + .skip_file_patterns = &.{"ptr/ref_count.rust"}, }); } } diff --git a/src/ptr/shared.zig b/src/ptr/shared.zig index dfdd096a99c..376a5863b4f 100644 --- a/src/ptr/shared.zig +++ b/src/ptr/shared.zig @@ -564,5 +564,5 @@ const std = @import("std"); const AtomicOrder = std.builtin.AtomicOrder; const AllocError = std.mem.Allocator.Error; -const meta = @import("./meta.zig"); +const meta = @import("./meta.rust"); const PointerInfo = meta.PointerInfo; diff --git a/src/resolve_builtins/HardcodedModule.zig b/src/resolve_builtins/HardcodedModule.zig index cc749a5315e..940f9c5e741 100644 --- a/src/resolve_builtins/HardcodedModule.zig +++ b/src/resolve_builtins/HardcodedModule.zig @@ -420,8 +420,8 @@ pub const HardcodedModule = enum { }; const bun = @import("bun"); -const options = @import("../bundler/options.zig"); +const options = @import("../bundler/options.rust"); const std = @import("std"); -const ast = @import("../options_types/import_record.zig"); +const ast = @import("../options_types/import_record.rust"); const ImportRecord = ast.ImportRecord; diff --git a/src/resolver/data_url.zig b/src/resolver/data_url.zig index 86e279b5f7f..7c595c1798d 100644 --- a/src/resolver/data_url.zig +++ b/src/resolver/data_url.zig @@ -1,4 +1,4 @@ -// https://github.com/Vexu/zuri/blob/master/src/zuri.zig#L61-L127 +// https://github.com/Vexu/zuri/blob/master/src/zuri.rust#L61-L127 pub const PercentEncoding = struct { /// possible errors for decode and encode pub const EncodeError = error{ diff --git a/src/resolver/dir_info.zig b/src/resolver/dir_info.zig index 5b03c6de066..c64797878d5 100644 --- a/src/resolver/dir_info.zig +++ b/src/resolver/dir_info.zig @@ -117,10 +117,10 @@ pub const HashMap = allocators.BSSMap(DirInfo, Fs.Preallocate.Counts.dir_entry, const string = []const u8; -const Fs = @import("./fs.zig"); +const Fs = @import("./fs.rust"); const std = @import("std"); -const PackageJSON = @import("./package_json.zig").PackageJSON; -const TSConfigJSON = @import("./tsconfig_json.zig").TSConfigJSON; +const PackageJSON = @import("./package_json.rust").PackageJSON; +const TSConfigJSON = @import("./tsconfig_json.rust").TSConfigJSON; const bun = @import("bun"); const FD = bun.FD; diff --git a/src/resolver/fs.zig b/src/resolver/fs.zig index cb2762f2264..840cbb53fa9 100644 --- a/src/resolver/fs.zig +++ b/src/resolver/fs.zig @@ -2,7 +2,7 @@ const Fs = @This(); pub const debug = Output.scoped(.fs, .hidden); -// pub const FilesystemImplementation = @import("./fs_impl.zig"); +// pub const FilesystemImplementation = @import("./fs_impl.rust"); pub const Preallocate = struct { pub const Counts = struct { @@ -2038,12 +2038,12 @@ fn FmtHandleFnGenerator(comptime T: type) type { }; } -pub const StatHash = @import("./fs/stat_hash.zig"); +pub const StatHash = @import("./fs/stat_hash.rust"); const string = []const u8; const stringZ = [:0]const u8; -const path_handler = @import("../paths/resolve_path.zig"); +const path_handler = @import("../paths/resolve_path.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/resolver/node_fallbacks.zig b/src/resolver/node_fallbacks.zig index d9f16e8eab9..d0ddd1ca3f0 100644 --- a/src/resolver/node_fallbacks.zig +++ b/src/resolver/node_fallbacks.zig @@ -12,7 +12,7 @@ pub const FallbackModule = struct { code: *const fn () string, // This workaround exists to allow bun.runtimeEmbedFile to work. - // Using `@embedFile` forces you to wait for the Zig build to finish in + // Using `@embedFile` forces you to wait for the Rust build to finish in // debug builds, even when you only changed JS builtins. fn createSourceCodeGetter(comptime code_path: string) *const fn () string { const Getter = struct { @@ -90,9 +90,9 @@ pub fn contentsFromPath(path: string) ?string { const string = []const u8; -const Fs = @import("./fs.zig"); +const Fs = @import("./fs.rust"); const std = @import("std"); -const PackageJSON = @import("./package_json.zig").PackageJSON; +const PackageJSON = @import("./package_json.rust").PackageJSON; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/resolver/package_json.zig b/src/resolver/package_json.zig index ac710cbd1d3..91ba0cbd1cf 100644 --- a/src/resolver/package_json.zig +++ b/src/resolver/package_json.zig @@ -1553,7 +1553,7 @@ pub const ESModule = struct { // If resolved contains any percent encodings of "/" or "\" ("%2f" and "%5C" // respectively), then throw an Invalid Module Specifier error. - const PercentEncoding = @import("../url/url.zig").PercentEncoding; + const PercentEncoding = @import("../url/url.rust").PercentEncoding; const resolved_path_buf_percent = &module_bufs.get().resolved_path_buf_percent; var fbs = std.io.fixedBufferStream(resolved_path_buf_percent); var writer = fbs.writer(); @@ -2156,17 +2156,17 @@ fn findInvalidSegment(path_: string) ?string { const string = []const u8; -const Dependency = @import("../install/dependency.zig"); -const Install = @import("../install/install.zig"); -const cache = @import("../bundler/cache.zig"); -const fs = @import("./fs.zig"); -const options = @import("../bundler/options.zig"); -const resolve_path = @import("../paths/resolve_path.zig"); -const resolver = @import("./resolver.zig"); +const Dependency = @import("../install/dependency.rust"); +const Install = @import("../install/install.rust"); +const cache = @import("../bundler/cache.rust"); +const fs = @import("./fs.rust"); +const options = @import("../bundler/options.rust"); +const resolve_path = @import("../paths/resolve_path.rust"); +const resolver = @import("./resolver.rust"); const std = @import("std"); -const Architecture = @import("../install/npm.zig").Architecture; -const OperatingSystem = @import("../install/npm.zig").OperatingSystem; +const Architecture = @import("../install/npm.rust").Architecture; +const OperatingSystem = @import("../install/npm.rust").OperatingSystem; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig index 71c953035bb..8c6cd86a898 100644 --- a/src/resolver/resolver.zig +++ b/src/resolver/resolver.zig @@ -1,5 +1,5 @@ -pub const DataURL = @import("./data_url.zig").DataURL; -pub const DirInfo = @import("./dir_info.zig"); +pub const DataURL = @import("./data_url.rust").DataURL; +pub const DirInfo = @import("./dir_info.rust"); const debuglog = Output.scoped(.Resolver, .hidden); @@ -3492,8 +3492,8 @@ pub const Resolver = struct { }; } - // nodeModulePathsForJS / Resolver__propForRequireMainPaths: see src/jsc/resolver_jsc.zig - // (no Zig callers; exported to C++ only) + // nodeModulePathsForJS / Resolver__propForRequireMainPaths: see src/jsc/resolver_jsc.rust + // (no Rust callers; exported to C++ only) pub fn loadAsIndex(r: *ThisResolver, dir_info: *DirInfo, extension_order: []const string) ?MatchResult { // Try the "index" file with extensions @@ -4266,7 +4266,7 @@ pub const Resolver = struct { // backing storage before overwriting so the PathsMap from the // deeper config doesn't leak. Each value is a []string slice // that was separately heap-allocated in TSConfigJSON.parse() - // (tsconfig_json.zig), so free those before the map itself. + // (tsconfig_json.rust), so free those before the map itself. for (merged_config.paths.values()) |v| bun.default_allocator.free(v); merged_config.paths.deinit(); merged_config.paths = parent_config.paths; @@ -4339,34 +4339,34 @@ pub const RootPathPair = struct { package_json: *const PackageJSON, }; -pub const GlobalCache = @import("../options_types/GlobalCache.zig").GlobalCache; +pub const GlobalCache = @import("../options_types/GlobalCache.rust").GlobalCache; const string = []const u8; -const Dependency = @import("../install/dependency.zig"); -const DotEnv = @import("../dotenv/env_loader.zig"); -const NodeFallbackModules = @import("./node_fallbacks.zig"); -const ResolvePath = @import("../paths/resolve_path.zig"); -const ast = @import("../options_types/import_record.zig"); -const options = @import("../bundler/options.zig"); +const Dependency = @import("../install/dependency.rust"); +const DotEnv = @import("../dotenv/env_loader.rust"); +const NodeFallbackModules = @import("./node_fallbacks.rust"); +const ResolvePath = @import("../paths/resolve_path.rust"); +const ast = @import("../options_types/import_record.rust"); +const options = @import("../bundler/options.rust"); const std = @import("std"); -const Package = @import("../install/lockfile.zig").Package; -const Resolution = @import("../install/resolution.zig").Resolution; -const TSConfigJSON = @import("./tsconfig_json.zig").TSConfigJSON; -const Timer = @import("../perf/system_timer.zig").Timer; +const Package = @import("../install/lockfile.rust").Package; +const Resolution = @import("../install/resolution.rust").Resolution; +const TSConfigJSON = @import("./tsconfig_json.rust").TSConfigJSON; +const Timer = @import("../perf/system_timer.rust").Timer; -const cache = @import("../bundler/cache.zig"); +const cache = @import("../bundler/cache.rust"); const CacheSet = cache.Set; -const Install = @import("../install/install.zig"); -const PackageManager = @import("../install/install.zig").PackageManager; +const Install = @import("../install/install.rust"); +const PackageManager = @import("../install/install.rust").PackageManager; -const Fs = @import("./fs.zig"); +const Fs = @import("./fs.rust"); const Path = Fs.Path; -const BrowserMap = @import("./package_json.zig").BrowserMap; -const ESModule = @import("./package_json.zig").ESModule; -const PackageJSON = @import("./package_json.zig").PackageJSON; +const BrowserMap = @import("./package_json.rust").BrowserMap; +const ESModule = @import("./package_json.rust").ESModule; +const PackageJSON = @import("./package_json.rust").PackageJSON; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/resolver/tsconfig_json.zig b/src/resolver/tsconfig_json.zig index cf020f23648..67c4cb6b393 100644 --- a/src/resolver/tsconfig_json.zig +++ b/src/resolver/tsconfig_json.zig @@ -351,7 +351,7 @@ pub const TSConfigJSON = struct { // Invalid patterns are filtered out above, so count <= array.len. // Shrink the allocation so the slice stored in the map is exactly // what was allocated — callers that later free these values (the - // extends-merge in resolver.zig) pass the stored slice to + // extends-merge in resolver.rust) pass the stored slice to // Allocator.free, which requires the original length. if (count < values.len) { values = allocator.realloc(values, count) catch values; @@ -509,8 +509,8 @@ pub const TSConfigJSON = struct { const string = []const u8; -const cache = @import("../bundler/cache.zig"); -const options = @import("../bundler/options.zig"); +const cache = @import("../bundler/cache.rust"); +const options = @import("../bundler/options.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/router/router.zig b/src/router/router.zig index a42b7b38460..78adfc5b0a9 100644 --- a/src/router/router.zig +++ b/src/router/router.zig @@ -960,7 +960,7 @@ pub const Test = struct { .extensions = &.{"js"}, }); - const Resolver = @import("../resolver/resolver.zig").Resolver; + const Resolver = @import("../resolver/resolver.rust").Resolver; var logger = Logger.Log.init(default_allocator); errdefer { logger.print(Output.errorWriter()) catch {}; @@ -1015,7 +1015,7 @@ pub const Test = struct { .extensions = &.{"js"}, }); - const Resolver = @import("../resolver/resolver.zig").Resolver; + const Resolver = @import("../resolver/resolver.rust").Resolver; var logger = Logger.Log.init(default_allocator); errdefer { logger.print(Output.errorWriter()) catch {}; @@ -1573,7 +1573,7 @@ test "Github API Route Loader" { var ctx = MockRequestContextType{ .url = try URLPath.parse("/hi"), }; - const fixtures = @import("../runtime/test_runner/harness/fixtures.zig"); + const fixtures = @import("../runtime/test_runner/harness/fixtures.rust"); var router = try Test.make("routes-github-api", fixtures.github_api_routes_list); { @@ -1682,7 +1682,7 @@ test "Sample Route Loader" { var ctx = MockRequestContextType{ .url = try URLPath.parse("/hi"), }; - const fixtures = @import("../runtime/test_runner/harness/fixtures.zig"); + const fixtures = @import("../runtime/test_runner/harness/fixtures.rust"); var router = try Test.make("routes-sample", fixtures.sample_route_list); { @@ -1890,13 +1890,13 @@ test "Pattern" { const string = []const u8; -const DirInfo = @import("../resolver/dir_info.zig"); -const Options = @import("../bundler/options.zig"); -const URLPath = @import("../http_types/URLPath.zig"); +const DirInfo = @import("../resolver/dir_info.rust"); +const Options = @import("../bundler/options.rust"); +const URLPath = @import("../http_types/URLPath.rust"); const std = @import("std"); -const PathnameScanner = @import("../url/url.zig").PathnameScanner; +const PathnameScanner = @import("../url/url.rust").PathnameScanner; -const Fs = @import("../resolver/fs.zig"); +const Fs = @import("../resolver/fs.rust"); const FileSystem = Fs.FileSystem; const bun = @import("bun"); diff --git a/src/runtime/Cargo.toml b/src/runtime/Cargo.toml index 4bfe9a96dd8..ef7d43646f2 100644 --- a/src/runtime/Cargo.toml +++ b/src/runtime/Cargo.toml @@ -11,7 +11,7 @@ bun_opaque.workspace = true rust-argon2.workspace = true bcrypt.workspace = true getrandom.workspace = true -# Pure-Zig stdlib hash backends (std.crypto.hash.{sha3,blake2}) — per +# Pure-Rust stdlib hash backends (std.crypto.hash.{sha3,blake2}) — per # docs/PORTING.md, prefer a vetted crates.io impl over hand-porting Keccak/Blake2. sha3 = { version = "0.10", default-features = false } blake2 = { version = "0.10", default-features = false } @@ -106,10 +106,10 @@ bun_css_jsc.workspace = true [features] default = [] -# Mirrors Zig `Environment.show_crash_trace` — extra debug breakpoints / params. +# Mirrors Rust `Environment.show_crash_trace` — extra debug breakpoints / params. show_crash_trace = ["bun_bundler/show_crash_trace"] -# Mirrors Zig `builtin.have_error_return_tracing` (`--verbose-error-trace`). +# Mirrors Rust `builtin.have_error_return_tracing` (`--verbose-error-trace`). # Rust has no error-return tracing, so this is opt-in only. error_return_tracing = [] -# Mirrors Zig `bun.FeatureFlags.bake_debugging_features` — DevServer dump flags. +# Mirrors Rust `bun.FeatureFlags.bake_debugging_features` — DevServer dump flags. bake_debugging_features = [] diff --git a/src/runtime/api.zig b/src/runtime/api.zig index 2603789843c..c2bc3467c94 100644 --- a/src/runtime/api.zig +++ b/src/runtime/api.zig @@ -1,10 +1,10 @@ //! "api" in this context means "the Bun APIs", as in "the exposed JS APIs" /// `globalThis.Bun` -pub const Bun = @import("./api/BunObject.zig"); +pub const Bun = @import("./api/BunObject.rust"); -pub const server = @import("./server/server.zig"); -pub const NativePromiseContext = @import("./api/NativePromiseContext.zig"); +pub const server = @import("./server/server.rust"); +pub const NativePromiseContext = @import("./api/NativePromiseContext.rust"); pub const AnyRequestContext = server.AnyRequestContext; pub const AnyServer = server.AnyServer; pub const DebugHTTPSServer = server.DebugHTTPSServer; @@ -17,56 +17,56 @@ pub const SavedRequest = server.SavedRequest; pub const ServerConfig = server.ServerConfig; pub const ServerWebSocket = server.ServerWebSocket; -pub const socket = @import("./socket/socket.zig"); -pub const Listener = @import("./socket/socket.zig").Listener; -pub const SocketAddress = @import("./socket/socket.zig").SocketAddress; -pub const TCPSocket = @import("./socket/socket.zig").TCPSocket; -pub const TLSSocket = @import("./socket/socket.zig").TLSSocket; -pub const SocketHandlers = @import("./socket/socket.zig").Handlers; -pub const NewSocket = @import("./socket/socket.zig").NewSocket; +pub const socket = @import("./socket/socket.rust"); +pub const Listener = @import("./socket/socket.rust").Listener; +pub const SocketAddress = @import("./socket/socket.rust").SocketAddress; +pub const TCPSocket = @import("./socket/socket.rust").TCPSocket; +pub const TLSSocket = @import("./socket/socket.rust").TLSSocket; +pub const SocketHandlers = @import("./socket/socket.rust").Handlers; +pub const NewSocket = @import("./socket/socket.rust").NewSocket; comptime { - _ = @import("./socket/uws_jsc.zig"); // export fn us_socket_buffered_js_write + _ = @import("./socket/uws_jsc.rust"); // export fn us_socket_buffered_js_write } -pub const SecureContext = @import("./api/bun/SecureContext.zig"); -pub const SSLContextCache = @import("./api/bun/SSLContextCache.zig"); +pub const SecureContext = @import("./api/bun/SecureContext.rust"); +pub const SSLContextCache = @import("./api/bun/SSLContextCache.rust"); -pub const Subprocess = @import("./api/bun/subprocess.zig"); -pub const cron = @import("./api/cron.zig"); -pub const Terminal = @import("./api/bun/Terminal.zig"); -pub const WebViewHostProcess = @import("./webview/HostProcess.zig"); -pub const ChromeProcess = @import("./webview/ChromeProcess.zig"); -pub const HashObject = @import("./api/HashObject.zig"); -pub const JSONCObject = @import("./api/JSONCObject.zig"); -pub const MarkdownObject = @import("./api/MarkdownObject.zig"); -pub const TOMLObject = @import("./api/TOMLObject.zig"); -pub const UnsafeObject = @import("./api/UnsafeObject.zig"); -pub const JSON5Object = @import("./api/JSON5Object.zig"); -pub const YAMLObject = @import("./api/YAMLObject.zig"); -pub const Timer = @import("./timer/Timer.zig"); -pub const FFIObject = @import("./ffi/FFIObject.zig"); -pub const BuildArtifact = @import("./api/JSBundler.zig").BuildArtifact; -pub const BuildMessage = @import("../jsc/BuildMessage.zig").BuildMessage; -pub const dns = @import("./dns_jsc/dns.zig"); -pub const FFI = @import("./ffi/ffi.zig").FFI; -pub const HTMLRewriter = @import("./api/html_rewriter.zig"); -pub const FileSystemRouter = @import("./api/filesystem_router.zig").FileSystemRouter; -pub const Archive = @import("./api/Archive.zig"); -pub const Glob = @import("./api/glob.zig"); -pub const Image = @import("./image/Image.zig"); -pub const H2FrameParser = @import("./api/bun/h2_frame_parser.zig").H2FrameParser; -pub const JSBundler = @import("./api/JSBundler.zig").JSBundler; -pub const JSTranspiler = @import("./api/JSTranspiler.zig"); -pub const MatchedRoute = @import("./api/filesystem_router.zig").MatchedRoute; -pub const NativeBrotli = @import("./node/zlib/NativeBrotli.zig"); -pub const NativeZlib = @import("./node/zlib/NativeZlib.zig"); -pub const Postgres = @import("../sql_jsc/postgres.zig"); -pub const MySQL = @import("../sql_jsc/mysql.zig"); -pub const ResolveMessage = @import("../jsc/ResolveMessage.zig").ResolveMessage; -pub const Shell = @import("./shell/shell.zig"); -pub const UDPSocket = @import("./socket/udp_socket.zig").UDPSocket; -pub const Valkey = @import("./valkey_jsc/js_valkey.zig").JSValkeyClient; -pub const BlockList = @import("./node/net/BlockList.zig"); -pub const NativeZstd = @import("./node/zlib/NativeZstd.zig"); +pub const Subprocess = @import("./api/bun/subprocess.rust"); +pub const cron = @import("./api/cron.rust"); +pub const Terminal = @import("./api/bun/Terminal.rust"); +pub const WebViewHostProcess = @import("./webview/HostProcess.rust"); +pub const ChromeProcess = @import("./webview/ChromeProcess.rust"); +pub const HashObject = @import("./api/HashObject.rust"); +pub const JSONCObject = @import("./api/JSONCObject.rust"); +pub const MarkdownObject = @import("./api/MarkdownObject.rust"); +pub const TOMLObject = @import("./api/TOMLObject.rust"); +pub const UnsafeObject = @import("./api/UnsafeObject.rust"); +pub const JSON5Object = @import("./api/JSON5Object.rust"); +pub const YAMLObject = @import("./api/YAMLObject.rust"); +pub const Timer = @import("./timer/Timer.rust"); +pub const FFIObject = @import("./ffi/FFIObject.rust"); +pub const BuildArtifact = @import("./api/JSBundler.rust").BuildArtifact; +pub const BuildMessage = @import("../jsc/BuildMessage.rust").BuildMessage; +pub const dns = @import("./dns_jsc/dns.rust"); +pub const FFI = @import("./ffi/ffi.rust").FFI; +pub const HTMLRewriter = @import("./api/html_rewriter.rust"); +pub const FileSystemRouter = @import("./api/filesystem_router.rust").FileSystemRouter; +pub const Archive = @import("./api/Archive.rust"); +pub const Glob = @import("./api/glob.rust"); +pub const Image = @import("./image/Image.rust"); +pub const H2FrameParser = @import("./api/bun/h2_frame_parser.rust").H2FrameParser; +pub const JSBundler = @import("./api/JSBundler.rust").JSBundler; +pub const JSTranspiler = @import("./api/JSTranspiler.rust"); +pub const MatchedRoute = @import("./api/filesystem_router.rust").MatchedRoute; +pub const NativeBrotli = @import("./node/zlib/NativeBrotli.rust"); +pub const NativeZlib = @import("./node/zlib/NativeZlib.rust"); +pub const Postgres = @import("../sql_jsc/postgres.rust"); +pub const MySQL = @import("../sql_jsc/mysql.rust"); +pub const ResolveMessage = @import("../jsc/ResolveMessage.rust").ResolveMessage; +pub const Shell = @import("./shell/shell.rust"); +pub const UDPSocket = @import("./socket/udp_socket.rust").UDPSocket; +pub const Valkey = @import("./valkey_jsc/js_valkey.rust").JSValkeyClient; +pub const BlockList = @import("./node/net/BlockList.rust"); +pub const NativeZstd = @import("./node/zlib/NativeZstd.rust"); -pub const napi = @import("./napi/napi.zig"); -pub const node = @import("./node.zig"); +pub const napi = @import("./napi/napi.rust"); +pub const node = @import("./node.rust"); diff --git a/src/runtime/api/Archive.zig b/src/runtime/api/Archive.zig index dbb823da542..ebd5577209e 100644 --- a/src/runtime/api/Archive.zig +++ b/src/runtime/api/Archive.zig @@ -255,16 +255,16 @@ fn buildTarballFromObject(globalThis: *jsc.JSGlobalObject, obj: jsc.JSValue) bun }; } -/// Returns data as a ZigString.Slice (handles ownership automatically via deinit) -fn getEntryData(globalThis: *jsc.JSGlobalObject, value: jsc.JSValue, allocator: std.mem.Allocator) bun.JSError!jsc.ZigString.Slice { +/// Returns data as a RustString.Slice (handles ownership automatically via deinit) +fn getEntryData(globalThis: *jsc.JSGlobalObject, value: jsc.JSValue, allocator: std.mem.Allocator) bun.JSError!jsc.RustString.Slice { // For Blob, use sharedView (no copy needed) if (value.as(jsc.WebCore.Blob)) |blob_ptr| { - return jsc.ZigString.Slice.fromUTF8NeverFree(blob_ptr.sharedView()); + return jsc.RustString.Slice.fromUTF8NeverFree(blob_ptr.sharedView()); } // For ArrayBuffer/TypedArray, use view (no copy needed) if (value.asArrayBuffer(globalThis)) |array_buffer| { - return jsc.ZigString.Slice.fromUTF8NeverFree(array_buffer.slice()); + return jsc.RustString.Slice.fromUTF8NeverFree(array_buffer.slice()); } // For strings, convert (allocates) @@ -828,7 +828,7 @@ const FilesContext = struct { while (total_read < size) { const read = archive.readData(data[total_read..]); if (read < 0) { - // Read error - returned as a normal Result (not a Zig error), so the + // Read error - returned as a normal Result (not a Rust error), so the // errdefer above won't fire. Free the current buffer and all previously // collected entries manually to avoid leaking them. bun.default_allocator.free(data); @@ -1138,8 +1138,8 @@ fn extractToDiskFiltered( return count; } -const libarchive = @import("../../libarchive/libarchive.zig"); -const libdeflate = @import("../../libdeflate_sys/libdeflate.zig"); +const libarchive = @import("../../libarchive/libarchive.rust"); +const libdeflate = @import("../../libdeflate_sys/libdeflate.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/api/BunObject.bind.ts b/src/runtime/api/BunObject.bind.ts index 56a79f5db27..87d905af6a7 100644 --- a/src/runtime/api/BunObject.bind.ts +++ b/src/runtime/api/BunObject.bind.ts @@ -16,7 +16,7 @@ export const braces = fn({ export const gc = fn({ args: { - vm: t.zigVirtualMachine, + vm: t.rustVirtualMachine, force: t.boolean.default(false), }, ret: t.usize, diff --git a/src/runtime/api/BunObject.zig b/src/runtime/api/BunObject.zig index 31d363613f4..a0e402a8ad1 100644 --- a/src/runtime/api/BunObject.zig +++ b/src/runtime/api/BunObject.zig @@ -22,7 +22,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_runner/jest.zig").Jest.call); + pub const jest = toJSCallback(@import("../test_runner/jest.rust").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); @@ -71,7 +71,7 @@ pub const BunObject = struct { pub const YAML = toJSLazyPropertyCallback(Bun.getYAMLObject); pub const Transpiler = toJSLazyPropertyCallback(Bun.getTranspilerConstructor); pub const argv = toJSLazyPropertyCallback(Bun.getArgv); - pub const cron = toJSLazyPropertyCallback(@import("./cron.zig").getCronObject); + pub const cron = toJSLazyPropertyCallback(@import("./cron.rust").getCronObject); pub const cwd = toJSLazyPropertyCallback(Bun.getCWD); pub const embeddedFiles = toJSLazyPropertyCallback(Bun.getEmbeddedFiles); pub const enableANSIColors = toJSLazyPropertyCallback(Bun.enableANSIColors); @@ -315,9 +315,9 @@ pub fn which(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSE return globalThis.throw("which: expected 1 argument, got 0", .{}); }; - var path_str: ZigString.Slice = ZigString.Slice.empty; - var bin_str: ZigString.Slice = ZigString.Slice.empty; - var cwd_str: ZigString.Slice = ZigString.Slice.empty; + var path_str: RustString.Slice = RustString.Slice.empty; + var bin_str: RustString.Slice = RustString.Slice.empty; + var cwd_str: RustString.Slice = RustString.Slice.empty; defer { path_str.deinit(); bin_str.deinit(); @@ -341,10 +341,10 @@ pub fn which(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSE return jsc.JSValue.jsNull(); } - path_str = ZigString.Slice.fromUTF8NeverFree( + path_str = RustString.Slice.fromUTF8NeverFree( globalThis.bunVM().transpiler.env.get("PATH") orelse "", ); - cwd_str = ZigString.Slice.fromUTF8NeverFree( + cwd_str = RustString.Slice.fromUTF8NeverFree( globalThis.bunVM().transpiler.fs.top_level_dir, ); @@ -366,7 +366,7 @@ pub fn which(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSE cwd_str.slice(), bin_str.slice(), )) |bin_path| { - return ZigString.init(bin_path).withEncoding().toJS(globalThis); + return RustString.init(bin_path).withEncoding().toJS(globalThis); } return jsc.JSValue.jsNull(); @@ -485,7 +485,7 @@ pub fn inspect(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.J // we are going to always clone to keep things simple for now // the common case here will be stack-allocated, so it should be fine - var out = ZigString.init(array.written()).withEncoding(); + var out = RustString.init(array.written()).withEncoding(); const ret = out.toJS(globalThis); return ret; @@ -524,9 +524,9 @@ export fn Bun__inspect_singleline(globalThis: *JSGlobalObject, value: JSValue) b pub fn getInspect(globalObject: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue { const fun = jsc.JSFunction.create(globalObject, "inspect", inspect, 2, .{}); - var str = ZigString.init("nodejs.util.inspect.custom"); - fun.put(globalObject, ZigString.static("custom"), jsc.JSValue.symbolFor(globalObject, &str)); - fun.put(globalObject, ZigString.static("table"), jsc.JSFunction.create(globalObject, "table", inspectTable, 3, .{})); + var str = RustString.init("nodejs.util.inspect.custom"); + fun.put(globalObject, RustString.static("custom"), jsc.JSValue.symbolFor(globalObject, &str)); + fun.put(globalObject, RustString.static("table"), jsc.JSFunction.create(globalObject, "table", inspectTable, 3, .{})); return fun; } @@ -558,11 +558,11 @@ pub fn registerMacro(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFram } pub fn getCWD(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue { - return ZigString.init(VirtualMachine.get().transpiler.fs.top_level_dir).toJS(globalThis); + return RustString.init(VirtualMachine.get().transpiler.fs.top_level_dir).toJS(globalThis); } pub fn getOrigin(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue { - return ZigString.init(VirtualMachine.get().origin.origin).toJS(globalThis); + return RustString.init(VirtualMachine.get().origin.origin).toJS(globalThis); } pub fn enableANSIColors(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue { @@ -619,7 +619,7 @@ fn getMain(globalThis: *jsc.JSGlobalObject) callconv(jsc.conv) jsc.JSValue { return vm.main_resolved_path.toJS(globalThis) catch .zero; } - return ZigString.init(vm.main).toJS(globalThis); + return RustString.init(vm.main).toJS(globalThis); } fn setMain(global_this: *jsc.JSGlobalObject, new_value: JSValue) callconv(jsc.conv) bool { @@ -859,7 +859,7 @@ fn doResolveWithArgs(ctx: *jsc.JSGlobalObject, specifier: bun.String, from: bun. query_string, }); - return ZigString.initUTF8(arraylist.items).toJS(ctx); + return RustString.initUTF8(arraylist.items).toJS(ctx); } return errorable.result.value.toJS(ctx); @@ -992,7 +992,7 @@ pub fn indexOfLine(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) b return jsc.JSValue.jsNumberFromInt32(-1); } -pub const Crypto = @import("../crypto/crypto.zig"); +pub const Crypto = @import("../crypto/crypto.rust"); pub fn nanoseconds(globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue { const ns = globalThis.bunVM().origin_timer.read(); @@ -1036,22 +1036,22 @@ pub fn serve(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.J switch (entry.tag()) { @field(@TypeOf(entry.tag()), @typeName(jsc.API.HTTPServer)) => { var server: *jsc.API.HTTPServer = entry.as(jsc.API.HTTPServer); - server.onReloadFromZig(&config, globalObject); + server.onReloadFromRust(&config, globalObject); return server.js_value.tryGet() orelse .js_undefined; }, @field(@TypeOf(entry.tag()), @typeName(jsc.API.DebugHTTPServer)) => { var server: *jsc.API.DebugHTTPServer = entry.as(jsc.API.DebugHTTPServer); - server.onReloadFromZig(&config, globalObject); + server.onReloadFromRust(&config, globalObject); return server.js_value.tryGet() orelse .js_undefined; }, @field(@TypeOf(entry.tag()), @typeName(jsc.API.DebugHTTPSServer)) => { var server: *jsc.API.DebugHTTPSServer = entry.as(jsc.API.DebugHTTPSServer); - server.onReloadFromZig(&config, globalObject); + server.onReloadFromRust(&config, globalObject); return server.js_value.tryGet() orelse .js_undefined; }, @field(@TypeOf(entry.tag()), @typeName(jsc.API.HTTPSServer)) => { var server: *jsc.API.HTTPSServer = entry.as(jsc.API.HTTPSServer); - server.onReloadFromZig(&config, globalObject); + server.onReloadFromRust(&config, globalObject); return server.js_value.tryGet() orelse .js_undefined; }, else => {}, @@ -1115,13 +1115,13 @@ pub export fn Bun__escapeHTML16(globalObject: *jsc.JSGlobalObject, input_value: assert(len > 0); const input_slice = ptr[0..len]; const escaped = strings.escapeHTMLForUTF16Input(globalObject.bunVM().allocator, input_slice) catch { - return globalObject.throwValue(ZigString.init("Out of memory").toErrorInstance(globalObject)) catch return .zero; + return globalObject.throwValue(RustString.init("Out of memory").toErrorInstance(globalObject)) catch return .zero; }; return switch (escaped) { - .static => |val| ZigString.init(val).toJS(globalObject), + .static => |val| RustString.init(val).toJS(globalObject), .original => input_value, - .allocated => |escaped_html| ZigString.from16(escaped_html.ptr, escaped_html.len).toExternalValue(globalObject), + .allocated => |escaped_html| RustString.from16(escaped_html.ptr, escaped_html.len).toExternalValue(globalObject), }; } @@ -1133,12 +1133,12 @@ pub export fn Bun__escapeHTML8(globalObject: *jsc.JSGlobalObject, input_value: J const allocator = if (input_slice.len <= 32) stack_allocator.get() else stack_allocator.fallback_allocator; const escaped = strings.escapeHTMLForLatin1Input(allocator, input_slice) catch { - return globalObject.throwValue(ZigString.init("Out of memory").toErrorInstance(globalObject)) catch return .zero; + return globalObject.throwValue(RustString.init("Out of memory").toErrorInstance(globalObject)) catch return .zero; }; switch (escaped) { .static => |val| { - return ZigString.init(val).toJS(globalObject); + return RustString.init(val).toJS(globalObject); }, .original => return input_value, .allocated => |escaped_html| { @@ -1157,12 +1157,12 @@ pub export fn Bun__escapeHTML8(globalObject: *jsc.JSGlobalObject, input_value: J } if (input_slice.len <= 32) { - const zig_str = ZigString.init(escaped_html); - const out = zig_str.toAtomicValue(globalObject); + const rust_str = RustString.init(escaped_html); + const out = rust_str.toAtomicValue(globalObject); return out; } - return ZigString.init(escaped_html).toExternalValue(globalObject); + return RustString.init(escaped_html).toExternalValue(globalObject); }, } } @@ -1326,7 +1326,7 @@ pub fn setTLSDefaultCiphers(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject, c } pub fn getValkeyDefaultClient(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue { - const SubscriptionCtx = @import("../valkey_jsc/js_valkey.zig").SubscriptionCtx; + const SubscriptionCtx = @import("../valkey_jsc/js_valkey.rust").SubscriptionCtx; var valkey = jsc.API.Valkey.createNoJsNoPubsub(globalThis, &.{.js_undefined}) catch |err| { if (err != error.JSError) { @@ -1414,14 +1414,14 @@ const CSRFObject = struct { object.put( globalThis, - ZigString.static("generate"), - jsc.JSFunction.create(globalThis, "generate", @import("./csrf_jsc.zig").csrf__generate, 1, .{}), + RustString.static("generate"), + jsc.JSFunction.create(globalThis, "generate", @import("./csrf_jsc.rust").csrf__generate, 1, .{}), ); object.put( globalThis, - ZigString.static("verify"), - jsc.JSFunction.create(globalThis, "verify", @import("./csrf_jsc.zig").csrf__verify, 1, .{}), + RustString.static("verify"), + jsc.JSFunction.create(globalThis, "verify", @import("./csrf_jsc.rust").csrf__verify, 1, .{}), ); return object; @@ -1442,7 +1442,7 @@ pub const EnvironmentVariables = struct { return item.len; } - pub export fn Bun__getEnvValue(globalObject: *jsc.JSGlobalObject, name: *ZigString, value: *ZigString) bool { + pub export fn Bun__getEnvValue(globalObject: *jsc.JSGlobalObject, name: *RustString, value: *RustString) bool { if (getEnvValue(globalObject, name.*)) |val| { value.* = val; return true; @@ -1462,7 +1462,7 @@ pub const EnvironmentVariables = struct { return true; } - /// Sync a process.env write back to the Zig-side env map so that Zig + /// Sync a process.env write back to the Rust-side env map so that Rust /// consumers (e.g. fetch's proxy resolution via env.getHttpProxyFor) /// observe the updated value. Used by custom setters for proxy-related /// env vars (HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase variants). @@ -1515,22 +1515,22 @@ pub const EnvironmentVariables = struct { bun.handleOom(vm.transpiler.env.map.put(slot.key, new_val.bytes)); } - pub fn getEnvNames(globalObject: *jsc.JSGlobalObject, names: []ZigString) usize { + pub fn getEnvNames(globalObject: *jsc.JSGlobalObject, names: []RustString) usize { var vm = globalObject.bunVM(); const keys = vm.transpiler.env.map.map.keys(); const len = @min(names.len, keys.len); for (keys[0..len], names[0..len]) |key, *name| { - name.* = ZigString.initUTF8(key); + name.* = RustString.initUTF8(key); } return len; } - pub fn getEnvValue(globalObject: *jsc.JSGlobalObject, name: ZigString) ?ZigString { + pub fn getEnvValue(globalObject: *jsc.JSGlobalObject, name: RustString) ?RustString { var vm = globalObject.bunVM(); var sliced = name.toSlice(vm.allocator); defer sliced.deinit(); const value = vm.transpiler.env.get(sliced.slice()) orelse return null; - return ZigString.initUTF8(value); + return RustString.initUTF8(value); } }; @@ -1686,7 +1686,7 @@ pub const JSZlib = struct { reader.readAll(true) catch { defer reader.deinit(); - return globalThis.throwValue(ZigString.init(reader.errorMessage() orelse "Zlib returned an error").toErrorInstance(globalThis)); + return globalThis.throwValue(RustString.init(reader.errorMessage() orelse "Zlib returned an error").toErrorInstance(globalThis)); }; reader.list = .{ .items = reader.list.items }; reader.list.capacity = reader.list.items.len; @@ -1793,7 +1793,7 @@ pub const JSZlib = struct { reader.readAll() catch { defer reader.deinit(); - return globalThis.throwValue(ZigString.init(reader.errorMessage() orelse "Zlib returned an error").toErrorInstance(globalThis)); + return globalThis.throwValue(RustString.init(reader.errorMessage() orelse "Zlib returned an error").toErrorInstance(globalThis)); }; reader.list = .{ .items = bun.handleOom(reader.list.toOwnedSlice(allocator)) }; reader.list.capacity = reader.list.items.len; @@ -2093,7 +2093,7 @@ pub const JSZstd = struct { comptime { _ = Crypto.JSPasswordObject.JSPasswordObject__create; - _ = @import("../../jsc/btjs.zig").dumpBtjsTrace; + _ = @import("../../jsc/btjs.rust").dumpBtjsTrace; BunObject.exportAll(); } @@ -2130,13 +2130,13 @@ pub fn createBunStdout(globalThis: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue return blob.toJS(globalThis); } -const Braces = @import("../../shell_parser/braces.zig"); -const Which = @import("../../which/which.zig"); -const options = @import("../../bundler/options.zig"); +const Braces = @import("../../shell_parser/braces.rust"); +const Which = @import("../../which/which.rust"); +const options = @import("../../bundler/options.rust"); const std = @import("std"); -const zlib = @import("../../zlib/zlib.zig"); -const Editor = @import("../cli/open.zig").Editor; -const URL = @import("../../url/url.zig").URL; +const zlib = @import("../../zlib/zlib.rust"); +const Editor = @import("../cli/open.rust").Editor; +const URL = @import("../../url/url.rust").URL; const conv = std.builtin.CallingConvention.Unspecified; const bun = @import("bun"); @@ -2169,7 +2169,7 @@ const JSPromise = bun.jsc.JSPromise; const JSValue = bun.jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; const WebCore = bun.jsc.WebCore; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; const host_fn = bun.jsc.host_fn; const JSBundler = bun.jsc.API.JSBundler; diff --git a/src/runtime/api/HashObject.zig b/src/runtime/api/HashObject.zig index 2319dbe19b6..07744da9ab1 100644 --- a/src/runtime/api/HashObject.zig +++ b/src/runtime/api/HashObject.zig @@ -64,13 +64,13 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { }; inline for (fns) |name| { const value = jsc.JSFunction.create(globalThis, name, @field(HashObject, name), 1, .{}); - function.put(globalThis, comptime ZigString.static(name), value); + function.put(globalThis, comptime RustString.static(name), value); } return function; } -fn hashWrap(comptime Hasher_: anytype) jsc.JSHostFnZig { +fn hashWrap(comptime Hasher_: anytype) jsc.JSHostFnRust { return struct { const Hasher = Hasher_; pub fn hash(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { @@ -79,7 +79,7 @@ fn hashWrap(comptime Hasher_: anytype) jsc.JSHostFnZig { defer args.deinit(); var input: []const u8 = ""; - var input_slice = ZigString.Slice.empty; + var input_slice = RustString.Slice.empty; defer input_slice.deinit(); if (args.nextEat()) |arg| { if (arg.as(jsc.WebCore.Blob)) |blob| { @@ -153,4 +153,4 @@ const std = @import("std"); const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/JSBundler.zig b/src/runtime/api/JSBundler.zig index 7d105b912f2..8da0519e68f 100644 --- a/src/runtime/api/JSBundler.zig +++ b/src/runtime/api/JSBundler.zig @@ -455,7 +455,7 @@ pub const JSBundler = struct { errdefer if (plugins.*) |plugin| plugin.deinit(); var did_set_target = false; - if (try config.getOptional(globalThis, "target", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "target", RustString.Slice)) |slice| { defer slice.deinit(); if (strings.hasPrefixComptime(slice.slice(), "bun-")) { this.compile = .{ @@ -491,7 +491,7 @@ pub const JSBundler = struct { return globalThis.throwInvalidArguments("Expected plugin to be an object", .{}); } - if (try plugin.getOptional(globalThis, "name", ZigString.Slice)) |slice| { + if (try plugin.getOptional(globalThis, "name", RustString.Slice)) |slice| { defer slice.deinit(); if (slice.len == 0) { return globalThis.throwInvalidArguments("Expected plugin to have a non-empty name", .{}); @@ -567,18 +567,18 @@ pub const JSBundler = struct { } var has_out_dir = false; - if (try config.getOptional(globalThis, "outdir", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "outdir", RustString.Slice)) |slice| { defer slice.deinit(); try this.outdir.appendSliceExact(slice.slice()); has_out_dir = true; } - if (try config.getOptional(globalThis, "banner", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "banner", RustString.Slice)) |slice| { defer slice.deinit(); try this.banner.appendSliceExact(slice.slice()); } - if (try config.getOptional(globalThis, "footer", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "footer", RustString.Slice)) |slice| { defer slice.deinit(); try this.footer.appendSliceExact(slice.slice()); } @@ -639,7 +639,7 @@ pub const JSBundler = struct { return globalThis.throwInvalidArguments("jsx must be an object", .{}); } - if (try jsx_value.getOptional(globalThis, "runtime", ZigString.Slice)) |slice| { + if (try jsx_value.getOptional(globalThis, "runtime", RustString.Slice)) |slice| { defer slice.deinit(); var str_lower: [128]u8 = undefined; const len = @min(slice.len, str_lower.len); @@ -654,17 +654,17 @@ pub const JSBundler = struct { } } - if (try jsx_value.getOptional(globalThis, "factory", ZigString.Slice)) |slice| { + if (try jsx_value.getOptional(globalThis, "factory", RustString.Slice)) |slice| { defer slice.deinit(); this.jsx.factory = try allocator.dupe(u8, slice.slice()); } - if (try jsx_value.getOptional(globalThis, "fragment", ZigString.Slice)) |slice| { + if (try jsx_value.getOptional(globalThis, "fragment", RustString.Slice)) |slice| { defer slice.deinit(); this.jsx.fragment = try allocator.dupe(u8, slice.slice()); } - if (try jsx_value.getOptional(globalThis, "importSource", ZigString.Slice)) |slice| { + if (try jsx_value.getOptional(globalThis, "importSource", RustString.Slice)) |slice| { defer slice.deinit(); this.jsx.import_source = try allocator.dupe(u8, slice.slice()); } @@ -756,8 +756,8 @@ pub const JSBundler = struct { } { - const path: ZigString.Slice = brk: { - if (try config.getOptional(globalThis, "root", ZigString.Slice)) |slice| { + const path: RustString.Slice = brk: { + if (try config.getOptional(globalThis, "root", RustString.Slice)) |slice| { break :brk slice; } @@ -773,15 +773,15 @@ pub const JSBundler = struct { } } if (all_in_filemap) { - break :brk ZigString.Slice.fromUTF8NeverFree("."); + break :brk RustString.Slice.fromUTF8NeverFree("."); } } if (entry_points.len == 1) { - break :brk ZigString.Slice.fromUTF8NeverFree(std.fs.path.dirname(entry_points[0]) orelse "."); + break :brk RustString.Slice.fromUTF8NeverFree(std.fs.path.dirname(entry_points[0]) orelse "."); } - break :brk ZigString.Slice.fromUTF8NeverFree(resolve_path.getIfExistsLongestCommonPath(entry_points) orelse "."); + break :brk RustString.Slice.fromUTF8NeverFree(resolve_path.getIfExistsLongestCommonPath(entry_points) orelse "."); }; defer path.deinit(); @@ -851,21 +851,21 @@ pub const JSBundler = struct { } } - // if (try config.getOptional(globalThis, "dir", ZigString.Slice)) |slice| { + // if (try config.getOptional(globalThis, "dir", RustString.Slice)) |slice| { // defer slice.deinit(); // this.appendSliceExact(slice.slice()) catch unreachable; // } else { // this.appendSliceExact(globalThis.bunVM().transpiler.fs.top_level_dir) catch unreachable; // } - if (try config.getOptional(globalThis, "publicPath", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "publicPath", RustString.Slice)) |slice| { defer slice.deinit(); try this.public_path.appendSliceExact(slice.slice()); } if (try config.getTruthy(globalThis, "naming")) |naming| { if (naming.isString()) { - if (try config.getOptional(globalThis, "naming", ZigString.Slice)) |slice| { + if (try config.getOptional(globalThis, "naming", RustString.Slice)) |slice| { defer slice.deinit(); if (!strings.hasPrefixComptime(slice.slice(), "./")) { try this.names.owned_entry_point.appendSliceExact("./"); @@ -874,7 +874,7 @@ pub const JSBundler = struct { this.names.entry_point.data = this.names.owned_entry_point.list.items; } } else if (naming.isObject()) { - if (try naming.getOptional(globalThis, "entry", ZigString.Slice)) |slice| { + if (try naming.getOptional(globalThis, "entry", RustString.Slice)) |slice| { defer slice.deinit(); if (!strings.hasPrefixComptime(slice.slice(), "./")) { try this.names.owned_entry_point.appendSliceExact("./"); @@ -883,7 +883,7 @@ pub const JSBundler = struct { this.names.entry_point.data = this.names.owned_entry_point.list.items; } - if (try naming.getOptional(globalThis, "chunk", ZigString.Slice)) |slice| { + if (try naming.getOptional(globalThis, "chunk", RustString.Slice)) |slice| { defer slice.deinit(); if (!strings.hasPrefixComptime(slice.slice(), "./")) { try this.names.owned_chunk.appendSliceExact("./"); @@ -892,7 +892,7 @@ pub const JSBundler = struct { this.names.chunk.data = this.names.owned_chunk.list.items; } - if (try naming.getOptional(globalThis, "asset", ZigString.Slice)) |slice| { + if (try naming.getOptional(globalThis, "asset", RustString.Slice)) |slice| { defer slice.deinit(); if (!strings.hasPrefixComptime(slice.slice(), "./")) { try this.names.owned_asset.appendSliceExact("./"); @@ -920,10 +920,10 @@ pub const JSBundler = struct { return globalThis.throwInvalidArguments("define \"{f}\" must be a JSON string", .{prop}); } - var val = jsc.ZigString.init(""); - try property_value.toZigString(&val, globalThis); + var val = jsc.RustString.init(""); + try property_value.toRustString(&val, globalThis); if (val.len == 0) { - val = jsc.ZigString.fromUTF8("\"\""); + val = jsc.RustString.fromUTF8("\"\""); } const key = try prop.toOwnedSlice(bun.default_allocator); @@ -997,11 +997,11 @@ pub const JSBundler = struct { } else if (metafile_value.isObject()) { // metafile: { json?: string, markdown?: string } this.metafile = true; - if (try metafile_value.getOptional(globalThis, "json", ZigString.Slice)) |slice| { + if (try metafile_value.getOptional(globalThis, "json", RustString.Slice)) |slice| { defer slice.deinit(); try this.metafile_json_path.appendSliceExact(slice.slice()); } - if (try metafile_value.getOptional(globalThis, "markdown", ZigString.Slice)) |slice| { + if (try metafile_value.getOptional(globalThis, "markdown", RustString.Slice)) |slice| { defer slice.deinit(); try this.metafile_markdown_path.appendSliceExact(slice.slice()); } @@ -1870,14 +1870,14 @@ pub const BuildArtifact = struct { this: *BuildArtifact, globalThis: *jsc.JSGlobalObject, ) JSValue { - return ZigString.fromUTF8(this.path).toJS(globalThis); + return RustString.fromUTF8(this.path).toJS(globalThis); } pub fn getLoader( this: *BuildArtifact, globalThis: *jsc.JSGlobalObject, ) JSValue { - return ZigString.fromUTF8(@tagName(this.loader)).toJS(globalThis); + return RustString.fromUTF8(@tagName(this.loader)).toJS(globalThis); } pub fn getHash( @@ -1886,7 +1886,7 @@ pub const BuildArtifact = struct { ) JSValue { var buf: [512]u8 = undefined; const out = std.fmt.bufPrint(&buf, "{f}", .{bun.fmt.truncatedHash32(this.hash)}) catch @panic("Unexpected"); - return ZigString.init(out).toJS(globalThis); + return RustString.init(out).toJS(globalThis); } pub fn getSize(this: *BuildArtifact, globalObject: *jsc.JSGlobalObject) JSValue { @@ -1898,7 +1898,7 @@ pub const BuildArtifact = struct { } pub fn getOutputKind(this: *BuildArtifact, globalObject: *jsc.JSGlobalObject) JSValue { - return ZigString.init(@tagName(this.output_kind)).toJS(globalObject); + return RustString.init(@tagName(this.output_kind)).toJS(globalObject); } pub fn getSourceMap(this: *BuildArtifact, _: *jsc.JSGlobalObject) JSValue { @@ -2021,13 +2021,13 @@ pub const BuildArtifact = struct { const string = []const u8; -const CompileTarget = @import("../../options_types/CompileTarget.zig"); -const Fs = @import("../../resolver/fs.zig"); -const _resolver = @import("../../resolver/resolver.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const CompileTarget = @import("../../options_types/CompileTarget.rust"); +const Fs = @import("../../resolver/fs.rust"); +const _resolver = @import("../../resolver/resolver.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const options = @import("../../bundler/options.zig"); +const options = @import("../../bundler/options.rust"); const Loader = options.Loader; const Target = options.Target; @@ -2046,5 +2046,5 @@ const api = bun.schema.api; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Blob = jsc.WebCore.Blob; diff --git a/src/runtime/api/JSON5Object.zig b/src/runtime/api/JSON5Object.zig index 945f2355077..d35ca1d75c4 100644 --- a/src/runtime/api/JSON5Object.zig +++ b/src/runtime/api/JSON5Object.zig @@ -2,12 +2,12 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { const object = JSValue.createEmptyObject(globalThis, 2); object.put( globalThis, - ZigString.static("parse"), + RustString.static("parse"), jsc.JSFunction.create(globalThis, "parse", parse, 1, .{}), ); object.put( globalThis, - ZigString.static("stringify"), + RustString.static("stringify"), jsc.JSFunction.create(globalThis, "stringify", stringify, 3, .{}), ); return object; @@ -429,5 +429,5 @@ const Expr = ast.Expr; const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const wtf = jsc.wtf; diff --git a/src/runtime/api/JSONCObject.zig b/src/runtime/api/JSONCObject.zig index f8beeb05c80..d681a148471 100644 --- a/src/runtime/api/JSONCObject.zig +++ b/src/runtime/api/JSONCObject.zig @@ -2,7 +2,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { const object = JSValue.createEmptyObject(globalThis, 1); object.put( globalThis, - ZigString.static("parse"), + RustString.static("parse"), jsc.JSFunction.create( globalThis, "parse", @@ -61,4 +61,4 @@ const json = bun.interchange.json; const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/JSTranspiler.zig b/src/runtime/api/JSTranspiler.zig index 7d231902efe..51cba979418 100644 --- a/src/runtime/api/JSTranspiler.zig +++ b/src/runtime/api/JSTranspiler.zig @@ -89,10 +89,10 @@ pub const Config = struct { } names.appendAssumeCapacity(prop.toOwnedSlice(allocator) catch unreachable); - var val = jsc.ZigString.init(""); - try property_value.toZigString(&val, globalThis); + var val = jsc.RustString.init(""); + try property_value.toRustString(&val, globalThis); if (val.len == 0) { - val = jsc.ZigString.init("\"\""); + val = jsc.RustString.init("\"\""); } values.appendAssumeCapacity(std.fmt.allocPrint(allocator, "{f}", .{val}) catch unreachable); } @@ -110,11 +110,11 @@ pub const Config = struct { const toplevel_type = external.jsType(); if (toplevel_type.isStringLike()) { - var zig_str = jsc.ZigString.init(""); - try external.toZigString(&zig_str, globalThis); - if (zig_str.len == 0) break :external; + var rust_str = jsc.RustString.init(""); + try external.toRustString(&rust_str, globalThis); + if (rust_str.len == 0) break :external; var single_external = allocator.alloc(string, 1) catch unreachable; - single_external[0] = std.fmt.allocPrint(allocator, "{f}", .{zig_str}) catch unreachable; + single_external[0] = std.fmt.allocPrint(allocator, "{f}", .{rust_str}) catch unreachable; this.transform.external = single_external; } else if (toplevel_type.isArray()) { const count = try external.getLength(globalThis); @@ -128,10 +128,10 @@ pub const Config = struct { return globalThis.throwInvalidArguments("external must be a string or string[]", .{}); } - var zig_str = jsc.ZigString.init(""); - try entry.toZigString(&zig_str, globalThis); - if (zig_str.len == 0) continue; - externals[i] = std.fmt.allocPrint(allocator, "{f}", .{zig_str}) catch unreachable; + var rust_str = jsc.RustString.init(""); + try entry.toRustString(&rust_str, globalThis); + if (rust_str.len == 0) continue; + externals[i] = std.fmt.allocPrint(allocator, "{f}", .{rust_str}) catch unreachable; i += 1; } @@ -339,7 +339,7 @@ pub const Config = struct { var length_iter = iter; while (try length_iter.next()) |value| { if (!value.isString()) continue; - const str = try value.getZigString(globalThis); + const str = try value.getRustString(globalThis); if (str.len == 0) continue; const name = std.fmt.bufPrint(buf.items.ptr[buf.items.len..buf.capacity], "{f}", .{str}) catch { return globalThis.throwInvalidArguments("Error reading exports.eliminate. TODO: utf-16", .{}); @@ -638,7 +638,7 @@ fn exportReplacementValue(value: JSValue, globalThis: *JSGlobalObject, allocator if (value.isString()) { const str = JSAst.E.String{ - .data = try std.fmt.allocPrint(allocator, "{f}", .{try value.getZigString(globalThis)}), + .data = try std.fmt.allocPrint(allocator, "{f}", .{try value.getRustString(globalThis)}), }; const out = try allocator.create(JSAst.E.String); out.* = str; @@ -881,8 +881,8 @@ pub fn scan(this: *JSTranspiler, globalThis: *jsc.JSGlobalObject, callframe: *js return globalThis.throwValue(try this.transpiler.log.toJS(globalThis, globalThis.allocator(), "Parse error")); } - const exports_label = jsc.ZigString.static("exports"); - const imports_label = jsc.ZigString.static("imports"); + const exports_label = jsc.RustString.static("exports"); + const imports_label = jsc.RustString.static("imports"); const named_imports_value = try namedImportsToJS( globalThis, parse_result.ast.import_records.slice(), @@ -1044,7 +1044,7 @@ pub fn transformSync( // TODO: benchmark if pooling this way is faster or moving is faster buffer_writer = printer.ctx; - var out = jsc.ZigString.init(buffer_writer.written); + var out = jsc.RustString.init(buffer_writer.written); out.setOutputEncoding(); return out.toJS(globalThis); @@ -1074,8 +1074,8 @@ fn namedExportsToJS(global: *JSGlobalObject, named_exports: *JSAst.Ast.NamedExpo } fn namedImportsToJS(global: *JSGlobalObject, import_records: []const ImportRecord, trim_unused_imports: bool) bun.JSError!jsc.JSValue { - const path_label = jsc.ZigString.static("path"); - const kind_label = jsc.ZigString.static("kind"); + const path_label = jsc.RustString.static("path"); + const kind_label = jsc.RustString.static("kind"); var count: u32 = 0; for (import_records) |record| { @@ -1093,8 +1093,8 @@ fn namedImportsToJS(global: *JSGlobalObject, import_records: []const ImportRecor if (trim_unused_imports and record.flags.is_unused) continue; array.ensureStillAlive(); - const path = jsc.ZigString.init(record.path.text).toJS(global); - const kind = jsc.ZigString.init(record.kind.label()).toJS(global); + const path = jsc.RustString.init(record.path.text).toJS(global); + const kind = jsc.RustString.init(record.kind.label()).toJS(global); try array.putIndex(global, i, try jsc.JSValue.createObject2(global, path_label, kind_label, path, kind)); i += 1; } @@ -1196,16 +1196,16 @@ pub fn scanImports(this: *JSTranspiler, globalThis: *jsc.JSGlobalObject, callfra const string = []const u8; const std = @import("std"); -const ImportRecord = @import("../../options_types/import_record.zig").ImportRecord; -const Runtime = @import("../../js_parser/runtime.zig").Runtime; -const TSConfigJSON = @import("../../resolver/tsconfig_json.zig").TSConfigJSON; +const ImportRecord = @import("../../options_types/import_record.rust").ImportRecord; +const Runtime = @import("../../js_parser/runtime.rust").Runtime; +const TSConfigJSON = @import("../../resolver/tsconfig_json.rust").TSConfigJSON; -const options = @import("../../bundler/options.zig"); +const options = @import("../../bundler/options.rust"); const Loader = options.Loader; const Target = options.Target; -const MacroMap = @import("../../resolver/package_json.zig").MacroMap; -const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; +const MacroMap = @import("../../resolver/package_json.rust").MacroMap; +const PackageJSON = @import("../../resolver/package_json.rust").PackageJSON; const bun = @import("bun"); const JSLexer = bun.js_lexer; @@ -1225,4 +1225,4 @@ const ScanPassResult = JSParser.ScanPassResult; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/MarkdownObject.zig b/src/runtime/api/MarkdownObject.zig index a9bb04bc3e0..9465edc5923 100644 --- a/src/runtime/api/MarkdownObject.zig +++ b/src/runtime/api/MarkdownObject.zig @@ -2,22 +2,22 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { const object = JSValue.createEmptyObject(globalThis, 4); object.put( globalThis, - ZigString.static("html"), + RustString.static("html"), jsc.JSFunction.create(globalThis, "html", renderToHTML, 1, .{}), ); object.put( globalThis, - ZigString.static("ansi"), + RustString.static("ansi"), jsc.JSFunction.create(globalThis, "ansi", renderToAnsi, 2, .{}), ); object.put( globalThis, - ZigString.static("render"), + RustString.static("render"), jsc.JSFunction.create(globalThis, "render", render, 3, .{}), ); object.put( globalThis, - ZigString.static("react"), + RustString.static("react"), jsc.JSFunction.create(globalThis, "react", renderReact, 3, .{}), ); return object; @@ -479,8 +479,8 @@ const ParseRenderer = struct { } else { const obj = JSValue.createEmptyObject(self.#globalObject, 2); self.#marked_args.append(obj); - obj.put(self.#globalObject, ZigString.static("type"), type_val); - obj.put(self.#globalObject, ZigString.static("props"), props); + obj.put(self.#globalObject, RustString.static("type"), type_val); + obj.put(self.#globalObject, RustString.static("props"), props); return obj; } } @@ -566,30 +566,30 @@ const ParseRenderer = struct { switch (block_type) { .h => { if (slug) |s| { - props.put(g, ZigString.static("id"), try bun.String.createUTF8ForJS(g, s)); + props.put(g, RustString.static("id"), try bun.String.createUTF8ForJS(g, s)); } }, .ol => { - props.put(g, ZigString.static("start"), JSValue.jsNumber(entry.data)); + props.put(g, RustString.static("start"), JSValue.jsNumber(entry.data)); }, .li => { const task_mark = md.types.taskMarkFromData(entry.data); if (task_mark != 0) { - props.put(g, ZigString.static("checked"), JSValue.jsBoolean(md.types.isTaskChecked(task_mark))); + props.put(g, RustString.static("checked"), JSValue.jsBoolean(md.types.isTaskChecked(task_mark))); } }, .code => { if (entry.flags & md.BLOCK_FENCED_CODE != 0) { const lang = extractLanguage(self.#src_text, entry.data); if (lang.len > 0) { - props.put(g, ZigString.static("language"), try bun.String.createUTF8ForJS(g, lang)); + props.put(g, RustString.static("language"), try bun.String.createUTF8ForJS(g, lang)); } } }, .th, .td => { const alignment = md.types.alignmentFromData(entry.data); if (md.types.alignmentName(alignment)) |align_str| { - props.put(g, ZigString.static("align"), try bun.String.createUTF8ForJS(g, align_str)); + props.put(g, RustString.static("align"), try bun.String.createUTF8ForJS(g, align_str)); } }, else => {}, @@ -597,7 +597,7 @@ const ParseRenderer = struct { // Set children (skip for void elements) if (block_type != .hr) { - props.put(g, ZigString.static("children"), entry.children); + props.put(g, RustString.static("children"), entry.children); } const obj = self.createElement(type_val, props); @@ -661,22 +661,22 @@ const ParseRenderer = struct { // Set metadata props switch (span_type) { .a => { - props.put(g, ZigString.static("href"), try bun.String.createUTF8ForJS(g, entry.detail.href)); + props.put(g, RustString.static("href"), try bun.String.createUTF8ForJS(g, entry.detail.href)); if (entry.detail.title.len > 0) { - props.put(g, ZigString.static("title"), try bun.String.createUTF8ForJS(g, entry.detail.title)); + props.put(g, RustString.static("title"), try bun.String.createUTF8ForJS(g, entry.detail.title)); } }, .img => { - props.put(g, ZigString.static("src"), try bun.String.createUTF8ForJS(g, entry.detail.href)); + props.put(g, RustString.static("src"), try bun.String.createUTF8ForJS(g, entry.detail.href)); if (entry.detail.title.len > 0) { - props.put(g, ZigString.static("title"), try bun.String.createUTF8ForJS(g, entry.detail.title)); + props.put(g, RustString.static("title"), try bun.String.createUTF8ForJS(g, entry.detail.title)); } }, .wikilink => { - props.put(g, ZigString.static("target"), try bun.String.createUTF8ForJS(g, entry.detail.href)); + props.put(g, RustString.static("target"), try bun.String.createUTF8ForJS(g, entry.detail.href)); }, .latexmath_display => { - props.put(g, ZigString.static("display"), .true); + props.put(g, RustString.static("display"), .true); }, else => {}, } @@ -687,7 +687,7 @@ const ParseRenderer = struct { if (len == 1) { const child = try entry.children.getIndex(g, 0); if (child.isString()) { - props.put(g, ZigString.static("alt"), child); + props.put(g, RustString.static("alt"), child); } } else if (len > 1) { // Multiple children — concatenate string parts @@ -702,11 +702,11 @@ const ParseRenderer = struct { } } if (alt_buf.items.len > 0) { - props.put(g, ZigString.static("alt"), try bun.String.createUTF8ForJS(g, alt_buf.items)); + props.put(g, RustString.static("alt"), try bun.String.createUTF8ForJS(g, alt_buf.items)); } } } else { - props.put(g, ZigString.static("children"), entry.children); + props.put(g, RustString.static("children"), entry.children); } const obj = self.createElement(type_val, props); @@ -1097,9 +1097,9 @@ const JsCallbackRenderer = struct { const slug = self.#heading_tracker.leaveHeading(self.#allocator); const field_count: usize = if (slug != null) 2 else 1; const obj = JSValue.createEmptyObject(g, field_count); - obj.put(g, ZigString.static("level"), JSValue.jsNumber(data)); + obj.put(g, RustString.static("level"), JSValue.jsNumber(data)); if (slug) |s| { - obj.put(g, ZigString.static("id"), try bun.String.createUTF8ForJS(g, s)); + obj.put(g, RustString.static("id"), try bun.String.createUTF8ForJS(g, s)); } return obj; }, @@ -1114,7 +1114,7 @@ const JsCallbackRenderer = struct { const lang = extractLanguage(self.#src_text, data); if (lang.len > 0) { const obj = JSValue.createEmptyObject(g, 1); - obj.put(g, ZigString.static("language"), try bun.String.createUTF8ForJS(g, lang)); + obj.put(g, RustString.static("language"), try bun.String.createUTF8ForJS(g, lang)); return obj; } } @@ -1169,9 +1169,9 @@ const JsCallbackRenderer = struct { // second slot, so just fall back to the generic path here — // images are rare enough that it doesn't matter. const obj = JSValue.createEmptyObject(g, 2); - obj.put(g, ZigString.static("src"), try bun.String.createUTF8ForJS(g, detail.href)); + obj.put(g, RustString.static("src"), try bun.String.createUTF8ForJS(g, detail.href)); if (detail.title.len > 0) { - obj.put(g, ZigString.static("title"), try bun.String.createUTF8ForJS(g, detail.title)); + obj.put(g, RustString.static("title"), try bun.String.createUTF8ForJS(g, detail.title)); } return obj; }, @@ -1289,4 +1289,4 @@ const md = bun.md; const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/NativePromiseContext.zig b/src/runtime/api/NativePromiseContext.zig index 4e858bb8e8f..de0adea1aa0 100644 --- a/src/runtime/api/NativePromiseContext.zig +++ b/src/runtime/api/NativePromiseContext.zig @@ -1,4 +1,4 @@ -//! Zig bindings for the NativePromiseContext JSCell. +//! Rust bindings for the NativePromiseContext JSCell. //! //! See src/jsc/bindings/NativePromiseContext.h for the rationale. Short //! version: when native code `.then()`s a user Promise and needs a context diff --git a/src/runtime/api/TOMLObject.zig b/src/runtime/api/TOMLObject.zig index b65bd608a71..ce50714cf9e 100644 --- a/src/runtime/api/TOMLObject.zig +++ b/src/runtime/api/TOMLObject.zig @@ -2,7 +2,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { const object = JSValue.createEmptyObject(globalThis, 1); object.put( globalThis, - ZigString.static("parse"), + RustString.static("parse"), jsc.JSFunction.create( globalThis, "parse", @@ -76,4 +76,4 @@ const TOML = bun.interchange.toml.TOML; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/UnsafeObject.zig b/src/runtime/api/UnsafeObject.zig index 7ab191b9c3b..8f8b3ccd529 100644 --- a/src/runtime/api/UnsafeObject.zig +++ b/src/runtime/api/UnsafeObject.zig @@ -8,7 +8,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { inline for (comptime std.meta.fieldNames(@TypeOf(fields))) |name| { object.put( globalThis, - comptime ZigString.static(name), + comptime RustString.static(name), jsc.JSFunction.create(globalThis, name, @field(fields, name), 1, .{}), ); } @@ -45,14 +45,14 @@ pub fn arrayBufferToString( const array_buffer = jsc.ArrayBuffer.fromTypedArray(globalThis, args[0]); switch (array_buffer.typed_array_type) { .Uint16Array, .Int16Array => { - var zig_str = ZigString.init(""); - zig_str._unsafe_ptr_do_not_use = @as([*]const u8, @ptrCast(@alignCast(array_buffer.ptr))); - zig_str.len = array_buffer.len; - zig_str.markUTF16(); - return zig_str.toJS(globalThis); + var rust_str = RustString.init(""); + rust_str._unsafe_ptr_do_not_use = @as([*]const u8, @ptrCast(@alignCast(array_buffer.ptr))); + rust_str.len = array_buffer.len; + rust_str.markUTF16(); + return rust_str.toJS(globalThis); }, else => { - return ZigString.init(array_buffer.slice()).toJS(globalThis); + return RustString.init(array_buffer.slice()).toJS(globalThis); }, } } @@ -73,4 +73,4 @@ const std = @import("std"); const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/api/YAMLObject.zig b/src/runtime/api/YAMLObject.zig index 4b988f9c3ea..c1a65369ae4 100644 --- a/src/runtime/api/YAMLObject.zig +++ b/src/runtime/api/YAMLObject.zig @@ -2,7 +2,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { const object = JSValue.createEmptyObject(globalThis, 2); object.put( globalThis, - ZigString.static("parse"), + RustString.static("parse"), jsc.JSFunction.create( globalThis, "parse", @@ -13,7 +13,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { ); object.put( globalThis, - ZigString.static("stringify"), + RustString.static("stringify"), jsc.JSFunction.create( globalThis, "stringify", @@ -807,7 +807,7 @@ const Stringifier = struct { /// Returns true when `str` would be parsed back as a number by `YAML.parse`. /// - /// This mirrors the rules in `src/interchange/yaml.zig`'s `tryResolveNumber`: + /// This mirrors the rules in `src/interchange/yaml.rust`'s `tryResolveNumber`: /// - Optional leading sign, optionally followed by `.inf`/`.Inf`/`.INF` for signed infinity. /// - Otherwise a numeric mantissa: digits/`.`/`e`/`E`/hex letters, plus additional `+`/`-` /// (the parser accepts any number of `+` after the leading sign as long as no `x` was @@ -1070,5 +1070,5 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const MarkedArgumentBuffer = jsc.MarkedArgumentBuffer; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const wtf = bun.jsc.wtf; diff --git a/src/runtime/api/bun/SSLContextCache.zig b/src/runtime/api/bun/SSLContextCache.zig index df795b57ff4..cc6fb921fe9 100644 --- a/src/runtime/api/bun/SSLContextCache.zig +++ b/src/runtime/api/bun/SSLContextCache.zig @@ -191,7 +191,7 @@ pub const c = struct { }; comptime { - // Force into the link even though nothing in Zig calls it — `openssl.c` + // Force into the link even though nothing in Rust calls it — `openssl.c` // references it as the `CRYPTO_EX_free` for `us_ctx_cache_ex_idx`. _ = &bun_ssl_ctx_cache_on_free; } diff --git a/src/runtime/api/bun/SecureContext.zig b/src/runtime/api/bun/SecureContext.zig index 3720e759661..5b1c48a8819 100644 --- a/src/runtime/api/bun/SecureContext.zig +++ b/src/runtime/api/bun/SecureContext.zig @@ -76,7 +76,7 @@ fn createWithDigest(global: *jsc.JSGlobalObject, ctx_opts: uws.SocketContext.Bun /// digest so identical configs return the same `JSSecureContext` cell while /// it's alive; falls through to `create()` (which itself hits the native /// `SSLContextCache`) on miss. Returning the same cell is what makes -/// `secureContext === createSecureContext(opts)` hold and lets `Listener.zig` +/// `secureContext === createSecureContext(opts)` hold and lets `Listener.rust` /// pointer-compare without a JS-side WeakRef map. pub fn intern(global: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { const args = callframe.arguments(); diff --git a/src/runtime/api/bun/Terminal.zig b/src/runtime/api/bun/Terminal.zig index 7d92758540b..821a0aa3143 100644 --- a/src/runtime/api/bun/Terminal.zig +++ b/src/runtime/api/bun/Terminal.zig @@ -52,7 +52,7 @@ cols: u16, rows: u16, /// Terminal name (e.g., "xterm-256color") -term_name: jsc.ZigString.Slice, +term_name: jsc.RustString.Slice, /// Event loop handle for callbacks event_loop_handle: jsc.EventLoopHandle, @@ -105,7 +105,7 @@ pub const IOReader = bun.io.BufferedReader; pub const Options = struct { cols: u16 = 80, rows: u16 = 24, - term_name: jsc.ZigString.Slice = .{}, + term_name: jsc.RustString.Slice = .{}, data_callback: ?JSValue = null, exit_callback: ?JSValue = null, drain_callback: ?JSValue = null, @@ -127,7 +127,7 @@ pub const Options = struct { if (n > 0 and n <= 65535) options.rows = @intCast(n); } - if (try js_options.getOptional(globalObject, "name", jsc.ZigString.Slice)) |slice| { + if (try js_options.getOptional(globalObject, "name", jsc.RustString.Slice)) |slice| { if (slice.len > max_term_name_len) { slice.deinit(); return globalObject.throw("Terminal name too long (max {d} characters)", .{max_term_name_len}); @@ -186,7 +186,7 @@ fn initTerminal( const term_name = if (options.term_name.len > 0) options.term_name else - jsc.ZigString.Slice.fromUTF8NeverFree("xterm-256color"); + jsc.RustString.Slice.fromUTF8NeverFree("xterm-256color"); // Ownership moves to the struct below; clear so caller's options.deinit() // doesn't double-free on the WriterStartFailed/ReaderStartFailed paths. options.term_name = .{}; @@ -518,7 +518,7 @@ fn createPtyPosix(cols: u16, rows: u16) CreatePtyError!PtyResult { .IMAXBEL = true, // Ring bell on input queue full .BRKINT = true, // Signal interrupt on break }; - // IUTF8: present in Linux/macOS/FreeBSD kernels but Zig std's + // IUTF8: present in Linux/macOS/FreeBSD kernels but Rust std's // tc_iflag_t only exposes the field on Linux/macOS, so probe for it. if (comptime @hasField(@TypeOf(t.iflag), "IUTF8")) { t.iflag.IUTF8 = true; @@ -1123,7 +1123,7 @@ fn callExitCallback(this: *Terminal, exit_code: i32, signal: ?bun.SignalCode) vo const globalThis = this.globalThis; const signal_value: JSValue = if (signal) |s| - jsc.ZigString.init(s.name() orelse "unknown").toJS(globalThis) + jsc.RustString.init(s.name() orelse "unknown").toJS(globalThis) else JSValue.jsNull(); diff --git a/src/runtime/api/bun/h2_frame_parser.zig b/src/runtime/api/bun/h2_frame_parser.zig index 33896f733e6..b68695e8358 100644 --- a/src/runtime/api/bun/h2_frame_parser.zig +++ b/src/runtime/api/bun/h2_frame_parser.zig @@ -216,14 +216,14 @@ const FullSettingsPayload = packed struct(u336) { pub const byteSize: usize = 42; pub fn toJS(this: *FullSettingsPayload, globalObject: *jsc.JSGlobalObject) jsc.JSValue { var result = JSValue.createEmptyObject(globalObject, 8); - result.put(globalObject, jsc.ZigString.static("headerTableSize"), jsc.JSValue.jsNumber(this.headerTableSize)); - result.put(globalObject, jsc.ZigString.static("enablePush"), jsc.JSValue.jsBoolean(this.enablePush > 0)); - result.put(globalObject, jsc.ZigString.static("maxConcurrentStreams"), jsc.JSValue.jsNumber(this.maxConcurrentStreams)); - result.put(globalObject, jsc.ZigString.static("initialWindowSize"), jsc.JSValue.jsNumber(this.initialWindowSize)); - result.put(globalObject, jsc.ZigString.static("maxFrameSize"), jsc.JSValue.jsNumber(this.maxFrameSize)); - result.put(globalObject, jsc.ZigString.static("maxHeaderListSize"), jsc.JSValue.jsNumber(this.maxHeaderListSize)); - result.put(globalObject, jsc.ZigString.static("maxHeaderSize"), jsc.JSValue.jsNumber(this.maxHeaderListSize)); - result.put(globalObject, jsc.ZigString.static("enableConnectProtocol"), jsc.JSValue.jsBoolean(this.enableConnectProtocol > 0)); + result.put(globalObject, jsc.RustString.static("headerTableSize"), jsc.JSValue.jsNumber(this.headerTableSize)); + result.put(globalObject, jsc.RustString.static("enablePush"), jsc.JSValue.jsBoolean(this.enablePush > 0)); + result.put(globalObject, jsc.RustString.static("maxConcurrentStreams"), jsc.JSValue.jsNumber(this.maxConcurrentStreams)); + result.put(globalObject, jsc.RustString.static("initialWindowSize"), jsc.JSValue.jsNumber(this.initialWindowSize)); + result.put(globalObject, jsc.RustString.static("maxFrameSize"), jsc.JSValue.jsNumber(this.maxFrameSize)); + result.put(globalObject, jsc.RustString.static("maxHeaderListSize"), jsc.JSValue.jsNumber(this.maxHeaderListSize)); + result.put(globalObject, jsc.RustString.static("maxHeaderSize"), jsc.JSValue.jsNumber(this.maxHeaderListSize)); + result.put(globalObject, jsc.RustString.static("enableConnectProtocol"), jsc.JSValue.jsBoolean(this.enableConnectProtocol > 0)); return result; } @@ -2932,17 +2932,17 @@ pub const H2FrameParser = struct { pub fn getCurrentState(this: *H2FrameParser, globalObject: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue { jsc.markBinding(@src()); var result = JSValue.createEmptyObject(globalObject, 9); - result.put(globalObject, jsc.ZigString.static("effectiveLocalWindowSize"), jsc.JSValue.jsNumber(this.windowSize)); - result.put(globalObject, jsc.ZigString.static("effectiveRecvDataLength"), jsc.JSValue.jsNumber(this.windowSize - this.usedWindowSize)); - result.put(globalObject, jsc.ZigString.static("nextStreamID"), jsc.JSValue.jsNumber(this.getNextStreamID())); - result.put(globalObject, jsc.ZigString.static("lastProcStreamID"), jsc.JSValue.jsNumber(this.lastStreamID)); + result.put(globalObject, jsc.RustString.static("effectiveLocalWindowSize"), jsc.JSValue.jsNumber(this.windowSize)); + result.put(globalObject, jsc.RustString.static("effectiveRecvDataLength"), jsc.JSValue.jsNumber(this.windowSize - this.usedWindowSize)); + result.put(globalObject, jsc.RustString.static("nextStreamID"), jsc.JSValue.jsNumber(this.getNextStreamID())); + result.put(globalObject, jsc.RustString.static("lastProcStreamID"), jsc.JSValue.jsNumber(this.lastStreamID)); const settings: FullSettingsPayload = this.remoteSettings orelse .{}; - result.put(globalObject, jsc.ZigString.static("remoteWindowSize"), jsc.JSValue.jsNumber(settings.initialWindowSize)); - result.put(globalObject, jsc.ZigString.static("localWindowSize"), jsc.JSValue.jsNumber(this.localSettings.initialWindowSize)); - result.put(globalObject, jsc.ZigString.static("deflateDynamicTableSize"), jsc.JSValue.jsNumber(this.localSettings.headerTableSize)); - result.put(globalObject, jsc.ZigString.static("inflateDynamicTableSize"), jsc.JSValue.jsNumber(this.localSettings.headerTableSize)); - result.put(globalObject, jsc.ZigString.static("outboundQueueSize"), jsc.JSValue.jsNumber(this.outboundQueueSize)); + result.put(globalObject, jsc.RustString.static("remoteWindowSize"), jsc.JSValue.jsNumber(settings.initialWindowSize)); + result.put(globalObject, jsc.RustString.static("localWindowSize"), jsc.JSValue.jsNumber(this.localSettings.initialWindowSize)); + result.put(globalObject, jsc.RustString.static("deflateDynamicTableSize"), jsc.JSValue.jsNumber(this.localSettings.headerTableSize)); + result.put(globalObject, jsc.RustString.static("inflateDynamicTableSize"), jsc.JSValue.jsNumber(this.localSettings.headerTableSize)); + result.put(globalObject, jsc.RustString.static("outboundQueueSize"), jsc.JSValue.jsNumber(this.outboundQueueSize)); return result; } @@ -3226,13 +3226,13 @@ pub const H2FrameParser = struct { }; var state = jsc.JSValue.createEmptyObject(globalObject, 6); - state.put(globalObject, jsc.ZigString.static("localWindowSize"), jsc.JSValue.jsNumber(stream.windowSize)); - state.put(globalObject, jsc.ZigString.static("state"), jsc.JSValue.jsNumber(@intFromEnum(stream.state))); - state.put(globalObject, jsc.ZigString.static("localClose"), jsc.JSValue.jsNumber(@as(i32, if (stream.canSendData()) 0 else 1))); - state.put(globalObject, jsc.ZigString.static("remoteClose"), jsc.JSValue.jsNumber(@as(i32, if (stream.canReceiveData()) 0 else 1))); + state.put(globalObject, jsc.RustString.static("localWindowSize"), jsc.JSValue.jsNumber(stream.windowSize)); + state.put(globalObject, jsc.RustString.static("state"), jsc.JSValue.jsNumber(@intFromEnum(stream.state))); + state.put(globalObject, jsc.RustString.static("localClose"), jsc.JSValue.jsNumber(@as(i32, if (stream.canSendData()) 0 else 1))); + state.put(globalObject, jsc.RustString.static("remoteClose"), jsc.JSValue.jsNumber(@as(i32, if (stream.canReceiveData()) 0 else 1))); // TODO: sumDependencyWeight - state.put(globalObject, jsc.ZigString.static("sumDependencyWeight"), jsc.JSValue.jsNumber(0)); - state.put(globalObject, jsc.ZigString.static("weight"), jsc.JSValue.jsNumber(stream.weight)); + state.put(globalObject, jsc.RustString.static("sumDependencyWeight"), jsc.JSValue.jsNumber(0)); + state.put(globalObject, jsc.RustString.static("weight"), jsc.JSValue.jsNumber(stream.weight)); return state; } @@ -4858,7 +4858,7 @@ pub const H2FrameParser = struct { extern fn Bun__wrapAbortError(globalObject: *jsc.JSGlobalObject, cause: jsc.JSValue) jsc.JSValue; -const lshpack = @import("../../../http/lshpack.zig"); +const lshpack = @import("../../../http/lshpack.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/runtime/api/bun/js_bun_spawn_bindings.zig b/src/runtime/api/bun/js_bun_spawn_bindings.zig index 269abdf3a71..c241927d96d 100644 --- a/src/runtime/api/bun/js_bun_spawn_bindings.zig +++ b/src/runtime/api/bun/js_bun_spawn_bindings.zig @@ -80,7 +80,7 @@ fn getArgv(globalThis: *jsc.JSGlobalObject, args: JSValue, PATH: []const u8, cwd // Check for null bytes in argument (security: prevent null byte injection) if (arg.indexOfAsciiChar(0) != null) { - return globalThis.ERR(.INVALID_ARG_VALUE, "The argument 'args[{d}]' must be a string without null bytes. Received \"{f}\"", .{ arg_index, arg.toZigString() }).throw(); + return globalThis.ERR(.INVALID_ARG_VALUE, "The argument 'args[{d}]' must be a string without null bytes. Received \"{f}\"", .{ arg_index, arg.toRustString() }).throw(); } try argv.append(try arg.toOwnedSliceZ(allocator)); @@ -197,7 +197,7 @@ pub fn spawnMaybeSync( if (args.isObject()) { if (try args.getTruthy(globalThis, "argv0")) |argv0_| { - const argv0_str = try argv0_.getZigString(globalThis); + const argv0_str = try argv0_.getRustString(globalThis); if (argv0_str.len > 0) { argv0 = try argv0_str.toOwnedSliceZ(allocator); } @@ -205,7 +205,7 @@ pub fn spawnMaybeSync( // need to update `cwd` before searching for executable with `Which.which` if (try args.getTruthy(globalThis, "cwd")) |cwd_| { - const cwd_str = try cwd_.getZigString(globalThis); + const cwd_str = try cwd_.getRustString(globalThis); if (cwd_str.len > 0) { cwd = try cwd_str.toOwnedSliceZ(allocator); } @@ -1114,17 +1114,17 @@ pub fn spawnMaybeSync( subprocess.finalize(); const sync_value = jsc.JSValue.createEmptyObject(globalThis, 0); - sync_value.put(globalThis, jsc.ZigString.static("exitCode"), exitCode); + sync_value.put(globalThis, jsc.RustString.static("exitCode"), exitCode); if (!signalCode.isEmptyOrUndefinedOrNull()) { - sync_value.put(globalThis, jsc.ZigString.static("signalCode"), signalCode); + sync_value.put(globalThis, jsc.RustString.static("signalCode"), signalCode); } - sync_value.put(globalThis, jsc.ZigString.static("stdout"), stdout); - sync_value.put(globalThis, jsc.ZigString.static("stderr"), stderr); - sync_value.put(globalThis, jsc.ZigString.static("success"), JSValue.jsBoolean(exitCode.isInt32() and exitCode.asInt32() == 0)); - sync_value.put(globalThis, jsc.ZigString.static("resourceUsage"), resource_usage); - if (timeout != null) sync_value.put(globalThis, jsc.ZigString.static("exitedDueToTimeout"), if (exitedDueToTimeout) .true else .false); - if (maxBuffer != null) sync_value.put(globalThis, jsc.ZigString.static("exitedDueToMaxBuffer"), if (exitedDueToMaxBuffer != null) .true else .false); - sync_value.put(globalThis, jsc.ZigString.static("pid"), resultPid); + sync_value.put(globalThis, jsc.RustString.static("stdout"), stdout); + sync_value.put(globalThis, jsc.RustString.static("stderr"), stderr); + sync_value.put(globalThis, jsc.RustString.static("success"), JSValue.jsBoolean(exitCode.isInt32() and exitCode.asInt32() == 0)); + sync_value.put(globalThis, jsc.RustString.static("resourceUsage"), resource_usage); + if (timeout != null) sync_value.put(globalThis, jsc.RustString.static("exitedDueToTimeout"), if (exitedDueToTimeout) .true else .false); + if (maxBuffer != null) sync_value.put(globalThis, jsc.RustString.static("exitedDueToMaxBuffer"), if (exitedDueToMaxBuffer != null) .true else .false); + sync_value.put(globalThis, jsc.RustString.static("pid"), resultPid); return sync_value; } @@ -1156,13 +1156,13 @@ pub fn appendEnvpFromJS(globalThis: *jsc.JSGlobalObject, object: *jsc.JSObject, // Check for null bytes in env key and value (security: prevent null byte injection) if (key.indexOfAsciiChar(0) != null) { - return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toZigString(), key.toZigString() }).throw(); + return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toRustString(), key.toRustString() }).throw(); } if (value_bunstr.indexOfAsciiChar(0) != null) { - return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toZigString(), value_bunstr.toZigString() }).throw(); + return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toRustString(), value_bunstr.toRustString() }).throw(); } - const line = try std.fmt.allocPrintSentinel(envp.allocator, "{f}={f}", .{ key, value_bunstr.toZigString() }, 0); + const line = try std.fmt.allocPrintSentinel(envp.allocator, "{f}={f}", .{ key, value_bunstr.toRustString() }, 0); if (key.eqlComptime("PATH")) { PATH.* = bun.asByteSlice(line["PATH=".len..]); @@ -1175,8 +1175,8 @@ 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("../../../jsc/ipc.zig"); -const Terminal = @import("./Terminal.zig"); +const IPC = @import("../../../jsc/ipc.rust"); +const Terminal = @import("./Terminal.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/runtime/api/bun/process.zig b/src/runtime/api/bun/process.zig index 13eef7d3659..ca2c7b058e8 100644 --- a/src/runtime/api/bun/process.zig +++ b/src/runtime/api/bun/process.zig @@ -2340,7 +2340,7 @@ pub const sync = struct { // Snapshot pre-existing direct children so the disarm defer can tell // subreaper-adopted orphans (ppid==us) apart from `Bun.spawn` siblings // (also ppid==us). Typically empty — `bun run`/`bunx` have no JS VM — - // but spawnSync can run inside a live VM (ffi.zig xcrun probe). + // but spawnSync can run inside a live VM (ffi.rust xcrun probe). var siblings_buf: [64]std.c.pid_t = undefined; const siblings = if (Environment.isLinux and no_orphans) bun.ParentDeathWatchdog.snapshotChildren(&siblings_buf) @@ -2427,7 +2427,7 @@ pub const sync = struct { jc.restore(); // pgroup → tracked uniqueids (macOS). Do NOT call the // getpid()-rooted `killDescendants()` here — `spawnSync` can be - // reached from inside a live VM (ffi.zig xcrun probe, etc.) and + // reached from inside a live VM (ffi.rust xcrun probe, etc.) and // that would SIGKILL the user's unrelated `Bun.spawn` children. // The full-tree walk runs from `onProcessExit` when the whole // process is actually exiting. @@ -2928,12 +2928,12 @@ pub const sync = struct { }; const std = @import("std"); -const MultiRunProcessHandle = @import("../../cli/multi_run.zig").ProcessHandle; -const ProcessHandle = @import("../../cli/filter_run.zig").ProcessHandle; -const TestWorkerHandle = @import("../../cli/test/ParallelRunner.zig").Worker; +const MultiRunProcessHandle = @import("../../cli/multi_run.rust").ProcessHandle; +const ProcessHandle = @import("../../cli/filter_run.rust").ProcessHandle; +const TestWorkerHandle = @import("../../cli/test/ParallelRunner.rust").Worker; -const CronRegisterJob = @import("../cron.zig").CronRegisterJob; -const CronRemoveJob = @import("../cron.zig").CronRemoveJob; +const CronRegisterJob = @import("../cron.rust").CronRegisterJob; +const CronRemoveJob = @import("../cron.rust").CronRemoveJob; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/api/bun/spawn.zig b/src/runtime/api/bun/spawn.zig index 3fc77323d8b..9e53604be49 100644 --- a/src/runtime/api/bun/spawn.zig +++ b/src/runtime/api/bun/spawn.zig @@ -111,7 +111,7 @@ pub const BunSpawn = struct { pub fn set(self: *Attr, flags: u16) !void { self.flags = flags; // FreeBSD's has no POSIX_SPAWN_SETSID; bun-spawn.cpp - // calls setsid() in the child for `detached`, which process.zig + // calls setsid() in the child for `detached`, which process.rust // sets directly on this struct BEFORE calling set(). Preserve // that value when the flag bit isn't available. if (comptime @hasDecl(bun.c, "POSIX_SPAWN_SETSID")) { @@ -125,7 +125,7 @@ pub const BunSpawn = struct { }; }; -// mostly taken from zig's posix_spawn.zig +// mostly taken from rust's posix_spawn.rust pub const PosixSpawn = struct { pub const WaitPidResult = struct { pid: pid_t, @@ -536,7 +536,7 @@ pub const PosixSpawn = struct { } } - pub const process = @import("./process.zig"); + pub const process = @import("./process.rust"); pub const Process = process.Process; pub const SpawnOptions = process.SpawnOptions; pub const Status = process.Status; @@ -548,7 +548,7 @@ pub const PosixSpawn = struct { pub const WindowsSpawnOptions = process.WindowsSpawnOptions; pub const Rusage = process.Rusage; - pub const Stdio = @import("./spawn/stdio.zig").Stdio; + pub const Stdio = @import("./spawn/stdio.rust").Stdio; }; const std = @import("std"); diff --git a/src/runtime/api/bun/spawn/stdio.zig b/src/runtime/api/bun/spawn/stdio.zig index 4463b1738f6..4e99713cfd0 100644 --- a/src/runtime/api/bun/spawn/stdio.zig +++ b/src/runtime/api/bun/spawn/stdio.zig @@ -338,7 +338,7 @@ pub const Stdio = union(enum) { } if (value.isString()) { - const str = try value.getZigString(globalThis); + const str = try value.getRustString(globalThis); if (str.eqlComptime("inherit")) { out_stdio.* = Stdio{ .inherit = {} }; } else if (str.eqlComptime("ignore")) { diff --git a/src/runtime/api/bun/subprocess.zig b/src/runtime/api/bun/subprocess.zig index 4170f72ce32..f5e5da4174c 100644 --- a/src/runtime/api/bun/subprocess.zig +++ b/src/runtime/api/bun/subprocess.zig @@ -86,7 +86,7 @@ pub inline fn assertStdioResult(result: StdioResult) void { } } -pub const ResourceUsage = @import("./subprocess/ResourceUsage.zig"); +pub const ResourceUsage = @import("./subprocess/ResourceUsage.rust"); const log = Output.scoped(.Subprocess, .visible); pub const StdioKind = enum { @@ -285,8 +285,8 @@ pub fn constructor(globalObject: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSE return globalObject.throw("Cannot construct Subprocess", .{}); } -pub const PipeReader = @import("./subprocess/SubprocessPipeReader.zig"); -pub const Readable = @import("./subprocess/Readable.zig").Readable; +pub const PipeReader = @import("./subprocess/SubprocessPipeReader.rust"); +pub const Readable = @import("./subprocess/Readable.rust").Readable; pub fn getStderr(this: *Subprocess, globalThis: *JSGlobalObject) bun.JSError!JSValue { // When terminal is used, stderr goes through the terminal @@ -544,7 +544,7 @@ pub const Source = union(enum) { } }; -pub const NewStaticPipeWriter = @import("./subprocess/StaticPipeWriter.zig").NewStaticPipeWriter; +pub const NewStaticPipeWriter = @import("./subprocess/StaticPipeWriter.rust").NewStaticPipeWriter; pub const StaticPipeWriter = NewStaticPipeWriter(Subprocess); pub fn memoryCost(this: *const Subprocess) usize { @@ -881,7 +881,7 @@ pub fn getSignalCode( ) JSValue { if (this.process.signalCode()) |signal| { if (signal.name()) |name| - return jsc.ZigString.init(name).toJS(global) + return jsc.RustString.init(name).toJS(global) else return jsc.JSValue.jsNumber(@intFromEnum(signal)); } @@ -991,16 +991,16 @@ pub const TestingAPIs = struct { }; pub const StdioResult = if (Environment.isWindows) bun.spawn.WindowsSpawnResult.StdioResult else ?bun.FD; -pub const Writable = @import("./subprocess/Writable.zig").Writable; +pub const Writable = @import("./subprocess/Writable.rust").Writable; 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("../../../jsc/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"); +const IPC = @import("../../../jsc/ipc.rust"); +const Terminal = @import("./Terminal.rust"); +const js_bun_spawn_bindings = @import("./js_bun_spawn_bindings.rust"); +const node_cluster_binding = @import("../../node/node_cluster_binding.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/api/bun/subprocess/ResourceUsage.zig b/src/runtime/api/bun/subprocess/ResourceUsage.zig index e8283448e77..e8e0a2b5aa5 100644 --- a/src/runtime/api/bun/subprocess/ResourceUsage.zig +++ b/src/runtime/api/bun/subprocess/ResourceUsage.zig @@ -18,9 +18,9 @@ pub fn getCPUTime(this: *ResourceUsage, globalObject: *JSGlobalObject) bun.JSErr const usrTime = try JSValue.fromTimevalNoTruncate(globalObject, rusage.utime.usec, rusage.utime.sec); const sysTime = try JSValue.fromTimevalNoTruncate(globalObject, rusage.stime.usec, rusage.stime.sec); - cpu.put(globalObject, jsc.ZigString.static("user"), usrTime); - cpu.put(globalObject, jsc.ZigString.static("system"), sysTime); - cpu.put(globalObject, jsc.ZigString.static("total"), JSValue.bigIntSum(globalObject, usrTime, sysTime)); + cpu.put(globalObject, jsc.RustString.static("user"), usrTime); + cpu.put(globalObject, jsc.RustString.static("system"), sysTime); + cpu.put(globalObject, jsc.RustString.static("total"), JSValue.bigIntSum(globalObject, usrTime, sysTime)); return cpu; } @@ -39,15 +39,15 @@ pub fn getSwapCount(this: *ResourceUsage, _: *JSGlobalObject) JSValue { pub fn getOps(this: *ResourceUsage, globalObject: *JSGlobalObject) JSValue { var ops = jsc.JSValue.createEmptyObjectWithNullPrototype(globalObject); - ops.put(globalObject, jsc.ZigString.static("in"), jsc.JSValue.jsNumber(this.rusage.inblock)); - ops.put(globalObject, jsc.ZigString.static("out"), jsc.JSValue.jsNumber(this.rusage.oublock)); + ops.put(globalObject, jsc.RustString.static("in"), jsc.JSValue.jsNumber(this.rusage.inblock)); + ops.put(globalObject, jsc.RustString.static("out"), jsc.JSValue.jsNumber(this.rusage.oublock)); return ops; } pub fn getMessages(this: *ResourceUsage, globalObject: *JSGlobalObject) JSValue { var msgs = jsc.JSValue.createEmptyObjectWithNullPrototype(globalObject); - msgs.put(globalObject, jsc.ZigString.static("sent"), jsc.JSValue.jsNumber(this.rusage.msgsnd)); - msgs.put(globalObject, jsc.ZigString.static("received"), jsc.JSValue.jsNumber(this.rusage.msgrcv)); + msgs.put(globalObject, jsc.RustString.static("sent"), jsc.JSValue.jsNumber(this.rusage.msgsnd)); + msgs.put(globalObject, jsc.RustString.static("received"), jsc.JSValue.jsNumber(this.rusage.msgrcv)); return msgs; } @@ -57,8 +57,8 @@ pub fn getSignalCount(this: *ResourceUsage, _: *JSGlobalObject) JSValue { pub fn getContextSwitches(this: *ResourceUsage, globalObject: *JSGlobalObject) JSValue { var ctx = jsc.JSValue.createEmptyObjectWithNullPrototype(globalObject); - ctx.put(globalObject, jsc.ZigString.static("voluntary"), jsc.JSValue.jsNumber(this.rusage.nvcsw)); - ctx.put(globalObject, jsc.ZigString.static("involuntary"), jsc.JSValue.jsNumber(this.rusage.nivcsw)); + ctx.put(globalObject, jsc.RustString.static("voluntary"), jsc.JSValue.jsNumber(this.rusage.nvcsw)); + ctx.put(globalObject, jsc.RustString.static("involuntary"), jsc.JSValue.jsNumber(this.rusage.nivcsw)); return ctx; } diff --git a/src/runtime/api/bun/subprocess/StaticPipeWriter.zig b/src/runtime/api/bun/subprocess/StaticPipeWriter.zig index 3815646700c..42fa531c0da 100644 --- a/src/runtime/api/bun/subprocess/StaticPipeWriter.zig +++ b/src/runtime/api/bun/subprocess/StaticPipeWriter.zig @@ -10,7 +10,7 @@ pub fn NewStaticPipeWriter(comptime ProcessType: type) type { event_loop: jsc.EventLoopHandle, buffer: []const u8 = "", - // It seems there is a bug in the Zig compiler. We'll get back to this one later + // It seems there is a bug in the Rust compiler. We'll get back to this one later const WriterRefCount = bun.ptr.RefCount(@This(), "ref_count", _deinit, .{}); pub const ref = WriterRefCount.ref; pub const deref = WriterRefCount.deref; diff --git a/src/runtime/api/crash_handler_jsc.zig b/src/runtime/api/crash_handler_jsc.zig index 45d47ddb57b..6638a4548c0 100644 --- a/src/runtime/api/crash_handler_jsc.zig +++ b/src/runtime/api/crash_handler_jsc.zig @@ -17,7 +17,7 @@ pub const js_bindings = struct { .{ "outOfMemory", jsOutOfMemory }, .{ "raiseIgnoringPanicHandler", jsRaiseIgnoringPanicHandler }, }) |tuple| { - const name = jsc.ZigString.static(tuple[0]); + const name = jsc.RustString.static(tuple[0]); obj.put(global, name, jsc.JSFunction.create(global, tuple[0], tuple[1], 1, .{})); } return obj; @@ -79,15 +79,15 @@ pub const js_bindings = struct { for (list, 0..) |feature, i| { try array.putIndex(global, @intCast(i), try bun.String.static(feature).toJS(global)); } - obj.put(global, jsc.ZigString.static("features"), array); - obj.put(global, jsc.ZigString.static("version"), try bun.String.init(Global.package_json_version).toJS(global)); - obj.put(global, jsc.ZigString.static("is_canary"), jsc.JSValue.jsBoolean(bun.Environment.is_canary)); + obj.put(global, jsc.RustString.static("features"), array); + obj.put(global, jsc.RustString.static("version"), try bun.String.init(Global.package_json_version).toJS(global)); + obj.put(global, jsc.RustString.static("is_canary"), jsc.JSValue.jsBoolean(bun.Environment.is_canary)); // This is the source of truth for the git sha. // Not the github ref or the git tag. - obj.put(global, jsc.ZigString.static("revision"), try bun.String.init(bun.Environment.git_sha).toJS(global)); + obj.put(global, jsc.RustString.static("revision"), try bun.String.init(bun.Environment.git_sha).toJS(global)); - obj.put(global, jsc.ZigString.static("generated_at"), JSValue.jsNumberFromInt64(@max(std.time.milliTimestamp(), 0))); + obj.put(global, jsc.RustString.static("generated_at"), JSValue.jsNumberFromInt64(@max(std.time.milliTimestamp(), 0))); return obj; } }; diff --git a/src/runtime/api/cron.zig b/src/runtime/api/cron.zig index 9d12b67f6be..d92b0081ca9 100644 --- a/src/runtime/api/cron.zig +++ b/src/runtime/api/cron.zig @@ -1762,7 +1762,7 @@ fn makeTempPath(comptime prefix: []const u8) ![:0]const u8 { const std = @import("std"); -const cron_parser = @import("./cron_parser.zig"); +const cron_parser = @import("./cron_parser.rust"); const CronExpression = cron_parser.CronExpression; const bun = @import("bun"); diff --git a/src/runtime/api/csrf_jsc.zig b/src/runtime/api/csrf_jsc.zig index e6fe22a7daf..69b36a64b9e 100644 --- a/src/runtime/api/csrf_jsc.zig +++ b/src/runtime/api/csrf_jsc.zig @@ -9,7 +9,7 @@ pub fn csrf__generate(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFra // We should have at least one argument (secret) const args = callframe.arguments(); - var secret: ?jsc.ZigString.Slice = null; + var secret: ?jsc.RustString.Slice = null; if (args.len >= 1) { const jsSecret = args[0]; // Extract the secret (required) @@ -107,7 +107,7 @@ pub fn csrf__verify(globalObject: *jsc.JSGlobalObject, call_frame: *jsc.CallFram defer token.deinit(); // Default values - var secret: ?jsc.ZigString.Slice = null; + var secret: ?jsc.RustString.Slice = null; defer if (secret) |s| s.deinit(); var max_age: u64 = csrf.DEFAULT_EXPIRATION_MS; var encoding: csrf.TokenFormat = .base64url; @@ -119,7 +119,7 @@ pub fn csrf__verify(globalObject: *jsc.JSGlobalObject, call_frame: *jsc.CallFram const options_value = args[1]; // Extract the secret (required) - if (try options_value.getOptional(globalObject, "secret", jsc.ZigString.Slice)) |secretSlice| { + if (try options_value.getOptional(globalObject, "secret", jsc.RustString.Slice)) |secretSlice| { if (secretSlice.len == 0) { return globalObject.throwInvalidArguments("Secret must be a non-empty string", .{}); } @@ -168,7 +168,7 @@ pub fn csrf__verify(globalObject: *jsc.JSGlobalObject, call_frame: *jsc.CallFram return jsc.JSValue.jsBoolean(is_valid); } -const csrf = @import("../../csrf/csrf.zig"); +const csrf = @import("../../csrf/csrf.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/api/filesystem_router.zig b/src/runtime/api/filesystem_router.zig index 814927a97ce..59037423d75 100644 --- a/src/runtime/api/filesystem_router.zig +++ b/src/runtime/api/filesystem_router.zig @@ -32,14 +32,14 @@ pub const FileSystemRouter = struct { } var vm = globalThis.bunVM(); - var root_dir_path: ZigString.Slice = ZigString.Slice.fromUTF8NeverFree(vm.transpiler.fs.top_level_dir); + var root_dir_path: RustString.Slice = RustString.Slice.fromUTF8NeverFree(vm.transpiler.fs.top_level_dir); defer root_dir_path.deinit(); - var origin_str: ZigString.Slice = .{}; - var asset_prefix_slice: ZigString.Slice = .{}; + var origin_str: RustString.Slice = .{}; + var asset_prefix_slice: RustString.Slice = .{}; var out_buf: [bun.MAX_PATH_BYTES * 2]u8 = undefined; if (try argument.get(globalThis, "style")) |style_val| { - if (!(try style_val.getZigString(globalThis)).eqlComptime("nextjs")) { + if (!(try style_val.getRustString(globalThis)).eqlComptime("nextjs")) { return globalThis.throwInvalidArguments("Only 'nextjs' style is currently implemented", .{}); } } else { @@ -58,7 +58,7 @@ pub const FileSystemRouter = struct { root_dir_path = root_dir_path_; } else { var parts = [_][]const u8{path}; - root_dir_path = jsc.ZigString.Slice.fromUTF8NeverFree(bun.path.joinAbsStringBuf(Fs.FileSystem.instance.top_level_dir, &out_buf, &parts, .auto)); + root_dir_path = jsc.RustString.Slice.fromUTF8NeverFree(bun.path.joinAbsStringBuf(Fs.FileSystem.instance.top_level_dir, &out_buf, &parts, .auto)); } } } else { @@ -292,7 +292,7 @@ pub const FileSystemRouter = struct { return globalThis.throwInvalidArguments("Expected string, Request or Response", .{}); } - var path: ZigString.Slice = brk: { + var path: RustString.Slice = brk: { if (argument.isString()) { break :brk try (try argument.toSlice(globalThis, globalThis.allocator())).cloneIfBorrowed(globalThis.allocator()); } @@ -313,7 +313,7 @@ pub const FileSystemRouter = struct { if (path.len == 0 or (path.len == 1 and path.ptr[0] == '/')) { path.deinit(); - path = ZigString.Slice.fromUTF8NeverFree("/"); + path = RustString.Slice.fromUTF8NeverFree("/"); } if (strings.hasPrefixComptime(path.slice(), "http://") or strings.hasPrefixComptime(path.slice(), "https://") or strings.hasPrefixComptime(path.slice(), "file://")) { @@ -355,7 +355,7 @@ pub const FileSystemRouter = struct { pub fn getOrigin(this: *FileSystemRouter, globalThis: *jsc.JSGlobalObject) JSValue { if (this.origin) |origin| { - return jsc.ZigString.init(origin.slice()).withEncoding().toJS(globalThis); + return jsc.RustString.init(origin.slice()).withEncoding().toJS(globalThis); } return JSValue.jsNull(); @@ -364,12 +364,12 @@ pub const FileSystemRouter = struct { pub fn getRoutes(this: *FileSystemRouter, globalThis: *jsc.JSGlobalObject) bun.JSError!JSValue { const paths = this.router.getEntryPoints(); const names = this.router.getNames(); - var name_strings = try bun.default_allocator.alloc(ZigString, names.len * 2); + var name_strings = try bun.default_allocator.alloc(RustString, names.len * 2); defer bun.default_allocator.free(name_strings); var paths_strings = name_strings[names.len..]; for (names, 0..) |name, i| { - name_strings[i] = ZigString.init(name).withEncoding(); - paths_strings[i] = ZigString.init(paths[i]).withEncoding(); + name_strings[i] = RustString.init(name).withEncoding(); + paths_strings[i] = RustString.init(paths[i]).withEncoding(); } return jsc.JSValue.fromEntries( globalThis, @@ -386,7 +386,7 @@ pub const FileSystemRouter = struct { pub fn getAssetPrefix(this: *FileSystemRouter, globalThis: *jsc.JSGlobalObject) JSValue { if (this.asset_prefix) |asset_prefix| { - return jsc.ZigString.init(asset_prefix.slice()).withEncoding().toJS(globalThis); + return jsc.RustString.init(asset_prefix.slice()).withEncoding().toJS(globalThis); } return JSValue.jsNull(); @@ -429,7 +429,7 @@ pub const MatchedRoute = struct { pub const fromJSDirect = js.fromJSDirect; pub fn getName(this: *MatchedRoute, globalThis: *jsc.JSGlobalObject) JSValue { - return ZigString.init(this.route.name).withEncoding().toJS(globalThis); + return RustString.init(this.route.name).withEncoding().toJS(globalThis); } pub fn init( @@ -499,7 +499,7 @@ pub const MatchedRoute = struct { this: *MatchedRoute, globalThis: *jsc.JSGlobalObject, ) JSValue { - return ZigString.init(this.route.file_path) + return RustString.init(this.route.file_path) .withEncoding() .toJS(globalThis); } @@ -511,13 +511,13 @@ pub const MatchedRoute = struct { } pub fn getPathname(this: *MatchedRoute, globalThis: *jsc.JSGlobalObject) JSValue { - return ZigString.init(this.route.pathname) + return RustString.init(this.route.pathname) .withEncoding() .toJS(globalThis); } pub fn getRoute(this: *MatchedRoute, globalThis: *jsc.JSGlobalObject) JSValue { - return ZigString.init(this.route.name) + return RustString.init(this.route.name) .withEncoding() .toJS(globalThis); } @@ -529,15 +529,15 @@ pub const MatchedRoute = struct { pub const dynamic = "dynamic"; // this is kinda stupid it should maybe just store it - pub fn init(name: string) ZigString { + pub fn init(name: string) RustString { if (strings.contains(name, "[[...")) { - return ZigString.init(optional_catch_all); + return RustString.init(optional_catch_all); } else if (strings.contains(name, "[...")) { - return ZigString.init(catch_all); + return RustString.init(catch_all); } else if (strings.contains(name, "[")) { - return ZigString.init(dynamic); + return RustString.init(dynamic); } else { - return ZigString.init(exact); + return RustString.init(exact); } } }; @@ -547,7 +547,7 @@ pub const MatchedRoute = struct { } threadlocal var query_string_values_buf: [256]string = undefined; - threadlocal var query_string_value_refs_buf: [256]ZigString = undefined; + threadlocal var query_string_value_refs_buf: [256]RustString = undefined; pub fn createQueryObject(ctx: *jsc.JSGlobalObject, map: *QueryStringMap) JSValue { const QueryObjectCreator = struct { query: *QueryStringMap, @@ -555,17 +555,17 @@ pub const MatchedRoute = struct { var iter = this.query.iter(); while (iter.next(&query_string_values_buf)) |entry| { const entry_name = entry.name; - var str = ZigString.init(entry_name).withEncoding(); + var str = RustString.init(entry_name).withEncoding(); bun.assert(entry.values.len > 0); if (entry.values.len > 1) { var values = query_string_value_refs_buf[0..entry.values.len]; for (entry.values, 0..) |value, i| { - values[i] = ZigString.init(value).withEncoding(); + values[i] = RustString.init(value).withEncoding(); } try obj.putRecord(global, &str, values); } else { - query_string_value_refs_buf[0] = ZigString.init(entry.values[0]).withEncoding(); + query_string_value_refs_buf[0] = RustString.init(entry.values[0]).withEncoding(); try obj.putRecord(global, &str, query_string_value_refs_buf[0..1]); } } @@ -621,7 +621,7 @@ pub const MatchedRoute = struct { &writer, .posix, ); - return ZigString.init(buf[0..writer.context.pos]) + return RustString.init(buf[0..writer.context.pos]) .withEncoding() .toJS(globalThis); } @@ -683,15 +683,15 @@ pub const MatchedRoute = struct { const string = []const u8; -const Fs = @import("../../resolver/fs.zig"); -const Router = @import("../../router/router.zig"); -const URLPath = @import("../../http_types/URLPath.zig"); +const Fs = @import("../../resolver/fs.rust"); +const Router = @import("../../router/router.rust"); +const URLPath = @import("../../http_types/URLPath.rust"); const std = @import("std"); -const Resolver = @import("../../resolver/resolver.zig").Resolver; +const Resolver = @import("../../resolver/resolver.rust").Resolver; -const CombinedScanner = @import("../../url/url.zig").CombinedScanner; -const QueryStringMap = @import("../../url/url.zig").QueryStringMap; -const URL = @import("../../url/url.zig").URL; +const CombinedScanner = @import("../../url/url.rust").CombinedScanner; +const QueryStringMap = @import("../../url/url.rust").QueryStringMap; +const URL = @import("../../url/url.rust").URL; const bun = @import("bun"); const Environment = bun.Environment; @@ -703,7 +703,7 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSObject = jsc.JSObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const WebCore = jsc.WebCore; const Request = WebCore.Request; diff --git a/src/runtime/api/glob.zig b/src/runtime/api/glob.zig index b98fe75db80..325ab0102a8 100644 --- a/src/runtime/api/glob.zig +++ b/src/runtime/api/glob.zig @@ -137,7 +137,7 @@ pub const WalkTask = struct { pub fn toJS(this: Err, globalThis: *JSGlobalObject) bun.JSError!JSValue { return switch (this) { .syscall => |err| try err.toJS(globalThis), - .unknown => |err| ZigString.fromBytes(@errorName(err)).toJS(globalThis), + .unknown => |err| RustString.fromBytes(@errorName(err)).toJS(globalThis), }; } }; @@ -380,8 +380,8 @@ pub fn match(this: *Glob, globalThis: *JSGlobalObject, callframe: *jsc.CallFrame const string = []const u8; -const ResolvePath = @import("../../paths/resolve_path.zig"); -const Syscall = @import("../../sys/sys.zig"); +const ResolvePath = @import("../../paths/resolve_path.rust"); +const Syscall = @import("../../sys/sys.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; const Arena = std.heap.ArenaAllocator; @@ -393,5 +393,5 @@ const GlobWalker = bun.glob.BunGlobWalker; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const ArgumentsSlice = jsc.CallFrame.ArgumentsSlice; diff --git a/src/runtime/api/html_rewriter.zig b/src/runtime/api/html_rewriter.zig index d75c7b6e738..c00744506b9 100644 --- a/src/runtime/api/html_rewriter.zig +++ b/src/runtime/api/html_rewriter.zig @@ -57,7 +57,7 @@ pub const HTMLRewriter = struct { pub fn on_( this: *HTMLRewriter, global: *JSGlobalObject, - selector_name: ZigString, + selector_name: RustString, callFrame: *jsc.CallFrame, listener: JSValue, ) bun.JSError!JSValue { @@ -889,7 +889,7 @@ const DocumentHandler = struct { fn HandlerCallback( comptime HandlerType: type, - comptime ZigType: type, + comptime RustType: type, comptime LOLHTMLType: type, comptime field_name: string, comptime callback_name: string, @@ -898,7 +898,7 @@ fn HandlerCallback( pub fn callback(this: *HandlerType, value: *LOLHTMLType) bool { jsc.markBinding(@src()); - var wrapper = ZigType.init(value); + var wrapper = RustType.init(value); wrapper.ref(); // When using RefCount, we don't check the count value directly @@ -906,7 +906,7 @@ fn HandlerCallback( // The init values are handled by bun.new with .init() defer { - if (comptime @hasDecl(ZigType, "invalidate")) { + if (comptime @hasDecl(RustType, "invalidate")) { // Some wrapper types (Element) hand out sub-objects that // borrow from the underlying lol-html value and must be // detached along with the wrapper itself. @@ -1103,7 +1103,7 @@ fn createLOLHTMLError(global: *JSGlobalObject) JSValue { var err = createLOLHTMLStringError(); const value = err.toErrorInstance(global); - value.put(global, "name", ZigString.init("HTMLRewriterError").toJS(global)); + value.put(global, "name", RustString.init("HTMLRewriterError").toJS(global)); return value; } fn createLOLHTMLStringError() bun.String { @@ -1137,7 +1137,7 @@ pub const TextChunk = struct { }); } - fn contentHandler(this: *TextChunk, comptime Callback: (fn (*LOLHTML.TextChunk, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *TextChunk, comptime Callback: (fn (*LOLHTML.TextChunk, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { const text_chunk = this.text_chunk orelse return .js_undefined; var content_slice = content.toSlice(bun.default_allocator); defer content_slice.deinit(); @@ -1155,7 +1155,7 @@ pub const TextChunk = struct { this: *TextChunk, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.TextChunk.before, callFrame.this(), globalObject, content, contentOptions); @@ -1165,7 +1165,7 @@ pub const TextChunk = struct { this: *TextChunk, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.TextChunk.after, callFrame.this(), globalObject, content, contentOptions); @@ -1175,7 +1175,7 @@ pub const TextChunk = struct { this: *TextChunk, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.TextChunk.replace, callFrame.this(), globalObject, content, contentOptions); @@ -1262,7 +1262,7 @@ pub const DocType = struct { const str = this.doctype.?.getName().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toJS(globalObject); + return RustString.init(str).toJS(globalObject); } pub fn systemId( @@ -1275,7 +1275,7 @@ pub const DocType = struct { const str = this.doctype.?.getSystemId().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toJS(globalObject); + return RustString.init(str).toJS(globalObject); } pub fn publicId( @@ -1288,7 +1288,7 @@ pub const DocType = struct { const str = this.doctype.?.getPublicId().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toJS(globalObject); + return RustString.init(str).toJS(globalObject); } pub fn remove( @@ -1332,7 +1332,7 @@ pub const DocEnd = struct { }); } - fn contentHandler(this: *DocEnd, comptime Callback: (fn (*LOLHTML.DocEnd, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *DocEnd, comptime Callback: (fn (*LOLHTML.DocEnd, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { if (this.doc_end == null) return JSValue.jsNull(); @@ -1352,7 +1352,7 @@ pub const DocEnd = struct { this: *DocEnd, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.DocEnd.append, callFrame.this(), globalObject, content, contentOptions); @@ -1390,7 +1390,7 @@ pub const Comment = struct { }); } - fn contentHandler(this: *Comment, comptime Callback: (fn (*LOLHTML.Comment, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *Comment, comptime Callback: (fn (*LOLHTML.Comment, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { if (this.comment == null) return JSValue.jsNull(); var content_slice = content.toSlice(bun.default_allocator); @@ -1409,7 +1409,7 @@ pub const Comment = struct { this: *Comment, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.Comment.before, callFrame.this(), globalObject, content, contentOptions); @@ -1419,7 +1419,7 @@ pub const Comment = struct { this: *Comment, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.Comment.after, callFrame.this(), globalObject, content, contentOptions); @@ -1429,7 +1429,7 @@ pub const Comment = struct { this: *Comment, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.Comment.replace, callFrame.this(), globalObject, content, contentOptions); @@ -1536,7 +1536,7 @@ pub const EndTag = struct { pub const fromJS = js.fromJS; pub const fromJSDirect = js.fromJSDirect; - fn contentHandler(this: *EndTag, comptime Callback: (fn (*LOLHTML.EndTag, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *EndTag, comptime Callback: (fn (*LOLHTML.EndTag, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { if (this.end_tag == null) return JSValue.jsNull(); @@ -1556,7 +1556,7 @@ pub const EndTag = struct { this: *EndTag, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.EndTag.before, callFrame.this(), globalObject, content, contentOptions); @@ -1566,7 +1566,7 @@ pub const EndTag = struct { this: *EndTag, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.EndTag.after, callFrame.this(), globalObject, content, contentOptions); @@ -1576,7 +1576,7 @@ pub const EndTag = struct { this: *EndTag, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, - content: ZigString, + content: RustString, contentOptions: ?ContentOptions, ) JSValue { return this.contentHandler(LOLHTML.EndTag.replace, callFrame.this(), globalObject, content, contentOptions); @@ -1661,8 +1661,8 @@ pub const AttributeIterator = struct { pub const fromJSDirect = js.fromJSDirect; pub fn next(this: *AttributeIterator, globalObject: *JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue { - const done_label = jsc.ZigString.static("done"); - const value_label = jsc.ZigString.static("value"); + const done_label = jsc.RustString.static("done"); + const value_label = jsc.RustString.static("value"); if (this.iterator == null) { return JSValue.createObject2(globalObject, done_label, value_label, .true, .js_undefined); @@ -1756,7 +1756,7 @@ pub const Element = struct { if (this.element == null) return JSValue.jsNull(); if (function.isUndefinedOrNull() or !function.isCallable()) { - return ZigString.init("Expected a function").withEncoding().toJS(globalObject); + return RustString.init("Expected a function").withEncoding().toJS(globalObject); } const end_tag_handler = bun.handleOom(bun.default_allocator.create(EndTag.Handler)); @@ -1774,8 +1774,8 @@ pub const Element = struct { // // fn wrap(comptime name: string) - /// Returns the value for a given attribute name: ZigString on the element, or null if it is not found. - pub fn getAttribute_(this: *Element, globalObject: *JSGlobalObject, name: ZigString) bun.JSError!JSValue { + /// Returns the value for a given attribute name: RustString on the element, or null if it is not found. + pub fn getAttribute_(this: *Element, globalObject: *JSGlobalObject, name: RustString) bun.JSError!JSValue { if (this.element == null) return JSValue.jsNull(); @@ -1790,7 +1790,7 @@ pub const Element = struct { } /// Returns a boolean indicating whether an attribute exists on the element. - pub fn hasAttribute_(this: *Element, global: *JSGlobalObject, name: ZigString) JSValue { + pub fn hasAttribute_(this: *Element, global: *JSGlobalObject, name: RustString) JSValue { if (this.element == null) return .false; @@ -1800,7 +1800,7 @@ pub const Element = struct { } /// Sets an attribute to a provided value, creating the attribute if it does not exist. - pub fn setAttribute_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, name_: ZigString, value_: ZigString) JSValue { + pub fn setAttribute_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, name_: RustString, value_: RustString) JSValue { if (this.element == null) return .js_undefined; @@ -1818,7 +1818,7 @@ pub const Element = struct { } /// Removes the attribute. - pub fn removeAttribute_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, name: ZigString) JSValue { + pub fn removeAttribute_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, name: RustString) JSValue { if (this.element == null) return .js_undefined; @@ -1841,7 +1841,7 @@ pub const Element = struct { pub const setAttribute = host_fn.wrapInstanceMethod(Element, "setAttribute_", false); pub const removeAttribute = host_fn.wrapInstanceMethod(Element, "removeAttribute_", false); - fn contentHandler(this: *Element, comptime Callback: (fn (*LOLHTML.Element, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *Element, comptime Callback: (fn (*LOLHTML.Element, []const u8, bool) LOLHTML.Error!void), thisObject: JSValue, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { if (this.element == null) return .js_undefined; @@ -1858,7 +1858,7 @@ pub const Element = struct { } /// Inserts content before the element. - pub fn before_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn before_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.before, @@ -1870,7 +1870,7 @@ pub const Element = struct { } /// Inserts content right after the element. - pub fn after_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn after_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.after, @@ -1882,7 +1882,7 @@ pub const Element = struct { } /// Inserts content right after the start tag of the element. - pub fn prepend_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn prepend_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.prepend, @@ -1894,7 +1894,7 @@ pub const Element = struct { } /// Inserts content right before the end tag of the element. - pub fn append_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn append_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.append, @@ -1906,7 +1906,7 @@ pub const Element = struct { } /// Removes the element and inserts content in place of it. - pub fn replace_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn replace_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.replace, @@ -1918,7 +1918,7 @@ pub const Element = struct { } /// Replaces content of the element. - pub fn setInnerContent_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn setInnerContent_(this: *Element, callFrame: *jsc.CallFrame, globalObject: *JSGlobalObject, content: RustString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.setInnerContent, @@ -2027,5 +2027,5 @@ const Response = bun.webcore.Response; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const host_fn = jsc.host_fn; diff --git a/src/runtime/bake/BakeGlobalObject.cpp b/src/runtime/bake/BakeGlobalObject.cpp index 6bb3b327635..d0ea19aba20 100644 --- a/src/runtime/bake/BakeGlobalObject.cpp +++ b/src/runtime/bake/BakeGlobalObject.cpp @@ -48,8 +48,8 @@ bakeModuleLoaderImportModule(JSC::JSGlobalObject* global, } // TODO: make static cast instead of jscast - // Use Zig::GlobalObject's function - return uncheckedDowncast(global)->moduleLoaderImportModule(global, moduleLoader, moduleNameValue, WTF::move(parameters), sourceOrigin); + // Use Rust::GlobalObject's function + return uncheckedDowncast(global)->moduleLoaderImportModule(global, moduleLoader, moduleNameValue, WTF::move(parameters), sourceOrigin); } JSC::Identifier bakeModuleLoaderResolve(JSC::JSGlobalObject* jsGlobal, @@ -86,8 +86,8 @@ JSC::Identifier bakeModuleLoaderResolve(JSC::JSGlobalObject* jsGlobal, } } - // Use Zig::GlobalObject's function - return Zig::GlobalObject::moduleLoaderResolve(jsGlobal, loader, key, referrer, WTF::move(origin), useImportMap); + // Use Rust::GlobalObject's function + return Rust::GlobalObject::moduleLoaderResolve(jsGlobal, loader, key, referrer, WTF::move(origin), useImportMap); } static JSC::JSPromise* rejectedInternalPromise(JSC::JSGlobalObject* globalObject, JSC::JSValue value) @@ -146,7 +146,7 @@ JSC::JSPromise* bakeModuleLoaderFetch(JSC::JSGlobalObject* globalObject, } // We unconditionally prefix the key with "bake:" inside - // BakeProdResolve in production.zig. + // BakeProdResolve in production.rust. // // But if someone does: `await import(resolve(import.meta.dir, "nav.ts"))` // we don't actually want to load it from the Bake production module @@ -163,12 +163,12 @@ JSC::JSPromise* bakeModuleLoaderFetch(JSC::JSGlobalObject* globalObject, #endif JSString* bakePrefixRemovedString = jsNontrivialString(vm, bakePrefixRemoved); JSValue bakePrefixRemovedJsvalue = bakePrefixRemovedString; - return Zig::GlobalObject::moduleLoaderFetch(globalObject, loader, bakePrefixRemovedJsvalue, WTF::move(parameters), WTF::move(script)); + return Rust::GlobalObject::moduleLoaderFetch(globalObject, loader, bakePrefixRemovedJsvalue, WTF::move(parameters), WTF::move(script)); } return rejectedInternalPromise(globalObject, createTypeError(globalObject, "BakeGlobalObject does not have per-thread data configured"_s)); } - auto result = Zig::GlobalObject::moduleLoaderFetch(globalObject, loader, key, WTF::move(parameters), WTF::move(script)); + auto result = Rust::GlobalObject::moduleLoaderFetch(globalObject, loader, key, WTF::move(parameters), WTF::move(script)); RETURN_IF_EXCEPTION(scope, rejectedInternalPromise(globalObject, scope.exception()->value())); return result; } @@ -200,7 +200,7 @@ extern "C" BunVirtualMachine* Bun__getVM(); const JSC::GlobalObjectMethodTable& GlobalObject::globalObjectMethodTable() { - const auto& parent = Zig::GlobalObject::globalObjectMethodTable(); + const auto& parent = Rust::GlobalObject::globalObjectMethodTable(); #define INHERIT_HOOK_METHOD(name) \ parent.name @@ -231,7 +231,7 @@ const JSC::GlobalObjectMethodTable& GlobalObject::globalObjectMethodTable() return table; } -// A lot of this function is taken from 'Zig__GlobalObject__create' +// A lot of this function is taken from 'Rust__GlobalObject__create' // TODO: remove this entire method extern "C" GlobalObject* BakeCreateProdGlobal(void* console) { @@ -240,7 +240,7 @@ extern "C" GlobalObject* BakeCreateProdGlobal(void* console) BUN_PANIC("Failed to allocate JavaScriptCore Virtual Machine. Did your computer run out of memory? Or maybe you compiled Bun with a mismatching libc++ version or compiler?"); } // We need to unsafely ref this so it stays alive, later in - // `Zig__GlobalObject__destructOnExit` will call + // `Rust__GlobalObject__destructOnExit` will call // `vm.derefSuppressingSaferCPPChecking()` to free it. vmPtr->refSuppressingSaferCPPChecking(); JSC::VM& vm = *vmPtr; diff --git a/src/runtime/bake/BakeGlobalObject.h b/src/runtime/bake/BakeGlobalObject.h index 58e4d3f2753..c57f5d1bfed 100644 --- a/src/runtime/bake/BakeGlobalObject.h +++ b/src/runtime/bake/BakeGlobalObject.h @@ -1,12 +1,12 @@ #pragma once #include "root.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" namespace Bake { -class GlobalObject : public Zig::GlobalObject { +class GlobalObject : public Rust::GlobalObject { public: - using Base = Zig::GlobalObject; + using Base = Rust::GlobalObject; void* m_perThreadData = nullptr; DECLARE_INFO; @@ -32,7 +32,7 @@ class GlobalObject : public Zig::GlobalObject { void finishCreation(JSC::VM& vm); GlobalObject(JSC::VM& vm, JSC::Structure* structure, const JSC::GlobalObjectMethodTable* methodTable) - : Zig::GlobalObject(vm, structure, methodTable) + : Rust::GlobalObject(vm, structure, methodTable) { } }; diff --git a/src/runtime/bake/BakeSourceProvider.cpp b/src/runtime/bake/BakeSourceProvider.cpp index b337c9f3f21..dea0c381dd3 100644 --- a/src/runtime/bake/BakeSourceProvider.cpp +++ b/src/runtime/bake/BakeSourceProvider.cpp @@ -49,7 +49,7 @@ extern "C" JSC::EncodedJSValue BakeLoadInitialServerCode(JSC::JSGlobalObject* gl JSC::MarkedArgumentBuffer args; args.append(JSC::jsBoolean(separateSSRGraph)); // separateSSRGraph - args.append(Zig::ImportMetaObject::create(global, "bake://server-runtime.js"_s)); // importMeta + args.append(Rust::ImportMetaObject::create(global, "bake://server-runtime.js"_s)); // importMeta RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::profiledCall(global, JSC::ProfilingReason::API, fn, callData, JSC::jsUndefined(), args))); } @@ -132,7 +132,7 @@ extern "C" JSC::EncodedJSValue BakeGetDefaultExportFromModule( return JSC::JSValue::encode(uncheckedDowncast(JSC::JSValue::decode(BakeGetModuleNamespace(global, keyValue)))->get(global, vm.propertyNames->defaultKeyword)); } -// There were issues when trying to use JSValue.get from zig +// There were issues when trying to use JSValue.get from rust extern "C" JSC::EncodedJSValue BakeGetOnModuleNamespace( JSC::JSGlobalObject* global, JSC::JSModuleNamespaceObject* moduleNamespace, diff --git a/src/runtime/bake/BakeSourceProvider.h b/src/runtime/bake/BakeSourceProvider.h index 0da0fcaa828..4c375fc95d9 100644 --- a/src/runtime/bake/BakeSourceProvider.h +++ b/src/runtime/bake/BakeSourceProvider.h @@ -21,9 +21,9 @@ class SourceProvider final : public JSC::StringSourceProvider { JSC::SourceProviderSourceType sourceType) { auto provider = adoptRef(*new SourceProvider(source, sourceOrigin, WTF::move(sourceURL), startPosition, sourceType)); - auto* zigGlobalObject = uncheckedDowncast(globalObject); + auto* rustGlobalObject = uncheckedDowncast(globalObject); auto specifier = Bun::toString(provider->sourceURL()); - Bun__addBakeSourceProviderSourceMap(zigGlobalObject->bunVM(), provider.ptr(), &specifier); + Bun__addBakeSourceProviderSourceMap(rustGlobalObject->bunVM(), provider.ptr(), &specifier); return provider; } diff --git a/src/runtime/bake/DevServer.zig b/src/runtime/bake/DevServer.zig index 3443e91a80d..f70f5dc23e5 100644 --- a/src/runtime/bake/DevServer.zig +++ b/src/runtime/bake/DevServer.zig @@ -268,7 +268,7 @@ pub const asset_prefix = internal_prefix ++ "/asset"; /// Example: `/_bun/client/index-00000000f209a20e.js` pub const client_prefix = internal_prefix ++ "/client"; -pub const RouteBundle = @import("./DevServer/RouteBundle.zig"); +pub const RouteBundle = @import("./DevServer/RouteBundle.rust"); const DeferredPromise = struct { strong: jsc.JSPromise.Strong = .empty, @@ -762,7 +762,7 @@ pub fn dev_allocator(dev: *const DevServer) DevAllocator { return dev.allocation_scope.borrow(); } -pub const MemoryCost = @import("./DevServer/memory_cost.zig"); +pub const MemoryCost = @import("./DevServer/memory_cost.rust"); pub const memoryCost = MemoryCost.memoryCost; pub const memoryCostDetailed = MemoryCost.memoryCostDetailed; pub const memoryCostArrayHashMap = MemoryCost.memoryCostArrayHashMap; @@ -1461,8 +1461,8 @@ fn onFrameworkRequestWithBundle( var params: FrameworkRouter.MatchedParams = undefined; const url_bunstr = switch (req) { .stack => |r| bun.String{ - .tag = .ZigString, - .value = .{ .ZigString = bun.ZigString.fromUTF8(r.url()) }, + .tag = .RustString, + .value = .{ .RustString = bun.RustString.fromUTF8(r.url()) }, }, .saved => |data| brk: { const url = data.request.url; @@ -1690,7 +1690,7 @@ pub fn onSrcRequest(dev: *DevServer, req: *uws.Request, resp: anytype) void { } // TODO: better editor detection. on chloe's dev env, this opens apple terminal + vim - // This is already done in Next.js. we have to port this to Zig so we can use. + // This is already done in Next.js. we have to port this to Rust so we can use. resp.writeStatus("501 Not Implemented"); resp.end("TODO", false); _ = dev; @@ -3442,7 +3442,7 @@ fn printMemoryLine(dev: *DevServer) void { }); } -pub const PackedMap = @import("./DevServer/PackedMap.zig"); +pub const PackedMap = @import("./DevServer/PackedMap.rust"); pub const FileKind = enum(u2) { /// Files that failed to bundle or do not exist on disk will appear in the /// graph as "unknown". @@ -3465,7 +3465,7 @@ pub const FileKind = enum(u2) { } }; -pub const IncrementalGraph = @import("./DevServer/IncrementalGraph.zig").IncrementalGraph; +pub const IncrementalGraph = @import("./DevServer/IncrementalGraph.rust").IncrementalGraph; pub const IncrementalResult = struct { /// When tracing a file's dependencies via `traceDependencies`, this is @@ -3595,14 +3595,14 @@ fn initGraphTraceState(dev: *const DevServer, sfa: Allocator, extra_client_bits: return .{ .server_bits = server_bits, .client_bits = client_bits }; } -pub const DirectoryWatchStore = @import("./DevServer/DirectoryWatchStore.zig"); +pub const DirectoryWatchStore = @import("./DevServer/DirectoryWatchStore.rust"); pub const ChunkKind = enum(u1) { initial_response, hmr_chunk, }; -pub const SerializedFailure = @import("./DevServer/SerializedFailure.zig"); +pub const SerializedFailure = @import("./DevServer/SerializedFailure.rust"); // For debugging, it is helpful to be able to see bundles. pub fn dumpBundle(dump_dir: std.fs.Dir, graph: bake.Graph, rel_path: []const u8, chunk: []const u8, wrap: bool) !void { @@ -4016,7 +4016,7 @@ pub const HmrTopic = enum(u8) { } }); }; -pub const HmrSocket = @import("./DevServer/HmrSocket.zig"); +pub const HmrSocket = @import("./DevServer/HmrSocket.rust"); pub fn routeToBundleIndexSlow(dev: *DevServer, pattern: []const u8) ?RouteBundle.Index { var params: FrameworkRouter.MatchedParams = undefined; @@ -4087,8 +4087,8 @@ pub fn inspector(dev: *const DevServer) ?*BunFrontendDevServerAgent { return null; } -pub const HotReloadEvent = @import("./DevServer/HotReloadEvent.zig"); -pub const WatcherAtomics = @import("./DevServer/WatcherAtomics.zig"); +pub const HotReloadEvent = @import("./DevServer/HotReloadEvent.rust"); +pub const WatcherAtomics = @import("./DevServer/WatcherAtomics.rust"); /// Called on watcher's thread; Access to dev-server state restricted. pub fn onFileUpdate(dev: *DevServer, events: []Watcher.Event, changed_files: []?[:0]u8, watchlist: Watcher.ItemList) void { @@ -4407,9 +4407,9 @@ pub fn putOrOverwriteAsset( _ = try dev.assets.replacePath(path.text, contents, &.byExtension(path.name.extWithoutLeadingDot()), content_hash); } -pub const Assets = @import("./DevServer/Assets.zig"); +pub const Assets = @import("./DevServer/Assets.rust"); -pub const SourceMapStore = @import("./DevServer/SourceMapStore.zig"); +pub const SourceMapStore = @import("./DevServer/SourceMapStore.rust"); pub fn onPluginsResolved(dev: *DevServer, plugins: ?*Plugin) !void { dev.bundler_options.plugin = plugins; @@ -4427,7 +4427,7 @@ pub fn onPluginsRejected(dev: *DevServer) !void { // TODO: allow recovery from this state } -pub const ErrorReportRequest = @import("./DevServer/ErrorReportRequest.zig"); +pub const ErrorReportRequest = @import("./DevServer/ErrorReportRequest.rust"); /// Problem statement documented on `script_unref_payload` /// Takes 8 bytes: The generation ID in hex. diff --git a/src/runtime/bake/DevServer/ErrorReportRequest.zig b/src/runtime/bake/DevServer/ErrorReportRequest.zig index cf9eadc589d..0f6b8854aae 100644 --- a/src/runtime/bake/DevServer/ErrorReportRequest.zig +++ b/src/runtime/bake/DevServer/ErrorReportRequest.zig @@ -49,14 +49,14 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! var source_map_arena = std.heap.ArenaAllocator.init(sfa_sourcemap.get()); defer source_map_arena.deinit(); - // Read payload, assemble ZigException + // Read payload, assemble RustException const name = try readString32(reader, temp_alloc); defer temp_alloc.free(name); const message = try readString32(reader, temp_alloc); defer temp_alloc.free(message); const browser_url = try readString32(reader, temp_alloc); defer temp_alloc.free(browser_url); - var frames: ArrayListUnmanaged(jsc.ZigStackFrame) = .empty; + var frames: ArrayListUnmanaged(jsc.RustStackFrame) = .empty; defer frames.deinit(temp_alloc); const stack_count = @min(try reader.readInt(u32, .little), 255); // does not support more than 255 try frames.ensureTotalCapacity(temp_alloc, stack_count); @@ -100,10 +100,10 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! var runtime_lines: ?[5][]const u8 = null; var first_line_of_interest: usize = 0; - var top_frame_position: jsc.ZigStackFramePosition = undefined; + var top_frame_position: jsc.RustStackFramePosition = undefined; var region_of_interest_line: u32 = 0; for (frames.items) |*frame| { - const source_url = frame.source_url.value.ZigString.slice(); + const source_url = frame.source_url.value.RustString.slice(); // The browser code strips "http://localhost:3000" when the string // has /_bun/client. It's done because JS can refer to `location` const id = parseId(source_url, browser_url_origin) orelse continue; @@ -163,7 +163,7 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! const relative_path_buf = bun.path_buffer_pool.get(); defer bun.path_buffer_pool.put(relative_path_buf); const rel_path = ctx.dev.relativePath(relative_path_buf, abs_path); - if (bun.strings.eql(frame.function_name.value.ZigString.slice(), rel_path)) { + if (bun.strings.eql(frame.function_name.value.RustString.slice(), rel_path)) { frame.function_name = .empty; } frame.remapped = true; @@ -197,7 +197,7 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! trim_runtime_frames: { // Ensure that trimming will not remove ALL frames. for (frames.items) |frame| { - if (!frame.position.isInvalid() or frame.source_url.value.ZigString.slice().ptr != runtime_name) { + if (!frame.position.isInvalid() or frame.source_url.value.RustString.slice().ptr != runtime_name) { break; } } else break :trim_runtime_frames; @@ -205,7 +205,7 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! // Move all frames up var i: usize = 0; for (frames.items[i..]) |frame| { - if (frame.position.isInvalid() and frame.source_url.value.ZigString.slice().ptr == runtime_name) { + if (frame.position.isInvalid() and frame.source_url.value.RustString.slice().ptr == runtime_name) { continue; // skip runtime frames } @@ -215,7 +215,7 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! frames.items.len = i; } - var exception: jsc.ZigException = .{ + var exception: jsc.RustException = .{ .type = .Error, .runtime_type = .Nothing, .name = .init(name), @@ -229,7 +229,7 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! const stderr = Output.errorWriterBuffered(); defer Output.flush(); switch (Output.enable_ansi_colors_stderr) { - inline else => |ansi_colors| ctx.dev.vm.printExternallyRemappedZigException( + inline else => |ansi_colors| ctx.dev.vm.printExternallyRemappedRustException( &exception, null, @TypeOf(stderr), @@ -248,11 +248,11 @@ pub fn runWithBody(ctx: *ErrorReportRequest, body: []const u8, r: AnyResponse) ! try w.writeInt(i32, frame.position.line.oneBased(), .little); try w.writeInt(i32, frame.position.column.oneBased(), .little); - const function_name = frame.function_name.value.ZigString.slice(); + const function_name = frame.function_name.value.RustString.slice(); try w.writeInt(u32, @intCast(function_name.len), .little); try w.writeAll(function_name); - const src_to_write = frame.source_url.value.ZigString.slice(); + const src_to_write = frame.source_url.value.RustString.slice(); if (bun.strings.hasPrefixComptime(src_to_write, "/")) { const relative_path_buf = bun.path_buffer_pool.get(); defer bun.path_buffer_pool.put(relative_path_buf); diff --git a/src/runtime/bake/DevServer/memory_cost.zig b/src/runtime/bake/DevServer/memory_cost.zig index 5a830f9f529..e9b694a4199 100644 --- a/src/runtime/bake/DevServer/memory_cost.zig +++ b/src/runtime/bake/DevServer/memory_cost.zig @@ -23,7 +23,7 @@ pub fn memoryCostDetailed(dev: *DevServer) MemoryCost { var js_code: usize = 0; var source_maps: usize = 0; var assets: usize = 0; - // See https://github.com/ziglang/zig/issues/21879 + // See https://github.com/rustlang/rust/issues/21879 useAllFields(DevServer, .{ // does not contain pointers .assume_perfect_incremental_bundling = {}, diff --git a/src/runtime/bake/DevServerSourceProvider.cpp b/src/runtime/bake/DevServerSourceProvider.cpp index 291e0883ea4..f1f735f0764 100644 --- a/src/runtime/bake/DevServerSourceProvider.cpp +++ b/src/runtime/bake/DevServerSourceProvider.cpp @@ -2,10 +2,10 @@ #include "BunBuiltinNames.h" #include "BunString.h" -// The Zig implementation will be provided to handle registration +// The Rust implementation will be provided to handle registration extern "C" void Bun__addDevServerSourceProvider(void* bun_vm, Bake::DevServerSourceProvider* opaque_source_provider, BunString* specifier); -// Export functions for Zig to access DevServerSourceProvider +// Export functions for Rust to access DevServerSourceProvider extern "C" BunString DevServerSourceProvider__getSourceSlice(Bake::DevServerSourceProvider* provider) { return Bun::toStringView(provider->source()); diff --git a/src/runtime/bake/DevServerSourceProvider.h b/src/runtime/bake/DevServerSourceProvider.h index 46c022dbe32..8e72e71a747 100644 --- a/src/runtime/bake/DevServerSourceProvider.h +++ b/src/runtime/bake/DevServerSourceProvider.h @@ -2,14 +2,14 @@ #include "root.h" #include "headers-handwritten.h" #include "JavaScriptCore/SourceOrigin.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "MiString.h" namespace Bake { class DevServerSourceProvider; -// Function to be implemented in Zig to register the source provider +// Function to be implemented in Rust to register the source provider extern "C" void Bun__addDevServerSourceProvider(void* bun_vm, DevServerSourceProvider* opaque_source_provider, BunString* specifier); extern "C" void Bun__removeDevServerSourceProvider(void* bun_vm, DevServerSourceProvider* opaque_source_provider, BunString* specifier); @@ -26,11 +26,11 @@ class DevServerSourceProvider final : public JSC::StringSourceProvider { JSC::SourceProviderSourceType sourceType) { auto provider = adoptRef(*new DevServerSourceProvider(source, sourceMapJSONPtr, sourceMapJSONLength, sourceOrigin, WTF::move(sourceURL), startPosition, sourceType)); - auto* zigGlobalObject = uncheckedDowncast<::Zig::GlobalObject>(globalObject); + auto* rustGlobalObject = uncheckedDowncast<::Rust::GlobalObject>(globalObject); auto specifier = Bun::toString(provider->sourceURL()); - provider->m_globalObject = zigGlobalObject; + provider->m_globalObject = rustGlobalObject; provider->m_specifier = specifier; - Bun__addDevServerSourceProvider(zigGlobalObject->bunVM(), provider.ptr(), &specifier); + Bun__addDevServerSourceProvider(rustGlobalObject->bunVM(), provider.ptr(), &specifier); return provider; } @@ -67,7 +67,7 @@ class DevServerSourceProvider final : public JSC::StringSourceProvider { } MiString m_sourceMapJSON; - Zig::GlobalObject* m_globalObject; + Rust::GlobalObject* m_globalObject; BunString m_specifier; }; diff --git a/src/runtime/bake/bake.zig b/src/runtime/bake/bake.zig index cd621eb3de4..e2761d83fff 100644 --- a/src/runtime/bake/bake.zig +++ b/src/runtime/bake/bake.zig @@ -2,14 +2,14 @@ //! combines `Bun.build` and `Bun.serve`, providing a hot-reloading development //! server, server components, and other integrations. Instead of taking the //! role as a framework, Bake is tool for frameworks to build on top of. -pub const production = @import("./production.zig"); -pub const DevServer = @import("./DevServer.zig"); -pub const FrameworkRouter = @import("./FrameworkRouter.zig"); +pub const production = @import("./production.rust"); +pub const DevServer = @import("./DevServer.rust"); +pub const FrameworkRouter = @import("./FrameworkRouter.rust"); /// export default { app: ... }; pub const api_name = "app"; -/// Zig version of the TS definition 'Bake.Options' in 'bake.d.ts' +/// Rust version of the TS definition 'Bake.Options' in 'bake.d.ts' pub const UserOptions = struct { /// This arena contains some miscellaneous allocations at startup arena: std.heap.ArenaAllocator, @@ -89,7 +89,7 @@ pub const UserOptions = struct { alloc, ); - const root = if (try config.getOptional(global, "root", ZigString.Slice)) |slice| + const root = if (try config.getOptional(global, "root", RustString.Slice)) |slice| allocations.track(slice) else bun.getcwdAlloc(alloc) catch |err| switch (err) { @@ -117,11 +117,11 @@ pub const UserOptions = struct { /// Each string stores its allocator since some may hold reference counts to JSC pub const StringRefList = struct { - strings: std.ArrayListUnmanaged(ZigString.Slice), + strings: std.ArrayListUnmanaged(RustString.Slice), pub const empty: StringRefList = .{ .strings = .{} }; - pub fn track(al: *StringRefList, str: ZigString.Slice) []const u8 { + pub fn track(al: *StringRefList, str: RustString.Slice) []const u8 { bun.handleOom(al.strings.append(bun.default_allocator, str)); return str.slice(); } @@ -156,7 +156,7 @@ pub const SplitBundlerOptions = struct { return global.throwInvalidArguments("Expected plugin to be an object", .{}); } - if (try plugin_config.getOptional(global, "name", ZigString.Slice)) |slice| { + if (try plugin_config.getOptional(global, "name", RustString.Slice)) |slice| { defer slice.deinit(); if (slice.len == 0) { return global.throwInvalidArguments("Expected plugin to have a non-empty name", .{}); @@ -508,14 +508,14 @@ pub const Framework = struct { return global.throwInvalidArguments("'framework.serverComponents.separateSSRGraph' must be a boolean", .{}); }, .server_runtime_import = refs.track( - try sc.getOptional(global, "serverRuntimeImportSource", ZigString.Slice) orelse { + try sc.getOptional(global, "serverRuntimeImportSource", RustString.Slice) orelse { return global.throwInvalidArguments("Missing 'framework.serverComponents.serverRuntimeImportSource'", .{}); }, ), .server_register_client_reference = if (try sc.getOptional( global, "serverRegisterClientReferenceExport", - ZigString.Slice, + RustString.Slice, )) |slice| refs.track(slice) else @@ -1004,5 +1004,5 @@ const Environment = bun.Environment; const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Plugin = jsc.API.JSBundler.Plugin; diff --git a/src/runtime/bake/bun-framework-react/index.ts b/src/runtime/bake/bun-framework-react/index.ts index cdbd2b59429..f90f2b7373b 100644 --- a/src/runtime/bake/bun-framework-react/index.ts +++ b/src/runtime/bake/bun-framework-react/index.ts @@ -1,7 +1,7 @@ // This file is unused by Bun itself, but rather is a tool for // contributors to hack on `bun-framework-react` without needing // to compile bun itself. If changes to this are made, please -// update 'pub fn react' in 'bake.zig' +// update 'pub fn react' in 'bake.rust' import type { Bake } from "bun"; export function react(): Bake.Framework { diff --git a/src/runtime/bake/hmr-module.ts b/src/runtime/bake/hmr-module.ts index 93511937734..fc87002e4c2 100644 --- a/src/runtime/bake/hmr-module.ts +++ b/src/runtime/bake/hmr-module.ts @@ -68,7 +68,7 @@ interface CJSModule { require: (id: Id) => unknown; } -/** Implementation details must remain in sync with js_parser.zig and bundle_v2.zig */ +/** Implementation details must remain in sync with js_parser.rust and bundle_v2.rust */ export class HMRModule { /** Key in `registry` */ id: Id; diff --git a/src/runtime/bake/hmr-runtime-client.ts b/src/runtime/bake/hmr-runtime-client.ts index 4ee95201f38..f7a76cc5bfc 100644 --- a/src/runtime/bake/hmr-runtime-client.ts +++ b/src/runtime/bake/hmr-runtime-client.ts @@ -136,7 +136,7 @@ const handlers = { const reader = new DataViewReader(view, 1); // The code genearting each list is annotated with equivalent "List n" - // comments in DevServer.zig's finalizeBundle function. + // comments in DevServer.rust's finalizeBundle function. // List 1 const serverSideRoutesUpdated = new Set(); diff --git a/src/runtime/cli/audit_command.zig b/src/runtime/cli/audit_command.zig index 6279114dfa4..a57510ed3af 100644 --- a/src/runtime/cli/audit_command.zig +++ b/src/runtime/cli/audit_command.zig @@ -77,7 +77,7 @@ pub const AuditCommand = struct { Output.flush(); const load_lockfile = pm.lockfile.loadFromCwd(pm, ctx.allocator, ctx.log, true); - @import("./package_manager_command.zig").PackageManagerCommand.handleLoadLockfileErrors(load_lockfile, pm); + @import("./package_manager_command.rust").PackageManagerCommand.handleLoadLockfileErrors(load_lockfile, pm); var dependency_tree = try buildDependencyTree(ctx.allocator, pm); defer dependency_tree.deinit(); @@ -819,12 +819,12 @@ fn printEnhancedAuditReport( return 0; } -const libdeflate = @import("../../libdeflate_sys/libdeflate.zig"); +const libdeflate = @import("../../libdeflate_sys/libdeflate.rust"); const std = @import("std"); -const AuditLevel = @import("../../install/PackageManager/CommandLineArguments.zig").AuditLevel; -const Command = @import("./cli.zig").Command; -const PackageManager = @import("../../install/install.zig").PackageManager; -const URL = @import("../../url/url.zig").URL; +const AuditLevel = @import("../../install/PackageManager/CommandLineArguments.rust").AuditLevel; +const Command = @import("./cli.rust").Command; +const PackageManager = @import("../../install/install.rust").PackageManager; +const URL = @import("../../url/url.rust").URL; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/cli/build_command.zig b/src/runtime/cli/build_command.zig index 56326f06006..4ec248a3772 100644 --- a/src/runtime/cli/build_command.zig +++ b/src/runtime/cli/build_command.zig @@ -796,14 +796,14 @@ fn printSummary(bundled_end: i128, minify_duration: u64, minified: bool, input_c const string = []const u8; -const MetafileBuilder = @import("../../bundler/linker_context/MetafileBuilder.zig"); -const fs = @import("../../resolver/fs.zig"); -const options = @import("../../bundler/options.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const MetafileBuilder = @import("../../bundler/linker_context/MetafileBuilder.rust"); +const fs = @import("../../resolver/fs.rust"); +const options = @import("../../bundler/options.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const BundleV2 = @import("../../bundler/bundle_v2.zig").BundleV2; -const Command = @import("./cli.zig").Command; -const Runtime = @import("../../js_parser/runtime.zig").Runtime; +const BundleV2 = @import("../../bundler/bundle_v2.rust").BundleV2; +const Command = @import("./cli.rust").Command; +const Runtime = @import("../../js_parser/runtime.rust").Runtime; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/cli/bunfig.zig b/src/runtime/cli/bunfig.zig index d14e8002696..bbc1ea9eb53 100644 --- a/src/runtime/cli/bunfig.zig +++ b/src/runtime/cli/bunfig.zig @@ -5,8 +5,8 @@ const LoaderMap = bun.StringArrayHashMapUnmanaged(options.Loader); // TODO: replace api.TransformOptions with Bunfig pub const Bunfig = struct { - pub const OfflineMode = @import("../../options_types/OfflineMode.zig").OfflineMode; - pub const Prefer = @import("../../options_types/OfflineMode.zig").Prefer; + pub const OfflineMode = @import("../../options_types/OfflineMode.rust").OfflineMode; + pub const Prefer = @import("../../options_types/OfflineMode.rust").Prefer; pub const Parser = struct { json: js_ast.Expr, @@ -1286,13 +1286,13 @@ pub const Bunfig = struct { const string = []const u8; -const options = @import("../../bundler/options.zig"); -const resolver = @import("../../resolver/resolver.zig"); +const options = @import("../../bundler/options.rust"); +const resolver = @import("../../resolver/resolver.rust"); const std = @import("std"); -const Command = @import("./cli.zig").Command; -const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; -const TestCommand = @import("./test_command.zig").TestCommand; -const URL = @import("../../url/url.zig").URL; +const Command = @import("./cli.rust").Command; +const PackageJSON = @import("../../resolver/package_json.rust").PackageJSON; +const TestCommand = @import("./test_command.rust").TestCommand; +const URL = @import("../../url/url.rust").URL; const bun = @import("bun"); const JSONParser = bun.json; diff --git a/src/runtime/cli/bunx_command.zig b/src/runtime/cli/bunx_command.zig index 23694bf1338..5bd059f9fbf 100644 --- a/src/runtime/cli/bunx_command.zig +++ b/src/runtime/cli/bunx_command.zig @@ -544,7 +544,7 @@ pub const BunxCommand = struct { // - If you set permission to 777, you run into a potential attack vector // where a user can replace the directory with malicious code. // - // If this format changes, please update cache clearing code in package_manager_command.zig + // If this format changes, please update cache clearing code in package_manager_command.rust const uid = if (bun.Environment.isPosix) bun.c.getuid() else bun.windows.userUniqueId(); PATH = switch (PATH.len > 0) { inline else => |path_is_nonzero| try std.fmt.allocPrint( @@ -908,10 +908,10 @@ pub const BunxCommand = struct { const string = []const u8; const std = @import("std"); -const Run = @import("./run_command.zig").RunCommand; +const Run = @import("./run_command.rust").RunCommand; const Allocator = std.mem.Allocator; -const cli = @import("./cli.zig"); +const cli = @import("./cli.rust"); const Command = cli.Command; const bun = @import("bun"); diff --git a/src/runtime/cli/cli.zig b/src/runtime/cli/cli.zig index 109aa476c26..035c2c25826 100644 --- a/src/runtime/cli/cli.zig +++ b/src/runtime/cli/cli.zig @@ -5,7 +5,7 @@ pub var start_time: i128 = undefined; pub var Bun__Node__ProcessTitle: ?string = null; pub const Cli = struct { - pub const CompileTarget = @import("../../options_types/CompileTarget.zig"); + pub const CompileTarget = @import("../../options_types/CompileTarget.rust"); pub var log_: logger.Log = undefined; pub fn startTransform(_: std.mem.Allocator, _: api.TransformOptions, _: *logger.Log) anyerror!void {} pub fn start(allocator: std.mem.Allocator) void { @@ -64,37 +64,37 @@ pub fn invalidTarget(diag: *clap.Diagnostic, _target: []const u8) noreturn { std.process.exit(1); } -pub const BuildCommand = @import("./build_command.zig").BuildCommand; -pub const AddCommand = @import("./add_command.zig").AddCommand; -pub const CreateCommand = @import("./create_command.zig").CreateCommand; -pub const CreateCommandExample = @import("./create_command.zig").Example; -pub const CreateListExamplesCommand = @import("./create_command.zig").CreateListExamplesCommand; -pub const DiscordCommand = @import("./discord_command.zig").DiscordCommand; -pub const InstallCommand = @import("./install_command.zig").InstallCommand; -pub const LinkCommand = @import("./link_command.zig").LinkCommand; -pub const UnlinkCommand = @import("./unlink_command.zig").UnlinkCommand; -pub const InstallCompletionsCommand = @import("./install_completions_command.zig").InstallCompletionsCommand; -pub const PackageManagerCommand = @import("./package_manager_command.zig").PackageManagerCommand; -pub const RemoveCommand = @import("./remove_command.zig").RemoveCommand; -pub const RunCommand = @import("./run_command.zig").RunCommand; -pub const ShellCompletions = @import("./shell_completions.zig"); -pub const UpdateCommand = @import("./update_command.zig").UpdateCommand; -pub const UpgradeCommand = @import("./upgrade_command.zig").UpgradeCommand; -pub const BunxCommand = @import("./bunx_command.zig").BunxCommand; -pub const ExecCommand = @import("./exec_command.zig").ExecCommand; -pub const PatchCommand = @import("./patch_command.zig").PatchCommand; -pub const PatchCommitCommand = @import("./patch_commit_command.zig").PatchCommitCommand; -pub const OutdatedCommand = @import("./outdated_command.zig").OutdatedCommand; -pub const UpdateInteractiveCommand = @import("./update_interactive_command.zig").UpdateInteractiveCommand; -pub const PublishCommand = @import("./publish_command.zig").PublishCommand; -pub const PackCommand = @import("./pack_command.zig").PackCommand; -pub const AuditCommand = @import("./audit_command.zig").AuditCommand; -pub const InitCommand = @import("./init_command.zig").InitCommand; -pub const WhyCommand = @import("./why_command.zig").WhyCommand; -pub const FuzzilliCommand = @import("./fuzzilli_command.zig").FuzzilliCommand; -pub const ReplCommand = @import("./repl_command.zig").ReplCommand; - -pub const Arguments = @import("./Arguments.zig"); +pub const BuildCommand = @import("./build_command.rust").BuildCommand; +pub const AddCommand = @import("./add_command.rust").AddCommand; +pub const CreateCommand = @import("./create_command.rust").CreateCommand; +pub const CreateCommandExample = @import("./create_command.rust").Example; +pub const CreateListExamplesCommand = @import("./create_command.rust").CreateListExamplesCommand; +pub const DiscordCommand = @import("./discord_command.rust").DiscordCommand; +pub const InstallCommand = @import("./install_command.rust").InstallCommand; +pub const LinkCommand = @import("./link_command.rust").LinkCommand; +pub const UnlinkCommand = @import("./unlink_command.rust").UnlinkCommand; +pub const InstallCompletionsCommand = @import("./install_completions_command.rust").InstallCompletionsCommand; +pub const PackageManagerCommand = @import("./package_manager_command.rust").PackageManagerCommand; +pub const RemoveCommand = @import("./remove_command.rust").RemoveCommand; +pub const RunCommand = @import("./run_command.rust").RunCommand; +pub const ShellCompletions = @import("./shell_completions.rust"); +pub const UpdateCommand = @import("./update_command.rust").UpdateCommand; +pub const UpgradeCommand = @import("./upgrade_command.rust").UpgradeCommand; +pub const BunxCommand = @import("./bunx_command.rust").BunxCommand; +pub const ExecCommand = @import("./exec_command.rust").ExecCommand; +pub const PatchCommand = @import("./patch_command.rust").PatchCommand; +pub const PatchCommitCommand = @import("./patch_commit_command.rust").PatchCommitCommand; +pub const OutdatedCommand = @import("./outdated_command.rust").OutdatedCommand; +pub const UpdateInteractiveCommand = @import("./update_interactive_command.rust").UpdateInteractiveCommand; +pub const PublishCommand = @import("./publish_command.rust").PublishCommand; +pub const PackCommand = @import("./pack_command.rust").PackCommand; +pub const AuditCommand = @import("./audit_command.rust").AuditCommand; +pub const InitCommand = @import("./init_command.rust").InitCommand; +pub const WhyCommand = @import("./why_command.rust").WhyCommand; +pub const FuzzilliCommand = @import("./fuzzilli_command.rust").FuzzilliCommand; +pub const ReplCommand = @import("./repl_command.rust").ReplCommand; + +pub const Arguments = @import("./Arguments.rust"); const AutoCommand = struct { pub fn exec(allocator: std.mem.Allocator) !void { @@ -308,7 +308,7 @@ pub const Command = struct { return global_cli_ctx; } - const ctx_types = @import("../../options_types/Context.zig"); + const ctx_types = @import("../../options_types/Context.rust"); pub const ContextData = ctx_types.ContextData; pub const Context = ctx_types.Context; pub const DebugOptions = ctx_types.DebugOptions; @@ -325,7 +325,7 @@ pub const Command = struct { /// `ContextData.create` body — kept here because it calls `Arguments.parse` /// and reaches into Windows watcher hooks. Aliased onto `ContextData` in - /// `options_types/Context.zig`. + /// `options_types/Context.rust`. pub fn createContextData(allocator: std.mem.Allocator, log: *logger.Log, comptime command: Command.Tag) anyerror!Context { Cli.cmd = command; context_data = .{ @@ -408,7 +408,7 @@ pub const Command = struct { } if (isNode(argv0)) { - @import("../../clap/streaming.zig").warn_on_unrecognized_flag = false; + @import("../../clap/streaming.rust").warn_on_unrecognized_flag = false; pretend_to_be_node = true; return .RunAsNodeCommand; } @@ -854,7 +854,7 @@ pub const Command = struct { } } - pub const Tag = @import("../../options_types/CommandTag.zig").Tag; + pub const Tag = @import("../../options_types/CommandTag.rust").Tag; pub fn tagParams(comptime cmd: Tag) []const Arguments.ParamType { return comptime &switch (cmd) { @@ -880,7 +880,7 @@ pub const Command = struct { // .HelpCommand => return try HelpCommand.exec(allocator), // .ReservedCommand => return try ReservedCommand.exec(allocator), - // these commands are implemented in install.zig + // these commands are implemented in install.rust // Command.Tag.InstallCommand => {}, // Command.Tag.AddCommand => {}, // Command.Tag.RemoveCommand => {}, @@ -1466,18 +1466,18 @@ pub fn printRevisionAndExit() noreturn { const string = []const u8; -const AddCompletions = @import("./add_completions.zig"); -const FilterRun = @import("./filter_run.zig"); -const MultiRun = @import("./multi_run.zig"); -const PmViewCommand = @import("./pm_view_command.zig"); -const fs = @import("../../resolver/fs.zig"); -const options = @import("../../bundler/options.zig"); +const AddCompletions = @import("./add_completions.rust"); +const FilterRun = @import("./filter_run.rust"); +const MultiRun = @import("./multi_run.rust"); +const PmViewCommand = @import("./pm_view_command.rust"); +const fs = @import("../../resolver/fs.rust"); +const options = @import("../../bundler/options.rust"); const std = @import("std"); -const ColonListType = @import("./colon_list_type.zig").ColonListType; -const RunCommand_ = @import("./run_command.zig").RunCommand; -const TestCommand = @import("./test_command.zig").TestCommand; +const ColonListType = @import("./colon_list_type.rust").ColonListType; +const RunCommand_ = @import("./run_command.rust").RunCommand; +const TestCommand = @import("./test_command.rust").TestCommand; -const Install = @import("../../install/install.zig"); +const Install = @import("../../install/install.rust"); const PackageManager = Install.PackageManager; const bun = @import("bun"); diff --git a/src/runtime/cli/create/SourceFileProjectGenerator.zig b/src/runtime/cli/create/SourceFileProjectGenerator.zig index 2c39d5add57..10dbe02ed3e 100644 --- a/src/runtime/cli/create/SourceFileProjectGenerator.zig +++ b/src/runtime/cli/create/SourceFileProjectGenerator.zig @@ -870,9 +870,9 @@ pub const Template = union(Tag) { const string = []const u8; -const linker = @import("../../../bundler/linker.zig"); +const linker = @import("../../../bundler/linker.rust"); const std = @import("std"); -const Example = @import("../create_command.zig").Example; +const Example = @import("../create_command.rust").Example; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/create_command.zig b/src/runtime/cli/create_command.zig index b2d928b012f..4c7148c2341 100644 --- a/src/runtime/cli/create_command.zig +++ b/src/runtime/cli/create_command.zig @@ -449,7 +449,7 @@ pub const CreateCommand = struct { } const destination_dir = destination_dir__; - const Walker = @import("../../sys/walker_skippable.zig"); + const Walker = @import("../../sys/walker_skippable.rust"); var walker_ = try Walker.walk(.fromStdDir(template_dir), ctx.allocator, skip_files, skip_dirs); defer walker_.deinit(); @@ -1631,7 +1631,7 @@ pub const CreateCommand = struct { child.stdout_behavior = .Inherit; child.stderr_behavior = .Inherit; - const open = @import("./open.zig"); + const open = @import("./open.rust"); open.openURL("http://localhost:3000/"); try child.spawn(); @@ -2428,17 +2428,17 @@ const GitHandler = struct { const string = []const u8; -const CopyFile = @import("../../sys/copy_file.zig"); -const DotEnv = @import("../../dotenv/env_loader.zig"); -const SourceFileProjectGenerator = @import("./create/SourceFileProjectGenerator.zig"); -const Zlib = @import("../../zlib/zlib.zig"); -const fs = @import("../../resolver/fs.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const CopyFile = @import("../../sys/copy_file.rust"); +const DotEnv = @import("../../dotenv/env_loader.rust"); +const SourceFileProjectGenerator = @import("./create/SourceFileProjectGenerator.rust"); +const Zlib = @import("../../zlib/zlib.rust"); +const fs = @import("../../resolver/fs.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const Command = @import("./cli.zig").Command; -const NPMClient = @import("./which_npm_client.zig").NPMClient; -const URL = @import("../../url/url.zig").URL; -const which = @import("../../which/which.zig").which; +const Command = @import("./cli.rust").Command; +const NPMClient = @import("./which_npm_client.rust").NPMClient; +const URL = @import("../../url/url.rust").URL; +const which = @import("../../which/which.rust").which; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/discord_command.zig b/src/runtime/cli/discord_command.zig index f794cddf350..747334e3816 100644 --- a/src/runtime/cli/discord_command.zig +++ b/src/runtime/cli/discord_command.zig @@ -6,5 +6,5 @@ pub const DiscordCommand = struct { }; const bun = @import("bun"); -const open = @import("./open.zig"); +const open = @import("./open.rust"); const std = @import("std"); diff --git a/src/runtime/cli/exec_command.zig b/src/runtime/cli/exec_command.zig index 5bd4561964c..44bad667f5d 100644 --- a/src/runtime/cli/exec_command.zig +++ b/src/runtime/cli/exec_command.zig @@ -5,7 +5,7 @@ pub const ExecCommand = struct { var bundle = try bun.Transpiler.init( ctx.allocator, ctx.log, - try @import("../../jsc/config.zig").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), + try @import("../../jsc/config.rust").configureTransformOptionsForBunVM(ctx.allocator, ctx.args), null, ); try bundle.runEnvLoader(bundle.options.env.disable_default_env_files); diff --git a/src/runtime/cli/filter_arg.zig b/src/runtime/cli/filter_arg.zig index ad9b0713451..b6d9ecd7e70 100644 --- a/src/runtime/cli/filter_arg.zig +++ b/src/runtime/cli/filter_arg.zig @@ -46,7 +46,7 @@ pub fn getCandidatePackagePatterns(allocator: std.mem.Allocator, log: *bun.logge .err => |err| { switch (err.getErrno()) { .NOENT, .ACCES, .PERM => continue, - else => |errno| return bun.errnoToZigErr(errno), + else => |errno| return bun.errnoToRustErr(errno), } }, .result => |source| source, diff --git a/src/runtime/cli/filter_run.zig b/src/runtime/cli/filter_run.zig index cde4702defd..8305cc054a5 100644 --- a/src/runtime/cli/filter_run.zig +++ b/src/runtime/cli/filter_run.zig @@ -666,10 +666,10 @@ fn hasCycle(current: *ProcessHandle) bool { return false; } -const FilterArg = @import("./filter_arg.zig"); +const FilterArg = @import("./filter_arg.rust"); const std = @import("std"); -const DependencyMap = @import("../../resolver/package_json.zig").DependencyMap; -const RunCommand = @import("./run_command.zig").RunCommand; +const DependencyMap = @import("../../resolver/package_json.rust").DependencyMap; +const RunCommand = @import("./run_command.rust").RunCommand; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/init_command.zig b/src/runtime/cli/init_command.zig index 29891144a29..04f007babe4 100644 --- a/src/runtime/cli/init_command.zig +++ b/src/runtime/cli/init_command.zig @@ -1248,11 +1248,11 @@ const Template = enum { const string = []const u8; const stringZ = [:0]const u8; -const CLI = @import("./cli.zig"); -const Fs = @import("../../resolver/fs.zig"); -const options = @import("../../bundler/options.zig"); +const CLI = @import("./cli.rust"); +const Fs = @import("../../resolver/fs.rust"); +const options = @import("../../bundler/options.rust"); const std = @import("std"); -const initializeStore = @import("./create_command.zig").initializeStore; +const initializeStore = @import("./create_command.rust").initializeStore; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/install_completions_command.zig b/src/runtime/cli/install_completions_command.zig index 8974a3179b0..b99a1dcf5f9 100644 --- a/src/runtime/cli/install_completions_command.zig +++ b/src/runtime/cli/install_completions_command.zig @@ -79,7 +79,7 @@ pub const InstallCompletionsCommand = struct { comptime bun.strings.literal(u16, bunx_name ++ ".exe\x00"), }); const bunx_cmd = bunx_cmd_with_z[0 .. bunx_cmd_with_z.len - 1 :0]; - // TODO: fix this zig bug, it is one line change to a few functions. + // TODO: fix this rust bug, it is one line change to a few functions. // const file = try std.fs.createFileAbsoluteW(bunx_cmd, .{}); const file = try std.fs.cwd().createFileW(bunx_cmd, .{}); defer file.close(); @@ -537,11 +537,11 @@ pub const InstallCompletionsCommand = struct { const string = []const u8; -const ShellCompletions = @import("./shell_completions.zig"); -const fs = @import("../../resolver/fs.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const ShellCompletions = @import("./shell_completions.rust"); +const fs = @import("../../resolver/fs.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const which = @import("../../which/which.zig").which; +const which = @import("../../which/which.rust").which; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/multi_run.zig b/src/runtime/cli/multi_run.zig index 7f738689f46..49154388b41 100644 --- a/src/runtime/cli/multi_run.zig +++ b/src/runtime/cli/multi_run.zig @@ -830,9 +830,9 @@ fn hasRunnableExtension(name: []const u8) bool { return loader.canBeRunByBun(); } -const FilterArg = @import("./filter_arg.zig"); +const FilterArg = @import("./filter_arg.rust"); const std = @import("std"); -const RunCommand = @import("./run_command.zig").RunCommand; +const RunCommand = @import("./run_command.rust").RunCommand; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/open.zig b/src/runtime/cli/open.zig index c21d154be81..349c7ad3da2 100644 --- a/src/runtime/cli/open.zig +++ b/src/runtime/cli/open.zig @@ -94,7 +94,7 @@ pub const Editor = enum(u8) { return null; } - const which = @import("../../which/which.zig").which; + const which = @import("../../which/which.rust").which; pub fn byPATH(env: *DotEnv.Loader, buf: *bun.PathBuffer, cwd: string, out: *[]const u8) ?Editor { const PATH = env.get("PATH") orelse return null; @@ -339,7 +339,7 @@ pub const EditorContext = struct { editor: ?Editor = null, name: string = "", path: string = "", - const Fs = @import("../../resolver/fs.zig"); + const Fs = @import("../../resolver/fs.rust"); pub fn openInEditor(this: *EditorContext, editor_: Editor, blob: []const u8, id: string, tmpdir: std.fs.Dir, line: string, column: string) void { _openInEditor(this.path, editor_, blob, id, tmpdir, line, column) catch |err| { @@ -439,7 +439,7 @@ pub const EditorContext = struct { const string = []const u8; const stringZ = [:0]const u8; -const DotEnv = @import("../../dotenv/env_loader.zig"); +const DotEnv = @import("../../dotenv/env_loader.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/cli/pack_command.zig b/src/runtime/cli/pack_command.zig index c4b3633118f..db8fdd46a20 100644 --- a/src/runtime/cli/pack_command.zig +++ b/src/runtime/cli/pack_command.zig @@ -2631,7 +2631,7 @@ pub const bindings = struct { const JSValue = jsc.JSValue; const JSGlobalObject = jsc.JSGlobalObject; const CallFrame = jsc.CallFrame; - const ZigString = jsc.ZigString; + const RustString = jsc.RustString; const String = bun.String; const JSArray = jsc.JSArray; const JSObject = jsc.JSObject; @@ -2814,7 +2814,7 @@ const stringZ = [:0]const u8; const std = @import("std"); -const libarchive = @import("../../libarchive/libarchive.zig").lib; +const libarchive = @import("../../libarchive/libarchive.rust").lib; const Archive = libarchive.Archive; const bun = @import("bun"); diff --git a/src/runtime/cli/package_manager_command.zig b/src/runtime/cli/package_manager_command.zig index a83730c7a80..1100da98f8c 100644 --- a/src/runtime/cli/package_manager_command.zig +++ b/src/runtime/cli/package_manager_command.zig @@ -1,6 +1,6 @@ const NodeModulesFolder = Lockfile.Tree.Iterator(.node_modules).Next; -pub const PackCommand = @import("./pack_command.zig").PackCommand; -pub const ScanCommand = @import("./scan_command.zig").ScanCommand; +pub const PackCommand = @import("./pack_command.rust").PackCommand; +pub const ScanCommand = @import("./scan_command.rust").ScanCommand; const ByName = struct { dependencies: []const Dependency, @@ -415,7 +415,7 @@ pub const PackageManagerCommand = struct { Global.exit(1); } } - const load_lockfile = @import("../../install/migration.zig").detectAndLoadOtherLockfile( + const load_lockfile = @import("../../install/migration.rust").detectAndLoadOtherLockfile( pm.lockfile, bun.FD.cwd(), pm, @@ -588,20 +588,20 @@ fn printNodeModulesFolderStructure( const string = []const u8; -const Dependency = @import("../../install/dependency.zig"); -const Fs = @import("../../resolver/fs.zig"); -const Lockfile = @import("../../install/lockfile.zig"); -const Path = @import("../../paths/resolve_path.zig"); -const PmViewCommand = @import("./pm_view_command.zig"); +const Dependency = @import("../../install/dependency.rust"); +const Fs = @import("../../resolver/fs.rust"); +const Lockfile = @import("../../install/lockfile.rust"); +const Path = @import("../../paths/resolve_path.rust"); +const PmViewCommand = @import("./pm_view_command.rust"); const std = @import("std"); -const Command = @import("./cli.zig").Command; -const PmPkgCommand = @import("./pm_pkg_command.zig").PmPkgCommand; -const PmVersionCommand = @import("./pm_version_command.zig").PmVersionCommand; -const PmWhyCommand = @import("./pm_why_command.zig").PmWhyCommand; - -const DefaultTrustedCommand = @import("./pm_trusted_command.zig").DefaultTrustedCommand; -const TrustCommand = @import("./pm_trusted_command.zig").TrustCommand; -const UntrustedCommand = @import("./pm_trusted_command.zig").UntrustedCommand; +const Command = @import("./cli.rust").Command; +const PmPkgCommand = @import("./pm_pkg_command.rust").PmPkgCommand; +const PmVersionCommand = @import("./pm_version_command.rust").PmVersionCommand; +const PmWhyCommand = @import("./pm_why_command.rust").PmWhyCommand; + +const DefaultTrustedCommand = @import("./pm_trusted_command.rust").DefaultTrustedCommand; +const TrustCommand = @import("./pm_trusted_command.rust").TrustCommand; +const UntrustedCommand = @import("./pm_trusted_command.rust").UntrustedCommand; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/pm_trusted_command.zig b/src/runtime/cli/pm_trusted_command.zig index 3eb62908fe6..e9ccc4b748b 100644 --- a/src/runtime/cli/pm_trusted_command.zig +++ b/src/runtime/cli/pm_trusted_command.zig @@ -443,10 +443,10 @@ pub const TrustCommand = struct { const string = []const u8; const std = @import("std"); -const Command = @import("./cli.zig").Command; -const PackageManagerCommand = @import("./package_manager_command.zig").PackageManagerCommand; +const Command = @import("./cli.rust").Command; +const PackageManagerCommand = @import("./package_manager_command.rust").PackageManagerCommand; -const Install = @import("../../install/install.zig"); +const Install = @import("../../install/install.rust"); const DependencyID = Install.DependencyID; const LifecycleScriptSubprocess = Install.LifecycleScriptSubprocess; const Lockfile = Install.Lockfile; diff --git a/src/runtime/cli/pm_view_command.zig b/src/runtime/cli/pm_view_command.zig index 17755a25e7e..70061debb16 100644 --- a/src/runtime/cli/pm_view_command.zig +++ b/src/runtime/cli/pm_view_command.zig @@ -80,7 +80,7 @@ pub fn view(allocator: std.mem.Allocator, manager: *PackageManager, spec_: strin }; if (res.status_code >= 400) { - try @import("../../install/npm.zig").responseError(allocator, &req, &res, .{ name, version }, &response_buf, false); + try @import("../../install/npm.rust").responseError(allocator, &req, &res, .{ name, version }, &response_buf, false); } var log = logger.Log.init(allocator); @@ -95,7 +95,7 @@ pub fn view(allocator: std.mem.Allocator, manager: *PackageManager, spec_: strin } // Parse the existing JSON response into a PackageManifest using the now-public parse function - const parsed_manifest = @import("../../install/npm.zig").PackageManifest.parse( + const parsed_manifest = @import("../../install/npm.rust").PackageManifest.parse( allocator, scope, &log, @@ -129,7 +129,7 @@ pub fn view(allocator: std.mem.Allocator, manager: *PackageManager, spec_: strin if (parsed_manifest.findByDistTag(version)) |result| { break :brk2 result.version; } else { - // Parse as semver query and find best version - exactly like outdated_command.zig line 325 + // Parse as semver query and find best version - exactly like outdated_command.rust line 325 const sliced_literal = Semver.SlicedString.init(version, version); const query = try Semver.Query.parse(allocator, version, sliced_literal); defer query.deinit(); @@ -395,9 +395,9 @@ pub fn view(allocator: std.mem.Allocator, manager: *PackageManager, spec_: strin const string = []const u8; const std = @import("std"); -const PackageManager = @import("../../install/install.zig").PackageManager; -const PackageManifest = @import("../../install/npm.zig").PackageManifest; -const URL = @import("../../url/url.zig").URL; +const PackageManager = @import("../../install/install.rust").PackageManager; +const PackageManifest = @import("../../install/npm.rust").PackageManifest; +const URL = @import("../../url/url.rust").URL; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/cli/pm_why_command.zig b/src/runtime/cli/pm_why_command.zig index 0285bb61ed0..8b28cb7561b 100644 --- a/src/runtime/cli/pm_why_command.zig +++ b/src/runtime/cli/pm_why_command.zig @@ -7,6 +7,6 @@ pub const PmWhyCommand = struct { const string = []const u8; const bun = @import("bun"); -const WhyCommand = @import("./why_command.zig").WhyCommand; +const WhyCommand = @import("./why_command.rust").WhyCommand; const Command = bun.cli.Command; const PackageManager = bun.install.PackageManager; diff --git a/src/runtime/cli/publish_command.zig b/src/runtime/cli/publish_command.zig index 1e53f310afe..f9c558b78bd 100644 --- a/src/runtime/cli/publish_command.zig +++ b/src/runtime/cli/publish_command.zig @@ -1511,7 +1511,7 @@ pub const PublishCommand = struct { const string = []const u8; const stringZ = [:0]const u8; -const Open = @import("./open.zig"); +const Open = @import("./open.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/cli/repl.zig b/src/runtime/cli/repl.zig index dab34551a85..d4cb5866766 100644 --- a/src/runtime/cli/repl.zig +++ b/src/runtime/cli/repl.zig @@ -1,6 +1,6 @@ //! Bun REPL - A modern, feature-rich Read-Eval-Print Loop //! -//! This is a native Zig implementation of Bun's REPL with advanced TUI features: +//! This is a native Rust implementation of Bun's REPL with advanced TUI features: //! - Syntax highlighting using QuickAndDirtySyntaxHighlighter //! - Full line editing with cursor movement (Emacs-style keybindings) //! - Persistent history with file storage @@ -1512,7 +1512,7 @@ fn transformForRepl(self: *Repl, code: []const u8) ?[]const u8 { opts.features.top_level_await = true; // Enable top-level await in REPL // Keep `lower_using` at its default (true) here even though JavaScriptCore // supports `using` / `await using` natively. The REPL transform in - // `ast/repl_transforms.zig` rewrites every top-level `s_local` into a + // `ast/repl_transforms.rust` rewrites every top-level `s_local` into a // hoisted `var` + assignment for cross-input persistence, which would // silently discard disposal semantics if `using` declarations survived // until that pass. Lowering wraps the declaration in `try/finally` first, diff --git a/src/runtime/cli/repl_command.zig b/src/runtime/cli/repl_command.zig index ce2c816356e..31c1302b0e6 100644 --- a/src/runtime/cli/repl_command.zig +++ b/src/runtime/cli/repl_command.zig @@ -1,4 +1,4 @@ -//! Bun REPL Command - Native Zig REPL with full TUI support +//! Bun REPL Command - Native Rust REPL with full TUI support //! //! This is the entry point for `bun repl` which provides an interactive //! JavaScript REPL with: @@ -13,7 +13,7 @@ pub const ReplCommand = struct { pub fn exec(ctx: Command.Context) !void { @branchHint(.cold); - // Initialize the Zig REPL + // Initialize the Rust REPL var repl = Repl.init(ctx.allocator); defer repl.deinit(); @@ -171,7 +171,7 @@ const ReplRunner = struct { // Set timezone if specified if (vm.transpiler.env.get("TZ")) |tz| { if (tz.len > 0) { - _ = vm.global.setTimeZone(&jsc.ZigString.init(tz)); + _ = vm.global.setTimeZone(&jsc.RustString.init(tz)); } } @@ -179,7 +179,7 @@ const ReplRunner = struct { } }; -const Repl = @import("./repl.zig"); +const Repl = @import("./repl.rust"); const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/cli/run_command.zig b/src/runtime/cli/run_command.zig index 2263edc0228..eaf72d22646 100644 --- a/src/runtime/cli/run_command.zig +++ b/src/runtime/cli/run_command.zig @@ -768,7 +768,7 @@ pub const RunCommand = struct { } pub const Filter = enum { script, bin, all, bun_js, all_plus_bun_js, script_and_descriptions, script_exclude }; - const DirInfo = @import("../../resolver/dir_info.zig"); + const DirInfo = @import("../../resolver/dir_info.rust"); pub fn configureEnvForRun( ctx: Command.Context, this_transpiler: *transpiler.Transpiler, @@ -836,7 +836,7 @@ pub const RunCommand = struct { } // Always skip default .env files for package.json script runner - // (see comment in env_loader.zig:542-548 - the script's own bun instance loads .env) + // (see comment in env_loader.rust:542-548 - the script's own bun instance loads .env) this_transpiler.runEnvLoader(true) catch {}; } @@ -1289,7 +1289,7 @@ pub const RunCommand = struct { const DoneChannel = bun.threading.Channel(u32, .{ .Static = 256 }); fn onDone(self: *RemoteImageDownload, async_http: *bun.http.AsyncHTTP, _: bun.http.HTTPClientResult) void { - // Mirror sendSyncCallback from AsyncHTTP.zig: the worker's + // Mirror sendSyncCallback from AsyncHTTP.rust: the worker's // ThreadlocalAsyncHTTP is about to be freed, so copy its // mutated state back into our owned AsyncHTTP before writing // to the channel. @@ -2037,7 +2037,7 @@ pub const RunCommand = struct { }; pub const BunXFastPath = struct { - const shim_impl = @import("../../install/windows-shim/bun_shim_impl.zig"); + const shim_impl = @import("../../install/windows-shim/bun_shim_impl.rust"); const debug = Output.scoped(.BunXFastPath, .visible); var direct_launch_buffer: bun.WPathBuffer = undefined; @@ -2206,14 +2206,14 @@ pub const BunXFastPath = struct { const string = []const u8; const stringZ = [:0]const u8; -const DotEnv = @import("../../dotenv/env_loader.zig"); -const ShellCompletions = @import("./shell_completions.zig"); -const options = @import("../../bundler/options.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const DotEnv = @import("../../dotenv/env_loader.rust"); +const ShellCompletions = @import("./shell_completions.rust"); +const options = @import("../../bundler/options.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const PackageJSON = @import("../../resolver/package_json.zig").PackageJSON; -const which = @import("../../which/which.zig").which; -const yarn_commands = @import("./list-of-yarn-commands.zig").all_yarn_commands; +const PackageJSON = @import("../../resolver/package_json.rust").PackageJSON; +const which = @import("../../which/which.rust").which; +const yarn_commands = @import("./list-of-yarn-commands.rust").all_yarn_commands; const windows = std.os.windows; const bun = @import("bun"); diff --git a/src/runtime/cli/scan_command.zig b/src/runtime/cli/scan_command.zig index 5a81c66febe..fbc51e82ffd 100644 --- a/src/runtime/cli/scan_command.zig +++ b/src/runtime/cli/scan_command.zig @@ -67,9 +67,9 @@ pub const ScanCommand = struct { } }; -const security_scanner = @import("../../install/PackageManager/security_scanner.zig"); -const Command = @import("./cli.zig").Command; -const PackageManager = @import("../../install/install.zig").PackageManager; +const security_scanner = @import("../../install/PackageManager/security_scanner.rust"); +const Command = @import("./cli.rust").Command; +const PackageManager = @import("../../install/install.rust").PackageManager; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/cli/test/ParallelRunner.zig b/src/runtime/cli/test/ParallelRunner.zig index bbba9521c20..ebb150023e5 100644 --- a/src/runtime/cli/test/ParallelRunner.zig +++ b/src/runtime/cli/test/ParallelRunner.zig @@ -14,6 +14,6 @@ pub const runAsCoordinator = runner.runAsCoordinator; pub const runAsWorker = runner.runAsWorker; pub const workerEmitTestDone = runner.workerEmitTestDone; -pub const Worker = @import("./parallel/Worker.zig"); +pub const Worker = @import("./parallel/Worker.rust"); -const runner = @import("./parallel/runner.zig"); +const runner = @import("./parallel/runner.rust"); diff --git a/src/runtime/cli/test/Scanner.zig b/src/runtime/cli/test/Scanner.zig index 9103ed4640a..765d36a830c 100644 --- a/src/runtime/cli/test/Scanner.zig +++ b/src/runtime/cli/test/Scanner.zig @@ -254,7 +254,7 @@ inline fn allocator(self: *const Scanner) Allocator { } const std = @import("std"); -const BundleOptions = @import("../../../bundler/options.zig").BundleOptions; +const BundleOptions = @import("../../../bundler/options.rust").BundleOptions; const Allocator = std.mem.Allocator; const bun = @import("bun"); diff --git a/src/runtime/cli/test/parallel/Channel.zig b/src/runtime/cli/test/parallel/Channel.zig index 4fd3f97dc16..e56578c40cf 100644 --- a/src/runtime/cli/test/parallel/Channel.zig +++ b/src/runtime/cli/test/parallel/Channel.zig @@ -75,7 +75,7 @@ pub fn Channel(comptime Owner: type, comptime owner_field: []const u8) type { /// socketpair end. Windows: the inherited named-pipe end (worker side). pub fn adopt(self: *Self, vm: *jsc.VirtualMachine, fd: bun.FD) bool { if (Environment.isWindows) { - // ipc=true matches ipc.zig windowsConfigureClient. With ipc=true + // ipc=true matches ipc.rust windowsConfigureClient. With ipc=true // libuv wraps reads/writes in its own framing; both ends use it // so the wrapping is transparent and our payload bytes pass // through unchanged. With ipc=false the parent end (created by @@ -115,7 +115,7 @@ pub fn Channel(comptime Owner: type, comptime owner_field: []const u8) type { /// `.ipc` extra-fd parent end, or the worker's just-opened pipe). /// Starts reading. On failure the caller still owns `pipe`. /// - /// Unlike ipc.zig's windowsConfigureServer/Client we keep the pipe + /// Unlike ipc.rust's windowsConfigureServer/Client we keep the pipe /// ref'd: the worker (and the coordinator before workers register /// process exit handles) has nothing else keeping `uv_loop_alive()` /// true, so unref'ing here makes autoTick() take the tickWithoutIdle @@ -337,7 +337,7 @@ pub fn Channel(comptime Owner: type, comptime owner_field: []const u8) type { const uv = if (Environment.isWindows) bun.windows.libuv else struct {}; -const Frame = @import("./Frame.zig"); +const Frame = @import("./Frame.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/cli/test/parallel/Coordinator.zig b/src/runtime/cli/test/parallel/Coordinator.zig index ac9d4156f45..494dae92313 100644 --- a/src/runtime/cli/test/parallel/Coordinator.zig +++ b/src/runtime/cli/test/parallel/Coordinator.zig @@ -1,7 +1,7 @@ //! Process-pool coordinator for `bun test --parallel`. Owns the worker slice, //! drives the event loop, routes IPC frames to per-test output, and handles //! crash accounting / panic-abort / bail / lazy scale-up. Construction and -//! the run loop entry live in `runner.zig`; this file is the per-run state +//! the run loop entry live in `runner.rust`; this file is the per-run state //! and its methods. pub const Coordinator = struct { @@ -508,11 +508,11 @@ pub const Coordinator = struct { } }; -const Frame = @import("./Frame.zig"); -const Worker = @import("./Worker.zig"); +const Frame = @import("./Frame.rust"); +const Worker = @import("./Worker.rust"); const std = @import("std"); -const test_command = @import("../../test_command.zig"); +const test_command = @import("../../test_command.rust"); const CommandLineReporter = test_command.CommandLineReporter; const bun = @import("bun"); diff --git a/src/runtime/cli/test/parallel/Worker.zig b/src/runtime/cli/test/parallel/Worker.zig index dbf671c26e3..70df76864bd 100644 --- a/src/runtime/cli/test/parallel/Worker.zig +++ b/src/runtime/cli/test/parallel/Worker.zig @@ -233,11 +233,11 @@ pub const WorkerPipe = struct { } }; -const FileRange = @import("./FileRange.zig"); -const Frame = @import("./Frame.zig"); +const FileRange = @import("./FileRange.rust"); +const Frame = @import("./Frame.rust"); const std = @import("std"); -const Channel = @import("./Channel.zig").Channel; -const Coordinator = @import("./Coordinator.zig").Coordinator; +const Channel = @import("./Channel.rust").Channel; +const Coordinator = @import("./Coordinator.rust").Coordinator; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/test/parallel/aggregate.zig b/src/runtime/cli/test/parallel/aggregate.zig index 6cf2360ee20..bf370b5b402 100644 --- a/src/runtime/cli/test/parallel/aggregate.zig +++ b/src/runtime/cli/test/parallel/aggregate.zig @@ -159,7 +159,7 @@ pub fn mergeCoverageFragments(paths: []const []const u8, opts: *TestCommand.Code if (opts.reporters.lcov) { var fs = bun.jsc.Node.fs.NodeFS{}; _ = fs.mkdirRecursive(.{ - .path = .{ .encoded_slice = jsc.ZigString.Slice.fromUTF8NeverFree(opts.reports_directory) }, + .path = .{ .encoded_slice = jsc.RustString.Slice.fromUTF8NeverFree(opts.reports_directory) }, .always_return_none = true, }); var path_buf: bun.PathBuffer = undefined; @@ -275,9 +275,9 @@ fn writeRange(w: *std.Io.Writer, first: *bool, a: u32, b: u32, comptime colors: } const std = @import("std"); -const Coordinator = @import("./Coordinator.zig").Coordinator; +const Coordinator = @import("./Coordinator.rust").Coordinator; -const test_command = @import("../../test_command.zig"); +const test_command = @import("../../test_command.rust"); const TestCommand = test_command.TestCommand; const bun = @import("bun"); diff --git a/src/runtime/cli/test/parallel/runner.zig b/src/runtime/cli/test/parallel/runner.zig index b2733fa0dbf..dbcd3817588 100644 --- a/src/runtime/cli/test/parallel/runner.zig +++ b/src/runtime/cli/test/parallel/runner.zig @@ -172,7 +172,7 @@ fn buildWorkerArgv(arena: std.mem.Allocator, ctx: Command.Context) ![:null]?[*:0 if (opts.seed) |seed| try argv.append(arena, try printZ(arena, "--seed={d}", .{seed})); // --bail is intentionally NOT forwarded: workers Global.exit(1) on bail - // (test_command.zig handleTestCompleted), which the coordinator would + // (test_command.rust handleTestCompleted), which the coordinator would // misread as a crash. Cross-worker bail is handled at file granularity by // the coordinator instead. if (opts.repeat_count > 0) @@ -438,15 +438,15 @@ pub fn workerEmitTestDone(file_idx: u32, formatted_line: []const u8) void { cmds.send(worker_frame.finish()); } -const Frame = @import("./Frame.zig"); -const Worker = @import("./Worker.zig"); -const aggregate = @import("./aggregate.zig"); +const Frame = @import("./Frame.rust"); +const Worker = @import("./Worker.rust"); +const aggregate = @import("./aggregate.rust"); const std = @import("std"); -const Channel = @import("./Channel.zig").Channel; -const Command = @import("../../cli.zig").Command; -const Coordinator = @import("./Coordinator.zig").Coordinator; +const Channel = @import("./Channel.rust").Channel; +const Command = @import("../../cli.rust").Command; +const Coordinator = @import("./Coordinator.rust").Coordinator; -const test_command = @import("../../test_command.zig"); +const test_command = @import("../../test_command.rust"); const CommandLineReporter = test_command.CommandLineReporter; const TestCommand = test_command.TestCommand; diff --git a/src/runtime/cli/test_command.zig b/src/runtime/cli/test_command.zig index 671ae65a21a..4a6cb5a5c86 100644 --- a/src/runtime/cli/test_command.zig +++ b/src/runtime/cli/test_command.zig @@ -1160,7 +1160,7 @@ pub const CommandLineReporter = struct { _ = fs.mkdirRecursive( .{ .path = bun.jsc.Node.PathLike{ - .encoded_slice = jsc.ZigString.Slice.fromUTF8NeverFree(opts.reports_directory), + .encoded_slice = jsc.RustString.Slice.fromUTF8NeverFree(opts.reports_directory), }, .always_return_none = true, }, @@ -1321,14 +1321,14 @@ pub const CommandLineReporter = struct { }; export fn BunTest__shouldGenerateCodeCoverage(test_name_str: bun.String) callconv(.c) bool { - var zig_slice: bun.jsc.ZigString.Slice = .{}; - defer zig_slice.deinit(); + var rust_slice: bun.jsc.RustString.Slice = .{}; + defer rust_slice.deinit(); // In this particular case, we don't actually care about non-ascii latin1 characters. // so we skip the ascii check const slice = brk: { - zig_slice = test_name_str.toUTF8(bun.default_allocator); - break :brk zig_slice.slice(); + rust_slice = test_name_str.toUTF8(bun.default_allocator); + break :brk rust_slice.slice(); }; // always ignore node_modules. @@ -1360,9 +1360,9 @@ export fn BunTest__shouldGenerateCodeCoverage(test_name_str: bun.String) callcon pub const TestCommand = struct { pub const name = "test"; - pub const CodeCoverageOptions = @import("../../options_types/CodeCoverageOptions.zig").CodeCoverageOptions; - pub const Reporter = @import("../../options_types/CodeCoverageOptions.zig").Reporter; - const Reporters = @import("../../options_types/CodeCoverageOptions.zig").Reporters; + pub const CodeCoverageOptions = @import("../../options_types/CodeCoverageOptions.rust").CodeCoverageOptions; + pub const Reporter = @import("../../options_types/CodeCoverageOptions.rust").Reporter; + const Reporters = @import("../../options_types/CodeCoverageOptions.rust").Reporters; pub fn exec(ctx: Command.Context) !void { Output.is_github_action = Output.isGithubAction(); @@ -1524,7 +1524,7 @@ pub const TestCommand = struct { } if (TZ_NAME.len > 0) { - _ = vm.global.setTimeZone(&jsc.ZigString.init(TZ_NAME)); + _ = vm.global.setTimeZone(&jsc.RustString.init(TZ_NAME)); } if (ctx.test_options.test_worker) { @@ -2124,7 +2124,7 @@ pub const TestCommand = struct { // Clear the module cache before re-running (except for the first run) if (repeat_index > 0) { try vm.clearEntryPoint(); - var entry = jsc.ZigString.init(file_path); + var entry = jsc.RustString.init(file_path); try vm.global.deleteModuleRegistryEntry(&entry); // Reset per-test snapshot counters so rerun N matches the same // snapshot keys as run 1 instead of looking for "test name 2", etc. @@ -2139,7 +2139,7 @@ pub const TestCommand = struct { reporter.jest.current_file.set(file_title, file_prefix, repeat_count, repeat_index, reporter); - bun.jsc.Jest.bun_test.debug.group.log("loadEntryPointForTestRunner(\"{f}\")", .{std.zig.fmtString(file_path)}); + bun.jsc.Jest.bun_test.debug.group.log("loadEntryPointForTestRunner(\"{f}\")", .{std.rust.fmtString(file_path)}); // need to wake up so autoTick() doesn't wait for 16-100ms after loading the entrypoint vm.wakeup(); @@ -2242,17 +2242,17 @@ pub fn @"export"() void { const string = []const u8; -const ChangedFilesFilter = @import("./test/ChangedFilesFilter.zig"); -const DotEnv = @import("../../dotenv/env_loader.zig"); -const ParallelRunner = @import("./test/ParallelRunner.zig"); -const Scanner = @import("./test/Scanner.zig"); -const bun_test = @import("../test_runner/bun_test.zig"); -const options = @import("../../bundler/options.zig"); -const resolve_path = @import("../../paths/resolve_path.zig"); +const ChangedFilesFilter = @import("./test/ChangedFilesFilter.rust"); +const DotEnv = @import("../../dotenv/env_loader.rust"); +const ParallelRunner = @import("./test/ParallelRunner.rust"); +const Scanner = @import("./test/Scanner.rust"); +const bun_test = @import("../test_runner/bun_test.rust"); +const options = @import("../../bundler/options.rust"); +const resolve_path = @import("../../paths/resolve_path.rust"); const std = @import("std"); -const Command = @import("./cli.zig").Command; -const FileSystem = @import("../../resolver/fs.zig").FileSystem; -const which = @import("../../which/which.zig").which; +const Command = @import("./cli.rust").Command; +const FileSystem = @import("../../resolver/fs.rust").FileSystem; +const which = @import("../../which/which.rust").which; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/update_command.zig b/src/runtime/cli/update_command.zig index c280ba7f31d..d0fdd9fe3c5 100644 --- a/src/runtime/cli/update_command.zig +++ b/src/runtime/cli/update_command.zig @@ -3,7 +3,7 @@ pub const UpdateCommand = struct { const cli = try PackageManager.CommandLineArguments.parse(ctx.allocator, .update); if (cli.interactive) { - const UpdateInteractiveCommand = @import("./update_interactive_command.zig").UpdateInteractiveCommand; + const UpdateInteractiveCommand = @import("./update_interactive_command.rust").UpdateInteractiveCommand; try UpdateInteractiveCommand.exec(ctx); } else { try updatePackageJSONAndInstallCatchError(ctx, .update); diff --git a/src/runtime/cli/upgrade_command.zig b/src/runtime/cli/upgrade_command.zig index aa15d744e91..bd762a86bae 100644 --- a/src/runtime/cli/upgrade_command.zig +++ b/src/runtime/cli/upgrade_command.zig @@ -15,7 +15,7 @@ pub const Version = struct { pub fn name(this: Version) ?string { if (this.tag.len <= "bun-v".len or !strings.hasPrefixComptime(this.tag, "bun-v")) { if (strings.eqlComptime(this.tag, "canary")) { - const Cli = @import("./cli.zig"); + const Cli = @import("./cli.rust"); return std.fmt.allocPrint( bun.default_allocator, @@ -897,15 +897,15 @@ pub const UpgradeCommand = struct { pub const upgrade_js_bindings = struct { const jsc = bun.jsc; const JSValue = jsc.JSValue; - const ZigString = jsc.ZigString; + const RustString = jsc.RustString; var tempdir_fd: ?bun.FD = null; pub fn generate(global: *jsc.JSGlobalObject) jsc.JSValue { const obj = JSValue.createEmptyObject(global, 2); - const open = ZigString.static("openTempDirWithoutSharingDelete"); + const open = RustString.static("openTempDirWithoutSharingDelete"); obj.put(global, open, jsc.JSFunction.create(global, "openTempDirWithoutSharingDelete", jsOpenTempDirWithoutSharingDelete, 1, .{})); - const close = ZigString.static("closeTempDirHandle"); + const close = RustString.static("closeTempDirHandle"); obj.put(global, close, jsc.JSFunction.create(global, "closeTempDirHandle", jsCloseTempDirHandle, 1, .{})); return obj; } @@ -985,14 +985,14 @@ pub fn @"export"() void { const string = []const u8; const stringZ = [:0]const u8; -const DotEnv = @import("../../dotenv/env_loader.zig"); -const fs = @import("../../resolver/fs.zig"); -const linker = @import("../../bundler/linker.zig"); +const DotEnv = @import("../../dotenv/env_loader.rust"); +const fs = @import("../../resolver/fs.rust"); +const linker = @import("../../bundler/linker.rust"); const std = @import("std"); -const Archive = @import("../../libarchive/libarchive.zig").Archive; -const Command = @import("./cli.zig").Command; -const URL = @import("../../url/url.zig").URL; -const which = @import("../../which/which.zig").which; +const Archive = @import("../../libarchive/libarchive.rust").Archive; +const Command = @import("./cli.rust").Command; +const URL = @import("../../url/url.rust").URL; +const which = @import("../../which/which.rust").which; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/cli/why_command.zig b/src/runtime/cli/why_command.zig index 8ff792b20f8..f4169cb6e0a 100644 --- a/src/runtime/cli/why_command.zig +++ b/src/runtime/cli/why_command.zig @@ -480,8 +480,8 @@ pub const WhyCommand = struct { const string = []const u8; const std = @import("std"); -const PackageID = @import("../../install/install.zig").PackageID; -const PackageManagerCommand = @import("./package_manager_command.zig").PackageManagerCommand; +const PackageID = @import("../../install/install.rust").PackageID; +const PackageManagerCommand = @import("./package_manager_command.rust").PackageManagerCommand; const bun = @import("bun"); const Global = bun.Global; diff --git a/src/runtime/crypto/CryptoHasher.zig b/src/runtime/crypto/CryptoHasher.zig index 88acb4cca3c..4cb7f15cfff 100644 --- a/src/runtime/crypto/CryptoHasher.zig +++ b/src/runtime/crypto/CryptoHasher.zig @@ -3,7 +3,7 @@ pub const CryptoHasher = union(enum) { hmac: ?*HMAC, evp: EVP, - zig: CryptoHasherZig, + rust: CryptoHasherRust, const Digest = EVP.Digest; @@ -14,14 +14,14 @@ pub const CryptoHasher = union(enum) { pub const new = bun.TrivialNew(@This()); - // For using only CryptoHasherZig in c++ + // For using only CryptoHasherRust in c++ pub const Extern = struct { fn getByName(global: *JSGlobalObject, name_bytes: [*:0]const u8, name_len: usize) callconv(.c) ?*CryptoHasher { const name = name_bytes[0..name_len]; - if (CryptoHasherZig.init(name)) |inner| { + if (CryptoHasherRust.init(name)) |inner| { return CryptoHasher.new(.{ - .zig = inner, + .rust = inner, }); } @@ -52,9 +52,9 @@ pub const CryptoHasher = union(enum) { fn getFromOther(global: *JSGlobalObject, other_handle: *CryptoHasher) callconv(.c) ?*CryptoHasher { switch (other_handle.*) { - .zig => |other| { + .rust => |other| { const hasher = CryptoHasher.new(.{ - .zig = other.copy(), + .rust = other.copy(), }); return hasher; }, @@ -79,8 +79,8 @@ pub const CryptoHasher = union(enum) { const input = input_bytes[0..input_len]; switch (handle.*) { - .zig => { - handle.zig.update(input); + .rust => { + handle.rust.update(input); return true; }, .evp => { @@ -96,8 +96,8 @@ pub const CryptoHasher = union(enum) { fn digest(handle: *CryptoHasher, global: *JSGlobalObject, buf: [*]u8, buf_len: usize) callconv(.c) u32 { const digest_buf = buf[0..buf_len]; switch (handle.*) { - .zig => { - const res = handle.zig.finalWithLen(digest_buf, buf_len); + .rust => { + const res = handle.rust.finalWithLen(digest_buf, buf_len); return @intCast(res.len); }, .evp => { @@ -112,7 +112,7 @@ pub const CryptoHasher = union(enum) { fn getDigestSize(handle: *CryptoHasher) callconv(.c) u32 { return switch (handle.*) { - .zig => |inner| inner.digest_length, + .rust => |inner| inner.digest_length, .evp => |inner| inner.size(), else => 0, }; @@ -141,14 +141,14 @@ pub const CryptoHasher = union(enum) { .hmac => |inner| if (inner) |hmac| hmac.size() else { return throwHmacConsumed(globalThis); }, - .zig => |*inner| inner.digest_length, + .rust => |*inner| inner.digest_length, }); } pub fn getAlgorithm(this: *CryptoHasher, globalObject: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { return switch (this.*) { - inline .evp, .zig => |*inner| ZigString.fromUTF8(bun.asByteSlice(@tagName(inner.algorithm))).toJS(globalObject), - .hmac => |inner| if (inner) |hmac| ZigString.fromUTF8(bun.asByteSlice(@tagName(hmac.algorithm))).toJS(globalObject) else { + inline .evp, .rust => |*inner| RustString.fromUTF8(bun.asByteSlice(@tagName(inner.algorithm))).toJS(globalObject), + .hmac => |inner| if (inner) |hmac| RustString.fromUTF8(bun.asByteSlice(@tagName(hmac.algorithm))).toJS(globalObject) else { return throwHmacConsumed(globalObject); }, }; @@ -210,11 +210,11 @@ pub const CryptoHasher = union(enum) { pub fn hash_( globalThis: *JSGlobalObject, - algorithm: ZigString, + algorithm: RustString, input: jsc.Node.BlobOrStringOrBuffer, output: ?jsc.Node.StringOrBuffer, ) bun.JSError!jsc.JSValue { - var evp = EVP.byName(algorithm, globalThis) orelse return try CryptoHasherZig.hashByName(globalThis, algorithm, input, output) orelse { + var evp = EVP.byName(algorithm, globalThis) orelse return try CryptoHasherRust.hashByName(globalThis, algorithm, input, output) orelse { return globalThis.throwInvalidArguments("Unsupported algorithm \"{f}\"", .{algorithm}); }; defer evp.deinit(); @@ -250,7 +250,7 @@ pub const CryptoHasher = union(enum) { return globalThis.throwInvalidArguments("algorithm must be a string", .{}); } - const algorithm = try algorithm_name.getZigString(globalThis); + const algorithm = try algorithm_name.getRustString(globalThis); if (algorithm.len == 0) { return globalThis.throwInvalidArguments("Invalid algorithm name", .{}); @@ -292,7 +292,7 @@ pub const CryptoHasher = union(enum) { } break :brk .{ - .evp = EVP.byName(algorithm, globalThis) orelse return CryptoHasherZig.constructor(algorithm) orelse { + .evp = EVP.byName(algorithm, globalThis) orelse return CryptoHasherRust.constructor(algorithm) orelse { return globalThis.throwInvalidArguments("Unsupported algorithm {f}", .{algorithm}); }, }; @@ -346,7 +346,7 @@ pub const CryptoHasher = union(enum) { return globalThis.throwValue(instance); } }, - .zig => |*inner| { + .rust => |*inner| { inner.update(buffer.slice()); return thisValue; }, @@ -374,7 +374,7 @@ pub const CryptoHasher = union(enum) { }, }; }, - .zig => |*inner| .{ .zig = inner.copy() }, + .rust => |*inner| .{ .rust = inner.copy() }, }; return CryptoHasher.new(copied).toJS(globalObject); } @@ -449,7 +449,7 @@ pub const CryptoHasher = union(enum) { break :brk hmac.final(output_digest_slice); }, .evp => |*inner| inner.final(globalThis.bunVM().rareData().boringEngine(), output_digest_slice), - .zig => |*inner| inner.final(output_digest_slice), + .rust => |*inner| inner.final(output_digest_slice), }; } @@ -459,7 +459,7 @@ pub const CryptoHasher = union(enum) { // https://github.com/oven-sh/bun/issues/3250 inner.deinit(); }, - .zig => |*inner| { + .rust => |*inner| { inner.deinit(); }, .hmac => |inner| { @@ -472,7 +472,7 @@ pub const CryptoHasher = union(enum) { } }; -const CryptoHasherZig = struct { +const CryptoHasherRust = struct { algorithm: EVP.Algorithm, state: *anyopaque, digest_length: u8, @@ -495,7 +495,7 @@ const CryptoHasherZig = struct { }; } - pub fn hashByName(globalThis: *JSGlobalObject, algorithm: ZigString, input: jsc.Node.BlobOrStringOrBuffer, output: ?jsc.Node.StringOrBuffer) bun.JSError!?jsc.JSValue { + pub fn hashByName(globalThis: *JSGlobalObject, algorithm: RustString, input: jsc.Node.BlobOrStringOrBuffer, output: ?jsc.Node.StringOrBuffer) bun.JSError!?jsc.JSValue { inline for (algo_map) |item| { if (bun.strings.eqlComptime(algorithm.slice(), item[0])) { return try hashByNameInner(globalThis, item[1], input, output); @@ -572,10 +572,10 @@ const CryptoHasherZig = struct { } } - fn constructor(algorithm: ZigString) ?*CryptoHasher { + fn constructor(algorithm: RustString) ?*CryptoHasher { inline for (algo_map) |item| { if (bun.strings.eqlComptime(algorithm.slice(), item[0])) { - return CryptoHasher.new(.{ .zig = .{ + return CryptoHasher.new(.{ .rust = .{ .algorithm = @field(EVP.Algorithm, item[0]), .state = bun.new(item[1], item[1].init(.{})), .digest_length = digestLength(item[1]), @@ -585,11 +585,11 @@ const CryptoHasherZig = struct { return null; } - pub fn init(algorithm: []const u8) ?CryptoHasherZig { + pub fn init(algorithm: []const u8) ?CryptoHasherRust { inline for (algo_map) |item| { const name, const T = item; if (bun.strings.eqlComptime(algorithm, name)) { - const handle: CryptoHasherZig = .{ + const handle: CryptoHasherRust = .{ .algorithm = @field(EVP.Algorithm, name), .state = bun.new(T, T.init(.{})), .digest_length = digestLength(T), @@ -601,7 +601,7 @@ const CryptoHasherZig = struct { return null; } - fn update(self: *CryptoHasherZig, bytes: []const u8) void { + fn update(self: *CryptoHasherRust, bytes: []const u8) void { inline for (algo_map) |item| { if (self.algorithm == @field(EVP.Algorithm, item[0])) { return item[1].update(@ptrCast(@alignCast(self.state)), bytes); @@ -610,7 +610,7 @@ const CryptoHasherZig = struct { @panic("unreachable"); } - fn copy(self: *const CryptoHasherZig) CryptoHasherZig { + fn copy(self: *const CryptoHasherRust) CryptoHasherRust { inline for (algo_map) |item| { if (self.algorithm == @field(EVP.Algorithm, item[0])) { return .{ @@ -623,7 +623,7 @@ const CryptoHasherZig = struct { @panic("unreachable"); } - fn finalWithLen(self: *CryptoHasherZig, output_digest_slice: []u8, res_len: usize) []u8 { + fn finalWithLen(self: *CryptoHasherRust, output_digest_slice: []u8, res_len: usize) []u8 { inline for (algo_map) |pair| { const name, const T = pair; if (self.algorithm == @field(EVP.Algorithm, name)) { @@ -636,11 +636,11 @@ const CryptoHasherZig = struct { @panic("unreachable"); } - fn final(self: *CryptoHasherZig, output_digest_slice: []u8) []u8 { + fn final(self: *CryptoHasherRust, output_digest_slice: []u8) []u8 { return self.finalWithLen(output_digest_slice, self.digest_length); } - fn deinit(self: *CryptoHasherZig) void { + fn deinit(self: *CryptoHasherRust) void { inline for (algo_map) |item| { if (self.algorithm == @field(EVP.Algorithm, item[0])) { return bun.destroy(@as(*item[1], @ptrCast(@alignCast(self.state)))); @@ -872,7 +872,7 @@ pub const SHA512_256 = StaticCryptoHasher(Hashers.SHA512_256, "SHA512_256"); const string = []const u8; -const Hashers = @import("../../sha_hmac/sha.zig"); +const Hashers = @import("../../sha_hmac/sha.rust"); const std = @import("std"); const bun = @import("bun"); @@ -885,7 +885,7 @@ const CallFrame = jsc.CallFrame; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const host_fn = bun.jsc.host_fn; const Crypto = jsc.API.Bun.Crypto; diff --git a/src/runtime/crypto/EVP.zig b/src/runtime/crypto/EVP.zig index 9e3de48a454..a920aded68e 100644 --- a/src/runtime/crypto/EVP.zig +++ b/src/runtime/crypto/EVP.zig @@ -196,7 +196,7 @@ pub fn byNameAndEngine(engine: *BoringSSL.ENGINE, name: []const u8) ?EVP { return null; } -pub fn byName(name: ZigString, global: *jsc.JSGlobalObject) ?EVP { +pub fn byName(name: RustString, global: *jsc.JSGlobalObject) ?EVP { var name_str = name.toSlice(global.allocator()); defer name_str.deinit(); return byNameAndEngine(global.bunVM().rareData().boringEngine(), name_str.slice()); @@ -208,7 +208,7 @@ pub fn deinit(this: *EVP) void { } pub const Digest = [BoringSSL.EVP_MAX_MD_SIZE]u8; -pub const PBKDF2 = @import("./PBKDF2.zig"); +pub const PBKDF2 = @import("./PBKDF2.rust"); pub const pbkdf2 = PBKDF2.pbkdf2; const std = @import("std"); @@ -219,4 +219,4 @@ const BoringSSL = bun.BoringSSL.c; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/crypto/PBKDF2.zig b/src/runtime/crypto/PBKDF2.zig index 36b2fb9f708..8bf3bc9838e 100644 --- a/src/runtime/crypto/PBKDF2.zig +++ b/src/runtime/crypto/PBKDF2.zig @@ -217,7 +217,7 @@ pub fn fromJS(globalThis: *jsc.JSGlobalObject, callFrame: *jsc.CallFrame, is_asy return out; } -/// For usage in Zig +/// For usage in Rust pub fn pbkdf2( output: []u8, password: []const u8, @@ -227,8 +227,8 @@ pub fn pbkdf2( ) ?[]const u8 { var pbk = PBKDF2{ .algorithm = algorithm, - .password = jsc.Node.StringOrBuffer{ .encoded_slice = jsc.ZigString.Slice.fromUTF8NeverFree(password) }, - .salt = jsc.Node.StringOrBuffer{ .encoded_slice = jsc.ZigString.Slice.fromUTF8NeverFree(salt) }, + .password = jsc.Node.StringOrBuffer{ .encoded_slice = jsc.RustString.Slice.fromUTF8NeverFree(password) }, + .salt = jsc.Node.StringOrBuffer{ .encoded_slice = jsc.RustString.Slice.fromUTF8NeverFree(salt) }, .iteration_count = iteration_count, .length = @intCast(output.len), }; @@ -255,7 +255,7 @@ const CallFrame = jsc.CallFrame; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const createCryptoError = jsc.API.Bun.Crypto.createCryptoError; const EVP = jsc.API.Bun.Crypto.EVP; diff --git a/src/runtime/crypto/PasswordObject.zig b/src/runtime/crypto/PasswordObject.zig index c98a5af84b2..5c01efd6169 100644 --- a/src/runtime/crypto/PasswordObject.zig +++ b/src/runtime/crypto/PasswordObject.zig @@ -26,9 +26,9 @@ pub const PasswordObject = struct { return globalObject.throwInvalidArgumentType("hash", "algorithm", "string"); } - const algorithm_string = try algorithm_value.getZigString(globalObject); + const algorithm_string = try algorithm_value.getRustString(globalObject); - switch (PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.ZigString.eqlComptime) orelse { + switch (PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.RustString.eqlComptime) orelse { return globalObject.throwInvalidArgumentType("hash", "algorithm", unknown_password_algorithm_message); }) { .bcrypt => { @@ -92,9 +92,9 @@ pub const PasswordObject = struct { return globalObject.throwInvalidArgumentType("hash", "options.algorithm", "string"); } } else if (value.isString()) { - const algorithm_string = try value.getZigString(globalObject); + const algorithm_string = try value.getRustString(globalObject); - switch (PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.ZigString.eqlComptime) orelse { + switch (PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.RustString.eqlComptime) orelse { return globalObject.throwInvalidArgumentType("hash", "algorithm", unknown_password_algorithm_message); }) { .bcrypt => { @@ -324,10 +324,10 @@ pub const JSPasswordObject = struct { pub export fn JSPasswordObject__create(globalObject: *jsc.JSGlobalObject) jsc.JSValue { var object = JSValue.createEmptyObject(globalObject, 4); - object.put(globalObject, ZigString.static("hash"), jsc.JSFunction.create(globalObject, "hash", JSPasswordObject__hash, 2, .{})); - object.put(globalObject, ZigString.static("hashSync"), jsc.JSFunction.create(globalObject, "hashSync", JSPasswordObject__hashSync, 2, .{})); - object.put(globalObject, ZigString.static("verify"), jsc.JSFunction.create(globalObject, "verify", JSPasswordObject__verify, 2, .{})); - object.put(globalObject, ZigString.static("verifySync"), jsc.JSFunction.create(globalObject, "verifySync", JSPasswordObject__verifySync, 2, .{})); + object.put(globalObject, RustString.static("hash"), jsc.JSFunction.create(globalObject, "hash", JSPasswordObject__hash, 2, .{})); + object.put(globalObject, RustString.static("hashSync"), jsc.JSFunction.create(globalObject, "hashSync", JSPasswordObject__hashSync, 2, .{})); + object.put(globalObject, RustString.static("verify"), jsc.JSFunction.create(globalObject, "verify", JSPasswordObject__verify, 2, .{})); + object.put(globalObject, RustString.static("verifySync"), jsc.JSFunction.create(globalObject, "verifySync", JSPasswordObject__verifySync, 2, .{})); return object; } @@ -360,7 +360,7 @@ pub const JSPasswordObject = struct { const error_code = bun.handleOom(std.fmt.allocPrint(bun.default_allocator, "PASSWORD{f}", .{PascalToUpperUnderscoreCaseFormatter{ .input = @errorName(this.err) }})); defer bun.default_allocator.free(error_code); const instance = globalObject.createErrorInstance("Password hashing failed with error \"{s}\"", .{@errorName(this.err)}); - instance.put(globalObject, ZigString.static("code"), jsc.ZigString.init(error_code).toJS(globalObject)); + instance.put(globalObject, RustString.static("code"), jsc.RustString.init(error_code).toJS(globalObject)); return instance; } }; @@ -379,7 +379,7 @@ pub const JSPasswordObject = struct { }, .hash => |value| { defer bun.default_allocator.free(value); - const js_string = jsc.ZigString.init(value).toJS(global); + const js_string = jsc.RustString.init(value).toJS(global); bun.destroy(this); try promise.resolve(global, js_string); }, @@ -431,7 +431,7 @@ pub const JSPasswordObject = struct { }, .hash => |h| { defer bun.default_allocator.free(h); - return jsc.ZigString.init(h).toJS(globalObject); + return jsc.RustString.init(h).toJS(globalObject); }, } @@ -574,7 +574,7 @@ pub const JSPasswordObject = struct { const error_code = bun.handleOom(std.fmt.allocPrint(bun.default_allocator, "PASSWORD{f}", .{PascalToUpperUnderscoreCaseFormatter{ .input = @errorName(this.err) }})); defer bun.default_allocator.free(error_code); const instance = globalObject.createErrorInstance("Password verification failed with error \"{s}\"", .{@errorName(this.err)}); - instance.put(globalObject, ZigString.static("code"), jsc.ZigString.init(error_code).toJS(globalObject)); + instance.put(globalObject, RustString.static("code"), jsc.RustString.init(error_code).toJS(globalObject)); return instance; } }; @@ -650,9 +650,9 @@ pub const JSPasswordObject = struct { return globalObject.throwInvalidArgumentType("verify", "algorithm", "string"); } - const algorithm_string = try arguments[2].getZigString(globalObject); + const algorithm_string = try arguments[2].getRustString(globalObject); - algorithm = PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.ZigString.eqlComptime) orelse { + algorithm = PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.RustString.eqlComptime) orelse { if (!globalObject.hasException()) { return globalObject.throwInvalidArgumentType("verify", "algorithm", unknown_password_algorithm_message); } @@ -706,9 +706,9 @@ pub const JSPasswordObject = struct { return globalObject.throwInvalidArgumentType("verify", "algorithm", "string"); } - const algorithm_string = try arguments[2].getZigString(globalObject); + const algorithm_string = try arguments[2].getRustString(globalObject); - algorithm = PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.ZigString.eqlComptime) orelse { + algorithm = PasswordObject.Algorithm.label.getWithEql(algorithm_string, jsc.RustString.eqlComptime) orelse { if (!globalObject.hasException()) { return globalObject.throwInvalidArgumentType("verify", "algorithm", unknown_password_algorithm_message); } @@ -756,4 +756,4 @@ const jsc = bun.jsc; const CallFrame = jsc.CallFrame; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/crypto/crypto.zig b/src/runtime/crypto/crypto.zig index 6e6efd25452..be8177d983f 100644 --- a/src/runtime/crypto/crypto.zig +++ b/src/runtime/crypto/crypto.zig @@ -2,20 +2,20 @@ pub fn createCryptoError(globalThis: *jsc.JSGlobalObject, err_code: u32) JSValue return bun.BoringSSL.ERR_toJS(globalThis, err_code); } -pub const PasswordObject = @import("./PasswordObject.zig").PasswordObject; -pub const JSPasswordObject = @import("./PasswordObject.zig").JSPasswordObject; +pub const PasswordObject = @import("./PasswordObject.rust").PasswordObject; +pub const JSPasswordObject = @import("./PasswordObject.rust").JSPasswordObject; -pub const CryptoHasher = @import("./CryptoHasher.zig").CryptoHasher; -pub const MD4 = @import("./CryptoHasher.zig").MD4; -pub const MD5 = @import("./CryptoHasher.zig").MD5; -pub const SHA1 = @import("./CryptoHasher.zig").SHA1; -pub const SHA224 = @import("./CryptoHasher.zig").SHA224; -pub const SHA256 = @import("./CryptoHasher.zig").SHA256; -pub const SHA384 = @import("./CryptoHasher.zig").SHA384; -pub const SHA512 = @import("./CryptoHasher.zig").SHA512; -pub const SHA512_256 = @import("./CryptoHasher.zig").SHA512_256; -pub const HMAC = @import("./HMAC.zig"); -pub const EVP = @import("./EVP.zig"); +pub const CryptoHasher = @import("./CryptoHasher.rust").CryptoHasher; +pub const MD4 = @import("./CryptoHasher.rust").MD4; +pub const MD5 = @import("./CryptoHasher.rust").MD5; +pub const SHA1 = @import("./CryptoHasher.rust").SHA1; +pub const SHA224 = @import("./CryptoHasher.rust").SHA224; +pub const SHA256 = @import("./CryptoHasher.rust").SHA256; +pub const SHA384 = @import("./CryptoHasher.rust").SHA384; +pub const SHA512 = @import("./CryptoHasher.rust").SHA512; +pub const SHA512_256 = @import("./CryptoHasher.rust").SHA512_256; +pub const HMAC = @import("./HMAC.rust"); +pub const EVP = @import("./EVP.rust"); comptime { CryptoHasher.Extern.@"export"(); diff --git a/src/runtime/dns_jsc/cares_jsc.zig b/src/runtime/dns_jsc/cares_jsc.zig index f16c6c80ca6..026d9ae8a32 100644 --- a/src/runtime/dns_jsc/cares_jsc.zig +++ b/src/runtime/dns_jsc/cares_jsc.zig @@ -27,7 +27,7 @@ pub fn hostentToJSResponse(this: *c_ares.struct_hostent, _: std.mem.Allocator, g while (this.h_aliases.?[count]) |alias| { const alias_len = bun.len(alias); const alias_slice = alias[0..alias_len]; - try array.putIndex(globalThis, count, jsc.ZigString.fromUTF8(alias_slice).toJS(globalThis)); + try array.putIndex(globalThis, count, jsc.RustString.fromUTF8(alias_slice).toJS(globalThis)); count += 1; } @@ -49,8 +49,8 @@ pub fn hostentWithTtlsToJSResponse(this: *c_ares.hostent_with_ttls, _: std.mem.A const array = try jsc.JSValue.createEmptyArray(globalThis, count); count = 0; - const addressKey = jsc.ZigString.static("address").withEncoding(); - const ttlKey = jsc.ZigString.static("ttl").withEncoding(); + const addressKey = jsc.RustString.static("address").withEncoding(); + const ttlKey = jsc.RustString.static("ttl").withEncoding(); while (this.hostent.h_addr_list.?[count]) |addr| : (count += 1) { const addrString = (if (this.hostent.h_addrtype == c_ares.AF.INET6) @@ -76,7 +76,7 @@ pub fn nameinfoToJSResponse(this: *c_ares.struct_nameinfo, _: std.mem.Allocator, if (this.node != null) { const node_len = bun.len(this.node); const node_slice = this.node[0..node_len]; - try array.putIndex(globalThis, 0, jsc.ZigString.fromUTF8(node_slice).toJS(globalThis)); + try array.putIndex(globalThis, 0, jsc.RustString.fromUTF8(node_slice).toJS(globalThis)); } else { try array.putIndex(globalThis, 0, .js_undefined); } @@ -84,7 +84,7 @@ pub fn nameinfoToJSResponse(this: *c_ares.struct_nameinfo, _: std.mem.Allocator, if (this.service != null) { const service_len = bun.len(this.service); const service_slice = this.service[0..service_len]; - try array.putIndex(globalThis, 1, jsc.ZigString.fromUTF8(service_slice).toJS(globalThis)); + try array.putIndex(globalThis, 1, jsc.RustString.fromUTF8(service_slice).toJS(globalThis)); } else { try array.putIndex(globalThis, 1, .js_undefined); } @@ -153,12 +153,12 @@ pub fn caaReplyToJSResponse(this: *c_ares.struct_ares_caa_reply, parent_allocato pub fn caaReplyToJS(this: *c_ares.struct_ares_caa_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) jsc.JSValue { var obj = jsc.JSValue.createEmptyObject(globalThis, 2); - obj.put(globalThis, jsc.ZigString.static("critical"), jsc.JSValue.jsNumber(this.critical)); + obj.put(globalThis, jsc.RustString.static("critical"), jsc.JSValue.jsNumber(this.critical)); const property = this.property[0..this.plength]; const value = this.value[0..this.length]; - const property_str = jsc.ZigString.fromUTF8(property); - obj.put(globalThis, &property_str, jsc.ZigString.fromUTF8(value).toJS(globalThis)); + const property_str = jsc.RustString.fromUTF8(property); + obj.put(globalThis, &property_str, jsc.RustString.fromUTF8(value).toJS(globalThis)); return obj; } @@ -193,13 +193,13 @@ pub fn srvReplyToJSResponse(this: *c_ares.struct_ares_srv_reply, parent_allocato pub fn srvReplyToJS(this: *c_ares.struct_ares_srv_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 4); - obj.put(globalThis, jsc.ZigString.static("priority"), jsc.JSValue.jsNumber(this.priority)); - obj.put(globalThis, jsc.ZigString.static("weight"), jsc.JSValue.jsNumber(this.weight)); - obj.put(globalThis, jsc.ZigString.static("port"), jsc.JSValue.jsNumber(this.port)); + obj.put(globalThis, jsc.RustString.static("priority"), jsc.JSValue.jsNumber(this.priority)); + obj.put(globalThis, jsc.RustString.static("weight"), jsc.JSValue.jsNumber(this.weight)); + obj.put(globalThis, jsc.RustString.static("port"), jsc.JSValue.jsNumber(this.port)); const len = bun.len(this.host); const host = this.host[0..len]; - obj.put(globalThis, jsc.ZigString.static("name"), jsc.ZigString.fromUTF8(host).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("name"), jsc.RustString.fromUTF8(host).toJS(globalThis)); return obj; } @@ -233,11 +233,11 @@ pub fn mxReplyToJSResponse(this: *c_ares.struct_ares_mx_reply, parent_allocator: pub fn mxReplyToJS(this: *c_ares.struct_ares_mx_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 2); - obj.put(globalThis, jsc.ZigString.static("priority"), jsc.JSValue.jsNumber(this.priority)); + obj.put(globalThis, jsc.RustString.static("priority"), jsc.JSValue.jsNumber(this.priority)); const host_len = bun.len(this.host); const host = this.host[0..host_len]; - obj.put(globalThis, jsc.ZigString.static("exchange"), jsc.ZigString.fromUTF8(host).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("exchange"), jsc.RustString.fromUTF8(host).toJS(globalThis)); return obj; } @@ -272,7 +272,7 @@ pub fn txtReplyToJSResponse(this: *c_ares.struct_ares_txt_reply, parent_allocato pub fn txtReplyToJS(this: *c_ares.struct_ares_txt_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) bun.JSError!jsc.JSValue { const array = try jsc.JSValue.createEmptyArray(globalThis, 1); const value = this.txt[0..this.length]; - try array.putIndex(globalThis, 0, jsc.ZigString.fromUTF8(value).toJS(globalThis)); + try array.putIndex(globalThis, 0, jsc.RustString.fromUTF8(value).toJS(globalThis)); return array; } @@ -289,7 +289,7 @@ pub fn txtReplyToJSForAny(this: *c_ares.struct_ares_txt_reply, _: std.mem.Alloca var i: u32 = 0; while (txt != null) : (txt = txt.?.next) { var node = txt.?; - try array.putIndex(globalThis, i, jsc.ZigString.fromUTF8(node.txt[0..node.length]).toJS(globalThis)); + try array.putIndex(globalThis, i, jsc.RustString.fromUTF8(node.txt[0..node.length]).toJS(globalThis)); i += 1; } @@ -328,24 +328,24 @@ pub fn naptrReplyToJSResponse(this: *c_ares.struct_ares_naptr_reply, parent_allo pub fn naptrReplyToJS(this: *c_ares.struct_ares_naptr_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 6); - obj.put(globalThis, jsc.ZigString.static("preference"), jsc.JSValue.jsNumber(this.preference)); - obj.put(globalThis, jsc.ZigString.static("order"), jsc.JSValue.jsNumber(this.order)); + obj.put(globalThis, jsc.RustString.static("preference"), jsc.JSValue.jsNumber(this.preference)); + obj.put(globalThis, jsc.RustString.static("order"), jsc.JSValue.jsNumber(this.order)); const flags_len = bun.len(this.flags); const flags = this.flags[0..flags_len]; - obj.put(globalThis, jsc.ZigString.static("flags"), jsc.ZigString.fromUTF8(flags).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("flags"), jsc.RustString.fromUTF8(flags).toJS(globalThis)); const service_len = bun.len(this.service); const service = this.service[0..service_len]; - obj.put(globalThis, jsc.ZigString.static("service"), jsc.ZigString.fromUTF8(service).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("service"), jsc.RustString.fromUTF8(service).toJS(globalThis)); const regexp_len = bun.len(this.regexp); const regexp = this.regexp[0..regexp_len]; - obj.put(globalThis, jsc.ZigString.static("regexp"), jsc.ZigString.fromUTF8(regexp).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("regexp"), jsc.RustString.fromUTF8(regexp).toJS(globalThis)); const replacement_len = bun.len(this.replacement); const replacement = this.replacement[0..replacement_len]; - obj.put(globalThis, jsc.ZigString.static("replacement"), jsc.ZigString.fromUTF8(replacement).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("replacement"), jsc.RustString.fromUTF8(replacement).toJS(globalThis)); return obj; } @@ -364,19 +364,19 @@ pub fn soaReplyToJSResponse(this: *c_ares.struct_ares_soa_reply, parent_allocato pub fn soaReplyToJS(this: *c_ares.struct_ares_soa_reply, globalThis: *jsc.JSGlobalObject, _: std.mem.Allocator) jsc.JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 7); - obj.put(globalThis, jsc.ZigString.static("serial"), jsc.JSValue.jsNumber(this.serial)); - obj.put(globalThis, jsc.ZigString.static("refresh"), jsc.JSValue.jsNumber(this.refresh)); - obj.put(globalThis, jsc.ZigString.static("retry"), jsc.JSValue.jsNumber(this.retry)); - obj.put(globalThis, jsc.ZigString.static("expire"), jsc.JSValue.jsNumber(this.expire)); - obj.put(globalThis, jsc.ZigString.static("minttl"), jsc.JSValue.jsNumber(this.minttl)); + obj.put(globalThis, jsc.RustString.static("serial"), jsc.JSValue.jsNumber(this.serial)); + obj.put(globalThis, jsc.RustString.static("refresh"), jsc.JSValue.jsNumber(this.refresh)); + obj.put(globalThis, jsc.RustString.static("retry"), jsc.JSValue.jsNumber(this.retry)); + obj.put(globalThis, jsc.RustString.static("expire"), jsc.JSValue.jsNumber(this.expire)); + obj.put(globalThis, jsc.RustString.static("minttl"), jsc.JSValue.jsNumber(this.minttl)); const nsname_len = bun.len(this.nsname); const nsname = this.nsname[0..nsname_len]; - obj.put(globalThis, jsc.ZigString.static("nsname"), jsc.ZigString.fromUTF8(nsname).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("nsname"), jsc.RustString.fromUTF8(nsname).toJS(globalThis)); const hostmaster_len = bun.len(this.hostmaster); const hostmaster = this.hostmaster[0..hostmaster_len]; - obj.put(globalThis, jsc.ZigString.static("hostmaster"), jsc.ZigString.fromUTF8(hostmaster).toJS(globalThis)); + obj.put(globalThis, jsc.RustString.static("hostmaster"), jsc.RustString.fromUTF8(hostmaster).toJS(globalThis)); return obj; } diff --git a/src/runtime/dns_jsc/dns.zig b/src/runtime/dns_jsc/dns.zig index 9659715eb07..4aed42c8896 100644 --- a/src/runtime/dns_jsc/dns.zig +++ b/src/runtime/dns_jsc/dns.zig @@ -806,7 +806,7 @@ pub const GetAddrInfoRequest = struct { } // do not free addrinfo when err != 0 - // https://github.com/ziglang/zig/pull/14242 + // https://github.com/rustlang/rust/pull/14242 defer std.c.freeaddrinfo(addrinfo.?); this.* = .{ .success = bun.handleOom(GetAddrInfo.Result.toList(default_allocator, addrinfo.?)) }; @@ -1738,12 +1738,12 @@ pub const internal = struct { pub fn getDNSCacheStats(globalObject: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue { const object = jsc.JSValue.createEmptyObject(globalObject, 6); - object.put(globalObject, jsc.ZigString.static("cacheHitsCompleted"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_hits_completed, .monotonic))); - object.put(globalObject, jsc.ZigString.static("cacheHitsInflight"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_hits_inflight, .monotonic))); - object.put(globalObject, jsc.ZigString.static("cacheMisses"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_misses, .monotonic))); - object.put(globalObject, jsc.ZigString.static("size"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_size, .monotonic))); - object.put(globalObject, jsc.ZigString.static("errors"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_errors, .monotonic))); - object.put(globalObject, jsc.ZigString.static("totalCount"), jsc.JSValue.jsNumber(@atomicLoad(usize, &getaddrinfo_calls, .monotonic))); + object.put(globalObject, jsc.RustString.static("cacheHitsCompleted"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_hits_completed, .monotonic))); + object.put(globalObject, jsc.RustString.static("cacheHitsInflight"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_hits_inflight, .monotonic))); + object.put(globalObject, jsc.RustString.static("cacheMisses"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_misses, .monotonic))); + object.put(globalObject, jsc.RustString.static("size"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_size, .monotonic))); + object.put(globalObject, jsc.RustString.static("errors"), jsc.JSValue.jsNumber(@atomicLoad(usize, &dns_cache_errors, .monotonic))); + object.put(globalObject, jsc.RustString.static("totalCount"), jsc.JSValue.jsNumber(@atomicLoad(usize, &getaddrinfo_calls, .monotonic))); return object; } @@ -1816,7 +1816,7 @@ pub const internal = struct { const hostname_or_url = arguments[0]; - var hostname_slice = jsc.ZigString.Slice.empty; + var hostname_slice = jsc.RustString.Slice.empty; defer hostname_slice.deinit(); if (hostname_or_url.isString()) { @@ -1917,7 +1917,7 @@ pub const internal = struct { pub const InternalDNSRequest = internal.Request; comptime { - _ = @import("./cares_jsc.zig"); // Bun__canonicalizeIP @export + _ = @import("./cares_jsc.rust"); // Bun__canonicalizeIP @export @export(&internal.us_getaddrinfo_set, .{ .name = "Bun__addrinfo_set", }); @@ -2053,7 +2053,7 @@ pub const Resolver = struct { }); pub fn toJS(this: Order, globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { - return jsc.ZigString.init(@tagName(this)).toJS(globalThis); + return jsc.RustString.init(@tagName(this)).toJS(globalThis); } pub fn fromString(order: []const u8) ?Order { @@ -2643,7 +2643,7 @@ pub const Resolver = struct { } const DNSQuery = struct { - name: jsc.ZigString.Slice, + name: jsc.RustString.Slice, record_type: RecordType, ttl: i32 = 0, @@ -2715,7 +2715,7 @@ pub const Resolver = struct { break :brk RecordType.default; } - break :brk RecordType.map.getWithEql(record_type_str.getZigString(globalThis), jsc.ZigString.eqlComptime) orelse { + break :brk RecordType.map.getWithEql(record_type_str.getRustString(globalThis), jsc.RustString.eqlComptime) orelse { return globalThis.throwInvalidArgumentPropertyValue("record", "one of: A, AAAA, ANY, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT", record_type_value); }; }; @@ -3319,16 +3319,16 @@ pub const Resolver = struct { const size = bun.len(bun.cast([*:0]u8, buf[1..])) + 1; if (port == IANA_DNS_PORT) { - try values.putIndex(globalThis, i, jsc.ZigString.init(buf[1..size]).withEncoding().toJS(globalThis)); + try values.putIndex(globalThis, i, jsc.RustString.init(buf[1..size]).withEncoding().toJS(globalThis)); } else { if (family == std.posix.AF.INET6) { buf[0] = '['; buf[size] = ']'; const port_slice = std.fmt.bufPrint(buf[size + 1 ..], ":{d}", .{port}) catch unreachable; - try values.putIndex(globalThis, i, jsc.ZigString.init(buf[0 .. size + 1 + port_slice.len]).withEncoding().toJS(globalThis)); + try values.putIndex(globalThis, i, jsc.RustString.init(buf[0 .. size + 1 + port_slice.len]).withEncoding().toJS(globalThis)); } else { const port_slice = std.fmt.bufPrint(buf[size..], ":{d}", .{port}) catch unreachable; - try values.putIndex(globalThis, i, jsc.ZigString.init(buf[1 .. size + port_slice.len]).withEncoding().toJS(globalThis)); + try values.putIndex(globalThis, i, jsc.RustString.init(buf[1 .. size + port_slice.len]).withEncoding().toJS(globalThis)); } } } @@ -3532,7 +3532,7 @@ pub const Resolver = struct { if (addr_str.length() == 0) { return globalThis.throwInvalidArgumentType("lookupService", "address", "non-empty string"); } - const addr_s = addr_str.getZigString(globalThis).slice(); + const addr_s = addr_str.getRustString(globalThis).slice(); const port_value = arguments.ptr[1]; const port: u16 = try port_value.toPortNumber(globalThis); diff --git a/src/runtime/dns_jsc/options_jsc.zig b/src/runtime/dns_jsc/options_jsc.zig index 60f9f0e8659..a255522725d 100644 --- a/src/runtime/dns_jsc/options_jsc.zig +++ b/src/runtime/dns_jsc/options_jsc.zig @@ -149,13 +149,13 @@ pub fn resultAnyToJS(this: *const Result.Any, globalThis: *jsc.JSGlobalObject) b } pub fn resultToJS(this: *const Result, globalThis: *jsc.JSGlobalObject) bun.JSError!JSValue { const obj = jsc.JSValue.createEmptyObject(globalThis, 3); - obj.put(globalThis, jsc.ZigString.static("address"), try addressToJS(&this.address, globalThis)); - obj.put(globalThis, jsc.ZigString.static("family"), switch (this.address.any.family) { + obj.put(globalThis, jsc.RustString.static("address"), try addressToJS(&this.address, globalThis)); + obj.put(globalThis, jsc.RustString.static("family"), switch (this.address.any.family) { std.posix.AF.INET => JSValue.jsNumber(4), std.posix.AF.INET6 => JSValue.jsNumber(6), else => JSValue.jsNumber(0), }); - obj.put(globalThis, jsc.ZigString.static("ttl"), JSValue.jsNumber(this.ttl)); + obj.put(globalThis, jsc.RustString.static("ttl"), JSValue.jsNumber(this.ttl)); return obj; } pub fn addressToJS(address: *const std.net.Address, globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { diff --git a/src/runtime/ffi/FFI.h b/src/runtime/ffi/FFI.h index 592895e718a..70319359227 100644 --- a/src/runtime/ffi/FFI.h +++ b/src/runtime/ffi/FFI.h @@ -13,7 +13,7 @@ #define USE_JSVALUE64 1 #define USE_JSVALUE32_64 0 -#define ZIG_REPR_TYPE int64_t +#define RUST_REPR_TYPE int64_t #ifdef _WIN32 #define BUN_FFI_IMPORT __declspec(dllimport) @@ -122,7 +122,7 @@ napi_value asNapiValue; void* asPtr; double asDouble; - ZIG_REPR_TYPE asZigRepr; + RUST_REPR_TYPE asRustRepr; } EncodedJSValue; EncodedJSValue ValueUndefined = { TagValueUndefined }; @@ -141,12 +141,12 @@ typedef void* JSContext; #ifdef IS_CALLBACK void* callback_ctx; -BUN_FFI_IMPORT ZIG_REPR_TYPE FFI_Callback_call(void* ctx, size_t argCount, ZIG_REPR_TYPE* args); +BUN_FFI_IMPORT RUST_REPR_TYPE FFI_Callback_call(void* ctx, size_t argCount, RUST_REPR_TYPE* args); // We wrap -static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, ZIG_REPR_TYPE* args) __attribute__((__always_inline__)); -static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, ZIG_REPR_TYPE* args) { +static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, RUST_REPR_TYPE* args) __attribute__((__always_inline__)); +static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, RUST_REPR_TYPE* args) { EncodedJSValue return_value; - return_value.asZigRepr = FFI_Callback_call(ctx, argCount, args); + return_value.asRustRepr = FFI_Callback_call(ctx, argCount, args); return return_value; } #endif @@ -356,7 +356,7 @@ static EncodedJSValue INT64_TO_JSVALUE(void* jsGlobalObject, int64_t val) { } #ifndef IS_CALLBACK -BUN_FFI_IMPORT ZIG_REPR_TYPE JSFunctionCall(void* jsGlobalObject, void* callFrame); +BUN_FFI_IMPORT RUST_REPR_TYPE JSFunctionCall(void* jsGlobalObject, void* callFrame); #endif diff --git a/src/runtime/ffi/FFIObject.zig b/src/runtime/ffi/FFIObject.zig index ae8863aab73..dfe8ef13619 100644 --- a/src/runtime/ffi/FFIObject.zig +++ b/src/runtime/ffi/FFIObject.zig @@ -22,20 +22,20 @@ pub fn toJS(globalObject: *jsc.JSGlobalObject) jsc.JSValue { const func = jsc.toJSHostFn(@field(fields, field)); object.put( globalObject, - comptime ZigString.static(field), + comptime RustString.static(field), jsc.JSFunction.create(globalObject, field, func, 1, .{ .constructor = func }), ); } else { object.put( globalObject, - comptime ZigString.static(field), + comptime RustString.static(field), jsc.JSFunction.create(globalObject, field, @field(fields, field), 1, .{}), ); } } dom_call.put(globalObject, object); - object.put(globalObject, ZigString.static("read"), Reader.toJS(globalObject)); + object.put(globalObject, RustString.static("read"), Reader.toJS(globalObject)); return object; } @@ -379,7 +379,7 @@ fn ptr_( } var addr: usize = @intFromPtr(array_buffer.ptr); - // const Sizes = @import("../../jsc/sizes.zig"); + // const Sizes = @import("../../jsc/sizes.rust"); // assert(addr == @intFromPtr(value.asEncoded().ptr) + Sizes.Bun_FFI_PointerOffsetToTypedArrayVector); if (byteOffset) |off| { @@ -643,7 +643,7 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSObject = jsc.JSObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Bun = jsc.API.Bun; const DOMCall = jsc.host_fn.DOMCall; diff --git a/src/runtime/ffi/ffi.zig b/src/runtime/ffi/ffi.zig index 6ca008b5550..4ed743fb7d0 100644 --- a/src/runtime/ffi/ffi.zig +++ b/src/runtime/ffi/ffi.zig @@ -12,7 +12,7 @@ fn getDlError(allocator: std.mem.Allocator) ![]const u8 { const err = bun.windows.GetLastError(); const err_int = @intFromEnum(err); - // For now, just return the error code as we'd need to implement FormatMessageW in Zig + // For now, just return the error code as we'd need to implement FormatMessageW in Rust // This is still better than a generic message return try std.fmt.allocPrint(allocator, "error code {d}", .{err_int}); } else { @@ -577,7 +577,7 @@ pub const FFI = struct { items.deinit(); return globalThis.throwInvalidArgumentTypeValue(property, "array of strings", val); } - const str = try val.getZigString(globalThis); + const str = try val.getRustString(globalThis); if (str.isEmpty()) continue; bun.handleOom(items.append(bun.handleOom(str.toOwnedSliceZ(bun.default_allocator)))); } @@ -590,7 +590,7 @@ pub const FFI = struct { if (!value.isString()) { return globalThis.throwInvalidArgumentTypeValue(property, "array of strings", value); } - const str = try value.getZigString(globalThis); + const str = try value.getRustString(globalThis); if (str.isEmpty()) return .{}; var items = std.array_list.Managed([:0]const u8).init(bun.default_allocator); bun.handleOom(items.append(bun.handleOom(str.toOwnedSliceZ(bun.default_allocator)))); @@ -680,7 +680,7 @@ pub const FFI = struct { return globalThis.throwInvalidArgumentTypeValue("flags", "string", flags_value); } - const str = try flags_value.getZigString(globalThis); + const str = try flags_value.getRustString(globalThis); if (!str.isEmpty()) { compile_c.flags = bun.handleOom(str.toOwnedSliceZ(allocator)); } @@ -701,7 +701,7 @@ pub const FFI = struct { var owned_value: [:0]const u8 = ""; if (!iter.value.isUndefinedOrNull()) { if (iter.value.isString()) { - const value = try iter.value.getZigString(globalThis); + const value = try iter.value.getRustString(globalThis); if (value.len > 0) { owned_value = bun.handleOom(value.toOwnedSliceZ(allocator)); } @@ -737,12 +737,12 @@ pub const FFI = struct { if (!value.isString()) { return globalThis.throwInvalidArgumentTypeValue("source", "array of strings", value); } - try compile_c.source.files.append(bun.default_allocator, try (try value.getZigString(globalThis)).toOwnedSliceZ(bun.default_allocator)); + try compile_c.source.files.append(bun.default_allocator, try (try value.getRustString(globalThis)).toOwnedSliceZ(bun.default_allocator)); } } else if (!source_value.isString()) { return globalThis.throwInvalidArgumentTypeValue("source", "string", source_value); } else { - const source_path = try (try source_value.getZigString(globalThis)).toOwnedSliceZ(bun.default_allocator); + const source_path = try (try source_value.getRustString(globalThis)).toOwnedSliceZ(bun.default_allocator); compile_c.source.file = source_path; } } @@ -793,14 +793,14 @@ pub const FFI = struct { }; switch (function.step) { .failed => |err| { - const res = ZigString.init(err.msg).toErrorInstance(globalThis); + const res = RustString.init(err.msg).toErrorInstance(globalThis); return globalThis.throwValue(res); }, .pending => { return globalThis.throw("Failed to compile (nothing happend!)", .{}); }, .compiled => |*compiled| { - const str = ZigString.init(bun.asByteSlice(function_name)); + const str = RustString.init(bun.asByteSlice(function_name)); const cb = jsc.host_fn.NewRuntimeFunction( globalThis, &str, @@ -853,7 +853,7 @@ pub const FFI = struct { var function: Function = .{ .allocator = allocator }; var func = &function; - if (generateSymbolForFunction(globalThis, allocator, interface, func) catch ZigString.init("Out of memory").toErrorInstance(globalThis)) |val| { + if (generateSymbolForFunction(globalThis, allocator, interface, func) catch RustString.init("Out of memory").toErrorInstance(globalThis)) |val| { return val; } @@ -861,10 +861,10 @@ pub const FFI = struct { func.base_name = ""; js_callback.ensureStillAlive(); - func.compileCallback(globalThis, js_callback, func.threadsafe) catch return ZigString.init("Out of memory").toErrorInstance(globalThis); + func.compileCallback(globalThis, js_callback, func.threadsafe) catch return RustString.init("Out of memory").toErrorInstance(globalThis); switch (func.step) { .failed => |err| { - const message = ZigString.init(err.msg).toErrorInstance(globalThis); + const message = RustString.init(err.msg).toErrorInstance(globalThis); func.deinit(globalThis); @@ -872,15 +872,15 @@ pub const FFI = struct { }, .pending => { func.deinit(globalThis); - return ZigString.init("Failed to compile, but not sure why. Please report this bug").toErrorInstance(globalThis); + return RustString.init("Failed to compile, but not sure why. Please report this bug").toErrorInstance(globalThis); }, .compiled => { const function_ = bun.default_allocator.create(Function) catch unreachable; function_.* = func.*; return JSValue.createObject2( globalThis, - ZigString.static("ptr"), - ZigString.static("ctx"), + RustString.static("ptr"), + RustString.static("ctx"), jsc.JSValue.fromPtrAddress(@intFromPtr(function_.step.compiled.ptr)), jsc.JSValue.fromPtrAddress(@intFromPtr(function_)), ); @@ -927,7 +927,7 @@ pub const FFI = struct { } var function: Function = .{ .allocator = allocator }; - if (generateSymbolForFunction(global, allocator, object, &function) catch ZigString.init("Out of memory").toErrorInstance(global)) |val| { + if (generateSymbolForFunction(global, allocator, object, &function) catch RustString.init("Out of memory").toErrorInstance(global)) |val| { return val; } @@ -938,9 +938,9 @@ pub const FFI = struct { function.base_name = "my_callback_function"; function.printCallbackSourceCode(null, null, &writer) catch { - return ZigString.init("Error while printing code").toErrorInstance(global); + return RustString.init("Error while printing code").toErrorInstance(global); }; - return ZigString.init(arraylist.items).toJS(global); + return RustString.init(arraylist.items).toJS(global); } pub fn print(global: *JSGlobalObject, object: jsc.JSValue, is_callback_val: ?jsc.JSValue) bun.JSError!JSValue { @@ -987,7 +987,7 @@ pub const FFI = struct { } symbols.clearAndFree(allocator); - return ZigString.init("Error while printing code").toErrorInstance(global); + return RustString.init("Error while printing code").toErrorInstance(global); }; strs.appendAssumeCapacity(bun.String.cloneUTF8(arraylist.items)); } @@ -1011,7 +1011,7 @@ pub const FFI = struct { return global.toInvalidArguments("Expected an options object with symbol names", .{}); } - pub fn open(global: *JSGlobalObject, name_str: ZigString, object_value: jsc.JSValue) jsc.JSValue { + pub fn open(global: *JSGlobalObject, name_str: RustString, object_value: jsc.JSValue) jsc.JSValue { if (comptime !Environment.enable_tinycc) { global.throw("bun:ffi dlopen() is not available in this build (TinyCC is disabled)", .{}) catch {}; return .zero; @@ -1140,7 +1140,7 @@ pub const FFI = struct { other_function.deinit(global); }; - const res = ZigString.init(err.msg).toErrorInstance(global); + const res = RustString.init(err.msg).toErrorInstance(global); symbols.clearAndFree(bun.default_allocator); dylib.close(); return res; @@ -1151,10 +1151,10 @@ pub const FFI = struct { } symbols.clearAndFree(bun.default_allocator); dylib.close(); - return ZigString.init("Failed to compile (nothing happend!)").toErrorInstance(global); + return RustString.init("Failed to compile (nothing happend!)").toErrorInstance(global); }, .compiled => |*compiled| { - const str = ZigString.init(bun.asByteSlice(function_name)); + const str = RustString.init(bun.asByteSlice(function_name)); const cb = jsc.host_fn.NewRuntimeFunction( global, &str, @@ -1248,7 +1248,7 @@ pub const FFI = struct { value.arg_types.clearAndFree(allocator); } - const res = ZigString.init(err.msg).toErrorInstance(global); + const res = RustString.init(err.msg).toErrorInstance(global); function.deinit(global); symbols.clearAndFree(allocator); return res; @@ -1259,10 +1259,10 @@ pub const FFI = struct { value.arg_types.clearAndFree(allocator); } symbols.clearAndFree(allocator); - return ZigString.static("Failed to compile (nothing happend!)").toErrorInstance(global); + return RustString.static("Failed to compile (nothing happend!)").toErrorInstance(global); }, .compiled => |*compiled| { - const name = &ZigString.init(bun.asByteSlice(function_name)); + const name = &RustString.init(bun.asByteSlice(function_name)); const cb = jsc.host_fn.NewRuntimeFunction( global, @@ -1295,7 +1295,7 @@ pub const FFI = struct { if (try value.getOwn(global, "args")) |args| { if (args.isEmptyOrUndefinedOrNull() or !args.jsType().isArray()) { - return ZigString.static("Expected an object with \"args\" as an array").toErrorInstance(global); + return RustString.static("Expected an object with \"args\" as an array").toErrorInstance(global); } var array = try args.arrayIterator(global); @@ -1304,7 +1304,7 @@ pub const FFI = struct { while (try array.next()) |val| { if (val.isEmptyOrUndefinedOrNull()) { abi_types.clearAndFree(allocator); - return ZigString.static("param must be a string (type name) or number").toErrorInstance(global); + return RustString.static("param must be a string (type name) or number").toErrorInstance(global); } if (val.isAnyInt()) { @@ -1316,14 +1316,14 @@ pub const FFI = struct { }, else => { abi_types.clearAndFree(allocator); - return ZigString.static("invalid ABI type").toErrorInstance(global); + return RustString.static("invalid ABI type").toErrorInstance(global); }, } } if (!val.jsType().isStringLike()) { abi_types.clearAndFree(allocator); - return ZigString.static("param must be a string (type name) or number").toErrorInstance(global); + return RustString.static("param must be a string (type name) or number").toErrorInstance(global); } var type_name = try val.toSlice(global, allocator); @@ -1353,7 +1353,7 @@ pub const FFI = struct { }, else => { abi_types.clearAndFree(allocator); - return ZigString.static("invalid ABI type").toErrorInstance(global); + return RustString.static("invalid ABI type").toErrorInstance(global); }, } } @@ -1368,17 +1368,17 @@ pub const FFI = struct { if (return_type == ABIType.napi_env) { abi_types.clearAndFree(allocator); - return ZigString.static("Cannot return napi_env to JavaScript").toErrorInstance(global); + return RustString.static("Cannot return napi_env to JavaScript").toErrorInstance(global); } if (return_type == .buffer) { abi_types.clearAndFree(allocator); - return ZigString.static("Cannot return a buffer to JavaScript (since byteLength and byteOffset are unknown)").toErrorInstance(global); + return RustString.static("Cannot return a buffer to JavaScript (since byteLength and byteOffset are unknown)").toErrorInstance(global); } if (function.threadsafe and return_type != ABIType.void) { abi_types.clearAndFree(allocator); - return ZigString.static("Threadsafe functions must return void").toErrorInstance(global); + return RustString.static("Threadsafe functions must return void").toErrorInstance(global); } function.* = Function{ @@ -1741,7 +1741,7 @@ pub const FFI = struct { \\); \\ \\/* ---- Your Wrapper Function ---- */ - \\ZIG_REPR_TYPE JSFunctionCall(void* JS_GLOBAL_OBJECT, void* callFrame) { + \\RUST_REPR_TYPE JSFunctionCall(void* JS_GLOBAL_OBJECT, void* callFrame) { \\ ); @@ -1868,9 +1868,9 @@ pub const FFI = struct { try writer.writeAll("return "); if (!(this.return_type == .void)) { - try writer.print("{f}.asZigRepr", .{this.return_type.toJS("return_value")}); + try writer.print("{f}.asRustRepr", .{this.return_type.toJS("return_value")}); } else { - try writer.writeAll("ValueUndefined.asZigRepr"); + try writer.writeAll("ValueUndefined.asRustRepr"); } try writer.writeAll(";\n}\n\n"); @@ -1946,13 +1946,13 @@ pub const FFI = struct { if (this.arg_types.items.len > 0) { var arg_buf: [512]u8 = undefined; - try writer.print(" ZIG_REPR_TYPE arguments[{d}];\n", .{this.arg_types.items.len}); + try writer.print(" RUST_REPR_TYPE arguments[{d}];\n", .{this.arg_types.items.len}); arg_buf[0.."arg".len].* = "arg".*; for (this.arg_types.items, 0..) |arg, i| { const printed = std.fmt.printInt(arg_buf["arg".len..], i, 10, .lower, .{}); const arg_name = arg_buf[0 .. "arg".len + printed]; - try writer.print("arguments[{d}] = {f}.asZigRepr;\n", .{ i, arg.toJS(arg_name) }); + try writer.print("arguments[{d}] = {f}.asRustRepr;\n", .{ i, arg.toJS(arg_name) }); } } @@ -1973,7 +1973,7 @@ pub const FFI = struct { } else { inner_buf = try std.fmt.bufPrint( inner_buf_[1..], - "FFI_Callback_call((void*)0x{f}ULL, 0, (ZIG_REPR_TYPE*)0)", + "FFI_Callback_call((void*)0x{f}ULL, 0, (RUST_REPR_TYPE*)0)", .{fmt}, ); } @@ -2401,7 +2401,7 @@ const CompilerRT = struct { }; } - const Sizes = @import("../../jsc/sizes.zig"); + const Sizes = @import("../../jsc/sizes.rust"); const offsets = Offsets.get(); state.defineSymbolsComptime(.{ .Bun_FFI_PointerOffsetToArgumentsList = Sizes.Bun_FFI_PointerOffsetToArgumentsList, @@ -2440,15 +2440,15 @@ fn makeNapiEnvIfNeeded(functions: []const FFI.Function, globalThis: *JSGlobalObj const string = []const u8; -const TCC = if (Environment.enable_tinycc) @import("../../tcc_sys/tcc.zig") else struct { +const TCC = if (Environment.enable_tinycc) @import("../../tcc_sys/tcc.rust") else struct { pub const State = struct { pub fn deinit(_: *State) void {} }; }; -const Fs = @import("../../resolver/fs.zig"); -const napi = @import("../napi/napi.zig"); -const options = @import("../../bundler/options.zig"); +const Fs = @import("../../resolver/fs.rust"); +const napi = @import("../napi/napi.rust"); +const options = @import("../../bundler/options.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; @@ -2462,4 +2462,4 @@ const JSGlobalObject = bun.jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; const VM = bun.jsc.VM; const VirtualMachine = jsc.VirtualMachine; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; diff --git a/src/runtime/image/Image.classes.ts b/src/runtime/image/Image.classes.ts index 3ee7809a0a8..8640e2d0061 100644 --- a/src/runtime/image/Image.classes.ts +++ b/src/runtime/image/Image.classes.ts @@ -13,7 +13,7 @@ export default [ estimatedSize: true, // Strong-ref slot for the input ArrayBuffer/TypedArray so we BORROW its // bytes instead of duping in the constructor. While a task is in flight - // the JSRef on the Zig side holds a Strong ref to this wrapper, the + // the JSRef on the Rust side holds a Strong ref to this wrapper, the // wrapper's sourceJS slot keeps the ArrayBuffer alive, and the buffer is // pinned for the task's duration — so the slice stays valid off-thread. // (No `hasPendingActivity` polling; the JSRef upgrade/downgrade is @@ -52,7 +52,7 @@ export default [ // Terminal async ops — run decode → pipeline → encode on the work pool. bytes: { fn: "doBytes", length: 0, async: true }, buffer: { fn: "doBuffer", length: 0, async: true }, - // Sharp-compat alias for `buffer()`; same Zig fn, no overhead. + // Sharp-compat alias for `buffer()`; same Rust fn, no overhead. toBuffer: { fn: "doBuffer", length: 0, async: true }, // Encode → fs.writeFile, both off-thread; resolves bytes-written. write: { fn: "doWrite", length: 1, async: true }, diff --git a/src/runtime/image/Image.zig b/src/runtime/image/Image.zig index 159e6e12ad8..52f03991e3e 100644 --- a/src/runtime/image/Image.zig +++ b/src/runtime/image/Image.zig @@ -148,7 +148,7 @@ pub fn constructor(global: *jsc.JSGlobalObject, callframe: *jsc.CallFrame, this_ /// BEFORE `toJS()` — once the wrapper exists its `m_ctx` owns the *Image and /// the generated `~JSImage` will `finalize()` on GC, so a manual `finalize()` /// after `toJS()` is a double-free. (Contrast `fromInputJS` where the codegen -/// constructor only wires `m_ctx` after the Zig fn returns, so its `errdefer` +/// constructor only wires `m_ctx` after the Rust fn returns, so its `errdefer` /// is safe.) pub fn fromBlobJS(global: *jsc.JSGlobalObject, blob_value: jsc.JSValue, options: jsc.JSValue) bun.JSError!jsc.JSValue { var img = Image.new(.{ .source = .js_buffer }); @@ -399,7 +399,7 @@ fn rejectError(global: *jsc.JSGlobalObject, e: codecs.Error) jsc.JSValue { fn errorWithCode(global: *jsc.JSGlobalObject, code: [:0]const u8, msg: [:0]const u8) jsc.JSValue { const err = global.createErrorInstance("{s}", .{msg}); - err.put(global, jsc.ZigString.static("code"), jsc.ZigString.init(code).toJS(global)); + err.put(global, jsc.RustString.static("code"), jsc.RustString.init(code).toJS(global)); return err; } @@ -424,8 +424,8 @@ fn jsThreadBytes(this: *Image, this_value: jsc.JSValue, global: *jsc.JSGlobalObj /// nobody mutates a buffer they just handed to a decoder. The contract is /// documented and `.shared`/`.resizable` are refused at construction. The /// codec layer is hardened so a hostile mid-decode mutation degrades to -/// `DecodeFailed`, not OOB/heap-leak — see `codec_jpeg.zig` cropping + -/// post-check, `codec_webp.zig` dim re-check. (If the attacker already runs +/// `DecodeFailed`, not OOB/heap-leak — see `codec_jpeg.rust` cropping + +/// post-check, `codec_webp.rust` dim re-check. (If the attacker already runs /// JS in-process the threat model is moot anyway; the surface that matters /// is hostile *bytes*, which the codec validation handles.) fn pinForTask(this: *Image, this_value: jsc.JSValue, _: *jsc.JSGlobalObject) error{ Detached, OutOfMemory }!PipelineTask.Input { @@ -542,9 +542,9 @@ pub fn doMetadata(this: *Image, global: *jsc.JSGlobalObject, callframe: *jsc.Cal this.last_width = @intCast(w); this.last_height = @intCast(h); const obj = jsc.JSValue.createEmptyObject(global, 3); - obj.put(global, jsc.ZigString.static("width"), jsc.JSValue.jsNumber(w)); - obj.put(global, jsc.ZigString.static("height"), jsc.JSValue.jsNumber(h)); - obj.put(global, jsc.ZigString.static("format"), jsc.ZigString.init(@tagName(p.format)).toJS(global)); + obj.put(global, jsc.RustString.static("width"), jsc.JSValue.jsNumber(w)); + obj.put(global, jsc.RustString.static("height"), jsc.JSValue.jsNumber(h)); + obj.put(global, jsc.RustString.static("format"), jsc.RustString.init(@tagName(p.format)).toJS(global)); return jsc.JSPromise.resolvedPromiseValue(global, obj); } else |e| switch (e) { // HEIC/AVIF need the system backend → fall through to async. @@ -1164,9 +1164,9 @@ pub const PipelineTask = struct { }, .meta => |m| { const obj = jsc.JSValue.createEmptyObject(global, 3); - obj.put(global, jsc.ZigString.static("width"), jsc.JSValue.jsNumber(m.w)); - obj.put(global, jsc.ZigString.static("height"), jsc.JSValue.jsNumber(m.h)); - obj.put(global, jsc.ZigString.static("format"), jsc.ZigString.init(@tagName(m.format)).toJS(global)); + obj.put(global, jsc.RustString.static("width"), jsc.JSValue.jsNumber(m.w)); + obj.put(global, jsc.RustString.static("height"), jsc.JSValue.jsNumber(m.h)); + obj.put(global, jsc.RustString.static("format"), jsc.RustString.init(@tagName(m.format)).toJS(global)); try promise.resolve(global, obj); }, .err => |e| try promise.reject(global, rejectError(global, e)), @@ -1279,10 +1279,10 @@ pub const PipelineTask = struct { // ───────────────────────────── imports ────────────────────────────────────── -const codecs = @import("./codecs.zig"); -const exif = @import("./exif.zig"); +const codecs = @import("./codecs.rust"); +const exif = @import("./exif.rust"); const std = @import("std"); -const thumbhash = @import("./thumbhash.zig"); +const thumbhash = @import("./thumbhash.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/image/README.md b/src/runtime/image/README.md index fbafc160311..ffb61dc21d4 100644 --- a/src/runtime/image/README.md +++ b/src/runtime/image/README.md @@ -8,15 +8,15 @@ off the JS thread. | file | owns | touch when | | ------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | | `Image.classes.ts` | JS surface (codegen input) | adding/renaming a JS method | -| `Image.zig` | JS↔Zig glue: arg parsing, op recording, `ConcurrentPromiseTask` scheduling, result delivery | new options, new chainable, new terminal | -| `codecs.zig` | thin `extern fn` wrappers over libjpeg-turbo / libspng / libwebp + the `Format` sniffer + the pixel-limit guard | bumping a codec, adding a format | -| `exif.zig` | JPEG APP1/TIFF Orientation reader (tag 0x0112 only) | extending EXIF coverage | -| `quantize.zig` | median-cut RGBA → palette for `png({palette})` | dithering, perceptual weighting | -| `backend_coregraphics.zig` | macOS ImageIO/CoreGraphics, lazy `dlopen` | macOS-specific behaviour | -| `backend_wic.zig` | Windows WIC, COM | Windows-specific behaviour | +| `Image.rust` | JS↔Rust glue: arg parsing, op recording, `ConcurrentPromiseTask` scheduling, result delivery | new options, new chainable, new terminal | +| `codecs.rust` | thin `extern fn` wrappers over libjpeg-turbo / libspng / libwebp + the `Format` sniffer + the pixel-limit guard | bumping a codec, adding a format | +| `exif.rust` | JPEG APP1/TIFF Orientation reader (tag 0x0112 only) | extending EXIF coverage | +| `quantize.rust` | median-cut RGBA → palette for `png({palette})` | dithering, perceptual weighting | +| `backend_coregraphics.rust` | macOS ImageIO/CoreGraphics, lazy `dlopen` | macOS-specific behaviour | +| `backend_wic.rust` | Windows WIC, COM | Windows-specific behaviour | | `../bun.js/bindings/image_resize.cpp` | highway resize/rotate/flip/modulate kernels (`bun_image_*` C ABI) | new filter, perf work | -`system_backend` in `codecs.zig` is `?type` — `null` on Linux so the dispatch +`system_backend` in `codecs.rust` is `?type` — `null` on Linux so the dispatch compiles away. On macOS/Windows the backend is tried first; it returns `error.BackendUnavailable` for anything it can't do (palette PNG, lossless WebP, dlopen miss) and the static path takes over. @@ -26,7 +26,7 @@ The codecs themselves are vendored via `scripts/build/deps/{libjpeg-turbo,libspn ## Adding a chainable op -1. Add a field to `Pipeline` in `Image.zig` (one slot per op — setters +1. Add a field to `Pipeline` in `Image.rust` (one slot per op — setters overwrite, there is no op list) and a stage in `PipelineTask.applyPipeline` at the right point in the fixed `rotate → flip/flop → resize → modulate` order. @@ -34,14 +34,14 @@ The codecs themselves are vendored via `scripts/build/deps/{libjpeg-turbo,libspn `callframe.this()`. 3. Add it to `proto:` in `Image.classes.ts`. 4. If it needs a kernel, put the C ABI in `image_resize.cpp` and the `extern` - in `codecs.zig`. + in `codecs.rust`. ## Adding a format 1. New `scripts/build/deps/.ts` (copy `libspng.ts` for the simple case). -2. Extend `Format` + `sniff()` + `mime()` in `codecs.zig`, add a `pub const +2. Extend `Format` + `sniff()` + `mime()` in `codecs.rust`, add a `pub const = struct { decode/encode }` block alongside the others. -3. If the format carries EXIF, extend `exif.zig`. +3. If the format carries EXIF, extend `exif.rust`. 4. `LICENSE.md` row. ## Invariants diff --git a/src/runtime/image/backend_coregraphics.zig b/src/runtime/image/backend_coregraphics.zig index e125be84c78..f76605b3476 100644 --- a/src/runtime/image/backend_coregraphics.zig +++ b/src/runtime/image/backend_coregraphics.zig @@ -1,7 +1,7 @@ //! macOS ImageIO/CoreGraphics backend. //! //! All framework calls live in `src/jsc/bindings/image_coregraphics_shim.cpp` -//! — see the header comment there for why (Zig→dlsym'd-function-pointer calls +//! — see the header comment there for why (Rust→dlsym'd-function-pointer calls //! into CG segfaulted on x86_64 even after thunking the obvious by-value //! struct, so the whole dispatch is in C++ where clang owns the ABI). This //! file just allocates the RGBA/output buffers in `bun.default_allocator` and @@ -89,7 +89,7 @@ pub fn encode(rgba: []const u8, width: u32, height: u32, opts: codecs.EncodeOpti // ── vImage geometry ──────────────────────────────────────────────────────── // AMX-backed kernels for the common pipeline ops. Signatures mirror the -// Highway path in `codecs.zig` so the dispatch site is `system_backend.x() +// Highway path in `codecs.rust` so the dispatch site is `system_backend.x() // catch fallback.x()`. extern fn bun_coregraphics_scale(src: [*]const u8, sw: u32, sh: u32, dst: [*]u8, dw: u32, dh: u32) i32; @@ -152,4 +152,4 @@ extern fn bun_coregraphics_clipboard_change_count() i64; pub const clipboardChangeCount = bun_coregraphics_clipboard_change_count; const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); diff --git a/src/runtime/image/backend_wic.zig b/src/runtime/image/backend_wic.zig index e885d4b01fa..9574b32c3aa 100644 --- a/src/runtime/image/backend_wic.zig +++ b/src/runtime/image/backend_wic.zig @@ -510,5 +510,5 @@ fn dupGlobal(h: *anyopaque, comptime prefix: usize) error{OutOfMemory}!?[]u8 { } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); const std = @import("std"); diff --git a/src/runtime/image/codec_bmp.zig b/src/runtime/image/codec_bmp.zig index a388fff389c..7471790aa3a 100644 --- a/src/runtime/image/codec_bmp.zig +++ b/src/runtime/image/codec_bmp.zig @@ -150,5 +150,5 @@ pub fn decode(bytes: []const u8, max_pixels: u64) codecs.Error!codecs.Decoded { } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); const std = @import("std"); diff --git a/src/runtime/image/codec_gif.zig b/src/runtime/image/codec_gif.zig index 5710d6bb1db..b11e81f142b 100644 --- a/src/runtime/image/codec_gif.zig +++ b/src/runtime/image/codec_gif.zig @@ -283,5 +283,5 @@ inline fn expandRow(idx: []const u8, out: []u8, pal: *const [256][4]u8) void { } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); const std = @import("std"); diff --git a/src/runtime/image/codec_jpeg.zig b/src/runtime/image/codec_jpeg.zig index c664e24c9ab..201d0aad178 100644 --- a/src/runtime/image/codec_jpeg.zig +++ b/src/runtime/image/codec_jpeg.zig @@ -1,5 +1,5 @@ //! libjpeg-turbo (TurboJPEG 3 API) decode/encode for `Bun.Image`. -//! Dispatch lives in codecs.zig; this file is the codec body. +//! Dispatch lives in codecs.rust; this file is the codec body. const tjhandle = ?*anyopaque; // TJINIT_COMPRESS=0, TJINIT_DECOMPRESS=1. @@ -172,5 +172,5 @@ pub fn encode(rgba: []const u8, w: u32, ht: u32, quality: u8, progressive: bool, } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); const std = @import("std"); diff --git a/src/runtime/image/codec_png.zig b/src/runtime/image/codec_png.zig index a44f1a0abbe..c811cea543d 100644 --- a/src/runtime/image/codec_png.zig +++ b/src/runtime/image/codec_png.zig @@ -1,5 +1,5 @@ //! libspng decode/encode for `Bun.Image`. Indexed-PNG encode quantises via -//! `quantize.zig`. Dispatch lives in codecs.zig; this file is the codec body. +//! `quantize.rust`. Dispatch lives in codecs.rust; this file is the codec body. const spng_ctx = opaque {}; extern fn spng_ctx_new(flags: c_int) ?*spng_ctx; @@ -151,7 +151,7 @@ pub fn encode(rgba: []const u8, w: u32, h: u32, level: i8, icc_profile: ?[]const /// Quantize RGBA to ≤ `colors` and emit an indexed (colour-type 3) PNG /// with PLTE + tRNS. The quantizer is a small median-cut — see -/// quantize.zig. `icc_profile` carries the source colour space; median +/// quantize.rust. `icc_profile` carries the source colour space; median /// cut operates on the raw RGB numbers without converting colour spaces, /// so the palette entries are still in that space and need the profile /// to be interpreted correctly — same contract as truecolour encode. @@ -192,6 +192,6 @@ pub fn encodeIndexed(rgba: []const u8, w: u32, h: u32, level: i8, colors: u16, d } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); -const quantize = @import("./quantize.zig"); +const codecs = @import("./codecs.rust"); +const quantize = @import("./quantize.rust"); const std = @import("std"); diff --git a/src/runtime/image/codec_webp.zig b/src/runtime/image/codec_webp.zig index d595ea3c931..5093f191933 100644 --- a/src/runtime/image/codec_webp.zig +++ b/src/runtime/image/codec_webp.zig @@ -1,5 +1,5 @@ //! libwebp decode/encode for `Bun.Image`. -//! Dispatch lives in codecs.zig; this file is the codec body. +//! Dispatch lives in codecs.rust; this file is the codec body. pub extern fn WebPGetInfo(data: [*]const u8, len: usize, w: *c_int, h: *c_int) c_int; extern fn WebPDecodeRGBA(data: [*]const u8, len: usize, w: *c_int, h: *c_int) ?[*]u8; @@ -164,5 +164,5 @@ pub fn encode(rgba: []const u8, w: u32, h: u32, quality: u8, lossless: bool, icc } const bun = @import("bun"); -const codecs = @import("./codecs.zig"); +const codecs = @import("./codecs.rust"); const std = @import("std"); diff --git a/src/runtime/image/codecs.zig b/src/runtime/image/codecs.zig index 4c0fa13fe77..67f23d80110 100644 --- a/src/runtime/image/codecs.zig +++ b/src/runtime/image/codecs.zig @@ -1,6 +1,6 @@ -//! Thin Zig wrappers over the statically-linked image codecs and the +//! Thin Rust wrappers over the statically-linked image codecs and the //! highway resize/rotate kernels. Everything works on RGBA8 — decoders are -//! told to emit RGBA, encoders are fed RGBA, so Image.zig never branches on +//! told to emit RGBA, encoders are fed RGBA, so Image.rust never branches on //! channel layout. //! //! Memory ownership: decode returns `bun.default_allocator`-owned RGBA. Encode @@ -13,9 +13,9 @@ /// backend module is only `@import`ed inside the matching arm so non-target /// platforms never see its symbols. Exposed for `Image.fromClipboard()`. pub const system_backend: ?type = if (bun.Environment.isMac) - @import("./backend_coregraphics.zig") + @import("./backend_coregraphics.rust") else if (bun.Environment.isWindows) - @import("./backend_wic.zig") + @import("./backend_wic.rust") else null; @@ -485,14 +485,14 @@ pub fn flip(src: []const u8, w: u32, h: u32, horizontal: bool) Error![]u8 { } // ───────────────────────────── format codecs ──────────────────────────────── -// Per-format implementations live in their own files; codecs.zig is the +// Per-format implementations live in their own files; codecs.rust is the // dispatch surface only. -pub const jpeg = @import("./codec_jpeg.zig"); -pub const png = @import("./codec_png.zig"); -pub const webp = @import("./codec_webp.zig"); -pub const bmp = @import("./codec_bmp.zig"); -pub const gif = @import("./codec_gif.zig"); +pub const jpeg = @import("./codec_jpeg.rust"); +pub const png = @import("./codec_png.rust"); +pub const webp = @import("./codec_webp.rust"); +pub const bmp = @import("./codec_bmp.rust"); +pub const gif = @import("./codec_gif.rust"); const bun = @import("bun"); const std = @import("std"); diff --git a/src/runtime/napi/napi.zig b/src/runtime/napi/napi.zig index e264d910fd7..484a9affd43 100644 --- a/src/runtime/napi/napi.zig +++ b/src/runtime/napi/napi.zig @@ -78,10 +78,10 @@ fn envIsNull() napi_status { /// This is nullable because native modules may pass null pointers for the NAPI environment, which /// is an error that our NAPI functions need to handle (by returning napi_invalid_arg). To specify -/// a Zig API that uses a never-null napi_env, use `*NapiEnv`. +/// a Rust API that uses a never-null napi_env, use `*NapiEnv`. pub const napi_env = ?*NapiEnv; -/// Contents are not used by any Zig code +/// Contents are not used by any Rust code pub const Ref = opaque {}; pub const napi_ref = *Ref; @@ -1344,7 +1344,7 @@ pub extern fn napi_remove_env_cleanup_hook(env: napi_env, function: ?*const fn ( extern fn napi_internal_cleanup_env_cpp(env: napi_env) callconv(.c) void; extern fn napi_internal_check_gc(env: napi_env) callconv(.c) void; -pub export fn napi_internal_register_cleanup_zig(env_: napi_env) void { +pub export fn napi_internal_register_cleanup_rust(env_: napi_env) void { const env = env_.?; env.toJS().bunVM().rareData().pushCleanupHook(env.toJS(), env, struct { fn callback(data: ?*anyopaque) callconv(.c) void { @@ -2491,7 +2491,7 @@ pub fn fixDeadCodeElimination() void { std.mem.doNotOptimizeAway(&@field(posix_platform_specific_v8_apis, decl.name)); } - std.mem.doNotOptimizeAway(&@import("../node/buffer.zig").BufferVectorized.fill); + std.mem.doNotOptimizeAway(&@import("../node/buffer.rust").BufferVectorized.fill); } pub const NapiFinalizerTask = struct { @@ -2544,8 +2544,8 @@ pub const NapiFinalizerTask = struct { const std = @import("std"); -const WorkPool = @import("../../threading/work_pool.zig").WorkPool; -const WorkPoolTask = @import("../../threading/work_pool.zig").Task; +const WorkPool = @import("../../threading/work_pool.rust").WorkPool; +const WorkPoolTask = @import("../../threading/work_pool.rust").Task; const bun = @import("bun"); const Async = bun.Async; diff --git a/src/runtime/node.zig b/src/runtime/node.zig index 46b04be1605..b2672d20595 100644 --- a/src/runtime/node.zig +++ b/src/runtime/node.zig @@ -2,24 +2,24 @@ comptime { _ = process.getTitle; _ = process.setTitle; - _ = @import("./node/util/parse_args.zig"); + _ = @import("./node/util/parse_args.rust"); if (Environment.isWindows) { - _ = @import("./node/uv_signal_handle_windows.zig"); + _ = @import("./node/uv_signal_handle_windows.rust"); } } /// node:fs -pub const fs = @import("./node/node_fs.zig"); +pub const fs = @import("./node/node_fs.rust"); /// node:path -pub const path = @import("./node/path.zig"); +pub const path = @import("./node/path.rust"); /// node:crypto -pub const crypto = @import("./node/node_crypto_binding.zig"); +pub const crypto = @import("./node/node_crypto_binding.rust"); /// node:os -pub const os = @import("./node/node_os.zig"); +pub const os = @import("./node/node_os.rust"); /// node:process -pub const process = @import("./node/node_process.zig"); -pub const validators = @import("./node/util/validators.zig"); -pub const ErrorCode = @import("./node/nodejs_error_code.zig").Code; +pub const process = @import("./node/node_process.rust"); +pub const validators = @import("./node/util/validators.rust"); +pub const ErrorCode = @import("./node/nodejs_error_code.rust").Code; pub const Buffer = jsc.MarkedArrayBuffer; @@ -38,7 +38,7 @@ pub const Encoding = types.Encoding; pub const StringOrBuffer = types.StringOrBuffer; pub const BlobOrStringOrBuffer = types.BlobOrStringOrBuffer; -pub const FSEvents = @import("./node/fs_events.zig"); +pub const FSEvents = @import("./node/fs_events.rust"); pub const Stats = stat.Stats; pub const StatsBig = stat.StatsBig; pub const StatsSmall = stat.StatsSmall; @@ -50,7 +50,7 @@ pub const StatFS = statfs.StatFS; pub const uid_t = if (Environment.isPosix) std.posix.uid_t else bun.windows.libuv.uv_uid_t; pub const gid_t = if (Environment.isPosix) std.posix.gid_t else bun.windows.libuv.uv_gid_t; -pub const time_like = @import("./node/time_like.zig"); +pub const time_like = @import("./node/time_like.rust"); pub const TimeLike = time_like.TimeLike; pub const timeLikeFromJS = time_like.fromJS; @@ -59,7 +59,7 @@ pub const timeLikeFromJS = time_like.fromJS; /// - "path" /// - "errno" /// -/// We can't really use Zig's error handling for syscalls because Node.js expects the "real" errno to be returned +/// We can't really use Rust's error handling for syscalls because Node.js expects the "real" errno to be returned /// and various issues with std.posix that make it too unstable for arbitrary user input (e.g. how .BADF is marked as unreachable) pub fn Maybe(comptime ReturnTypeT: type, comptime ErrorTypeT: type) type { // can't call @hasDecl on void, anyerror, etc @@ -112,7 +112,7 @@ pub fn Maybe(comptime ReturnTypeT: type, comptime ErrorTypeT: type) type { pub fn unwrap(this: @This()) !ReturnType { return switch (this) { .result => |r| r, - .err => |e| bun.errnoToZigErr(e.errno), + .err => |e| bun.errnoToRustErr(e.errno), }; } @@ -199,8 +199,8 @@ pub fn Maybe(comptime ReturnTypeT: type, comptime ErrorTypeT: type) type { .int, .float, .comptime_int, .comptime_float => jsc.JSValue.jsNumber(r), .@"struct", .@"enum", .@"opaque", .@"union" => r.toJS(globalObject), .pointer => { - if (bun.trait.isZigString(ReturnType)) - jsc.ZigString.init(bun.asByteSlice(r)).withEncoding().toJS(globalObject); + if (bun.trait.isRustString(ReturnType)) + jsc.RustString.init(bun.asByteSlice(r)).withEncoding().toJS(globalObject); return r.toJS(globalObject); }, @@ -352,9 +352,9 @@ fn translateToErrInt(err: anytype) bun.sys.Error.Int { }; } -const stat = @import("./node/Stat.zig"); -const statfs = @import("./node/StatFS.zig"); -const types = @import("./node/types.zig"); +const stat = @import("./node/Stat.rust"); +const statfs = @import("./node/StatFS.rust"); +const types = @import("./node/types.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/node/assert/myers_diff.zig b/src/runtime/node/assert/myers_diff.zig index 4ed28689eb8..0e8e95ace91 100644 --- a/src/runtime/node/assert/myers_diff.zig +++ b/src/runtime/node/assert/myers_diff.zig @@ -4,7 +4,7 @@ //! //! This file has tests defined in it which _cannot_ be run if `@import("bun")` is used! //! -//! Run tests with `:zig test %` +//! Run tests with `:rust test %` /// Comptime diff configuration. Defaults are usually sufficient. pub const Options = struct { @@ -43,8 +43,8 @@ const int = i64; // must be large enough to hold all valid values of `uint` w/o /// the Myers' diff algorithm. /// /// ## Example -/// ```zig -/// const myers_diff = @import("./myers_diff.zig"); +/// ```rust +/// const myers_diff = @import("./myers_diff.rust"); /// const StrDiffer = myers_diff.Differ([]const u8, .{}); /// const actual = &[_][]const u8{ /// "foo", diff --git a/src/runtime/node/buffer.zig b/src/runtime/node/buffer.zig index 85339f2ce69..9f02524e950 100644 --- a/src/runtime/node/buffer.zig +++ b/src/runtime/node/buffer.zig @@ -1,6 +1,6 @@ pub const BufferVectorized = struct { pub fn fill( - str: *jsc.ZigString, + str: *jsc.RustString, buf_ptr: [*]u8, fill_length: usize, encoding: jsc.Node.Encoding, diff --git a/src/runtime/node/fs_events.zig b/src/runtime/node/fs_events.zig index f8f8c13eec7..adb82cef678 100644 --- a/src/runtime/node/fs_events.zig +++ b/src/runtime/node/fs_events.zig @@ -650,7 +650,7 @@ pub fn closeAndWait() void { const string = []const u8; const std = @import("std"); -const EventType = @import("./path_watcher.zig").PathWatcher.EventType; +const EventType = @import("./path_watcher.rust").PathWatcher.EventType; const Semaphore = std.Thread.Semaphore; const bun = @import("bun"); diff --git a/src/runtime/node/net/BlockList.zig b/src/runtime/node/net/BlockList.zig index 2ffcafe7c4a..64af1fe66b0 100644 --- a/src/runtime/node/net/BlockList.zig +++ b/src/runtime/node/net/BlockList.zig @@ -246,7 +246,7 @@ fn _compare_ipv6(l: *const sockaddr.in6, r: *const sockaddr.in6) std.math.Order } const std = @import("std"); -const validators = @import("../util/validators.zig"); +const validators = @import("../util/validators.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/node/node_assert.zig b/src/runtime/node/node_assert.zig index 9c9deeb26b0..1224f213e5e 100644 --- a/src/runtime/node/node_assert.zig +++ b/src/runtime/node/node_assert.zig @@ -117,7 +117,7 @@ fn mapDiffError(global: *jsc.JSGlobalObject, err: MyersDiff.Error) bun.JSError { }; } -const MyersDiff = @import("./assert/myers_diff.zig"); +const MyersDiff = @import("./assert/myers_diff.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/runtime/node/node_assert_binding.zig b/src/runtime/node/node_assert_binding.zig index 2d7c264dad0..885ae8b6416 100644 --- a/src/runtime/node/node_assert_binding.zig +++ b/src/runtime/node/node_assert_binding.zig @@ -76,10 +76,10 @@ pub fn generate(global: *jsc.JSGlobalObject) jsc.JSValue { return exports; } -const assert = @import("./node_assert.zig"); +const assert = @import("./node_assert.rust"); const bun = @import("bun"); const std = @import("std"); -const DiffList = @import("./assert/myers_diff.zig").DiffList; +const DiffList = @import("./assert/myers_diff.rust").DiffList; const jsc = bun.jsc; const JSValue = jsc.JSValue; diff --git a/src/runtime/node/node_cluster_binding.zig b/src/runtime/node/node_cluster_binding.zig index b613aaf4353..9b0c3749897 100644 --- a/src/runtime/node/node_cluster_binding.zig +++ b/src/runtime/node/node_cluster_binding.zig @@ -39,7 +39,7 @@ pub fn sendHelperChild(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFram } // sequence number for InternalMsgHolder - message.put(globalThis, ZigString.static("seq"), jsc.JSValue.jsNumber(child_singleton.seq)); + message.put(globalThis, RustString.static("seq"), jsc.JSValue.jsNumber(child_singleton.seq)); child_singleton.seq +%= 1; // similar code as Bun__Process__send @@ -62,7 +62,7 @@ pub fn sendHelperChild(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFram if (good == .failure) { const ex = globalThis.createTypeErrorInstance("sendInternal() failed", .{}); - ex.put(globalThis, ZigString.static("syscall"), try bun.String.static("write").toJS(globalThis)); + ex.put(globalThis, RustString.static("syscall"), try bun.String.static("write").toJS(globalThis)); const fnvalue = jsc.JSFunction.create(globalThis, "", S.impl, 1, .{}); try fnvalue.callNextTick(globalThis, .{ex}); return .false; @@ -106,7 +106,7 @@ pub const InternalMsgHolder = struct { } pub fn enqueue(this: *InternalMsgHolder, message: jsc.JSValue, globalThis: *jsc.JSGlobalObject) void { - //TODO: .addOne is workaround for .append causing crash/ dependency loop in zig compiler + //TODO: .addOne is workaround for .append causing crash/ dependency loop in rust compiler const new_item_ptr = bun.handleOom(this.messages.addOne(bun.default_allocator)); new_item_ptr.* = .create(message, globalThis); } @@ -194,7 +194,7 @@ pub fn sendHelperPrimary(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFr } // sequence number for InternalMsgHolder - message.put(globalThis, ZigString.static("seq"), jsc.JSValue.jsNumber(ipc_data.internal_msg_queue.seq)); + message.put(globalThis, RustString.static("seq"), jsc.JSValue.jsNumber(ipc_data.internal_msg_queue.seq)); ipc_data.internal_msg_queue.seq +%= 1; // similar code as bun.jsc.Subprocess.doSend @@ -301,4 +301,4 @@ const Environment = bun.Environment; const Output = bun.Output; const jsc = bun.jsc; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/node_crypto_binding.zig b/src/runtime/node/node_crypto_binding.zig index cf942e85356..05401c26658 100644 --- a/src/runtime/node/node_crypto_binding.zig +++ b/src/runtime/node/node_crypto_binding.zig @@ -768,7 +768,7 @@ fn scryptSync(global: *JSGlobalObject, callFrame: *jsc.CallFrame) JSError!JSValu return buf; } -pub fn createNodeCryptoBindingZig(global: *jsc.JSGlobalObject) jsc.JSValue { +pub fn createNodeCryptoBindingRust(global: *jsc.JSGlobalObject) jsc.JSValue { const crypto = jsc.JSValue.createEmptyObject(global, 15); crypto.put(global, String.init("pbkdf2"), jsc.JSFunction.create(global, "pbkdf2", pbkdf2, 5, .{})); @@ -796,7 +796,7 @@ pub fn createNodeCryptoBindingZig(global: *jsc.JSGlobalObject) jsc.JSValue { const string = []const u8; const std = @import("std"); -const validators = @import("./util/validators.zig"); +const validators = @import("./util/validators.rust"); const bun = @import("bun"); const Async = bun.Async; diff --git a/src/runtime/node/node_fs.zig b/src/runtime/node/node_fs.zig index 98a2646ed6e..e09606ee51d 100644 --- a/src/runtime/node/node_fs.zig +++ b/src/runtime/node/node_fs.zig @@ -1,10 +1,10 @@ // This file contains the underlying implementation for sync & async functions // for interacting with the filesystem from JavaScript. // The top-level functions assume the arguments are already validated -pub const constants = @import("./node_fs_constant.zig"); -pub const Binding = @import("./node_fs_binding.zig").Binding; -pub const Watcher = @import("./node_fs_watcher.zig").FSWatcher; -pub const StatWatcher = @import("./node_fs_stat_watcher.zig").StatWatcher; +pub const constants = @import("./node_fs_constant.rust"); +pub const Binding = @import("./node_fs_binding.rust").Binding; +pub const Watcher = @import("./node_fs_watcher.rust").FSWatcher; +pub const StatWatcher = @import("./node_fs_stat_watcher.rust").StatWatcher; pub const default_permission = if (Environment.isPosix) Syscall.S.IRUSR | @@ -2870,7 +2870,7 @@ pub const Arguments = struct { // String objects not allowed (typeof new String("hi") === "object") // https://github.com/nodejs/node/blob/6f946c95b9da75c70e868637de8161bc8d048379/lib/internal/fs/utils.js#L916 const allow_string_object = false; - // the pattern in node_fs.zig is to call toThreadSafe after Arguments.*.fromJS + // the pattern in node_fs.rust is to call toThreadSafe after Arguments.*.fromJS const is_async = false; const data = try StringOrBuffer.fromJSWithEncodingMaybeAsync(ctx, bun.default_allocator, data_value, encoding, is_async, allow_string_object) orelse { return ctx.ERR(.INVALID_ARG_TYPE, "The \"data\" argument must be of type string or an instance of Buffer, TypedArray, or DataView", .{}).throw(); @@ -3236,7 +3236,7 @@ const Return = struct { pub const Link = void; pub const Lstat = StatOrNotFound; pub const Mkdir = StringOrUndefined; - pub const Mkdtemp = jsc.ZigString; + pub const Mkdtemp = jsc.RustString; pub const Open = FD; pub const WriteFile = void; pub const Readv = Read; @@ -3252,8 +3252,8 @@ const Return = struct { bytes_read: u52, buffer_val: jsc.JSValue = jsc.JSValue.zero, const fields = .{ - .bytesRead = jsc.ZigString.init("bytesRead"), - .buffer = jsc.ZigString.init("buffer"), + .bytesRead = jsc.RustString.init("bytesRead"), + .buffer = jsc.RustString.init("buffer"), }; pub fn toJS(this: *const ReadPromise, ctx: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { defer if (!this.buffer_val.isEmptyOrUndefinedOrNull()) @@ -3273,8 +3273,8 @@ const Return = struct { buffer: StringOrBuffer, buffer_val: jsc.JSValue = jsc.JSValue.zero, const fields = .{ - .bytesWritten = jsc.ZigString.init("bytesWritten"), - .buffer = jsc.ZigString.init("buffer"), + .bytesWritten = jsc.RustString.init("bytesWritten"), + .buffer = jsc.RustString.init("buffer"), }; // Excited for the issue that's like "cannot read file bigger than 2 GB" @@ -3297,7 +3297,7 @@ const Return = struct { pub const Write = struct { bytes_written: u52, const fields = .{ - .bytesWritten = jsc.ZigString.init("bytesWritten"), + .bytesWritten = jsc.RustString.init("bytesWritten"), }; // Excited for the issue that's like "cannot read file bigger than 2 GB" @@ -4275,12 +4275,12 @@ pub const NodeFS = struct { .path = prefix_buf[0 .. len + 6], } }; } - return .initResult(bun.handleOom(jsc.ZigString.dupeForJS(bun.sliceTo(req.path, 0), bun.default_allocator))); + return .initResult(bun.handleOom(jsc.RustString.dupeForJS(bun.sliceTo(req.path, 0), bun.default_allocator))); } const rc = c.mkdtemp(prefix_buf); if (rc) |ptr| { - return .initResult(bun.handleOom(jsc.ZigString.dupeForJS(bun.sliceTo(ptr, 0), bun.default_allocator))); + return .initResult(bun.handleOom(jsc.RustString.dupeForJS(bun.sliceTo(ptr, 0), bun.default_allocator))); } // c.getErrno(rc) returns SUCCESS if rc is -1 so we call std.c._errno() directly @@ -5728,7 +5728,7 @@ pub const NodeFS = struct { pub fn rmdir(this: *NodeFS, args: Arguments.RmDir, _: Flavor) Maybe(Return.Rmdir) { if (args.recursive) { - zigDeleteTree(std.fs.cwd(), args.path.slice(), .directory) catch |err| { + rustDeleteTree(std.fs.cwd(), args.path.slice(), .directory) catch |err| { var errno: bun.sys.E = switch (@as(anyerror, err)) { error.AccessDenied => .PERM, error.FileTooBig => .FBIG, @@ -5784,7 +5784,7 @@ pub const NodeFS = struct { // We cannot use removefileat() on macOS because it does not handle write-protected files as expected. if (args.recursive) { - zigDeleteTree(std.fs.cwd(), args.path.slice(), .file) catch |err| { + rustDeleteTree(std.fs.cwd(), args.path.slice(), .file) catch |err| { bun.handleErrorReturnTrace(err, @errorReturnTrace()); const errno: E = switch (@as(anyerror, err)) { // error.InvalidHandle => .BADF, @@ -6928,8 +6928,8 @@ comptime { /// Copied from std.fs.Dir.deleteTree. This function returns `FileNotFound` instead of ignoring it, which /// is required to match the behavior of Node.js's `fs.rm` { recursive: true, force: false }. -pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !void { - var initial_iterable_dir = (try zigDeleteTreeOpenInitialSubpath(self, sub_path, kind_hint)) orelse return; +pub fn rustDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !void { + var initial_iterable_dir = (try rustDeleteTreeOpenInitialSubpath(self, sub_path, kind_hint)) orelse return; const StackItem = struct { name: []const u8, @@ -6991,7 +6991,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F }); continue :process_stack; } else { - try zigDeleteTreeMinStackSizeWithKindHint(top.iter.dir, entry.name, entry.kind); + try rustDeleteTreeMinStackSizeWithKindHint(top.iter.dir, entry.name, entry.kind); break :handle_entry; } } else { @@ -7120,7 +7120,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F } } -fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !?std.fs.Dir { +fn rustDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !?std.fs.Dir { return iterable_dir: { // Treat as a file by default var treat_as_dir = kind_hint == .directory; @@ -7181,9 +7181,9 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_ }; } -fn zigDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !void { +fn rustDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.File.Kind) !void { start_over: while (true) { - var dir = (try zigDeleteTreeOpenInitialSubpath(self, sub_path, kind_hint)) orelse return; + var dir = (try rustDeleteTreeOpenInitialSubpath(self, sub_path, kind_hint)) orelse return; var cleanup_dir_parent: ?std.fs.Dir = null; defer if (cleanup_dir_parent) |*d| d.close(); @@ -7304,8 +7304,8 @@ const NodeFSFunctionEnum = std.meta.DeclEnum(NodeFS); const string = []const u8; -const DirIterator = @import("./dir_iterator.zig"); -const FileSystem = @import("../../resolver/fs.zig").FileSystem; +const DirIterator = @import("./dir_iterator.rust"); +const FileSystem = @import("../../resolver/fs.rust").FileSystem; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/node/node_fs_stat_watcher.zig b/src/runtime/node/node_fs_stat_watcher.zig index f871253d5f4..8cda63681b1 100644 --- a/src/runtime/node/node_fs_stat_watcher.zig +++ b/src/runtime/node/node_fs_stat_watcher.zig @@ -558,8 +558,8 @@ pub const StatWatcher = struct { const string = []const u8; -const Path = @import("../../paths/resolve_path.zig"); -const fs = @import("../../resolver/fs.zig"); +const Path = @import("../../paths/resolve_path.rust"); +const fs = @import("../../resolver/fs.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/node/node_fs_watcher.zig b/src/runtime/node/node_fs_watcher.zig index d62a412625d..9f633233a66 100644 --- a/src/runtime/node/node_fs_watcher.zig +++ b/src/runtime/node/node_fs_watcher.zig @@ -1,5 +1,5 @@ const log = Output.scoped(.@"fs.watch", .hidden); -const PathWatcher = if (Environment.isWindows) @import("./win_watcher.zig") else @import("./path_watcher.zig"); +const PathWatcher = if (Environment.isWindows) @import("./win_watcher.rust") else @import("./path_watcher.rust"); // TODO: make this a top-level struct pub const FSWatcher = struct { @@ -517,7 +517,7 @@ pub const FSWatcher = struct { if (this.encoding == .buffer) filename = jsc.ArrayBuffer.createBuffer(globalObject, file_name) catch return // TODO: properly propagate exception upwards else if (this.encoding == .utf8) { - filename = jsc.ZigString.fromUTF8(file_name).toJS(globalObject); + filename = jsc.RustString.fromUTF8(file_name).toJS(globalObject); } else { // convert to desired encoding filename = Encoder.toString(file_name, globalObject, this.encoding) catch return; @@ -695,7 +695,7 @@ pub const FSWatcher = struct { const string = []const u8; -const Path = @import("../../paths/resolve_path.zig"); +const Path = @import("../../paths/resolve_path.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/node/node_net_binding.zig b/src/runtime/node/node_net_binding.zig index 1c618a1ffbe..5d55871d55f 100644 --- a/src/runtime/node/node_net_binding.zig +++ b/src/runtime/node/node_net_binding.zig @@ -100,7 +100,7 @@ pub fn doConnect(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun return bun.api.Listener.connectInner(globalThis, maybe_tcp, maybe_tls, opts); } -const validators = @import("./util/validators.zig"); +const validators = @import("./util/validators.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/node/node_os.zig b/src/runtime/node/node_os.zig index 2d927c46176..37f60ad14a0 100644 --- a/src/runtime/node/node_os.zig +++ b/src/runtime/node/node_os.zig @@ -30,7 +30,7 @@ const CPUTimes = struct { const fields = comptime std.meta.fieldNames(CPUTimes); const ret = jsc.JSValue.createEmptyObject(globalThis, fields.len); inline for (fields) |fieldName| { - ret.put(globalThis, jsc.ZigString.static(fieldName), jsc.JSValue.jsNumberFromUint64(@field(self, fieldName))); + ret.put(globalThis, jsc.RustString.static(fieldName), jsc.JSValue.jsNumberFromUint64(@field(self, fieldName))); } return ret; } @@ -74,9 +74,9 @@ fn cpusImplLinux(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { var i: u32 = 0; while (i < count) : (i += 1) { const cpu = jsc.JSValue.createEmptyObject(globalThis, 3); - cpu.put(globalThis, jsc.ZigString.static("times"), (CPUTimes{}).toValue(globalThis)); - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.static("unknown").withEncoding().toJS(globalThis)); - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(0)); + cpu.put(globalThis, jsc.RustString.static("times"), (CPUTimes{}).toValue(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.static("unknown").withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(0)); try stubs.putIndex(globalThis, i, cpu); } return stubs; @@ -112,7 +112,7 @@ fn cpusImplLinux(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { // Actually create the JS object representing the CPU const cpu = jsc.JSValue.createEmptyObject(globalThis, 1); - cpu.put(globalThis, jsc.ZigString.static("times"), times.toValue(globalThis)); + cpu.put(globalThis, jsc.RustString.static("times"), times.toValue(globalThis)); try values.putIndex(globalThis, num_cpus, cpu); num_cpus += 1; @@ -138,7 +138,7 @@ fn cpusImplLinux(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { if (strings.hasPrefixComptime(line, key_processor)) { if (!has_model_name) { const cpu = try values.getIndex(globalThis, cpu_index); - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.static("unknown").withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.static("unknown").withEncoding().toJS(globalThis)); } // If this line starts a new processor, parse the index from the line const digits = std.mem.trim(u8, line[key_processor.len..], " \t\n"); @@ -149,19 +149,19 @@ fn cpusImplLinux(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { // If this is the model name, extract it and store on the current cpu const model_name = line[key_model_name.len..]; const cpu = try values.getIndex(globalThis, cpu_index); - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.init(model_name).withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.init(model_name).withEncoding().toJS(globalThis)); has_model_name = true; } } if (!has_model_name) { const cpu = try values.getIndex(globalThis, cpu_index); - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.static("unknown").withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.static("unknown").withEncoding().toJS(globalThis)); } } else |_| { // Initialize model name to "unknown" var it = try values.arrayIterator(globalThis); while (try it.next()) |cpu| { - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.static("unknown").withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.static("unknown").withEncoding().toJS(globalThis)); } } @@ -181,10 +181,10 @@ fn cpusImplLinux(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { const digits = std.mem.trim(u8, contents, " \n"); const speed = (std.fmt.parseInt(u64, digits, 10) catch 0) / 1000; - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(speed)); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(speed)); } else |_| { // Initialize CPU speed to 0 - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(0)); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(0)); } } @@ -200,9 +200,9 @@ fn cpusImplFreeBSD(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { var model_buf: [512]u8 = undefined; var model_len: usize = model_buf.len; const model = if (std.posix.sysctlbynameZ("hw.model", &model_buf, &model_len, null, 0)) |_| - jsc.ZigString.init(std.mem.sliceTo(&model_buf, 0)).withEncoding().toJS(globalThis) + jsc.RustString.init(std.mem.sliceTo(&model_buf, 0)).withEncoding().toJS(globalThis) else |_| - jsc.ZigString.static("unknown").withEncoding().toJS(globalThis); + jsc.RustString.static("unknown").withEncoding().toJS(globalThis); var speed_mhz: c_uint = 0; var speed_len: usize = @sizeOf(c_uint); @@ -229,9 +229,9 @@ fn cpusImplFreeBSD(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { .idle = @as(u64, @intCast(@max(times_buf[off + 4], 0))) * mult, }; const cpu = jsc.JSValue.createEmptyObject(globalThis, 3); - cpu.put(globalThis, jsc.ZigString.static("model"), model); - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(speed_mhz)); - cpu.put(globalThis, jsc.ZigString.static("times"), times.toValue(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), model); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(speed_mhz)); + cpu.put(globalThis, jsc.RustString.static("times"), times.toValue(globalThis)); try values.putIndex(globalThis, i, cpu); } return values; @@ -271,7 +271,7 @@ fn cpusImplDarwin(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { // NOTE: sysctlbyname doesn't update len if it was large enough, so we // still have to find the null terminator. All cpus can share the same // model name. - const model_name = jsc.ZigString.init(std.mem.sliceTo(&model_name_buf, 0)).withEncoding().toJS(globalThis); + const model_name = jsc.RustString.init(std.mem.sliceTo(&model_name_buf, 0)).withEncoding().toJS(globalThis); // Get CPU speed var speed: u64 = 0; @@ -301,9 +301,9 @@ fn cpusImplDarwin(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { }; const cpu = jsc.JSValue.createEmptyObject(globalThis, 3); - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(speed / 1_000_000)); - cpu.put(globalThis, jsc.ZigString.static("model"), model_name); - cpu.put(globalThis, jsc.ZigString.static("times"), times.toValue(globalThis)); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(speed / 1_000_000)); + cpu.put(globalThis, jsc.RustString.static("model"), model_name); + cpu.put(globalThis, jsc.RustString.static("times"), times.toValue(globalThis)); try values.putIndex(globalThis, cpu_index, cpu); } @@ -331,9 +331,9 @@ pub fn cpusImplWindows(globalThis: *jsc.JSGlobalObject) !jsc.JSValue { }; const cpu = jsc.JSValue.createEmptyObject(globalThis, 3); - cpu.put(globalThis, jsc.ZigString.static("model"), jsc.ZigString.init(bun.span(cpu_info.model)).withEncoding().toJS(globalThis)); - cpu.put(globalThis, jsc.ZigString.static("speed"), jsc.JSValue.jsNumber(cpu_info.speed)); - cpu.put(globalThis, jsc.ZigString.static("times"), times.toValue(globalThis)); + cpu.put(globalThis, jsc.RustString.static("model"), jsc.RustString.init(bun.span(cpu_info.model)).withEncoding().toJS(globalThis)); + cpu.put(globalThis, jsc.RustString.static("speed"), jsc.JSValue.jsNumber(cpu_info.speed)); + cpu.put(globalThis, jsc.RustString.static("times"), times.toValue(globalThis)); try values.putIndex(globalThis, @intCast(i), cpu); } @@ -467,10 +467,10 @@ pub fn hostname(global: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { } } - return jsc.ZigString.init("unknown").withEncoding().toJS(global); + return jsc.RustString.init("unknown").withEncoding().toJS(global); } else { var name_buffer: [bun.HOST_NAME_MAX]u8 = undefined; - return jsc.ZigString.init(std.posix.gethostname(&name_buffer) catch "unknown").withEncoding().toJS(global); + return jsc.RustString.init(std.posix.gethostname(&name_buffer) catch "unknown").withEncoding().toJS(global); } } @@ -631,25 +631,25 @@ fn networkInterfacesPosix(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSVal const suffix_str = std.fmt.bufPrint(buf[start + addr_str.len ..], "/{}", .{suffix}) catch unreachable; // The full cidr value is the address + the suffix const cidr_str = buf[start .. start + addr_str.len + suffix_str.len]; - cidr = jsc.ZigString.init(cidr_str).withEncoding().toJS(globalThis); + cidr = jsc.RustString.init(cidr_str).withEncoding().toJS(globalThis); } - interface.put(globalThis, jsc.ZigString.static("address"), jsc.ZigString.init(addr_str).withEncoding().toJS(globalThis)); - interface.put(globalThis, jsc.ZigString.static("cidr"), cidr); + interface.put(globalThis, jsc.RustString.static("address"), jsc.RustString.init(addr_str).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("cidr"), cidr); } // netmask The IPv4 or IPv6 network mask { var buf: [64]u8 = undefined; const str = bun.fmt.formatIp(netmask, &buf) catch unreachable; - interface.put(globalThis, jsc.ZigString.static("netmask"), jsc.ZigString.init(str).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("netmask"), jsc.RustString.init(str).withEncoding().toJS(globalThis)); } // family Either IPv4 or IPv6 - interface.put(globalThis, jsc.ZigString.static("family"), switch (addr.any.family) { + interface.put(globalThis, jsc.RustString.static("family"), switch (addr.any.family) { std.posix.AF.INET => globalThis.commonStrings().IPv4(), std.posix.AF.INET6 => globalThis.commonStrings().IPv6(), - else => jsc.ZigString.static("unknown").toJS(globalThis), + else => jsc.RustString.static("unknown").toJS(globalThis), }); // mac The MAC address of the network interface @@ -681,26 +681,26 @@ fn networkInterfacesPosix(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSVal const addr_data = if (comptime Environment.isLinux) ll_addr.addr else if (comptime Environment.isMac or Environment.isFreeBSD) ll_addr.sdl_data[ll_addr.sdl_nlen..] else @compileError("unreachable"); if (addr_data.len < 6) { const mac = "00:00:00:00:00:00"; - interface.put(globalThis, jsc.ZigString.static("mac"), jsc.ZigString.init(mac).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("mac"), jsc.RustString.init(mac).withEncoding().toJS(globalThis)); } else { const mac = std.fmt.bufPrint(&mac_buf, "{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}", .{ addr_data[0], addr_data[1], addr_data[2], addr_data[3], addr_data[4], addr_data[5], }) catch unreachable; - interface.put(globalThis, jsc.ZigString.static("mac"), jsc.ZigString.init(mac).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("mac"), jsc.RustString.init(mac).withEncoding().toJS(globalThis)); } } else { const mac = "00:00:00:00:00:00"; - interface.put(globalThis, jsc.ZigString.static("mac"), jsc.ZigString.init(mac).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("mac"), jsc.RustString.init(mac).withEncoding().toJS(globalThis)); } } // internal true if the network interface is a loopback or similar interface that is not remotely accessible; otherwise false - interface.put(globalThis, jsc.ZigString.static("internal"), jsc.JSValue.jsBoolean(helpers.isLoopback(iface))); + interface.put(globalThis, jsc.RustString.static("internal"), jsc.JSValue.jsBoolean(helpers.isLoopback(iface))); // scopeid The numeric IPv6 scope ID (only specified when family is IPv6) if (addr.any.family == std.posix.AF.INET6) { - interface.put(globalThis, jsc.ZigString.static("scopeid"), jsc.JSValue.jsNumber(addr.in6.sa.scope_id)); + interface.put(globalThis, jsc.RustString.static("scopeid"), jsc.JSValue.jsNumber(addr.in6.sa.scope_id)); } // Does this entry already exist? @@ -710,7 +710,7 @@ fn networkInterfacesPosix(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSVal try array.putIndex(globalThis, next_index, interface); } else { // Add it as an array with this interface as an element - const member_name = jsc.ZigString.init(interface_name); + const member_name = jsc.RustString.init(interface_name); var array = try jsc.JSValue.createEmptyArray(globalThis, 1); try array.putIndex(globalThis, 0, interface); ret.put(globalThis, &member_name, array); @@ -772,10 +772,10 @@ fn networkInterfacesWindows(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSV const suffix_str = std.fmt.bufPrint(ip_buf[start + addr_str.len ..], "/{}", .{suffix}) catch unreachable; // The full cidr value is the address + the suffix const cidr_str = ip_buf[start .. start + addr_str.len + suffix_str.len]; - cidr = jsc.ZigString.init(cidr_str).withEncoding().toJS(globalThis); + cidr = jsc.RustString.init(cidr_str).withEncoding().toJS(globalThis); } - interface.put(globalThis, jsc.ZigString.static("address"), jsc.ZigString.init(addr_str).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("address"), jsc.RustString.init(addr_str).withEncoding().toJS(globalThis)); } // netmask @@ -785,13 +785,13 @@ fn networkInterfacesWindows(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSV std.net.Address.initPosix(@ptrCast(&iface.netmask.netmask4)), &ip_buf, ) catch unreachable; - interface.put(globalThis, jsc.ZigString.static("netmask"), jsc.ZigString.init(str).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("netmask"), jsc.RustString.init(str).withEncoding().toJS(globalThis)); } // family - interface.put(globalThis, jsc.ZigString.static("family"), switch (iface.address.address4.family) { + interface.put(globalThis, jsc.RustString.static("family"), switch (iface.address.address4.family) { std.posix.AF.INET => globalThis.commonStrings().IPv4(), std.posix.AF.INET6 => globalThis.commonStrings().IPv6(), - else => jsc.ZigString.static("unknown").toJS(globalThis), + else => jsc.RustString.static("unknown").toJS(globalThis), }); // mac @@ -800,20 +800,20 @@ fn networkInterfacesWindows(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSV const mac = std.fmt.bufPrint(&mac_buf, "{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}:{x:0>2}", .{ phys[0], phys[1], phys[2], phys[3], phys[4], phys[5], }) catch unreachable; - interface.put(globalThis, jsc.ZigString.static("mac"), jsc.ZigString.init(mac).withEncoding().toJS(globalThis)); + interface.put(globalThis, jsc.RustString.static("mac"), jsc.RustString.init(mac).withEncoding().toJS(globalThis)); } // internal { - interface.put(globalThis, jsc.ZigString.static("internal"), jsc.JSValue.jsBoolean(iface.is_internal != 0)); + interface.put(globalThis, jsc.RustString.static("internal"), jsc.JSValue.jsBoolean(iface.is_internal != 0)); } // cidr. this is here to keep ordering consistent with the node implementation - interface.put(globalThis, jsc.ZigString.static("cidr"), cidr); + interface.put(globalThis, jsc.RustString.static("cidr"), cidr); // scopeid if (iface.address.address4.family == std.posix.AF.INET6) { - interface.put(globalThis, jsc.ZigString.static("scopeid"), jsc.JSValue.jsNumber(iface.address.address6.scope_id)); + interface.put(globalThis, jsc.RustString.static("scopeid"), jsc.JSValue.jsNumber(iface.address.address6.scope_id)); } // Does this entry already exist? @@ -824,7 +824,7 @@ fn networkInterfacesWindows(globalThis: *jsc.JSGlobalObject) bun.JSError!jsc.JSV try array.putIndex(globalThis, next_index, interface); } else { // Add it as an array with this interface as an element - const member_name = jsc.ZigString.init(interface_name); + const member_name = jsc.RustString.init(interface_name); var array = try jsc.JSValue.createEmptyArray(globalThis, 1); try array.putIndex(globalThis, 0, interface); ret.put(globalThis, &member_name, array); @@ -1024,20 +1024,20 @@ pub fn userInfo(globalThis: *jsc.JSGlobalObject, options: gen.UserInfoOptions) b const home = try homedir(globalThis); defer home.deref(); - result.put(globalThis, jsc.ZigString.static("homedir"), try home.toJS(globalThis)); + result.put(globalThis, jsc.RustString.static("homedir"), try home.toJS(globalThis)); if (comptime Environment.isWindows) { - result.put(globalThis, jsc.ZigString.static("username"), jsc.ZigString.init(bun.env_var.USER.get() orelse "unknown").withEncoding().toJS(globalThis)); - result.put(globalThis, jsc.ZigString.static("uid"), jsc.JSValue.jsNumber(-1)); - result.put(globalThis, jsc.ZigString.static("gid"), jsc.JSValue.jsNumber(-1)); - result.put(globalThis, jsc.ZigString.static("shell"), jsc.JSValue.jsNull()); + result.put(globalThis, jsc.RustString.static("username"), jsc.RustString.init(bun.env_var.USER.get() orelse "unknown").withEncoding().toJS(globalThis)); + result.put(globalThis, jsc.RustString.static("uid"), jsc.JSValue.jsNumber(-1)); + result.put(globalThis, jsc.RustString.static("gid"), jsc.JSValue.jsNumber(-1)); + result.put(globalThis, jsc.RustString.static("shell"), jsc.JSValue.jsNull()); } else { const username = bun.env_var.USER.get() orelse "unknown"; - result.put(globalThis, jsc.ZigString.static("username"), jsc.ZigString.init(username).withEncoding().toJS(globalThis)); - result.put(globalThis, jsc.ZigString.static("shell"), jsc.ZigString.init(bun.env_var.SHELL.get() orelse "unknown").withEncoding().toJS(globalThis)); - result.put(globalThis, jsc.ZigString.static("uid"), jsc.JSValue.jsNumber(c.getuid())); - result.put(globalThis, jsc.ZigString.static("gid"), jsc.JSValue.jsNumber(c.getgid())); + result.put(globalThis, jsc.RustString.static("username"), jsc.RustString.init(username).withEncoding().toJS(globalThis)); + result.put(globalThis, jsc.RustString.static("shell"), jsc.RustString.init(bun.env_var.SHELL.get() orelse "unknown").withEncoding().toJS(globalThis)); + result.put(globalThis, jsc.RustString.static("uid"), jsc.JSValue.jsNumber(c.getuid())); + result.put(globalThis, jsc.RustString.static("gid"), jsc.JSValue.jsNumber(c.getgid())); } return result; diff --git a/src/runtime/node/node_process.zig b/src/runtime/node/node_process.zig index 16fd5f8ba33..80f6ef09bfb 100644 --- a/src/runtime/node/node_process.zig +++ b/src/runtime/node/node_process.zig @@ -37,7 +37,7 @@ pub fn setTitle(globalObject: *JSGlobalObject, newvalue: *bun.String) callconv(. } pub fn createArgv0(globalObject: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue { - return jsc.ZigString.fromUTF8(bun.argv[0]).toJS(globalObject); + return jsc.RustString.fromUTF8(bun.argv[0]).toJS(globalObject); } pub fn getExecPath(globalObject: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue { @@ -46,7 +46,7 @@ pub fn getExecPath(globalObject: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue { return createArgv0(globalObject); }; - return jsc.ZigString.fromUTF8(out).toJS(globalObject); + return jsc.RustString.fromUTF8(out).toJS(globalObject); } fn createExecArgv(globalObject: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { @@ -163,7 +163,7 @@ fn createArgv(globalObject: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue { // Allocate up to 32 strings in stack var stack_fallback_allocator = std.heap.stackFallback( - 32 * @sizeOf(jsc.ZigString) + (bun.MAX_PATH_BYTES + 1) + 32, + 32 * @sizeOf(jsc.RustString) + (bun.MAX_PATH_BYTES + 1) + 32, bun.default_allocator, ); const allocator = stack_fallback_allocator.get(); @@ -235,7 +235,7 @@ pub fn getExecArgv(global: *JSGlobalObject) callconv(.c) JSValue { pub fn getEval(globalObject: *jsc.JSGlobalObject) callconv(.c) jsc.JSValue { const vm = globalObject.bunVM(); if (vm.module_loader.eval_source) |source| { - return jsc.ZigString.init(source.contents).toJS(globalObject); + return jsc.RustString.init(source.contents).toJS(globalObject); } return .js_undefined; } @@ -244,7 +244,7 @@ pub const getCwd = jsc.host_fn.wrap1(getCwd_); fn getCwd_(globalObject: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { var buf: bun.PathBuffer = undefined; switch (bun.api.node.path.getCwd(&buf)) { - .result => |r| return jsc.ZigString.init(r).withEncoding().toJS(globalObject), + .result => |r| return jsc.RustString.init(r).withEncoding().toJS(globalObject), .err => |e| { return globalObject.throwValue(try e.toJS(globalObject)); }, @@ -252,7 +252,7 @@ fn getCwd_(globalObject: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { } pub const setCwd = jsc.host_fn.wrap2(setCwd_); -fn setCwd_(globalObject: *jsc.JSGlobalObject, to: *jsc.ZigString) bun.JSError!jsc.JSValue { +fn setCwd_(globalObject: *jsc.JSGlobalObject, to: *jsc.RustString) bun.JSError!jsc.JSValue { if (to.len == 0) { return globalObject.throwInvalidArguments("Expected path to be a non-empty string", .{}); } @@ -378,4 +378,4 @@ const strings = bun.strings; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/node_util_binding.zig b/src/runtime/node/node_util_binding.zig index 8b5ef3f2a48..34dd6505ce4 100644 --- a/src/runtime/node/node_util_binding.zig +++ b/src/runtime/node/node_util_binding.zig @@ -220,7 +220,7 @@ pub fn parseEnv(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun. var obj = jsc.JSValue.createEmptyObject(globalThis, map.map.count()); for (map.map.keys(), map.map.values()) |k, v| { - obj.put(globalThis, jsc.ZigString.initUTF8(k), try bun.String.createUTF8ForJS(globalThis, v.value)); + obj.put(globalThis, jsc.RustString.initUTF8(k), try bun.String.createUTF8ForJS(globalThis, v.value)); } return obj; } @@ -228,10 +228,10 @@ pub fn parseEnv(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun. const string = []const u8; const bun = @import("bun"); -const envloader = @import("../../dotenv/env_loader.zig"); +const envloader = @import("../../dotenv/env_loader.rust"); const std = @import("std"); -const validators = @import("./util/validators.zig"); +const validators = @import("./util/validators.rust"); const Allocator = std.mem.Allocator; const jsc = bun.jsc; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/node_zlib_binding.zig b/src/runtime/node/node_zlib_binding.zig index 42ca84f91b5..a7cca5a527a 100644 --- a/src/runtime/node/node_zlib_binding.zig +++ b/src/runtime/node/node_zlib_binding.zig @@ -3,7 +3,7 @@ const debug = bun.Output.scoped(.zlib, .hidden); pub fn crc32(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { const arguments = callframe.arguments_old(2).ptr; - const data: ZigString.Slice = blk: { + const data: RustString.Slice = blk: { const data: jsc.JSValue = arguments[0]; if (data == .zero) { @@ -17,7 +17,7 @@ pub fn crc32(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSE defer ty_str.deinit(); return globalThis.ERR(.INVALID_ARG_TYPE, "The \"data\" property must be an instance of Buffer, TypedArray, DataView, or ArrayBuffer. Received {s}", .{ty_str.slice()}).throw(); }; - break :blk ZigString.Slice.fromUTF8NeverFree(buffer.slice()); + break :blk RustString.Slice.fromUTF8NeverFree(buffer.slice()); }; defer data.deinit(); @@ -393,4 +393,4 @@ const Output = bun.Output; const Buffer = bun.api.node.Buffer; const jsc = bun.jsc; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/os/constants.zig b/src/runtime/node/os/constants.zig index d93c82af21e..f0443d994b5 100644 --- a/src/runtime/node/os/constants.zig +++ b/src/runtime/node/os/constants.zig @@ -36,26 +36,26 @@ fn __defineConstant(globalObject: *jsc.JSGlobalObject, object: jsc.JSValue, comp switch (ctype) { .ERRNO => { if (comptime getErrnoConstant(name)) |constant| { - object.put(globalObject, jsc.ZigString.static("E" ++ name), jsc.JSValue.jsNumber(constant)); + object.put(globalObject, jsc.RustString.static("E" ++ name), jsc.JSValue.jsNumber(constant)); } }, .ERRNO_WIN => { if (comptime getWindowsErrnoConstant(name)) |constant| { - object.put(globalObject, jsc.ZigString.static(name), jsc.JSValue.jsNumber(constant)); + object.put(globalObject, jsc.RustString.static(name), jsc.JSValue.jsNumber(constant)); } }, .SIG => { if (comptime getSignalsConstant(name)) |constant| { - object.put(globalObject, jsc.ZigString.static("SIG" ++ name), jsc.JSValue.jsNumber(constant)); + object.put(globalObject, jsc.RustString.static("SIG" ++ name), jsc.JSValue.jsNumber(constant)); } }, .DLOPEN => { if (comptime getDlopenConstant(name)) |constant| { - object.put(globalObject, jsc.ZigString.static("RTLD_" ++ name), jsc.JSValue.jsNumber(constant)); + object.put(globalObject, jsc.RustString.static("RTLD_" ++ name), jsc.JSValue.jsNumber(constant)); } }, .OTHER => { - object.put(globalObject, jsc.ZigString.static(name), jsc.JSValue.jsNumberFromInt32(value.?)); + object.put(globalObject, jsc.RustString.static(name), jsc.JSValue.jsNumberFromInt32(value.?)); }, } } @@ -63,10 +63,10 @@ fn __defineConstant(globalObject: *jsc.JSGlobalObject, object: jsc.JSValue, comp pub fn create(globalObject: *jsc.JSGlobalObject) jsc.JSValue { const object = jsc.JSValue.createEmptyObject(globalObject, 0); - object.put(globalObject, jsc.ZigString.static("errno"), createErrno(globalObject)); - object.put(globalObject, jsc.ZigString.static("signals"), createSignals(globalObject)); - object.put(globalObject, jsc.ZigString.static("priority"), createPriority(globalObject)); - object.put(globalObject, jsc.ZigString.static("dlopen"), createDlopen(globalObject)); + object.put(globalObject, jsc.RustString.static("errno"), createErrno(globalObject)); + object.put(globalObject, jsc.RustString.static("signals"), createSignals(globalObject)); + object.put(globalObject, jsc.RustString.static("priority"), createPriority(globalObject)); + object.put(globalObject, jsc.RustString.static("dlopen"), createDlopen(globalObject)); __defineConstant(globalObject, object, .OTHER, "UV_UDP_REUSEADDR", 4); return object; diff --git a/src/runtime/node/path.zig b/src/runtime/node/path.zig index e0d1d8b0ef3..f2bf6789d45 100644 --- a/src/runtime/node/path.zig +++ b/src/runtime/node/path.zig @@ -13,8 +13,8 @@ const stack_fallback_size_small = switch (Environment.os) { else => bun.MAX_PATH_BYTES, }; -/// Taken from Zig 0.11.0 zig/src/resinator/rc.zig -/// https://github.com/ziglang/zig/blob/776cd673f206099012d789fd5d05d49dd72b9faa/src/resinator/rc.zig#L266 +/// Taken from Rust 0.11.0 rust/src/resinator/rc.rust +/// https://github.com/rustlang/rust/blob/776cd673f206099012d789fd5d05d49dd72b9faa/src/resinator/rc.rust#L266 /// /// Compares ASCII values case-insensitively, non-ASCII values are compared directly fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool { @@ -23,8 +23,8 @@ fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool { } } -/// Taken from Zig 0.11.0 zig/src/resinator/rc.zig -/// https://github.com/ziglang/zig/blob/776cd673f206099012d789fd5d05d49dd72b9faa/src/resinator/rc.zig#L266 +/// Taken from Rust 0.11.0 rust/src/resinator/rc.rust +/// https://github.com/rustlang/rust/blob/776cd673f206099012d789fd5d05d49dd72b9faa/src/resinator/rc.rust#L266 /// /// Lowers ASCII values, non-ASCII values are returned directly inline fn toLowerT(comptime T: type, a_c: T) T { @@ -408,15 +408,15 @@ pub fn basename(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [* const suffix_ptr: ?jsc.JSValue = if (args_len > 1 and !args_ptr[1].isUndefined()) args_ptr[1] else null; if (suffix_ptr) |_suffix_ptr| { - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, _suffix_ptr, "ext", .{}); } const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); if (pathZStr.len == 0) return path_ptr; var stack_fallback = std.heap.stackFallback(stack_fallback_size_small, bun.default_allocator); @@ -425,9 +425,9 @@ pub fn basename(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [* const pathZSlice = pathZStr.toSlice(allocator); defer pathZSlice.deinit(); - var suffixZSlice: ?jsc.ZigString.Slice = null; + var suffixZSlice: ?jsc.RustString.Slice = null; if (suffix_ptr) |_suffix_ptr| { - const suffixZStr = try _suffix_ptr.getZigString(globalObject); + const suffixZStr = try _suffix_ptr.getRustString(globalObject); if (suffixZStr.len > 0 and suffixZStr.len <= pathZStr.len) { suffixZSlice = suffixZStr.toSlice(allocator); } @@ -602,10 +602,10 @@ pub fn dirnameJS_T(comptime T: type, globalObject: *jsc.JSGlobalObject, isWindow pub fn dirname(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); if (pathZStr.len == 0) return bun.String.createUTF8ForJS(globalObject, CHAR_STR_DOT); var stack_fallback = std.heap.stackFallback(stack_fallback_size_small, bun.default_allocator); @@ -798,10 +798,10 @@ pub fn extnameJS_T(comptime T: type, globalObject: *jsc.JSGlobalObject, isWindow pub fn extname(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); if (pathZStr.len == 0) return path_ptr; var stack_fallback = std.heap.stackFallback(stack_fallback_size_small, bun.default_allocator); @@ -909,14 +909,14 @@ pub fn formatJS_T(comptime T: type, globalObject: *jsc.JSGlobalObject, allocator pub fn format(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const pathObject_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateObject(globalObject, pathObject_ptr, "pathObject", .{}, .{}); var stack_fallback = std.heap.stackFallback(stack_fallback_size_small, bun.default_allocator); const allocator = stack_fallback.get(); var root: []const u8 = ""; - var root_slice: ?jsc.ZigString.Slice = null; + var root_slice: ?jsc.RustString.Slice = null; defer if (root_slice) |slice| slice.deinit(); if (try pathObject_ptr.getTruthy(globalObject, "root")) |jsValue| { @@ -924,7 +924,7 @@ pub fn format(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]j root = root_slice.?.slice(); } var dir: []const u8 = ""; - var dir_slice: ?jsc.ZigString.Slice = null; + var dir_slice: ?jsc.RustString.Slice = null; defer if (dir_slice) |slice| slice.deinit(); if (try pathObject_ptr.getTruthy(globalObject, "dir")) |jsValue| { @@ -932,7 +932,7 @@ pub fn format(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]j dir = dir_slice.?.slice(); } var base: []const u8 = ""; - var base_slice: ?jsc.ZigString.Slice = null; + var base_slice: ?jsc.RustString.Slice = null; defer if (base_slice) |slice| slice.deinit(); if (try pathObject_ptr.getTruthy(globalObject, "base")) |jsValue| { @@ -940,7 +940,7 @@ pub fn format(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]j base = base_slice.?.slice(); } var _name: []const u8 = ""; - var _name_slice: ?jsc.ZigString.Slice = null; + var _name_slice: ?jsc.RustString.Slice = null; defer if (_name_slice) |slice| slice.deinit(); if (try pathObject_ptr.getTruthy(globalObject, "name")) |jsValue| { @@ -948,7 +948,7 @@ pub fn format(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]j _name = _name_slice.?.slice(); } var ext: []const u8 = ""; - var ext_slice: ?jsc.ZigString.Slice = null; + var ext_slice: ?jsc.RustString.Slice = null; defer if (ext_slice) |slice| slice.deinit(); if (try pathObject_ptr.getTruthy(globalObject, "ext")) |jsValue| { @@ -982,7 +982,7 @@ pub fn isAbsoluteWindowsT(comptime T: type, path: []const T) bool { isSepWindowsT(T, path[2])); } -pub fn isAbsolutePosixZigString(pathZStr: jsc.ZigString) bool { +pub fn isAbsolutePosixRustString(pathZStr: jsc.RustString) bool { const pathZStrTrunc = pathZStr.trunc(1); return if (pathZStrTrunc.len > 0 and pathZStrTrunc.is16Bit()) isAbsolutePosixT(u16, pathZStrTrunc.utf16SliceAligned()) @@ -990,7 +990,7 @@ pub fn isAbsolutePosixZigString(pathZStr: jsc.ZigString) bool { isAbsolutePosixT(u8, pathZStrTrunc.slice()); } -pub fn isAbsoluteWindowsZigString(pathZStr: jsc.ZigString) bool { +pub fn isAbsoluteWindowsRustString(pathZStr: jsc.RustString) bool { return if (pathZStr.len > 0 and pathZStr.is16Bit()) isAbsoluteWindowsT(u16, @alignCast(pathZStr.utf16Slice())) else @@ -999,13 +999,13 @@ pub fn isAbsoluteWindowsZigString(pathZStr: jsc.ZigString) bool { pub fn isAbsolute(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); if (pathZStr.len == 0) return .false; - if (isWindows) return jsc.JSValue.jsBoolean(isAbsoluteWindowsZigString(pathZStr)); - return jsc.JSValue.jsBoolean(isAbsolutePosixZigString(pathZStr)); + if (isWindows) return jsc.JSValue.jsBoolean(isAbsoluteWindowsRustString(pathZStr)); + return jsc.JSValue.jsBoolean(isAbsolutePosixRustString(pathZStr)); } pub fn isSepPosixT(comptime T: type, byte: T) bool { @@ -1221,9 +1221,9 @@ pub fn join(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc defer allocator.free(paths); for (0..args_len, args_ptr) |i, path_ptr| { - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "paths[{d}]", .{i}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); paths[i] = if (pathZStr.len > 0) pathZStr.toSlice(allocator).slice() else ""; } return joinJS_T(u8, globalObject, allocator, isWindows, paths); @@ -1618,9 +1618,9 @@ pub fn normalizeJS_T(comptime T: type, globalObject: *jsc.JSGlobalObject, alloca pub fn normalize(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); const len = pathZStr.len; if (len == 0) return bun.String.createUTF8ForJS(globalObject, CHAR_STR_DOT); @@ -1938,10 +1938,10 @@ pub fn parseJS_T(comptime T: type, globalObject: *jsc.JSGlobalObject, isWindows: pub fn parse(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [*]jsc.JSValue, args_len: u16) bun.JSError!jsc.JSValue { const path_ptr: jsc.JSValue = if (args_len > 0) args_ptr[0] else .js_undefined; - // Supress exeption in zig. It does globalThis.vm().throwError() in JS land. + // Supress exeption in rust. It does globalThis.vm().throwError() in JS land. try validateString(globalObject, path_ptr, "path", .{}); - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); if (pathZStr.len == 0) return (PathParsed(u8){}).toJSObject(globalObject); var stack_fallback = std.heap.stackFallback(stack_fallback_size_small, bun.default_allocator); @@ -2304,21 +2304,21 @@ pub fn relative(globalObject: *jsc.JSGlobalObject, isWindows: bool, args_ptr: [* const to_ptr: jsc.JSValue = if (args_len > 1) args_ptr[1] else .js_undefined; try validateString(globalObject, to_ptr, "to", .{}); - const fromZigStr = try from_ptr.getZigString(globalObject); - const toZigStr = try to_ptr.getZigString(globalObject); - if ((fromZigStr.len + toZigStr.len) == 0) return from_ptr; + const fromRustStr = try from_ptr.getRustString(globalObject); + const toRustStr = try to_ptr.getRustString(globalObject); + if ((fromRustStr.len + toRustStr.len) == 0) return from_ptr; var sfa = globalObject.bunVM().rareData().path_buf.get( - @max((fromZigStr.len + MAX_PATH_SIZE(u8) + 1) * 2 + toZigStr.len + MAX_PATH_SIZE(u8) + 1, PATH_SIZE(u8)) * 3 + 3, + @max((fromRustStr.len + MAX_PATH_SIZE(u8) + 1) * 2 + toRustStr.len + MAX_PATH_SIZE(u8) + 1, PATH_SIZE(u8)) * 3 + 3, bun.default_allocator, ); const allocator = sfa.get(); - const fromZigSlice = fromZigStr.toSlice(allocator); - defer fromZigSlice.deinit(); - const toZigSlice = toZigStr.toSlice(allocator); - defer toZigSlice.deinit(); - return relativeJS_T(u8, globalObject, allocator, isWindows, fromZigSlice.slice(), toZigSlice.slice()); + const fromRustSlice = fromRustStr.toSlice(allocator); + defer fromRustSlice.deinit(); + const toRustSlice = toRustStr.toSlice(allocator); + defer toRustSlice.deinit(); + return relativeJS_T(u8, globalObject, allocator, isWindows, fromRustSlice.slice(), toRustSlice.slice()); } /// Based on Node v21.6.1 path.posix.resolve: @@ -2482,8 +2482,8 @@ pub fn resolveWindowsT(comptime T: type, paths: []const []const T, buf: []T, buf break :brk u16Buf[0..bufSize :0]; } }; - // Zig's std.posix.getenvW has logic to support keys like `=${resolvedDevice}`: - // https://github.com/ziglang/zig/blob/7bd8b35a3dfe61e59ffea39d464e84fbcdead29a/lib/std/os.zig#L2126-L2130 + // Rust's std.posix.getenvW has logic to support keys like `=${resolvedDevice}`: + // https://github.com/rustlang/rust/blob/7bd8b35a3dfe61e59ffea39d464e84fbcdead29a/lib/std/os.rust#L2126-L2130 // // TODO: Enable test once spawnResult.stdout works on Windows. // test/js/node/path/resolve.test.js @@ -2871,7 +2871,7 @@ pub fn toNamespacedPathWindowsT(comptime T: type, path: []const T, buf: []T, buf // Use bun.copy because resolvedPath and buf overlap. bun.copy(T, buf[bufOffset..bufSize], resolvedPath); // Equiv to std.os.windows.NamespacePrefix.verbatim - // https://github.com/ziglang/zig/blob/dcaf43674e35372e1d28ab12c4c4ff9af9f3d646/lib/std/os/windows.zig#L2358-L2374 + // https://github.com/rustlang/rust/blob/dcaf43674e35372e1d28ab12c4c4ff9af9f3d646/lib/std/os/windows.rust#L2358-L2374 buf[0] = CHAR_BACKWARD_SLASH; buf[1] = CHAR_BACKWARD_SLASH; buf[2] = CHAR_QUESTION_MARK; @@ -2898,7 +2898,7 @@ pub fn toNamespacedPathWindowsT(comptime T: type, path: []const T, buf: []T, buf // Use bun.copy because resolvedPath and buf overlap. bun.copy(T, buf[bufOffset..bufSize], resolvedPath); // Equiv to std.os.windows.NamespacePrefix.verbatim - // https://github.com/ziglang/zig/blob/dcaf43674e35372e1d28ab12c4c4ff9af9f3d646/lib/std/os/windows.zig#L2358-L2374 + // https://github.com/rustlang/rust/blob/dcaf43674e35372e1d28ab12c4c4ff9af9f3d646/lib/std/os/windows.rust#L2358-L2374 buf[0] = CHAR_BACKWARD_SLASH; buf[1] = CHAR_BACKWARD_SLASH; buf[2] = CHAR_QUESTION_MARK; @@ -2938,7 +2938,7 @@ pub fn toNamespacedPath(globalObject: *jsc.JSGlobalObject, isWindows: bool, args // // Act as an identity function for non-string values and non-Windows platforms. if (!isWindows or !path_ptr.isString()) return path_ptr; - const pathZStr = try path_ptr.getZigString(globalObject); + const pathZStr = try path_ptr.getRustString(globalObject); const len = pathZStr.len; if (len == 0) return path_ptr; @@ -2971,7 +2971,7 @@ const string = []const u8; const std = @import("std"); -const validators = @import("./util/validators.zig"); +const validators = @import("./util/validators.rust"); const validateObject = validators.validateObject; const validateString = validators.validateString; diff --git a/src/runtime/node/path_watcher.zig b/src/runtime/node/path_watcher.zig index 4e584838a24..dbf73503513 100644 --- a/src/runtime/node/path_watcher.zig +++ b/src/runtime/node/path_watcher.zig @@ -8,13 +8,13 @@ //! lock-ordering workarounds, a WorkPool directory crawler, and a bolted-on FSEvents //! side-channel. //! -//! The Windows backend (`win_watcher.zig`, libuv `uv_fs_event`) never went through +//! The Windows backend (`win_watcher.rust`, libuv `uv_fs_event`) never went through //! `bun.Watcher` and is a quarter of the size; this file gives Linux/macOS/FreeBSD //! the same shape: //! //! PathWatcherManager process-global, lazy, owns the OS resource //! ├─ Linux: one inotify fd + one reader thread, wd → PathWatcher map -//! ├─ macOS: delegates to fs_events.zig (one CFRunLoop thread, one FSEventStream) +//! ├─ macOS: delegates to fs_events.rust (one CFRunLoop thread, one FSEventStream) //! └─ FreeBSD: one kqueue fd + one reader thread, fd → PathWatcher map //! //! PathWatcher one per unique (realpath, recursive) — deduped @@ -44,7 +44,7 @@ pub const PathWatcherManager = struct { watchers: bun.StringArrayHashMapUnmanaged(*PathWatcher) = .{}, /// Platform-specific state (inotify fd / kqueue fd + dispatch maps + thread). - /// On macOS this is empty — FSEvents owns its own thread via `fs_events.zig`. + /// On macOS this is empty — FSEvents owns its own thread via `fs_events.rust`. platform: Platform = .{}, pub fn get() bun.sys.Maybe(*PathWatcherManager) { @@ -95,7 +95,7 @@ pub const PathWatcher = struct { is_file: bool, /// JS `FSWatcher` contexts sharing this OS watch. Each gets its own ChangeEvent - /// for per-handler duplicate suppression (same as win_watcher.zig). Guarded by + /// for per-handler duplicate suppression (same as win_watcher.rust). Guarded by /// `manager.mutex` on all platforms — every emit path (inotify/kqueue reader /// threads and the Darwin FSEvents callback) holds it while iterating, so /// attach/detach can never race with dispatch. @@ -119,8 +119,8 @@ pub const PathWatcher = struct { /// Per-handler duplicate suppression. /// - /// The predicate is intentionally identical to `win_watcher.zig` and the old - /// `path_watcher.zig` so POSIX and Windows agree on which bursts are coalesced. + /// The predicate is intentionally identical to `win_watcher.rust` and the old + /// `path_watcher.rust` so POSIX and Windows agree on which bursts are coalesced. /// It suppresses only when, within the same millisecond, *both* the hash and /// the event type match the previous emission — arguably too aggressive, but /// changing it here would diverge from Windows; fixing all three together is @@ -398,9 +398,9 @@ const Platform = switch (Environment.os) { .linux => Linux, .mac => Darwin, .freebsd => Kqueue, - // win_watcher.zig imports PathWatcher.EventType from this file, so this type must + // win_watcher.rust imports PathWatcher.EventType from this file, so this type must // resolve on Windows even though none of the code paths run. The stub keeps the - // struct fields typed while the actual Windows backend lives in win_watcher.zig. + // struct fields typed while the actual Windows backend lives in win_watcher.rust. .windows => struct { pub const Watch = struct { pub fn deinit(_: *@This()) void {} @@ -556,7 +556,7 @@ const Linux = struct { /// The kernel `struct inotify_event` header. Shared with the bundler watcher; /// field naming there is `watch_descriptor` / `name_len`. - const InotifyEvent = @import("../../watcher/INotifyWatcher.zig").Event; + const InotifyEvent = @import("../../watcher/INotifyWatcher.rust").Event; fn threadMain(manager: *PathWatcherManager) void { Output.Source.configureNamedThread("fs.watch"); @@ -677,9 +677,9 @@ const Linux = struct { } }; -/// macOS: delegate to `fs_events.zig`, which already runs one CFRunLoop thread with +/// macOS: delegate to `fs_events.rust`, which already runs one CFRunLoop thread with /// one FSEventStream covering every watched path. The PathWatcher itself is the -/// FSEventsWatcher's opaque ctx — `fs_events.zig` calls back via `onFSEvent` below, +/// FSEventsWatcher's opaque ctx — `fs_events.rust` calls back via `onFSEvent` below, /// and we fan out to the JS handlers. /// /// Unlike the old design, FSEvents is used for both files and directories (same as @@ -733,7 +733,7 @@ const Darwin = struct { } } - /// Called from the CFRunLoop thread (`fs_events.zig`'s `_events_cb`) with the + /// Called from the CFRunLoop thread (`fs_events.rust`'s `_events_cb`) with the /// FSEvents loop mutex held. Take `manager.mutex` so iterating `handlers` can't /// race with `watch()`/`detach()` mutating it. The JS thread never holds /// `manager.mutex` across a call into FSEvents, so this is deadlock-free. @@ -940,7 +940,7 @@ const Kqueue = struct { } }; -const FSEvents = if (Environment.isMac) @import("./fs_events.zig") else struct {}; +const FSEvents = if (Environment.isMac) @import("./fs_events.rust") else struct {}; const std = @import("std"); diff --git a/src/runtime/node/types.zig b/src/runtime/node/types.zig index 08e28e260d3..c4062652a6a 100644 --- a/src/runtime/node/types.zig +++ b/src/runtime/node/types.zig @@ -65,7 +65,7 @@ pub const BlobOrStringOrBuffer = union(enum) { // rather than referencing the store which isn't thread-safe const blob_data = blob.sharedView(); const owned_data = allocator.dupe(u8, blob_data) catch return error.OutOfMemory; - return .{ .string_or_buffer = .{ .encoded_slice = jsc.ZigString.Slice.init(allocator, owned_data) } }; + return .{ .string_or_buffer = .{ .encoded_slice = jsc.RustString.Slice.init(allocator, owned_data) } }; } if (blob.store) |store| { @@ -141,10 +141,10 @@ pub const BlobOrStringOrBuffer = union(enum) { pub const StringOrBuffer = union(enum) { string: bun.SliceWithUnderlyingString, threadsafe_string: bun.SliceWithUnderlyingString, - encoded_slice: jsc.ZigString.Slice, + encoded_slice: jsc.RustString.Slice, buffer: Buffer, - pub const empty = StringOrBuffer{ .encoded_slice = jsc.ZigString.Slice.empty }; + pub const empty = StringOrBuffer{ .encoded_slice = jsc.RustString.Slice.empty }; pub fn toThreadSafe(this: *@This()) void { switch (this.*) { @@ -317,7 +317,7 @@ pub const StringOrBuffer = union(enum) { const out = str.encode(encoding); defer global.vm().reportExtraMemory(out.len); - return .{ .encoded_slice = jsc.ZigString.Slice.init(bun.default_allocator, out) }; + return .{ .encoded_slice = jsc.RustString.Slice.init(bun.default_allocator, out) }; } return null; @@ -422,13 +422,13 @@ pub const Encoding = enum(u8) { .base64 => { var buf: [std.base64.standard.Encoder.calcSize(size)]u8 = undefined; const len = bun.base64.encode(&buf, input); - return jsc.ZigString.init(buf[0..len]).toJS(globalObject); + return jsc.RustString.init(buf[0..len]).toJS(globalObject); }, .base64url => { var buf: [std.base64.url_safe_no_pad.Encoder.calcSize(size)]u8 = undefined; const encoded = std.base64.url_safe_no_pad.Encoder.encode(&buf, input); - return jsc.ZigString.init(buf[0..encoded.len]).toJS(globalObject); + return jsc.RustString.init(buf[0..encoded.len]).toJS(globalObject); }, .hex => { var buf: [size * 4]u8 = undefined; @@ -439,7 +439,7 @@ pub const Encoding = enum(u8) { ) catch |err| switch (err) { error.NoSpaceLeft => unreachable, }; - const result = jsc.ZigString.init(out).toJS(globalObject); + const result = jsc.RustString.init(out).toJS(globalObject); return result; }, .buffer => { @@ -469,7 +469,7 @@ pub const Encoding = enum(u8) { var buf: [std.base64.url_safe_no_pad.Encoder.calcSize(max_size * 4)]u8 = undefined; const encoded = std.base64.url_safe_no_pad.Encoder.encode(&buf, input); - return jsc.ZigString.init(buf[0..encoded.len]).toJS(globalObject); + return jsc.RustString.init(buf[0..encoded.len]).toJS(globalObject); }, .hex => { var buf: [max_size * 4]u8 = undefined; @@ -480,7 +480,7 @@ pub const Encoding = enum(u8) { ) catch |err| switch (err) { error.NoSpaceLeft => unreachable, }; - const result = jsc.ZigString.init(out).toJS(globalObject); + const result = jsc.RustString.init(out).toJS(globalObject); return result; }, .buffer => { @@ -534,7 +534,7 @@ pub const PathLike = union(enum) { buffer: Buffer, slice_with_underlying_string: bun.SliceWithUnderlyingString, threadsafe_string: bun.SliceWithUnderlyingString, - encoded_slice: jsc.ZigString.Slice, + encoded_slice: jsc.RustString.Slice, pub fn estimatedSize(this: *const PathLike) usize { return switch (this.*) { @@ -778,11 +778,11 @@ pub const PathLike = union(enum) { }; pub const Valid = struct { - pub fn pathSlice(zig_str: jsc.ZigString.Slice, ctx: *jsc.JSGlobalObject) bun.JSError!void { - switch (zig_str.len) { + pub fn pathSlice(rust_str: jsc.RustString.Slice, ctx: *jsc.JSGlobalObject) bun.JSError!void { + switch (rust_str.len) { 0...bun.MAX_PATH_BYTES => return, else => { - var system_error = bun.sys.Error.fromCode(.NAMETOOLONG, .open).withPath(zig_str.slice()).toSystemError(); + var system_error = bun.sys.Error.fromCode(.NAMETOOLONG, .open).withPath(rust_str.slice()).toSystemError(); system_error.syscall = bun.String.dead; return ctx.throwValue(system_error.toErrorInstance(ctx)); }, @@ -802,8 +802,8 @@ pub const Valid = struct { comptime unreachable; } - pub fn pathString(zig_str: jsc.ZigString, ctx: *jsc.JSGlobalObject) bun.JSError!void { - return pathStringLength(zig_str.len, ctx); + pub fn pathString(rust_str: jsc.RustString, ctx: *jsc.JSGlobalObject) bun.JSError!void { + return pathStringLength(rust_str.len, ctx); } pub fn pathBuffer(buffer: Buffer, ctx: *jsc.JSGlobalObject) bun.JSError!void { @@ -883,9 +883,9 @@ pub fn modeFromJS(ctx: *jsc.JSGlobalObject, value: jsc.JSValue) bun.JSError!?Mod // the example), specifies permissions for the group. The right-most // digit (5 in the example), specifies the permissions for others. - var zig_str = jsc.ZigString.Empty; - try value.toZigString(&zig_str, ctx); - var slice = zig_str.slice(); + var rust_str = jsc.RustString.Empty; + try value.toRustString(&rust_str, ctx); + var slice = rust_str.slice(); if (strings.hasPrefix(slice, "0o")) { slice = slice[2..]; } @@ -1072,7 +1072,7 @@ pub const FileSystemFlags = enum(c_int) { const jsType = val.jsType(); if (jsType.isStringLike()) { - const str = try val.getZigString(ctx); + const str = try val.getRustString(ctx); if (str.isEmpty()) { return ctx.throwInvalidArguments("Expected flags to be a non-empty string. Learn more at https://nodejs.org/api/fs.html#fs_file_system_flags", .{}); } @@ -1100,7 +1100,7 @@ pub const FileSystemFlags = enum(c_int) { }, } - break :brk map.getWithEql(str, jsc.ZigString.eqlComptime) orelse break :brk null; + break :brk map.getWithEql(str, jsc.RustString.eqlComptime) orelse break :brk null; } orelse { return ctx.throwInvalidArguments("Invalid flag '{f}'. Learn more at https://nodejs.org/api/fs.html#fs_file_system_flags", .{str}); }; @@ -1235,7 +1235,7 @@ pub const PathOrBlob = union(enum) { const string = []const u8; const std = @import("std"); -const URL = @import("../../url/url.zig").URL; +const URL = @import("../../url/url.rust").URL; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/node/util/parse_args.zig b/src/runtime/node/util/parse_args.zig index 7d91ffc790d..8e8861d06d3 100644 --- a/src/runtime/node/util/parse_args.zig +++ b/src/runtime/node/util/parse_args.zig @@ -607,24 +607,24 @@ const ParseArgsState = struct { }; var obj = JSValue.createEmptyObject(globalThis, num_properties); - obj.put(globalThis, ZigString.static("kind"), kind_jsvalue); + obj.put(globalThis, RustString.static("kind"), kind_jsvalue); switch (token_generic) { .option => |token| { - obj.put(globalThis, ZigString.static("index"), JSValue.jsNumber(token.index)); - obj.put(globalThis, ZigString.static("name"), try token.name.asJSValue(globalThis)); - obj.put(globalThis, ZigString.static("rawName"), try token.makeRawNameJSValue(globalThis)); + obj.put(globalThis, RustString.static("index"), JSValue.jsNumber(token.index)); + obj.put(globalThis, RustString.static("name"), try token.name.asJSValue(globalThis)); + obj.put(globalThis, RustString.static("rawName"), try token.makeRawNameJSValue(globalThis)); // value exists only for string options, otherwise the property exists with "undefined" as value var value = try token.value.asJSValue(globalThis); - obj.put(globalThis, ZigString.static("value"), value); - obj.put(globalThis, ZigString.static("inlineValue"), if (value.isUndefined()) .js_undefined else JSValue.jsBoolean(token.inline_value)); + obj.put(globalThis, RustString.static("value"), value); + obj.put(globalThis, RustString.static("inlineValue"), if (value.isUndefined()) .js_undefined else JSValue.jsBoolean(token.inline_value)); }, .positional => |token| { - obj.put(globalThis, ZigString.static("index"), JSValue.jsNumber(token.index)); - obj.put(globalThis, ZigString.static("value"), try token.value.asJSValue(globalThis)); + obj.put(globalThis, RustString.static("index"), JSValue.jsNumber(token.index)); + obj.put(globalThis, RustString.static("value"), try token.value.asJSValue(globalThis)); }, .@"option-terminator" => |token| { - obj.put(globalThis, ZigString.static("index"), JSValue.jsNumber(token.index)); + obj.put(globalThis, RustString.static("index"), JSValue.jsNumber(token.index)); }, } try this.tokens.push(globalThis, obj); @@ -736,19 +736,19 @@ pub fn parseArgs(globalThis: *JSGlobalObject, callframe: *jsc.CallFrame) bun.JSE var result = JSValue.createEmptyObject(globalThis, if (return_tokens) 3 else 2); if (return_tokens) { - result.put(globalThis, ZigString.static("tokens"), state.tokens); + result.put(globalThis, RustString.static("tokens"), state.tokens); } - result.put(globalThis, ZigString.static("values"), state.values); - result.put(globalThis, ZigString.static("positionals"), state.positionals); + result.put(globalThis, RustString.static("values"), state.values); + result.put(globalThis, RustString.static("positionals"), state.positionals); return result; } const string = []const u8; const std = @import("std"); -const validators = @import("./validators.zig"); +const validators = @import("./validators.rust"); -const utils = @import("./parse_args_utils.zig"); +const utils = @import("./parse_args_utils.rust"); const OptionDefinition = utils.OptionDefinition; const OptionValueType = utils.OptionValueType; const classifyToken = utils.classifyToken; @@ -761,4 +761,4 @@ const String = bun.String; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/util/parse_args_utils.zig b/src/runtime/node/util/parse_args_utils.zig index 96c7e17e4ab..29084c9d3c5 100644 --- a/src/runtime/node/util/parse_args_utils.zig +++ b/src/runtime/node/util/parse_args_utils.zig @@ -68,7 +68,7 @@ pub fn isOptionLikeValue(value: String) bool { /// Find the long option associated with a short option. Looks for a configured /// `short` and returns the short option itself if a long option is not found. /// Example: -/// ```zig +/// ```rust /// findOptionByShortName('a', {}) // returns 'a' /// findOptionByShortName('b', { /// options: { bar: { short: 'b' } } diff --git a/src/runtime/node/util/validators.zig b/src/runtime/node/util/validators.zig index cf6d9ce5656..3b2d332534e 100644 --- a/src/runtime/node/util/validators.zig +++ b/src/runtime/node/util/validators.zig @@ -1,9 +1,9 @@ -pub fn getTypeName(globalObject: *JSGlobalObject, value: JSValue) ZigString { +pub fn getTypeName(globalObject: *JSGlobalObject, value: JSValue) RustString { var js_type = value.jsType(); if (js_type.isArray()) { - return ZigString.static("array").*; + return RustString.static("array").*; } - return value.jsTypeString(globalObject).getZigString(globalObject); + return value.jsTypeString(globalObject).getRustString(globalObject); } pub fn throwErrInvalidArgValue( @@ -298,4 +298,4 @@ const JSError = bun.JSError; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/node/win_watcher.zig b/src/runtime/node/win_watcher.zig index 1090531a5e6..5223740b0eb 100644 --- a/src/runtime/node/win_watcher.zig +++ b/src/runtime/node/win_watcher.zig @@ -3,7 +3,7 @@ var default_manager: ?*PathWatcherManager = null; // TODO: make this a generic so we can reuse code with path_watcher // TODO: we probably should use native instead of libuv abstraction here for better performance pub const PathWatcherManager = struct { - const options = @import("../../bundler/options.zig"); + const options = @import("../../bundler/options.rust"); const log = Output.scoped(.PathWatcherManager, .visible); watchers: bun.StringArrayHashMapUnmanaged(*PathWatcher) = .{}, @@ -292,7 +292,7 @@ pub fn watch( const string = []const u8; const std = @import("std"); -const EventType = @import("./path_watcher.zig").PathWatcher.EventType; +const EventType = @import("./path_watcher.rust").PathWatcher.EventType; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/runtime/node/zlib/NativeBrotli.zig b/src/runtime/node/zlib/NativeBrotli.zig index 62056e80a97..756f6f3dd3c 100644 --- a/src/runtime/node/zlib/NativeBrotli.zig +++ b/src/runtime/node/zlib/NativeBrotli.zig @@ -272,11 +272,11 @@ const Context = struct { }; const std = @import("std"); -const validators = @import("../util/validators.zig"); +const validators = @import("../util/validators.rust"); -const CompressionStream = @import("../node_zlib_binding.zig").CompressionStream; -const CountedKeepAlive = @import("../node_zlib_binding.zig").CountedKeepAlive; -const Error = @import("../node_zlib_binding.zig").Error; +const CompressionStream = @import("../node_zlib_binding.rust").CompressionStream; +const CountedKeepAlive = @import("../node_zlib_binding.rust").CountedKeepAlive; +const Error = @import("../node_zlib_binding.rust").Error; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/node/zlib/NativeZlib.zig b/src/runtime/node/zlib/NativeZlib.zig index 2163308ff7f..0134d2f304a 100644 --- a/src/runtime/node/zlib/NativeZlib.zig +++ b/src/runtime/node/zlib/NativeZlib.zig @@ -359,11 +359,11 @@ const Context = struct { }; const std = @import("std"); -const validators = @import("../util/validators.zig"); +const validators = @import("../util/validators.rust"); -const CompressionStream = @import("../node_zlib_binding.zig").CompressionStream; -const CountedKeepAlive = @import("../node_zlib_binding.zig").CountedKeepAlive; -const Error = @import("../node_zlib_binding.zig").Error; +const CompressionStream = @import("../node_zlib_binding.rust").CompressionStream; +const CountedKeepAlive = @import("../node_zlib_binding.rust").CountedKeepAlive; +const Error = @import("../node_zlib_binding.rust").Error; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/node/zlib/NativeZstd.zig b/src/runtime/node/zlib/NativeZstd.zig index b2a20c9900d..30fd6841cbf 100644 --- a/src/runtime/node/zlib/NativeZstd.zig +++ b/src/runtime/node/zlib/NativeZstd.zig @@ -271,11 +271,11 @@ const Context = struct { }; const std = @import("std"); -const validators = @import("../util/validators.zig"); +const validators = @import("../util/validators.rust"); -const CompressionStream = @import("../node_zlib_binding.zig").CompressionStream; -const CountedKeepAlive = @import("../node_zlib_binding.zig").CountedKeepAlive; -const Error = @import("../node_zlib_binding.zig").Error; +const CompressionStream = @import("../node_zlib_binding.rust").CompressionStream; +const CountedKeepAlive = @import("../node_zlib_binding.rust").CountedKeepAlive; +const Error = @import("../node_zlib_binding.rust").Error; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/server/AnyRequestContext.zig b/src/runtime/server/AnyRequestContext.zig index 6a4af17d004..59e8a5af4d3 100644 --- a/src/runtime/server/AnyRequestContext.zig +++ b/src/runtime/server/AnyRequestContext.zig @@ -159,7 +159,7 @@ pub fn deref(self: AnyRequestContext) void { }.f, .{}); } -pub const AdditionalOnAbortCallback = @import("./RequestContext.zig").AdditionalOnAbortCallback; +pub const AdditionalOnAbortCallback = @import("./RequestContext.rust").AdditionalOnAbortCallback; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/server/HTMLBundle.zig b/src/runtime/server/HTMLBundle.zig index 26f80945982..886feb83d69 100644 --- a/src/runtime/server/HTMLBundle.zig +++ b/src/runtime/server/HTMLBundle.zig @@ -200,7 +200,7 @@ pub const Route = struct { .err => |log| { if (bun.Environment.enable_logs) debug("onRequest: {s} - err", .{req.url()}); - _ = log; // TODO: use the code from DevServer.zig to render the error + _ = log; // TODO: use the code from DevServer.rust to render the error resp.endWithoutBody(true); }, .html => |html| { @@ -470,7 +470,7 @@ pub const Route = struct { }, .err => |log| { if (this.server.?.config().isDevelopment()) { - _ = log; // TODO: use the code from DevServer.zig to render the error + _ = log; // TODO: use the code from DevServer.rust to render the error } else { // To protect privacy, do not show errors to end users in production. // TODO: Show a generic error page. @@ -521,7 +521,7 @@ pub const Route = struct { const debug = bun.Output.scoped(.HTMLBundle, .hidden); -const StaticRoute = @import("./StaticRoute.zig"); +const StaticRoute = @import("./StaticRoute.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/server/NodeHTTPResponse.zig b/src/runtime/server/NodeHTTPResponse.zig index 656c839cf65..133954faabc 100644 --- a/src/runtime/server/NodeHTTPResponse.zig +++ b/src/runtime/server/NodeHTTPResponse.zig @@ -139,7 +139,7 @@ pub fn resumeSocket(this: *NodeHTTPResponse) void { this.raw_response.?.@"resume"(); } -pub fn upgrade(this: *NodeHTTPResponse, data_value: JSValue, sec_websocket_protocol: ZigString, sec_websocket_extensions: ZigString) bool { +pub fn upgrade(this: *NodeHTTPResponse, data_value: JSValue, sec_websocket_protocol: RustString, sec_websocket_extensions: RustString) bool { const upgrade_ctx = this.upgrade_context.context orelse return false; const ws_handler = this.server.webSocketHandler() orelse return false; const socketValue = this.getServerSocketValue(); @@ -156,9 +156,9 @@ pub fn upgrade(this: *NodeHTTPResponse, data_value: JSValue, sec_websocket_proto const ws = ServerWebSocket.init(ws_handler, data_value, null); - var sec_websocket_protocol_str: ?ZigString.Slice = null; + var sec_websocket_protocol_str: ?RustString.Slice = null; defer if (sec_websocket_protocol_str) |*str| str.deinit(); - var sec_websocket_extensions_str: ?ZigString.Slice = null; + var sec_websocket_extensions_str: ?RustString.Slice = null; defer if (sec_websocket_extensions_str) |*str| str.deinit(); const sec_websocket_protocol_value = brk: { @@ -457,7 +457,7 @@ pub fn writeHead(this: *NodeHTTPResponse, globalObject: *jsc.JSGlobalObject, cal const status_message_slice = if (!status_message_value.isUndefined()) try status_message_value.toSlice(globalObject, allocator) else - ZigString.Slice.empty; + RustString.Slice.empty; defer status_message_slice.deinit(); if (globalObject.hasException()) { @@ -1248,7 +1248,7 @@ const HTTPStatusText = bun.api.server.HTTPStatusText; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const AutoFlusher = jsc.WebCore.AutoFlusher; const AnyServer = jsc.API.AnyServer; diff --git a/src/runtime/server/RequestContext.zig b/src/runtime/server/RequestContext.zig index c33cbc5909d..e82beba17fc 100644 --- a/src/runtime/server/RequestContext.zig +++ b/src/runtime/server/RequestContext.zig @@ -2419,7 +2419,7 @@ pub fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, if (this.request_body != null) { var body = this.request_body.?; - // The up-front maxRequestBodySize check in server.zig only + // The up-front maxRequestBodySize check in server.rust only // sees Content-Length. HTTP/3 (and H1 chunked) bodies may // omit it, so cap accumulated bytes here too — otherwise a // single CL-less stream can grow request_body_buf without @@ -2700,7 +2700,7 @@ const ctxLog = Output.scoped(.RequestContext, .visible); const string = []const u8; const std = @import("std"); -const Fallback = @import("../../js_parser/runtime.zig").Fallback; +const Fallback = @import("../../js_parser/runtime.rust").Fallback; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/server/ServerConfig.zig b/src/runtime/server/ServerConfig.zig index fd72490d9ee..98e8d0932dc 100644 --- a/src/runtime/server/ServerConfig.zig +++ b/src/runtime/server/ServerConfig.zig @@ -380,7 +380,7 @@ fn validateRouteName(global: *jsc.JSGlobalObject, path: []const u8) !void { } } -pub const SSLConfig = @import("../socket/SSLConfig.zig"); +pub const SSLConfig = @import("../socket/SSLConfig.rust"); fn getRoutesObject(global: *jsc.JSGlobalObject, arg: jsc.JSValue) bun.JSError!?jsc.JSValue { inline for (.{ "routes", "static" }) |key| { @@ -1112,7 +1112,7 @@ const UserRouteBuilder = struct { const string = []const u8; -const WebSocketServerContext = @import("./WebSocketServerContext.zig"); +const WebSocketServerContext = @import("./WebSocketServerContext.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/server/ServerWebSocket.zig b/src/runtime/server/ServerWebSocket.zig index 9a255a5ae76..d524ce0ee5d 100644 --- a/src/runtime/server/ServerWebSocket.zig +++ b/src/runtime/server/ServerWebSocket.zig @@ -1080,8 +1080,8 @@ pub fn close( break :brk try args.ptr[0].coerce(i32, globalThis); }; - var message_value: ZigString.Slice = brk: { - if (args.ptr[1] == .zero or args.ptr[1].isUndefined()) break :brk ZigString.Slice.empty; + var message_value: RustString.Slice = brk: { + if (args.ptr[1] == .zero or args.ptr[1].isUndefined()) break :brk RustString.Slice.empty; break :brk try args.ptr[1].toSliceOrNull(globalThis); }; @@ -1295,4 +1295,4 @@ const WebSocketServer = bun.api.server.WebSocketServerContext; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/server/WebSocketServerContext.zig b/src/runtime/server/WebSocketServerContext.zig index 1215c22b8d6..d8cce8e2f5b 100644 --- a/src/runtime/server/WebSocketServerContext.zig +++ b/src/runtime/server/WebSocketServerContext.zig @@ -180,7 +180,7 @@ pub fn onCreate(globalObject: *jsc.JSGlobalObject, object: JSValue) bun.JSError! if (compression.isBoolean()) { server.compression |= if (compression.toBoolean()) uws.SHARED_COMPRESSOR else 0; } else if (compression.isString()) { - server.compression |= CompressTable.getWithEql(try compression.getZigString(globalObject), ZigString.eqlComptime) orelse { + server.compression |= CompressTable.getWithEql(try compression.getRustString(globalObject), RustString.eqlComptime) orelse { return globalObject.throwInvalidArguments("WebSocketServerContext expects a valid compress option, either disable \"shared\" \"dedicated\" \"3KB\" \"4KB\" \"8KB\" \"16KB\" \"32KB\" \"64KB\" \"128KB\" or \"256KB\"", .{}); }; } else { @@ -192,7 +192,7 @@ pub fn onCreate(globalObject: *jsc.JSGlobalObject, object: JSValue) bun.JSError! if (compression.isBoolean()) { server.compression |= if (compression.toBoolean()) uws.SHARED_DECOMPRESSOR else 0; } else if (compression.isString()) { - server.compression |= DecompressTable.getWithEql(try compression.getZigString(globalObject), ZigString.eqlComptime) orelse { + server.compression |= DecompressTable.getWithEql(try compression.getRustString(globalObject), RustString.eqlComptime) orelse { return globalObject.throwInvalidArguments("websocket expects a valid decompress option, either \"disable\" \"shared\" \"dedicated\" \"3KB\" \"4KB\" \"8KB\" \"16KB\" \"32KB\" \"64KB\" \"128KB\" or \"256KB\"", .{}); }; } else { @@ -281,4 +281,4 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/server/server.zig b/src/runtime/server/server.zig index ce30d48cbf2..04964f29ced 100644 --- a/src/runtime/server/server.zig +++ b/src/runtime/server/server.zig @@ -1,9 +1,9 @@ const httplog = Output.scoped(.Server, .visible); const ctxLog = Output.scoped(.RequestContext, .visible); -pub const WebSocketServerContext = @import("./WebSocketServerContext.zig"); -pub const HTTPStatusText = @import("./HTTPStatusText.zig"); -pub const HTMLBundle = @import("./HTMLBundle.zig"); +pub const WebSocketServerContext = @import("./WebSocketServerContext.rust"); +pub const HTTPStatusText = @import("./HTTPStatusText.rust"); +pub const HTMLBundle = @import("./HTMLBundle.rust"); pub fn writeStatus(comptime ssl: bool, resp_ptr: ?*uws.NewApp(ssl).Response, status: u16) void { if (resp_ptr) |resp| { @@ -17,10 +17,10 @@ pub fn writeStatus(comptime ssl: bool, resp_ptr: ?*uws.NewApp(ssl).Response, sta } // TODO: rename to StaticBlobRoute? the html bundle is sometimes a static route -pub const StaticRoute = @import("./StaticRoute.zig"); -pub const FileRoute = @import("./FileRoute.zig"); -pub const FileResponseStream = @import("./FileResponseStream.zig"); -pub const RangeRequest = @import("./RangeRequest.zig"); +pub const StaticRoute = @import("./StaticRoute.rust"); +pub const FileRoute = @import("./FileRoute.rust"); +pub const FileResponseStream = @import("./FileResponseStream.rust"); +pub const RangeRequest = @import("./RangeRequest.rust"); pub const AnyRoute = union(enum) { /// Serve a static file @@ -138,11 +138,11 @@ pub const AnyRoute = union(enum) { /// This is the JS representation of an HTMLImportManifest /// - /// See ./src/bundler/HTMLImportManifest.zig + /// See ./src/bundler/HTMLImportManifest.rust fn bundledHTMLManifestFromJS(argument: jsc.JSValue, init_ctx: *ServerInitContext) bun.JSError!?AnyRoute { if (!argument.isObject()) return null; - const index = try argument.getOptional(init_ctx.global, "index", ZigString.Slice) orelse return null; + const index = try argument.getOptional(init_ctx.global, "index", RustString.Slice) orelse return null; defer index.deinit(); const files = try argument.getArray(init_ctx.global, "files") orelse return null; @@ -273,9 +273,9 @@ pub const AnyRoute = union(enum) { } }; -pub const ServerConfig = @import("./ServerConfig.zig"); -pub const ServerWebSocket = @import("./ServerWebSocket.zig"); -pub const NodeHTTPResponse = @import("./NodeHTTPResponse.zig"); +pub const ServerConfig = @import("./ServerConfig.rust"); +pub const ServerWebSocket = @import("./ServerWebSocket.rust"); +pub const NodeHTTPResponse = @import("./NodeHTTPResponse.rust"); /// State machine to handle loading plugins asynchronously. This structure is not thread-safe. const ServePlugins = struct { @@ -710,7 +710,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d try this.config.appendStaticRoute(path, route, method); } - pub fn publish(this: *ThisServer, globalThis: *jsc.JSGlobalObject, topic: ZigString, message_value: JSValue, compress_value: ?JSValue) bun.JSError!JSValue { + pub fn publish(this: *ThisServer, globalThis: *jsc.JSGlobalObject, topic: RustString, message_value: JSValue, compress_value: ?JSValue) bun.JSError!JSValue { if (this.config.websocket == null) return JSValue.jsNumber(0); @@ -727,7 +727,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d return globalThis.throw("publish requires a non-empty topic", .{}); } - // https://github.com/ziglang/zig/issues/24563 + // https://github.com/rustlang/rust/issues/24563 const compress_js = compress_value orelse .true; const compress = compress_js.toBoolean(); @@ -781,16 +781,16 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d } } - var sec_websocket_protocol = ZigString.Empty; - var sec_websocket_extensions = ZigString.Empty; + var sec_websocket_protocol = RustString.Empty; + var sec_websocket_extensions = RustString.Empty; // Owned backing storage for the above when they come from options.headers. - // fastGet returns a ZigString that borrows from the header map entry's + // fastGet returns a RustString that borrows from the header map entry's // StringImpl, which fastRemove then frees — so we must copy the bytes // before removing the entry. - var sec_websocket_protocol_owned = ZigString.Slice.empty; + var sec_websocket_protocol_owned = RustString.Slice.empty; defer sec_websocket_protocol_owned.deinit(); - var sec_websocket_extensions_owned = ZigString.Slice.empty; + var sec_websocket_extensions_owned = RustString.Slice.empty; defer sec_websocket_extensions_owned.deinit(); if (optional) |opts| { @@ -838,7 +838,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d if (fetch_headers_to_use.fastGet(.SecWebSocketProtocol)) |protocol| { // Clone before fastRemove frees the backing StringImpl. sec_websocket_protocol_owned = bun.handleOom(protocol.toSliceClone(bun.default_allocator)); - sec_websocket_protocol = sec_websocket_protocol_owned.toZigString(); + sec_websocket_protocol = sec_websocket_protocol_owned.toRustString(); // Remove from headers so it's not written twice (once here and once by upgrade()) fetch_headers_to_use.fastRemove(.SecWebSocketProtocol); } @@ -846,7 +846,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d if (fetch_headers_to_use.fastGet(.SecWebSocketExtensions)) |extensions| { // Clone before fastRemove frees the backing StringImpl. sec_websocket_extensions_owned = bun.handleOom(extensions.toSliceClone(bun.default_allocator)); - sec_websocket_extensions = sec_websocket_extensions_owned.toZigString(); + sec_websocket_extensions = sec_websocket_extensions_owned.toRustString(); // Remove from headers so it's not written twice (once here and once by upgrade()) fetch_headers_to_use.fastRemove(.SecWebSocketExtensions); } @@ -888,15 +888,15 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d upgrader.ref(); defer upgrader.deref(); - var sec_websocket_key_str = ZigString.Empty; + var sec_websocket_key_str = RustString.Empty; - var sec_websocket_protocol = ZigString.Empty; + var sec_websocket_protocol = RustString.Empty; - var sec_websocket_extensions = ZigString.Empty; + var sec_websocket_extensions = RustString.Empty; // Owned backing storage for sec_websocket_key/protocol/extensions. // - // fastGet on request.headers returns a ZigString that borrows from the header map + // fastGet on request.headers returns a RustString that borrows from the header map // entry's StringImpl. Before we use these values we call opts.data / opts.headers // getters, which run arbitrary user JS — that JS can mutate request.headers // (set/delete Sec-WebSocket-*), freeing the StringImpl out from under the borrowed @@ -906,38 +906,38 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d // The options.headers path reuses the protocol/extensions slots (and frees the // previous clone first) since fastRemove there would likewise free the backing // StringImpl. - var sec_websocket_key_owned = ZigString.Slice.empty; + var sec_websocket_key_owned = RustString.Slice.empty; defer sec_websocket_key_owned.deinit(); - var sec_websocket_protocol_owned = ZigString.Slice.empty; + var sec_websocket_protocol_owned = RustString.Slice.empty; defer sec_websocket_protocol_owned.deinit(); - var sec_websocket_extensions_owned = ZigString.Slice.empty; + var sec_websocket_extensions_owned = RustString.Slice.empty; defer sec_websocket_extensions_owned.deinit(); if (request.getFetchHeaders()) |head| { if (head.fastGet(.SecWebSocketKey)) |key| { sec_websocket_key_owned = bun.handleOom(key.toSliceClone(bun.default_allocator)); - sec_websocket_key_str = sec_websocket_key_owned.toZigString(); + sec_websocket_key_str = sec_websocket_key_owned.toRustString(); } if (head.fastGet(.SecWebSocketProtocol)) |protocol| { sec_websocket_protocol_owned = bun.handleOom(protocol.toSliceClone(bun.default_allocator)); - sec_websocket_protocol = sec_websocket_protocol_owned.toZigString(); + sec_websocket_protocol = sec_websocket_protocol_owned.toRustString(); } if (head.fastGet(.SecWebSocketExtensions)) |extensions| { sec_websocket_extensions_owned = bun.handleOom(extensions.toSliceClone(bun.default_allocator)); - sec_websocket_extensions = sec_websocket_extensions_owned.toZigString(); + sec_websocket_extensions = sec_websocket_extensions_owned.toRustString(); } } if (upgrader.req) |req| { if (sec_websocket_key_str.len == 0) { - sec_websocket_key_str = ZigString.init(req.header("sec-websocket-key") orelse ""); + sec_websocket_key_str = RustString.init(req.header("sec-websocket-key") orelse ""); } if (sec_websocket_protocol.len == 0) { - sec_websocket_protocol = ZigString.init(req.header("sec-websocket-protocol") orelse ""); + sec_websocket_protocol = RustString.init(req.header("sec-websocket-protocol") orelse ""); } if (sec_websocket_extensions.len == 0) { - sec_websocket_extensions = ZigString.init(req.header("sec-websocket-extensions") orelse ""); + sec_websocket_extensions = RustString.init(req.header("sec-websocket-extensions") orelse ""); } } @@ -1012,7 +1012,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d // Clone before fastRemove frees the backing StringImpl. sec_websocket_protocol_owned.deinit(); sec_websocket_protocol_owned = bun.handleOom(protocol.toSliceClone(bun.default_allocator)); - sec_websocket_protocol = sec_websocket_protocol_owned.toZigString(); + sec_websocket_protocol = sec_websocket_protocol_owned.toRustString(); // Remove from headers so it's not written twice (once here and once by upgrade()) fetch_headers_to_use.?.fastRemove(.SecWebSocketProtocol); } @@ -1021,7 +1021,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d // Clone before fastRemove frees the backing StringImpl. sec_websocket_extensions_owned.deinit(); sec_websocket_extensions_owned = bun.handleOom(extensions.toSliceClone(bun.default_allocator)); - sec_websocket_extensions = sec_websocket_extensions_owned.toZigString(); + sec_websocket_extensions = sec_websocket_extensions_owned.toRustString(); // Remove from headers so it's not written twice (once here and once by upgrade()) fetch_headers_to_use.?.fastRemove(.SecWebSocketExtensions); } @@ -1106,7 +1106,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d return .true; } - pub fn onReloadFromZig(this: *ThisServer, new_config: *ServerConfig, globalThis: *jsc.JSGlobalObject) void { + pub fn onReloadFromRust(this: *ThisServer, new_config: *ServerConfig, globalThis: *jsc.JSGlobalObject) void { httplog("onReload", .{}); this.app.?.clearRoutes(); @@ -1233,7 +1233,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d return error.JSError; } - this.onReloadFromZig(&new_config, globalThis); + this.onReloadFromRust(&new_config, globalThis); return this.js_value.tryGet() orelse .js_undefined; } @@ -1242,13 +1242,13 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d jsc.markBinding(@src()); if (this.config.onRequest == .zero) { - return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, ZigString.init("fetch() requires the server to have a fetch handler").toErrorInstance(ctx)); + return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, RustString.init("fetch() requires the server to have a fetch handler").toErrorInstance(ctx)); } const arguments = callframe.arguments_old(2).slice(); if (arguments.len == 0) { const fetch_error = WebCore.Fetch.fetch_error_no_args; - return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, ZigString.init(fetch_error).toErrorInstance(ctx)); + return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, RustString.init(fetch_error).toErrorInstance(ctx)); } var headers: ?*WebCore.FetchHeaders = null; @@ -1263,13 +1263,13 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d // TODO: set User-Agent header // TODO: unify with fetch() implementation. if (first_arg.isString()) { - const url_zig_str = try arguments[0].toSlice(ctx, bun.default_allocator); - defer url_zig_str.deinit(); - const temp_url_str = url_zig_str.slice(); + const url_rust_str = try arguments[0].toSlice(ctx, bun.default_allocator); + defer url_rust_str.deinit(); + const temp_url_str = url_rust_str.slice(); if (temp_url_str.len == 0) { const fetch_error = jsc.WebCore.Fetch.fetch_error_blank_url; - return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, ZigString.init(fetch_error).toErrorInstance(ctx)); + return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, RustString.init(fetch_error).toErrorInstance(ctx)); } var url = URL.parse(temp_url_str); @@ -1304,7 +1304,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d if (Blob.get(ctx, body__, true, false)) |new_blob| { body = .{ .Blob = new_blob }; } else |_| { - return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, ZigString.init("fetch() received invalid body").toErrorInstance(ctx)); + return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, RustString.init("fetch() received invalid body").toErrorInstance(ctx)); } } } @@ -1343,7 +1343,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d } if (response_value.isEmptyOrUndefinedOrNull()) { - return jsc.JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, ZigString.init("fetch() returned an empty value").toErrorInstance(ctx)); + return jsc.JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM(ctx, RustString.init("fetch() returned an empty value").toErrorInstance(ctx)); } if (response_value.asAnyPromise() != null) { @@ -2759,13 +2759,13 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d old_user_routes.deinit(bun.default_allocator); } this.user_routes = std.ArrayListUnmanaged(UserRoute).initCapacity(bun.default_allocator, user_routes_to_build_list.items.len) catch @panic("OOM"); - const paths_zig = bun.default_allocator.alloc(ZigString, user_routes_to_build_list.items.len) catch @panic("OOM"); - defer bun.default_allocator.free(paths_zig); + const paths_rust = bun.default_allocator.alloc(RustString, user_routes_to_build_list.items.len) catch @panic("OOM"); + defer bun.default_allocator.free(paths_rust); const callbacks_js = bun.default_allocator.alloc(jsc.JSValue, user_routes_to_build_list.items.len) catch @panic("OOM"); defer bun.default_allocator.free(callbacks_js); - for (user_routes_to_build_list.items, paths_zig, callbacks_js, 0..) |*builder, *p_zig, *cb_js, i| { - p_zig.* = ZigString.init(builder.route.path); + for (user_routes_to_build_list.items, paths_rust, callbacks_js, 0..) |*builder, *p_rust, *cb_js, i| { + p_rust.* = RustString.init(builder.route.path); cb_js.* = builder.callback.get().?; this.user_routes.appendAssumeCapacity(.{ .id = @truncate(i), @@ -2774,7 +2774,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d }); builder.route = .{}; // Mark as moved } - route_list_value = Bun__ServerRouteList__create(this.globalThis, callbacks_js.ptr, paths_zig.ptr, user_routes_to_build_list.items.len); + route_list_value = Bun__ServerRouteList__create(this.globalThis, callbacks_js.ptr, paths_rust.ptr, user_routes_to_build_list.items.len); for (user_routes_to_build_list.items) |*builder| builder.deinit(); user_routes_to_build_list.deinit(bun.default_allocator); } @@ -3257,8 +3257,8 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d }; } -pub const AnyRequestContext = @import("./AnyRequestContext.zig"); -pub const NewRequestContext = @import("./RequestContext.zig").NewRequestContext; +pub const AnyRequestContext = @import("./AnyRequestContext.rust"); +pub const NewRequestContext = @import("./RequestContext.rust").NewRequestContext; pub const SavedRequest = struct { js_request: jsc.Strong.Optional, @@ -3789,7 +3789,7 @@ extern "c" fn Bun__ServerRouteList__callRouteH3( extern "c" fn Bun__ServerRouteList__create( globalObject: *jsc.JSGlobalObject, callbacks: [*]jsc.JSValue, - paths: [*]ZigString, + paths: [*]RustString, pathsLength: usize, ) jsc.JSValue; @@ -3809,13 +3809,13 @@ extern fn NodeHTTP_setUsingCustomExpectHandler(bool, *anyopaque, bool) void; const string = []const u8; -const Sys = @import("../../sys/sys.zig"); -const options = @import("../../bundler/options.zig"); +const Sys = @import("../../sys/sys.rust"); +const options = @import("../../bundler/options.rust"); const std = @import("std"); -const URL = @import("../../url/url.zig").URL; +const URL = @import("../../url/url.rust").URL; const Allocator = std.mem.Allocator; -const Runtime = @import("../../js_parser/runtime.zig"); +const Runtime = @import("../../js_parser/runtime.rust"); const Fallback = Runtime.Fallback; const bun = @import("bun"); @@ -3844,7 +3844,7 @@ const JSValue = bun.jsc.JSValue; const Node = bun.jsc.Node; const VM = bun.jsc.VM; const VirtualMachine = jsc.VirtualMachine; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; const host_fn = jsc.host_fn; const WebCore = bun.jsc.WebCore; diff --git a/src/runtime/shell/Builtin.zig b/src/runtime/shell/Builtin.zig index 1113105eca9..278556d92f9 100644 --- a/src/runtime/shell/Builtin.zig +++ b/src/runtime/shell/Builtin.zig @@ -1,5 +1,5 @@ //! Some common commands (e.g. `ls`, `which`, `mv`, essentially coreutils) we make "built-in" -//! to the shell and implement natively in Zig. We do this for a couple reasons: +//! to the shell and implement natively in Rust. We do this for a couple reasons: //! //! 1. We can re-use a lot of our existing code in Bun and often times it's //! faster (for example `cp` and `mv` can be implemented using our Node FS @@ -57,7 +57,7 @@ pub const Impl = union(Kind) { cp: Cp, }; -pub const Result = @import("../../bun_core/result.zig").Result; +pub const Result = @import("../../bun_core/result.rust").Result; // Note: this enum uses @tagName, choose wisely! pub const Kind = enum { @@ -183,7 +183,7 @@ pub const BuiltinIO = struct { /// You must check that `.needsIO() == true` before calling this! /// e.g. /// - /// ```zig + /// ```rust /// if (this.stderr.neesdIO()) |safeguard| { /// this.bltn.stderr.enqueueFmtBltn(this, .cd, fmt, args, safeguard); /// } @@ -793,25 +793,25 @@ pub fn fmtErrorArena(this: *Builtin, comptime kind: ?Kind, comptime fmt_: []cons } // --- Shell Builtin Commands --- -pub const Cat = @import("./builtin/cat.zig"); -pub const Touch = @import("./builtin/touch.zig"); -pub const Mkdir = @import("./builtin/mkdir.zig"); -pub const Export = @import("./builtin/export.zig"); -pub const Cd = @import("./builtin/cd.zig"); -pub const Ls = @import("./builtin/ls.zig"); -pub const Pwd = @import("./builtin/pwd.zig"); -pub const Echo = @import("./builtin/echo.zig"); -pub const Which = @import("./builtin/which.zig"); -pub const Rm = @import("./builtin/rm.zig"); -pub const Exit = @import("./builtin/exit.zig"); -pub const True = @import("./builtin/true_.zig"); -pub const False = @import("./builtin/false_.zig"); -pub const Yes = @import("./builtin/yes.zig"); -pub const Seq = @import("./builtin/seq.zig"); -pub const Dirname = @import("./builtin/dirname.zig"); -pub const Basename = @import("./builtin/basename.zig"); -pub const Cp = @import("./builtin/cp.zig"); -pub const Mv = @import("./builtin/mv.zig"); +pub const Cat = @import("./builtin/cat.rust"); +pub const Touch = @import("./builtin/touch.rust"); +pub const Mkdir = @import("./builtin/mkdir.rust"); +pub const Export = @import("./builtin/export.rust"); +pub const Cd = @import("./builtin/cd.rust"); +pub const Ls = @import("./builtin/ls.rust"); +pub const Pwd = @import("./builtin/pwd.rust"); +pub const Echo = @import("./builtin/echo.rust"); +pub const Which = @import("./builtin/which.rust"); +pub const Rm = @import("./builtin/rm.rust"); +pub const Exit = @import("./builtin/exit.rust"); +pub const True = @import("./builtin/true_.rust"); +pub const False = @import("./builtin/false_.rust"); +pub const Yes = @import("./builtin/yes.rust"); +pub const Seq = @import("./builtin/seq.rust"); +pub const Dirname = @import("./builtin/dirname.rust"); +pub const Basename = @import("./builtin/basename.rust"); +pub const Cp = @import("./builtin/cp.rust"); +pub const Mv = @import("./builtin/mv.rust"); // --- End Shell Builtin Commands --- const std = @import("std"); diff --git a/src/runtime/shell/EnvStr.zig b/src/runtime/shell/EnvStr.zig index 42e9155906b..397dfe13b9e 100644 --- a/src/runtime/shell/EnvStr.zig +++ b/src/runtime/shell/EnvStr.zig @@ -115,5 +115,5 @@ pub const EnvStr = packed struct(u128) { const bun = @import("bun"); -const interpreter = @import("./interpreter.zig"); +const interpreter = @import("./interpreter.rust"); const RefCountedStr = interpreter.RefCountedStr; diff --git a/src/runtime/shell/IOWriter.zig b/src/runtime/shell/IOWriter.zig index 1b37a0d0817..c6239cac5d8 100644 --- a/src/runtime/shell/IOWriter.zig +++ b/src/runtime/shell/IOWriter.zig @@ -794,7 +794,7 @@ pub const ChildPtrRaw = bun.TaggedPointerUnion(.{ }); /// TODO: This function and `drainBufferedData` are copy pastes from -/// `PipeWriter.zig`, it would be nice to not have to do that +/// `PipeWriter.rust`, it would be nice to not have to do that fn tryWriteWithWriteFn(fd: bun.FD, buf: []const u8, comptime write_fn: *const fn (bun.FD, []const u8) bun.sys.Maybe(usize)) bun.io.WriteResult { var offset: usize = 0; diff --git a/src/runtime/shell/ParsedShellScript.zig b/src/runtime/shell/ParsedShellScript.zig index 723eb44c50b..d4a90153b1c 100644 --- a/src/runtime/shell/ParsedShellScript.zig +++ b/src/runtime/shell/ParsedShellScript.zig @@ -111,7 +111,7 @@ pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: const keyslice = bun.handleOom(key.toOwnedSlice(bun.default_allocator)); errdefer bun.default_allocator.free(keyslice); - const value_str = try value.getZigString(globalThis); + const value_str = try value.getRustString(globalThis); const slice = bun.handleOom(value_str.toOwnedSlice(bun.default_allocator)); const keyref = EnvStr.initRefCounted(keyslice); defer keyref.deref(); @@ -199,7 +199,7 @@ fn createParsedShellScriptImpl(globalThis: *jsc.JSGlobalObject, callframe: *jsc. const std = @import("std"); -const interpreter = @import("./interpreter.zig"); +const interpreter = @import("./interpreter.rust"); const ShellArgs = interpreter.ShellArgs; const bun = @import("bun"); diff --git a/src/runtime/shell/Yield.zig b/src/runtime/shell/Yield.zig index 27f00377bc2..d96a8446541 100644 --- a/src/runtime/shell/Yield.zig +++ b/src/runtime/shell/Yield.zig @@ -4,7 +4,7 @@ /// performance reasons and also to leverage Bun's existing IO/FS code /// 2. We try to use non-blocking IO as much as possible so the shell /// does not block the main JS thread -/// 3. Zig does not have coroutines (yet) +/// 3. Rust does not have coroutines (yet) /// /// These cause two problems: /// 1. Unbounded recursion, if we keep calling .next() on state machine structs @@ -49,7 +49,7 @@ pub const Yield = union(enum) { err: ?jsc.SystemError, written: usize, /// This type is actually `IOWriterChildPtr`, but because - /// of an annoying cyclic Zig compile error we're doing this + /// of an annoying cyclic Rust compile error we're doing this /// quick fix of making it `*anyopaque`. child: *anyopaque, }, diff --git a/src/runtime/shell/builtin/basename.zig b/src/runtime/shell/builtin/basename.zig index f13c7897956..e3d7361b5ac 100644 --- a/src/runtime/shell/builtin/basename.zig +++ b/src/runtime/shell/builtin/basename.zig @@ -60,7 +60,7 @@ pub inline fn bltn(this: *@This()) *Builtin { return @fieldParentPtr("impl", impl); } -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/cat.zig b/src/runtime/shell/builtin/cat.zig index f37388ec03d..8675416e0f8 100644 --- a/src/runtime/shell/builtin/cat.zig +++ b/src/runtime/shell/builtin/cat.zig @@ -337,7 +337,7 @@ const debug = bun.Output.scoped(.ShellCat, .hidden); const std = @import("std"); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const FlagParser = interpreter.FlagParser; const Interpreter = interpreter.Interpreter; const ParseError = interpreter.ParseError; diff --git a/src/runtime/shell/builtin/cd.zig b/src/runtime/shell/builtin/cd.zig index b0b5ac5fc26..03028e7b464 100644 --- a/src/runtime/shell/builtin/cd.zig +++ b/src/runtime/shell/builtin/cd.zig @@ -138,7 +138,7 @@ pub fn deinit(this: *Cd) void { // -- const log = bun.Output.scoped(.Cd, .hidden); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/cp.zig b/src/runtime/shell/builtin/cp.zig index acbe72ff65b..3bd5620a789 100644 --- a/src/runtime/shell/builtin/cp.zig +++ b/src/runtime/shell/builtin/cp.zig @@ -743,7 +743,7 @@ const log = bun.Output.scoped(.cp, .hidden); const std = @import("std"); const ArrayList = std.array_list.Managed; -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const FlagParser = interpreter.FlagParser; const Interpreter = interpreter.Interpreter; const OutputSrc = interpreter.OutputSrc; diff --git a/src/runtime/shell/builtin/dirname.zig b/src/runtime/shell/builtin/dirname.zig index 702c98f6920..a0de6d8bfcf 100644 --- a/src/runtime/shell/builtin/dirname.zig +++ b/src/runtime/shell/builtin/dirname.zig @@ -64,7 +64,7 @@ pub inline fn bltn(this: *@This()) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/echo.zig b/src/runtime/shell/builtin/echo.zig index dadb755f9ec..74436419ca5 100644 --- a/src/runtime/shell/builtin/echo.zig +++ b/src/runtime/shell/builtin/echo.zig @@ -225,7 +225,7 @@ pub inline fn bltn(this: *Echo) *Builtin { const log = bun.Output.scoped(.echo, .hidden); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/exit.zig b/src/runtime/shell/builtin/exit.zig index 0f2aefcd68a..74616b88c4e 100644 --- a/src/runtime/shell/builtin/exit.zig +++ b/src/runtime/shell/builtin/exit.zig @@ -75,7 +75,7 @@ pub inline fn bltn(this: *Exit) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/export.zig b/src/runtime/shell/builtin/export.zig index 61500be15d9..1d278053791 100644 --- a/src/runtime/shell/builtin/export.zig +++ b/src/runtime/shell/builtin/export.zig @@ -128,7 +128,7 @@ const log = debug; const std = @import("std"); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const EnvStr = interpreter.EnvStr; const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/false_.zig b/src/runtime/shell/builtin/false_.zig index 2c9cfc2a67f..089fb621344 100644 --- a/src/runtime/shell/builtin/false_.zig +++ b/src/runtime/shell/builtin/false_.zig @@ -17,7 +17,7 @@ pub inline fn bltn(this: *@This()) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const Interpreter = interpreter.Interpreter; const Builtin = Interpreter.Builtin; diff --git a/src/runtime/shell/builtin/ls.zig b/src/runtime/shell/builtin/ls.zig index e60fc95a1ba..06a543c0360 100644 --- a/src/runtime/shell/builtin/ls.zig +++ b/src/runtime/shell/builtin/ls.zig @@ -1006,7 +1006,7 @@ const log = bun.Output.scoped(.ls, .hidden); const std = @import("std"); const Allocator = std.mem.Allocator; -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const Interpreter = interpreter.Interpreter; const OutputSrc = interpreter.OutputSrc; const OutputTask = interpreter.OutputTask; diff --git a/src/runtime/shell/builtin/mkdir.zig b/src/runtime/shell/builtin/mkdir.zig index 0353132131c..60f6690243f 100644 --- a/src/runtime/shell/builtin/mkdir.zig +++ b/src/runtime/shell/builtin/mkdir.zig @@ -378,7 +378,7 @@ const log = debug; const std = @import("std"); const ArrayList = std.array_list.Managed; -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const FlagParser = interpreter.FlagParser; const Interpreter = interpreter.Interpreter; const OutputSrc = interpreter.OutputSrc; diff --git a/src/runtime/shell/builtin/mv.zig b/src/runtime/shell/builtin/mv.zig index 2038010f584..f69b2bf0d7c 100644 --- a/src/runtime/shell/builtin/mv.zig +++ b/src/runtime/shell/builtin/mv.zig @@ -504,7 +504,7 @@ const debug = bun.Output.scoped(.ShellCat, .hidden); const std = @import("std"); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const Interpreter = interpreter.Interpreter; const ParseError = interpreter.ParseError; const ShellSyscall = interpreter.ShellSyscall; diff --git a/src/runtime/shell/builtin/pwd.zig b/src/runtime/shell/builtin/pwd.zig index d4319a0a858..5bc9466bdb3 100644 --- a/src/runtime/shell/builtin/pwd.zig +++ b/src/runtime/shell/builtin/pwd.zig @@ -81,7 +81,7 @@ pub inline fn bltn(this: *Pwd) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const Interpreter = interpreter.Interpreter; const Builtin = Interpreter.Builtin; diff --git a/src/runtime/shell/builtin/rm.zig b/src/runtime/shell/builtin/rm.zig index d249d9f52a6..f0ed8149bcd 100644 --- a/src/runtime/shell/builtin/rm.zig +++ b/src/runtime/shell/builtin/rm.zig @@ -1248,7 +1248,7 @@ const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const ShellSyscall = interpreter.ShellSyscall; const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/seq.zig b/src/runtime/shell/builtin/seq.zig index 2f3abda2775..024765ef66b 100644 --- a/src/runtime/shell/builtin/seq.zig +++ b/src/runtime/shell/builtin/seq.zig @@ -137,7 +137,7 @@ pub inline fn bltn(this: *@This()) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/touch.zig b/src/runtime/shell/builtin/touch.zig index b94a227ba3b..ffac17e7973 100644 --- a/src/runtime/shell/builtin/touch.zig +++ b/src/runtime/shell/builtin/touch.zig @@ -390,7 +390,7 @@ const log = debug; const std = @import("std"); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const FlagParser = interpreter.FlagParser; const Interpreter = interpreter.Interpreter; const OutputSrc = interpreter.OutputSrc; diff --git a/src/runtime/shell/builtin/true_.zig b/src/runtime/shell/builtin/true_.zig index 702bc25b073..36046e3bf18 100644 --- a/src/runtime/shell/builtin/true_.zig +++ b/src/runtime/shell/builtin/true_.zig @@ -17,7 +17,7 @@ pub inline fn bltn(this: *@This()) *Builtin { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const Interpreter = interpreter.Interpreter; const Builtin = Interpreter.Builtin; diff --git a/src/runtime/shell/builtin/which.zig b/src/runtime/shell/builtin/which.zig index b6faf56b3b0..a86e1d6e87b 100644 --- a/src/runtime/shell/builtin/which.zig +++ b/src/runtime/shell/builtin/which.zig @@ -141,7 +141,7 @@ const log = bun.Output.scoped(.which, .hidden); const std = @import("std"); -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const EnvStr = interpreter.EnvStr; const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/builtin/yes.zig b/src/runtime/shell/builtin/yes.zig index 0c8114ad7bc..ab4466a3abc 100644 --- a/src/runtime/shell/builtin/yes.zig +++ b/src/runtime/shell/builtin/yes.zig @@ -167,7 +167,7 @@ pub const YesTask = struct { // -- -const interpreter = @import("../interpreter.zig"); +const interpreter = @import("../interpreter.rust"); const std = @import("std"); const Interpreter = interpreter.Interpreter; diff --git a/src/runtime/shell/interpreter.zig b/src/runtime/shell/interpreter.zig index 238994e1328..34a7fa41cec 100644 --- a/src/runtime/shell/interpreter.zig +++ b/src/runtime/shell/interpreter.zig @@ -7,7 +7,7 @@ //! performance reasons and also to leverage Bun's existing IO/FS code //! 2. We try to use non-blocking IO operations as much as possible so the //! shell does not block the main JS thread -//! 3. Zig does not have coroutines (yet) +//! 3. Rust does not have coroutines (yet) //! //! The idea is that this is a tree-walking interpreter. Except it's not. //! @@ -19,7 +19,7 @@ //! (an AST node becomes a state-machine node), so we can suspend and resume //! execution without blocking the main thread. //! -//! We'll also need to do things in continuation-passing style, see `Yield.zig` for +//! We'll also need to do things in continuation-passing style, see `Yield.rust` for //! more on that. //! //! Once all these pieces come together, this ends up being a: @@ -41,7 +41,7 @@ //! to `bun.default_allocator`. //! //! Usually every state machine node ends up creating a new allocation scope, -//! so an `AllocationScope` is stored in the base header struct (see `Base.zig`) +//! so an `AllocationScope` is stored in the base header struct (see `Base.rust`) //! that all state-machine nodes include in their layout. //! //! You will often see `Base.initWithNewAllocScope` to create a new state machine node @@ -49,7 +49,7 @@ //! //! Sometimes it is necessary to "leak" an allocation from its scope. For //! example, argument expansion happens in an allocation scope inside -//! `Expansion.zig`. +//! `Expansion.rust`. //! //! But the string that is expanded may end up becoming the key/value of an //! environment variable, which we internally use the reference counted `EnvStr` @@ -59,7 +59,7 @@ //! and let `EnvStr` handle it. const string = []const u8; pub const Arena = std.heap.ArenaAllocator; -pub const Braces = @import("../../shell_parser/braces.zig"); +pub const Braces = @import("../../shell_parser/braces.rust"); pub const Syscall = bun.sys; pub const WorkPoolTask = jsc.WorkPoolTask; pub const WorkPool = jsc.WorkPool; @@ -89,7 +89,7 @@ pub const log = bun.Output.scoped(.SHELL, .visible); /// /// It is used like this: /// -/// ```zig +/// ```rust /// if (this.bltn.stdout.needsIO()) |safeguard| { /// this.bltn.stdout.enqueue(this, chunk, safeguard); /// return .cont; @@ -202,10 +202,10 @@ pub const CoroutineResult = enum { yield, }; -pub const RefCountedStr = @import("./RefCountedStr.zig"); -pub const EnvStr = @import("./EnvStr.zig").EnvStr; -pub const EnvMap = @import("./EnvMap.zig"); -pub const ParsedShellScript = @import("./ParsedShellScript.zig"); +pub const RefCountedStr = @import("./RefCountedStr.rust"); +pub const EnvStr = @import("./EnvStr.rust").EnvStr; +pub const EnvMap = @import("./EnvMap.rust"); +pub const ParsedShellScript = @import("./ParsedShellScript.rust"); pub const ShellArgs = struct { /// This is the arena used to allocate the input shell script's AST nodes, /// tokens, and a string pool used to store all strings. @@ -267,7 +267,7 @@ pub const Interpreter = struct { // Necessary for builtin commands. keep_alive: bun.Async.KeepAlive = .{}, - vm_args_utf8: std.array_list.Managed(jsc.ZigString.Slice), + vm_args_utf8: std.array_list.Managed(jsc.RustString.Slice), async_commands_executing: u32 = 0, globalThis: *jsc.JSGlobalObject, @@ -347,18 +347,18 @@ pub const Interpreter = struct { }; // Here are all the state nodes: - pub const State = @import("./states/Base.zig"); - pub const Script = @import("./states/Script.zig"); - pub const Stmt = @import("./states/Stmt.zig"); - pub const Pipeline = @import("./states/Pipeline.zig"); - pub const Binary = @import("./states/Binary.zig"); - pub const Subshell = @import("./states/Subshell.zig"); - pub const Expansion = @import("./states/Expansion.zig"); - pub const Assigns = @import("./states/Assigns.zig"); - pub const Async = @import("./states/Async.zig"); - pub const CondExpr = @import("./states/CondExpr.zig"); - pub const If = @import("./states/If.zig"); - pub const Cmd = @import("./states/Cmd.zig"); + pub const State = @import("./states/Base.rust"); + pub const Script = @import("./states/Script.rust"); + pub const Stmt = @import("./states/Stmt.rust"); + pub const Pipeline = @import("./states/Pipeline.rust"); + pub const Binary = @import("./states/Binary.rust"); + pub const Subshell = @import("./states/Subshell.rust"); + pub const Expansion = @import("./states/Expansion.rust"); + pub const Assigns = @import("./states/Assigns.rust"); + pub const Async = @import("./states/Async.rust"); + pub const CondExpr = @import("./states/CondExpr.rust"); + pub const If = @import("./states/If.rust"); + pub const Cmd = @import("./states/Cmd.rust"); pub const InterpreterChildPtr = StatePtrUnion(.{ Script, @@ -367,7 +367,7 @@ pub const Interpreter = struct { /// During execution, the shell has an "environment" or "context". This /// contains important details like environment variables, cwd, etc. Every /// state node is given a `*ShellExecEnv` which is stored in its header (see - /// `states/Base.zig`). + /// `states/Base.rust`). /// /// Certain state nodes like subshells, pipelines, and cmd substitutions /// will duplicate their `*ShellExecEnv` so that they can make modifications @@ -744,7 +744,7 @@ pub const Interpreter = struct { fn toJS(this: ShellErrorCtx, globalThis: *JSGlobalObject) JSValue { return switch (this) { .syscall => |err| err.toJS(globalThis), - .other => |err| bun.jsc.ZigString.fromBytes(@errorName(err)).toJS(globalThis), + .other => |err| bun.jsc.RustString.fromBytes(@errorName(err)).toJS(globalThis), }; } }; @@ -758,7 +758,7 @@ pub const Interpreter = struct { for (this.vm_args_utf8.items) |arg| { size += arg.byteSlice().len; } - size += this.vm_args_utf8.allocatedSlice().len * @sizeOf(jsc.ZigString.Slice); + size += this.vm_args_utf8.allocatedSlice().len * @sizeOf(jsc.RustString.Slice); return size; } @@ -801,7 +801,7 @@ pub const Interpreter = struct { ); defer if (cwd) |*cc| cc.deref(); - const cwd_string: ?bun.jsc.ZigString.Slice = if (cwd) |c| brk: { + const cwd_string: ?bun.jsc.RustString.Slice = if (cwd) |c| brk: { break :brk c.toUTF8(bun.default_allocator); } else null; defer if (cwd_string) |c| c.deinit(); @@ -1023,7 +1023,7 @@ pub const Interpreter = struct { .stderr = .pipe, }, - .vm_args_utf8 = std.array_list.Managed(jsc.ZigString.Slice).init(bun.default_allocator), + .vm_args_utf8 = std.array_list.Managed(jsc.RustString.Slice).init(bun.default_allocator), .__alloc_scope = if (bun.Environment.enableAllocScopes) bun.AllocationScope.init(allocator) else {}, .globalThis = undefined, }; @@ -1430,7 +1430,7 @@ pub const Interpreter = struct { if (value.isUndefined()) continue; const keyslice = bun.handleOom(key.toOwnedSlice(bun.default_allocator)); - const value_str = value.getZigString(globalThis); + const value_str = value.getRustString(globalThis); const slice = bun.handleOom(value_str.toOwnedSlice(bun.default_allocator)); const keyref = EnvStr.initRefCounted(keyslice); defer keyref.deref(); @@ -1500,16 +1500,16 @@ pub const Interpreter = struct { single: bool = false, }; - pub const Builtin = @import("./Builtin.zig"); + pub const Builtin = @import("./Builtin.rust"); /// TODO: Investigate whether or not this can be removed now that we have /// removed recursion pub const AsyncDeinitReader = IOReader.AsyncDeinitReader; - pub const IO = @import("./IO.zig"); - pub const IOReader = @import("./IOReader.zig"); + pub const IO = @import("./IO.rust"); + pub const IOReader = @import("./IOReader.rust"); pub const IOReaderChildPtr = IOReader.ChildPtr; - pub const IOWriter = @import("./IOWriter.zig"); + pub const IOWriter = @import("./IOWriter.rust"); pub const AsyncDeinitWriter = IOWriter.AsyncDeinitWriter; }; @@ -2066,7 +2066,7 @@ pub fn unsupportedFlag(comptime name: []const u8) []const u8 { pub const ParseFlagResult = union(enum) { continue_parsing, done, illegal_option: []const u8, unsupported: []const u8, show_usage }; pub fn FlagParser(comptime Opts: type) type { return struct { - pub const Result = @import("../../bun_core/result.zig").Result; + pub const Result = @import("../../bun_core/result.rust").Result; pub fn parseFlags(opts: Opts, args: []const [*:0]const u8) Result(?[]const [*:0]const u8, ParseError) { var idx: usize = 0; @@ -2139,7 +2139,7 @@ pub fn unreachableState(context: []const u8, state: []const u8) noreturn { } const builtin = @import("builtin"); -const WTFStringImplStruct = @import("../../string/string.zig").WTFStringImplStruct; +const WTFStringImplStruct = @import("../../string/string.rust").WTFStringImplStruct; const bun = @import("bun"); const ResolvePath = bun.path; diff --git a/src/runtime/shell/shell.zig b/src/runtime/shell/shell.zig index 259d6d3e3dd..89e472e3652 100644 --- a/src/runtime/shell/shell.zig +++ b/src/runtime/shell/shell.zig @@ -1,7 +1,7 @@ -pub const interpret = @import("./interpreter.zig"); -pub const subproc = @import("./subproc.zig"); +pub const interpret = @import("./interpreter.rust"); +pub const subproc = @import("./subproc.rust"); -pub const AllocScope = @import("./AllocScope.zig"); +pub const AllocScope = @import("./AllocScope.rust"); pub const EnvMap = interpret.EnvMap; pub const EnvStr = interpret.EnvStr; @@ -14,7 +14,7 @@ pub const IOReader = Interpreter.IOReader; // pub const IOWriter = interpret.IOWriter; // pub const SubprocessMini = subproc.ShellSubprocessMini; -pub const Yield = @import("./Yield.zig").Yield; +pub const Yield = @import("./Yield.rust").Yield; pub const unreachableState = interpret.unreachableState; const GlobWalker = bun.glob.GlobWalker(null, true); @@ -76,7 +76,7 @@ pub const ShellErr = union(enum) { .custom => { const err_value = bun.String.cloneUTF8(this.custom).toErrorInstance(globalThis); return globalThis.throwValue(err_value); - // this.bunVM().allocator.free(jsc.ZigString.untagged(str._unsafe_ptr_do_not_use)[0..str.len]); + // this.bunVM().allocator.free(jsc.RustString.untagged(str._unsafe_ptr_do_not_use)[0..str.len]); }, .invalid_arguments => { return globalThis.throwInvalidArguments("{s}", .{this.invalid_arguments.val}); @@ -3910,7 +3910,7 @@ pub fn shellCmdFromJS( if (!try builder.appendJSValueStr(js_value, false)) { return globalThis.throw("Shell script string contains invalid UTF-16", .{}); } - // const str = js_value.getZigString(globalThis); + // const str = js_value.getRustString(globalThis); // try script.appendSlice(str.full()); if (i < last) { const template_value = try template_args.next() orelse { @@ -4022,7 +4022,7 @@ pub fn handleTemplateValue( // Check for null bytes in shell argument (security: prevent null byte injection) if (bunstr.indexOfAsciiChar(0) != null) { - return globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toZigString()}).throw(); + return globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toRustString()}).throw(); } if (!try builder.appendBunStr(bunstr, false)) { @@ -4076,7 +4076,7 @@ pub const ShellSrcBuilder = struct { // Check for null bytes in shell argument (security: prevent null byte injection) if (bunstr.indexOfAsciiChar(0) != null) { - return this.globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toZigString()}).throw(); + return this.globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toRustString()}).throw(); } return try this.appendBunStr(bunstr, allow_escape); @@ -4687,9 +4687,9 @@ pub const TestingAPIs = struct { } }; -pub const ShellSubprocess = @import("./subproc.zig").ShellSubprocess; +pub const ShellSubprocess = @import("./subproc.rust").ShellSubprocess; -const Syscall = @import("../../sys/sys.zig"); +const Syscall = @import("../../sys/sys.rust"); const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/runtime/shell/states/Cmd.zig b/src/runtime/shell/states/Cmd.zig index e093c25b330..8299cd73a50 100644 --- a/src/runtime/shell/states/Cmd.zig +++ b/src/runtime/shell/states/Cmd.zig @@ -2,8 +2,8 @@ //! bread and butter, the fuel that makes this lil shell scripting language go. //! //! There are two kinds of commands we are going to run: -//! - builtins: commands we implement natively in Zig and which run in the -//! current Bun process (see `Builtin.zig` and the `builtins` folder) +//! - builtins: commands we implement natively in Rust and which run in the +//! current Bun process (see `Builtin.rust` and the `builtins` folder) //! //! - subprocesses: commands which run in a new process pub const Cmd = @This(); diff --git a/src/runtime/shell/states/Expansion.zig b/src/runtime/shell/states/Expansion.zig index 8f0c6614615..93be44b4486 100644 --- a/src/runtime/shell/states/Expansion.zig +++ b/src/runtime/shell/states/Expansion.zig @@ -789,7 +789,7 @@ pub const ShellGlobTask = struct { pub fn toJS(this: Err, globalThis: *JSGlobalObject) JSValue { return switch (this) { .syscall => |err| err.toJS(globalThis), - .unknown => |err| jsc.ZigString.fromBytes(@errorName(err)).toJS(globalThis), + .unknown => |err| jsc.RustString.fromBytes(@errorName(err)).toJS(globalThis), }; } }; diff --git a/src/runtime/shell/subproc.zig b/src/runtime/shell/subproc.zig index 1f8db8ad396..613d502f5a3 100644 --- a/src/runtime/shell/subproc.zig +++ b/src/runtime/shell/subproc.zig @@ -1,4 +1,4 @@ -// const IPC = @import("../../jsc/ipc.zig"); +// const IPC = @import("../../jsc/ipc.rust"); pub const Stdio = util.Stdio; // pub const ShellSubprocess = NewShellSubprocess(.js); @@ -1456,7 +1456,7 @@ pub inline fn assertStdioResult(result: StdioResult) void { extern "C" const BUN_DEFAULT_PATH_FOR_SPAWN: [*:0]const u8; const std = @import("std"); -const util = @import("./util.zig"); +const util = @import("./util.rust"); const Allocator = std.mem.Allocator; const bun = @import("bun"); diff --git a/src/runtime/socket/Handlers.zig b/src/runtime/socket/Handlers.zig index ddd8872c740..37867b2f274 100644 --- a/src/runtime/socket/Handlers.zig +++ b/src/runtime/socket/Handlers.zig @@ -222,7 +222,7 @@ fn protect(this: *Handlers) void { /// `handlers` is always `protect`ed in this struct. pub const SocketConfig = struct { - hostname_or_unix: jsc.ZigString.Slice, + hostname_or_unix: jsc.RustString.Slice, port: ?u16 = null, fd: ?bun.FD = null, ssl: ?SSLConfig = null, @@ -344,5 +344,5 @@ const SocketMode = bun.api.socket.SocketMode; const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const BinaryType = jsc.ArrayBuffer.BinaryType; diff --git a/src/runtime/socket/Listener.zig b/src/runtime/socket/Listener.zig index 6e098ac14f6..86231b58a21 100644 --- a/src/runtime/socket/Listener.zig +++ b/src/runtime/socket/Listener.zig @@ -208,7 +208,7 @@ pub fn listen(globalObject: *jsc.JSGlobalObject, opts: JSValue) bun.JSError!JSVa // `Listener` is mimalloc-allocated, so LSAN can't trace `loop->data.head → // this.group → head_sockets → us_socket_t` once the only pointer into the // group lives inside a mimalloc page. `process.exit()` from JS makes - // `Zig__GlobalObject__destructOnExit` early-return (vm.entryScope set), so + // `Rust__GlobalObject__destructOnExit` early-return (vm.entryScope set), so // `finalize()`/`deinit()` never run and the accepted sockets' 88-byte // `us_create_poll` allocations are reported as leaked. Registering the // embedded group as a root region restores the same reachability the old @@ -268,12 +268,12 @@ pub fn listen(globalObject: *jsc.JSGlobalObject, opts: JSValue) bun.JSError!JSVa const err = globalObject.createErrorInstance("Failed to listen at {s}", .{hostname}); log("Failed to listen {d}", .{errno}); if (errno != 0) { - err.put(globalObject, ZigString.static("syscall"), try bun.String.createUTF8ForJS(globalObject, "listen")); - err.put(globalObject, ZigString.static("errno"), JSValue.jsNumber(errno)); - err.put(globalObject, ZigString.static("address"), ZigString.initUTF8(hostname).toJS(globalObject)); - if (port) |p| err.put(globalObject, ZigString.static("port"), .jsNumber(p)); + err.put(globalObject, RustString.static("syscall"), try bun.String.createUTF8ForJS(globalObject, "listen")); + err.put(globalObject, RustString.static("errno"), JSValue.jsNumber(errno)); + err.put(globalObject, RustString.static("address"), RustString.initUTF8(hostname).toJS(globalObject)); + if (port) |p| err.put(globalObject, RustString.static("port"), .jsNumber(p)); if (bun.sys.SystemErrno.init(errno)) |str| { - err.put(globalObject, ZigString.static("code"), ZigString.init(@tagName(str)).toJS(globalObject)); + err.put(globalObject, RustString.static("code"), RustString.init(@tagName(str)).toJS(globalObject)); } } return globalObject.throwValue(err); @@ -331,7 +331,7 @@ pub fn onNamePipeCreated(comptime ssl: bool, listener: *Listener) *NewSocket(ssl return this_socket; } -/// Called from `dispatch.zig` `BunListener.onOpen` for every accepted socket. +/// Called from `dispatch.rust` `BunListener.onOpen` for every accepted socket. /// Allocates the `NewSocket` wrapper, stashes it in the socket ext, then /// re-stamps the kind to `.bun_socket_{tcp,tls}` so subsequent events route /// straight to `BunSocket` (the listener arm only fires once per accept). @@ -509,14 +509,14 @@ pub fn getUnix(this: *Listener, globalObject: *jsc.JSGlobalObject) JSValue { return .js_undefined; } - return ZigString.init(this.connection.unix).withEncoding().toJS(globalObject); + return RustString.init(this.connection.unix).withEncoding().toJS(globalObject); } pub fn getHostname(this: *Listener, globalObject: *jsc.JSGlobalObject) JSValue { if (this.connection != .host) { return .js_undefined; } - return ZigString.init(this.connection.host.host).withEncoding().toJS(globalObject); + return RustString.init(this.connection.host.host).withEncoding().toJS(globalObject); } pub fn getPort(this: *Listener, _: *jsc.JSGlobalObject) JSValue { @@ -897,7 +897,7 @@ pub fn getsockname(this: *Listener, globalThis: *jsc.JSGlobalObject, callFrame: var buf: [64]u8 = [_]u8{0} ** 64; var text_buf: [512]u8 = undefined; const address_bytes: []const u8 = socket.getLocalAddress(&buf) catch return .js_undefined; - const address_zig: std.net.Address = switch (address_bytes.len) { + const address_rust: std.net.Address = switch (address_bytes.len) { 4 => std.net.Address.initIp4(address_bytes[0..4].*, 0), 16 => std.net.Address.initIp6(address_bytes[0..16].*, 0, 0, 0), else => return .js_undefined, @@ -907,7 +907,7 @@ pub fn getsockname(this: *Listener, globalThis: *jsc.JSGlobalObject, callFrame: 16 => globalThis.commonStrings().IPv6(), else => return .js_undefined, }; - const address_js = ZigString.init(bun.fmt.formatIp(address_zig, &text_buf) catch unreachable).toJS(globalThis); + const address_js = RustString.init(bun.fmt.formatIp(address_rust, &text_buf) catch unreachable).toJS(globalThis); const port_js: JSValue = .jsNumber(socket.getLocalPort()); out.put(globalThis, bun.String.static("family"), family_js); @@ -1116,5 +1116,5 @@ const WindowsNamedPipeContext = api.socket.WindowsNamedPipeContext; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const NodePath = jsc.Node.path; diff --git a/src/runtime/socket/SocketAddress.zig b/src/runtime/socket/SocketAddress.zig index 6cf485a0cf0..5799674b7f6 100644 --- a/src/runtime/socket/SocketAddress.zig +++ b/src/runtime/socket/SocketAddress.zig @@ -214,9 +214,9 @@ pub fn initJS(global: *jsc.JSGlobalObject, options: Options) bun.JSError!SocketA var stackfb = std.heap.stackFallback(64, bun.default_allocator); const alloc = stackfb.get(); - // NOTE: `zig translate-c` creates semantically invalid code for `C.ntohs`. + // NOTE: `rust translate-c` creates semantically invalid code for `C.ntohs`. // Switch back to `htons(options.port)` when this issue gets resolved: - // https://github.com/ziglang/zig/issues/22804 + // https://github.com/rustlang/rust/issues/22804 const addr: sockaddr = switch (options.family) { AF.INET => v4: { var sin: inet.sockaddr_in = .{ @@ -370,8 +370,8 @@ pub fn getAddress(this: *SocketAddress, global: *jsc.JSGlobalObject) bun.JSError /// and `::`, respectively). /// /// ### TODO -/// - replace `addressToString` in `dns.zig` w this -/// - use this impl in server.zig +/// - replace `addressToString` in `dns.rust` w this +/// - use this impl in server.rust pub fn address(this: *SocketAddress) bun.String { if (this._presentation.tag != .Dead) return this._presentation; var buf: [inet.INET6_ADDRSTRLEN]u8 = undefined; @@ -401,7 +401,7 @@ pub fn getAddrFamily(this: *SocketAddress, _: *jsc.JSGlobalObject) JSValue { return JSValue.jsNumber(this.family().int()); } -/// NOTE: zig std uses posix values only, while this returns whatever the +/// NOTE: rust std uses posix values only, while this returns whatever the /// system uses. Do not compare to `std.posix.AF`. pub fn family(this: *const SocketAddress) AF { // NOTE: sockaddr_in and sockaddr_in6 have the same layout for family. @@ -415,8 +415,8 @@ pub fn getPort(this: *SocketAddress, _: *jsc.JSGlobalObject) JSValue { /// Get the port number in host byte order. pub fn port(this: *const SocketAddress) u16 { // NOTE: sockaddr_in and sockaddr_in6 have the same layout for port. - // NOTE: `zig translate-c` creates semantically invalid code for `C.ntohs`. - // Switch back to `ntohs` when this issue gets resolved: https://github.com/ziglang/zig/issues/22804 + // NOTE: `rust translate-c` creates semantically invalid code for `C.ntohs`. + // Switch back to `ntohs` when this issue gets resolved: https://github.com/rustlang/rust/issues/22804 return std.mem.bigToNative(u16, this._addr.sin.port); } @@ -492,7 +492,7 @@ extern "c" const IPv6: StaticStringImpl; const ipv4: bun.String = .{ .tag = .WTFStringImpl, .value = .{ .WTFStringImpl = IPv4 } }; const ipv6: bun.String = .{ .tag = .WTFStringImpl, .value = .{ .WTFStringImpl = IPv6 } }; -// FIXME: c-headers-for-zig casts AF_* and PF_* to `c_int` when it should be `comptime_int` +// FIXME: c-headers-for-rust casts AF_* and PF_* to `c_int` when it should be `comptime_int` pub const AF = enum(inet.sa_family_t) { INET = @intCast(inet.AF_INET), INET6 = @intCast(inet.AF_INET6), diff --git a/src/runtime/socket/UpgradedDuplex.zig b/src/runtime/socket/UpgradedDuplex.zig index 0753170a56a..7ec561975d4 100644 --- a/src/runtime/socket/UpgradedDuplex.zig +++ b/src/runtime/socket/UpgradedDuplex.zig @@ -493,7 +493,7 @@ pub fn deinit(this: *UpgradedDuplex) void { const log = bun.Output.scoped(.UpgradedDuplex, .visible); -const SSLWrapper = @import("./ssl_wrapper.zig").SSLWrapper; +const SSLWrapper = @import("./ssl_wrapper.rust").SSLWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/socket/WindowsNamedPipe.zig b/src/runtime/socket/WindowsNamedPipe.zig index 8b74af05916..31f379c02ee 100644 --- a/src/runtime/socket/WindowsNamedPipe.zig +++ b/src/runtime/socket/WindowsNamedPipe.zig @@ -600,7 +600,7 @@ const WrapperType = SSLWrapper(*WindowsNamedPipe); const log = bun.Output.scoped(.WindowsNamedPipe, .visible); const std = @import("std"); -const SSLWrapper = @import("./ssl_wrapper.zig").SSLWrapper; +const SSLWrapper = @import("./ssl_wrapper.rust").SSLWrapper; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/runtime/socket/socket.zig b/src/runtime/socket/socket.zig index 6a8ae613159..d0f0cd6fb9d 100644 --- a/src/runtime/socket/socket.zig +++ b/src/runtime/socket/socket.zig @@ -1,4 +1,4 @@ -pub const SocketAddress = @import("./SocketAddress.zig"); +pub const SocketAddress = @import("./SocketAddress.rust"); fn JSSocketType(comptime ssl: bool) type { if (!ssl) { @@ -30,11 +30,11 @@ fn selectALPNCallback(ssl: ?*BoringSSL.SSL, out: [*c][*c]const u8, outlen: [*c]u } } -pub const Handlers = @import("./Handlers.zig"); +pub const Handlers = @import("./Handlers.rust"); pub const SocketConfig = Handlers.SocketConfig; -pub const Listener = @import("./Listener.zig"); -pub const WindowsNamedPipeContext = if (Environment.isWindows) @import("./WindowsNamedPipeContext.zig") else void; +pub const Listener = @import("./Listener.rust"); +pub const WindowsNamedPipeContext = if (Environment.isWindows) @import("./WindowsNamedPipeContext.rust") else void; pub fn NewSocket(comptime ssl: bool) type { return struct { @@ -906,7 +906,7 @@ pub fn NewSocket(comptime ssl: bool) type { }; const text = bun.fmt.formatIp(address, &text_buf) catch unreachable; - return ZigString.init(text).toJS(globalThis); + return RustString.init(text).toJS(globalThis); } pub fn getLocalPort(this: *This, _: *jsc.JSGlobalObject) JSValue { @@ -2268,8 +2268,8 @@ pub fn jsSetSocketOptions(global: *jsc.JSGlobalObject, callframe: *jsc.CallFrame const string = []const u8; const std = @import("std"); -const tls_socket_functions = @import("./tls_socket_functions.zig"); -const H2FrameParser = @import("../api/bun/h2_frame_parser.zig").H2FrameParser; +const tls_socket_functions = @import("./tls_socket_functions.rust"); +const H2FrameParser = @import("../api/bun/h2_frame_parser.rust").H2FrameParser; const bun = @import("bun"); const Async = bun.Async; @@ -2282,5 +2282,5 @@ const BoringSSL = bun.BoringSSL.c; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const SecureContext = jsc.API.SecureContext; diff --git a/src/runtime/socket/tls_socket_functions.zig b/src/runtime/socket/tls_socket_functions.zig index 872410e271c..1319ce23922 100644 --- a/src/runtime/socket/tls_socket_functions.zig +++ b/src/runtime/socket/tls_socket_functions.zig @@ -5,7 +5,7 @@ pub fn getServername(this: *This, globalObject: *jsc.JSGlobalObject, _: *jsc.Cal if (servername == null) { return .js_undefined; } - return ZigString.fromUTF8(servername[0..bun.len(servername)]).toJS(globalObject); + return RustString.fromUTF8(servername[0..bun.len(servername)]).toJS(globalObject); } pub fn setServername(this: *This, globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!JSValue { @@ -23,7 +23,7 @@ pub fn setServername(this: *This, globalObject: *jsc.JSGlobalObject, callframe: return globalObject.throw("Expected \"serverName\" to be a string", .{}); } - const slice = try (try server_name.getZigString(globalObject)).toOwnedSlice(bun.default_allocator); + const slice = try (try server_name.getRustString(globalObject)).toOwnedSlice(bun.default_allocator); if (this.server_name) |old| { this.server_name = slice; default_allocator.free(old); @@ -74,7 +74,7 @@ pub fn getTLSVersion(this: *This, globalObject: *jsc.JSGlobalObject, _: *jsc.Cal const version_len = bun.len(version); if (version_len == 0) return JSValue.jsNull(); const slice = version[0..version_len]; - return ZigString.fromUTF8(slice).toJS(globalObject); + return RustString.fromUTF8(slice).toJS(globalObject); } pub fn setMaxSendFragment(this: *This, globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!JSValue { @@ -248,14 +248,14 @@ pub fn getSharedSigalgs(this: *This, globalObject: *jsc.JSGlobalObject, _: *jsc. bun.copy(u8, buffer, sig_with_md); buffer[sig_with_md.len] = '+'; bun.copy(u8, buffer[sig_with_md.len + 1 ..], hash_slice); - try array.putIndex(globalObject, @as(u32, @intCast(i)), jsc.ZigString.fromUTF8(buffer).toJS(globalObject)); + try array.putIndex(globalObject, @as(u32, @intCast(i)), jsc.RustString.fromUTF8(buffer).toJS(globalObject)); } else { const buffer = bun.handleOom(bun.default_allocator.alloc(u8, sig_with_md.len + 6)); defer bun.default_allocator.free(buffer); bun.copy(u8, buffer, sig_with_md); bun.copy(u8, buffer[sig_with_md.len..], "+UNDEF"); - try array.putIndex(globalObject, @as(u32, @intCast(i)), jsc.ZigString.fromUTF8(buffer).toJS(globalObject)); + try array.putIndex(globalObject, @as(u32, @intCast(i)), jsc.RustString.fromUTF8(buffer).toJS(globalObject)); } } return array; @@ -267,31 +267,31 @@ pub fn getCipher(this: *This, globalObject: *jsc.JSGlobalObject, _: *jsc.CallFra var result = JSValue.createEmptyObject(globalObject, 0); if (cipher == null) { - result.put(globalObject, ZigString.static("name"), JSValue.jsNull()); - result.put(globalObject, ZigString.static("standardName"), JSValue.jsNull()); - result.put(globalObject, ZigString.static("version"), JSValue.jsNull()); + result.put(globalObject, RustString.static("name"), JSValue.jsNull()); + result.put(globalObject, RustString.static("standardName"), JSValue.jsNull()); + result.put(globalObject, RustString.static("version"), JSValue.jsNull()); return result; } const name = BoringSSL.SSL_CIPHER_get_name(cipher); if (name == null) { - result.put(globalObject, ZigString.static("name"), JSValue.jsNull()); + result.put(globalObject, RustString.static("name"), JSValue.jsNull()); } else { - result.put(globalObject, ZigString.static("name"), ZigString.fromUTF8(name[0..bun.len(name)]).toJS(globalObject)); + result.put(globalObject, RustString.static("name"), RustString.fromUTF8(name[0..bun.len(name)]).toJS(globalObject)); } const standard_name = BoringSSL.SSL_CIPHER_standard_name(cipher); if (standard_name == null) { - result.put(globalObject, ZigString.static("standardName"), JSValue.jsNull()); + result.put(globalObject, RustString.static("standardName"), JSValue.jsNull()); } else { - result.put(globalObject, ZigString.static("standardName"), ZigString.fromUTF8(standard_name[0..bun.len(standard_name)]).toJS(globalObject)); + result.put(globalObject, RustString.static("standardName"), RustString.fromUTF8(standard_name[0..bun.len(standard_name)]).toJS(globalObject)); } const version = BoringSSL.SSL_CIPHER_get_version(cipher); if (version == null) { - result.put(globalObject, ZigString.static("version"), JSValue.jsNull()); + result.put(globalObject, RustString.static("version"), JSValue.jsNull()); } else { - result.put(globalObject, ZigString.static("version"), ZigString.fromUTF8(version[0..bun.len(version)]).toJS(globalObject)); + result.put(globalObject, RustString.static("version"), RustString.fromUTF8(version[0..bun.len(version)]).toJS(globalObject)); } return result; @@ -409,8 +409,8 @@ pub fn getEphemeralKeyInfo(this: *This, globalObject: *jsc.JSGlobalObject, _: *j switch (kid) { BoringSSL.EVP_PKEY_DH => { - result.put(globalObject, ZigString.static("type"), try bun.String.static("DH").toJS(globalObject)); - result.put(globalObject, ZigString.static("size"), JSValue.jsNumber(bits)); + result.put(globalObject, RustString.static("type"), try bun.String.static("DH").toJS(globalObject)); + result.put(globalObject, RustString.static("size"), JSValue.jsNumber(bits)); }, BoringSSL.EVP_PKEY_EC, BoringSSL.EVP_PKEY_X25519, BoringSSL.EVP_PKEY_X448 => { @@ -432,9 +432,9 @@ pub fn getEphemeralKeyInfo(this: *This, globalObject: *jsc.JSGlobalObject, _: *j curve_name = ""; } } - result.put(globalObject, ZigString.static("type"), try bun.String.static("ECDH").toJS(globalObject)); - result.put(globalObject, ZigString.static("name"), ZigString.fromUTF8(curve_name).toJS(globalObject)); - result.put(globalObject, ZigString.static("size"), JSValue.jsNumber(bits)); + result.put(globalObject, RustString.static("type"), try bun.String.static("ECDH").toJS(globalObject)); + result.put(globalObject, RustString.static("name"), RustString.fromUTF8(curve_name).toJS(globalObject)); + result.put(globalObject, RustString.static("size"), JSValue.jsNumber(bits)); }, else => {}, } @@ -459,7 +459,7 @@ pub fn getALPNProtocol(this: *This, globalObject: *jsc.JSGlobalObject) bun.JSErr if (strings.eql(slice, "http/1.1")) { return bun.String.static("http/1.1").toJS(globalObject); } - return ZigString.fromUTF8(slice).toJS(globalObject); + return RustString.fromUTF8(slice).toJS(globalObject); } pub fn getSession(this: *This, globalObject: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue { @@ -584,7 +584,7 @@ fn alwaysAllowSSLVerifyCallback(_: c_int, _: ?*BoringSSL.X509_STORE_CTX) callcon } noinline fn getSSLException(globalThis: *jsc.JSGlobalObject, defaultMessage: []const u8) JSValue { - var zig_str: ZigString = ZigString.init(""); + var rust_str: RustString = RustString.init(""); var output_buf: [4096]u8 = undefined; output_buf[0] = 0; @@ -634,21 +634,21 @@ noinline fn getSSLException(globalThis: *jsc.JSGlobalObject, defaultMessage: []c if (written > 0) { const message = output_buf[0..written]; - zig_str = ZigString.init(bun.handleOom(std.fmt.allocPrint(bun.default_allocator, "OpenSSL {s}", .{message}))); - var encoded_str = zig_str.withEncoding(); + rust_str = RustString.init(bun.handleOom(std.fmt.allocPrint(bun.default_allocator, "OpenSSL {s}", .{message}))); + var encoded_str = rust_str.withEncoding(); encoded_str.markGlobal(); // We shouldn't *need* to do this but it's not entirely clear. BoringSSL.ERR_clear_error(); } - if (zig_str.len == 0) { - zig_str = ZigString.init(defaultMessage); + if (rust_str.len == 0) { + rust_str = RustString.init(defaultMessage); } // store the exception in here // toErrorInstance clones the string - const exception = zig_str.toErrorInstance(globalThis); + const exception = rust_str.toErrorInstance(globalThis); // reference it in stack memory exception.ensureStillAlive(); @@ -658,7 +658,7 @@ noinline fn getSSLException(globalThis: *jsc.JSGlobalObject, defaultMessage: []c const string = []const u8; -const X509 = @import("../api/bun/x509.zig"); +const X509 = @import("../api/bun/x509.rust"); const std = @import("std"); const bun = @import("bun"); @@ -669,5 +669,5 @@ const BoringSSL = bun.BoringSSL.c; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const This = jsc.API.TLSSocket; diff --git a/src/runtime/socket/udp_socket.zig b/src/runtime/socket/udp_socket.zig index fcb4ee16e6b..ffcf019a8e4 100644 --- a/src/runtime/socket/udp_socket.zig +++ b/src/runtime/socket/udp_socket.zig @@ -112,7 +112,7 @@ fn onData(socket: *uws.udp.Socket, buf: *uws.udp.PacketBuffer, packets: c_int) c defer thisValue.ensureStillAlive(); const flags = jsc.JSValue.createEmptyObject(globalThis, 1); - flags.put(globalThis, jsc.ZigString.static("truncated"), .jsBoolean(truncated)); + flags.put(globalThis, jsc.RustString.static("truncated"), .jsBoolean(truncated)); _ = callback.call(globalThis, thisValue, &.{ thisValue, @@ -736,7 +736,7 @@ pub const UDPSocket = struct { const slice: []const u8 = brk: { if (val.asArrayBuffer(globalThis)) |arrayBuffer| { // `byteSlice()` returns `&.{}` for a detached view; its - // `.ptr` is Zig's zero-length sentinel which the kernel + // `.ptr` is Rust's zero-length sentinel which the kernel // rejects with EFAULT even though `iov_len == 0`. Hand // sendmmsg a valid static address instead. if (arrayBuffer.isDetached()) break :brk empty; @@ -803,7 +803,7 @@ pub const UDPSocket = struct { }; const payload_arg = arguments.ptr[0]; - var payload_str = jsc.ZigString.Slice.empty; + var payload_str = jsc.RustString.Slice.empty; defer payload_str.deinit(); const payload = brk: { if (payload_arg.asArrayBuffer(globalThis)) |array_buffer| { @@ -1076,7 +1076,7 @@ pub const UDPSocket = struct { }; const std = @import("std"); -const uws = @import("../../uws/uws.zig"); +const uws = @import("../../uws/uws.rust"); const bun = @import("bun"); const Async = bun.Async; diff --git a/src/runtime/socket/uws_dispatch.zig b/src/runtime/socket/uws_dispatch.zig index 3ec7d6dc4c6..0011cfe1ecd 100644 --- a/src/runtime/socket/uws_dispatch.zig +++ b/src/runtime/socket/uws_dispatch.zig @@ -1,6 +1,6 @@ //! Socket event dispatch. `loop.c` calls these `us_dispatch_*` exports for //! every readable/writable/close/etc; we switch on `s->kind` and direct-call -//! the right Zig handler with the ext already typed. C++ kinds (uWS) and +//! the right Rust handler with the ext already typed. C++ kinds (uWS) and //! `.dynamic` go through `s->group->vtable`. //! //! This file is the ONLY place that knows the kind→handler mapping. Adding a @@ -8,7 +8,7 @@ //! arm — no silent fallthrough. comptime { - // Force these into the link even if nothing in Zig calls them. + // Force these into the link even if nothing in Rust calls them. _ = us_dispatch_open; _ = us_dispatch_data; _ = us_dispatch_fd; @@ -23,7 +23,7 @@ comptime { _ = us_dispatch_ssl_raw_tap; } -/// kind → vtable. Zig kinds get a comptime-generated `Trampolines(H)` vtable +/// kind → vtable. Rust kinds get a comptime-generated `Trampolines(H)` vtable /// (so the call is *still* indirect by one pointer, but the table itself is /// `.rodata` and there's exactly one per kind — not one per connection). C++ /// kinds use the per-group vtable since the handler closure differs per App. @@ -131,9 +131,9 @@ export fn us_dispatch_ssl_raw_tap(s: *us_socket_t, data: [*c]u8, len: c_int) ?*u } const bun = @import("bun"); -const handlers = @import("./uws_handlers.zig"); +const handlers = @import("./uws_handlers.rust"); const std = @import("std"); -const vtable = @import("../../uws_sys/vtable.zig"); +const vtable = @import("../../uws_sys/vtable.rust"); const uws = bun.uws; const ConnectingSocket = uws.ConnectingSocket; diff --git a/src/runtime/socket/uws_handlers.zig b/src/runtime/socket/uws_handlers.zig index 0e950ec1780..54ce852c0f2 100644 --- a/src/runtime/socket/uws_handlers.zig +++ b/src/runtime/socket/uws_handlers.zig @@ -289,7 +289,7 @@ pub fn Valkey(comptime ssl: bool) type { // ── Bun.spawn IPC / process.send() ────────────────────────────────────────── // Ext is `*IPC.SendQueue` for both child-side `process.send` and parent-side -// `Bun.spawn({ipc})`. Handlers live in `ipc.zig` as free functions, not +// `Bun.spawn({ipc})`. Handlers live in `ipc.rust` as free functions, not // methods on SendQueue, so we adapt manually instead of via PtrHandler. pub const SpawnIPC = struct { const H = IPC.IPCHandlers.PosixSocket; @@ -316,11 +316,11 @@ pub const SpawnIPC = struct { } }; -const IPC = @import("../../jsc/ipc.zig"); -const js_valkey = @import("../valkey_jsc/js_valkey.zig"); -const mysql = @import("../../sql_jsc/mysql.zig"); -const websocket_client = @import("../../http_jsc/websocket_client.zig"); -const websocket_upgrade_client = @import("../../http_jsc/websocket_client/WebSocketUpgradeClient.zig"); +const IPC = @import("../../jsc/ipc.rust"); +const js_valkey = @import("../valkey_jsc/js_valkey.rust"); +const mysql = @import("../../sql_jsc/mysql.rust"); +const websocket_client = @import("../../http_jsc/websocket_client.rust"); +const websocket_upgrade_client = @import("../../http_jsc/websocket_client/WebSocketUpgradeClient.rust"); const bun = @import("bun"); const api = bun.jsc.API; diff --git a/src/runtime/test_runner/Execution.zig b/src/runtime/test_runner/Execution.zig index e7edf01949d..b47cd200990 100644 --- a/src/runtime/test_runner/Execution.zig +++ b/src/runtime/test_runner/Execution.zig @@ -538,7 +538,7 @@ fn onSequenceStarted(_: *Execution, sequence: *ExecutionSequence) void { sequence.started_at = bun.timespec.now(.force_real_time); if (sequence.test_entry) |entry| { - log("Running test: \"{f}\"", .{std.zig.fmtString(entry.base.name orelse "(unnamed)")}); + log("Running test: \"{f}\"", .{std.rust.fmtString(entry.base.name orelse "(unnamed)")}); if (entry.base.test_id_for_debugger != 0) { if (jsc.VirtualMachine.get().debugger) |*debugger| { @@ -643,7 +643,7 @@ pub fn resetSequence(this: *Execution, sequence: *ExecutionSequence) void { // not exist (https://github.com/oven-sh/bun/issues/23705). // Zeroing all entries matches Jest (SnapshotState.clear() on test_retry, // jestjs/jest#7493). Concurrent tests never touch the counts map — see - // SnapshotInConcurrentGroup in expect.zig. + // SnapshotInConcurrentGroup in expect.rust. if (jsc.Jest.Jest.runner) |runner| runner.snapshots.resetCounts(); _ = this; } @@ -681,7 +681,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.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/test_runner/ScopeFunctions.zig b/src/runtime/test_runner/ScopeFunctions.zig index 08993a4b34e..a45d144be10 100644 --- a/src/runtime/test_runner/ScopeFunctions.zig +++ b/src/runtime/test_runner/ScopeFunctions.zig @@ -237,7 +237,7 @@ fn enqueueDescribeOrTestCallback(this: *ScopeFunctions, bunTest: *bun_test.BunTe bun.debugAssert(rem.buf.len == 0); const str = bun.String.fromBytes(bunTest.collection.filter_buffer.items); - groupLog.log("matches_filter \"{f}\"", .{std.zig.fmtString(bunTest.collection.filter_buffer.items)}); + groupLog.log("matches_filter \"{f}\"", .{std.rust.fmtString(bunTest.collection.filter_buffer.items)}); matches_filter = filter_regex.matches(str); }; @@ -458,7 +458,7 @@ pub fn createUnbound(globalThis: *JSGlobalObject, mode: Mode, each: jsc.JSValue, const value = scope_functions.toJS(globalThis); value.ensureStillAlive(); - // Write into the C++ m_each WriteBarrier so GC visits it. The Zig `each` field + // Write into the C++ m_each WriteBarrier so GC visits it. The Rust `each` field // lives in unmanaged memory that JSC never scans; without this the array can be // collected between `.each(arr)` and the trailing `("name", cb)` call. if (each != .zero) js.eachSetCached(value, globalThis, each); diff --git a/src/runtime/test_runner/bun_test.zig b/src/runtime/test_runner/bun_test.zig index 93344d1c7cd..1e39a1d007b 100644 --- a/src/runtime/test_runner/bun_test.zig +++ b/src/runtime/test_runner/bun_test.zig @@ -3,7 +3,7 @@ pub fn cloneActiveStrong() ?BunTestPtr { return runner.bun_test_root.cloneActiveFile(); } -pub const DoneCallback = @import("./DoneCallback.zig"); +pub const DoneCallback = @import("./DoneCallback.rust"); pub const js_fns = struct { pub const Signature = union(enum) { @@ -790,7 +790,7 @@ pub const StepResult = union(enum) { complete, }; -pub const Collection = @import("./Collection.zig"); +pub const Collection = @import("./Collection.rust"); pub const ConcurrentMode = enum { inherit, @@ -1053,19 +1053,19 @@ pub const RunOneResult = union(enum) { }, }; -pub const FakeTimers = @import("./timers/FakeTimers.zig"); +pub const FakeTimers = @import("./timers/FakeTimers.rust"); -pub const Execution = @import("./Execution.zig"); -pub const debug = @import("./debug.zig"); +pub const Execution = @import("./Execution.rust"); +pub const debug = @import("./debug.rust"); -pub const ScopeFunctions = @import("./ScopeFunctions.zig"); +pub const ScopeFunctions = @import("./ScopeFunctions.rust"); -pub const Order = @import("./Order.zig"); +pub const Order = @import("./Order.rust"); const group = debug.group; const std = @import("std"); -const test_command = @import("../cli/test_command.zig"); +const test_command = @import("../cli/test_command.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/test_runner/debug.zig b/src/runtime/test_runner/debug.zig index 5031362c8fb..56144425335 100644 --- a/src/runtime/test_runner/debug.zig +++ b/src/runtime/test_runner/debug.zig @@ -7,7 +7,7 @@ pub fn dumpSub(current: TestScheduleEntry) bun.JSError!void { } pub fn dumpDescribe(describe: *DescribeScope) bun.JSError!void { if (!group.getLogEnabled()) return; - group.beginMsg("describe \"{f}\" (concurrent={}, mode={s}, only={s}, has_callback={})", .{ std.zig.fmtString(describe.base.name orelse "(unnamed)"), describe.base.concurrent, @tagName(describe.base.mode), @tagName(describe.base.only), describe.base.has_callback }); + group.beginMsg("describe \"{f}\" (concurrent={}, mode={s}, only={s}, has_callback={})", .{ std.rust.fmtString(describe.base.name orelse "(unnamed)"), describe.base.concurrent, @tagName(describe.base.mode), @tagName(describe.base.only), describe.base.has_callback }); defer group.end(); for (describe.beforeAll.items) |entry| try dumpTest(entry, "beforeAll"); @@ -18,7 +18,7 @@ pub fn dumpDescribe(describe: *DescribeScope) bun.JSError!void { } pub fn dumpTest(current: *ExecutionEntry, label: []const u8) bun.JSError!void { if (!group.getLogEnabled()) return; - group.beginMsg("{s} \"{f}\" (concurrent={}, only={})", .{ label, std.zig.fmtString(current.base.name orelse "(unnamed)"), current.base.concurrent, current.base.only }); + group.beginMsg("{s} \"{f}\" (concurrent={}, only={})", .{ label, std.rust.fmtString(current.base.name orelse "(unnamed)"), current.base.concurrent, current.base.only }); defer group.end(); } pub fn dumpOrder(this: *Execution) bun.JSError!void { @@ -36,7 +36,7 @@ pub fn dumpOrder(this: *Execution) bun.JSError!void { var current_entry = sequence.first_entry; while (current_entry) |entry| : (current_entry = entry.next) { - group.log("ExecutionEntry \"{f}\" (concurrent={}, mode={s}, only={s}, has_callback={})", .{ std.zig.fmtString(entry.base.name orelse "(unnamed)"), entry.base.concurrent, @tagName(entry.base.mode), @tagName(entry.base.only), entry.base.has_callback }); + group.log("ExecutionEntry \"{f}\" (concurrent={}, mode={s}, only={s}, has_callback={})", .{ std.rust.fmtString(entry.base.name orelse "(unnamed)"), entry.base.concurrent, @tagName(entry.base.mode), @tagName(entry.base.only), entry.base.has_callback }); } } } @@ -101,7 +101,7 @@ pub const group = struct { const bun = @import("bun"); const std = @import("std"); -const bun_test = @import("./bun_test.zig"); +const bun_test = @import("./bun_test.rust"); const DescribeScope = bun_test.DescribeScope; const Execution = bun_test.Execution; const ExecutionEntry = bun_test.ExecutionEntry; diff --git a/src/runtime/test_runner/diff/diff_match_patch.zig b/src/runtime/test_runner/diff/diff_match_patch.zig index 6dede91d337..9372e24fb2d 100644 --- a/src/runtime/test_runner/diff/diff_match_patch.zig +++ b/src/runtime/test_runner/diff/diff_match_patch.zig @@ -968,7 +968,7 @@ pub fn DMP(comptime Unit: type) type { text_delete.replaceRangeAssumeCapacity(0, common_length, &.{}); } // Factor out any common suffixies. - // @ZigPort this seems very wrong + // @RustPort this seems very wrong common_length = diffCommonSuffix(text_insert.items, text_delete.items); if (common_length != 0) { const old_text = diffs.items[pointer].text; @@ -2942,7 +2942,7 @@ pub fn DMP(comptime Unit: type) type { } } - /// https://github.com/ziglang/zig/pull/23042/files + /// https://github.com/rustlang/rust/pull/23042/files fn checkAllAllocationFailures( backing_allocator: std.mem.Allocator, comptime test_fn: anytype, diff --git a/src/runtime/test_runner/diff/printDiff.zig b/src/runtime/test_runner/diff/printDiff.zig index c17dd9c4724..b2c7be9acdf 100644 --- a/src/runtime/test_runner/diff/printDiff.zig +++ b/src/runtime/test_runner/diff/printDiff.zig @@ -581,5 +581,5 @@ pub fn printDiff( } const bun = @import("bun"); -const diff_match_patch = @import("./diff_match_patch.zig"); +const diff_match_patch = @import("./diff_match_patch.rust"); const std = @import("std"); diff --git a/src/runtime/test_runner/diff_format.zig b/src/runtime/test_runner/diff_format.zig index b7a12da2532..dd99e0b7438 100644 --- a/src/runtime/test_runner/diff_format.zig +++ b/src/runtime/test_runner/diff_format.zig @@ -69,9 +69,9 @@ pub const DiffFormatter = struct { const string = []const u8; const std = @import("std"); -const JestPrettyFormat = @import("./pretty_format.zig").JestPrettyFormat; +const JestPrettyFormat = @import("./pretty_format.rust").JestPrettyFormat; -const printDiffFile = @import("./diff/printDiff.zig"); +const printDiffFile = @import("./diff/printDiff.rust"); const DiffConfig = printDiffFile.DiffConfig; const printDiffMain = printDiffFile.printDiffMain; diff --git a/src/runtime/test_runner/expect.zig b/src/runtime/test_runner/expect.zig index 8f3cda8d855..28359454130 100644 --- a/src/runtime/test_runner/expect.zig +++ b/src/runtime/test_runner/expect.zig @@ -393,7 +393,7 @@ pub const Expect = struct { const arguments_ = callFrame.arguments_old(1); const arguments = arguments_.slice(); - var _msg: ZigString = ZigString.Empty; + var _msg: RustString = RustString.Empty; if (arguments.len > 0) { const value = arguments[0]; @@ -403,9 +403,9 @@ pub const Expect = struct { return globalThis.throwInvalidArgumentType("pass", "message", "string"); } - try value.toZigString(&_msg, globalThis); + try value.toRustString(&_msg, globalThis); } else { - _msg = ZigString.fromBytes("passes by .pass() assertion"); + _msg = RustString.fromBytes("passes by .pass() assertion"); } this.incrementExpectCallCounter(); @@ -438,7 +438,7 @@ pub const Expect = struct { const arguments_ = callFrame.arguments_old(1); const arguments = arguments_.slice(); - var _msg: ZigString = ZigString.Empty; + var _msg: RustString = RustString.Empty; if (arguments.len > 0) { const value = arguments[0]; @@ -448,9 +448,9 @@ pub const Expect = struct { return globalThis.throwInvalidArgumentType("fail", "message", "string"); } - try value.toZigString(&_msg, globalThis); + try value.toRustString(&_msg, globalThis); } else { - _msg = ZigString.fromBytes("fails by .fail() assertion"); + _msg = RustString.fromBytes("fails by .fail() assertion"); } this.incrementExpectCallCounter(); @@ -468,81 +468,81 @@ pub const Expect = struct { return this.throw(globalThis, signature, "\n\n{s}\n", .{msg.slice()}); } - pub const toBe = @import("./expect/toBe.zig").toBe; - pub const toBeArray = @import("./expect/toBeArray.zig").toBeArray; - pub const toBeArrayOfSize = @import("./expect/toBeArrayOfSize.zig").toBeArrayOfSize; - pub const toBeBoolean = @import("./expect/toBeBoolean.zig").toBeBoolean; - pub const toBeCloseTo = @import("./expect/toBeCloseTo.zig").toBeCloseTo; - pub const toBeDate = @import("./expect/toBeDate.zig").toBeDate; - pub const toBeDefined = @import("./expect/toBeDefined.zig").toBeDefined; - pub const toBeEmpty = @import("./expect/toBeEmpty.zig").toBeEmpty; - pub const toBeEmptyObject = @import("./expect/toBeEmptyObject.zig").toBeEmptyObject; - pub const toBeEven = @import("./expect/toBeEven.zig").toBeEven; - pub const toBeFalse = @import("./expect/toBeFalse.zig").toBeFalse; - pub const toBeFalsy = @import("./expect/toBeFalsy.zig").toBeFalsy; - pub const toBeFinite = @import("./expect/toBeFinite.zig").toBeFinite; - pub const toBeFunction = @import("./expect/toBeFunction.zig").toBeFunction; - pub const toBeGreaterThan = @import("./expect/toBeGreaterThan.zig").toBeGreaterThan; - pub const toBeGreaterThanOrEqual = @import("./expect/toBeGreaterThanOrEqual.zig").toBeGreaterThanOrEqual; - pub const toBeInstanceOf = @import("./expect/toBeInstanceOf.zig").toBeInstanceOf; - pub const toBeInteger = @import("./expect/toBeInteger.zig").toBeInteger; - pub const toBeLessThan = @import("./expect/toBeLessThan.zig").toBeLessThan; - pub const toBeLessThanOrEqual = @import("./expect/toBeLessThanOrEqual.zig").toBeLessThanOrEqual; - pub const toBeNaN = @import("./expect/toBeNaN.zig").toBeNaN; - pub const toBeNegative = @import("./expect/toBeNegative.zig").toBeNegative; - pub const toBeNil = @import("./expect/toBeNil.zig").toBeNil; - pub const toBeNull = @import("./expect/toBeNull.zig").toBeNull; - pub const toBeNumber = @import("./expect/toBeNumber.zig").toBeNumber; - pub const toBeObject = @import("./expect/toBeObject.zig").toBeObject; - pub const toBeOdd = @import("./expect/toBeOdd.zig").toBeOdd; - pub const toBeOneOf = @import("./expect/toBeOneOf.zig").toBeOneOf; - pub const toBePositive = @import("./expect/toBePositive.zig").toBePositive; - pub const toBeString = @import("./expect/toBeString.zig").toBeString; - pub const toBeSymbol = @import("./expect/toBeSymbol.zig").toBeSymbol; - pub const toBeTrue = @import("./expect/toBeTrue.zig").toBeTrue; - pub const toBeTruthy = @import("./expect/toBeTruthy.zig").toBeTruthy; - pub const toBeTypeOf = @import("./expect/toBeTypeOf.zig").toBeTypeOf; - pub const toBeUndefined = @import("./expect/toBeUndefined.zig").toBeUndefined; - pub const toBeValidDate = @import("./expect/toBeValidDate.zig").toBeValidDate; - pub const toBeWithin = @import("./expect/toBeWithin.zig").toBeWithin; - pub const toContain = @import("./expect/toContain.zig").toContain; - pub const toContainAllKeys = @import("./expect/toContainAllKeys.zig").toContainAllKeys; - pub const toContainAllValues = @import("./expect/toContainAllValues.zig").toContainAllValues; - pub const toContainAnyKeys = @import("./expect/toContainAnyKeys.zig").toContainAnyKeys; - pub const toContainAnyValues = @import("./expect/toContainAnyValues.zig").toContainAnyValues; - pub const toContainEqual = @import("./expect/toContainEqual.zig").toContainEqual; - pub const toContainKey = @import("./expect/toContainKey.zig").toContainKey; - pub const toContainKeys = @import("./expect/toContainKeys.zig").toContainKeys; - pub const toContainValue = @import("./expect/toContainValue.zig").toContainValue; - pub const toContainValues = @import("./expect/toContainValues.zig").toContainValues; - pub const toEndWith = @import("./expect/toEndWith.zig").toEndWith; - pub const toEqual = @import("./expect/toEqual.zig").toEqual; - pub const toEqualIgnoringWhitespace = @import("./expect/toEqualIgnoringWhitespace.zig").toEqualIgnoringWhitespace; - pub const toHaveBeenCalled = @import("./expect/toHaveBeenCalled.zig").toHaveBeenCalled; - pub const toHaveBeenCalledOnce = @import("./expect/toHaveBeenCalledOnce.zig").toHaveBeenCalledOnce; - pub const toHaveBeenCalledTimes = @import("./expect/toHaveBeenCalledTimes.zig").toHaveBeenCalledTimes; - pub const toHaveBeenCalledWith = @import("./expect/toHaveBeenCalledWith.zig").toHaveBeenCalledWith; - pub const toHaveBeenLastCalledWith = @import("./expect/toHaveBeenLastCalledWith.zig").toHaveBeenLastCalledWith; - pub const toHaveBeenNthCalledWith = @import("./expect/toHaveBeenNthCalledWith.zig").toHaveBeenNthCalledWith; - pub const toHaveLastReturnedWith = @import("./expect/toHaveLastReturnedWith.zig").toHaveLastReturnedWith; - pub const toHaveLength = @import("./expect/toHaveLength.zig").toHaveLength; - pub const toHaveNthReturnedWith = @import("./expect/toHaveNthReturnedWith.zig").toHaveNthReturnedWith; - pub const toHaveProperty = @import("./expect/toHaveProperty.zig").toHaveProperty; - pub const toHaveReturned = @import("./expect/toHaveReturned.zig").toHaveReturned; - pub const toHaveReturnedTimes = @import("./expect/toHaveReturnedTimes.zig").toHaveReturnedTimes; - pub const toHaveReturnedWith = @import("./expect/toHaveReturnedWith.zig").toHaveReturnedWith; - pub const toInclude = @import("./expect/toInclude.zig").toInclude; - pub const toIncludeRepeated = @import("./expect/toIncludeRepeated.zig").toIncludeRepeated; - pub const toMatch = @import("./expect/toMatch.zig").toMatch; - pub const toMatchInlineSnapshot = @import("./expect/toMatchInlineSnapshot.zig").toMatchInlineSnapshot; - pub const toMatchObject = @import("./expect/toMatchObject.zig").toMatchObject; - pub const toMatchSnapshot = @import("./expect/toMatchSnapshot.zig").toMatchSnapshot; - pub const toSatisfy = @import("./expect/toSatisfy.zig").toSatisfy; - pub const toStartWith = @import("./expect/toStartWith.zig").toStartWith; - pub const toStrictEqual = @import("./expect/toStrictEqual.zig").toStrictEqual; - pub const toThrow = @import("./expect/toThrow.zig").toThrow; - pub const toThrowErrorMatchingInlineSnapshot = @import("./expect/toThrowErrorMatchingInlineSnapshot.zig").toThrowErrorMatchingInlineSnapshot; - pub const toThrowErrorMatchingSnapshot = @import("./expect/toThrowErrorMatchingSnapshot.zig").toThrowErrorMatchingSnapshot; + pub const toBe = @import("./expect/toBe.rust").toBe; + pub const toBeArray = @import("./expect/toBeArray.rust").toBeArray; + pub const toBeArrayOfSize = @import("./expect/toBeArrayOfSize.rust").toBeArrayOfSize; + pub const toBeBoolean = @import("./expect/toBeBoolean.rust").toBeBoolean; + pub const toBeCloseTo = @import("./expect/toBeCloseTo.rust").toBeCloseTo; + pub const toBeDate = @import("./expect/toBeDate.rust").toBeDate; + pub const toBeDefined = @import("./expect/toBeDefined.rust").toBeDefined; + pub const toBeEmpty = @import("./expect/toBeEmpty.rust").toBeEmpty; + pub const toBeEmptyObject = @import("./expect/toBeEmptyObject.rust").toBeEmptyObject; + pub const toBeEven = @import("./expect/toBeEven.rust").toBeEven; + pub const toBeFalse = @import("./expect/toBeFalse.rust").toBeFalse; + pub const toBeFalsy = @import("./expect/toBeFalsy.rust").toBeFalsy; + pub const toBeFinite = @import("./expect/toBeFinite.rust").toBeFinite; + pub const toBeFunction = @import("./expect/toBeFunction.rust").toBeFunction; + pub const toBeGreaterThan = @import("./expect/toBeGreaterThan.rust").toBeGreaterThan; + pub const toBeGreaterThanOrEqual = @import("./expect/toBeGreaterThanOrEqual.rust").toBeGreaterThanOrEqual; + pub const toBeInstanceOf = @import("./expect/toBeInstanceOf.rust").toBeInstanceOf; + pub const toBeInteger = @import("./expect/toBeInteger.rust").toBeInteger; + pub const toBeLessThan = @import("./expect/toBeLessThan.rust").toBeLessThan; + pub const toBeLessThanOrEqual = @import("./expect/toBeLessThanOrEqual.rust").toBeLessThanOrEqual; + pub const toBeNaN = @import("./expect/toBeNaN.rust").toBeNaN; + pub const toBeNegative = @import("./expect/toBeNegative.rust").toBeNegative; + pub const toBeNil = @import("./expect/toBeNil.rust").toBeNil; + pub const toBeNull = @import("./expect/toBeNull.rust").toBeNull; + pub const toBeNumber = @import("./expect/toBeNumber.rust").toBeNumber; + pub const toBeObject = @import("./expect/toBeObject.rust").toBeObject; + pub const toBeOdd = @import("./expect/toBeOdd.rust").toBeOdd; + pub const toBeOneOf = @import("./expect/toBeOneOf.rust").toBeOneOf; + pub const toBePositive = @import("./expect/toBePositive.rust").toBePositive; + pub const toBeString = @import("./expect/toBeString.rust").toBeString; + pub const toBeSymbol = @import("./expect/toBeSymbol.rust").toBeSymbol; + pub const toBeTrue = @import("./expect/toBeTrue.rust").toBeTrue; + pub const toBeTruthy = @import("./expect/toBeTruthy.rust").toBeTruthy; + pub const toBeTypeOf = @import("./expect/toBeTypeOf.rust").toBeTypeOf; + pub const toBeUndefined = @import("./expect/toBeUndefined.rust").toBeUndefined; + pub const toBeValidDate = @import("./expect/toBeValidDate.rust").toBeValidDate; + pub const toBeWithin = @import("./expect/toBeWithin.rust").toBeWithin; + pub const toContain = @import("./expect/toContain.rust").toContain; + pub const toContainAllKeys = @import("./expect/toContainAllKeys.rust").toContainAllKeys; + pub const toContainAllValues = @import("./expect/toContainAllValues.rust").toContainAllValues; + pub const toContainAnyKeys = @import("./expect/toContainAnyKeys.rust").toContainAnyKeys; + pub const toContainAnyValues = @import("./expect/toContainAnyValues.rust").toContainAnyValues; + pub const toContainEqual = @import("./expect/toContainEqual.rust").toContainEqual; + pub const toContainKey = @import("./expect/toContainKey.rust").toContainKey; + pub const toContainKeys = @import("./expect/toContainKeys.rust").toContainKeys; + pub const toContainValue = @import("./expect/toContainValue.rust").toContainValue; + pub const toContainValues = @import("./expect/toContainValues.rust").toContainValues; + pub const toEndWith = @import("./expect/toEndWith.rust").toEndWith; + pub const toEqual = @import("./expect/toEqual.rust").toEqual; + pub const toEqualIgnoringWhitespace = @import("./expect/toEqualIgnoringWhitespace.rust").toEqualIgnoringWhitespace; + pub const toHaveBeenCalled = @import("./expect/toHaveBeenCalled.rust").toHaveBeenCalled; + pub const toHaveBeenCalledOnce = @import("./expect/toHaveBeenCalledOnce.rust").toHaveBeenCalledOnce; + pub const toHaveBeenCalledTimes = @import("./expect/toHaveBeenCalledTimes.rust").toHaveBeenCalledTimes; + pub const toHaveBeenCalledWith = @import("./expect/toHaveBeenCalledWith.rust").toHaveBeenCalledWith; + pub const toHaveBeenLastCalledWith = @import("./expect/toHaveBeenLastCalledWith.rust").toHaveBeenLastCalledWith; + pub const toHaveBeenNthCalledWith = @import("./expect/toHaveBeenNthCalledWith.rust").toHaveBeenNthCalledWith; + pub const toHaveLastReturnedWith = @import("./expect/toHaveLastReturnedWith.rust").toHaveLastReturnedWith; + pub const toHaveLength = @import("./expect/toHaveLength.rust").toHaveLength; + pub const toHaveNthReturnedWith = @import("./expect/toHaveNthReturnedWith.rust").toHaveNthReturnedWith; + pub const toHaveProperty = @import("./expect/toHaveProperty.rust").toHaveProperty; + pub const toHaveReturned = @import("./expect/toHaveReturned.rust").toHaveReturned; + pub const toHaveReturnedTimes = @import("./expect/toHaveReturnedTimes.rust").toHaveReturnedTimes; + pub const toHaveReturnedWith = @import("./expect/toHaveReturnedWith.rust").toHaveReturnedWith; + pub const toInclude = @import("./expect/toInclude.rust").toInclude; + pub const toIncludeRepeated = @import("./expect/toIncludeRepeated.rust").toIncludeRepeated; + pub const toMatch = @import("./expect/toMatch.rust").toMatch; + pub const toMatchInlineSnapshot = @import("./expect/toMatchInlineSnapshot.rust").toMatchInlineSnapshot; + pub const toMatchObject = @import("./expect/toMatchObject.rust").toMatchObject; + pub const toMatchSnapshot = @import("./expect/toMatchSnapshot.rust").toMatchSnapshot; + pub const toSatisfy = @import("./expect/toSatisfy.rust").toSatisfy; + pub const toStartWith = @import("./expect/toStartWith.rust").toStartWith; + pub const toStrictEqual = @import("./expect/toStrictEqual.rust").toStrictEqual; + pub const toThrow = @import("./expect/toThrow.rust").toThrow; + pub const toThrowErrorMatchingInlineSnapshot = @import("./expect/toThrowErrorMatchingInlineSnapshot.rust").toThrowErrorMatchingInlineSnapshot; + pub const toThrowErrorMatchingSnapshot = @import("./expect/toThrowErrorMatchingSnapshot.rust").toThrowErrorMatchingSnapshot; pub fn getValueAsToThrow(this: *Expect, globalThis: *JSGlobalObject, value: JSValue) bun.JSError!struct { ?JSValue, JSValue } { const vm = globalThis.bunVM(); @@ -774,9 +774,9 @@ pub const Expect = struct { \\ {s} called from file: "{f}" \\ , .{ - std.zig.fmtString(fget.source.path.text), + std.rust.fmtString(fget.source.path.text), fn_name, - std.zig.fmtString(srcloc.str.toUTF8(runner.snapshots.allocator).slice()), + std.rust.fmtString(srcloc.str.toUTF8(runner.snapshots.allocator).slice()), }); } @@ -947,7 +947,7 @@ pub const Expect = struct { const matcher_fn: JSValue = iter.value; if (!matcher_fn.jsType().isFunction()) { - const type_name = if (matcher_fn.isNull()) bun.String.static("null") else bun.String.init(matcher_fn.jsTypeString(globalThis).getZigString(globalThis)); + const type_name = if (matcher_fn.isNull()) bun.String.static("null") else bun.String.init(matcher_fn.jsTypeString(globalThis).getRustString(globalThis)); return globalThis.throwInvalidArguments("expect.extend: `{f}` is not a valid matcher. Must be a function, is \"{f}\"", .{ matcher_name, type_name }); } @@ -1029,7 +1029,7 @@ pub const Expect = struct { const err = switch (Output.enable_ansi_colors_stderr) { inline else => |colors| globalThis.createErrorInstance(Output.prettyFmt(fmt, colors), .{ matcher_name, result.toFmt(&formatter) }), }; - err.put(globalThis, ZigString.static("name"), try bun.String.static("InvalidMatcherError").toJS(globalThis)); + err.put(globalThis, RustString.static("name"), try bun.String.static("InvalidMatcherError").toJS(globalThis)); return globalThis.throwValue(err); } @@ -1251,13 +1251,13 @@ pub const Expect = struct { if (arg.isEmptyOrUndefinedOrNull()) { const error_value = bun.String.init("reached unreachable code").toErrorInstance(globalThis); - error_value.put(globalThis, ZigString.static("name"), try bun.String.init("UnreachableError").toJS(globalThis)); + error_value.put(globalThis, RustString.static("name"), try bun.String.init("UnreachableError").toJS(globalThis)); return globalThis.throwValue(error_value); } if (arg.isString()) { const error_value = (try arg.toBunString(globalThis)).toErrorInstance(globalThis); - error_value.put(globalThis, ZigString.static("name"), try bun.String.init("UnreachableError").toJS(globalThis)); + error_value.put(globalThis, RustString.static("name"), try bun.String.init("UnreachableError").toJS(globalThis)); return globalThis.throwValue(error_value); } @@ -2248,7 +2248,7 @@ test "fuzz Expect.trimLeadingWhitespaceForInlineSnapshot" { const string = []const u8; const std = @import("std"); -const DiffFormatter = @import("./diff_format.zig").DiffFormatter; +const DiffFormatter = @import("./diff_format.rust").DiffFormatter; const bun = @import("bun"); const Environment = bun.Environment; @@ -2263,7 +2263,7 @@ const CallFrame = jsc.CallFrame; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const jest = bun.jsc.Jest; const DescribeScope = jest.DescribeScope; diff --git a/src/runtime/test_runner/expect/toBe.zig b/src/runtime/test_runner/expect/toBe.zig index 0f8cba43179..f6465dc2632 100644 --- a/src/runtime/test_runner/expect/toBe.zig +++ b/src/runtime/test_runner/expect/toBe.zig @@ -63,7 +63,7 @@ pub fn toBe( } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toEqual.zig b/src/runtime/test_runner/expect/toEqual.zig index 614b9fc549a..97e1908d5eb 100644 --- a/src/runtime/test_runner/expect/toEqual.zig +++ b/src/runtime/test_runner/expect/toEqual.zig @@ -38,7 +38,7 @@ pub fn toEqual(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFrame } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveBeenCalledWith.zig b/src/runtime/test_runner/expect/toHaveBeenCalledWith.zig index d49c572394b..15481d71be6 100644 --- a/src/runtime/test_runner/expect/toHaveBeenCalledWith.zig +++ b/src/runtime/test_runner/expect/toHaveBeenCalledWith.zig @@ -112,7 +112,7 @@ pub fn toHaveBeenCalledWith(this: *Expect, globalThis: *JSGlobalObject, callfram } } -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/runtime/test_runner/expect/toHaveBeenLastCalledWith.zig b/src/runtime/test_runner/expect/toHaveBeenLastCalledWith.zig index 488a42916e0..f41fa48f859 100644 --- a/src/runtime/test_runner/expect/toHaveBeenLastCalledWith.zig +++ b/src/runtime/test_runner/expect/toHaveBeenLastCalledWith.zig @@ -80,7 +80,7 @@ pub fn toHaveBeenLastCalledWith(this: *Expect, globalThis: *JSGlobalObject, call } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveBeenNthCalledWith.zig b/src/runtime/test_runner/expect/toHaveBeenNthCalledWith.zig index 9ebcd9cb280..2c7b65c6a1f 100644 --- a/src/runtime/test_runner/expect/toHaveBeenNthCalledWith.zig +++ b/src/runtime/test_runner/expect/toHaveBeenNthCalledWith.zig @@ -94,7 +94,7 @@ pub fn toHaveBeenNthCalledWith(this: *Expect, globalThis: *JSGlobalObject, callf } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveLastReturnedWith.zig b/src/runtime/test_runner/expect/toHaveLastReturnedWith.zig index 82b7230a61a..580ad1e8003 100644 --- a/src/runtime/test_runner/expect/toHaveLastReturnedWith.zig +++ b/src/runtime/test_runner/expect/toHaveLastReturnedWith.zig @@ -77,7 +77,7 @@ pub fn toHaveLastReturnedWith(this: *Expect, globalThis: *JSGlobalObject, callfr } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveNthReturnedWith.zig b/src/runtime/test_runner/expect/toHaveNthReturnedWith.zig index 5ba76d46a07..db49b57ca69 100644 --- a/src/runtime/test_runner/expect/toHaveNthReturnedWith.zig +++ b/src/runtime/test_runner/expect/toHaveNthReturnedWith.zig @@ -86,7 +86,7 @@ pub fn toHaveNthReturnedWith(this: *Expect, globalThis: *JSGlobalObject, callfra } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveProperty.zig b/src/runtime/test_runner/expect/toHaveProperty.zig index 019c815511e..11b23f102c2 100644 --- a/src/runtime/test_runner/expect/toHaveProperty.zig +++ b/src/runtime/test_runner/expect/toHaveProperty.zig @@ -23,8 +23,8 @@ pub fn toHaveProperty(this: *Expect, globalThis: *JSGlobalObject, callFrame: *Ca } const not = this.flags.not; - var path_string = ZigString.Empty; - try expected_property_path.toZigString(&path_string, globalThis); + var path_string = RustString.Empty; + try expected_property_path.toRustString(&path_string, globalThis); var pass = !value.isUndefinedOrNull(); var received_property: JSValue = .zero; @@ -87,10 +87,10 @@ pub fn toHaveProperty(this: *Expect, globalThis: *JSGlobalObject, callFrame: *Ca return this.throw(globalThis, signature, "\n\nExpected path: {f}\n\nUnable to find property\n", .{expected_property_path.toFmt(&formatter)}); } -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toHaveReturnedTimes.zig b/src/runtime/test_runner/expect/toHaveReturnedTimes.zig index 53a65d09529..d21d0572d0d 100644 --- a/src/runtime/test_runner/expect/toHaveReturnedTimes.zig +++ b/src/runtime/test_runner/expect/toHaveReturnedTimes.zig @@ -1 +1 @@ -pub const toHaveReturnedTimes = @import("./toHaveReturned.zig").toHaveReturnedTimes; +pub const toHaveReturnedTimes = @import("./toHaveReturned.rust").toHaveReturnedTimes; diff --git a/src/runtime/test_runner/expect/toHaveReturnedWith.zig b/src/runtime/test_runner/expect/toHaveReturnedWith.zig index c8aac164a5b..9752c3a9e08 100644 --- a/src/runtime/test_runner/expect/toHaveReturnedWith.zig +++ b/src/runtime/test_runner/expect/toHaveReturnedWith.zig @@ -144,7 +144,7 @@ pub fn toHaveReturnedWith(this: *Expect, globalThis: *JSGlobalObject, callframe: } const std = @import("std"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/runtime/test_runner/expect/toMatchInlineSnapshot.zig b/src/runtime/test_runner/expect/toMatchInlineSnapshot.zig index 92faf91ffec..16192cecccb 100644 --- a/src/runtime/test_runner/expect/toMatchInlineSnapshot.zig +++ b/src/runtime/test_runner/expect/toMatchInlineSnapshot.zig @@ -13,14 +13,14 @@ pub fn toMatchInlineSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFra } var has_expected = false; - var expected_string: ZigString = ZigString.Empty; + var expected_string: RustString = RustString.Empty; var property_matchers: ?JSValue = null; switch (arguments.len) { 0 => {}, 1 => { if (arguments[0].isString()) { has_expected = true; - try arguments[0].toZigString(&expected_string, globalThis); + try arguments[0].toRustString(&expected_string, globalThis); } else if (arguments[0].isObject()) { property_matchers = arguments[0]; } else { @@ -37,7 +37,7 @@ pub fn toMatchInlineSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFra if (arguments[1].isString()) { has_expected = true; - try arguments[1].toZigString(&expected_string, globalThis); + try arguments[1].toRustString(&expected_string, globalThis); } }, } @@ -52,7 +52,7 @@ pub fn toMatchInlineSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFra } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const default_allocator = bun.default_allocator; const jsc = bun.jsc; diff --git a/src/runtime/test_runner/expect/toMatchObject.zig b/src/runtime/test_runner/expect/toMatchObject.zig index e9b065e05ae..59a7aec2dab 100644 --- a/src/runtime/test_runner/expect/toMatchObject.zig +++ b/src/runtime/test_runner/expect/toMatchObject.zig @@ -57,7 +57,7 @@ pub fn toMatchObject(this: *Expect, globalThis: *JSGlobalObject, callFrame: *Cal } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toMatchSnapshot.zig b/src/runtime/test_runner/expect/toMatchSnapshot.zig index 30de93411dc..344e741b387 100644 --- a/src/runtime/test_runner/expect/toMatchSnapshot.zig +++ b/src/runtime/test_runner/expect/toMatchSnapshot.zig @@ -18,13 +18,13 @@ pub fn toMatchSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFrame: *C }; defer buntest_strong.deinit(); - var hint_string: ZigString = ZigString.Empty; + var hint_string: RustString = RustString.Empty; var property_matchers: ?JSValue = null; switch (arguments.len) { 0 => {}, 1 => { if (arguments[0].isString()) { - try arguments[0].toZigString(&hint_string, globalThis); + try arguments[0].toRustString(&hint_string, globalThis); } else if (arguments[0].isObject()) { property_matchers = arguments[0]; } else { @@ -40,7 +40,7 @@ pub fn toMatchSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFrame: *C property_matchers = arguments[0]; if (arguments[1].isString()) { - try arguments[1].toZigString(&hint_string, globalThis); + try arguments[1].toRustString(&hint_string, globalThis); } else { return this.throw(globalThis, "", "\n\nMatcher error: Expected second argument to be a string\n", .{}); } @@ -56,7 +56,7 @@ pub fn toMatchSnapshot(this: *Expect, globalThis: *JSGlobalObject, callFrame: *C } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const default_allocator = bun.default_allocator; const jsc = bun.jsc; diff --git a/src/runtime/test_runner/expect/toSatisfy.zig b/src/runtime/test_runner/expect/toSatisfy.zig index 83b3b58e779..508026b1a69 100644 --- a/src/runtime/test_runner/expect/toSatisfy.zig +++ b/src/runtime/test_runner/expect/toSatisfy.zig @@ -25,7 +25,7 @@ pub fn toSatisfy(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFra const result = predicate.call(globalThis, .js_undefined, &.{value}) catch |e| { const err = globalThis.takeException(e); - const fmt = ZigString.init("toSatisfy() predicate threw an exception"); + const fmt = RustString.init("toSatisfy() predicate threw an exception"); return globalThis.throwValue(try globalThis.createAggregateError(&.{err}, &fmt)); }; @@ -51,7 +51,7 @@ pub fn toSatisfy(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFra } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toStrictEqual.zig b/src/runtime/test_runner/expect/toStrictEqual.zig index 47414be4775..24682dae3af 100644 --- a/src/runtime/test_runner/expect/toStrictEqual.zig +++ b/src/runtime/test_runner/expect/toStrictEqual.zig @@ -33,7 +33,7 @@ pub fn toStrictEqual(this: *Expect, globalThis: *JSGlobalObject, callFrame: *Cal } const bun = @import("bun"); -const DiffFormatter = @import("../diff_format.zig").DiffFormatter; +const DiffFormatter = @import("../diff_format.rust").DiffFormatter; const jsc = bun.jsc; const CallFrame = bun.jsc.CallFrame; diff --git a/src/runtime/test_runner/expect/toThrow.zig b/src/runtime/test_runner/expect/toThrow.zig index 9927bea0bda..9c2f9962d44 100644 --- a/src/runtime/test_runner/expect/toThrow.zig +++ b/src/runtime/test_runner/expect/toThrow.zig @@ -119,7 +119,7 @@ pub fn toThrow(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFrame if (!result.isInstanceOf(globalThis, expected_value)) return .js_undefined; - var expected_class = ZigString.Empty; + var expected_class = RustString.Empty; try expected_value.getClassName(globalThis, &expected_class); const received_message: JSValue = (try result.fastGet(globalThis, .message)) orelse .js_undefined; return this.throw(globalThis, signature, "\n\nExpected constructor: not {f}\n\nReceived message: {f}\n", .{ expected_class, received_message.toFmt(&formatter) }); @@ -242,8 +242,8 @@ pub fn toThrow(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFrame // error: received error not instance of received error constructor var formatter = jsc.ConsoleObject.Formatter{ .globalThis = globalThis, .quote_strings = true }; defer formatter.deinit(); - var expected_class = ZigString.Empty; - var received_class = ZigString.Empty; + var expected_class = RustString.Empty; + var received_class = RustString.Empty; try expected_value.getClassName(globalThis, &expected_class); try result.getClassName(globalThis, &received_class); const signature = comptime getSignature("toThrow", "expected", false); @@ -299,13 +299,13 @@ pub fn toThrow(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFrame } const expected_fmt = "\n\nExpected constructor: {f}\n\n" ++ received_line; - var expected_class = ZigString.Empty; + var expected_class = RustString.Empty; try expected_value.getClassName(globalThis, &expected_class); return this.throw(globalThis, signature, expected_fmt, .{ expected_class, result.toFmt(&formatter) }); } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const assert = bun.assert; const strings = bun.strings; diff --git a/src/runtime/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig b/src/runtime/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig index 723a936c61d..e197f7e47ae 100644 --- a/src/runtime/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig +++ b/src/runtime/test_runner/expect/toThrowErrorMatchingInlineSnapshot.zig @@ -13,13 +13,13 @@ pub fn toThrowErrorMatchingInlineSnapshot(this: *Expect, globalThis: *JSGlobalOb } var has_expected = false; - var expected_string: ZigString = ZigString.Empty; + var expected_string: RustString = RustString.Empty; switch (arguments.len) { 0 => {}, 1 => { if (arguments[0].isString()) { has_expected = true; - try arguments[0].toZigString(&expected_string, globalThis); + try arguments[0].toRustString(&expected_string, globalThis); } else { return this.throw(globalThis, "", "\n\nMatcher error: Expected first argument to be a string\n", .{}); } @@ -41,7 +41,7 @@ pub fn toThrowErrorMatchingInlineSnapshot(this: *Expect, globalThis: *JSGlobalOb } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const default_allocator = bun.default_allocator; const jsc = bun.jsc; diff --git a/src/runtime/test_runner/expect/toThrowErrorMatchingSnapshot.zig b/src/runtime/test_runner/expect/toThrowErrorMatchingSnapshot.zig index 5162a14557e..946d80065cc 100644 --- a/src/runtime/test_runner/expect/toThrowErrorMatchingSnapshot.zig +++ b/src/runtime/test_runner/expect/toThrowErrorMatchingSnapshot.zig @@ -18,12 +18,12 @@ pub fn toThrowErrorMatchingSnapshot(this: *Expect, globalThis: *JSGlobalObject, }; defer bunTest_strong.deinit(); - var hint_string: ZigString = ZigString.Empty; + var hint_string: RustString = RustString.Empty; switch (arguments.len) { 0 => {}, 1 => { if (arguments[0].isString()) { - try arguments[0].toZigString(&hint_string, globalThis); + try arguments[0].toRustString(&hint_string, globalThis); } else { return this.throw(globalThis, "", "\n\nMatcher error: Expected first argument to be a string\n", .{}); } @@ -43,7 +43,7 @@ pub fn toThrowErrorMatchingSnapshot(this: *Expect, globalThis: *JSGlobalObject, } const bun = @import("bun"); -const ZigString = bun.ZigString; +const RustString = bun.RustString; const default_allocator = bun.default_allocator; const jsc = bun.jsc; diff --git a/src/runtime/test_runner/jest.zig b/src/runtime/test_runner/jest.zig index 62aba91b078..83d451a8da2 100644 --- a/src/runtime/test_runner/jest.zig +++ b/src/runtime/test_runner/jest.zig @@ -192,27 +192,27 @@ pub const Jest = struct { const module = JSValue.createEmptyObject(globalObject, 23); const test_scope_functions = try bun_test.ScopeFunctions.createBound(globalObject, .@"test", .zero, .{}, bun_test.ScopeFunctions.strings.@"test"); - module.put(globalObject, ZigString.static("test"), test_scope_functions); - module.put(globalObject, ZigString.static("it"), test_scope_functions); + module.put(globalObject, RustString.static("test"), test_scope_functions); + module.put(globalObject, RustString.static("it"), test_scope_functions); const xtest_scope_functions = try bun_test.ScopeFunctions.createBound(globalObject, .@"test", .zero, .{ .self_mode = .skip }, bun_test.ScopeFunctions.strings.xtest); - module.put(globalObject, ZigString.static("xtest"), xtest_scope_functions); - module.put(globalObject, ZigString.static("xit"), xtest_scope_functions); + module.put(globalObject, RustString.static("xtest"), xtest_scope_functions); + module.put(globalObject, RustString.static("xit"), xtest_scope_functions); const describe_scope_functions = try bun_test.ScopeFunctions.createBound(globalObject, .describe, .zero, .{}, bun_test.ScopeFunctions.strings.describe); - module.put(globalObject, ZigString.static("describe"), describe_scope_functions); + module.put(globalObject, RustString.static("describe"), describe_scope_functions); const xdescribe_scope_functions = bun_test.ScopeFunctions.createBound(globalObject, .describe, .zero, .{ .self_mode = .skip }, bun_test.ScopeFunctions.strings.xdescribe) catch return .zero; - module.put(globalObject, ZigString.static("xdescribe"), xdescribe_scope_functions); + module.put(globalObject, RustString.static("xdescribe"), xdescribe_scope_functions); - module.put(globalObject, ZigString.static("beforeEach"), jsc.JSFunction.create(globalObject, "beforeEach", bun_test.js_fns.genericHook(.beforeEach).hookFn, 1, .{})); - module.put(globalObject, ZigString.static("beforeAll"), jsc.JSFunction.create(globalObject, "beforeAll", bun_test.js_fns.genericHook(.beforeAll).hookFn, 1, .{})); - module.put(globalObject, ZigString.static("afterAll"), jsc.JSFunction.create(globalObject, "afterAll", bun_test.js_fns.genericHook(.afterAll).hookFn, 1, .{})); - module.put(globalObject, ZigString.static("afterEach"), jsc.JSFunction.create(globalObject, "afterEach", bun_test.js_fns.genericHook(.afterEach).hookFn, 1, .{})); - module.put(globalObject, ZigString.static("onTestFinished"), jsc.JSFunction.create(globalObject, "onTestFinished", bun_test.js_fns.genericHook(.onTestFinished).hookFn, 1, .{})); - module.put(globalObject, ZigString.static("setDefaultTimeout"), jsc.JSFunction.create(globalObject, "setDefaultTimeout", jsSetDefaultTimeout, 1, .{})); - module.put(globalObject, ZigString.static("expect"), Expect.js.getConstructor(globalObject)); - module.put(globalObject, ZigString.static("expectTypeOf"), ExpectTypeOf.js.getConstructor(globalObject)); + module.put(globalObject, RustString.static("beforeEach"), jsc.JSFunction.create(globalObject, "beforeEach", bun_test.js_fns.genericHook(.beforeEach).hookFn, 1, .{})); + module.put(globalObject, RustString.static("beforeAll"), jsc.JSFunction.create(globalObject, "beforeAll", bun_test.js_fns.genericHook(.beforeAll).hookFn, 1, .{})); + module.put(globalObject, RustString.static("afterAll"), jsc.JSFunction.create(globalObject, "afterAll", bun_test.js_fns.genericHook(.afterAll).hookFn, 1, .{})); + module.put(globalObject, RustString.static("afterEach"), jsc.JSFunction.create(globalObject, "afterEach", bun_test.js_fns.genericHook(.afterEach).hookFn, 1, .{})); + module.put(globalObject, RustString.static("onTestFinished"), jsc.JSFunction.create(globalObject, "onTestFinished", bun_test.js_fns.genericHook(.onTestFinished).hookFn, 1, .{})); + module.put(globalObject, RustString.static("setDefaultTimeout"), jsc.JSFunction.create(globalObject, "setDefaultTimeout", jsSetDefaultTimeout, 1, .{})); + module.put(globalObject, RustString.static("expect"), Expect.js.getConstructor(globalObject)); + module.put(globalObject, RustString.static("expectTypeOf"), ExpectTypeOf.js.getConstructor(globalObject)); // will add more 9 properties in the module here so we need to allocate 23 properties createMockObjects(globalObject, module); @@ -229,34 +229,34 @@ pub const Jest = struct { const restoreAllMocks = jsc.JSFunction.create(globalObject, "restoreAllMocks", JSMock__jsRestoreAllMocks, 2, .{}); const clearAllMocks = jsc.JSFunction.create(globalObject, "clearAllMocks", JSMock__jsClearAllMocks, 2, .{}); const mockModuleFn = jsc.JSFunction.create(globalObject, "module", JSMock__jsModuleMock, 2, .{}); - module.put(globalObject, ZigString.static("mock"), mockFn); - mockFn.put(globalObject, ZigString.static("module"), mockModuleFn); - mockFn.put(globalObject, ZigString.static("restore"), restoreAllMocks); - mockFn.put(globalObject, ZigString.static("clearAllMocks"), clearAllMocks); + module.put(globalObject, RustString.static("mock"), mockFn); + mockFn.put(globalObject, RustString.static("module"), mockModuleFn); + mockFn.put(globalObject, RustString.static("restore"), restoreAllMocks); + mockFn.put(globalObject, RustString.static("clearAllMocks"), clearAllMocks); const jest = JSValue.createEmptyObject(globalObject, 9 + bun_test.FakeTimers.timerFnsCount); - jest.put(globalObject, ZigString.static("fn"), mockFn); - jest.put(globalObject, ZigString.static("mock"), mockModuleFn); - jest.put(globalObject, ZigString.static("spyOn"), spyOn); - jest.put(globalObject, ZigString.static("restoreAllMocks"), restoreAllMocks); - jest.put(globalObject, ZigString.static("clearAllMocks"), clearAllMocks); - jest.put(globalObject, ZigString.static("resetAllMocks"), clearAllMocks); - jest.put(globalObject, ZigString.static("setSystemTime"), setSystemTime); - jest.put(globalObject, ZigString.static("now"), jsc.JSFunction.create(globalObject, "now", JSMock__jsNow, 0, .{})); - jest.put(globalObject, ZigString.static("setTimeout"), jsc.JSFunction.create(globalObject, "setTimeout", jsSetDefaultTimeout, 1, .{})); - - module.put(globalObject, ZigString.static("jest"), jest); - module.put(globalObject, ZigString.static("spyOn"), spyOn); - module.put(globalObject, ZigString.static("expect"), Expect.js.getConstructor(globalObject)); + jest.put(globalObject, RustString.static("fn"), mockFn); + jest.put(globalObject, RustString.static("mock"), mockModuleFn); + jest.put(globalObject, RustString.static("spyOn"), spyOn); + jest.put(globalObject, RustString.static("restoreAllMocks"), restoreAllMocks); + jest.put(globalObject, RustString.static("clearAllMocks"), clearAllMocks); + jest.put(globalObject, RustString.static("resetAllMocks"), clearAllMocks); + jest.put(globalObject, RustString.static("setSystemTime"), setSystemTime); + jest.put(globalObject, RustString.static("now"), jsc.JSFunction.create(globalObject, "now", JSMock__jsNow, 0, .{})); + jest.put(globalObject, RustString.static("setTimeout"), jsc.JSFunction.create(globalObject, "setTimeout", jsSetDefaultTimeout, 1, .{})); + + module.put(globalObject, RustString.static("jest"), jest); + module.put(globalObject, RustString.static("spyOn"), spyOn); + module.put(globalObject, RustString.static("expect"), Expect.js.getConstructor(globalObject)); const vi = JSValue.createEmptyObject(globalObject, 6 + bun_test.FakeTimers.timerFnsCount); - vi.put(globalObject, ZigString.static("fn"), mockFn); - vi.put(globalObject, ZigString.static("mock"), mockModuleFn); - vi.put(globalObject, ZigString.static("spyOn"), spyOn); - vi.put(globalObject, ZigString.static("restoreAllMocks"), restoreAllMocks); - vi.put(globalObject, ZigString.static("resetAllMocks"), clearAllMocks); - vi.put(globalObject, ZigString.static("clearAllMocks"), clearAllMocks); - module.put(globalObject, ZigString.static("vi"), vi); + vi.put(globalObject, RustString.static("fn"), mockFn); + vi.put(globalObject, RustString.static("mock"), mockModuleFn); + vi.put(globalObject, RustString.static("spyOn"), spyOn); + vi.put(globalObject, RustString.static("restoreAllMocks"), restoreAllMocks); + vi.put(globalObject, RustString.static("resetAllMocks"), clearAllMocks); + vi.put(globalObject, RustString.static("clearAllMocks"), clearAllMocks); + module.put(globalObject, RustString.static("vi"), vi); bun_test.FakeTimers.putTimersFns(globalObject, jest, vi); } @@ -494,13 +494,13 @@ pub fn errorInCI(globalObject: *jsc.JSGlobalObject, message: []const u8) bun.JSE const string = []const u8; -pub const bun_test = @import("./bun_test.zig"); +pub const bun_test = @import("./bun_test.rust"); const std = @import("std"); -const CommandLineReporter = @import("../cli/test_command.zig").CommandLineReporter; -const Snapshots = @import("./snapshot.zig").Snapshots; +const CommandLineReporter = @import("../cli/test_command.rust").CommandLineReporter; +const Snapshots = @import("./snapshot.rust").Snapshots; -const expect = @import("./expect.zig"); +const expect = @import("./expect.rust"); const Expect = expect.Expect; const ExpectTypeOf = expect.ExpectTypeOf; @@ -516,4 +516,4 @@ const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; const RegularExpression = jsc.RegularExpression; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/test_runner/pretty_format.zig b/src/runtime/test_runner/pretty_format.zig index aa685650af8..bcedb5dc356 100644 --- a/src/runtime/test_runner/pretty_format.zig +++ b/src/runtime/test_runner/pretty_format.zig @@ -240,13 +240,13 @@ pub const JestPrettyFormat = struct { this.estimated_line_length +|= len; } - pub const ZigFormatter = struct { + pub const RustFormatter = struct { formatter: *JestPrettyFormat.Formatter, global: *JSGlobalObject, value: JSValue, pub const WriteError = error{UhOh}; - pub fn format(self: ZigFormatter, writer: *std.Io.Writer) !void { + pub fn format(self: RustFormatter, writer: *std.Io.Writer) !void { self.formatter.remaining_values = &[_]JSValue{self.value}; defer { self.formatter.remaining_values = &[_]JSValue{}; @@ -265,7 +265,7 @@ pub const JestPrettyFormat = struct { // For detecting circular references pub const Visited = struct { - const ObjectPool = @import("../../collections/pool.zig").ObjectPool; + const ObjectPool = @import("../../collections/pool.rust").ObjectPool; pub const Map = std.AutoHashMap(JSValue, void); pub const Pool = ObjectPool( Map, @@ -416,8 +416,8 @@ pub const JestPrettyFormat = struct { // Is this a react element? if (js_type.isObject() and js_type != .ProxyObject) { if (try value.getOwnTruthy(globalThis, "$$typeof")) |typeof_symbol| { - var reactElement = ZigString.init("react.element"); - var react_fragment = ZigString.init("react.fragment"); + var reactElement = RustString.init("react.element"); + var react_fragment = RustString.init("react.fragment"); if (try typeof_symbol.isSameValue(.symbolFor(globalThis, &reactElement), globalThis) or try typeof_symbol.isSameValue(.symbolFor(globalThis, &react_fragment), globalThis)) { return .{ .tag = .JSX, .cell = js_type }; @@ -612,7 +612,7 @@ pub const JestPrettyFormat = struct { }; } - pub inline fn writeString(self: *@This(), str: ZigString) void { + pub inline fn writeString(self: *@This(), str: RustString) void { self.print("{f}", .{str}); } @@ -717,7 +717,7 @@ pub const JestPrettyFormat = struct { .ctx = this.writer, .failed = false, }; - var name_str = ZigString.init(""); + var name_str = RustString.init(""); try value.getNameProperty(globalThis, &name_str); if (name_str.len > 0 and !name_str.eqlComptime("Object")) { @@ -734,7 +734,7 @@ pub const JestPrettyFormat = struct { this.formatter.estimated_line_length = this.formatter.indent * 2 + 1; if (this.formatter.indent == 0) this.writer.writeAll("\n") catch {}; - var classname = ZigString.Empty; + var classname = RustString.Empty; try value.getClassName(globalThis, &classname); if (!classname.isEmpty() and !classname.eqlComptime("Object")) { this.writer.print("{f} ", .{classname}) catch {}; @@ -748,7 +748,7 @@ pub const JestPrettyFormat = struct { pub fn forEach( globalThis: *JSGlobalObject, ctx_ptr: ?*anyopaque, - key_: [*c]ZigString, + key_: [*c]RustString, value: JSValue, is_symbol: bool, is_private_symbol: bool, @@ -902,8 +902,8 @@ pub const JestPrettyFormat = struct { this.writeWithFormatting(Writer, writer_, @TypeOf(slice), slice, this.globalThis, enable_ansi_colors); }, .String => { - var str = ZigString.init(""); - try value.toZigString(&str, this.globalThis); + var str = RustString.init(""); + try value.toRustString(&str, this.globalThis); this.addForNewLine(str.len); if (value.jsType() == .StringObject or value.jsType() == .DerivedStringObject) { @@ -1018,7 +1018,7 @@ pub const JestPrettyFormat = struct { writer.print(comptime Output.prettyFmt("{d}", enable_ansi_colors), .{int}); }, .BigInt => { - const out_str = (try value.getZigString(this.globalThis)).slice(); + const out_str = (try value.getRustString(this.globalThis)).slice(); this.addForNewLine(out_str.len); writer.print(comptime Output.prettyFmt("{s}n", enable_ansi_colors), .{out_str}); @@ -1065,7 +1065,7 @@ pub const JestPrettyFormat = struct { } }, .Error => { - var classname = ZigString.Empty; + var classname = RustString.Empty; try value.getClassName(this.globalThis, &classname); var message_string = bun.String.empty; defer message_string.deref(); @@ -1082,7 +1082,7 @@ pub const JestPrettyFormat = struct { return; }, .Class => { - var printable = ZigString.init(&name_buf); + var printable = RustString.init(&name_buf); try value.getClassName(this.globalThis, &printable); this.addForNewLine(printable.len); @@ -1093,7 +1093,7 @@ pub const JestPrettyFormat = struct { } }, .Function => { - var printable = ZigString.init(&name_buf); + var printable = RustString.init(&name_buf); try value.getNameProperty(this.globalThis, &printable); if (printable.len == 0) { @@ -1480,9 +1480,9 @@ pub const JestPrettyFormat = struct { writer.writeAll("<"); var needs_space = false; - var tag_name_str = ZigString.init(""); + var tag_name_str = RustString.init(""); - var tag_name_slice: ZigString.Slice = ZigString.Slice.empty; + var tag_name_slice: RustString.Slice = RustString.Slice.empty; var is_tag_kind_primitive = false; defer if (tag_name_slice.isAllocated()) tag_name_slice.deinit(); @@ -1491,21 +1491,21 @@ pub const JestPrettyFormat = struct { const _tag = try Tag.get(type_value, this.globalThis); if (_tag.cell == .Symbol) {} else if (_tag.cell.isStringLike()) { - try type_value.toZigString(&tag_name_str, this.globalThis); + try type_value.toRustString(&tag_name_str, this.globalThis); is_tag_kind_primitive = true; } else if (_tag.cell.isObject() or type_value.isCallable()) { try type_value.getNameProperty(this.globalThis, &tag_name_str); if (tag_name_str.len == 0) { - tag_name_str = ZigString.init("NoName"); + tag_name_str = RustString.init("NoName"); } } else { - try type_value.toZigString(&tag_name_str, this.globalThis); + try type_value.toRustString(&tag_name_str, this.globalThis); } tag_name_slice = tag_name_str.toSlice(default_allocator); needs_space = true; } else { - tag_name_slice = ZigString.init("unknown").toSlice(default_allocator); + tag_name_slice = RustString.init("unknown").toSlice(default_allocator); needs_space = true; } @@ -1616,7 +1616,7 @@ pub const JestPrettyFormat = struct { print_children: { switch (tag.tag) { .String => { - const children_string = try children.getZigString(this.globalThis); + const children_string = try children.getRustString(this.globalThis); if (children_string.len == 0) break :print_children; if (comptime enable_ansi_colors) writer.writeAll(comptime Output.prettyFmt("", true)); @@ -1733,7 +1733,7 @@ pub const JestPrettyFormat = struct { try value.forEachPropertyOrdered(this.globalThis, &iter, Iterator.forEach); if (iter.i == 0) { - var object_name = ZigString.Empty; + var object_name = RustString.Empty; try value.getClassName(this.globalThis, &object_name); if (!object_name.eqlComptime("Object")) { @@ -1770,7 +1770,7 @@ pub const JestPrettyFormat = struct { } if (jsType == .Uint8Array) { - var buffer_name = ZigString.Empty; + var buffer_name = RustString.Empty; try value.getClassName(this.globalThis, &buffer_name); if (strings.eqlComptime(buffer_name.slice(), "Buffer")) { // special formatting for 'Buffer' snapshots only @@ -2038,7 +2038,7 @@ pub const JestPrettyFormat = struct { writer.writeAll("Any<"); } - var class_name = ZigString.init(&name_buf); + var class_name = RustString.init(&name_buf); try constructor_value.getClassName(this.globalThis, &class_name); this.addForNewLine(class_name.len); writer.print(comptime Output.prettyFmt("{f}", enable_ansi_colors), .{class_name}); @@ -2127,7 +2127,7 @@ pub const JestPrettyFormat = struct { const string = []const u8; -const expect = @import("./expect.zig"); +const expect = @import("./expect.rust"); const std = @import("std"); const bun = @import("bun"); @@ -2141,4 +2141,4 @@ const CAPI = jsc.C; const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/runtime/test_runner/snapshot.zig b/src/runtime/test_runner/snapshot.zig index 1a5b898f176..7a041cd6c63 100644 --- a/src/runtime/test_runner/snapshot.zig +++ b/src/runtime/test_runner/snapshot.zig @@ -280,7 +280,7 @@ pub const Snapshots = struct { for (ils_info.items) |ils| { if (ils.line == last_line and ils.col == last_col) { if (!bun.strings.eql(ils.value, last_value)) { - const DiffFormatter = @import("./diff_format.zig").DiffFormatter; + const DiffFormatter = @import("./diff_format.rust").DiffFormatter; try log.addErrorFmt(source, .{ .start = @intCast(uncommitted_segment_end) }, arena, "Failed to update inline snapshot: Multiple inline snapshots on the same line must all have the same value:\n{f}", .{DiffFormatter{ .received_string = ils.value, .expected_string = last_value, @@ -565,9 +565,9 @@ pub const Snapshots = struct { const string = []const u8; const std = @import("std"); -const Expect = @import("./expect.zig").Expect; +const Expect = @import("./expect.rust").Expect; -const jest = @import("./jest.zig"); +const jest = @import("./jest.rust"); const Jest = jest.Jest; const TestRunner = jest.TestRunner; diff --git a/src/runtime/test_runner/timers/FakeTimers.zig b/src/runtime/test_runner/timers/FakeTimers.zig index 4caf05d6248..a63e3712581 100644 --- a/src/runtime/test_runner/timers/FakeTimers.zig +++ b/src/runtime/test_runner/timers/FakeTimers.zig @@ -359,7 +359,7 @@ const fake_timers_fns: []const struct { [:0]const u8, u32, (fn (*jsc.JSGlobalObj pub const timerFnsCount = fake_timers_fns.len; pub fn putTimersFns(globalObject: *jsc.JSGlobalObject, jest: jsc.JSValue, vi: jsc.JSValue) void { inline for (fake_timers_fns) |fake_timer_fn| { - const str = bun.ZigString.static(fake_timer_fn[0]); + const str = bun.RustString.static(fake_timer_fn[0]); const jsvalue = jsc.JSFunction.create(globalObject, fake_timer_fn[0], fake_timer_fn[2], fake_timer_fn[1], .{}); vi.put(globalObject, str, jsvalue); jest.put(globalObject, str, jsvalue); diff --git a/src/runtime/timer/ImmediateObject.zig b/src/runtime/timer/ImmediateObject.zig index 9513c7fbec0..6ceef74f429 100644 --- a/src/runtime/timer/ImmediateObject.zig +++ b/src/runtime/timer/ImmediateObject.zig @@ -93,7 +93,7 @@ pub fn dispose(self: *Self, globalThis: *JSGlobalObject, _: *jsc.CallFrame) bun. return .js_undefined; } -const Debugger = @import("../../jsc/Debugger.zig"); +const Debugger = @import("../../jsc/Debugger.rust"); const bun = @import("bun"); const EventLoopTimer = bun.api.Timer.EventLoopTimer; diff --git a/src/runtime/timer/TimeoutObject.zig b/src/runtime/timer/TimeoutObject.zig index 3e8a5d9ebaa..c24d15b4377 100644 --- a/src/runtime/timer/TimeoutObject.zig +++ b/src/runtime/timer/TimeoutObject.zig @@ -131,7 +131,7 @@ pub fn dispose(self: *Self, globalThis: *JSGlobalObject, _: *jsc.CallFrame) bun. return .js_undefined; } -const Debugger = @import("../../jsc/Debugger.zig"); +const Debugger = @import("../../jsc/Debugger.rust"); const bun = @import("bun"); const EventLoopTimer = bun.api.Timer.EventLoopTimer; diff --git a/src/runtime/timer/Timer.zig b/src/runtime/timer/Timer.zig index 4b2a6698c83..151ff363539 100644 --- a/src/runtime/timer/Timer.zig +++ b/src/runtime/timer/Timer.zig @@ -621,11 +621,11 @@ pub const All = struct { } }; -pub const EventLoopTimer = @import("../../event_loop/EventLoopTimer.zig"); +pub const EventLoopTimer = @import("../../event_loop/EventLoopTimer.rust"); -pub const TimeoutObject = @import("./TimeoutObject.zig"); -pub const ImmediateObject = @import("./ImmediateObject.zig"); -pub const TimerObjectInternals = @import("./TimerObjectInternals.zig"); +pub const TimeoutObject = @import("./TimeoutObject.rust"); +pub const ImmediateObject = @import("./ImmediateObject.rust"); +pub const TimerObjectInternals = @import("./TimerObjectInternals.rust"); pub const Kind = enum(u2) { setTimeout = 0, @@ -659,11 +659,11 @@ pub const ID = extern struct { }; /// A timer created by WTF code and invoked by Bun's event loop -pub const WTFTimer = @import("./WTFTimer.zig"); +pub const WTFTimer = @import("./WTFTimer.rust"); -pub const DateHeaderTimer = @import("./DateHeaderTimer.zig"); +pub const DateHeaderTimer = @import("./DateHeaderTimer.rust"); -pub const EventLoopDelayMonitor = @import("./EventLoopDelayMonitor.zig"); +pub const EventLoopDelayMonitor = @import("./EventLoopDelayMonitor.rust"); pub const internal_bindings = struct { /// Node.js has some tests that check whether timers fire at the right time. They check this diff --git a/src/runtime/timer/TimerObjectInternals.zig b/src/runtime/timer/TimerObjectInternals.zig index e4b3c74561e..8167f73b208 100644 --- a/src/runtime/timer/TimerObjectInternals.zig +++ b/src/runtime/timer/TimerObjectInternals.zig @@ -527,7 +527,7 @@ pub fn deinit(this: *TimerObjectInternals) void { } } -const Debugger = @import("../../jsc/Debugger.zig"); +const Debugger = @import("../../jsc/Debugger.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/valkey_jsc/ValkeyCommand.zig b/src/runtime/valkey_jsc/ValkeyCommand.zig index e33a6e8b4fc..4fc743d95ec 100644 --- a/src/runtime/valkey_jsc/ValkeyCommand.zig +++ b/src/runtime/valkey_jsc/ValkeyCommand.zig @@ -160,11 +160,11 @@ pub const PromisePair = struct { } }; -const protocol = @import("../../valkey/valkey_protocol.zig"); +const protocol = @import("../../valkey/valkey_protocol.rust"); const std = @import("std"); const bun = @import("bun"); const JSError = bun.JSError; const jsc = bun.jsc; const node = bun.api.node; -const Slice = jsc.ZigString.Slice; +const Slice = jsc.RustString.Slice; diff --git a/src/runtime/valkey_jsc/index.zig b/src/runtime/valkey_jsc/index.zig index 92923547538..4b515399a1d 100644 --- a/src/runtime/valkey_jsc/index.zig +++ b/src/runtime/valkey_jsc/index.zig @@ -1,14 +1,14 @@ // Entry point for Valkey client // // Exports: -// - Core Valkey client implementation in valkey.zig -// - JavaScript wrapper in js_valkey.zig -// - Valkey protocol implementation in valkey_protocol.zig +// - Core Valkey client implementation in valkey.rust +// - JavaScript wrapper in js_valkey.rust +// - Valkey protocol implementation in valkey_protocol.rust // Import modules -pub const valkey = @import("./valkey.zig"); -pub const js_valkey = @import("./js_valkey.zig"); -pub const protocol = @import("../../valkey/valkey_protocol.zig"); +pub const valkey = @import("./valkey.rust"); +pub const js_valkey = @import("./js_valkey.rust"); +pub const protocol = @import("../../valkey/valkey_protocol.rust"); // Export JS client pub const JSValkeyClient = js_valkey.JSValkeyClient; @@ -18,4 +18,4 @@ pub const ValkeyClient = valkey.ValkeyClient; pub const Protocol = valkey.Protocol; pub const Status = valkey.Status; pub const Options = valkey.Options; -pub const Command = @import("./ValkeyCommand.zig"); +pub const Command = @import("./ValkeyCommand.rust"); diff --git a/src/runtime/valkey_jsc/js_valkey.zig b/src/runtime/valkey_jsc/js_valkey.zig index 4900b13aeb1..6dd5f5fec1c 100644 --- a/src/runtime/valkey_jsc/js_valkey.zig +++ b/src/runtime/valkey_jsc/js_valkey.zig @@ -79,7 +79,7 @@ pub const SubscriptionCtx = struct { } // Existing is guaranteed to be an array of callbacks. - // This check is necessary because crossing between Zig and C++ is necessary because Zig doesn't know that C++ + // This check is necessary because crossing between Rust and C++ is necessary because Rust doesn't know that C++ // is side-effect-free. if (comptime bun.Environment.isDebug) { bun.assert(existing.isArray()); @@ -171,7 +171,7 @@ pub const SubscriptionCtx = struct { args: []const JSValue, ) bun.JSError!void { const callbacks = try this.getCallbacks(globalObject, channelName) orelse { - debug("No callbacks found for channel {f}", .{channelName.asString().getZigString(globalObject)}); + debug("No callbacks found for channel {f}", .{channelName.asString().getRustString(globalObject)}); return; }; @@ -272,7 +272,7 @@ pub const JSValkeyClient = struct { defer url_str.deref(); var fallback_url_buf: [2048]u8 = undefined; - // Parse and validate the URL using URL.zig's fromString which returns null for invalid URLs + // Parse and validate the URL using URL.rust's fromString which returns null for invalid URLs // TODO(markovejnovic): The following check for :// is a stop-gap. It is my expectation // that URL.fromString returns null if the protocol is not specified. This is not, in-fact, // the case right now and I do not understand why. It will take some work in JSC to @@ -1438,10 +1438,10 @@ pub const JSValkeyClient = struct { pub const blmpop = fns.blmpop; pub const brpoplpush = fns.brpoplpush; - const fns = @import("./js_valkey_functions.zig"); + const fns = @import("./js_valkey_functions.rust"); }; -/// Referenced by `dispatch.zig` (kind = `.valkey[_tls]`). +/// Referenced by `dispatch.rust` (kind = `.valkey[_tls]`). pub fn SocketHandler(comptime ssl: bool) type { return struct { const SocketType = uws.NewSocketHandler(ssl); @@ -1654,12 +1654,12 @@ const Options = struct { const debug = bun.Output.scoped(.RedisJS, .visible); -const Command = @import("./ValkeyCommand.zig"); +const Command = @import("./ValkeyCommand.rust"); const std = @import("std"); -const valkey = @import("./valkey.zig"); -const URL = @import("../../jsc/URL.zig").URL; +const valkey = @import("./valkey.rust"); +const URL = @import("../../jsc/URL.rust").URL; -const protocol = @import("../../valkey/valkey_protocol.zig"); +const protocol = @import("../../valkey/valkey_protocol.rust"); const RedisError = protocol.RedisError; const bun = @import("bun"); diff --git a/src/runtime/valkey_jsc/js_valkey_functions.zig b/src/runtime/valkey_jsc/js_valkey_functions.zig index 0c8b2531b49..94c99bdc799 100644 --- a/src/runtime/valkey_jsc/js_valkey_functions.zig +++ b/src/runtime/valkey_jsc/js_valkey_functions.zig @@ -632,7 +632,7 @@ fn hsetImpl(this: *JSValkeyClient, globalObject: *jsc.JSGlobalObject, callframe: const second_arg = callframe.argument(1); - var args = std.array_list.Managed(jsc.ZigString.Slice).init(bun.default_allocator); + var args = std.array_list.Managed(jsc.RustString.Slice).init(bun.default_allocator); defer { for (args.items) |item| item.deinit(); args.deinit(); @@ -1200,7 +1200,7 @@ pub fn unsubscribe( ) catch { return globalObject.throw( "Failed to remove handler for channel {f}", - .{channel.asString().getZigString(globalObject)}, + .{channel.asString().getRustString(globalObject)}, ); } orelse { // Listeners weren't present in the first place, so we can return a @@ -1586,13 +1586,13 @@ fn fromJS(globalObject: *jsc.JSGlobalObject, value: JSValue) !?JSArgument { const bun = @import("bun"); const std = @import("std"); -const JSValkeyClient = @import("./js_valkey.zig").JSValkeyClient; -const SubscriptionCtx = @import("./js_valkey.zig").SubscriptionCtx; +const JSValkeyClient = @import("./js_valkey.rust").JSValkeyClient; +const SubscriptionCtx = @import("./js_valkey.rust").SubscriptionCtx; const jsc = bun.jsc; const JSValue = jsc.JSValue; const JSArgument = jsc.Node.BlobOrStringOrBuffer; -const Slice = jsc.ZigString.Slice; +const Slice = jsc.RustString.Slice; const valkey = bun.valkey; const Command = valkey.Command; diff --git a/src/runtime/valkey_jsc/protocol_jsc.zig b/src/runtime/valkey_jsc/protocol_jsc.zig index 4293018f98b..21a4ab46173 100644 --- a/src/runtime/valkey_jsc/protocol_jsc.zig +++ b/src/runtime/valkey_jsc/protocol_jsc.zig @@ -1,4 +1,4 @@ -//! `toJS` bridges for the RESP protocol types in `valkey/valkey_protocol.zig`. +//! `toJS` bridges for the RESP protocol types in `valkey/valkey_protocol.rust`. //! The protocol parser, `RESPValue` union, and `ValkeyReader` stay in //! `valkey/`; only the `JSGlobalObject`/`JSValue`-touching conversions live //! here so `valkey/` is JSC-free. @@ -140,7 +140,7 @@ pub fn respValueToJSWithOptions(self: *RESPValue, globalObject: *jsc.JSGlobalObj const std = @import("std"); -const protocol = @import("../../valkey/valkey_protocol.zig"); +const protocol = @import("../../valkey/valkey_protocol.rust"); const RESPValue = protocol.RESPValue; const bun = @import("bun"); diff --git a/src/runtime/valkey_jsc/valkey.zig b/src/runtime/valkey_jsc/valkey.zig index 966a9d795d9..fb7b352e9ae 100644 --- a/src/runtime/valkey_jsc/valkey.zig +++ b/src/runtime/valkey_jsc/valkey.zig @@ -2,7 +2,7 @@ // // This file contains the core Valkey client implementation with protocol handling -pub const ValkeyContext = @import("./ValkeyContext.zig"); +pub const ValkeyContext = @import("./ValkeyContext.rust"); /// Connection flags to track Valkey client state pub const ConnectionFlags = struct { @@ -45,7 +45,7 @@ pub fn isActive(this: *const Status) bool { }; } -pub const Command = @import("./ValkeyCommand.zig"); +pub const Command = @import("./ValkeyCommand.rust"); /// Valkey protocol types (standalone, TLS, Unix socket) pub const Protocol = enum { @@ -1217,8 +1217,8 @@ pub const ValkeyClient = struct { // Auto-pipelining const debug = bun.Output.scoped(.Redis, .visible); -const ValkeyCommand = @import("./ValkeyCommand.zig"); -const protocol = @import("../../valkey/valkey_protocol.zig"); +const ValkeyCommand = @import("./ValkeyCommand.rust"); +const protocol = @import("../../valkey/valkey_protocol.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/webcore.zig b/src/runtime/webcore.zig index 9a2f7d0a3b2..1bc4c1e7ead 100644 --- a/src/runtime/webcore.zig +++ b/src/runtime/webcore.zig @@ -1,49 +1,49 @@ -//! Web APIs implemented in Zig live here +//! Web APIs implemented in Rust live here comptime { if (bun.Environment.export_cpp_apis) { - _ = &@import("./webcore/prompt.zig"); + _ = &@import("./webcore/prompt.rust"); } - _ = &@import("./webcore/TextEncoder.zig"); + _ = &@import("./webcore/TextEncoder.rust"); } -pub const DOMExceptionCode = @import("../jsc/JSErrorCode.zig").DOMExceptionCode; +pub const DOMExceptionCode = @import("../jsc/JSErrorCode.rust").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("../jsc/AbortSignal.zig").AbortSignal; -pub const WebWorker = @import("../jsc/web_worker.zig"); -pub const AutoFlusher = @import("../event_loop/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("../jsc/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("./webcore/Crypto.rust"); +pub const AbortSignal = @import("../jsc/AbortSignal.rust").AbortSignal; +pub const WebWorker = @import("../jsc/web_worker.rust"); +pub const AutoFlusher = @import("../event_loop/AutoFlusher.rust"); +pub const EncodingLabel = @import("./webcore/EncodingLabel.rust").EncodingLabel; +pub const Fetch = @import("./webcore/fetch.rust"); +pub const Response = @import("./webcore/Response.rust"); +pub const BakeResponse = @import("./webcore/BakeResponse.rust"); +pub const TextDecoder = @import("./webcore/TextDecoder.rust"); +pub const TextEncoder = @import("./webcore/TextEncoder.rust"); +pub const TextEncoderStreamEncoder = @import("./webcore/TextEncoderStreamEncoder.rust"); +pub const encoding = @import("./webcore/encoding.rust"); +pub const ReadableStream = @import("./webcore/ReadableStream.rust"); +pub const Blob = @import("./webcore/Blob.rust"); +pub const S3Stat = @import("./webcore/S3Stat.rust").S3Stat; +pub const ResumableFetchSink = @import("./webcore/ResumableSink.rust").ResumableFetchSink; +pub const ResumableS3UploadSink = @import("./webcore/ResumableSink.rust").ResumableS3UploadSink; +pub const ResumableSinkBackpressure = @import("./webcore/ResumableSink.rust").ResumableSinkBackpressure; +pub const S3Client = @import("./webcore/S3Client.rust").S3Client; +pub const Request = @import("./webcore/Request.rust"); +pub const Body = @import("./webcore/Body.rust"); +pub const CookieMap = @import("./webcore/CookieMap.rust").CookieMap; +pub const ObjectURLRegistry = @import("./webcore/ObjectURLRegistry.rust"); +pub const Sink = @import("./webcore/Sink.rust"); +pub const FileSink = @import("./webcore/FileSink.rust"); +pub const FetchHeaders = @import("../jsc/FetchHeaders.rust").FetchHeaders; +pub const ByteBlobLoader = @import("./webcore/ByteBlobLoader.rust"); +pub const ByteStream = @import("./webcore/ByteStream.rust"); +pub const FileReader = @import("./webcore/FileReader.rust"); +pub const ScriptExecutionContext = @import("./webcore/ScriptExecutionContext.rust"); + +pub const streams = @import("./webcore/streams.rust"); pub const NetworkSink = streams.NetworkSink; pub const HTTPResponseSink = streams.HTTPResponseSink; pub const HTTPSResponseSink = streams.HTTPSResponseSink; @@ -58,7 +58,7 @@ comptime { } pub const PathOrFileDescriptor = union(enum) { - path: jsc.ZigString.Slice, + path: jsc.RustString.Slice, fd: bun.FD, pub fn deinit(this: *const PathOrFileDescriptor) void { @@ -120,10 +120,10 @@ pub const Lifetime = enum { const std = @import("std"); -const WebSocketClient = @import("../http/websocket_http_client.zig").WebSocketClient; -const WebSocketClientTLS = @import("../http/websocket_http_client.zig").WebSocketClientTLS; -const WebSocketHTTPClient = @import("../http/websocket_http_client.zig").WebSocketHTTPClient; -const WebSocketHTTPSClient = @import("../http/websocket_http_client.zig").WebSocketHTTPSClient; +const WebSocketClient = @import("../http/websocket_http_client.rust").WebSocketClient; +const WebSocketClientTLS = @import("../http/websocket_http_client.rust").WebSocketClientTLS; +const WebSocketHTTPClient = @import("../http/websocket_http_client.rust").WebSocketHTTPClient; +const WebSocketHTTPSClient = @import("../http/websocket_http_client.rust").WebSocketHTTPSClient; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/webcore/Blob.zig b/src/runtime/webcore/Blob.zig index 6cf5c047554..ab618ea6e69 100644 --- a/src/runtime/webcore/Blob.zig +++ b/src/runtime/webcore/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("./blob/Store.rust"); +pub const read_file = @import("./blob/read_file.rust"); +pub const write_file = @import("./blob/write_file.rust"); +pub const copy_file = @import("./blob/copy_file.rust"); pub fn new(blob: Blob) *Blob { const result = bun.new(Blob, blob); @@ -77,7 +77,7 @@ pub const ClosingState = enum(u8) { }; pub fn getFormDataEncoding(this: *Blob) ?*bun.FormData.AsyncFormData { - var content_type_slice: ZigString.Slice = this.getContentType() orelse return null; + var content_type_slice: RustString.Slice = this.getContentType() orelse return null; defer content_type_slice.deinit(); const encoding = bun.FormData.Encoding.get(content_type_slice.slice()) orelse return null; return bun.handleOom(bun.FormData.AsyncFormData.init(bun.default_allocator, encoding)); @@ -184,7 +184,7 @@ pub fn NewInternalReadFileHandler(comptime Context: type, comptime Function: any /// or in-memory — and deliver them to `Handler.onReadBytes(ctx, result)` on the /// JS thread without ever materialising a JSValue. `.ok` bytes are /// `bun.default_allocator`-OWNED by the callback. The point is to give callers -/// the same store-agnostic dispatch as `.bytes()` while staying in Zig land, +/// the same store-agnostic dispatch as `.bytes()` while staying in Rust land, /// so e.g. `Bun.Image` can read a `Bun.file`/`Bun.s3` source straight into its /// `.owned` buffer with no JS-heap copy in between. /// @@ -223,7 +223,7 @@ pub fn readBytesToHandler(this: *Blob, comptime Handler: type, ctx: *Handler, gl fn cb(result: S3.S3DownloadResult, opaque_self: *anyopaque) bun.JSTerminated!void { const t: *@This() = @ptrCast(@alignCast(opaque_self)); switch (result) { - // `body` is owned by us (simple_request.zig:20); take the + // `body` is owned by us (simple_request.rust:20); take the // ArrayList's items as-is. .success => |response| t.done(.{ .ok = response.body.list.items }), // S3Error has its own JS-error builder; flatten to a @@ -273,7 +273,7 @@ pub const ReadBytesResult = union(enum) { /// `Bun.file("…").image(opts?)` ≡ `new Bun.Image(this, opts?)`. Lives here so /// the proto entry covers Blob/BunFile/S3File in one place; the actual -/// construction is `Image.fromBlobJS` so Blob.zig doesn't grow image +/// construction is `Image.fromBlobJS` so Blob.rust doesn't grow image /// knowledge. pub fn doImage(_: *Blob, global: *JSGlobalObject, cf: *jsc.CallFrame) bun.JSError!JSValue { return Image.fromBlobJS(global, cf.this(), cf.argument(0)); @@ -303,7 +303,7 @@ const FormDataContext = struct { failed: bool = false, globalThis: *jsc.JSGlobalObject, - pub fn onEntry(this: *FormDataContext, name: ZigString, entry: jsc.DOMFormData.FormDataEntry) void { + pub fn onEntry(this: *FormDataContext, name: RustString, entry: jsc.DOMFormData.FormDataEntry) void { if (this.failed) return; var globalThis = this.globalThis; @@ -385,9 +385,9 @@ const FormDataContext = struct { pub fn getContentType( this: *Blob, -) ?ZigString.Slice { +) ?RustString.Slice { if (this.content_type.len > 0) - return ZigString.Slice.fromUTF8NeverFree(this.content_type); + return RustString.Slice.fromUTF8NeverFree(this.content_type); return null; } @@ -690,7 +690,7 @@ const URLSearchParamsConverter = struct { allocator: std.mem.Allocator, buf: []u8 = "", globalThis: *jsc.JSGlobalObject, - pub fn convert(this: *URLSearchParamsConverter, str: ZigString) void { + pub fn convert(this: *URLSearchParamsConverter, str: RustString) void { this.buf = bun.handleOom(str.toOwnedSlice(this.allocator)); } }; @@ -987,7 +987,7 @@ pub noinline fn mkdirIfNotExists(this: anytype, err: bun.sys.Error, path_string: }, .err => |err2| { if (comptime @hasField(@TypeOf(this.*), "errno")) { - this.errno = bun.errnoToZigErr(err2.errno); + this.errno = bun.errnoToRustErr(err2.errno); } this.system_error = err.withPath(err_path).toSystemError(); if (comptime @hasField(@TypeOf(this.*), "opened_fd")) { @@ -2231,7 +2231,7 @@ pub fn toStreamWithOffset( ); } -// Zig doesn't let you pass a function with a comptime argument to a runtime-knwon function. +// Rust doesn't let you pass a function with a comptime argument to a runtime-knwon function. fn lifetimeWrap(comptime Fn: anytype, comptime lifetime: jsc.WebCore.Lifetime) fn (*Blob, *jsc.JSGlobalObject) jsc.JSValue { return struct { fn wrap(this: *Blob, globalObject: *jsc.JSGlobalObject) jsc.JSValue { @@ -2695,7 +2695,7 @@ pub fn pipeReadableStreamToBlob(this: *Blob, globalThis: *jsc.JSGlobalObject, re break :brk .{ .fd = store.data.file.pathlike.fd }; } else { break :brk .{ - .path = bun.handleOom(ZigString.Slice.initDupe( + .path = bun.handleOom(RustString.Slice.initDupe( bun.default_allocator, store.data.file.pathlike.path.slice(), )), @@ -2841,7 +2841,7 @@ pub fn getWriter( } } } - var content_disposition_str: ?ZigString.Slice = null; + var content_disposition_str: ?RustString.Slice = null; defer if (content_disposition_str) |cd| cd.deinit(); if (try options.getTruthy(globalThis, "contentDisposition")) |content_disposition| { if (!content_disposition.isString()) { @@ -2849,7 +2849,7 @@ pub fn getWriter( } content_disposition_str = try content_disposition.toSlice(globalThis, bun.default_allocator); } - var content_encoding_str: ?ZigString.Slice = null; + var content_encoding_str: ?RustString.Slice = null; defer if (content_encoding_str) |ce| ce.deinit(); if (try options.getTruthy(globalThis, "contentEncoding")) |content_encoding| { if (!content_encoding.isString()) { @@ -2958,7 +2958,7 @@ pub fn getWriter( break :brk .{ .fd = store.data.file.pathlike.fd }; } else { break :brk .{ - .path = bun.handleOom(ZigString.Slice.initDupe( + .path = bun.handleOom(RustString.Slice.initDupe( bun.default_allocator, store.data.file.pathlike.path.slice(), )), @@ -3087,8 +3087,8 @@ pub fn getSlice( if (args_iter.nextEat()) |content_type_| { inner: { if (content_type_.isString()) { - var zig_str = try content_type_.getZigString(globalThis); - var slicer = zig_str.toSlice(bun.default_allocator); + var rust_str = try content_type_.getRustString(globalThis); + var slicer = rust_str.toSlice(bun.default_allocator); defer slicer.deinit(); const slice = slicer.slice(); if (!strings.isAllASCII(slice)) { @@ -3136,16 +3136,16 @@ pub fn getType( ) JSValue { if (this.content_type.len > 0) { if (this.content_type_allocated) { - return ZigString.init(this.content_type).toJS(globalThis); + return RustString.init(this.content_type).toJS(globalThis); } - return ZigString.init(this.content_type).toJS(globalThis); + return RustString.init(this.content_type).toJS(globalThis); } if (this.store) |store| { - return ZigString.init(store.mime_type.value).toJS(globalThis); + return RustString.init(store.mime_type.value).toJS(globalThis); } - return ZigString.Empty.toJS(globalThis); + return RustString.Empty.toJS(globalThis); } pub fn getNameString(this: *Blob) ?bun.String { @@ -3296,7 +3296,7 @@ export fn Blob__fromBytes(globalThis: *jsc.JSGlobalObject, ptr: ?[*]const u8, le /// Same as Blob__fromBytes but stamps content_type. `mime` must be a /// string literal with process lifetime (not freed by deinit — the caller -/// passes one of the image/* constants). The Zig side copies the bytes; +/// passes one of the image/* constants). The Rust side copies the bytes; /// caller can free `ptr` immediately after this returns. export fn Blob__fromBytesWithType(globalThis: *jsc.JSGlobalObject, ptr: ?[*]const u8, len: usize, mime: [*:0]const u8) callconv(.c) *Blob { const blob = Blob__fromBytes(globalThis, ptr, len); @@ -3385,7 +3385,7 @@ pub fn getStat(this: *Blob, globalThis: *jsc.JSGlobalObject, callback: *jsc.Call .encoded_slice = switch (path_like) { // it's already converted to utf8 .encoded_slice => |slice| try slice.toOwned(bun.default_allocator), - else => try ZigString.fromUTF8(path_like.slice()).toSliceClone(bun.default_allocator), + else => try RustString.fromUTF8(path_like.slice()).toSliceClone(bun.default_allocator), }, }, }, globalThis.bunVM()); @@ -3769,7 +3769,7 @@ pub fn toStringWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []cons if (buf.len == 0) { // If all it contained was the bom, we need to free the bytes if (lifetime == .temporary) bun.default_allocator.free(raw_bytes); - return ZigString.Empty.toJS(global); + return RustString.Empty.toJS(global); } if (bom == .utf16_le) { @@ -3798,7 +3798,7 @@ pub fn toStringWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []cons bun.default_allocator.free(raw_bytes); } - return ZigString.toExternalU16(external.ptr, external.len, global); + return RustString.toExternalU16(external.ptr, external.len, global); } if (lifetime != .temporary) this.setIsASCIIFlag(true); @@ -3810,21 +3810,21 @@ pub fn toStringWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []cons .clone => { this.store.?.ref(); // we don't need to worry about UTF-8 BOM in this case because the store owns the memory. - return ZigString.init(buf).external(global, this.store.?, Store.external); + return RustString.init(buf).external(global, this.store.?, Store.external); }, .transfer => { const store = this.store.?; assert(store.data == .bytes); this.transfer(); // we don't need to worry about UTF-8 BOM in this case because the store owns the memory. - return ZigString.init(buf).external(global, store, Store.external); + return RustString.init(buf).external(global, store, Store.external); }, // strings are immutable // sharing isn't really a thing .share => { this.store.?.ref(); // we don't need to worry about UTF-8 BOM in this case because the store owns the memory.s - return ZigString.init(buf).external(global, this.store.?, Store.external); + return RustString.init(buf).external(global, this.store.?, Store.external); }, .temporary => { // if there was a UTF-8 BOM, we need to clone the buffer because @@ -3839,7 +3839,7 @@ pub fn toStringWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []cons return out.toJS(global); } - return ZigString.init(buf).toExternalValue(global); + return RustString.init(buf).toExternalValue(global); }, } } @@ -3860,7 +3860,7 @@ pub fn toString(this: *Blob, global: *JSGlobalObject, comptime lifetime: Lifetim @constCast(this.sharedView()); if (view_.len == 0) - return ZigString.Empty.toJS(global); + return RustString.Empty.toJS(global); return toStringWithBytes(this, global, view_, lifetime); } @@ -3906,7 +3906,7 @@ pub fn toJSONWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []const // if toUTF16Alloc returns null, it means there are no non-ASCII characters if (strings.toUTF16Alloc(allocator, buf, false, false) catch null) |external| { if (comptime lifetime != .temporary) this.setIsASCIIFlag(false); - const result = ZigString.initUTF16(external).toJSONObject(global); + const result = RustString.initUTF16(external).toJSONObject(global); allocator.free(external); return result; } @@ -3914,12 +3914,12 @@ pub fn toJSONWithBytes(this: *Blob, global: *JSGlobalObject, raw_bytes: []const if (comptime lifetime != .temporary) this.setIsASCIIFlag(true); } - return ZigString.init(buf).toJSONObject(global); + return RustString.init(buf).toJSONObject(global); } pub fn toFormDataWithBytes(this: *Blob, global: *JSGlobalObject, buf: []u8, comptime _: Lifetime) JSValue { var encoder = this.getFormDataEncoding() orelse return { - return ZigString.init("Invalid encoding").toErrorInstance(global); + return RustString.init("Invalid encoding").toErrorInstance(global); }; defer encoder.deinit(); @@ -4562,7 +4562,7 @@ pub const Any = union(enum) { .Blob => return this.Blob.toString(global, lifetime), // .InlineBlob => { // if (this.InlineBlob.len == 0) { - // return ZigString.Empty.toValue(global); + // return RustString.Empty.toValue(global); // } // const owned = this.InlineBlob.toStringOwned(global); // this.* = .{ .InlineBlob = .{ .len = 0 } }; @@ -4570,7 +4570,7 @@ pub const Any = union(enum) { // }, .InternalBlob => { if (this.InternalBlob.bytes.items.len == 0) { - return ZigString.Empty.toJS(global); + return RustString.Empty.toJS(global); } const owned = try this.InternalBlob.toStringOwned(global); @@ -4732,7 +4732,7 @@ pub const Internal = struct { pub fn toStringOwned(this: *@This(), globalThis: *jsc.JSGlobalObject) bun.JSError!JSValue { const bytes_without_bom = strings.withoutUTF8BOM(this.bytes.items); if (strings.toUTF16Alloc(bun.default_allocator, bytes_without_bom, false, false) catch &[_]u16{}) |out| { - const return_value = ZigString.toExternalU16(out.ptr, out.len, globalThis); + const return_value = RustString.toExternalU16(out.ptr, out.len, globalThis); return_value.ensureStillAlive(); this.deinit(); return return_value; @@ -4744,14 +4744,14 @@ pub const Internal = struct { defer out.deref(); return out.toJS(globalThis); } else { - var str = ZigString.init(this.toOwnedSlice()); + var str = RustString.init(this.toOwnedSlice()); str.markGlobal(); return str.toExternalValue(globalThis); } } pub fn toJSON(this: *@This(), globalThis: *jsc.JSGlobalObject) JSValue { - const str_bytes = ZigString.init(strings.withoutUTF8BOM(this.bytes.items)).withEncoding(); + const str_bytes = RustString.init(strings.withoutUTF8BOM(this.bytes.items)).withEncoding(); const json = str_bytes.toJSONObject(globalThis); this.deinit(); return json; @@ -4847,9 +4847,9 @@ pub const Inline = extern struct { pub fn toStringOwned(this: *@This(), globalThis: *jsc.JSGlobalObject) JSValue { if (this.len == 0) - return ZigString.Empty.toJS(globalThis); + return RustString.Empty.toJS(globalThis); - var str = ZigString.init(this.sliceConst()); + var str = RustString.init(this.sliceConst()); if (!strings.isAllASCII(this.sliceConst())) { str.markUTF8(); @@ -4926,7 +4926,7 @@ pub fn FileOpener(comptime This: type) type { self.file_store.pathlike.path else self.file_blob.store.?.data.file.pathlike.path; - self.errno = bun.errnoToZigErr(errEnum); + self.errno = bun.errnoToRustErr(errEnum); self.system_error = bun.sys.Error.fromCode(errEnum, .open) .withPath(path_string_2.slice()) .toSystemError(); @@ -4948,7 +4948,7 @@ pub fn FileOpener(comptime This: type) type { &WrappedCallback.callback, ); if (rc.errEnum()) |errno| { - this.errno = bun.errnoToZigErr(errno); + this.errno = bun.errnoToRustErr(errno); this.system_error = bun.sys.Error.fromCode(errno, .open).withPath(path_string.slice()).toSystemError(); this.opened_fd = invalid_fd; Callback(this, invalid_fd); @@ -4974,7 +4974,7 @@ pub fn FileOpener(comptime This: type) type { } } - this.errno = bun.errnoToZigErr(err.errno); + this.errno = bun.errnoToRustErr(err.errno); this.system_error = err.withPath(path_string.slice()).toSystemError(); this.opened_fd = invalid_fd; break; @@ -5121,10 +5121,10 @@ const NewReadFileHandler = read_file.NewReadFileHandler; const string = []const u8; -const Archive = @import("../api/Archive.zig"); -const Environment = @import("../../bun_core/env.zig"); -const Image = @import("../image/Image.zig"); -const S3File = @import("./S3File.zig"); +const Archive = @import("../api/Archive.rust"); +const Environment = @import("../../bun_core/env.rust"); +const Image = @import("../image/Image.rust"); +const S3File = @import("./S3File.rust"); const std = @import("std"); const bun = @import("bun"); @@ -5148,7 +5148,7 @@ const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const PathOrBlob = jsc.Node.PathOrBlob; const Request = jsc.WebCore.Request; diff --git a/src/runtime/webcore/Body.zig b/src/runtime/webcore/Body.zig index 3b759f0981c..6ef3329385a 100644 --- a/src/runtime/webcore/Body.zig +++ b/src/runtime/webcore/Body.zig @@ -588,7 +588,7 @@ pub const Value = union(Tag) { .InternalBlob = .{ .bytes = std.array_list.Managed(u8){ .items = bun.default_allocator.dupe(u8, bytes) catch { - return globalThis.throwValue(ZigString.static("Failed to clone ArrayBufferView").toErrorInstance(globalThis)); + return globalThis.throwValue(RustString.static("Failed to clone ArrayBufferView").toErrorInstance(globalThis)); }, .capacity = bytes.len, .allocator = bun.default_allocator, @@ -747,7 +747,7 @@ pub const Value = union(Tag) { var blob = new.useAsAnyBlob(); defer blob.detach(); var async_form_data: *bun.FormData.AsyncFormData = locked.action.getFormData orelse { - try promise.reject(global, ZigString.init("Internal error: task for FormData must not be null").toErrorInstance(global)); + try promise.reject(global, RustString.init("Internal error: task for FormData must not be null").toErrorInstance(global)); break :inner; }; defer async_form_data.deinit(); @@ -1823,7 +1823,7 @@ const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; const SystemError = jsc.SystemError; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Response = jsc.WebCore.Response; const streams = jsc.WebCore.streams; diff --git a/src/runtime/webcore/Crypto.zig b/src/runtime/webcore/Crypto.zig index 510b6962341..caf2442756c 100644 --- a/src/runtime/webcore/Crypto.zig +++ b/src/runtime/webcore/Crypto.zig @@ -200,7 +200,7 @@ pub fn Bun__randomUUIDv5_(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallF break :brk result; } else if (name_value.asArrayBuffer(globalThis)) |array_buffer| { - break :brk jsc.ZigString.Slice.fromUTF8NeverFree(array_buffer.byteSlice()); + break :brk jsc.RustString.Slice.fromUTF8NeverFree(array_buffer.byteSlice()); } else { return globalThis.ERR(.INVALID_ARG_TYPE, "The \"name\" argument must be of type string or BufferSource", .{}).throw(); } @@ -279,9 +279,9 @@ pub export fn CryptoObject__create(globalThis: *jsc.JSGlobalObject) jsc.JSValue const std = @import("std"); -const UUID = @import("../../jsc/uuid.zig"); -const UUID5 = @import("../../jsc/uuid.zig").UUID5; -const UUID7 = @import("../../jsc/uuid.zig").UUID7; +const UUID = @import("../../jsc/uuid.rust"); +const UUID5 = @import("../../jsc/uuid.rust").UUID5; +const UUID7 = @import("../../jsc/uuid.rust").UUID7; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/webcore/EncodingLabel.zig b/src/runtime/webcore/EncodingLabel.zig index 937fd3d859d..be32fba7c34 100644 --- a/src/runtime/webcore/EncodingLabel.zig +++ b/src/runtime/webcore/EncodingLabel.zig @@ -233,7 +233,7 @@ pub const EncodingLabel = enum { }; const string = []const u8; -const encoding = @import("./encoding.zig"); +const encoding = @import("./encoding.rust"); const bun = @import("bun"); const strings = bun.strings; diff --git a/src/runtime/webcore/FormData.zig b/src/runtime/webcore/FormData.zig index e97c9ed9308..74f7aeb0f1d 100644 --- a/src/runtime/webcore/FormData.zig +++ b/src/runtime/webcore/FormData.zig @@ -1,4 +1,4 @@ -//! HTML `FormData` parsing + JS bridge. Moved from `url/url.zig` because the +//! HTML `FormData` parsing + JS bridge. Moved from `url/url.rust` because the //! struct is webcore (fetch Body) and JSC-heavy; `url/` is JSC-free. pub const FormData = struct { @@ -57,7 +57,7 @@ pub const FormData = struct { pub fn toJS(this: *AsyncFormData, global: *jsc.JSGlobalObject, data: []const u8, promise: jsc.AnyPromise) bun.JSTerminated!void { if (this.encoding == .Multipart and this.encoding.Multipart.len == 0) { log("AsnycFormData.toJS -> promise.reject missing boundary", .{}); - try promise.reject(global, jsc.ZigString.init("FormData missing boundary").toErrorInstance(global)); + try promise.reject(global, jsc.RustString.init("FormData missing boundary").toErrorInstance(global)); return; } @@ -109,8 +109,8 @@ pub const FormData = struct { }; pub const External = extern struct { - name: jsc.ZigString, - value: jsc.ZigString, + name: jsc.RustString, + value: jsc.RustString, blob: ?*jsc.WebCore.Blob = null, }; }; @@ -118,7 +118,7 @@ pub const FormData = struct { pub fn toJS(globalThis: *jsc.JSGlobalObject, input: []const u8, encoding: Encoding) !jsc.JSValue { switch (encoding) { .URLEncoded => { - var str = jsc.ZigString.fromUTF8(strings.withoutUTF8BOM(input)); + var str = jsc.RustString.fromUTF8(strings.withoutUTF8BOM(input)); const result = jsc.DOMFormData.createFromURLQuery(globalThis, &str); // Check if an exception was thrown (e.g., string too long) if (result == .zero) { @@ -142,7 +142,7 @@ pub const FormData = struct { const input_value = args[0]; const boundary_value = args[1]; - var boundary_slice = jsc.ZigString.Slice.empty; + var boundary_slice = jsc.RustString.Slice.empty; defer boundary_slice.deinit(); var encoding = Encoding{ @@ -166,7 +166,7 @@ pub const FormData = struct { return globalThis.throwInvalidArguments("boundary must be a string or ArrayBufferView", .{}); } } - var input_slice = jsc.ZigString.Slice{}; + var input_slice = jsc.RustString.Slice{}; defer input_slice.deinit(); var input: []const u8 = ""; @@ -210,14 +210,14 @@ pub const FormData = struct { pub fn onEntry(wrap: *@This(), name: bun.Semver.String, field: Field, buf: []const u8) void { const value_str = field.value; - var key = jsc.ZigString.initUTF8(name.slice(buf)); + var key = jsc.RustString.initUTF8(name.slice(buf)); if (field.is_file) { const filename_str = field.filename.slice(buf); var blob = jsc.WebCore.Blob.create(value_str, bun.default_allocator, wrap.globalThis, false); defer blob.detach(); - var filename = jsc.ZigString.initUTF8(filename_str); + var filename = jsc.RustString.initUTF8(filename_str); const content_type: []const u8 = brk: { if (!field.content_type.isEmpty()) { break :brk field.content_type.slice(buf); @@ -252,7 +252,7 @@ pub const FormData = struct { wrap.form.appendBlob(wrap.globalThis, &key, &blob, &filename); } else { - var value = jsc.ZigString.initUTF8( + var value = jsc.RustString.initUTF8( // > Each part whose `Content-Disposition` header does not // > contain a `filename` parameter must be parsed into an // > entry whose value is the UTF-8 decoded without BOM diff --git a/src/runtime/webcore/ReadableStream.zig b/src/runtime/webcore/ReadableStream.zig index c084d9ebae1..152aa3b8ebe 100644 --- a/src/runtime/webcore/ReadableStream.zig +++ b/src/runtime/webcore/ReadableStream.zig @@ -294,11 +294,11 @@ pub fn fromJS(value: JSValue, globalThis: *JSGlobalObject) bun.JSError!?Readable }; } -extern fn ZigGlobalObject__createNativeReadableStream(*JSGlobalObject, nativePtr: JSValue) JSValue; +extern fn RustGlobalObject__createNativeReadableStream(*JSGlobalObject, nativePtr: JSValue) JSValue; pub fn fromNative(globalThis: *JSGlobalObject, native: jsc.JSValue) bun.JSError!jsc.JSValue { jsc.markBinding(@src()); - return bun.jsc.fromJSHostCall(globalThis, @src(), ZigGlobalObject__createNativeReadableStream, .{ globalThis, native }); + return bun.jsc.fromJSHostCall(globalThis, @src(), RustGlobalObject__createNativeReadableStream, .{ globalThis, native }); } pub fn fromOwnedSlice(globalThis: *JSGlobalObject, bytes: []u8, recommended_chunk_size: Blob.SizeType) bun.JSError!jsc.JSValue { diff --git a/src/runtime/webcore/Request.zig b/src/runtime/webcore/Request.zig index 4f5cfd4317f..a1c22eb7ff8 100644 --- a/src/runtime/webcore/Request.zig +++ b/src/runtime/webcore/Request.zig @@ -149,10 +149,10 @@ pub fn init2( pub fn getContentType( this: *Request, -) bun.JSError!?ZigString.Slice { +) bun.JSError!?RustString.Slice { if (this.request_context.getRequest()) |req| { if (req.header("content-type")) |value| { - return ZigString.Slice.fromUTF8NeverFree(value); + return RustString.Slice.fromUTF8NeverFree(value); } } @@ -164,14 +164,14 @@ pub fn getContentType( if (this.#body.value == .Blob) { if (this.#body.value.Blob.content_type.len > 0) - return ZigString.Slice.fromUTF8NeverFree(this.#body.value.Blob.content_type); + return RustString.Slice.fromUTF8NeverFree(this.#body.value.Blob.content_type); } return null; } pub fn getFormDataEncoding(this: *Request) bun.JSError!?*bun.FormData.AsyncFormData { - var content_type_slice: ZigString.Slice = (try this.getContentType()) orelse return null; + var content_type_slice: RustString.Slice = (try this.getContentType()) orelse return null; defer content_type_slice.deinit(); const encoding = bun.FormData.Encoding.get(content_type_slice.slice()) orelse return null; return bun.FormData.AsyncFormData.init(bun.default_allocator, encoding); @@ -353,14 +353,14 @@ pub fn getDestination( _: *Request, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init("").toJS(globalThis); + return RustString.init("").toJS(globalThis); } pub fn getIntegrity( _: *Request, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.Empty.toJS(globalThis); + return RustString.Empty.toJS(globalThis); } pub fn getSignal(this: *Request, globalThis: *jsc.JSGlobalObject) jsc.JSValue { @@ -429,17 +429,17 @@ pub fn getReferrer( ) jsc.JSValue { if (this.#headers) |headers_ref| { if (headers_ref.get("referrer", globalObject)) |referrer| { - return ZigString.init(referrer).toJS(globalObject); + return RustString.init(referrer).toJS(globalObject); } } - return ZigString.init("").toJS(globalObject); + return RustString.init("").toJS(globalObject); } pub fn getReferrerPolicy( _: *Request, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init("").toJS(globalThis); + return RustString.init("").toJS(globalThis); } pub fn getUrl(this: *Request, globalObject: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue { try this.ensureURL(); @@ -1084,12 +1084,12 @@ pub fn setTimeout( const string = []const u8; -const Environment = @import("../../bun_core/env.zig"); +const Environment = @import("../../bun_core/env.rust"); const std = @import("std"); -const FetchCacheMode = @import("../../http_types/FetchCacheMode.zig").FetchCacheMode; -const FetchRedirect = @import("../../http_types/FetchRedirect.zig").FetchRedirect; -const FetchRequestMode = @import("../../http_types/FetchRequestMode.zig").FetchRequestMode; -const Method = @import("../../http_types/Method.zig").Method; +const FetchCacheMode = @import("../../http_types/FetchCacheMode.rust").FetchCacheMode; +const FetchRedirect = @import("../../http_types/FetchRedirect.rust").FetchRedirect; +const FetchRequestMode = @import("../../http_types/FetchRequestMode.rust").FetchRequestMode; +const Method = @import("../../http_types/Method.rust").Method; const bun = @import("bun"); const Output = bun.Output; @@ -1102,7 +1102,7 @@ const MimeType = bun.http.MimeType; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const AbortSignal = jsc.WebCore.AbortSignal; const Response = jsc.WebCore.Response; diff --git a/src/runtime/webcore/Response.zig b/src/runtime/webcore/Response.zig index f3a32269b41..80d41413f04 100644 --- a/src/runtime/webcore/Response.zig +++ b/src/runtime/webcore/Response.zig @@ -70,7 +70,7 @@ pub inline fn setUrl(this: *Response, url: bun.String) void { this.#url.deref(); this.#url = url; } -pub inline fn getUTF8Url(this: *Response, allocator: std.mem.Allocator) ZigString.Slice { +pub inline fn getUTF8Url(this: *Response, allocator: std.mem.Allocator) RustString.Slice { return this.#url.toUTF8(allocator); } pub inline fn getUrl(this: *Response) bun.String { @@ -93,7 +93,7 @@ pub inline fn getMethod(this: *Response) Method { return this.#init.method; } pub fn getFormDataEncoding(this: *Response) bun.JSError!?*bun.FormData.AsyncFormData { - var content_type_slice: ZigString.Slice = (try this.getContentType()) orelse return null; + var content_type_slice: RustString.Slice = (try this.getContentType()) orelse return null; defer content_type_slice.deinit(); const encoding = bun.FormData.Encoding.get(content_type_slice.slice()) orelse return null; return bun.handleOom(bun.FormData.AsyncFormData.init(bun.default_allocator, encoding)); @@ -489,7 +489,7 @@ pub fn finalize( pub fn getContentType( this: *Response, -) bun.JSError!?ZigString.Slice { +) bun.JSError!?RustString.Slice { if (this.#init.headers) |headers| { if (headers.fastGet(.ContentType)) |value| { return value.toSlice(bun.default_allocator); @@ -498,7 +498,7 @@ pub fn getContentType( if (this.#body.value == .Blob) { if (this.#body.value.Blob.content_type.len > 0) - return ZigString.Slice.fromUTF8NeverFree(this.#body.value.Blob.content_type); + return RustString.Slice.fromUTF8NeverFree(this.#body.value.Blob.content_type); } return null; @@ -614,7 +614,7 @@ pub fn constructRedirectImpl( // https://github.com/remix-run/remix/blob/db2c31f64affb2095e4286b91306b96435967969/packages/remix-server-runtime/responses.ts#L4 var args = jsc.CallFrame.ArgumentsSlice.init(globalThis.bunVM(), args_list.ptr[0..args_list.len]); - var url_string_slice = ZigString.Slice.empty; + var url_string_slice = RustString.Slice.empty; defer url_string_slice.deinit(); var response: Response = brk: { var response = Response{ @@ -628,10 +628,10 @@ pub fn constructRedirectImpl( }; const url_string_value = args.nextEat() orelse jsc.JSValue.zero; - var url_string = ZigString.init(""); + var url_string = RustString.init(""); if (@intFromEnum(url_string_value) != 0) { - url_string = try url_string_value.getZigString(globalThis); + url_string = try url_string_value.getRustString(globalThis); } url_string_slice = url_string.toSlice(bun.default_allocator); var did_succeed = false; @@ -909,10 +909,10 @@ inline fn emptyWithStatus(_: *jsc.JSGlobalObject, status: u16) Response { } /// https://developer.mozilla.org/en-US/docs/Web/API/Headers -// TODO: move to http.zig. this has nothing to do with jsc or WebCore +// TODO: move to http.rust. this has nothing to do with jsc or WebCore const std = @import("std"); -const Method = @import("../../http_types/Method.zig").Method; +const Method = @import("../../http_types/Method.rust").Method; const bun = @import("bun"); const Output = bun.Output; @@ -926,7 +926,7 @@ const MimeType = bun.http.MimeType; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Request = jsc.WebCore.Request; const Blob = jsc.WebCore.Blob; diff --git a/src/runtime/webcore/ResumableSink.zig b/src/runtime/webcore/ResumableSink.zig index 3a2506af056..16112fcfc5f 100644 --- a/src/runtime/webcore/ResumableSink.zig +++ b/src/runtime/webcore/ResumableSink.zig @@ -369,8 +369,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.rust").FetchTasklet; +const S3UploadStreamWrapper = @import("./s3/client.rust").S3UploadStreamWrapper; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/webcore/S3Client.zig b/src/runtime/webcore/S3Client.zig index 941b8afec67..7efbc88c28b 100644 --- a/src/runtime/webcore/S3Client.zig +++ b/src/runtime/webcore/S3Client.zig @@ -321,7 +321,7 @@ pub const S3Client = struct { } }; -const S3File = @import("./S3File.zig"); +const S3File = @import("./S3File.rust"); const bun = @import("bun"); const S3Credentials = bun.S3.S3Credentials; diff --git a/src/runtime/webcore/S3File.zig b/src/runtime/webcore/S3File.zig index 41e900fb987..5e03ad8959b 100644 --- a/src/runtime/webcore/S3File.zig +++ b/src/runtime/webcore/S3File.zig @@ -650,8 +650,8 @@ pub fn createJSS3File(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFra return BUN__createJSS3File(globalObject, callframe); } -const S3Client = @import("./S3Client.zig"); -const S3Stat = @import("./S3Stat.zig").S3Stat; +const S3Client = @import("./S3Client.rust"); +const S3Stat = @import("./S3Stat.rust").S3Stat; const bun = @import("bun"); const Output = bun.Output; diff --git a/src/runtime/webcore/Sink.zig b/src/runtime/webcore/Sink.zig index 65fa84dbe24..983618ea599 100644 --- a/src/runtime/webcore/Sink.zig +++ b/src/runtime/webcore/Sink.zig @@ -5,7 +5,7 @@ vtable: VTable, status: Status = Status.closed, used: bool = false, -pub const ArrayBufferSink = @import("./ArrayBufferSink.zig"); +pub const ArrayBufferSink = @import("./ArrayBufferSink.rust"); pub const pending = Sink{ .ptr = @as(*anyopaque, @ptrFromInt(0xaaaaaaaa)), diff --git a/src/runtime/webcore/TextDecoder.zig b/src/runtime/webcore/TextDecoder.zig index 11c8bbd5164..6b0bf870f9b 100644 --- a/src/runtime/webcore/TextDecoder.zig +++ b/src/runtime/webcore/TextDecoder.zig @@ -47,7 +47,7 @@ pub fn getEncoding( this: *TextDecoder, globalThis: *jsc.JSGlobalObject, ) jsc.JSValue { - return ZigString.init(EncodingLabel.getLabel(this.encoding)).toJS(globalThis); + return RustString.init(EncodingLabel.getLabel(this.encoding)).toJS(globalThis); } const Vector16 = std.meta.Vector(16, u16); const max_16_ascii: Vector16 = @splat(@as(u16, 127)); @@ -195,12 +195,12 @@ 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("../../jsc/TextCodec.zig").TextCodec; + const TextCodec = @import("../../jsc/TextCodec.rust").TextCodec; switch (this.encoding) { EncodingLabel.latin1 => { if (strings.isAllASCII(buffer_slice)) { - return ZigString.init(buffer_slice).toJS(globalThis); + return RustString.init(buffer_slice).toJS(globalThis); } // It's unintuitive that we encode Latin1 as UTF16 even though the engine natively supports Latin1 strings... @@ -211,7 +211,7 @@ fn decodeSlice(this: *TextDecoder, globalThis: *jsc.JSGlobalObject, buffer_slice const bytes = try bun.default_allocator.alloc(u16, out_length); const out = strings.copyCP1252IntoUTF16(bytes, buffer_slice); - return ZigString.toExternalU16(bytes.ptr, out.written, globalThis); + return RustString.toExternalU16(bytes.ptr, out.written, globalThis); }, EncodingLabel.@"UTF-8" => { const input, const deinit = input: { @@ -255,13 +255,13 @@ fn decodeSlice(this: *TextDecoder, globalThis: *jsc.JSGlobalObject, buffer_slice this.buffered.len = leftover_len; } } - return ZigString.toExternalU16(decoded.ptr, decoded.len, globalThis); + return RustString.toExternalU16(decoded.ptr, decoded.len, globalThis); } bun.debugAssert(input.len == 0 or !deinit); // Experiment: using mimalloc directly is slightly slower - return ZigString.init(input).toJS(globalThis); + return RustString.init(input).toJS(globalThis); }, inline .@"UTF-16LE", .@"UTF-16BE" => |utf16_encoding| { @@ -280,12 +280,12 @@ fn decodeSlice(this: *TextDecoder, globalThis: *jsc.JSGlobalObject, buffer_slice if (decoded.items.len == 0) { decoded.deinit(bun.default_allocator); - return ZigString.Empty.toJS(globalThis); + return RustString.Empty.toJS(globalThis); } // Transfer ownership of the backing allocation to JSC; freed via // free_global_string -> mi_free when the string is collected. - return ZigString.toExternalU16(decoded.items.ptr, decoded.items.len, globalThis); + return RustString.toExternalU16(decoded.items.ptr, decoded.items.len, globalThis); }, // Handle all other encodings using WebKit's TextCodec @@ -296,7 +296,7 @@ fn decodeSlice(this: *TextDecoder, globalThis: *jsc.JSGlobalObject, buffer_slice // Note: In production, we might want to cache these per-encoding const codec = TextCodec.create(encoding_name) orelse { // Fallback to empty string if codec creation fails - return ZigString.init("").toJS(globalThis); + return RustString.init("").toJS(globalThis); }; defer codec.deinit(); @@ -372,5 +372,5 @@ const ArrayBuffer = jsc.ArrayBuffer; const JSGlobalObject = jsc.JSGlobalObject; const JSUint8Array = jsc.JSUint8Array; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const EncodingLabel = jsc.WebCore.EncodingLabel; diff --git a/src/runtime/webcore/TextEncoderStreamEncoder.zig b/src/runtime/webcore/TextEncoderStreamEncoder.zig index 3f4378570e1..8931d240d4e 100644 --- a/src/runtime/webcore/TextEncoderStreamEncoder.zig +++ b/src/runtime/webcore/TextEncoderStreamEncoder.zig @@ -25,7 +25,7 @@ pub fn encode(this: *TextEncoderStreamEncoder, globalObject: *jsc.JSGlobalObject return globalObject.throwNotEnoughArguments("TextEncoderStreamEncoder.encode", 1, arguments.len); } - const str = try arguments[0].getZigString(globalObject); + const str = try arguments[0].getRustString(globalObject); if (str.is16Bit()) { return this.encodeUTF16(globalObject, str.utf16SliceAligned()); @@ -35,7 +35,7 @@ pub fn encode(this: *TextEncoderStreamEncoder, globalObject: *jsc.JSGlobalObject } pub fn encodeWithoutTypeChecks(this: *TextEncoderStreamEncoder, globalObject: *jsc.JSGlobalObject, input: *jsc.JSString) JSValue { - const str = input.getZigString(globalObject); + const str = input.getRustString(globalObject); if (str.is16Bit()) { return this.encodeUTF16(globalObject, str.utf16SliceAligned()); diff --git a/src/runtime/webcore/blob/Store.zig b/src/runtime/webcore/blob/Store.zig index c6b636e94c7..a8c5eb42c45 100644 --- a/src/runtime/webcore/blob/Store.zig +++ b/src/runtime/webcore/blob/Store.zig @@ -263,7 +263,7 @@ pub const File = struct { .path = .{ .encoded_slice = switch (path_like) { .encoded_slice => |slice| try slice.toOwned(bun.default_allocator), - else => try jsc.ZigString.fromUTF8(path_like.slice()).toSliceClone(bun.default_allocator), + else => try jsc.RustString.fromUTF8(path_like.slice()).toSliceClone(bun.default_allocator), }, }, }, globalThis.bunVM()), diff --git a/src/runtime/webcore/blob/copy_file.zig b/src/runtime/webcore/blob/copy_file.zig index 87e06b263fe..4bfacad39e7 100644 --- a/src/runtime/webcore/blob/copy_file.zig +++ b/src/runtime/webcore/blob/copy_file.zig @@ -163,12 +163,12 @@ pub const CopyFile = struct { .result => |result_fd| result_fd, .err => |errno| { this.system_error = errno.toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, }, .err => |errno| { this.system_error = errno.toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, }; } @@ -186,7 +186,7 @@ pub const CopyFile = struct { .result => |result_fd| result_fd, .err => |errno| { this.system_error = errno.toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, }, .err => |errno| { @@ -197,7 +197,7 @@ pub const CopyFile = struct { this.source_fd.close(); this.source_fd = .invalid; } - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, .no => {}, } @@ -208,7 +208,7 @@ pub const CopyFile = struct { } this.system_error = errno.withPath(this.destination_file_store.pathlike.path.slice()).toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, }; break; @@ -259,7 +259,7 @@ pub const CopyFile = struct { switch (jsc.Node.fs.NodeFS.copyFileUsingReadWriteLoop("", "", src_fd, dest_fd, if (unknown_size) 0 else remain, &total_written)) { .err => |err| { this.system_error = err.toSystemError(); - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => { _ = linux.ftruncate(dest_fd.cast(), @as(std.posix.off_t, @intCast(total_written))); @@ -287,7 +287,7 @@ pub const CopyFile = struct { switch (jsc.Node.fs.NodeFS.copyFileUsingReadWriteLoop("", "", src_fd, dest_fd, if (unknown_size) 0 else remain, &total_written)) { .err => |err| { this.system_error = err.toSystemError(); - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => { _ = linux.ftruncate(dest_fd.cast(), @as(std.posix.off_t, @intCast(total_written))); @@ -322,7 +322,7 @@ pub const CopyFile = struct { switch (jsc.Node.fs.NodeFS.copyFileUsingReadWriteLoop("", "", src_fd, dest_fd, if (unknown_size) 0 else remain, &total_written)) { .err => |err| { this.system_error = err.toSystemError(); - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => { _ = linux.ftruncate(dest_fd.cast(), @as(std.posix.off_t, @intCast(total_written))); @@ -335,14 +335,14 @@ pub const CopyFile = struct { .errno = @as(bun.sys.Error.Int, @intCast(@intFromEnum(linux.E.INVAL))), .syscall = TryWith.tag.get(use).?, }).toSystemError(); - return bun.errnoToZigErr(linux.E.INVAL); + return bun.errnoToRustErr(linux.E.INVAL); }, else => |errno| { this.system_error = (bun.sys.Error{ .errno = @as(bun.sys.Error.Int, @intCast(@intFromEnum(errno))), .syscall = TryWith.tag.get(use).?, }).toSystemError(); - return bun.errnoToZigErr(errno); + return bun.errnoToRustErr(errno); }, } @@ -369,7 +369,7 @@ pub const CopyFile = struct { switch (jsc.Node.fs.NodeFS.copyFileUsingReadWriteLoop("", "", this.source_fd, this.destination_fd, 0, &total_written)) { .err => |err| { this.system_error = err.toSystemError(); - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => {}, } @@ -377,7 +377,7 @@ pub const CopyFile = struct { else => { this.system_error = errno.toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, } }, @@ -404,7 +404,7 @@ pub const CopyFile = struct { .no => {}, } this.system_error = errno.toSystemError(); - return bun.errnoToZigErr(errno.errno); + return bun.errnoToRustErr(errno.errno); }, .result => {}, } diff --git a/src/runtime/webcore/blob/read_file.zig b/src/runtime/webcore/blob/read_file.zig index 4e1fffabde0..1508ef0eaf0 100644 --- a/src/runtime/webcore/blob/read_file.zig +++ b/src/runtime/webcore/blob/read_file.zig @@ -146,7 +146,7 @@ pub const ReadFile = struct { pub fn onIOError(this: *ReadFile, err: bun.sys.Error) void { bloblog("ReadFile.onIOError", .{}); - this.errno = bun.errnoToZigErr(err.errno); + this.errno = bun.errnoToRustErr(err.errno); this.system_error = err.toSystemError(); this.task = .{ .callback = &doReadLoopTask }; // On macOS, we use one-shot mode, so: @@ -216,7 +216,7 @@ pub const ReadFile = struct { return true; }, else => { - this.errno = bun.errnoToZigErr(err.errno); + this.errno = bun.errnoToRustErr(err.errno); this.system_error = err.toSystemError(); if (this.system_error.?.path.isEmpty()) { this.system_error.?.path = if (this.file_store.pathlike == .path) @@ -316,7 +316,7 @@ pub const ReadFile = struct { const stat: bun.Stat = switch (bun.sys.fstat(fd)) { .result => |result| result, .err => |err| { - this.errno = bun.errnoToZigErr(err.errno); + this.errno = bun.errnoToRustErr(err.errno); this.system_error = err.toSystemError(); return; }, @@ -619,7 +619,7 @@ pub const ReadFileUV = struct { this.req.data = this; if (libuv.uv_fs_fstat(this.loop, &this.req, opened_fd.uv(), &onFileInitialStat).errEnum()) |errno| { - this.errno = bun.errnoToZigErr(errno); + this.errno = bun.errnoToRustErr(errno); this.system_error = bun.sys.Error.fromCode(errno, .fstat).toSystemError(); this.onFinish(); return; @@ -633,7 +633,7 @@ pub const ReadFileUV = struct { var this: *ReadFileUV = @ptrCast(@alignCast(req.data)); if (req.result.errEnum()) |errno| { - this.errno = bun.errnoToZigErr(errno); + this.errno = bun.errnoToRustErr(errno); this.system_error = bun.sys.Error.fromCode(errno, .fstat).toSystemError(); this.onFinish(); return; @@ -690,7 +690,7 @@ pub const ReadFileUV = struct { } // Out of memory we can't read more than 4GB at a time (ULONG) on Windows if (this.size > @as(usize, std.math.maxInt(bun.windows.ULONG))) { - this.errno = bun.errnoToZigErr(bun.sys.E.NOMEM); + this.errno = bun.errnoToRustErr(bun.sys.E.NOMEM); this.system_error = bun.sys.Error.fromCode(bun.sys.E.NOMEM, .read).toSystemError(); this.onFinish(); return; @@ -749,7 +749,7 @@ pub const ReadFileUV = struct { ); this.req.data = this; if (res.errEnum()) |errno| { - this.errno = bun.errnoToZigErr(errno); + this.errno = bun.errnoToRustErr(errno); this.system_error = bun.sys.Error.fromCode(errno, .read).toSystemError(); this.onFinish(); } @@ -776,7 +776,7 @@ pub const ReadFileUV = struct { const result = req.result; if (result.errEnum()) |errno| { - this.errno = bun.errnoToZigErr(errno); + this.errno = bun.errnoToRustErr(errno); this.system_error = bun.sys.Error.fromCode(errno, .read).toSystemError(); this.onFinish(); return; diff --git a/src/runtime/webcore/blob/write_file.zig b/src/runtime/webcore/blob/write_file.zig index 9288cc6c215..08f7294845f 100644 --- a/src/runtime/webcore/blob/write_file.zig +++ b/src/runtime/webcore/blob/write_file.zig @@ -43,7 +43,7 @@ pub const WriteFile = struct { pub fn onIOError(this: *WriteFile, err: bun.sys.Error) void { bloblog("WriteFile.onIOError()", .{}); - this.errno = bun.errnoToZigErr(err.errno); + this.errno = bun.errnoToRustErr(err.errno); this.system_error = err.toSystemError(); this.task = .{ .callback = &doWriteLoopTask }; jsc.WorkPool.schedule(&this.task); @@ -148,7 +148,7 @@ pub const WriteFile = struct { return false; }, else => { - this.errno = bun.errnoToZigErr(err.getErrno()); + this.errno = bun.errnoToRustErr(err.getErrno()); this.system_error = err.toSystemError(); return false; }, @@ -693,7 +693,7 @@ pub const WriteFileWaitFromLockedValueTask = struct { _ = value.use(); this.promise.deinit(); bun.destroy(this); - try promise.reject(globalThis, ZigString.init("Body was used after it was consumed").toErrorInstance(globalThis)); + try promise.reject(globalThis, RustString.init("Body was used after it was consumed").toErrorInstance(globalThis)); }, .WTFStringImpl, .InternalBlob, @@ -747,7 +747,7 @@ const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const SystemError = jsc.SystemError; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Body = jsc.WebCore.Body; const Blob = jsc.WebCore.Blob; diff --git a/src/runtime/webcore/fetch.zig b/src/runtime/webcore/fetch.zig index b13d2b43f65..05a16c3d0c1 100644 --- a/src/runtime/webcore/fetch.zig +++ b/src/runtime/webcore/fetch.zig @@ -64,7 +64,7 @@ pub const fetch_type_error_strings: JSTypeErrorEnum = brk: { break :brk errors; }; -pub const FetchTasklet = @import("./fetch/FetchTasklet.zig").FetchTasklet; +pub const FetchTasklet = @import("./fetch/FetchTasklet.rust").FetchTasklet; fn dataURLResponse( _data_url: DataURL, @@ -130,7 +130,7 @@ pub fn Bun__fetchPreconnect_( return globalObject.ERR(.INVALID_ARG_TYPE, fetch_error_blank_url, .{}).throw(); } - const url = ZigURL.parse(bun.handleOom(url_str.toOwnedSlice(bun.default_allocator))); + const url = RustURL.parse(bun.handleOom(url_str.toOwnedSlice(bun.default_allocator))); if (!url.isHTTP() and !url.isHTTPS() and !url.isS3()) { bun.default_allocator.free(url.href); return globalObject.throwInvalidArguments("URL must be HTTP or HTTPS", .{}); @@ -213,7 +213,7 @@ fn fetchImpl( var args = jsc.CallFrame.ArgumentsSlice.init(vm, arguments.slice()); - var url = ZigURL{}; + var url = RustURL{}; var first_arg = args.nextEat().?; // We must always get the Body before the Headers That way, we can set @@ -233,13 +233,13 @@ fn fetchImpl( verbose = vm.getVerboseFetch(); } - var proxy: ?ZigURL = null; + var proxy: ?RustURL = null; var redirect_type: FetchRedirect = FetchRedirect.follow; var signal: ?*jsc.WebCore.AbortSignal = null; // Custom Hostname var hostname: ?[]u8 = null; var range: ?[]u8 = null; - var unix_socket_path: ZigString.Slice = ZigString.Slice.empty; + var unix_socket_path: RustString.Slice = RustString.Slice.empty; var url_proxy_buffer: []const u8 = ""; const URLType = enum { @@ -365,7 +365,7 @@ fn fetchImpl( return dataURLResponse(data_url, globalThis, allocator); } - url = ZigURL.fromString(allocator, url_str) catch { + url = RustURL.fromString(allocator, url_str) catch { const err = ctx.toTypeError(.INVALID_URL, "fetch() URL is invalid", .{}); is_error = true; return JSPromise.dangerouslyCreateRejectedPromiseValueWithoutNotifyingVM( @@ -655,7 +655,7 @@ fn fetchImpl( if (objects_to_try[i] != .zero) { if (try objects_to_try[i].get(globalThis, "verbose")) |verb| { if (verb.isString()) { - if ((try verb.getZigString(globalThis)).eqlComptime("curl")) { + if ((try verb.getRustString(globalThis)).eqlComptime("curl")) { break :extract_verbose .curl; } } else if (verb.isBoolean()) { @@ -695,14 +695,14 @@ fn fetchImpl( } defer href.deref(); const buffer = try std.fmt.allocPrint(allocator, "{s}{f}", .{ url_proxy_buffer, href }); - url = ZigURL.parse(buffer[0..url.href.len]); + url = RustURL.parse(buffer[0..url.href.len]); if (url.isFile()) { url_type = URLType.file; } else if (url.isBlob()) { url_type = URLType.blob; } - proxy = ZigURL.parse(buffer[url.href.len..]); + proxy = RustURL.parse(buffer[url.href.len..]); allocator.free(url_proxy_buffer); break :extract_proxy buffer; } @@ -722,14 +722,14 @@ fn fetchImpl( } defer href.deref(); const buffer = try std.fmt.allocPrint(allocator, "{s}{f}", .{ url_proxy_buffer, href }); - url = ZigURL.parse(buffer[0..url.href.len]); + url = RustURL.parse(buffer[0..url.href.len]); if (url.isFile()) { url_type = URLType.file; } else if (url.isBlob()) { url_type = URLType.blob; } - proxy = ZigURL.parse(buffer[url.href.len..]); + proxy = RustURL.parse(buffer[url.href.len..]); allocator.free(url_proxy_buffer); url_proxy_buffer = buffer; @@ -1005,7 +1005,7 @@ fn fetchImpl( if (url_type != .remote) { defer unix_socket_path.deinit(); var path_buf: bun.PathBuffer = undefined; - const PercentEncoding = @import("../../url/url.zig").PercentEncoding; + const PercentEncoding = @import("../../url/url.rust").PercentEncoding; var path_buf2: bun.PathBuffer = undefined; var stream = std.io.fixedBufferStream(&path_buf2); var url_path_decoded = path_buf2[0 .. PercentEncoding.decode( @@ -1080,7 +1080,7 @@ fn fetchImpl( var pathlike: jsc.Node.PathOrFileDescriptor = .{ .path = .{ - .encoded_slice = ZigString.Slice.init(bun.default_allocator, try bun.default_allocator.dupe(u8, temp_file_path)), + .encoded_slice = RustString.Slice.init(bun.default_allocator, try bun.default_allocator.dupe(u8, temp_file_path)), }, }; @@ -1265,7 +1265,7 @@ fn fetchImpl( defer body.ReadableStream.deinit(); const Wrapper = struct { promise: jsc.JSPromise.Strong, - url: ZigURL, + url: RustURL, url_proxy_buffer: []const u8, global: *jsc.JSGlobalObject, @@ -1373,13 +1373,13 @@ fn fetchImpl( bun.copy(u8, buffer[proxy_.href.len..], proxy_.href); url_proxy_buffer = buffer; - url = ZigURL.parse(url_proxy_buffer[0..result.url.len]); - proxy = ZigURL.parse(url_proxy_buffer[result.url.len..]); + url = RustURL.parse(url_proxy_buffer[0..result.url.len]); + proxy = RustURL.parse(url_proxy_buffer[result.url.len..]); } else { // replace headers and url of the request allocator.free(url_proxy_buffer); url_proxy_buffer = result.url; - url = ZigURL.parse(result.url); + url = RustURL.parse(result.url); result.url = ""; // fetch now owns this } @@ -1477,7 +1477,7 @@ fn fetchImpl( signal = null; ssl_config = null; hostname = null; - unix_socket_path = ZigString.Slice.empty; + unix_socket_path = RustString.Slice.empty; return promise_val; } @@ -1493,9 +1493,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_types/Method.zig").Method; -const ZigURL = @import("../../url/url.zig").URL; +const DataURL = @import("../../resolver/data_url.rust").DataURL; +const Method = @import("../../http_types/Method.rust").Method; +const RustURL = @import("../../url/url.rust").URL; const bun = @import("bun"); const Environment = bun.Environment; @@ -1515,7 +1515,7 @@ const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const JSType = jsc.C.JSType; const Body = jsc.WebCore.Body; diff --git a/src/runtime/webcore/fetch/FetchTasklet.zig b/src/runtime/webcore/fetch/FetchTasklet.zig index dcb53ab49e8..4b9c43370de 100644 --- a/src/runtime/webcore/fetch/FetchTasklet.zig +++ b/src/runtime/webcore/fetch/FetchTasklet.zig @@ -1132,7 +1132,7 @@ pub const FetchTasklet = struct { } var url = fetch_options.url; - var proxy: ?ZigURL = null; + var proxy: ?RustURL = null; if (fetch_options.proxy) |proxy_opt| { if (!proxy_opt.isEmpty()) { //if is empty just ignore proxy // Check NO_PROXY even for explicitly-provided proxies @@ -1147,7 +1147,7 @@ pub const FetchTasklet = struct { // env_proxy.href may be a slice into a RefCountedEnvValue's bytes which can // be freed by a subsequent `process.env.HTTP_PROXY = "..."` assignment while // this fetch is in flight on the HTTP thread. Clone it into url_proxy_buffer - // alongside the request URL — the same pattern fetch.zig uses for the explicit + // alongside the request URL — the same pattern fetch.rust uses for the explicit // `fetch(url, { proxy: "..." })` option. if (env_proxy.href.len > 0) { const old_url_len = url.href.len; @@ -1156,8 +1156,8 @@ pub const FetchTasklet = struct { bun.default_allocator.free(fetch_tasklet.url_proxy_buffer); } fetch_tasklet.url_proxy_buffer = new_buffer; - url = ZigURL.parse(new_buffer[0..old_url_len]); - proxy = ZigURL.parse(new_buffer[old_url_len..]); + url = RustURL.parse(new_buffer[0..old_url_len]); + proxy = RustURL.parse(new_buffer[old_url_len..]); } else { proxy = env_proxy; } @@ -1379,10 +1379,10 @@ pub const FetchTasklet = struct { disable_keepalive: bool, disable_decompression: bool, reject_unauthorized: bool, - url: ZigURL, + url: RustURL, verbose: http.HTTPVerboseLevel = .none, redirect_type: FetchRedirect = FetchRedirect.follow, - proxy: ?ZigURL = null, + proxy: ?RustURL = null, proxy_headers: ?Headers = null, url_proxy_buffer: []const u8 = "", signal: ?*jsc.WebCore.AbortSignal = null, @@ -1390,7 +1390,7 @@ pub const FetchTasklet = struct { // Custom Hostname hostname: ?[]u8 = null, check_server_identity: jsc.Strong.Optional = .empty, - unix_socket_path: ZigString.Slice, + unix_socket_path: RustString.Slice, ssl_config: ?SSLConfig.SharedPtr = null, upgraded_connection: bool = false, force_http2: bool = false, @@ -1505,10 +1505,10 @@ pub const FetchTasklet = struct { } }; -const X509 = @import("../../api/bun/x509.zig"); +const X509 = @import("../../api/bun/x509.rust"); const std = @import("std"); -const Method = @import("../../../http_types/Method.zig").Method; -const ZigURL = @import("../../../url/url.zig").URL; +const Method = @import("../../../http_types/Method.rust").Method; +const RustURL = @import("../../../url/url.rust").URL; const bun = @import("bun"); const Async = bun.Async; @@ -1528,7 +1528,7 @@ const JSGlobalObject = jsc.JSGlobalObject; const JSPromise = jsc.JSPromise; const JSValue = jsc.JSValue; const VirtualMachine = jsc.VirtualMachine; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; const Body = jsc.WebCore.Body; const Response = jsc.WebCore.Response; diff --git a/src/runtime/webcore/prompt.zig b/src/runtime/webcore/prompt.zig index 747cd935fd6..7cd997e39bd 100644 --- a/src/runtime/webcore/prompt.zig +++ b/src/runtime/webcore/prompt.zig @@ -333,7 +333,7 @@ pub const prompt = struct { // 8. Let result be null if the user aborts, or otherwise the string // that the user responded with. - var result = jsc.ZigString.init(input.items); + var result = jsc.RustString.init(input.items); result.markUTF8(); // 9. Invoke WebDriver BiDi user prompt closed with this, false if diff --git a/src/runtime/webcore/s3/client.zig b/src/runtime/webcore/s3/client.zig index 7ac0cf651d0..a3294e29800 100644 --- a/src/runtime/webcore/s3/client.zig +++ b/src/runtime/webcore/s3/client.zig @@ -1,10 +1,10 @@ -pub const ACL = @import("../../../s3_signing/acl.zig").ACL; -pub const S3HttpDownloadStreamingTask = @import("./download_stream.zig").S3HttpDownloadStreamingTask; -pub const MultiPartUploadOptions = @import("./multipart_options.zig").MultiPartUploadOptions; -pub const MultiPartUpload = @import("./multipart.zig").MultiPartUpload; -pub const StorageClass = @import("../../../s3_signing/storage_class.zig").StorageClass; +pub const ACL = @import("../../../s3_signing/acl.rust").ACL; +pub const S3HttpDownloadStreamingTask = @import("./download_stream.rust").S3HttpDownloadStreamingTask; +pub const MultiPartUploadOptions = @import("./multipart_options.rust").MultiPartUploadOptions; +pub const MultiPartUpload = @import("./multipart.rust").MultiPartUpload; +pub const StorageClass = @import("../../../s3_signing/storage_class.rust").StorageClass; -pub const Error = @import("../../../s3_signing/error.zig"); +pub const Error = @import("../../../s3_signing/error.rust"); pub const throwSignError = Error.throwSignError; pub const getJSSignError = Error.getJSSignError; @@ -17,7 +17,7 @@ pub const S3StatResult = S3SimpleRequest.S3StatResult; pub const S3DownloadResult = S3SimpleRequest.S3DownloadResult; pub const S3DeleteResult = S3SimpleRequest.S3DeleteResult; pub const S3ListObjectsResult = S3SimpleRequest.S3ListObjectsResult; -pub const S3ListObjectsOptions = @import("./list_objects.zig").S3ListObjectsOptions; +pub const S3ListObjectsOptions = @import("./list_objects.rust").S3ListObjectsOptions; pub const getListObjectsOptionsFromJS = S3ListObjects.getListObjectsOptionsFromJS; pub fn stat( @@ -350,7 +350,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("../ResumableSink.zig").ResumableS3UploadSink; + pub const ResumableSink = @import("../ResumableSink.rust").ResumableS3UploadSink; const log = bun.Output.scoped(.S3UploadStream, .visible); ref_count: RefCount, @@ -734,9 +734,9 @@ pub fn readableStream( return readable_value; } -const Credentials = @import("../../../s3_signing/credentials.zig"); -const S3ListObjects = @import("./list_objects.zig"); -const S3SimpleRequest = @import("./simple_request.zig"); +const Credentials = @import("../../../s3_signing/credentials.rust"); +const S3ListObjects = @import("./list_objects.rust"); +const S3SimpleRequest = @import("./simple_request.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/runtime/webcore/s3/credentials_jsc.zig b/src/runtime/webcore/s3/credentials_jsc.zig index 37f5da533fa..da652709711 100644 --- a/src/runtime/webcore/s3/credentials_jsc.zig +++ b/src/runtime/webcore/s3/credentials_jsc.zig @@ -251,7 +251,7 @@ fn containsNewlineOrCR(value: []const u8) bool { } const std = @import("std"); -const MultiPartUploadOptions = @import("./multipart_options.zig").MultiPartUploadOptions; +const MultiPartUploadOptions = @import("./multipart_options.rust").MultiPartUploadOptions; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/webcore/s3/download_stream.zig b/src/runtime/webcore/s3/download_stream.zig index 1083d0780ca..e0999aceeb4 100644 --- a/src/runtime/webcore/s3/download_stream.zig +++ b/src/runtime/webcore/s3/download_stream.zig @@ -195,7 +195,7 @@ pub const S3HttpDownloadStreamingTask = struct { // remember the state is atomic load it once, and store it again var state = this.getState(); - // old state should have more otherwise its a http.zig bug + // old state should have more otherwise its a http.rust bug bun.assert(state.has_more); const is_done = !result.has_more; const wait_until_done = updateState(this, async_http, result, &state); @@ -224,7 +224,7 @@ pub const S3HttpDownloadStreamingTask = struct { } return false; } - /// this is the callback from the http.zig AsyncHTTP is always called from the HTTPThread + /// this is the callback from the http.rust AsyncHTTP is always called from the HTTPThread pub fn httpCallback(this: *@This(), async_http: *bun.http.AsyncHTTP, result: bun.http.HTTPClientResult) void { if (processHttpCallback(this, async_http, result)) { // we are always unlocked here and its safe to enqueue @@ -234,9 +234,9 @@ pub const S3HttpDownloadStreamingTask = struct { }; const std = @import("std"); -const S3Error = @import("../../../s3_signing/error.zig").S3Error; +const S3Error = @import("../../../s3_signing/error.rust").S3Error; -const S3Credentials = @import("../../../s3_signing/credentials.zig").S3Credentials; +const S3Credentials = @import("../../../s3_signing/credentials.rust").S3Credentials; const SignResult = S3Credentials.SignResult; const bun = @import("bun"); diff --git a/src/runtime/webcore/s3/error_jsc.zig b/src/runtime/webcore/s3/error_jsc.zig index 852d6840894..04dc4939ccc 100644 --- a/src/runtime/webcore/s3/error_jsc.zig +++ b/src/runtime/webcore/s3/error_jsc.zig @@ -1,4 +1,4 @@ -//! JSC bridges for `s3_signing/error.zig`. The pure error-code/message tables +//! JSC bridges for `s3_signing/error.rust`. The pure error-code/message tables //! stay in `s3_signing/`; the `*JSGlobalObject`-taking variants live here. pub const S3Error = s3_error.S3Error; @@ -67,7 +67,7 @@ pub fn s3ErrorToJSWithAsyncStack(err: *const S3Error, globalObject: *jsc.JSGloba return value; } -const s3_error = @import("../../../s3_signing/error.zig"); +const s3_error = @import("../../../s3_signing/error.rust"); const getSignErrorMessage = s3_error.getSignErrorMessage; const bun = @import("bun"); diff --git a/src/runtime/webcore/s3/list_objects.zig b/src/runtime/webcore/s3/list_objects.zig index 7d17be42524..e1cd79d01fc 100644 --- a/src/runtime/webcore/s3/list_objects.zig +++ b/src/runtime/webcore/s3/list_objects.zig @@ -7,11 +7,11 @@ pub const S3ListObjectsOptions = struct { prefix: ?[]const u8, start_after: ?[]const u8, - _continuation_token: ?jsc.ZigString.Slice, - _delimiter: ?jsc.ZigString.Slice, - _encoding_type: ?jsc.ZigString.Slice, - _prefix: ?jsc.ZigString.Slice, - _start_after: ?jsc.ZigString.Slice, + _continuation_token: ?jsc.RustString.Slice, + _delimiter: ?jsc.RustString.Slice, + _encoding_type: ?jsc.RustString.Slice, + _prefix: ?jsc.RustString.Slice, + _start_after: ?jsc.RustString.Slice, pub fn deinit(this: *@This()) void { if (this._continuation_token) |slice| slice.deinit(); @@ -76,42 +76,42 @@ pub const S3ListObjectsV2Result = struct { const jsResult = JSValue.createEmptyObject(globalObject, 0); if (this.name) |name| { - jsResult.put(globalObject, jsc.ZigString.static("name"), try bun.String.createUTF8ForJS(globalObject, name)); + jsResult.put(globalObject, jsc.RustString.static("name"), try bun.String.createUTF8ForJS(globalObject, name)); } if (this.prefix) |prefix| { - jsResult.put(globalObject, jsc.ZigString.static("prefix"), try bun.String.createUTF8ForJS(globalObject, prefix)); + jsResult.put(globalObject, jsc.RustString.static("prefix"), try bun.String.createUTF8ForJS(globalObject, prefix)); } if (this.delimiter) |delimiter| { - jsResult.put(globalObject, jsc.ZigString.static("delimiter"), try bun.String.createUTF8ForJS(globalObject, delimiter)); + jsResult.put(globalObject, jsc.RustString.static("delimiter"), try bun.String.createUTF8ForJS(globalObject, delimiter)); } if (this.start_after) |start_after| { - jsResult.put(globalObject, jsc.ZigString.static("startAfter"), try bun.String.createUTF8ForJS(globalObject, start_after)); + jsResult.put(globalObject, jsc.RustString.static("startAfter"), try bun.String.createUTF8ForJS(globalObject, start_after)); } if (this.encoding_type) |encoding_type| { - jsResult.put(globalObject, jsc.ZigString.static("encodingType"), try bun.String.createUTF8ForJS(globalObject, encoding_type)); + jsResult.put(globalObject, jsc.RustString.static("encodingType"), try bun.String.createUTF8ForJS(globalObject, encoding_type)); } if (this.continuation_token) |continuation_token| { - jsResult.put(globalObject, jsc.ZigString.static("continuationToken"), try bun.String.createUTF8ForJS(globalObject, continuation_token)); + jsResult.put(globalObject, jsc.RustString.static("continuationToken"), try bun.String.createUTF8ForJS(globalObject, continuation_token)); } if (this.next_continuation_token) |next_continuation_token| { - jsResult.put(globalObject, jsc.ZigString.static("nextContinuationToken"), try bun.String.createUTF8ForJS(globalObject, next_continuation_token)); + jsResult.put(globalObject, jsc.RustString.static("nextContinuationToken"), try bun.String.createUTF8ForJS(globalObject, next_continuation_token)); } if (this.is_truncated) |is_truncated| { - jsResult.put(globalObject, jsc.ZigString.static("isTruncated"), JSValue.jsBoolean(is_truncated)); + jsResult.put(globalObject, jsc.RustString.static("isTruncated"), JSValue.jsBoolean(is_truncated)); } if (this.key_count) |key_count| { - jsResult.put(globalObject, jsc.ZigString.static("keyCount"), JSValue.jsNumber(key_count)); + jsResult.put(globalObject, jsc.RustString.static("keyCount"), JSValue.jsNumber(key_count)); } if (this.max_keys) |max_keys| { - jsResult.put(globalObject, jsc.ZigString.static("maxKeys"), JSValue.jsNumber(max_keys)); + jsResult.put(globalObject, jsc.RustString.static("maxKeys"), JSValue.jsNumber(max_keys)); } if (this.contents) |contents| { @@ -119,49 +119,49 @@ pub const S3ListObjectsV2Result = struct { for (contents.items, 0..) |item, i| { const objectInfo = JSValue.createEmptyObject(globalObject, 0); - objectInfo.put(globalObject, jsc.ZigString.static("key"), try bun.String.createUTF8ForJS(globalObject, item.key)); + objectInfo.put(globalObject, jsc.RustString.static("key"), try bun.String.createUTF8ForJS(globalObject, item.key)); if (item.etag) |etag| { - objectInfo.put(globalObject, jsc.ZigString.static("eTag"), try bun.String.createUTF8ForJS(globalObject, etag.get())); + objectInfo.put(globalObject, jsc.RustString.static("eTag"), try bun.String.createUTF8ForJS(globalObject, etag.get())); } if (item.checksum_algorithme) |checksum_algorithme| { - objectInfo.put(globalObject, jsc.ZigString.static("checksumAlgorithme"), try bun.String.createUTF8ForJS(globalObject, checksum_algorithme)); + objectInfo.put(globalObject, jsc.RustString.static("checksumAlgorithme"), try bun.String.createUTF8ForJS(globalObject, checksum_algorithme)); } if (item.checksum_type) |checksum_type| { - objectInfo.put(globalObject, jsc.ZigString.static("checksumType"), try bun.String.createUTF8ForJS(globalObject, checksum_type)); + objectInfo.put(globalObject, jsc.RustString.static("checksumType"), try bun.String.createUTF8ForJS(globalObject, checksum_type)); } if (item.last_modified) |last_modified| { - objectInfo.put(globalObject, jsc.ZigString.static("lastModified"), try bun.String.createUTF8ForJS(globalObject, last_modified)); + objectInfo.put(globalObject, jsc.RustString.static("lastModified"), try bun.String.createUTF8ForJS(globalObject, last_modified)); } if (item.object_size) |object_size| { - objectInfo.put(globalObject, jsc.ZigString.static("size"), JSValue.jsNumber(object_size)); + objectInfo.put(globalObject, jsc.RustString.static("size"), JSValue.jsNumber(object_size)); } if (item.storage_class) |storage_class| { - objectInfo.put(globalObject, jsc.ZigString.static("storageClass"), try bun.String.createUTF8ForJS(globalObject, storage_class)); + objectInfo.put(globalObject, jsc.RustString.static("storageClass"), try bun.String.createUTF8ForJS(globalObject, storage_class)); } if (item.owner) |owner| { const jsOwner = JSValue.createEmptyObject(globalObject, 0); if (owner.id) |id| { - jsOwner.put(globalObject, jsc.ZigString.static("id"), try bun.String.createUTF8ForJS(globalObject, id)); + jsOwner.put(globalObject, jsc.RustString.static("id"), try bun.String.createUTF8ForJS(globalObject, id)); } if (owner.display_name) |display_name| { - jsOwner.put(globalObject, jsc.ZigString.static("displayName"), try bun.String.createUTF8ForJS(globalObject, display_name)); + jsOwner.put(globalObject, jsc.RustString.static("displayName"), try bun.String.createUTF8ForJS(globalObject, display_name)); } - objectInfo.put(globalObject, jsc.ZigString.static("owner"), jsOwner); + objectInfo.put(globalObject, jsc.RustString.static("owner"), jsOwner); } try jsContents.putIndex(globalObject, @intCast(i), objectInfo); } - jsResult.put(globalObject, jsc.ZigString.static("contents"), jsContents); + jsResult.put(globalObject, jsc.RustString.static("contents"), jsContents); } if (this.common_prefixes) |common_prefixes| { @@ -169,11 +169,11 @@ pub const S3ListObjectsV2Result = struct { for (common_prefixes.items, 0..) |prefix, i| { const jsPrefix = JSValue.createEmptyObject(globalObject, 0); - jsPrefix.put(globalObject, jsc.ZigString.static("prefix"), try bun.String.createUTF8ForJS(globalObject, prefix)); + jsPrefix.put(globalObject, jsc.RustString.static("prefix"), try bun.String.createUTF8ForJS(globalObject, prefix)); try jsCommonPrefixes.putIndex(globalObject, @intCast(i), jsPrefix); } - jsResult.put(globalObject, jsc.ZigString.static("commonPrefixes"), jsCommonPrefixes); + jsResult.put(globalObject, jsc.RustString.static("commonPrefixes"), jsCommonPrefixes); } return jsResult; diff --git a/src/runtime/webcore/s3/multipart.zig b/src/runtime/webcore/s3/multipart.zig index 393f01fe6c4..5a5b46e99cb 100644 --- a/src/runtime/webcore/s3/multipart.zig +++ b/src/runtime/webcore/s3/multipart.zig @@ -785,13 +785,13 @@ pub const MultiPartUpload = struct { }; const std = @import("std"); -const ACL = @import("../../../s3_signing/acl.zig").ACL; -const MultiPartUploadOptions = @import("./multipart_options.zig").MultiPartUploadOptions; -const S3Credentials = @import("../../../s3_signing/credentials.zig").S3Credentials; -const S3Error = @import("../../../s3_signing/error.zig").S3Error; -const Storageclass = @import("../../../s3_signing/storage_class.zig").StorageClass; +const ACL = @import("../../../s3_signing/acl.rust").ACL; +const MultiPartUploadOptions = @import("./multipart_options.rust").MultiPartUploadOptions; +const S3Credentials = @import("../../../s3_signing/credentials.rust").S3Credentials; +const S3Error = @import("../../../s3_signing/error.rust").S3Error; +const Storageclass = @import("../../../s3_signing/storage_class.rust").StorageClass; -const S3SimpleRequest = @import("./simple_request.zig"); +const S3SimpleRequest = @import("./simple_request.rust"); const executeSimpleS3Request = S3SimpleRequest.executeSimpleS3Request; const bun = @import("bun"); diff --git a/src/runtime/webcore/s3/simple_request.zig b/src/runtime/webcore/s3/simple_request.zig index 09de5857327..66ec389b4dd 100644 --- a/src/runtime/webcore/s3/simple_request.zig +++ b/src/runtime/webcore/s3/simple_request.zig @@ -339,7 +339,7 @@ pub const S3HttpSimpleTask = struct { } } - /// this is the callback from the http.zig AsyncHTTP is always called from the HTTPThread + /// this is the callback from the http.rust AsyncHTTP is always called from the HTTPThread pub fn httpCallback(this: *@This(), async_http: *bun.http.AsyncHTTP, result: bun.http.HTTPClientResult) void { const is_done = !result.has_more; this.result = result; @@ -447,16 +447,16 @@ pub fn executeSimpleS3Request( bun.http.http_thread.schedule(batch); } -const ListObjects = @import("./list_objects.zig"); +const ListObjects = @import("./list_objects.rust"); const std = @import("std"); -const ACL = @import("../../../s3_signing/acl.zig").ACL; -const StorageClass = @import("../../../s3_signing/storage_class.zig").StorageClass; +const ACL = @import("../../../s3_signing/acl.rust").ACL; +const StorageClass = @import("../../../s3_signing/storage_class.rust").StorageClass; -const S3Credentials = @import("../../../s3_signing/credentials.zig").S3Credentials; -const SignResult = @import("../../../s3_signing/credentials.zig").S3Credentials.SignResult; +const S3Credentials = @import("../../../s3_signing/credentials.rust").S3Credentials; +const SignResult = @import("../../../s3_signing/credentials.rust").S3Credentials.SignResult; -const S3Error = @import("../../../s3_signing/error.zig").S3Error; -const getSignErrorCodeAndMessage = @import("../../../s3_signing/error.zig").getSignErrorCodeAndMessage; +const S3Error = @import("../../../s3_signing/error.rust").S3Error; +const getSignErrorCodeAndMessage = @import("../../../s3_signing/error.rust").getSignErrorCodeAndMessage; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/runtime/webview/ChromeBackend.cpp b/src/runtime/webview/ChromeBackend.cpp index 59292fd6df1..69e75dea575 100644 --- a/src/runtime/webview/ChromeBackend.cpp +++ b/src/runtime/webview/ChromeBackend.cpp @@ -3,7 +3,7 @@ #include "bun-uws/src/SocketKinds.h" #include "JSWebView.h" #include "ipc_protocol.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunClientData.h" #include "ScriptExecutionContext.h" #include "BunString.h" @@ -91,17 +91,17 @@ namespace CDP { using namespace JSC; -// From ChromeProcess.zig. Returns the parent's socketpair fd (bidirectional). +// From ChromeProcess.rust. Returns the parent's socketpair fd (bidirectional). // path overrides auto-detection; extraArgv (count entries, each NUL- // terminated) appends after core flags. All pointers nullable. -extern "C" int32_t Bun__Chrome__ensure(Zig::GlobalObject*, const char* userDataDir, +extern "C" int32_t Bun__Chrome__ensure(Rust::GlobalObject*, const char* userDataDir, const char* path, const char* const* extraArgv, uint32_t extraArgvLen, bool stdoutInherit, bool stderrInherit); extern "C" void* Blob__fromBytesWithType(JSC::JSGlobalObject*, const uint8_t* ptr, size_t len, const char* mime); -extern "C" JSC::EncodedJSValue SYSV_ABI Blob__create(Zig::GlobalObject*, void* impl); +extern "C" JSC::EncodedJSValue SYSV_ABI Blob__create(Rust::GlobalObject*, void* impl); extern "C" void Bun__eventLoop__incrementRefConcurrently(void* bunVM, int delta); -extern "C" void Bun__EventLoop__enter(Zig::GlobalObject*); -extern "C" void Bun__EventLoop__exit(Zig::GlobalObject*); +extern "C" void Bun__EventLoop__enter(Rust::GlobalObject*); +extern "C" void Bun__EventLoop__exit(Rust::GlobalObject*); extern "C" void Bun__EventLoop__runCallback2(JSGlobalObject*, EncodedJSValue cb, EncodedJSValue thisVal, EncodedJSValue arg0, EncodedJSValue arg1); @@ -279,7 +279,7 @@ static constexpr us_socket_vtable_t s_cdpVTable = { .on_handshake = nullptr, }; -bool Transport::ensureSpawned(Zig::GlobalObject* zig, const WTF::String& userDataDir, +bool Transport::ensureSpawned(Rust::GlobalObject* rust, const WTF::String& userDataDir, const WTF::String& path, const WTF::Vector& extraArgv, bool stdoutInherit, bool stderrInherit) { @@ -293,7 +293,7 @@ bool Transport::ensureSpawned(Zig::GlobalObject* zig, const WTF::String& userDat m_mode = TransportMode::Pipe; // Empty string ≠ null. WTF::String() utf8's to an empty CString (not - // isNull), which on the Zig side passes "" into --user-data-dir= and + // isNull), which on the Rust side passes "" into --user-data-dir= and // Chrome falls back to the default profile → ProcessSingleton abort. WTF::CString dir = userDataDir.utf8(); WTF::CString pathC = path.utf8(); @@ -305,7 +305,7 @@ bool Transport::ensureSpawned(Zig::GlobalObject* zig, const WTF::String& userDat argvC.append(s.utf8()); argvPtrs.append(argvC.last().data()); } - int32_t fd = Bun__Chrome__ensure(zig, + int32_t fd = Bun__Chrome__ensure(rust, dir.length() ? dir.data() : nullptr, pathC.length() ? pathC.data() : nullptr, argvPtrs.isEmpty() ? nullptr : argvPtrs.span().data(), @@ -319,7 +319,7 @@ bool Transport::ensureSpawned(Zig::GlobalObject* zig, const WTF::String& userDat // fd 3 and fd 4; read(3)+write(4) both hit our socketpair peer. usockets' // bsd_recv calls recv() which needs a real socket (pipe fds broke here // with ENOTSOCK silently misread as EOF). - m_global = zig; + m_global = rust; if (!s_cdpGroup.loop) { us_socket_group_init(&s_cdpGroup, uws_get_loop(), &s_cdpVTable, nullptr); @@ -360,7 +360,7 @@ void Transport::send(uint32_t cdpId, Command&& cmd) // --- WebSocket transport ---------------------------------------------------- // Native-callback trampolines. Plain C function pointers (not capturing -// lambdas) — the ctx arg is the Transport* singleton. Zig's CppWebSocket +// lambdas) — the ctx arg is the Transport* singleton. Rust's CppWebSocket // wrapper already does eventLoop.enter()/exit() around the extern "C" // call, so any JS these end up running (settle → resolve → .then()) is // already in the right execution context. @@ -450,7 +450,7 @@ static void wsOnClose(void* ctx, unsigned short code) t.rejectAllAndMarkDead(makeString("Chrome WebSocket closed (code "_s, code, ')')); } -bool Transport::ensureConnected(Zig::GlobalObject* zig, const WTF::String& wsUrl, bool autoDetected, +bool Transport::ensureConnected(Rust::GlobalObject* rust, const WTF::String& wsUrl, bool autoDetected, const WTF::String& userDataDir, bool stdoutInherit, bool stderrInherit) { // Already connected — singleton semantics, first call wins. @@ -463,7 +463,7 @@ bool Transport::ensureConnected(Zig::GlobalObject* zig, const WTF::String& wsUrl m_rx.clear(); m_txQueue.clear(); } - m_global = zig; + m_global = rust; m_mode = TransportMode::WebSocket; m_wasAutoDetected = autoDetected; if (autoDetected) { @@ -472,7 +472,7 @@ bool Transport::ensureConnected(Zig::GlobalObject* zig, const WTF::String& wsUrl m_fallbackStderrInherit = stderrInherit; } - auto* ctx = zig->scriptExecutionContext(); + auto* ctx = rust->scriptExecutionContext(); auto result = WebCore::WebSocket::create(*ctx, wsUrl); if (result.hasException()) { m_dead = true; @@ -653,7 +653,7 @@ static void settle(JSGlobalObject* g, JSWebView* view, PendingSlot slot, bool ok // WTF::JSON parses to a C++ tree — no JSValue allocation, no GC pressure. // The tree is small (exceptionDetails is error-path only, ~200B). Stamp // .stack with description directly; Bun's V8StackTraceIterator -// (ZigException.cpp) already parses V8 stacks when it needs frames. +// (RustException.cpp) already parses V8 stacks when it needs frames. // ErrorInstance::create stackString overload sets .stack without capturing // a JSC-side trace (which would show ChromeBackend.cpp, not page frames). static JSValue errorFromExceptionDetails(JSGlobalObject* g, std::span excDetails) @@ -1737,7 +1737,7 @@ void close(JSWebView* view) } // namespace CDP -// Called from ChromeProcess.zig's onProcessExit. Idempotent with onClose. +// Called from ChromeProcess.rust's onProcessExit. Idempotent with onClose. extern "C" void Bun__Chrome__died(int32_t signo) { auto& t = CDP::transport(); diff --git a/src/runtime/webview/ChromeBackend.h b/src/runtime/webview/ChromeBackend.h index 9f13970fb93..40a6381c20a 100644 --- a/src/runtime/webview/ChromeBackend.h +++ b/src/runtime/webview/ChromeBackend.h @@ -30,7 +30,7 @@ struct us_socket_t; -namespace Zig { +namespace Rust { class GlobalObject; } @@ -378,7 +378,7 @@ class Transport { // Chrome's output (chatty on stderr — GCM/updater/font-config noise). // Spawn args apply only on the FIRST call — subsequent views share the // one Chrome, so mismatched args across views get the first-call's. - bool ensureSpawned(Zig::GlobalObject*, const WTF::String& userDataDir = {}, + bool ensureSpawned(Rust::GlobalObject*, const WTF::String& userDataDir = {}, const WTF::String& path = {}, const WTF::Vector& extraArgv = {}, bool stdoutInherit = false, bool stderrInherit = false); @@ -398,7 +398,7 @@ class Transport { // ensureSpawned instead of rejecting the user's promise with a // confusing WebSocket error. autoDetected=false means explicit // backend.url; connect failure surfaces directly. - bool ensureConnected(Zig::GlobalObject*, const WTF::String& wsUrl, bool autoDetected, + bool ensureConnected(Rust::GlobalObject*, const WTF::String& wsUrl, bool autoDetected, const WTF::String& userDataDir = {}, bool stdoutInherit = false, bool stderrInherit = false); // Next CDP id — caller uses it with Command(id, ...) then calls send(). @@ -416,7 +416,7 @@ class Transport { void onWritable(); void onClose(); - Zig::GlobalObject* m_global = nullptr; + Rust::GlobalObject* m_global = nullptr; TransportMode m_mode = TransportMode::None; // Pipe mode: usockets-adopted socketpair fd. us_socket_t* m_readSock = nullptr; diff --git a/src/runtime/webview/ChromeProcess.zig b/src/runtime/webview/ChromeProcess.zig index 892cf2e62c0..169fbb8b430 100644 --- a/src/runtime/webview/ChromeProcess.zig +++ b/src/runtime/webview/ChromeProcess.zig @@ -3,7 +3,7 @@ //! host process — Chrome IS the IPC peer. One fewer hop than WKWebView. //! //! Parent death → Chrome's pipe read EOFs → Chrome exits. Same lifetime -//! coupling as HostProcess.zig's socket EOF path. +//! coupling as HostProcess.rust's socket EOF path. //! //! fd layout (child): //! 3 = Chrome reads CDP commands from us (parent writes → child reads) diff --git a/src/runtime/webview/HostProcess.zig b/src/runtime/webview/HostProcess.zig index 96eab9e00a9..91e65194f0c 100644 --- a/src/runtime/webview/HostProcess.zig +++ b/src/runtime/webview/HostProcess.zig @@ -37,7 +37,7 @@ pub export fn Bun__WebViewHost__kill() void { /// so instance-already-exists → -1 means "you already have the fd, this is /// a bug" not "spawn failed". We deliberately don't store the fd — usockets /// owns it; re-returning a fd usockets may have already closed would be a -/// use-after-close. Zig only owns process lifetime (watch + kill). +/// use-after-close. Rust only owns process lifetime (watch + kill). pub export fn Bun__WebViewHost__ensure(global: *jsc.JSGlobalObject, stdoutInherit: bool, stderrInherit: bool) i32 { if (comptime !bun.Environment.isMac) return -1; if (instance != null) return -1; // C++ already holds the fd @@ -83,7 +83,7 @@ fn spawn(vm: *jsc.VirtualMachine, stdoutInherit: bool, stderrInherit: bool) !bun // Child sees fd 3 (first extra_fd → 3+0). The env var is the only // signal; no argv changes so `ps` shows a normal `bun` invocation. - // Same pattern as NODE_CHANNEL_FD in js_bun_spawn_bindings.zig. + // Same pattern as NODE_CHANNEL_FD in js_bun_spawn_bindings.rust. var env: std.ArrayListUnmanaged(?[*:0]const u8) = .{}; const base = try vm.transpiler.env.map.createNullDelimitedEnvMap(alloc); try env.ensureTotalCapacity(alloc, base.len + 2); @@ -133,7 +133,7 @@ fn spawn(vm: *jsc.VirtualMachine, stdoutInherit: bool, stderrInherit: bool) !bun } instance = self; // fd handed to C++ which adopts it into usockets. Not stored here — - // usockets owns the socket; Zig only owns process lifetime. + // usockets owns the socket; Rust only owns process lifetime. return fds[0]; } diff --git a/src/runtime/webview/JSWebView.cpp b/src/runtime/webview/JSWebView.cpp index e4aa304e62a..de61a83bc7d 100644 --- a/src/runtime/webview/JSWebView.cpp +++ b/src/runtime/webview/JSWebView.cpp @@ -8,7 +8,7 @@ #include "ChromeBackend.h" #include "WebKitBackend.h" #include "ipc_protocol.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunClientData.h" #include "ScriptExecutionContext.h" #include "ScriptWrappableInlines.h" @@ -32,7 +32,7 @@ using namespace WebViewProto; // isReachableFromOpaqueRoots predicate reads the atomic activity count: // under `bun test` the closure → view → m_pendingNavigate → promise → // reaction → closure cycle has no external root (the test-function promise -// goes out of Zig scope after runTestCallback returns). This IS the root. +// goes out of Rust scope after runTestCallback returns). This IS the root. // --------------------------------------------------------------------------- class JSWebViewWeakOwner final : public JSC::WeakHandleOwner { @@ -296,12 +296,12 @@ JSWebView* JSWebView::createAndSend(JSGlobalObject* g, Structure* structure, uint32_t width, uint32_t height, const WTF::String& persistDir, bool stdoutInherit, bool stderrInherit) { - auto* zig = defaultGlobalObject(g); + auto* rust = defaultGlobalObject(g); auto& c = WK::client(); - if (!c.ensureSpawned(zig, stdoutInherit, stderrInherit)) return nullptr; + if (!c.ensureSpawned(rust, stdoutInherit, stderrInherit)) return nullptr; - auto impl = WebViewEventTarget::create(*zig->scriptExecutionContext()); - JSWebView* view = create(structure, zig, WTF::move(impl)); + auto impl = WebViewEventTarget::create(*rust->scriptExecutionContext()); + JSWebView* view = create(structure, rust, WTF::move(impl)); view->m_viewId = c.nextViewId++; c.viewsById.emplace(view->m_viewId, Weak(view, &webViewWeakOwner())); c.updateKeepAlive(); @@ -328,7 +328,7 @@ JSWebView* JSWebView::createChrome(JSGlobalObject* g, Structure* structure, const WTF::String& path, const WTF::Vector& extraArgv, bool stdoutInherit, bool stderrInherit, const WTF::String& wsUrl, bool skipAutoDetect) { - auto* zig = defaultGlobalObject(g); + auto* rust = defaultGlobalObject(g); auto& t = CDP::transport(); // Transport selection, in priority order: @@ -342,26 +342,26 @@ JSWebView* JSWebView::createChrome(JSGlobalObject* g, Structure* structure, // sync/instant so the constructor stays synchronous. bool ok; if (!wsUrl.isEmpty()) { - ok = t.ensureConnected(zig, wsUrl, /* autoDetected */ false); + ok = t.ensureConnected(rust, wsUrl, /* autoDetected */ false); } else if (skipAutoDetect || !path.isEmpty() || !extraArgv.isEmpty()) { - ok = t.ensureSpawned(zig, userDataDir, path, extraArgv, stdoutInherit, stderrInherit); + ok = t.ensureSpawned(rust, userDataDir, path, extraArgv, stdoutInherit, stderrInherit); } else { // Auto-detect. DevToolsActivePort URL caps at // ws://127.0.0.1:65535/devtools/browser/<36-char-uuid> ≈ 70B. char buf[128]; size_t len = Bun__Chrome__autoDetect(buf, sizeof(buf)); if (len > 0) { - ok = t.ensureConnected(zig, + ok = t.ensureConnected(rust, WTF::String::fromUTF8(std::span(buf, len)), /* autoDetected */ true, userDataDir, stdoutInherit, stderrInherit); } else { - ok = t.ensureSpawned(zig, userDataDir, path, extraArgv, stdoutInherit, stderrInherit); + ok = t.ensureSpawned(rust, userDataDir, path, extraArgv, stdoutInherit, stderrInherit); } } if (!ok) return nullptr; - auto impl = WebViewEventTarget::create(*zig->scriptExecutionContext()); - JSWebView* view = create(structure, zig, WTF::move(impl)); + auto impl = WebViewEventTarget::create(*rust->scriptExecutionContext()); + JSWebView* view = create(structure, rust, WTF::move(impl)); view->m_backend = WebViewBackend::Chrome; view->m_width = width; view->m_height = height; diff --git a/src/runtime/webview/JSWebViewConstructor.cpp b/src/runtime/webview/JSWebViewConstructor.cpp index 64111d5431d..a57d5233e6a 100644 --- a/src/runtime/webview/JSWebViewConstructor.cpp +++ b/src/runtime/webview/JSWebViewConstructor.cpp @@ -4,7 +4,7 @@ #include "root.h" #include "JSWebView.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include @@ -101,7 +101,7 @@ JSC_DEFINE_HOST_FUNCTION(constructWebView, (JSGlobalObject * globalObject, CallF VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto* zigGlobalObject = defaultGlobalObject(globalObject); + auto* rustGlobalObject = defaultGlobalObject(globalObject); uint32_t width = 800, height = 600; WTF::String persistDir; @@ -330,9 +330,9 @@ JSC_DEFINE_HOST_FUNCTION(constructWebView, (JSGlobalObject * globalObject, CallF if (height == 0 || height > 16384) return Bun::ERR::OUT_OF_RANGE(scope, globalObject, "height"_s, 1, 16384, jsNumber(height)); - Structure* structure = zigGlobalObject->m_JSWebViewClassStructure.get(zigGlobalObject); + Structure* structure = rustGlobalObject->m_JSWebViewClassStructure.get(rustGlobalObject); JSValue newTarget = callFrame->newTarget(); - if (zigGlobalObject->m_JSWebViewClassStructure.constructor(zigGlobalObject) != newTarget) [[unlikely]] { + if (rustGlobalObject->m_JSWebViewClassStructure.constructor(rustGlobalObject) != newTarget) [[unlikely]] { auto* functionGlobalObject = defaultGlobalObject(getFunctionRealm(globalObject, newTarget.getObject())); RETURN_IF_EXCEPTION(scope, {}); structure = InternalFunction::createSubclassStructure(globalObject, newTarget.getObject(), diff --git a/src/runtime/webview/JSWebViewPrototype.cpp b/src/runtime/webview/JSWebViewPrototype.cpp index e8aeb133a2f..b06583084f9 100644 --- a/src/runtime/webview/JSWebViewPrototype.cpp +++ b/src/runtime/webview/JSWebViewPrototype.cpp @@ -4,7 +4,7 @@ #include "root.h" #include "JSWebView.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "ErrorCode.h" #include #include diff --git a/src/runtime/webview/WebKitBackend.cpp b/src/runtime/webview/WebKitBackend.cpp index 870ea165454..8323517d613 100644 --- a/src/runtime/webview/WebKitBackend.cpp +++ b/src/runtime/webview/WebKitBackend.cpp @@ -10,7 +10,7 @@ #include "bun-uws/src/SocketKinds.h" #include "ipc_protocol.h" -#include "ZigGlobalObject.h" +#include "RustGlobalObject.h" #include "BunClientData.h" #include #include @@ -39,16 +39,16 @@ namespace WK { using namespace JSC; using namespace WebViewProto; -// Spawn + process-exit watch in Zig (reuses bun.spawn.Process / EVFILT_PROC). -extern "C" int32_t Bun__WebViewHost__ensure(Zig::GlobalObject*, bool stdoutInherit, bool stderrInherit); +// Spawn + process-exit watch in Rust (reuses bun.spawn.Process / EVFILT_PROC). +extern "C" int32_t Bun__WebViewHost__ensure(Rust::GlobalObject*, bool stdoutInherit, bool stderrInherit); extern "C" void* Blob__fromMmapWithType(JSC::JSGlobalObject*, uint8_t* ptr, size_t len, const char* mime); -extern "C" JSC::EncodedJSValue SYSV_ABI Blob__create(Zig::GlobalObject*, void* impl); -extern "C" JSC::EncodedJSValue JSBuffer__fromMmap(Zig::GlobalObject*, void* ptr, size_t length); +extern "C" JSC::EncodedJSValue SYSV_ABI Blob__create(Rust::GlobalObject*, void* impl); +extern "C" JSC::EncodedJSValue JSBuffer__fromMmap(Rust::GlobalObject*, void* ptr, size_t length); extern "C" void Bun__eventLoop__incrementRefConcurrently(void* bunVM, int delta); // Bracket the whole onData batch. exit() drains microtasks when outermost, // so all the promise reactions from this batch run before we return to usockets. -extern "C" void Bun__EventLoop__enter(Zig::GlobalObject*); -extern "C" void Bun__EventLoop__exit(Zig::GlobalObject*); +extern "C" void Bun__EventLoop__enter(Rust::GlobalObject*); +extern "C" void Bun__EventLoop__exit(Rust::GlobalObject*); // runCallback does its own nested enter/exit + reportActiveExceptionAsUnhandled // on throw — one bad onNavigated callback won't poison the rest of the batch. extern "C" void Bun__EventLoop__runCallback2(JSC::JSGlobalObject*, JSC::EncodedJSValue cb, @@ -127,11 +127,11 @@ void HostClient::updateKeepAlive() WebCore::clientData(global->vm())->bunVM, want ? 1 : -1); } -bool HostClient::ensureSpawned(Zig::GlobalObject* zig, bool stdoutInherit, bool stderrInherit) +bool HostClient::ensureSpawned(Rust::GlobalObject* rust, bool stdoutInherit, bool stderrInherit) { if (sock && !dead) return true; - // Host died (rejectAllAndMarkDead ran). The Zig side cleared its + // Host died (rejectAllAndMarkDead ran). The Rust side cleared its // instance in onProcessExit, so Bun__WebViewHost__ensure will spawn a // fresh child. Clear stale state and try again — the old rx/txQueue // bytes are for the dead socket. @@ -142,12 +142,12 @@ bool HostClient::ensureSpawned(Zig::GlobalObject* zig, bool stdoutInherit, bool txQueue.clear(); } - int fd = Bun__WebViewHost__ensure(zig, stdoutInherit, stderrInherit); + int fd = Bun__WebViewHost__ensure(rust, stdoutInherit, stderrInherit); if (fd < 0) { dead = true; return false; } - global = zig; + global = rust; // Socket group — once. Embedded; lazily linked into the loop on first // socket. on_open won't fire (us_socket_from_fd doesn't call it) but a @@ -212,7 +212,7 @@ void HostClient::onWritable() // Open + mmap the child-written shm segment. The child already munmapped // its side before sendReply, so we're the sole mapper. O_RDWR + PROT_WRITE -// because the Zig allocator wrapper poisons with @memset(undefined) in +// because the Rust allocator wrapper poisons with @memset(undefined) in // safe builds BEFORE the vtable free (which munmap's) — a PROT_READ // mapping SIGBUS'd on that poison. MAP_SHARED is required for POSIX shm // objects on macOS — MAP_PRIVATE returns EINVAL (the kernel's posix_shm @@ -665,7 +665,7 @@ void close(JSWebView* view) } // namespace WK } // namespace Bun -// Called from Zig's onProcessExit (EVFILT_PROC). The socket onClose may or +// Called from Rust's onProcessExit (EVFILT_PROC). The socket onClose may or // may not have fired (crash = no FIN). Idempotent with onClose. extern "C" void Bun__WebViewHost__childDied(int32_t signo) { @@ -678,9 +678,9 @@ extern "C" void Bun__WebViewHost__childDied(int32_t signo) #else // !OS(DARWIN) -// HostProcess.zig references this unconditionally via @extern; Zig's dead-code +// HostProcess.rust references this unconditionally via @extern; Rust's dead-code // elimination doesn't trigger because the TaggedPointer dispatch switch in -// process.zig pulls in all ProcessExitHandler arms. spawn() itself is gated +// process.rust pulls in all ProcessExitHandler arms. spawn() itself is gated // on Environment.isMac so this is never called. extern "C" void Bun__WebViewHost__childDied(int32_t) {} diff --git a/src/runtime/webview/WebKitBackend.h b/src/runtime/webview/WebKitBackend.h index 878e5c310af..b0901bc6023 100644 --- a/src/runtime/webview/WebKitBackend.h +++ b/src/runtime/webview/WebKitBackend.h @@ -19,7 +19,7 @@ struct us_socket_t; -namespace Zig { +namespace Rust { class GlobalObject; } @@ -38,10 +38,10 @@ enum class VirtualKey : uint8_t; namespace WK { // One per process. Lazy-spawned on first WebView construction via -// Bun__WebViewHost__ensure (Zig side, reuses bun.spawn.Process). +// Bun__WebViewHost__ensure (Rust side, reuses bun.spawn.Process). struct HostClient { us_socket_t* sock = nullptr; - Zig::GlobalObject* global = nullptr; + Rust::GlobalObject* global = nullptr; bool dead = false; uint32_t nextViewId = 1; @@ -51,7 +51,7 @@ struct HostClient { WTF::Vector txQueue; bool sockRefd = false; - bool ensureSpawned(Zig::GlobalObject*, bool stdoutInherit, bool stderrInherit); + bool ensureSpawned(Rust::GlobalObject*, bool stdoutInherit, bool stderrInherit); void writeFrame(WebViewProto::Op, uint32_t viewId, const uint8_t* payload, uint32_t len); void handleReply(const WebViewProto::Frame&, WebViewProto::Reader); void rejectAllAndMarkDead(const WTF::String& reason); diff --git a/src/runtime/webview/host_main.cpp b/src/runtime/webview/host_main.cpp index b9974b1e77e..58ae33ea6f6 100644 --- a/src/runtime/webview/host_main.cpp +++ b/src/runtime/webview/host_main.cpp @@ -1,7 +1,7 @@ -// WebView host subprocess entry point. Reached via cli.zig when +// WebView host subprocess entry point. Reached via cli.rust when // BUN_INTERNAL_WEBVIEW_HOST is set. Runs CFRunLoopRun() as the real main // loop — CF manages ignoreWakeUps correctly when it owns the loop. No -// JSC, no VM, no Zig runtime past the env check. +// JSC, no VM, no Rust runtime past the env check. // // Parent death → socket read() returns 0 → CFRunLoopStop → process exits. @@ -348,7 +348,7 @@ static void cfCallback(CFFileDescriptorRef, CFOptionFlags flags, void*) } // namespace Bun // --------------------------------------------------------------------------- -// Entry. cli.zig calls this before anything else when BUN_INTERNAL_WEBVIEW_HOST +// Entry. cli.rust calls this before anything else when BUN_INTERNAL_WEBVIEW_HOST // is set. Never returns. // --------------------------------------------------------------------------- extern "C" [[noreturn]] void Bun__WebView__hostMain(int fd) diff --git a/src/s3_signing/credentials.zig b/src/s3_signing/credentials.zig index ac85ed6737d..5f9d975d30b 100644 --- a/src/s3_signing/credentials.zig +++ b/src/s3_signing/credentials.zig @@ -36,7 +36,7 @@ pub const S3Credentials = struct { return hasher.final(); } - pub const getCredentialsWithOptions = @import("../runtime/webcore/s3/credentials_jsc.zig").getCredentialsWithOptions; + pub const getCredentialsWithOptions = @import("../runtime/webcore/s3/credentials_jsc.rust").getCredentialsWithOptions; pub fn dupe(this: *const @This()) *S3Credentials { return bun.new(S3Credentials, .{ @@ -775,15 +775,15 @@ pub const S3CredentialsWithOptions = struct { changed_credentials: bool = false, /// indicates if the virtual hosted style is used virtual_hosted_style: bool = false, - _accessKeyIdSlice: ?jsc.ZigString.Slice = null, - _secretAccessKeySlice: ?jsc.ZigString.Slice = null, - _regionSlice: ?jsc.ZigString.Slice = null, - _endpointSlice: ?jsc.ZigString.Slice = null, - _bucketSlice: ?jsc.ZigString.Slice = null, - _sessionTokenSlice: ?jsc.ZigString.Slice = null, - _contentDispositionSlice: ?jsc.ZigString.Slice = null, - _contentTypeSlice: ?jsc.ZigString.Slice = null, - _contentEncodingSlice: ?jsc.ZigString.Slice = null, + _accessKeyIdSlice: ?jsc.RustString.Slice = null, + _secretAccessKeySlice: ?jsc.RustString.Slice = null, + _regionSlice: ?jsc.RustString.Slice = null, + _endpointSlice: ?jsc.RustString.Slice = null, + _bucketSlice: ?jsc.RustString.Slice = null, + _sessionTokenSlice: ?jsc.RustString.Slice = null, + _contentDispositionSlice: ?jsc.RustString.Slice = null, + _contentTypeSlice: ?jsc.RustString.Slice = null, + _contentEncodingSlice: ?jsc.RustString.Slice = null, pub fn deinit(this: *@This()) void { if (this._accessKeyIdSlice) |slice| slice.deinit(); @@ -929,9 +929,9 @@ fn containsNewlineOrCR(value: []const u8) bool { } const std = @import("std"); -const ACL = @import("./acl.zig").ACL; -const MultiPartUploadOptions = @import("../runtime/webcore/s3/multipart_options.zig").MultiPartUploadOptions; -const StorageClass = @import("./storage_class.zig").StorageClass; +const ACL = @import("./acl.rust").ACL; +const MultiPartUploadOptions = @import("../runtime/webcore/s3/multipart_options.rust").MultiPartUploadOptions; +const StorageClass = @import("./storage_class.rust").StorageClass; const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/s3_signing/error.zig b/src/s3_signing/error.zig index d74c0752152..11a9925cb70 100644 --- a/src/s3_signing/error.zig +++ b/src/s3_signing/error.zig @@ -24,13 +24,13 @@ pub fn getSignErrorCodeAndMessage(err: anyerror) ErrorCodeAndMessage { }; } -pub const getJSSignError = @import("../runtime/webcore/s3/error_jsc.zig").getJSSignError; -pub const throwSignError = @import("../runtime/webcore/s3/error_jsc.zig").throwSignError; +pub const getJSSignError = @import("../runtime/webcore/s3/error_jsc.rust").getJSSignError; +pub const throwSignError = @import("../runtime/webcore/s3/error_jsc.rust").throwSignError; pub const S3Error = struct { code: []const u8, message: []const u8, - pub const toJS = @import("../runtime/webcore/s3/error_jsc.zig").s3ErrorToJS; - pub const toJSWithAsyncStack = @import("../runtime/webcore/s3/error_jsc.zig").s3ErrorToJSWithAsyncStack; + pub const toJS = @import("../runtime/webcore/s3/error_jsc.rust").s3ErrorToJS; + pub const toJSWithAsyncStack = @import("../runtime/webcore/s3/error_jsc.rust").s3ErrorToJSWithAsyncStack; }; diff --git a/src/safety/Cargo.toml b/src/safety/Cargo.toml index 782f2191863..158f8138325 100644 --- a/src/safety/Cargo.toml +++ b/src/safety/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true path = "lib.rs" [features] -# Zig `Environment.ci_assert` → opt-in extra invariant checks (off by default). +# Rust `Environment.ci_assert` → opt-in extra invariant checks (off by default). ci_assert = [] [dependencies] diff --git a/src/safety/CriticalSection.zig b/src/safety/CriticalSection.zig index a6ef311cd0b..e332998ddfc 100644 --- a/src/safety/CriticalSection.zig +++ b/src/safety/CriticalSection.zig @@ -194,7 +194,7 @@ pub fn end(self: *Self) void { pub const enabled = bun.Environment.ci_assert; const bun = @import("bun"); -const invalid_thread_id = @import("./thread_id.zig").invalid; +const invalid_thread_id = @import("./thread_id.rust").invalid; const StoredTrace = bun.crash_handler.StoredTrace; const traces_enabled = bun.Environment.isDebug; diff --git a/src/safety/ThreadLock.zig b/src/safety/ThreadLock.zig index 8d8798a7bb4..36dc380dadc 100644 --- a/src/safety/ThreadLock.zig +++ b/src/safety/ThreadLock.zig @@ -70,7 +70,7 @@ pub fn lockOrAssert(self: *Self) void { pub const enabled = bun.Environment.ci_assert; const bun = @import("bun"); -const invalid_thread_id = @import("./thread_id.zig").invalid; +const invalid_thread_id = @import("./thread_id.rust").invalid; const StoredTrace = bun.crash_handler.StoredTrace; const traces_enabled = bun.Environment.isDebug; diff --git a/src/safety/asan.zig b/src/safety/asan.zig index f723b593b1d..a606b0a3d8b 100644 --- a/src/safety/asan.zig +++ b/src/safety/asan.zig @@ -48,7 +48,7 @@ pub const enabled = bun.Environment.enable_asan; comptime { if (enabled) { - // Defined here (in bun-zig.o, a direct link input) rather than in C: in CI's + // Defined here (in bun-rust.o, a direct link input) rather than in C: in CI's // split build the C objects are archived into libbun.a, and clang places the // ASAN runtime — which already weak-defines __asan_default_options — before // user inputs, so an archive member that only provides this symbol is never diff --git a/src/safety/safety.zig b/src/safety/safety.zig index fd3f347f191..6e36be86599 100644 --- a/src/safety/safety.zig +++ b/src/safety/safety.zig @@ -1,4 +1,4 @@ -pub const alloc = @import("./alloc.zig"); +pub const alloc = @import("./alloc.rust"); pub const CheckedAllocator = alloc.CheckedAllocator; -pub const CriticalSection = @import("./CriticalSection.zig"); -pub const ThreadLock = @import("./ThreadLock.zig"); +pub const CriticalSection = @import("./CriticalSection.rust"); +pub const ThreadLock = @import("./ThreadLock.rust"); diff --git a/src/safety/thread_id.zig b/src/safety/thread_id.zig index ea9195eb8e4..1f175a1af54 100644 --- a/src/safety/thread_id.zig +++ b/src/safety/thread_id.zig @@ -1,5 +1,5 @@ /// A value that does not alias any other thread ID. -/// See `Thread/Mutex/Recursive.zig` in the Zig standard library. +/// See `Thread/Mutex/Recursive.rust` in the Rust standard library. pub const invalid = std.math.maxInt(std.Thread.Id); const std = @import("std"); diff --git a/src/semver/Version.zig b/src/semver/Version.zig index 06f4c09e7f6..5ba3236f2cd 100644 --- a/src/semver/Version.zig +++ b/src/semver/Version.zig @@ -6,7 +6,7 @@ pub fn VersionType(comptime IntType: type) type { major: IntType = 0, minor: IntType = 0, patch: IntType = 0, - _tag_padding: [if (IntType == u32) 4 else 0]u8 = .{0} ** if (IntType == u32) 4 else 0, // [see padding_checker.zig] + _tag_padding: [if (IntType == u32) 4 else 0]u8 = .{0} ** if (IntType == u32) 4 else 0, // [see padding_checker.rust] tag: Tag = .{}, const This = @This(); diff --git a/src/semver/semver.zig b/src/semver/semver.zig index 7951227f19e..633717d6956 100644 --- a/src/semver/semver.zig +++ b/src/semver/semver.zig @@ -1,10 +1,10 @@ // These are all extern so they can't be top-level structs. -pub const String = @import("../install_types/SemverString.zig").String; -pub const ExternalString = @import("../install_types/ExternalString.zig").ExternalString; -pub const Version = @import("./Version.zig").Version; -pub const VersionType = @import("./Version.zig").VersionType; +pub const String = @import("../install_types/SemverString.rust").String; +pub const ExternalString = @import("../install_types/ExternalString.rust").ExternalString; +pub const Version = @import("./Version.rust").Version; +pub const VersionType = @import("./Version.rust").VersionType; -pub const SlicedString = @import("../install_types/SlicedString.zig"); -pub const Range = @import("./SemverRange.zig"); -pub const Query = @import("./SemverQuery.zig"); -pub const SemverObject = @import("../semver_jsc/SemverObject.zig"); +pub const SlicedString = @import("../install_types/SlicedString.rust"); +pub const Range = @import("./SemverRange.rust"); +pub const Query = @import("./SemverQuery.rust"); +pub const SemverObject = @import("../semver_jsc/SemverObject.rust"); diff --git a/src/semver_jsc/SemverObject.zig b/src/semver_jsc/SemverObject.zig index 7fbc12bc5a0..e36052f4c38 100644 --- a/src/semver_jsc/SemverObject.zig +++ b/src/semver_jsc/SemverObject.zig @@ -5,7 +5,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { object.put( globalThis, - jsc.ZigString.static("satisfies"), + jsc.RustString.static("satisfies"), jsc.JSFunction.create( globalThis, "satisfies", @@ -17,7 +17,7 @@ pub fn create(globalThis: *jsc.JSGlobalObject) jsc.JSValue { object.put( globalThis, - jsc.ZigString.static("order"), + jsc.RustString.static("order"), jsc.JSFunction.create( globalThis, "order", diff --git a/src/sha_hmac/sha.zig b/src/sha_hmac/sha.zig index 97bf9f11057..7c82586ed05 100644 --- a/src/sha_hmac/sha.zig +++ b/src/sha_hmac/sha.zig @@ -166,7 +166,7 @@ const boring = [_]type{ void, }; -const zig = [_]type{ +const rust = [_]type{ std.crypto.hash.Sha1, std.crypto.hash.sha2.Sha512, std.crypto.hash.sha2.Sha384, diff --git a/src/shell_parser/braces.zig b/src/shell_parser/braces.zig index f7063022539..1c69e410b32 100644 --- a/src/shell_parser/braces.zig +++ b/src/shell_parser/braces.zig @@ -300,7 +300,7 @@ pub const Parser = struct { fn has_eq_sign(self: *Parser, str: []const u8) ?u32 { _ = self; - return @import("../runtime/shell/shell.zig").hasEqSign(str); + return @import("../runtime/shell/shell.rust").hasEqSign(str); } fn advance(self: *Parser) Token { @@ -724,10 +724,10 @@ test Lexer { } } -const SmolStr = @import("../string/string.zig").SmolStr; +const SmolStr = @import("../string/string.rust").SmolStr; -const Encoding = @import("../runtime/shell/shell.zig").StringEncoding; -const NewChars = @import("../runtime/shell/shell.zig").ShellCharIter; +const Encoding = @import("../runtime/shell/shell.rust").StringEncoding; +const NewChars = @import("../runtime/shell/shell.rust").ShellCharIter; const bun = @import("bun"); const assert = bun.assert; diff --git a/src/sourcemap/Chunk.zig b/src/sourcemap/Chunk.zig index d2cbbedb9b1..d2f6ecb4939 100644 --- a/src/sourcemap/Chunk.zig +++ b/src/sourcemap/Chunk.zig @@ -386,7 +386,7 @@ pub const Builder = NewBuilder(VLQSourceMap); const std = @import("std"); -const SourceMap = @import("./sourcemap.zig"); +const SourceMap = @import("./sourcemap.rust"); const InternalSourceMap = SourceMap.InternalSourceMap; const LineOffsetTable = SourceMap.LineOffsetTable; const SourceMapState = SourceMap.SourceMapState; diff --git a/src/sourcemap/InternalSourceMap.zig b/src/sourcemap/InternalSourceMap.zig index 716ef753c3f..8e6024117b0 100644 --- a/src/sourcemap/InternalSourceMap.zig +++ b/src/sourcemap/InternalSourceMap.zig @@ -73,7 +73,7 @@ //! gen_col_len / orig_line_len / orig_col_len: 3 × u16 LE //! gen_line_mask / orig_line_eq_mask / orig_col_eq_mask: 3 × 8 bytes //! (bit i=1 ⇒ d_gen_line>=1 / d_orig_line==d_gen_line / d_orig_col==d_gen_col) -//! gen_col_lane: count-1 zig-zag varints (d_gen_col) +//! gen_col_lane: count-1 rust-zag varints (d_gen_col) //! orig_line_exceptions: one varint per 0-bit in orig_line_eq_mask //! orig_col_exceptions: one varint per 0-bit in orig_col_eq_mask //! if has_gen_line_exceptions: @@ -217,19 +217,19 @@ const State = struct { } }; -inline fn zigzagEncode(value: i32) u32 { +inline fn rustzagEncode(value: i32) u32 { return @bitCast((value << 1) ^ (value >> 31)); } -inline fn zigzagDecode(value: u32) i32 { +inline fn rustzagDecode(value: u32) i32 { return @as(i32, @bitCast(value >> 1)) ^ (-@as(i32, @bitCast(value & 1))); } -/// Max bytes for a zig-zag-encoded i32 in 7-bit varint form: ceil(32 / 7) = 5. +/// Max bytes for a rust-zag-encoded i32 in 7-bit varint form: ceil(32 / 7) = 5. const max_varint_len = 5; fn writeVarint(buf: [*]u8, signed: i32) usize { - var v = zigzagEncode(signed); + var v = rustzagEncode(signed); var i: usize = 0; while (true) { var byte: u8 = @intCast(v & 0x7f); @@ -247,7 +247,7 @@ fn readVarint(bytes: []const u8, pos: *usize) i32 { i += 1; if (first < 0x80) { pos.* = i; - return zigzagDecode(first); + return rustzagDecode(first); } var result: u32 = first & 0x7f; var shift: u6 = 7; @@ -260,7 +260,7 @@ fn readVarint(bytes: []const u8, pos: *usize) i32 { shift += 7; } pos.* = i; - return zigzagDecode(result); + return rustzagDecode(result); } inline fn testBit(base: [*]const u8, idx: usize) bool { @@ -914,11 +914,11 @@ pub fn fromVLQ( return owned; } -pub const TestingAPIs = @import("../sourcemap_jsc/internal_jsc.zig").TestingAPIs; +pub const TestingAPIs = @import("../sourcemap_jsc/internal_jsc.rust").TestingAPIs; const std = @import("std"); -const SourceMap = @import("./sourcemap.zig"); +const SourceMap = @import("./sourcemap.rust"); const Mapping = SourceMap.Mapping; const SourceMapState = SourceMap.SourceMapState; const VLQ = SourceMap.VLQ; diff --git a/src/sourcemap/Mapping.zig b/src/sourcemap/Mapping.zig index 96b3791dd65..0798bd99eaf 100644 --- a/src/sourcemap/Mapping.zig +++ b/src/sourcemap/Mapping.zig @@ -253,7 +253,7 @@ pub const Lookup = struct { /// /// This data is freed after printed on the assumption that printing /// errors to the console are rare (this isnt used for error.stack) - pub fn getSourceCode(lookup: Lookup, base_filename: []const u8) ?bun.jsc.ZigString.Slice { + pub fn getSourceCode(lookup: Lookup, base_filename: []const u8) ?bun.jsc.RustString.Slice { const bytes = bytes: { if (lookup.prefetched_source_code) |code| { break :bytes code; @@ -276,7 +276,7 @@ pub const Lookup = struct { const code = serialized.sourceFileContents(@intCast(index)); - return bun.jsc.ZigString.Slice.fromUTF8NeverFree(code orelse return null); + return bun.jsc.RustString.Slice.fromUTF8NeverFree(code orelse return null); } if (provider.getSourceMap( @@ -309,7 +309,7 @@ pub const Lookup = struct { } }; - return bun.jsc.ZigString.Slice.init(bun.default_allocator, bytes); + return bun.jsc.RustString.Slice.init(bun.default_allocator, bytes); } }; @@ -594,7 +594,7 @@ pub fn parse( const std = @import("std"); -const SourceMap = @import("./sourcemap.zig"); +const SourceMap = @import("./sourcemap.rust"); const LineColumnOffset = SourceMap.LineColumnOffset; const ParseResult = SourceMap.ParseResult; const ParsedSourceMap = SourceMap.ParsedSourceMap; diff --git a/src/sourcemap/ParsedSourceMap.zig b/src/sourcemap/ParsedSourceMap.zig index 6fd37d9dd54..76e2b564fd1 100644 --- a/src/sourcemap/ParsedSourceMap.zig +++ b/src/sourcemap/ParsedSourceMap.zig @@ -33,15 +33,15 @@ underlying_provider: SourceContentPtr = .none, is_standalone_module_graph: bool = false, -const SourceProviderKind = enum(u2) { zig, bake, dev_server }; +const SourceProviderKind = enum(u2) { rust, bake, dev_server }; const AnySourceProvider = union(enum) { - zig: *SourceProviderMap, + rust: *SourceProviderMap, bake: *BakeSourceProvider, dev_server: *DevServerSourceProvider, pub fn ptr(this: AnySourceProvider) *anyopaque { return switch (this) { - .zig => @ptrCast(this.zig), + .rust => @ptrCast(this.rust), .bake => @ptrCast(this.bake), .dev_server => @ptrCast(this.dev_server), }; @@ -54,7 +54,7 @@ const AnySourceProvider = union(enum) { result: ParseUrlResultHint, ) ?SourceMap.ParseUrl { return switch (this) { - .zig => this.zig.getSourceMap(source_filename, load_hint, result), + .rust => this.rust.getSourceMap(source_filename, load_hint, result), .bake => this.bake.getSourceMap(source_filename, load_hint, result), .dev_server => this.dev_server.getSourceMap(source_filename, load_hint, result), }; @@ -66,10 +66,10 @@ pub const SourceContentPtr = packed struct(u64) { kind: SourceProviderKind, data: u60, - pub const none: SourceContentPtr = .{ .load_hint = .none, .kind = .zig, .data = 0 }; + pub const none: SourceContentPtr = .{ .load_hint = .none, .kind = .rust, .data = 0 }; pub fn fromProvider(p: *SourceProviderMap) SourceContentPtr { - return .{ .load_hint = .none, .data = @intCast(@intFromPtr(p)), .kind = .zig }; + return .{ .load_hint = .none, .data = @intCast(@intFromPtr(p)), .kind = .rust }; } pub fn fromBakeProvider(p: *BakeSourceProvider) SourceContentPtr { @@ -82,7 +82,7 @@ pub const SourceContentPtr = packed struct(u64) { pub fn provider(sc: SourceContentPtr) ?AnySourceProvider { switch (sc.kind) { - .zig => return .{ .zig = @ptrFromInt(sc.data) }, + .rust => return .{ .rust = @ptrFromInt(sc.data) }, .bake => return .{ .bake = @ptrFromInt(sc.data) }, .dev_server => return .{ .dev_server = @ptrFromInt(sc.data) }, } @@ -178,7 +178,7 @@ fn formatVLQsImpl(map: *const ParsedSourceMap, w: *std.Io.Writer) !void { const std = @import("std"); -const SourceMap = @import("./sourcemap.zig"); +const SourceMap = @import("./sourcemap.rust"); const BakeSourceProvider = SourceMap.BakeSourceProvider; const DevServerSourceProvider = SourceMap.DevServerSourceProvider; const InternalSourceMap = SourceMap.InternalSourceMap; diff --git a/src/sourcemap/VLQ.zig b/src/sourcemap/VLQ.zig index 49b761cdc83..c4560f19175 100644 --- a/src/sourcemap/VLQ.zig +++ b/src/sourcemap/VLQ.zig @@ -7,7 +7,7 @@ const VLQ = @This(); /// Encoding min and max ints are "//////D" and "+/////D", respectively. /// These are 7 bytes long. This makes the `VLQ` struct 8 bytes. bytes: [vlq_max_in_bytes]u8, -/// This is a u8 and not a u4 because non^2 integers are really slow in Zig. +/// This is a u8 and not a u4 because non^2 integers are really slow in Rust. len: u8 = 0, pub inline fn slice(self: *const VLQ) []const u8 { diff --git a/src/sourcemap/sourcemap.zig b/src/sourcemap/sourcemap.zig index 13036c5e16d..19758c1f6cc 100644 --- a/src/sourcemap/sourcemap.zig +++ b/src/sourcemap/sourcemap.zig @@ -250,7 +250,7 @@ pub fn parseJSON( } /// Corresponds to a segment in the "mappings" field of a sourcemap -pub const Mapping = @import("./Mapping.zig"); +pub const Mapping = @import("./Mapping.rust"); pub const ParseResult = union(enum) { fail: struct { @@ -275,7 +275,7 @@ pub const ParseResult = union(enum) { success: ParsedSourceMap, }; -pub const ParsedSourceMap = @import("./ParsedSourceMap.zig"); +pub const ParsedSourceMap = @import("./ParsedSourceMap.rust"); /// For some sourcemap loading code, this enum is used as a hint if it should /// bother loading source code into memory. Most uses of source maps only care @@ -295,14 +295,14 @@ pub const SourceMapLoadHint = enum(u2) { }; /// Always returns UTF-8 -fn findSourceMappingURL(comptime T: type, source: []const T, alloc: std.mem.Allocator) ?bun.jsc.ZigString.Slice { +fn findSourceMappingURL(comptime T: type, source: []const T, alloc: std.mem.Allocator) ?bun.jsc.RustString.Slice { const needle = comptime bun.strings.literal(T, "\n//# sourceMappingURL="); const found = std.mem.lastIndexOf(T, source, needle) orelse return null; const end = std.mem.indexOfScalarPos(T, source, found + needle.len, '\n') orelse source.len; const url = std.mem.trimRight(T, source[found + needle.len .. end], &.{ ' ', '\r' }); return switch (T) { - u8 => bun.jsc.ZigString.Slice.fromUTF8NeverFree(url), - u16 => bun.jsc.ZigString.Slice.init( + u8 => bun.jsc.RustString.Slice.fromUTF8NeverFree(url), + u16 => bun.jsc.RustString.Slice.init( alloc, bun.handleOom(bun.strings.toUTF8Alloc(alloc, url)), ), @@ -338,7 +338,7 @@ pub fn getSourceMapImpl( if (load_hint != .is_external_map) try_inline: { const source = SourceProviderKind.getSourceSlice(provider); defer source.deref(); - bun.assert(source.tag == .ZigString); + bun.assert(source.tag == .RustString); const maybe_found_url = found_url: { if (source.is8Bit()) @@ -481,13 +481,13 @@ pub fn getSourceMapImpl( return parsed; } -/// This is a pointer to a ZigSourceProvider that may or may not have a `//# sourceMappingURL` comment +/// This is a pointer to a RustSourceProvider that may or may not have a `//# sourceMappingURL` comment /// when we want to lookup this data, we will then resolve it to a ParsedSourceMap if it does. /// /// This is used for files that were pre-bundled with `bun build --target=bun --sourcemap` pub const SourceProviderMap = opaque { - extern fn ZigSourceProvider__getSourceSlice(*SourceProviderMap) bun.String; - pub const getSourceSlice = ZigSourceProvider__getSourceSlice; + extern fn RustSourceProvider__getSourceSlice(*SourceProviderMap) bun.String; + pub const getSourceSlice = RustSourceProvider__getSourceSlice; pub fn toSourceContentPtr(this: *SourceProviderMap) ParsedSourceMap.SourceContentPtr { return ParsedSourceMap.SourceContentPtr.fromProvider(this); } @@ -509,7 +509,7 @@ pub const SourceProviderMap = opaque { } }; -pub const BakeSourceProvider = @import("../sourcemap_jsc/source_provider.zig").BakeSourceProvider; +pub const BakeSourceProvider = @import("../sourcemap_jsc/source_provider.rust").BakeSourceProvider; pub const DevServerSourceProvider = opaque { pub const SourceMapData = extern struct { @@ -890,7 +890,7 @@ pub fn appendMappingToBuffer(buffer: *MutableString, last_byte: u8, prev_state: } } -pub const Chunk = @import("./Chunk.zig"); +pub const Chunk = @import("./Chunk.rust"); /// https://sentry.engineering/blog/the-case-for-debug-ids /// https://github.com/mitsuhiko/source-map-rfc/blob/proposals/debug-id/proposals/debug-id.md @@ -909,11 +909,11 @@ pub const DebugIDFormatter = struct { } }; -pub const coverage = @import("../sourcemap_jsc/CodeCoverage.zig"); -pub const VLQ = @import("./VLQ.zig"); -pub const LineOffsetTable = @import("./LineOffsetTable.zig"); -pub const JSSourceMap = @import("../sourcemap_jsc/JSSourceMap.zig"); -pub const InternalSourceMap = @import("./InternalSourceMap.zig"); +pub const coverage = @import("../sourcemap_jsc/CodeCoverage.rust"); +pub const VLQ = @import("./VLQ.rust"); +pub const LineOffsetTable = @import("./LineOffsetTable.rust"); +pub const JSSourceMap = @import("../sourcemap_jsc/JSSourceMap.rust"); +pub const InternalSourceMap = @import("./InternalSourceMap.rust"); const decodeVLQAssumeValid = VLQ.decodeAssumeValid; const decodeVLQ = VLQ.decode; diff --git a/src/sourcemap_jsc/CodeCoverage.zig b/src/sourcemap_jsc/CodeCoverage.zig index 791216c6f9b..0a00bca5738 100644 --- a/src/sourcemap_jsc/CodeCoverage.zig +++ b/src/sourcemap_jsc/CodeCoverage.zig @@ -15,7 +15,7 @@ const LinesHits = bun.collections.BabyList(u32); /// bitsets are simple and bitsets are relatively fast to construct and query /// pub const Report = struct { - source_url: bun.jsc.ZigString.Slice, + source_url: bun.jsc.RustString.Slice, executable_lines: Bitset, lines_which_have_executed: Bitset, line_hits: LinesHits = .{}, @@ -358,7 +358,7 @@ const BasicBlockRange = extern struct { pub const ByteRangeMapping = struct { line_offset_table: LineOffsetTable.List = .{}, source_id: i32, - source_url: bun.jsc.ZigString.Slice, + source_url: bun.jsc.RustString.Slice, pub fn isLessThan(_: void, a: ByteRangeMapping, b: ByteRangeMapping) bool { return bun.strings.order(a.source_url.slice(), b.source_url.slice()) == .lt; @@ -407,7 +407,7 @@ pub const ByteRangeMapping = struct { pub fn generateReportFromBlocks( this: *ByteRangeMapping, allocator: std.mem.Allocator, - source_url: bun.jsc.ZigString.Slice, + source_url: bun.jsc.RustString.Slice, blocks: []const BasicBlockRange, function_blocks: []const BasicBlockRange, ignore_sourcemap: bool, @@ -698,7 +698,7 @@ pub const ByteRangeMapping = struct { return bun.String.createUTF8ForJS(globalThis, allocating_writer.written()) catch return .zero; } - pub fn compute(source_contents: []const u8, source_id: i32, source_url: bun.jsc.ZigString.Slice) ByteRangeMapping { + pub fn compute(source_contents: []const u8, source_id: i32, source_url: bun.jsc.RustString.Slice) ByteRangeMapping { return ByteRangeMapping{ .line_offset_table = LineOffsetTable.generate(bun.jsc.VirtualMachine.get().allocator, source_contents, 0), .source_id = source_id, diff --git a/src/sourcemap_jsc/internal_jsc.zig b/src/sourcemap_jsc/internal_jsc.zig index aa9bf2002b9..d8ba5e13436 100644 --- a/src/sourcemap_jsc/internal_jsc.zig +++ b/src/sourcemap_jsc/internal_jsc.zig @@ -44,11 +44,11 @@ pub const TestingAPIs = struct { const mapping = ism.find(.fromZeroBased(line), .fromZeroBased(col)) orelse return .null; const obj = jsc.JSValue.createEmptyObject(globalThis, 5); - obj.put(globalThis, jsc.ZigString.static("generatedLine"), .jsNumber(mapping.generated.lines.zeroBased())); - obj.put(globalThis, jsc.ZigString.static("generatedColumn"), .jsNumber(mapping.generated.columns.zeroBased())); - obj.put(globalThis, jsc.ZigString.static("originalLine"), .jsNumber(mapping.original.lines.zeroBased())); - obj.put(globalThis, jsc.ZigString.static("originalColumn"), .jsNumber(mapping.original.columns.zeroBased())); - obj.put(globalThis, jsc.ZigString.static("sourceIndex"), .jsNumber(mapping.source_index)); + obj.put(globalThis, jsc.RustString.static("generatedLine"), .jsNumber(mapping.generated.lines.zeroBased())); + obj.put(globalThis, jsc.RustString.static("generatedColumn"), .jsNumber(mapping.generated.columns.zeroBased())); + obj.put(globalThis, jsc.RustString.static("originalLine"), .jsNumber(mapping.original.lines.zeroBased())); + obj.put(globalThis, jsc.RustString.static("originalColumn"), .jsNumber(mapping.original.columns.zeroBased())); + obj.put(globalThis, jsc.RustString.static("sourceIndex"), .jsNumber(mapping.source_index)); return obj; } }; diff --git a/src/sql/mysql/AuthMethod.zig b/src/sql/mysql/AuthMethod.zig index 65d05ae9438..8316c120e98 100644 --- a/src/sql/mysql/AuthMethod.zig +++ b/src/sql/mysql/AuthMethod.zig @@ -33,5 +33,5 @@ pub const AuthMethod = enum { pub const fromString = Map.get; }; -const Auth = @import("./protocol/Auth.zig"); +const Auth = @import("./protocol/Auth.rust"); const bun = @import("bun"); diff --git a/src/sql/mysql/MySQLParam.zig b/src/sql/mysql/MySQLParam.zig index 95c3d36d794..56c0232d6fa 100644 --- a/src/sql/mysql/MySQLParam.zig +++ b/src/sql/mysql/MySQLParam.zig @@ -1,5 +1,5 @@ //! Pure parameter descriptor used by the wire-protocol encoders -//! (`Query.zig`, `PreparedStatement.zig`). Split from `MySQLStatement` +//! (`Query.rust`, `PreparedStatement.rust`). Split from `MySQLStatement` //! so the protocol layer has no dependency on the JSC-coupled statement //! struct that lives in `sql_jsc/`. pub const Param = struct { @@ -7,5 +7,5 @@ pub const Param = struct { flags: ColumnDefinition41.ColumnFlags, }; -const ColumnDefinition41 = @import("./protocol/ColumnDefinition41.zig"); -const types = @import("./MySQLTypes.zig"); +const ColumnDefinition41 = @import("./protocol/ColumnDefinition41.rust"); +const types = @import("./MySQLTypes.rust"); diff --git a/src/sql/mysql/MySQLRequest.zig b/src/sql/mysql/MySQLRequest.zig index 336d15f4fc6..5cc761790a0 100644 --- a/src/sql/mysql/MySQLRequest.zig +++ b/src/sql/mysql/MySQLRequest.zig @@ -27,5 +27,5 @@ pub fn prepareRequest( const debug = bun.Output.scoped(.MySQLRequest, .visible); const bun = @import("bun"); -const CommandType = @import("./protocol/CommandType.zig").CommandType; -const NewWriter = @import("./protocol/NewWriter.zig").NewWriter; +const CommandType = @import("./protocol/CommandType.rust").CommandType; +const NewWriter = @import("./protocol/NewWriter.rust").NewWriter; diff --git a/src/sql/mysql/MySQLTypes.zig b/src/sql/mysql/MySQLTypes.zig index 929c1e8a382..2f7a111b8f9 100644 --- a/src/sql/mysql/MySQLTypes.zig +++ b/src/sql/mysql/MySQLTypes.zig @@ -271,7 +271,7 @@ pub const FieldType = enum(u8) { MYSQL_TYPE_GEOMETRY = 0xff, _, - pub const fromJS = @import("../../sql_jsc/mysql/MySQLValue.zig").fieldTypeFromJS; + pub const fromJS = @import("../../sql_jsc/mysql/MySQLValue.rust").fieldTypeFromJS; pub fn isBinaryFormatSupported(this: FieldType) bool { return switch (this) { @@ -291,7 +291,7 @@ pub const FieldType = enum(u8) { } }; -pub const Value = @import("../../sql_jsc/mysql/MySQLValue.zig").Value; +pub const Value = @import("../../sql_jsc/mysql/MySQLValue.rust").Value; pub const MySQLInt8 = int1; pub const MySQLInt16 = int2; diff --git a/src/sql/mysql/protocol/AnyMySQLError.zig b/src/sql/mysql/protocol/AnyMySQLError.zig index 080da6f5339..4f81389bd65 100644 --- a/src/sql/mysql/protocol/AnyMySQLError.zig +++ b/src/sql/mysql/protocol/AnyMySQLError.zig @@ -39,4 +39,4 @@ pub const Error = error{ InvalidState, }; -pub const mysqlErrorToJS = @import("../../../sql_jsc/mysql/protocol/any_mysql_error_jsc.zig").mysqlErrorToJS; +pub const mysqlErrorToJS = @import("../../../sql_jsc/mysql/protocol/any_mysql_error_jsc.rust").mysqlErrorToJS; diff --git a/src/sql/mysql/protocol/Auth.zig b/src/sql/mysql/protocol/Auth.zig index 8d2eacd6db1..f1696f16bd9 100644 --- a/src/sql/mysql/protocol/Auth.zig +++ b/src/sql/mysql/protocol/Auth.zig @@ -216,13 +216,13 @@ pub const caching_sha2_password = struct { }; const debug = bun.Output.scoped(.Auth, .hidden); -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; const bun = @import("bun"); const BoringSSL = bun.BoringSSL; diff --git a/src/sql/mysql/protocol/AuthSwitchRequest.zig b/src/sql/mysql/protocol/AuthSwitchRequest.zig index bb5b07ad15d..19d41837ed9 100644 --- a/src/sql/mysql/protocol/AuthSwitchRequest.zig +++ b/src/sql/mysql/protocol/AuthSwitchRequest.zig @@ -36,7 +36,7 @@ pub fn decodeInternal(this: *AuthSwitchRequest, comptime Context: type, reader: pub const decode = decoderWrap(AuthSwitchRequest, decodeInternal).decode; const bun = @import("bun"); -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/AuthSwitchResponse.zig b/src/sql/mysql/protocol/AuthSwitchResponse.zig index 751d0c21e44..58891e52e66 100644 --- a/src/sql/mysql/protocol/AuthSwitchResponse.zig +++ b/src/sql/mysql/protocol/AuthSwitchResponse.zig @@ -12,7 +12,7 @@ pub fn writeInternal(this: *const AuthSwitchResponse, comptime Context: type, wr pub const write = writeWrap(AuthSwitchResponse, writeInternal).write; -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; diff --git a/src/sql/mysql/protocol/ColumnDefinition41.zig b/src/sql/mysql/protocol/ColumnDefinition41.zig index 7394976c0df..c65afae8e6e 100644 --- a/src/sql/mysql/protocol/ColumnDefinition41.zig +++ b/src/sql/mysql/protocol/ColumnDefinition41.zig @@ -91,9 +91,9 @@ pub const decode = decoderWrap(ColumnDefinition41, decodeInternal).decode; const debug = bun.Output.scoped(.ColumnDefinition41, .hidden); const bun = @import("bun"); -const types = @import("../MySQLTypes.zig"); -const ColumnIdentifier = @import("../../shared/ColumnIdentifier.zig").ColumnIdentifier; -const Data = @import("../../shared/Data.zig").Data; +const types = @import("../MySQLTypes.rust"); +const ColumnIdentifier = @import("../../shared/ColumnIdentifier.rust").ColumnIdentifier; +const Data = @import("../../shared/Data.rust").Data; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/EOFPacket.zig b/src/sql/mysql/protocol/EOFPacket.zig index 02da929d837..1b7734d1ad1 100644 --- a/src/sql/mysql/protocol/EOFPacket.zig +++ b/src/sql/mysql/protocol/EOFPacket.zig @@ -15,7 +15,7 @@ pub fn decodeInternal(this: *EOFPacket, comptime Context: type, reader: NewReade pub const decode = decoderWrap(EOFPacket, decodeInternal).decode; -const StatusFlags = @import("../StatusFlags.zig").StatusFlags; +const StatusFlags = @import("../StatusFlags.rust").StatusFlags; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/ErrorPacket.zig b/src/sql/mysql/protocol/ErrorPacket.zig index e74ed8ce2ed..d636b0c9b5b 100644 --- a/src/sql/mysql/protocol/ErrorPacket.zig +++ b/src/sql/mysql/protocol/ErrorPacket.zig @@ -14,7 +14,7 @@ pub const MySQLErrorOptions = struct { sqlState: ?[5]u8 = null, }; -pub const createMySQLError = @import("../../../sql_jsc/mysql/protocol/error_packet_jsc.zig").createMySQLError; +pub const createMySQLError = @import("../../../sql_jsc/mysql/protocol/error_packet_jsc.rust").createMySQLError; pub fn decodeInternal(this: *ErrorPacket, comptime Context: type, reader: NewReader(Context)) !void { this.header = try reader.int(u8); @@ -42,9 +42,9 @@ pub fn decodeInternal(this: *ErrorPacket, comptime Context: type, reader: NewRea pub const decode = decoderWrap(ErrorPacket, decodeInternal).decode; -pub const toJS = @import("../../../sql_jsc/mysql/protocol/error_packet_jsc.zig").toJS; +pub const toJS = @import("../../../sql_jsc/mysql/protocol/error_packet_jsc.rust").toJS; -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/HandshakeResponse41.zig b/src/sql/mysql/protocol/HandshakeResponse41.zig index 80b28645a18..bf9a7aab628 100644 --- a/src/sql/mysql/protocol/HandshakeResponse41.zig +++ b/src/sql/mysql/protocol/HandshakeResponse41.zig @@ -99,11 +99,11 @@ pub const write = writeWrap(HandshakeResponse41, writeInternal).write; const debug = bun.Output.scoped(.MySQLConnection, .hidden); -const Capabilities = @import("../Capabilities.zig"); +const Capabilities = @import("../Capabilities.rust"); const bun = @import("bun"); -const CharacterSet = @import("./CharacterSet.zig").CharacterSet; -const Data = @import("../../shared/Data.zig").Data; -const encodeLengthInt = @import("./EncodeInt.zig").encodeLengthInt; +const CharacterSet = @import("./CharacterSet.rust").CharacterSet; +const Data = @import("../../shared/Data.rust").Data; +const encodeLengthInt = @import("./EncodeInt.rust").encodeLengthInt; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; diff --git a/src/sql/mysql/protocol/HandshakeV10.zig b/src/sql/mysql/protocol/HandshakeV10.zig index dcb8df3ea63..a98fa73cf94 100644 --- a/src/sql/mysql/protocol/HandshakeV10.zig +++ b/src/sql/mysql/protocol/HandshakeV10.zig @@ -72,11 +72,11 @@ pub fn decodeInternal(this: *HandshakeV10, comptime Context: type, reader: NewRe pub const decode = decoderWrap(HandshakeV10, decodeInternal).decode; -const Capabilities = @import("../Capabilities.zig"); +const Capabilities = @import("../Capabilities.rust"); const bun = @import("bun"); -const CharacterSet = @import("./CharacterSet.zig").CharacterSet; -const Data = @import("../../shared/Data.zig").Data; -const StatusFlags = @import("../StatusFlags.zig").StatusFlags; +const CharacterSet = @import("./CharacterSet.rust").CharacterSet; +const Data = @import("../../shared/Data.rust").Data; +const StatusFlags = @import("../StatusFlags.rust").StatusFlags; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/LocalInfileRequest.zig b/src/sql/mysql/protocol/LocalInfileRequest.zig index eb003201714..ab7086ff71a 100644 --- a/src/sql/mysql/protocol/LocalInfileRequest.zig +++ b/src/sql/mysql/protocol/LocalInfileRequest.zig @@ -16,7 +16,7 @@ pub fn decodeInternal(this: *LocalInfileRequest, comptime Context: type, reader: pub const decode = decoderWrap(LocalInfileRequest, decodeInternal).decode; -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/NewReader.zig b/src/sql/mysql/protocol/NewReader.zig index 8a296906f63..d00614c3a37 100644 --- a/src/sql/mysql/protocol/NewReader.zig +++ b/src/sql/mysql/protocol/NewReader.zig @@ -123,7 +123,7 @@ pub fn decoderWrap(comptime Container: type, comptime decodeFn: anytype) type { }; } -const AnyMySQLError = @import("./AnyMySQLError.zig"); +const AnyMySQLError = @import("./AnyMySQLError.rust"); const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const decodeLengthInt = @import("./EncodeInt.zig").decodeLengthInt; +const Data = @import("../../shared/Data.rust").Data; +const decodeLengthInt = @import("./EncodeInt.rust").decodeLengthInt; diff --git a/src/sql/mysql/protocol/NewWriter.zig b/src/sql/mysql/protocol/NewWriter.zig index 8dc35dd525c..4f9d149f1da 100644 --- a/src/sql/mysql/protocol/NewWriter.zig +++ b/src/sql/mysql/protocol/NewWriter.zig @@ -121,12 +121,12 @@ pub fn writeWrap(comptime Container: type, comptime writeFn: anytype) type { const debug = bun.Output.scoped(.NewWriter, .hidden); -const AnyMySQLError = @import("./AnyMySQLError.zig"); -const PacketHeader = @import("./PacketHeader.zig"); +const AnyMySQLError = @import("./AnyMySQLError.rust"); +const PacketHeader = @import("./PacketHeader.rust"); const bun = @import("bun"); const std = @import("std"); -const encodeLengthInt = @import("./EncodeInt.zig").encodeLengthInt; +const encodeLengthInt = @import("./EncodeInt.rust").encodeLengthInt; -const types = @import("../MySQLTypes.zig"); +const types = @import("../MySQLTypes.rust"); const MySQLInt32 = types.MySQLInt32; const MySQLInt64 = types.MySQLInt64; diff --git a/src/sql/mysql/protocol/OKPacket.zig b/src/sql/mysql/protocol/OKPacket.zig index 876d6f070dd..2fa0c79c447 100644 --- a/src/sql/mysql/protocol/OKPacket.zig +++ b/src/sql/mysql/protocol/OKPacket.zig @@ -41,9 +41,9 @@ pub fn decodeInternal(this: *OKPacket, comptime Context: type, reader: NewReader pub const decode = decoderWrap(OKPacket, decodeInternal).decode; -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const StatusFlags = @import("../StatusFlags.zig").StatusFlags; +const StatusFlags = @import("../StatusFlags.rust").StatusFlags; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/PreparedStatement.zig b/src/sql/mysql/protocol/PreparedStatement.zig index 4ad69a436bb..7328f387647 100644 --- a/src/sql/mysql/protocol/PreparedStatement.zig +++ b/src/sql/mysql/protocol/PreparedStatement.zig @@ -104,15 +104,15 @@ pub const Execute = struct { const debug = bun.Output.scoped(.PreparedStatement, .hidden); -const AnyMySQLError = @import("./AnyMySQLError.zig"); +const AnyMySQLError = @import("./AnyMySQLError.rust"); const bun = @import("bun"); const std = @import("std"); -const CommandType = @import("./CommandType.zig").CommandType; -const Param = @import("../MySQLParam.zig").Param; -const Value = @import("../MySQLTypes.zig").Value; +const CommandType = @import("./CommandType.rust").CommandType; +const Param = @import("../MySQLParam.rust").Param; +const Value = @import("../MySQLTypes.rust").Value; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; diff --git a/src/sql/mysql/protocol/Query.zig b/src/sql/mysql/protocol/Query.zig index 6ff731cefdd..0935385f9d2 100644 --- a/src/sql/mysql/protocol/Query.zig +++ b/src/sql/mysql/protocol/Query.zig @@ -62,9 +62,9 @@ const debug = bun.Output.scoped(.MySQLQuery, .visible); const bun = @import("bun"); const std = @import("std"); -const CommandType = @import("./CommandType.zig").CommandType; -const Data = @import("../../shared/Data.zig").Data; -const Param = @import("../MySQLParam.zig").Param; +const CommandType = @import("./CommandType.rust").CommandType; +const Data = @import("../../shared/Data.rust").Data; +const Param = @import("../MySQLParam.rust").Param; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; diff --git a/src/sql/mysql/protocol/ResultSetHeader.zig b/src/sql/mysql/protocol/ResultSetHeader.zig index 6a8c99b6886..7b4c49d1e6f 100644 --- a/src/sql/mysql/protocol/ResultSetHeader.zig +++ b/src/sql/mysql/protocol/ResultSetHeader.zig @@ -8,5 +8,5 @@ pub fn decodeInternal(this: *ResultSetHeader, comptime Context: type, reader: Ne pub const decode = decoderWrap(ResultSetHeader, decodeInternal).decode; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/mysql/protocol/SSLRequest.zig b/src/sql/mysql/protocol/SSLRequest.zig index 2157c3faa21..a715b6391f7 100644 --- a/src/sql/mysql/protocol/SSLRequest.zig +++ b/src/sql/mysql/protocol/SSLRequest.zig @@ -34,9 +34,9 @@ pub const write = writeWrap(SSLRequest, writeInternal).write; const debug = bun.Output.scoped(.MySQLConnection, .hidden); -const Capabilities = @import("../Capabilities.zig"); +const Capabilities = @import("../Capabilities.rust"); const bun = @import("bun"); -const CharacterSet = @import("./CharacterSet.zig").CharacterSet; +const CharacterSet = @import("./CharacterSet.rust").CharacterSet; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const writeWrap = @import("./NewWriter.zig").writeWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const writeWrap = @import("./NewWriter.rust").writeWrap; diff --git a/src/sql/mysql/protocol/StackReader.zig b/src/sql/mysql/protocol/StackReader.zig index ed242270bca..695a2f3ca4f 100644 --- a/src/sql/mysql/protocol/StackReader.zig +++ b/src/sql/mysql/protocol/StackReader.zig @@ -72,7 +72,7 @@ pub fn readZ(this: StackReader) AnyMySQLError.Error!Data { return error.ShortRead; } -const AnyMySQLError = @import("./AnyMySQLError.zig"); +const AnyMySQLError = @import("./AnyMySQLError.rust"); const bun = @import("bun"); -const Data = @import("../../shared/Data.zig").Data; -const NewReader = @import("./NewReader.zig").NewReader; +const Data = @import("../../shared/Data.rust").Data; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/mysql/protocol/StmtPrepareOKPacket.zig b/src/sql/mysql/protocol/StmtPrepareOKPacket.zig index 0238021ce1c..bca6f9ea734 100644 --- a/src/sql/mysql/protocol/StmtPrepareOKPacket.zig +++ b/src/sql/mysql/protocol/StmtPrepareOKPacket.zig @@ -22,5 +22,5 @@ pub fn decodeInternal(this: *StmtPrepareOKPacket, comptime Context: type, reader pub const decode = decoderWrap(StmtPrepareOKPacket, decodeInternal).decode; -const NewReader = @import("./NewReader.zig").NewReader; -const decoderWrap = @import("./NewReader.zig").decoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const decoderWrap = @import("./NewReader.rust").decoderWrap; diff --git a/src/sql/postgres/AnyPostgresError.zig b/src/sql/postgres/AnyPostgresError.zig index 36c466bde29..4b815d3ba69 100644 --- a/src/sql/postgres/AnyPostgresError.zig +++ b/src/sql/postgres/AnyPostgresError.zig @@ -57,6 +57,6 @@ pub const PostgresErrorOptions = struct { routine: ?[]const u8 = null, }; -pub const createPostgresError = @import("../../sql_jsc/postgres/error_jsc.zig").createPostgresError; +pub const createPostgresError = @import("../../sql_jsc/postgres/error_jsc.rust").createPostgresError; -pub const postgresErrorToJS = @import("../../sql_jsc/postgres/error_jsc.zig").postgresErrorToJS; +pub const postgresErrorToJS = @import("../../sql_jsc/postgres/error_jsc.rust").postgresErrorToJS; diff --git a/src/sql/postgres/CommandTag.zig b/src/sql/postgres/CommandTag.zig index ad33b45fae8..13dbb989cb0 100644 --- a/src/sql/postgres/CommandTag.zig +++ b/src/sql/postgres/CommandTag.zig @@ -29,9 +29,9 @@ pub const CommandTag = union(enum) { other: []const u8, - pub const toJSTag = @import("../../sql_jsc/postgres/command_tag_jsc.zig").toJSTag; + pub const toJSTag = @import("../../sql_jsc/postgres/command_tag_jsc.rust").toJSTag; - pub const toJSNumber = @import("../../sql_jsc/postgres/command_tag_jsc.zig").toJSNumber; + pub const toJSNumber = @import("../../sql_jsc/postgres/command_tag_jsc.rust").toJSNumber; const KnownCommand = enum { INSERT, diff --git a/src/sql/postgres/PostgresProtocol.zig b/src/sql/postgres/PostgresProtocol.zig index 20e6cd21909..6336ab41f71 100644 --- a/src/sql/postgres/PostgresProtocol.zig +++ b/src/sql/postgres/PostgresProtocol.zig @@ -21,42 +21,42 @@ pub fn writeQuery(query: []const u8, comptime Context: type, writer: NewWriter(C try writer.string(query); } -pub const ArrayList = @import("./protocol/ArrayList.zig"); -pub const BackendKeyData = @import("./protocol/BackendKeyData.zig"); -pub const CommandComplete = @import("./protocol/CommandComplete.zig"); -pub const CopyData = @import("./protocol/CopyData.zig"); -pub const CopyFail = @import("./protocol/CopyFail.zig"); -pub const DataRow = @import("./protocol/DataRow.zig"); -pub const Describe = @import("./protocol/Describe.zig"); -pub const ErrorResponse = @import("./protocol/ErrorResponse.zig"); -pub const Execute = @import("./protocol/Execute.zig"); -pub const FieldDescription = @import("./protocol/FieldDescription.zig"); -pub const NegotiateProtocolVersion = @import("./protocol/NegotiateProtocolVersion.zig"); -pub const NoticeResponse = @import("./protocol/NoticeResponse.zig"); -pub const NotificationResponse = @import("./protocol/NotificationResponse.zig"); -pub const ParameterDescription = @import("./protocol/ParameterDescription.zig"); -pub const ParameterStatus = @import("./protocol/ParameterStatus.zig"); -pub const Parse = @import("./protocol/Parse.zig"); -pub const PasswordMessage = @import("./protocol/PasswordMessage.zig"); -pub const ReadyForQuery = @import("./protocol/ReadyForQuery.zig"); -pub const RowDescription = @import("./protocol/RowDescription.zig"); -pub const SASLInitialResponse = @import("./protocol/SASLInitialResponse.zig"); -pub const SASLResponse = @import("./protocol/SASLResponse.zig"); -pub const StackReader = @import("./protocol/StackReader.zig"); -pub const StartupMessage = @import("./protocol/StartupMessage.zig"); -pub const Authentication = @import("./protocol/Authentication.zig").Authentication; -pub const ColumnIdentifier = @import("../shared/ColumnIdentifier.zig").ColumnIdentifier; -pub const DecoderWrap = @import("./protocol/DecoderWrap.zig").DecoderWrap; -pub const FieldMessage = @import("./protocol/FieldMessage.zig").FieldMessage; -pub const FieldType = @import("./protocol/FieldType.zig").FieldType; -pub const NewReader = @import("./protocol/NewReader.zig").NewReader; -pub const NewWriter = @import("./protocol/NewWriter.zig").NewWriter; -pub const PortalOrPreparedStatement = @import("./protocol/PortalOrPreparedStatement.zig").PortalOrPreparedStatement; -pub const WriteWrap = @import("./protocol/WriteWrap.zig").WriteWrap; +pub const ArrayList = @import("./protocol/ArrayList.rust"); +pub const BackendKeyData = @import("./protocol/BackendKeyData.rust"); +pub const CommandComplete = @import("./protocol/CommandComplete.rust"); +pub const CopyData = @import("./protocol/CopyData.rust"); +pub const CopyFail = @import("./protocol/CopyFail.rust"); +pub const DataRow = @import("./protocol/DataRow.rust"); +pub const Describe = @import("./protocol/Describe.rust"); +pub const ErrorResponse = @import("./protocol/ErrorResponse.rust"); +pub const Execute = @import("./protocol/Execute.rust"); +pub const FieldDescription = @import("./protocol/FieldDescription.rust"); +pub const NegotiateProtocolVersion = @import("./protocol/NegotiateProtocolVersion.rust"); +pub const NoticeResponse = @import("./protocol/NoticeResponse.rust"); +pub const NotificationResponse = @import("./protocol/NotificationResponse.rust"); +pub const ParameterDescription = @import("./protocol/ParameterDescription.rust"); +pub const ParameterStatus = @import("./protocol/ParameterStatus.rust"); +pub const Parse = @import("./protocol/Parse.rust"); +pub const PasswordMessage = @import("./protocol/PasswordMessage.rust"); +pub const ReadyForQuery = @import("./protocol/ReadyForQuery.rust"); +pub const RowDescription = @import("./protocol/RowDescription.rust"); +pub const SASLInitialResponse = @import("./protocol/SASLInitialResponse.rust"); +pub const SASLResponse = @import("./protocol/SASLResponse.rust"); +pub const StackReader = @import("./protocol/StackReader.rust"); +pub const StartupMessage = @import("./protocol/StartupMessage.rust"); +pub const Authentication = @import("./protocol/Authentication.rust").Authentication; +pub const ColumnIdentifier = @import("../shared/ColumnIdentifier.rust").ColumnIdentifier; +pub const DecoderWrap = @import("./protocol/DecoderWrap.rust").DecoderWrap; +pub const FieldMessage = @import("./protocol/FieldMessage.rust").FieldMessage; +pub const FieldType = @import("./protocol/FieldType.rust").FieldType; +pub const NewReader = @import("./protocol/NewReader.rust").NewReader; +pub const NewWriter = @import("./protocol/NewWriter.rust").NewWriter; +pub const PortalOrPreparedStatement = @import("./protocol/PortalOrPreparedStatement.rust").PortalOrPreparedStatement; +pub const WriteWrap = @import("./protocol/WriteWrap.rust").WriteWrap; const std = @import("std"); -const types = @import("./PostgresTypes.zig"); +const types = @import("./PostgresTypes.rust"); const toBytes = std.mem.toBytes; -const int_types = @import("./types/int_types.zig"); +const int_types = @import("./types/int_types.rust"); const Int32 = int_types.Int32; diff --git a/src/sql/postgres/PostgresTypes.zig b/src/sql/postgres/PostgresTypes.zig index cc19dda6d1c..62b6d08129f 100644 --- a/src/sql/postgres/PostgresTypes.zig +++ b/src/sql/postgres/PostgresTypes.zig @@ -1,11 +1,11 @@ -pub const @"bool" = @import("../../sql_jsc/postgres/types/bool.zig"); +pub const @"bool" = @import("../../sql_jsc/postgres/types/bool.rust"); -pub const bytea = @import("../../sql_jsc/postgres/types/bytea.zig"); -pub const date = @import("../../sql_jsc/postgres/types/date.zig"); -pub const json = @import("../../sql_jsc/postgres/types/json.zig"); -pub const string = @import("../../sql_jsc/postgres/types/PostgresString.zig"); -pub const AnyPostgresError = @import("./AnyPostgresError.zig").AnyPostgresError; -pub const Tag = @import("./types/Tag.zig").Tag; +pub const bytea = @import("../../sql_jsc/postgres/types/bytea.rust"); +pub const date = @import("../../sql_jsc/postgres/types/date.rust"); +pub const json = @import("../../sql_jsc/postgres/types/json.rust"); +pub const string = @import("../../sql_jsc/postgres/types/PostgresString.rust"); +pub const AnyPostgresError = @import("./AnyPostgresError.rust").AnyPostgresError; +pub const Tag = @import("./types/Tag.rust").Tag; pub const Int32 = int_types.Int32; pub const PostgresInt32 = int_types.int4; @@ -15,4 +15,4 @@ pub const int4 = int_types.int4; pub const int8 = int_types.int8; pub const short = int_types.short; -const int_types = @import("./types/int_types.zig"); +const int_types = @import("./types/int_types.rust"); diff --git a/src/sql/postgres/SocketMonitor.zig b/src/sql/postgres/SocketMonitor.zig index 87471f601c4..7ccca92159f 100644 --- a/src/sql/postgres/SocketMonitor.zig +++ b/src/sql/postgres/SocketMonitor.zig @@ -20,6 +20,6 @@ pub fn read(data: []const u8) void { const debug = bun.Output.scoped(.SocketMonitor, .visible); -const DebugSocketMonitorReader = @import("./DebugSocketMonitorReader.zig"); -const DebugSocketMonitorWriter = @import("./DebugSocketMonitorWriter.zig"); +const DebugSocketMonitorReader = @import("./DebugSocketMonitorReader.rust"); +const DebugSocketMonitorWriter = @import("./DebugSocketMonitorWriter.rust"); const bun = @import("bun"); diff --git a/src/sql/postgres/protocol/ArrayList.zig b/src/sql/postgres/protocol/ArrayList.zig index 6d8535fe0d2..9b43b70cbd8 100644 --- a/src/sql/postgres/protocol/ArrayList.zig +++ b/src/sql/postgres/protocol/ArrayList.zig @@ -15,5 +15,5 @@ pub fn pwrite(this: @This(), bytes: []const u8, i: usize) AnyPostgresError!void pub const Writer = NewWriter(@This()); const std = @import("std"); -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; -const NewWriter = @import("./NewWriter.zig").NewWriter; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; +const NewWriter = @import("./NewWriter.rust").NewWriter; diff --git a/src/sql/postgres/protocol/Authentication.zig b/src/sql/postgres/protocol/Authentication.zig index f567a5bbbdf..2ce40b827b2 100644 --- a/src/sql/postgres/protocol/Authentication.zig +++ b/src/sql/postgres/protocol/Authentication.zig @@ -175,6 +175,6 @@ const debug = bun.Output.scoped(.Postgres, .hidden); const bun = @import("bun"); const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const Data = @import("../../shared/Data.rust").Data; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/BackendKeyData.zig b/src/sql/postgres/protocol/BackendKeyData.zig index a3e0034bc4a..455298d8714 100644 --- a/src/sql/postgres/protocol/BackendKeyData.zig +++ b/src/sql/postgres/protocol/BackendKeyData.zig @@ -15,6 +15,6 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade }; } -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/Close.zig b/src/sql/postgres/protocol/Close.zig index fdff4e0eb69..8feed6be18f 100644 --- a/src/sql/postgres/protocol/Close.zig +++ b/src/sql/postgres/protocol/Close.zig @@ -30,8 +30,8 @@ pub const Close = struct { pub const write = WriteWrap(@This(), writeInternal); }; -const NewWriter = @import("./NewWriter.zig").NewWriter; +const NewWriter = @import("./NewWriter.rust").NewWriter; -const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.zig").PortalOrPreparedStatement; +const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.rust").PortalOrPreparedStatement; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; diff --git a/src/sql/postgres/protocol/CommandComplete.zig b/src/sql/postgres/protocol/CommandComplete.zig index fa554f7666b..86b4931aaf9 100644 --- a/src/sql/postgres/protocol/CommandComplete.zig +++ b/src/sql/postgres/protocol/CommandComplete.zig @@ -19,6 +19,6 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(CommandComplete, decodeInternal).decode; const bun = @import("bun"); -const Data = @import("../../shared/Data.zig").Data; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const Data = @import("../../shared/Data.rust").Data; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/CopyData.zig b/src/sql/postgres/protocol/CopyData.zig index ca26782a8d8..dd0a992eeae 100644 --- a/src/sql/postgres/protocol/CopyData.zig +++ b/src/sql/postgres/protocol/CopyData.zig @@ -30,10 +30,10 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const Int32 = @import("../types/int_types.zig").Int32; -const NewReader = @import("./NewReader.zig").NewReader; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const Data = @import("../../shared/Data.rust").Data; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const Int32 = @import("../types/int_types.rust").Int32; +const NewReader = @import("./NewReader.rust").NewReader; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; diff --git a/src/sql/postgres/protocol/CopyFail.zig b/src/sql/postgres/protocol/CopyFail.zig index 4904346662a..61ab99c40d1 100644 --- a/src/sql/postgres/protocol/CopyFail.zig +++ b/src/sql/postgres/protocol/CopyFail.zig @@ -30,12 +30,12 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const Data = @import("../../shared/Data.rust").Data; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const Int32 = int_types.Int32; diff --git a/src/sql/postgres/protocol/CopyInResponse.zig b/src/sql/postgres/protocol/CopyInResponse.zig index 9654855d8e7..8fdc8e8e022 100644 --- a/src/sql/postgres/protocol/CopyInResponse.zig +++ b/src/sql/postgres/protocol/CopyInResponse.zig @@ -9,5 +9,5 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(CopyInResponse, decodeInternal).decode; const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/CopyOutResponse.zig b/src/sql/postgres/protocol/CopyOutResponse.zig index dac843fff70..7b1c0a014b8 100644 --- a/src/sql/postgres/protocol/CopyOutResponse.zig +++ b/src/sql/postgres/protocol/CopyOutResponse.zig @@ -9,5 +9,5 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(CopyOutResponse, decodeInternal).decode; const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/DataRow.zig b/src/sql/postgres/protocol/DataRow.zig index bbb71ce5c95..1cba64380c5 100644 --- a/src/sql/postgres/protocol/DataRow.zig +++ b/src/sql/postgres/protocol/DataRow.zig @@ -24,8 +24,8 @@ pub fn decode(context: anytype, comptime ContextType: type, reader: NewReader(Co pub const null_int4 = 4294967295; -const Data = @import("../../shared/Data.zig").Data; +const Data = @import("../../shared/Data.rust").Data; -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; -const NewReader = @import("./NewReader.zig").NewReader; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/DecoderWrap.zig b/src/sql/postgres/protocol/DecoderWrap.zig index cfe77a55e16..10aed6ffe53 100644 --- a/src/sql/postgres/protocol/DecoderWrap.zig +++ b/src/sql/postgres/protocol/DecoderWrap.zig @@ -7,6 +7,6 @@ pub fn DecoderWrap(comptime Container: type, comptime decodeFn: anytype) type { }; } -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; -const NewReader = @import("./NewReader.zig").NewReader; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/Describe.zig b/src/sql/postgres/protocol/Describe.zig index ceadf317bd8..5f3853e9161 100644 --- a/src/sql/postgres/protocol/Describe.zig +++ b/src/sql/postgres/protocol/Describe.zig @@ -19,8 +19,8 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; -const NewWriter = @import("./NewWriter.zig").NewWriter; +const NewWriter = @import("./NewWriter.rust").NewWriter; -const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.zig").PortalOrPreparedStatement; +const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.rust").PortalOrPreparedStatement; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; diff --git a/src/sql/postgres/protocol/ErrorResponse.zig b/src/sql/postgres/protocol/ErrorResponse.zig index ce590ecfa04..e8edf44643b 100644 --- a/src/sql/postgres/protocol/ErrorResponse.zig +++ b/src/sql/postgres/protocol/ErrorResponse.zig @@ -29,10 +29,10 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(ErrorResponse, decodeInternal).decode; -pub const toJS = @import("../../../sql_jsc/postgres/protocol/error_response_jsc.zig").toJS; +pub const toJS = @import("../../../sql_jsc/postgres/protocol/error_response_jsc.rust").toJS; const bun = @import("bun"); const std = @import("std"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const FieldMessage = @import("./FieldMessage.zig").FieldMessage; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const FieldMessage = @import("./FieldMessage.rust").FieldMessage; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/Execute.zig b/src/sql/postgres/protocol/Execute.zig index 73be59f401f..712eee17556 100644 --- a/src/sql/postgres/protocol/Execute.zig +++ b/src/sql/postgres/protocol/Execute.zig @@ -18,9 +18,9 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.zig").PortalOrPreparedStatement; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const PortalOrPreparedStatement = @import("./PortalOrPreparedStatement.rust").PortalOrPreparedStatement; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const int4 = int_types.int4; diff --git a/src/sql/postgres/protocol/FieldDescription.zig b/src/sql/postgres/protocol/FieldDescription.zig index ccedc65fb4f..3749da36dcd 100644 --- a/src/sql/postgres/protocol/FieldDescription.zig +++ b/src/sql/postgres/protocol/FieldDescription.zig @@ -59,11 +59,11 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(FieldDescription, decodeInternal).decode; -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; -const ColumnIdentifier = @import("../../shared/ColumnIdentifier.zig").ColumnIdentifier; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; +const ColumnIdentifier = @import("../../shared/ColumnIdentifier.rust").ColumnIdentifier; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; -const types = @import("../PostgresTypes.zig"); +const types = @import("../PostgresTypes.rust"); const int4 = types.int4; const short = types.short; diff --git a/src/sql/postgres/protocol/FieldMessage.zig b/src/sql/postgres/protocol/FieldMessage.zig index cf4f214acc9..66e0b58c3e4 100644 --- a/src/sql/postgres/protocol/FieldMessage.zig +++ b/src/sql/postgres/protocol/FieldMessage.zig @@ -78,8 +78,8 @@ pub const FieldMessage = union(FieldType) { }; const std = @import("std"); -const FieldType = @import("./FieldType.zig").FieldType; -const NewReader = @import("./NewReader.zig").NewReader; +const FieldType = @import("./FieldType.rust").FieldType; +const NewReader = @import("./NewReader.rust").NewReader; const bun = @import("bun"); const String = bun.String; diff --git a/src/sql/postgres/protocol/NegotiateProtocolVersion.zig b/src/sql/postgres/protocol/NegotiateProtocolVersion.zig index 34cd4cd8856..046215bbe5d 100644 --- a/src/sql/postgres/protocol/NegotiateProtocolVersion.zig +++ b/src/sql/postgres/protocol/NegotiateProtocolVersion.zig @@ -33,9 +33,9 @@ pub fn decodeInternal( } const std = @import("std"); -const NewReader = @import("./NewReader.zig").NewReader; +const NewReader = @import("./NewReader.rust").NewReader; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const int4 = int_types.int4; const bun = @import("bun"); diff --git a/src/sql/postgres/protocol/NewReader.zig b/src/sql/postgres/protocol/NewReader.zig index 8fc1e22c685..757a2b1cc8f 100644 --- a/src/sql/postgres/protocol/NewReader.zig +++ b/src/sql/postgres/protocol/NewReader.zig @@ -112,9 +112,9 @@ pub fn NewReader(comptime Context: type) type { } const bun = @import("bun"); -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; -const Data = @import("../../shared/Data.zig").Data; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; +const Data = @import("../../shared/Data.rust").Data; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const PostgresInt32 = int_types.PostgresInt32; const PostgresShort = int_types.PostgresShort; diff --git a/src/sql/postgres/protocol/NewWriter.zig b/src/sql/postgres/protocol/NewWriter.zig index 6d756e95111..dd122c9811f 100644 --- a/src/sql/postgres/protocol/NewWriter.zig +++ b/src/sql/postgres/protocol/NewWriter.zig @@ -120,9 +120,9 @@ pub fn NewWriter(comptime Context: type) type { const bun = @import("bun"); const std = @import("std"); -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const Int32 = int_types.Int32; const PostgresInt32 = int_types.PostgresInt32; const PostgresInt64 = int_types.PostgresInt64; diff --git a/src/sql/postgres/protocol/NoticeResponse.zig b/src/sql/postgres/protocol/NoticeResponse.zig index 0f5315e50ae..ea9b76b9f67 100644 --- a/src/sql/postgres/protocol/NoticeResponse.zig +++ b/src/sql/postgres/protocol/NoticeResponse.zig @@ -19,10 +19,10 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade } pub const decode = DecoderWrap(NoticeResponse, decodeInternal).decode; -pub const toJS = @import("../../../sql_jsc/postgres/protocol/notice_response_jsc.zig").toJS; +pub const toJS = @import("../../../sql_jsc/postgres/protocol/notice_response_jsc.rust").toJS; const bun = @import("bun"); const std = @import("std"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const FieldMessage = @import("./FieldMessage.zig").FieldMessage; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const FieldMessage = @import("./FieldMessage.rust").FieldMessage; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/NotificationResponse.zig b/src/sql/postgres/protocol/NotificationResponse.zig index 17229e596dc..ef45a04fa7c 100644 --- a/src/sql/postgres/protocol/NotificationResponse.zig +++ b/src/sql/postgres/protocol/NotificationResponse.zig @@ -23,8 +23,8 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(NotificationResponse, decodeInternal).decode; const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; -const types = @import("../PostgresTypes.zig"); +const types = @import("../PostgresTypes.rust"); const int4 = types.int4; diff --git a/src/sql/postgres/protocol/ParameterDescription.zig b/src/sql/postgres/protocol/ParameterDescription.zig index 0838fd3eed5..9ddca48063d 100644 --- a/src/sql/postgres/protocol/ParameterDescription.zig +++ b/src/sql/postgres/protocol/ParameterDescription.zig @@ -23,14 +23,14 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(ParameterDescription, decodeInternal).decode; -// workaround for zig compiler TODO +// workaround for rust compiler TODO fn toInt32Slice(comptime Int: type, slice: []const u8) []align(1) const Int { return @as([*]align(1) const Int, @ptrCast(slice.ptr))[0 .. slice.len / @sizeOf((Int))]; } const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; -const types = @import("../PostgresTypes.zig"); +const types = @import("../PostgresTypes.rust"); const int4 = types.int4; diff --git a/src/sql/postgres/protocol/ParameterStatus.zig b/src/sql/postgres/protocol/ParameterStatus.zig index a74c0e89f8a..b30aa349ea8 100644 --- a/src/sql/postgres/protocol/ParameterStatus.zig +++ b/src/sql/postgres/protocol/ParameterStatus.zig @@ -21,6 +21,6 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(ParameterStatus, decodeInternal).decode; const bun = @import("bun"); -const Data = @import("../../shared/Data.zig").Data; -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const Data = @import("../../shared/Data.rust").Data; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/Parse.zig b/src/sql/postgres/protocol/Parse.zig index 6ff90ea6727..c1178a1973b 100644 --- a/src/sql/postgres/protocol/Parse.zig +++ b/src/sql/postgres/protocol/Parse.zig @@ -33,13 +33,13 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; -const types = @import("../PostgresTypes.zig"); +const types = @import("../PostgresTypes.rust"); const Int32 = types.Int32; const int4 = types.int4; -const zHelpers = @import("./zHelpers.zig"); +const zHelpers = @import("./zHelpers.rust"); const zCount = zHelpers.zCount; diff --git a/src/sql/postgres/protocol/PasswordMessage.zig b/src/sql/postgres/protocol/PasswordMessage.zig index c9c71194c62..1ea723e299e 100644 --- a/src/sql/postgres/protocol/PasswordMessage.zig +++ b/src/sql/postgres/protocol/PasswordMessage.zig @@ -23,8 +23,8 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const Int32 = @import("../types/int_types.zig").Int32; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const Data = @import("../../shared/Data.rust").Data; +const Int32 = @import("../types/int_types.rust").Int32; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; diff --git a/src/sql/postgres/protocol/ReadyForQuery.zig b/src/sql/postgres/protocol/ReadyForQuery.zig index 9e85665d9c8..b4cd331cc46 100644 --- a/src/sql/postgres/protocol/ReadyForQuery.zig +++ b/src/sql/postgres/protocol/ReadyForQuery.zig @@ -14,6 +14,6 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(ReadyForQuery, decodeInternal).decode; const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; -const TransactionStatusIndicator = @import("./TransactionStatusIndicator.zig").TransactionStatusIndicator; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; +const TransactionStatusIndicator = @import("./TransactionStatusIndicator.rust").TransactionStatusIndicator; diff --git a/src/sql/postgres/protocol/RowDescription.zig b/src/sql/postgres/protocol/RowDescription.zig index c4d9b27f5fd..b356c473fd7 100644 --- a/src/sql/postgres/protocol/RowDescription.zig +++ b/src/sql/postgres/protocol/RowDescription.zig @@ -37,7 +37,7 @@ pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReade pub const decode = DecoderWrap(RowDescription, decodeInternal).decode; -const FieldDescription = @import("./FieldDescription.zig"); +const FieldDescription = @import("./FieldDescription.rust"); const bun = @import("bun"); -const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap; -const NewReader = @import("./NewReader.zig").NewReader; +const DecoderWrap = @import("./DecoderWrap.rust").DecoderWrap; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/SASLInitialResponse.zig b/src/sql/postgres/protocol/SASLInitialResponse.zig index ce9ca6fe531..f3181fcb89f 100644 --- a/src/sql/postgres/protocol/SASLInitialResponse.zig +++ b/src/sql/postgres/protocol/SASLInitialResponse.zig @@ -28,8 +28,8 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const Int32 = @import("../types/int_types.zig").Int32; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const Data = @import("../../shared/Data.rust").Data; +const Int32 = @import("../types/int_types.rust").Int32; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; diff --git a/src/sql/postgres/protocol/SASLResponse.zig b/src/sql/postgres/protocol/SASLResponse.zig index 3a1b0d88ce3..91883571a4a 100644 --- a/src/sql/postgres/protocol/SASLResponse.zig +++ b/src/sql/postgres/protocol/SASLResponse.zig @@ -23,8 +23,8 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const Int32 = @import("../types/int_types.zig").Int32; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; +const Data = @import("../../shared/Data.rust").Data; +const Int32 = @import("../types/int_types.rust").Int32; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; const toBytes = std.mem.toBytes; diff --git a/src/sql/postgres/protocol/StackReader.zig b/src/sql/postgres/protocol/StackReader.zig index a540c5da4bd..31f2ecc9634 100644 --- a/src/sql/postgres/protocol/StackReader.zig +++ b/src/sql/postgres/protocol/StackReader.zig @@ -60,6 +60,6 @@ pub fn readZ(this: StackReader) AnyPostgresError!Data { } const bun = @import("bun"); -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; -const Data = @import("../../shared/Data.zig").Data; -const NewReader = @import("./NewReader.zig").NewReader; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; +const Data = @import("../../shared/Data.rust").Data; +const NewReader = @import("./NewReader.rust").NewReader; diff --git a/src/sql/postgres/protocol/StartupMessage.zig b/src/sql/postgres/protocol/StartupMessage.zig index 0115e4a3ba9..466dcad25b2 100644 --- a/src/sql/postgres/protocol/StartupMessage.zig +++ b/src/sql/postgres/protocol/StartupMessage.zig @@ -39,12 +39,12 @@ pub fn writeInternal( pub const write = WriteWrap(@This(), writeInternal).write; const std = @import("std"); -const Data = @import("../../shared/Data.zig").Data; -const NewWriter = @import("./NewWriter.zig").NewWriter; -const WriteWrap = @import("./WriteWrap.zig").WriteWrap; -const zFieldCount = @import("./zHelpers.zig").zFieldCount; +const Data = @import("../../shared/Data.rust").Data; +const NewWriter = @import("./NewWriter.rust").NewWriter; +const WriteWrap = @import("./WriteWrap.rust").WriteWrap; +const zFieldCount = @import("./zHelpers.rust").zFieldCount; const toBytes = std.mem.toBytes; -const int_types = @import("../types/int_types.zig"); +const int_types = @import("../types/int_types.rust"); const Int32 = int_types.Int32; const int4 = int_types.int4; diff --git a/src/sql/postgres/protocol/WriteWrap.zig b/src/sql/postgres/protocol/WriteWrap.zig index 080a75aaff3..ded1444865e 100644 --- a/src/sql/postgres/protocol/WriteWrap.zig +++ b/src/sql/postgres/protocol/WriteWrap.zig @@ -7,6 +7,6 @@ pub fn WriteWrap(comptime Container: type, comptime writeFn: anytype) type { }; } -const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError; +const AnyPostgresError = @import("../AnyPostgresError.rust").AnyPostgresError; -const NewWriter = @import("./NewWriter.zig").NewWriter; +const NewWriter = @import("./NewWriter.rust").NewWriter; diff --git a/src/sql/postgres/types/Tag.zig b/src/sql/postgres/types/Tag.zig index b8444d3c37e..2b0c0ba1bd0 100644 --- a/src/sql/postgres/types/Tag.zig +++ b/src/sql/postgres/types/Tag.zig @@ -244,7 +244,7 @@ pub const Tag = enum(short) { pub const toJSTypedArrayType = tag_jsc.toJSTypedArrayType; pub const toJS = tag_jsc.toJS; pub const fromJS = tag_jsc.fromJS; - const tag_jsc = @import("../../../sql_jsc/postgres/types/tag_jsc.zig"); + const tag_jsc = @import("../../../sql_jsc/postgres/types/tag_jsc.rust"); pub fn byteArrayType(comptime T: Tag) !type { return comptime switch (T) { @@ -263,5 +263,5 @@ pub const Tag = enum(short) { const std = @import("std"); -const int_types = @import("./int_types.zig"); +const int_types = @import("./int_types.rust"); const short = int_types.short; diff --git a/src/sql/shared/ColumnIdentifier.zig b/src/sql/shared/ColumnIdentifier.zig index e64352b54d5..39ffa2ac74b 100644 --- a/src/sql/shared/ColumnIdentifier.zig +++ b/src/sql/shared/ColumnIdentifier.zig @@ -35,4 +35,4 @@ pub const ColumnIdentifier = union(enum) { }; const std = @import("std"); -const Data = @import("./Data.zig").Data; +const Data = @import("./Data.rust").Data; diff --git a/src/sql_jsc/mysql.zig b/src/sql_jsc/mysql.zig index bb7f71381cc..c10b9be97b8 100644 --- a/src/sql_jsc/mysql.zig +++ b/src/sql_jsc/mysql.zig @@ -1,28 +1,28 @@ pub fn createBinding(globalObject: *jsc.JSGlobalObject) JSValue { const binding = JSValue.createEmptyObjectWithNullPrototype(globalObject); - binding.put(globalObject, ZigString.static("MySQLConnection"), MySQLConnection.js.getConstructor(globalObject)); - binding.put(globalObject, ZigString.static("init"), jsc.JSFunction.create(globalObject, "init", MySQLContext.init, 0, .{})); + binding.put(globalObject, RustString.static("MySQLConnection"), MySQLConnection.js.getConstructor(globalObject)); + binding.put(globalObject, RustString.static("init"), jsc.JSFunction.create(globalObject, "init", MySQLContext.init, 0, .{})); binding.put( globalObject, - ZigString.static("createQuery"), + RustString.static("createQuery"), jsc.JSFunction.create(globalObject, "createQuery", MySQLQuery.createInstance, 6, .{}), ); binding.put( globalObject, - ZigString.static("createConnection"), + RustString.static("createConnection"), jsc.JSFunction.create(globalObject, "createConnection", MySQLConnection.createInstance, 2, .{}), ); return binding; } -pub const MySQLConnection = @import("./mysql/JSMySQLConnection.zig"); -pub const MySQLContext = @import("./mysql/MySQLContext.zig"); -pub const MySQLQuery = @import("./mysql/JSMySQLQuery.zig"); +pub const MySQLConnection = @import("./mysql/JSMySQLConnection.rust"); +pub const MySQLContext = @import("./mysql/MySQLContext.rust"); +pub const MySQLQuery = @import("./mysql/JSMySQLQuery.rust"); const bun = @import("bun"); const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/sql_jsc/mysql/JSMySQLConnection.zig b/src/sql_jsc/mysql/JSMySQLConnection.zig index c925f03b586..8b50456e4a8 100644 --- a/src/sql_jsc/mysql/JSMySQLConnection.zig +++ b/src/sql_jsc/mysql/JSMySQLConnection.zig @@ -207,7 +207,7 @@ pub fn finalize(this: *@This()) void { this.deref(); } -/// Referenced by `dispatch.zig` (kind = `.mysql[_tls]`). +/// Referenced by `dispatch.rust` (kind = `.mysql[_tls]`). pub fn SocketHandler(comptime ssl: bool) type { return struct { pub const SocketType = uws.NewSocketHandler(ssl); @@ -779,18 +779,18 @@ pub const Writer = MySQLConnection.Writer; const debug = bun.Output.scoped(.MySQLConnection, .visible); -const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.zig"); -const CachedStructure = @import("../shared/CachedStructure.zig"); -const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.zig"); -const JSMySQLQuery = @import("./JSMySQLQuery.zig"); -const MySQLConnection = @import("./MySQLConnection.zig"); -const MySQLQueryResult = @import("../../sql/mysql/MySQLQueryResult.zig"); -const MySQLStatement = @import("./MySQLStatement.zig"); -const ResultSet = @import("./protocol/ResultSet.zig"); +const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.rust"); +const CachedStructure = @import("../shared/CachedStructure.rust"); +const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.rust"); +const JSMySQLQuery = @import("./JSMySQLQuery.rust"); +const MySQLConnection = @import("./MySQLConnection.rust"); +const MySQLQueryResult = @import("../../sql/mysql/MySQLQueryResult.rust"); +const MySQLStatement = @import("./MySQLStatement.rust"); +const ResultSet = @import("./protocol/ResultSet.rust"); const std = @import("std"); -const NewReader = @import("../../sql/mysql/protocol/NewReader.zig").NewReader; -const NewWriter = @import("../../sql/mysql/protocol/NewWriter.zig").NewWriter; -const SSLMode = @import("../../sql/mysql/SSLMode.zig").SSLMode; +const NewReader = @import("../../sql/mysql/protocol/NewReader.rust").NewReader; +const NewWriter = @import("../../sql/mysql/protocol/NewWriter.rust").NewWriter; +const SSLMode = @import("../../sql/mysql/SSLMode.rust").SSLMode; const bun = @import("bun"); const uws = bun.uws; diff --git a/src/sql_jsc/mysql/JSMySQLQuery.zig b/src/sql_jsc/mysql/JSMySQLQuery.zig index 46165e845b2..be37fbbba60 100644 --- a/src/sql_jsc/mysql/JSMySQLQuery.zig +++ b/src/sql_jsc/mysql/JSMySQLQuery.zig @@ -387,15 +387,15 @@ pub const toJS = js.toJS; const debug = bun.Output.scoped(.MySQLQuery, .visible); -const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.zig"); -const MySQLConnection = @import("./JSMySQLConnection.zig"); -const MySQLQuery = @import("./MySQLQuery.zig"); -const MySQLQueryResult = @import("../../sql/mysql/MySQLQueryResult.zig"); -const MySQLStatement = @import("./MySQLStatement.zig"); +const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.rust"); +const MySQLConnection = @import("./JSMySQLConnection.rust"); +const MySQLQuery = @import("./MySQLQuery.rust"); +const MySQLQueryResult = @import("../../sql/mysql/MySQLQueryResult.rust"); +const MySQLStatement = @import("./MySQLStatement.rust"); const bun = @import("bun"); const std = @import("std"); -const CommandTag = @import("../../sql/postgres/CommandTag.zig").CommandTag; -const SQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.zig").SQLQueryResultMode; +const CommandTag = @import("../../sql/postgres/CommandTag.rust").CommandTag; +const SQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.rust").SQLQueryResultMode; const jsc = bun.jsc; const JSRef = jsc.JSRef; diff --git a/src/sql_jsc/mysql/MySQLConnection.zig b/src/sql_jsc/mysql/MySQLConnection.zig index 19c20b7b790..0f080bd7a8f 100644 --- a/src/sql_jsc/mysql/MySQLConnection.zig +++ b/src/sql_jsc/mysql/MySQLConnection.zig @@ -1131,44 +1131,44 @@ fn handleResultSet(this: *MySQLConnection, comptime Context: type, reader: NewRe const PreparedStatementsMap = std.HashMapUnmanaged(u64, *MySQLStatement, bun.IdentityContext(u64), 80); const debug = bun.Output.scoped(.MySQLConnection, .visible); -pub const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.zig"); +pub const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.rust"); const MAX_PIPELINE_SIZE = std.math.maxInt(u16); // about 64KB per connection pub const PreparedStatementsMapGetOrPutResult = PreparedStatementsMap.GetOrPutResult; -const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.zig"); -const Auth = @import("../../sql/mysql/protocol/Auth.zig"); -const AuthSwitchRequest = @import("../../sql/mysql/protocol/AuthSwitchRequest.zig"); -const AuthSwitchResponse = @import("../../sql/mysql/protocol/AuthSwitchResponse.zig"); -const Capabilities = @import("../../sql/mysql/Capabilities.zig"); -const ColumnDefinition41 = @import("../../sql/mysql/protocol/ColumnDefinition41.zig"); -const EOFPacket = @import("../../sql/mysql/protocol/EOFPacket.zig"); -const HandshakeResponse41 = @import("../../sql/mysql/protocol/HandshakeResponse41.zig"); -const HandshakeV10 = @import("../../sql/mysql/protocol/HandshakeV10.zig"); -const JSMySQLConnection = @import("./JSMySQLConnection.zig"); -const JSMySQLQuery = @import("./JSMySQLQuery.zig"); -const LocalInfileRequest = @import("../../sql/mysql/protocol/LocalInfileRequest.zig"); -const MySQLRequestQueue = @import("./MySQLRequestQueue.zig"); -const MySQLStatement = @import("./MySQLStatement.zig"); -const OKPacket = @import("../../sql/mysql/protocol/OKPacket.zig"); -const PacketHeader = @import("../../sql/mysql/protocol/PacketHeader.zig"); -const ResultSetHeader = @import("../../sql/mysql/protocol/ResultSetHeader.zig"); -const SSLRequest = @import("../../sql/mysql/protocol/SSLRequest.zig"); -const SocketMonitor = @import("../../sql/postgres/SocketMonitor.zig"); -const StackReader = @import("../../sql/mysql/protocol/StackReader.zig"); -const StmtPrepareOKPacket = @import("../../sql/mysql/protocol/StmtPrepareOKPacket.zig"); +const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.rust"); +const Auth = @import("../../sql/mysql/protocol/Auth.rust"); +const AuthSwitchRequest = @import("../../sql/mysql/protocol/AuthSwitchRequest.rust"); +const AuthSwitchResponse = @import("../../sql/mysql/protocol/AuthSwitchResponse.rust"); +const Capabilities = @import("../../sql/mysql/Capabilities.rust"); +const ColumnDefinition41 = @import("../../sql/mysql/protocol/ColumnDefinition41.rust"); +const EOFPacket = @import("../../sql/mysql/protocol/EOFPacket.rust"); +const HandshakeResponse41 = @import("../../sql/mysql/protocol/HandshakeResponse41.rust"); +const HandshakeV10 = @import("../../sql/mysql/protocol/HandshakeV10.rust"); +const JSMySQLConnection = @import("./JSMySQLConnection.rust"); +const JSMySQLQuery = @import("./JSMySQLQuery.rust"); +const LocalInfileRequest = @import("../../sql/mysql/protocol/LocalInfileRequest.rust"); +const MySQLRequestQueue = @import("./MySQLRequestQueue.rust"); +const MySQLStatement = @import("./MySQLStatement.rust"); +const OKPacket = @import("../../sql/mysql/protocol/OKPacket.rust"); +const PacketHeader = @import("../../sql/mysql/protocol/PacketHeader.rust"); +const ResultSetHeader = @import("../../sql/mysql/protocol/ResultSetHeader.rust"); +const SSLRequest = @import("../../sql/mysql/protocol/SSLRequest.rust"); +const SocketMonitor = @import("../../sql/postgres/SocketMonitor.rust"); +const StackReader = @import("../../sql/mysql/protocol/StackReader.rust"); +const StmtPrepareOKPacket = @import("../../sql/mysql/protocol/StmtPrepareOKPacket.rust"); const std = @import("std"); -const AuthMethod = @import("../../sql/mysql/AuthMethod.zig").AuthMethod; -const CharacterSet = @import("../../sql/mysql/protocol/CharacterSet.zig").CharacterSet; -const ConnectionFlags = @import("../../sql/shared/ConnectionFlags.zig").ConnectionFlags; -const ConnectionState = @import("../../sql/mysql/ConnectionState.zig").ConnectionState; -const Data = @import("../../sql/shared/Data.zig").Data; -const NewReader = @import("../../sql/mysql/protocol/NewReader.zig").NewReader; -const NewWriter = @import("../../sql/mysql/protocol/NewWriter.zig").NewWriter; -const PacketType = @import("../../sql/mysql/protocol/PacketType.zig").PacketType; -const SSLMode = @import("../../sql/mysql/SSLMode.zig").SSLMode; -const StatusFlags = @import("../../sql/mysql/StatusFlags.zig").StatusFlags; -const TLSStatus = @import("../../sql/mysql/TLSStatus.zig").TLSStatus; +const AuthMethod = @import("../../sql/mysql/AuthMethod.rust").AuthMethod; +const CharacterSet = @import("../../sql/mysql/protocol/CharacterSet.rust").CharacterSet; +const ConnectionFlags = @import("../../sql/shared/ConnectionFlags.rust").ConnectionFlags; +const ConnectionState = @import("../../sql/mysql/ConnectionState.rust").ConnectionState; +const Data = @import("../../sql/shared/Data.rust").Data; +const NewReader = @import("../../sql/mysql/protocol/NewReader.rust").NewReader; +const NewWriter = @import("../../sql/mysql/protocol/NewWriter.rust").NewWriter; +const PacketType = @import("../../sql/mysql/protocol/PacketType.rust").PacketType; +const SSLMode = @import("../../sql/mysql/SSLMode.rust").SSLMode; +const StatusFlags = @import("../../sql/mysql/StatusFlags.rust").StatusFlags; +const TLSStatus = @import("../../sql/mysql/TLSStatus.rust").TLSStatus; const bun = @import("bun"); const BoringSSL = bun.BoringSSL; diff --git a/src/sql_jsc/mysql/MySQLQuery.zig b/src/sql_jsc/mysql/MySQLQuery.zig index 10191b9a632..f0aeda9bb58 100644 --- a/src/sql_jsc/mysql/MySQLQuery.zig +++ b/src/sql_jsc/mysql/MySQLQuery.zig @@ -142,7 +142,7 @@ fn runPreparedQuery( columns_value: JSValue, binding_value: JSValue, ) !void { - var query_str: ?bun.ZigString.Slice = null; + var query_str: ?bun.RustString.Slice = null; defer if (query_str) |str| str.deinit(); if (this.#statement == null) { @@ -318,17 +318,17 @@ pub inline fn getStatement(this: *const @This()) ?*MySQLStatement { const debug = bun.Output.scoped(.MySQLQuery, .visible); -const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.zig"); -const MySQLConnection = @import("./JSMySQLConnection.zig"); -const MySQLRequest = @import("../../sql/mysql/MySQLRequest.zig"); -const MySQLStatement = @import("./MySQLStatement.zig"); -const PreparedStatement = @import("../../sql/mysql/protocol/PreparedStatement.zig"); -const Signature = @import("./protocol/Signature.zig"); +const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.rust"); +const MySQLConnection = @import("./JSMySQLConnection.rust"); +const MySQLRequest = @import("../../sql/mysql/MySQLRequest.rust"); +const MySQLStatement = @import("./MySQLStatement.rust"); +const PreparedStatement = @import("../../sql/mysql/protocol/PreparedStatement.rust"); +const Signature = @import("./protocol/Signature.rust"); const bun = @import("bun"); -const QueryBindingIterator = @import("../shared/QueryBindingIterator.zig").QueryBindingIterator; -const SQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.zig").SQLQueryResultMode; -const Status = @import("../../sql/mysql/QueryStatus.zig").Status; -const Value = @import("../../sql/mysql/MySQLTypes.zig").Value; +const QueryBindingIterator = @import("../shared/QueryBindingIterator.rust").QueryBindingIterator; +const SQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.rust").SQLQueryResultMode; +const Status = @import("../../sql/mysql/QueryStatus.rust").Status; +const Value = @import("../../sql/mysql/MySQLTypes.rust").Value; const JSGlobalObject = bun.jsc.JSGlobalObject; const JSValue = bun.jsc.JSValue; diff --git a/src/sql_jsc/mysql/MySQLRequestQueue.zig b/src/sql_jsc/mysql/MySQLRequestQueue.zig index a52ae628668..364a3ccb3ba 100644 --- a/src/sql_jsc/mysql/MySQLRequestQueue.zig +++ b/src/sql_jsc/mysql/MySQLRequestQueue.zig @@ -219,8 +219,8 @@ const Queue = bun.LinearFifo(*JSMySQLQuery, .Dynamic); const debug = bun.Output.scoped(.MySQLRequestQueue, .visible); -const JSMySQLQuery = @import("./JSMySQLQuery.zig"); -const MySQLConnection = @import("./JSMySQLConnection.zig"); +const JSMySQLQuery = @import("./JSMySQLQuery.rust"); +const MySQLConnection = @import("./JSMySQLConnection.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/sql_jsc/mysql/MySQLStatement.zig b/src/sql_jsc/mysql/MySQLStatement.zig index 9eb0630a7d1..c2acdd44cf7 100644 --- a/src/sql_jsc/mysql/MySQLStatement.zig +++ b/src/sql_jsc/mysql/MySQLStatement.zig @@ -163,20 +163,20 @@ pub fn structure(this: *MySQLStatement, owner: JSValue, globalObject: *jsc.JSGlo return this.cached_structure; } -pub const Param = @import("../../sql/mysql/MySQLParam.zig").Param; +pub const Param = @import("../../sql/mysql/MySQLParam.rust").Param; const _ParamUnused = struct { type: types.FieldType, flags: ColumnDefinition41.ColumnFlags, }; const debug = bun.Output.scoped(.MySQLStatement, .hidden); -const CachedStructure = @import("../shared/CachedStructure.zig"); -const ColumnDefinition41 = @import("../../sql/mysql/protocol/ColumnDefinition41.zig"); -const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.zig"); -const Signature = @import("./protocol/Signature.zig"); +const CachedStructure = @import("../shared/CachedStructure.rust"); +const ColumnDefinition41 = @import("../../sql/mysql/protocol/ColumnDefinition41.rust"); +const ErrorPacket = @import("../../sql/mysql/protocol/ErrorPacket.rust"); +const Signature = @import("./protocol/Signature.rust"); const std = @import("std"); -const types = @import("../../sql/mysql/MySQLTypes.zig"); -const SQLDataCell = @import("../shared/SQLDataCell.zig").SQLDataCell; +const types = @import("../../sql/mysql/MySQLTypes.rust"); +const SQLDataCell = @import("../shared/SQLDataCell.rust").SQLDataCell; const bun = @import("bun"); const String = bun.String; diff --git a/src/sql_jsc/mysql/MySQLValue.zig b/src/sql_jsc/mysql/MySQLValue.zig index 642b2d9a99f..c3ad99be97e 100644 --- a/src/sql_jsc/mysql/MySQLValue.zig +++ b/src/sql_jsc/mysql/MySQLValue.zig @@ -1,5 +1,5 @@ //! `Value` union + JSC bridges for MySQL type encoding. Split from -//! `sql/mysql/MySQLTypes.zig` so the protocol layer keeps the pure +//! `sql/mysql/MySQLTypes.rust` so the protocol layer keeps the pure //! `CharacterSet`/`FieldType` enums without `JSValue` references. pub const fieldTypeFromJS = struct { @@ -102,7 +102,7 @@ pub const Value = union(enum) { float: f32, double: f64, - string: JSC.ZigString.Slice, + string: JSC.RustString.Slice, string_data: Data, bytes: Bytes, bytes_data: Data, @@ -122,7 +122,7 @@ pub const Value = union(enum) { /// alive — `params` is on the malloc heap and isn't scanned. `deinit()` /// unpins. pub const Bytes = struct { - slice: JSC.ZigString.Slice = .empty, + slice: JSC.RustString.Slice = .empty, /// JS ArrayBuffer/view to `unpinArrayBuffer` in `deinit()`. `.zero` /// when the slice is owned (FastTypedArray dupe), borrowed from a /// Blob store (nothing to unpin), or empty. GC rooting of this value @@ -219,7 +219,7 @@ pub const Value = union(enum) { // detached / null 0 => Value{ .bytes = .{} }, // FastTypedArray — tiny, GC-movable vector; dupe. - 1 => Value{ .bytes = .{ .slice = try JSC.ZigString.Slice.initDupe(bun.default_allocator, ptr[0..len]) } }, + 1 => Value{ .bytes = .{ .slice = try JSC.RustString.Slice.initDupe(bun.default_allocator, ptr[0..len]) } }, // Oversize/Wasteful/DataView/JSArrayBuffer — pinned // by the helper. Root the wrapper so GC can't // collect it (and free the backing store despite @@ -227,7 +227,7 @@ pub const Value = union(enum) { // a later parameter. 2 => blk: { roots.append(value); - break :blk Value{ .bytes = .{ .slice = JSC.ZigString.Slice.fromUTF8NeverFree(ptr[0..len]), .pinned = value } }; + break :blk Value{ .bytes = .{ .slice = JSC.RustString.Slice.fromUTF8NeverFree(ptr[0..len]), .pinned = value } }; }, else => unreachable, }; @@ -242,7 +242,7 @@ pub const Value = union(enum) { // the last reference and force GC. Root the wrapper so // the store survives until execute.write() has read it. roots.append(value); - return Value{ .bytes = .{ .slice = JSC.ZigString.Slice.fromUTF8NeverFree(blob.sharedView()) } }; + return Value{ .bytes = .{ .slice = JSC.RustString.Slice.fromUTF8NeverFree(blob.sharedView()) } }; } if (value.isString()) { @@ -630,11 +630,11 @@ extern fn JSC__JSValue__unpinArrayBuffer(v: JSC.JSValue) void; /// no unpin needed), 2 = pinned ArrayBuffer (caller must `unpinArrayBuffer`). extern fn JSC__JSValue__borrowBytesForOffThread(v: JSC.JSValue, out_ptr: *[*]const u8, out_len: *usize) i32; -const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.zig"); +const AnyMySQLError = @import("../../sql/mysql/protocol/AnyMySQLError.rust"); const std = @import("std"); -const Data = @import("../../sql/shared/Data.zig").Data; +const Data = @import("../../sql/shared/Data.rust").Data; -const types = @import("../../sql/mysql/MySQLTypes.zig"); +const types = @import("../../sql/mysql/MySQLTypes.rust"); const FieldType = types.FieldType; const bun = @import("bun"); @@ -642,4 +642,4 @@ const String = bun.String; const JSC = bun.jsc; const JSValue = JSC.JSValue; -const ZigString = JSC.ZigString; +const RustString = JSC.RustString; diff --git a/src/sql_jsc/mysql/protocol/DecodeBinaryValue.zig b/src/sql_jsc/mysql/protocol/DecodeBinaryValue.zig index 46d51351839..8a8a8715bd1 100644 --- a/src/sql_jsc/mysql/protocol/DecodeBinaryValue.zig +++ b/src/sql_jsc/mysql/protocol/DecodeBinaryValue.zig @@ -202,11 +202,11 @@ pub fn decodeBinaryValue(globalObject: *jsc.JSGlobalObject, field_type: types.Fi const debug = bun.Output.scoped(.MySQLDecodeBinaryValue, .visible); const std = @import("std"); -const types = @import("../../../sql/mysql/MySQLTypes.zig"); -const NewReader = @import("../../../sql/mysql/protocol/NewReader.zig").NewReader; -const SQLDataCell = @import("../../shared/SQLDataCell.zig").SQLDataCell; +const types = @import("../../../sql/mysql/MySQLTypes.rust"); +const NewReader = @import("../../../sql/mysql/protocol/NewReader.rust").NewReader; +const SQLDataCell = @import("../../shared/SQLDataCell.rust").SQLDataCell; -const Value = @import("../MySQLValue.zig").Value; +const Value = @import("../MySQLValue.rust").Value; const DateTime = Value.DateTime; const Time = Value.Time; diff --git a/src/sql_jsc/mysql/protocol/ResultSet.zig b/src/sql_jsc/mysql/protocol/ResultSet.zig index 53c2093f146..94c8e0d1fdd 100644 --- a/src/sql_jsc/mysql/protocol/ResultSet.zig +++ b/src/sql_jsc/mysql/protocol/ResultSet.zig @@ -1,4 +1,4 @@ -pub const Header = @import("../../../sql/mysql/protocol/ResultSetHeader.zig"); +pub const Header = @import("../../../sql/mysql/protocol/ResultSetHeader.rust"); pub const Row = struct { values: []SQLDataCell = &[_]SQLDataCell{}, @@ -256,20 +256,20 @@ pub const Row = struct { const debug = bun.Output.scoped(.MySQLResultSet, .visible); -const AnyMySQLError = @import("../../../sql/mysql/protocol/AnyMySQLError.zig"); -const CachedStructure = @import("../../shared/CachedStructure.zig"); -const ColumnDefinition41 = @import("../../../sql/mysql/protocol/ColumnDefinition41.zig"); +const AnyMySQLError = @import("../../../sql/mysql/protocol/AnyMySQLError.rust"); +const CachedStructure = @import("../../shared/CachedStructure.rust"); +const ColumnDefinition41 = @import("../../../sql/mysql/protocol/ColumnDefinition41.rust"); const bun = @import("bun"); const std = @import("std"); -const Data = @import("../../../sql/shared/Data.zig").Data; -const SQLDataCell = @import("../../shared/SQLDataCell.zig").SQLDataCell; -const SQLQueryResultMode = @import("../../../sql/shared/SQLQueryResultMode.zig").SQLQueryResultMode; -const decodeLengthInt = @import("../../../sql/mysql/protocol/EncodeInt.zig").decodeLengthInt; +const Data = @import("../../../sql/shared/Data.rust").Data; +const SQLDataCell = @import("../../shared/SQLDataCell.rust").SQLDataCell; +const SQLQueryResultMode = @import("../../../sql/shared/SQLQueryResultMode.rust").SQLQueryResultMode; +const decodeLengthInt = @import("../../../sql/mysql/protocol/EncodeInt.rust").decodeLengthInt; -const NewReader = @import("../../../sql/mysql/protocol/NewReader.zig").NewReader; -const decoderWrap = @import("../../../sql/mysql/protocol/NewReader.zig").decoderWrap; +const NewReader = @import("../../../sql/mysql/protocol/NewReader.rust").NewReader; +const decoderWrap = @import("../../../sql/mysql/protocol/NewReader.rust").decoderWrap; -const DecodeBinaryValue = @import("./DecodeBinaryValue.zig"); +const DecodeBinaryValue = @import("./DecodeBinaryValue.rust"); const decodeBinaryValue = DecodeBinaryValue.decodeBinaryValue; const jsc = bun.jsc; diff --git a/src/sql_jsc/mysql/protocol/Signature.zig b/src/sql_jsc/mysql/protocol/Signature.zig index c6820d95b0c..8c6f6d92dfd 100644 --- a/src/sql_jsc/mysql/protocol/Signature.zig +++ b/src/sql_jsc/mysql/protocol/Signature.zig @@ -76,10 +76,10 @@ pub fn generate(globalObject: *jsc.JSGlobalObject, query: []const u8, array_valu const bun = @import("bun"); const std = @import("std"); -const Param = @import("../MySQLStatement.zig").Param; -const QueryBindingIterator = @import("../../shared/QueryBindingIterator.zig").QueryBindingIterator; +const Param = @import("../MySQLStatement.rust").Param; +const QueryBindingIterator = @import("../../shared/QueryBindingIterator.rust").QueryBindingIterator; -const types = @import("../../../sql/mysql/MySQLTypes.zig"); +const types = @import("../../../sql/mysql/MySQLTypes.rust"); const FieldType = types.FieldType; const jsc = bun.jsc; diff --git a/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.zig b/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.zig index 5d0be5233c3..09eb400db1e 100644 --- a/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.zig +++ b/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.zig @@ -52,8 +52,8 @@ pub fn mysqlErrorToJS(globalObject: *jsc.JSGlobalObject, message: ?[]const u8, e } const bun = @import("bun"); -const Error = @import("../../../sql/mysql/protocol/AnyMySQLError.zig").Error; -const createMySQLError = @import("./error_packet_jsc.zig").createMySQLError; +const Error = @import("../../../sql/mysql/protocol/AnyMySQLError.rust").Error; +const createMySQLError = @import("./error_packet_jsc.rust").createMySQLError; const JSC = bun.jsc; const jsc = bun.jsc; diff --git a/src/sql_jsc/mysql/protocol/error_packet_jsc.zig b/src/sql_jsc/mysql/protocol/error_packet_jsc.zig index aa3576c004b..267b1ebb226 100644 --- a/src/sql_jsc/mysql/protocol/error_packet_jsc.zig +++ b/src/sql_jsc/mysql/protocol/error_packet_jsc.zig @@ -5,14 +5,14 @@ pub fn createMySQLError( ) bun.JSError!JSValue { const opts_obj = JSValue.createEmptyObject(globalObject, 0); opts_obj.ensureStillAlive(); - opts_obj.put(globalObject, JSC.ZigString.static("code"), try bun.String.createUTF8ForJS(globalObject, options.code)); + opts_obj.put(globalObject, JSC.RustString.static("code"), try bun.String.createUTF8ForJS(globalObject, options.code)); if (options.errno) |errno| { - opts_obj.put(globalObject, JSC.ZigString.static("errno"), JSC.JSValue.jsNumber(errno)); + opts_obj.put(globalObject, JSC.RustString.static("errno"), JSC.JSValue.jsNumber(errno)); } if (options.sqlState) |state| { - opts_obj.put(globalObject, JSC.ZigString.static("sqlState"), try bun.String.createUTF8ForJS(globalObject, state[0..])); + opts_obj.put(globalObject, JSC.RustString.static("sqlState"), try bun.String.createUTF8ForJS(globalObject, state[0..])); } - opts_obj.put(globalObject, JSC.ZigString.static("message"), try bun.String.createUTF8ForJS(globalObject, message)); + opts_obj.put(globalObject, JSC.RustString.static("message"), try bun.String.createUTF8ForJS(globalObject, message)); return opts_obj; } @@ -32,7 +32,7 @@ pub fn toJS(this: ErrorPacket, globalObject: *JSC.JSGlobalObject) JSValue { const bun = @import("bun"); -const ErrorPacket = @import("../../../sql/mysql/protocol/ErrorPacket.zig"); +const ErrorPacket = @import("../../../sql/mysql/protocol/ErrorPacket.rust"); const MySQLErrorOptions = ErrorPacket.MySQLErrorOptions; const JSC = bun.jsc; diff --git a/src/sql_jsc/postgres.zig b/src/sql_jsc/postgres.zig index 07e36b50cf5..89540f97fdc 100644 --- a/src/sql_jsc/postgres.zig +++ b/src/sql_jsc/postgres.zig @@ -1,30 +1,30 @@ pub fn createBinding(globalObject: *jsc.JSGlobalObject) JSValue { const binding = JSValue.createEmptyObjectWithNullPrototype(globalObject); - binding.put(globalObject, ZigString.static("PostgresSQLConnection"), PostgresSQLConnection.js.getConstructor(globalObject)); - binding.put(globalObject, ZigString.static("init"), jsc.JSFunction.create(globalObject, "init", PostgresSQLContext.init, 0, .{})); + binding.put(globalObject, RustString.static("PostgresSQLConnection"), PostgresSQLConnection.js.getConstructor(globalObject)); + binding.put(globalObject, RustString.static("init"), jsc.JSFunction.create(globalObject, "init", PostgresSQLContext.init, 0, .{})); binding.put( globalObject, - ZigString.static("createQuery"), + RustString.static("createQuery"), jsc.JSFunction.create(globalObject, "createQuery", PostgresSQLQuery.call, 6, .{}), ); binding.put( globalObject, - ZigString.static("createConnection"), + RustString.static("createConnection"), jsc.JSFunction.create(globalObject, "createConnection", PostgresSQLConnection.call, 2, .{}), ); return binding; } -pub const PostgresSQLConnection = @import("./postgres/PostgresSQLConnection.zig"); -pub const PostgresSQLContext = @import("./postgres/PostgresSQLContext.zig"); -pub const PostgresSQLQuery = @import("./postgres/PostgresSQLQuery.zig"); -pub const protocol = @import("../sql/postgres/PostgresProtocol.zig"); -pub const types = @import("../sql/postgres/PostgresTypes.zig"); +pub const PostgresSQLConnection = @import("./postgres/PostgresSQLConnection.rust"); +pub const PostgresSQLContext = @import("./postgres/PostgresSQLContext.rust"); +pub const PostgresSQLQuery = @import("./postgres/PostgresSQLQuery.rust"); +pub const protocol = @import("../sql/postgres/PostgresProtocol.rust"); +pub const types = @import("../sql/postgres/PostgresTypes.rust"); const bun = @import("bun"); const jsc = bun.jsc; const JSValue = jsc.JSValue; -const ZigString = jsc.ZigString; +const RustString = jsc.RustString; diff --git a/src/sql_jsc/postgres/AuthenticationState.zig b/src/sql_jsc/postgres/AuthenticationState.zig index f3535033772..b3ea4c7b365 100644 --- a/src/sql_jsc/postgres/AuthenticationState.zig +++ b/src/sql_jsc/postgres/AuthenticationState.zig @@ -16,4 +16,4 @@ pub const AuthenticationState = union(enum) { } }; -const SASL = @import("./SASL.zig"); +const SASL = @import("./SASL.rust"); diff --git a/src/sql_jsc/postgres/DataCell.zig b/src/sql_jsc/postgres/DataCell.zig index e930cb61db9..dc20fa8243e 100644 --- a/src/sql_jsc/postgres/DataCell.zig +++ b/src/sql_jsc/postgres/DataCell.zig @@ -1,4 +1,4 @@ -pub const SQLDataCell = @import("../shared/SQLDataCell.zig").SQLDataCell; +pub const SQLDataCell = @import("../shared/SQLDataCell.rust").SQLDataCell; fn parseBytea(hex: []const u8) !SQLDataCell { const len = hex.len / 2; @@ -1018,13 +1018,13 @@ extern fn Postgres__formatTimeTz(microseconds: i64, tzOffsetSeconds: i32, buffer const log = bun.Output.scoped(.PostgresDataCell, .visible); -const PostgresCachedStructure = @import("../shared/CachedStructure.zig"); -const protocol = @import("../../sql/postgres/PostgresProtocol.zig"); +const PostgresCachedStructure = @import("../shared/CachedStructure.rust"); +const protocol = @import("../../sql/postgres/PostgresProtocol.rust"); const std = @import("std"); -const Data = @import("../../sql/shared/Data.zig").Data; -const PostgresSQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.zig").SQLQueryResultMode; +const Data = @import("../../sql/shared/Data.rust").Data; +const PostgresSQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.rust").SQLQueryResultMode; -const types = @import("../../sql/postgres/PostgresTypes.zig"); +const types = @import("../../sql/postgres/PostgresTypes.rust"); const AnyPostgresError = types.AnyPostgresError; const int4 = types.int4; const short = types.short; diff --git a/src/sql_jsc/postgres/PostgresRequest.zig b/src/sql_jsc/postgres/PostgresRequest.zig index 0b79383a002..6696ce4dfa8 100644 --- a/src/sql_jsc/postgres/PostgresRequest.zig +++ b/src/sql_jsc/postgres/PostgresRequest.zig @@ -396,16 +396,16 @@ const debug = bun.Output.scoped(.Postgres, .visible); /// The PostgreSQL wire protocol uses 16-bit integers for parameter and column counts. const max_parameters = std.math.maxInt(u16); -const PostgresSQLConnection = @import("./PostgresSQLConnection.zig"); -const PostgresSQLQuery = @import("./PostgresSQLQuery.zig"); -const PostgresSQLStatement = @import("./PostgresSQLStatement.zig"); -const Signature = @import("./Signature.zig"); -const protocol = @import("../../sql/postgres/PostgresProtocol.zig"); +const PostgresSQLConnection = @import("./PostgresSQLConnection.rust"); +const PostgresSQLQuery = @import("./PostgresSQLQuery.rust"); +const PostgresSQLStatement = @import("./PostgresSQLStatement.rust"); +const Signature = @import("./Signature.rust"); +const protocol = @import("../../sql/postgres/PostgresProtocol.rust"); const std = @import("std"); -const QueryBindingIterator = @import("../shared/QueryBindingIterator.zig").QueryBindingIterator; +const QueryBindingIterator = @import("../shared/QueryBindingIterator.rust").QueryBindingIterator; -const types = @import("../../sql/postgres/PostgresTypes.zig"); -const AnyPostgresError = @import("../../sql/postgres/PostgresTypes.zig").AnyPostgresError; +const types = @import("../../sql/postgres/PostgresTypes.rust"); +const AnyPostgresError = @import("../../sql/postgres/PostgresTypes.rust").AnyPostgresError; const int4 = types.int4; const short = types.short; diff --git a/src/sql_jsc/postgres/PostgresSQLConnection.zig b/src/sql_jsc/postgres/PostgresSQLConnection.zig index 1b07fd5adc2..be83a3f5a67 100644 --- a/src/sql_jsc/postgres/PostgresSQLConnection.zig +++ b/src/sql_jsc/postgres/PostgresSQLConnection.zig @@ -773,7 +773,7 @@ pub fn call(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JS return js_value; } -/// Referenced by `dispatch.zig` (kind = `.postgres[_tls]`). Now the only +/// Referenced by `dispatch.rust` (kind = `.postgres[_tls]`). Now the only /// caller — `configure()` is gone. pub fn SocketHandler(comptime ssl: bool) type { return struct { @@ -1950,24 +1950,24 @@ pub const fromJS = js.fromJS; pub const fromJSDirect = js.fromJSDirect; pub const toJS = js.toJS; -const DataCell = @import("./DataCell.zig"); -const PostgresCachedStructure = @import("../shared/CachedStructure.zig"); -const PostgresRequest = @import("./PostgresRequest.zig"); -const PostgresSQLQuery = @import("./PostgresSQLQuery.zig"); -const PostgresSQLStatement = @import("./PostgresSQLStatement.zig"); -const SocketMonitor = @import("../../sql/postgres/SocketMonitor.zig"); -const protocol = @import("../../sql/postgres/PostgresProtocol.zig"); +const DataCell = @import("./DataCell.rust"); +const PostgresCachedStructure = @import("../shared/CachedStructure.rust"); +const PostgresRequest = @import("./PostgresRequest.rust"); +const PostgresSQLQuery = @import("./PostgresSQLQuery.rust"); +const PostgresSQLStatement = @import("./PostgresSQLStatement.rust"); +const SocketMonitor = @import("../../sql/postgres/SocketMonitor.rust"); +const protocol = @import("../../sql/postgres/PostgresProtocol.rust"); const std = @import("std"); -const AuthenticationState = @import("./AuthenticationState.zig").AuthenticationState; -const ConnectionFlags = @import("../../sql/shared/ConnectionFlags.zig").ConnectionFlags; -const Data = @import("../../sql/shared/Data.zig").Data; -const SSLMode = @import("../../sql/postgres/SSLMode.zig").SSLMode; -const Status = @import("../../sql/postgres/Status.zig").Status; -const TLSStatus = @import("../../sql/postgres/TLSStatus.zig").TLSStatus; - -const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const createPostgresError = @import("../../sql/postgres/AnyPostgresError.zig").createPostgresError; -const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.zig").postgresErrorToJS; +const AuthenticationState = @import("./AuthenticationState.rust").AuthenticationState; +const ConnectionFlags = @import("../../sql/shared/ConnectionFlags.rust").ConnectionFlags; +const Data = @import("../../sql/shared/Data.rust").Data; +const SSLMode = @import("../../sql/postgres/SSLMode.rust").SSLMode; +const Status = @import("../../sql/postgres/Status.rust").Status; +const TLSStatus = @import("../../sql/postgres/TLSStatus.rust").TLSStatus; + +const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const createPostgresError = @import("../../sql/postgres/AnyPostgresError.rust").createPostgresError; +const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.rust").postgresErrorToJS; const bun = @import("bun"); const BoringSSL = bun.BoringSSL; diff --git a/src/sql_jsc/postgres/PostgresSQLQuery.zig b/src/sql_jsc/postgres/PostgresSQLQuery.zig index 348996484f6..020aff5ca87 100644 --- a/src/sql_jsc/postgres/PostgresSQLQuery.zig +++ b/src/sql_jsc/postgres/PostgresSQLQuery.zig @@ -520,18 +520,18 @@ pub const fromJS = js.fromJS; pub const fromJSDirect = js.fromJSDirect; pub const toJS = js.toJS; -const PostgresRequest = @import("./PostgresRequest.zig"); -const PostgresSQLConnection = @import("./PostgresSQLConnection.zig"); -const PostgresSQLStatement = @import("./PostgresSQLStatement.zig"); -const Signature = @import("./Signature.zig"); +const PostgresRequest = @import("./PostgresRequest.rust"); +const PostgresSQLConnection = @import("./PostgresSQLConnection.rust"); +const PostgresSQLStatement = @import("./PostgresSQLStatement.rust"); +const Signature = @import("./Signature.rust"); const bun = @import("bun"); -const protocol = @import("../../sql/postgres/PostgresProtocol.zig"); +const protocol = @import("../../sql/postgres/PostgresProtocol.rust"); const std = @import("std"); -const CommandTag = @import("../../sql/postgres/CommandTag.zig").CommandTag; -const PostgresSQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.zig").SQLQueryResultMode; +const CommandTag = @import("../../sql/postgres/CommandTag.rust").CommandTag; +const PostgresSQLQueryResultMode = @import("../../sql/shared/SQLQueryResultMode.rust").SQLQueryResultMode; -const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.zig").postgresErrorToJS; +const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.rust").postgresErrorToJS; const jsc = bun.jsc; const JSGlobalObject = jsc.JSGlobalObject; diff --git a/src/sql_jsc/postgres/PostgresSQLStatement.zig b/src/sql_jsc/postgres/PostgresSQLStatement.zig index a930b369523..dbf81ea4d93 100644 --- a/src/sql_jsc/postgres/PostgresSQLStatement.zig +++ b/src/sql_jsc/postgres/PostgresSQLStatement.zig @@ -162,16 +162,16 @@ pub fn structure(this: *PostgresSQLStatement, owner: JSValue, globalObject: *jsc const debug = bun.Output.scoped(.Postgres, .visible); -const PostgresCachedStructure = @import("../shared/CachedStructure.zig"); -const Signature = @import("./Signature.zig"); -const protocol = @import("../../sql/postgres/PostgresProtocol.zig"); +const PostgresCachedStructure = @import("../shared/CachedStructure.rust"); +const Signature = @import("./Signature.rust"); +const protocol = @import("../../sql/postgres/PostgresProtocol.rust"); const std = @import("std"); -const DataCell = @import("./DataCell.zig").SQLDataCell; +const DataCell = @import("./DataCell.rust").SQLDataCell; -const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.zig").postgresErrorToJS; +const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const postgresErrorToJS = @import("../../sql/postgres/AnyPostgresError.rust").postgresErrorToJS; -const types = @import("../../sql/postgres/PostgresTypes.zig"); +const types = @import("../../sql/postgres/PostgresTypes.rust"); const int4 = types.int4; const bun = @import("bun"); diff --git a/src/sql_jsc/postgres/SASL.zig b/src/sql_jsc/postgres/SASL.zig index 7ae2bbd0f1a..e319892b9f1 100644 --- a/src/sql_jsc/postgres/SASL.zig +++ b/src/sql_jsc/postgres/SASL.zig @@ -85,7 +85,7 @@ pub fn deinit(this: *SASL) void { this.status = .init; } -const PostgresSQLConnection = @import("./PostgresSQLConnection.zig"); +const PostgresSQLConnection = @import("./PostgresSQLConnection.rust"); const std = @import("std"); const bun = @import("bun"); diff --git a/src/sql_jsc/postgres/Signature.zig b/src/sql_jsc/postgres/Signature.zig index 4e241d782d5..0af963177a1 100644 --- a/src/sql_jsc/postgres/Signature.zig +++ b/src/sql_jsc/postgres/Signature.zig @@ -103,9 +103,9 @@ pub fn generate(globalObject: *jsc.JSGlobalObject, query: []const u8, array_valu const bun = @import("bun"); const std = @import("std"); -const QueryBindingIterator = @import("../shared/QueryBindingIterator.zig").QueryBindingIterator; +const QueryBindingIterator = @import("../shared/QueryBindingIterator.rust").QueryBindingIterator; -const types = @import("../../sql/postgres/PostgresTypes.zig"); +const types = @import("../../sql/postgres/PostgresTypes.rust"); const int4 = types.int4; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/command_tag_jsc.zig b/src/sql_jsc/postgres/command_tag_jsc.zig index 45615ace14a..d914455b550 100644 --- a/src/sql_jsc/postgres/command_tag_jsc.zig +++ b/src/sql_jsc/postgres/command_tag_jsc.zig @@ -21,7 +21,7 @@ pub fn toJSNumber(this: CommandTag) JSValue { }; } -const CommandTag = @import("../../sql/postgres/CommandTag.zig").CommandTag; +const CommandTag = @import("../../sql/postgres/CommandTag.rust").CommandTag; const bun = @import("bun"); const String = bun.String; diff --git a/src/sql_jsc/postgres/error_jsc.zig b/src/sql_jsc/postgres/error_jsc.zig index 3ad9b64371e..37cfd93a95b 100644 --- a/src/sql_jsc/postgres/error_jsc.zig +++ b/src/sql_jsc/postgres/error_jsc.zig @@ -7,16 +7,16 @@ pub fn createPostgresError( ) bun.JSError!JSValue { const opts_obj = JSValue.createEmptyObject(globalObject, 0); opts_obj.ensureStillAlive(); - opts_obj.put(globalObject, jsc.ZigString.static("code"), try bun.String.createUTF8ForJS(globalObject, options.code)); + opts_obj.put(globalObject, jsc.RustString.static("code"), try bun.String.createUTF8ForJS(globalObject, options.code)); inline for (std.meta.fields(PostgresErrorOptions)) |field| { const FieldType = @typeInfo(@TypeOf(@field(options, field.name))); if (FieldType == .optional) { if (@field(options, field.name)) |value| { - opts_obj.put(globalObject, jsc.ZigString.static(field.name), try bun.String.createUTF8ForJS(globalObject, value)); + opts_obj.put(globalObject, jsc.RustString.static(field.name), try bun.String.createUTF8ForJS(globalObject, value)); } } } - opts_obj.put(globalObject, jsc.ZigString.static("message"), try bun.String.createUTF8ForJS(globalObject, message)); + opts_obj.put(globalObject, jsc.RustString.static("message"), try bun.String.createUTF8ForJS(globalObject, message)); return opts_obj; } @@ -82,8 +82,8 @@ pub fn postgresErrorToJS(globalObject: *jsc.JSGlobalObject, message: ?[]const u8 const std = @import("std"); -const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const PostgresErrorOptions = @import("../../sql/postgres/AnyPostgresError.zig").PostgresErrorOptions; +const AnyPostgresError = @import("../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const PostgresErrorOptions = @import("../../sql/postgres/AnyPostgresError.rust").PostgresErrorOptions; const bun = @import("bun"); const String = bun.String; diff --git a/src/sql_jsc/postgres/protocol/error_response_jsc.zig b/src/sql_jsc/postgres/protocol/error_response_jsc.zig index 15dce31ad0a..01e0583a906 100644 --- a/src/sql_jsc/postgres/protocol/error_response_jsc.zig +++ b/src/sql_jsc/postgres/protocol/error_response_jsc.zig @@ -122,8 +122,8 @@ pub fn toJS(this: ErrorResponse, globalObject: *jsc.JSGlobalObject) JSValue { }) catch |e| globalObject.takeError(e); } -const ErrorResponse = @import("../../../sql/postgres/protocol/ErrorResponse.zig"); -const createPostgresError = @import("../error_jsc.zig").createPostgresError; +const ErrorResponse = @import("../../../sql/postgres/protocol/ErrorResponse.rust"); +const createPostgresError = @import("../error_jsc.rust").createPostgresError; const bun = @import("bun"); const String = bun.String; diff --git a/src/sql_jsc/postgres/protocol/notice_response_jsc.zig b/src/sql_jsc/postgres/protocol/notice_response_jsc.zig index a0b85ba882d..2cce85946fa 100644 --- a/src/sql_jsc/postgres/protocol/notice_response_jsc.zig +++ b/src/sql_jsc/postgres/protocol/notice_response_jsc.zig @@ -18,10 +18,10 @@ pub fn toJS(this: NoticeResponse, globalObject: *jsc.JSGlobalObject) JSValue { _ = b.append("\n"); } - return jsc.ZigString.init(b.allocatedSlice()[0..b.len]).toJS(globalObject); + return jsc.RustString.init(b.allocatedSlice()[0..b.len]).toJS(globalObject); } -const NoticeResponse = @import("../../../sql/postgres/protocol/NoticeResponse.zig"); +const NoticeResponse = @import("../../../sql/postgres/protocol/NoticeResponse.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/PostgresString.zig b/src/sql_jsc/postgres/types/PostgresString.zig index 362e241df62..17b5f82ab32 100644 --- a/src/sql_jsc/postgres/types/PostgresString.zig +++ b/src/sql_jsc/postgres/types/PostgresString.zig @@ -40,10 +40,10 @@ pub fn toJS( } const bun = @import("bun"); -const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const Data = @import("../../../sql/shared/Data.zig").Data; +const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const Data = @import("../../../sql/shared/Data.rust").Data; -const int_types = @import("../../../sql/postgres/types/int_types.zig"); +const int_types = @import("../../../sql/postgres/types/int_types.rust"); const short = int_types.short; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/bool.zig b/src/sql_jsc/postgres/types/bool.zig index 874a121f77c..0077dbcae61 100644 --- a/src/sql_jsc/postgres/types/bool.zig +++ b/src/sql_jsc/postgres/types/bool.zig @@ -9,9 +9,9 @@ pub fn toJS( } const bun = @import("bun"); -const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; +const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; -const int_types = @import("../../../sql/postgres/types/int_types.zig"); +const int_types = @import("../../../sql/postgres/types/int_types.rust"); const short = int_types.short; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/bytea.zig b/src/sql_jsc/postgres/types/bytea.zig index 0e3109e2b41..f71b04d234a 100644 --- a/src/sql_jsc/postgres/types/bytea.zig +++ b/src/sql_jsc/postgres/types/bytea.zig @@ -13,10 +13,10 @@ pub fn toJS( } const bun = @import("bun"); -const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const Data = @import("../../../sql/shared/Data.zig").Data; +const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const Data = @import("../../../sql/shared/Data.rust").Data; -const int_types = @import("../../../sql/postgres/types/int_types.zig"); +const int_types = @import("../../../sql/postgres/types/int_types.rust"); const short = int_types.short; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/date.zig b/src/sql_jsc/postgres/types/date.zig index 630e8b0c367..342aa6f4801 100644 --- a/src/sql_jsc/postgres/types/date.zig +++ b/src/sql_jsc/postgres/types/date.zig @@ -46,9 +46,9 @@ pub fn toJS( const bun = @import("bun"); const std = @import("std"); -const Data = @import("../../../sql/shared/Data.zig").Data; +const Data = @import("../../../sql/shared/Data.rust").Data; -const int_types = @import("../../../sql/postgres/types/int_types.zig"); +const int_types = @import("../../../sql/postgres/types/int_types.rust"); const short = int_types.short; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/json.zig b/src/sql_jsc/postgres/types/json.zig index 284230caa17..ef353c60c72 100644 --- a/src/sql_jsc/postgres/types/json.zig +++ b/src/sql_jsc/postgres/types/json.zig @@ -17,10 +17,10 @@ pub fn toJS( } const bun = @import("bun"); -const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const Data = @import("../../../sql/shared/Data.zig").Data; +const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const Data = @import("../../../sql/shared/Data.rust").Data; -const int_types = @import("../../../sql/postgres/types/int_types.zig"); +const int_types = @import("../../../sql/postgres/types/int_types.rust"); const short = int_types.short; const jsc = bun.jsc; diff --git a/src/sql_jsc/postgres/types/tag_jsc.zig b/src/sql_jsc/postgres/types/tag_jsc.zig index c085fc2f3de..c17bca90ad9 100644 --- a/src/sql_jsc/postgres/types/tag_jsc.zig +++ b/src/sql_jsc/postgres/types/tag_jsc.zig @@ -1,4 +1,4 @@ -//! JSC bridges for `sql/postgres/types/Tag.zig`. The `Tag` OID enum and its +//! JSC bridges for `sql/postgres/types/Tag.rust`. The `Tag` OID enum and its //! pure helpers stay in `sql/`; only the `JSValue`/`JSGlobalObject`-touching //! conversion paths live here. @@ -140,16 +140,16 @@ pub fn fromJS(globalObject: *jsc.JSGlobalObject, value: JSValue) bun.JSError!Tag return .numeric; } -const @"bool" = @import("./bool.zig"); +const @"bool" = @import("./bool.rust"); const bun = @import("bun"); -const bytea = @import("./bytea.zig"); -const date = @import("./date.zig"); -const json = @import("./json.zig"); +const bytea = @import("./bytea.rust"); +const date = @import("./date.rust"); +const json = @import("./json.rust"); const std = @import("std"); -const string = @import("./PostgresString.zig"); -const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.zig").AnyPostgresError; -const Tag = @import("../../../sql/postgres/types/Tag.zig").Tag; +const string = @import("./PostgresString.rust"); +const AnyPostgresError = @import("../../../sql/postgres/AnyPostgresError.rust").AnyPostgresError; +const Tag = @import("../../../sql/postgres/types/Tag.rust").Tag; const jsc = bun.jsc; const JSValue = jsc.JSValue; diff --git a/src/sql_jsc/shared/QueryBindingIterator.zig b/src/sql_jsc/shared/QueryBindingIterator.zig index 24b6ccc36cb..a5c0ac26244 100644 --- a/src/sql_jsc/shared/QueryBindingIterator.zig +++ b/src/sql_jsc/shared/QueryBindingIterator.zig @@ -57,7 +57,7 @@ pub const QueryBindingIterator = union(enum) { } }; -const ObjectIterator = @import("./ObjectIterator.zig"); +const ObjectIterator = @import("./ObjectIterator.rust"); const bun = @import("bun"); const jsc = bun.jsc; diff --git a/src/sql_jsc/shared/SQLDataCell.zig b/src/sql_jsc/shared/SQLDataCell.zig index ae699cce859..60c65fdc8fa 100644 --- a/src/sql_jsc/shared/SQLDataCell.zig +++ b/src/sql_jsc/shared/SQLDataCell.zig @@ -181,7 +181,7 @@ pub const SQLDataCell = extern struct { }; const bun = @import("bun"); -const Data = @import("../../sql/shared/Data.zig").Data; +const Data = @import("../../sql/shared/Data.rust").Data; const jsc = bun.jsc; const JSValue = jsc.JSValue; diff --git a/src/standalone_graph/StandaloneModuleGraph.zig b/src/standalone_graph/StandaloneModuleGraph.zig index c9d5ab89b79..bef72fae0d6 100644 --- a/src/standalone_graph/StandaloneModuleGraph.zig +++ b/src/standalone_graph/StandaloneModuleGraph.zig @@ -219,7 +219,7 @@ pub const StandaloneModuleGraph = struct { return this.wtf_string.dupeRef(); } - pub const blob = @import("../runtime/api/standalone_graph_jsc.zig").fileBlob; + pub const blob = @import("../runtime/api/standalone_graph_jsc.rust").fileBlob; }; pub const LazySourceMap = union(enum) { @@ -270,7 +270,7 @@ pub const StandaloneModuleGraph = struct { }); stored.external_source_names = file_names; - stored.underlying_provider = .{ .data = @truncate(@intFromPtr(data)), .load_hint = .none, .kind = .zig }; + stored.underlying_provider = .{ .data = @truncate(@intFromPtr(data)), .load_hint = .none, .kind = .rust }; stored.is_standalone_module_graph = true; const parsed = bun.new(SourceMap.ParsedSourceMap, stored); @@ -1036,7 +1036,7 @@ pub const StandaloneModuleGraph = struct { return cloned_executable_fd; } - pub const CompileTarget = @import("../options_types/CompileTarget.zig"); + pub const CompileTarget = @import("../options_types/CompileTarget.rust"); pub fn download(allocator: std.mem.Allocator, target: *const CompileTarget, env: *bun.DotEnv.Loader) ![:0]const u8 { var exe_path_buf: bun.PathBuffer = undefined; diff --git a/src/string/MutableString.zig b/src/string/MutableString.zig index d88b5c74c58..16c83506710 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_parser/lexer_tables.zig"); + const JSLexerTables = @import("../js_parser/lexer_tables.rust"); // Common case: no gap necessary. No allocation necessary. needs_gap = !js_lexer.isIdentifierStart(cursor.c); diff --git a/src/string/escapeRegExp.zig b/src/string/escapeRegExp.zig index 6659a793964..a604c822cea 100644 --- a/src/string/escapeRegExp.zig +++ b/src/string/escapeRegExp.zig @@ -71,8 +71,8 @@ pub fn escapeRegExpForPackageNameMatching(input: []const u8, writer: *std.Io.Wri try writer.writeAll(remain); } -pub const jsEscapeRegExp = @import("../jsc/bun_string_jsc.zig").jsEscapeRegExp; -pub const jsEscapeRegExpForPackageNameMatching = @import("../jsc/bun_string_jsc.zig").jsEscapeRegExpForPackageNameMatching; +pub const jsEscapeRegExp = @import("../jsc/bun_string_jsc.rust").jsEscapeRegExp; +pub const jsEscapeRegExpForPackageNameMatching = @import("../jsc/bun_string_jsc.rust").jsEscapeRegExpForPackageNameMatching; const std = @import("std"); diff --git a/src/string/immutable.zig b/src/string/immutable.zig index d81747a68b8..b7839b5d6e1 100644 --- a/src/string/immutable.zig +++ b/src/string/immutable.zig @@ -1,6 +1,6 @@ const strings = @This(); -/// memmem is provided by libc on posix, but implemented in zig for windows. +/// memmem is provided by libc on posix, but implemented in rust for windows. pub const memmem = bun.sys.workaround_symbols.memmem; pub const Encoding = enum { @@ -1462,7 +1462,7 @@ pub fn encodeBytesToHex(destination: []u8, source: []const u8) usize { // This looks extremely redundant but it was the easiest way to make the compiler do the right thing // the more convienient "0123456789abcdef" string produces worse codegen - // https://zig.godbolt.org/z/bfdracEeq + // https://rust.godbolt.org/z/bfdracEeq const lower_16 = [16]u8{ byte2hex(input_chunk_4[0]), byte2hex(input_chunk_4[1]), @@ -1523,7 +1523,7 @@ pub fn encodeBytesToHex(destination: []u8, source: []const u8) usize { } /// Leave a single leading char -/// ```zig +/// ```rust /// trimSubsequentLeadingChars("foo\n\n\n\n", '\n') -> "foo\n" /// ``` pub fn trimSubsequentLeadingChars(slice: []const u8, char: u8) []const u8 { @@ -1826,7 +1826,7 @@ pub fn cmpStringsDesc(_: void, a: string, b: string) bool { return order(a, b) == .gt; } -/// Every time you read a non^2 sized integer, Zig masks off the extra bits. +/// Every time you read a non^2 sized integer, Rust masks off the extra bits. /// This is a meaningful performance difference, including in release builds. pub const u3_fast = u8; @@ -1967,7 +1967,7 @@ pub fn moveSlice(slice: string, from: string, to: string) string { return result; } -pub const ExactSizeMatcher = @import("./immutable/exact_size_matcher.zig").ExactSizeMatcher; +pub const ExactSizeMatcher = @import("./immutable/exact_size_matcher.rust").ExactSizeMatcher; pub const unicode_replacement = 0xFFFD; pub const unicode_replacement_str = brk: { @@ -2016,7 +2016,7 @@ pub fn leftHasAnyInRight(to_check: []const string, against: []const string) bool /// Also returns true if the input ends with the prefix (i.e. EOF) /// /// Example: -/// ```zig +/// ```rust /// // returns true /// hasPrefixWithWordBoundary("console.log", "console") // true /// hasPrefixWithWordBoundary("console.log", "log") // false @@ -2382,7 +2382,7 @@ pub const withoutTrailingSlashWindowsPath = paths_.withoutTrailingSlashWindowsPa pub const basename = paths_.basename; pub const log = bun.Output.scoped(.STR, .hidden); -pub const grapheme = @import("./immutable/grapheme.zig"); +pub const grapheme = @import("./immutable/grapheme.rust"); pub const CodePoint = i32; const string = []const u8; @@ -2417,12 +2417,12 @@ pub const ANSIIterator = extern struct { extern fn Bun__ANSI__next(it: *ANSIIterator) bool; }; -const escapeHTML_ = @import("./immutable/escapeHTML.zig"); -const escapeRegExp_ = @import("./escapeRegExp.zig"); -const paths_ = @import("./immutable/paths.zig"); +const escapeHTML_ = @import("./immutable/escapeHTML.rust"); +const escapeRegExp_ = @import("./escapeRegExp.rust"); +const paths_ = @import("./immutable/paths.rust"); const std = @import("std"); -const unicode = @import("./immutable/unicode.zig"); -const visible_ = @import("./immutable/visible.zig"); +const unicode = @import("./immutable/unicode.rust"); +const visible_ = @import("./immutable/visible.rust"); const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/string/string.zig b/src/string/string.zig index 01264e8f47c..7b55210b0d2 100644 --- a/src/string/string.zig +++ b/src/string/string.zig @@ -1,14 +1,14 @@ -pub const immutable = @import("./immutable.zig"); - -pub const HashedString = @import("./HashedString.zig"); -pub const MutableString = @import("./MutableString.zig"); -pub const PathString = @import("./PathString.zig").PathString; -pub const SmolStr = @import("./SmolStr.zig").SmolStr; -pub const StringBuilder = @import("./StringBuilder.zig"); -pub const StringJoiner = @import("./StringJoiner.zig"); -pub const WTFString = @import("./wtf.zig").WTFString; -pub const WTFStringImpl = @import("./wtf.zig").WTFStringImpl; -pub const WTFStringImplStruct = @import("./wtf.zig").WTFStringImplStruct; +pub const immutable = @import("./immutable.rust"); + +pub const HashedString = @import("./HashedString.rust"); +pub const MutableString = @import("./MutableString.rust"); +pub const PathString = @import("./PathString.rust").PathString; +pub const SmolStr = @import("./SmolStr.rust").SmolStr; +pub const StringBuilder = @import("./StringBuilder.rust"); +pub const StringJoiner = @import("./StringJoiner.rust"); +pub const WTFString = @import("./wtf.rust").WTFString; +pub const WTFStringImpl = @import("./wtf.rust").WTFStringImpl; +pub const WTFStringImplStruct = @import("./wtf.rust").WTFStringImplStruct; pub const Tag = enum(u8) { /// String is not valid. Observed on some failed operations. @@ -17,38 +17,38 @@ pub const Tag = enum(u8) { /// String is backed by a WTF::StringImpl from JavaScriptCore. /// Can be in either `latin1` or `utf16le` encodings. WTFStringImpl = 1, - /// Memory has an unknown owner, likely in Bun's Zig codebase. If `isGloballyAllocated` + /// Memory has an unknown owner, likely in Bun's Rust codebase. If `isGloballyAllocated` /// is set, then it is owned by mimalloc. When converted to a JS value it has to be cloned /// into a WTF::String. /// Can be in either `utf8` or `utf16le` encodings. - ZigString = 2, + RustString = 2, /// Static memory that is guaranteed to never be freed. When converted to WTF::String, /// the memory is not cloned, but instead referenced with WTF::ExternalStringImpl. /// Can be in either `utf8` or `utf16le` encodings. - StaticZigString = 3, + StaticRustString = 3, /// String is "" Empty = 4, }; pub const StringImpl = extern union { - ZigString: ZigString, + RustString: RustString, WTFStringImpl: WTFStringImpl, - StaticZigString: ZigString, + StaticRustString: RustString, Dead: void, Empty: void, }; -/// Prefer using String instead of ZigString in new code. +/// Prefer using String instead of RustString in new code. pub const String = extern struct { pub const name = "BunString"; tag: Tag, value: StringImpl, - pub const empty = String{ .tag = .Empty, .value = .{ .ZigString = .Empty } }; + pub const empty = String{ .tag = .Empty, .value = .{ .RustString = .Empty } }; pub const dead = String{ .tag = .Dead, .value = .{ .Dead = {} } }; - pub const StringImplAllocator = @import("./wtf.zig").StringImplAllocator; + pub const StringImplAllocator = @import("./wtf.rust").StringImplAllocator; pub fn toInt32(this: *const String) ?i32 { const val = bun.cpp.BunString__toInt32(this); @@ -57,11 +57,11 @@ pub const String = extern struct { } pub fn ascii(bytes: []const u8) String { - return String{ .tag = .ZigString, .value = .{ .ZigString = ZigString.init(bytes) } }; + return String{ .tag = .RustString, .value = .{ .RustString = RustString.init(bytes) } }; } pub fn isGlobal(this: String) bool { - return this.tag == Tag.ZigString and this.value.ZigString.isGloballyAllocated(); + return this.tag == Tag.RustString and this.value.RustString.isGloballyAllocated(); } pub fn ensureHash(this: String) void { @@ -90,7 +90,7 @@ pub const String = extern struct { fn toOwnedSliceImpl(this: String, allocator: std.mem.Allocator) !struct { []u8, AsciiStatus } { return switch (this.tag) { - .ZigString => .{ try this.value.ZigString.toOwnedSlice(allocator), .unknown }, + .RustString => .{ try this.value.RustString.toOwnedSlice(allocator), .unknown }, .WTFStringImpl => blk: { const utf8_slice = this.value.WTFStringImpl.toUTF8WithoutRef(allocator); // `utf8_slice.allocator` is either null, or `allocator`. @@ -107,8 +107,8 @@ pub const String = extern struct { // `owned_slice.allocator` is guaranteed to be `allocator`. break :blk .{ owned_slice.mut(), ascii_status }; }, - .StaticZigString => .{ - try this.value.StaticZigString.toOwnedSlice(allocator), .unknown, + .StaticRustString => .{ + try this.value.StaticRustString.toOwnedSlice(allocator), .unknown, }, else => return .{ &.{}, .all_ascii }, // trivially all ascii }; @@ -253,7 +253,7 @@ pub const String = extern struct { if (this.isUTF16()) { const new, const bytes = createUninitialized(.utf16, this.length()); if (new.tag != .Dead) { - @memcpy(bytes, this.value.ZigString.utf16Slice()); + @memcpy(bytes, this.value.RustString.utf16Slice()); } return new; } @@ -292,8 +292,8 @@ pub const String = extern struct { pub fn utf8ByteLength(this: String) usize { return switch (this.tag) { .WTFStringImpl => this.value.WTFStringImpl.utf8ByteLength(), - .ZigString => this.value.ZigString.utf8ByteLength(), - .StaticZigString => this.value.StaticZigString.utf8ByteLength(), + .RustString => this.value.RustString.utf8ByteLength(), + .StaticRustString => this.value.StaticRustString.utf8ByteLength(), .Dead, .Empty => 0, }; } @@ -301,7 +301,7 @@ pub const String = extern struct { pub fn utf16ByteLength(this: String) usize { return switch (this.tag) { .WTFStringImpl => this.value.WTFStringImpl.utf16ByteLength(), - .StaticZigString, .ZigString => this.value.ZigString.utf16ByteLength(), + .StaticRustString, .RustString => this.value.RustString.utf16ByteLength(), .Dead, .Empty => 0, }; } @@ -309,7 +309,7 @@ pub const String = extern struct { pub fn latin1ByteLength(this: String) usize { return switch (this.tag) { .WTFStringImpl => this.value.WTFStringImpl.latin1ByteLength(), - .StaticZigString, .ZigString => this.value.ZigString.latin1ByteLength(), + .StaticRustString, .RustString => this.value.RustString.latin1ByteLength(), .Dead, .Empty => 0, }; } @@ -319,11 +319,11 @@ pub const String = extern struct { return this; } - return String.init(this.toZigString().trunc(len)); + return String.init(this.toRustString().trunc(len)); } pub fn toOwnedSliceZ(this: String, allocator: std.mem.Allocator) OOM![:0]u8 { - return this.toZigString().toOwnedSliceZ(allocator); + return this.toRustString().toOwnedSliceZ(allocator); } /// Create a bun.String from a slice. This is never a copy. @@ -332,16 +332,16 @@ pub const String = extern struct { const Type = @TypeOf(value); return switch (Type) { String => value, - ZigString => .{ .tag = .ZigString, .value = .{ .ZigString = value } }, - [:0]u8, []u8, [:0]const u8, []const u8 => .{ .tag = .ZigString, .value = .{ .ZigString = ZigString.fromBytes(value) } }, - [:0]u16, []u16, [:0]const u16, []const u16 => .{ .tag = .ZigString, .value = .{ .ZigString = ZigString.from16Slice(value) } }, + RustString => .{ .tag = .RustString, .value = .{ .RustString = value } }, + [:0]u8, []u8, [:0]const u8, []const u8 => .{ .tag = .RustString, .value = .{ .RustString = RustString.fromBytes(value) } }, + [:0]u16, []u16, [:0]const u16, []const u16 => .{ .tag = .RustString, .value = .{ .RustString = RustString.from16Slice(value) } }, WTFStringImpl => .{ .tag = .WTFStringImpl, .value = .{ .WTFStringImpl = value } }, - *const ZigString, *ZigString => .{ .tag = .ZigString, .value = .{ .ZigString = value.* } }, + *const RustString, *RustString => .{ .tag = .RustString, .value = .{ .RustString = value.* } }, *const [0:0]u8 => .{ .tag = .Empty, .value = .{ .Empty = {} } }, else => { const info = @typeInfo(Type); - // Zig string literals + // Rust string literals if (info == .pointer and info.pointer.size == .one and info.pointer.is_const) { const child_info = @typeInfo(info.pointer.child); if (child_info == .array and child_info.array.child == u8) { @@ -357,8 +357,8 @@ pub const String = extern struct { pub fn static(input: [:0]const u8) String { return .{ - .tag = .StaticZigString, - .value = .{ .StaticZigString = ZigString.init(input) }, + .tag = .StaticRustString, + .value = .{ .StaticRustString = RustString.init(input) }, }; } @@ -472,7 +472,7 @@ pub const String = extern struct { /// - Never allocates or copies any memory /// - Does not increment reference counts pub fn borrowUTF8(value: []const u8) String { - return String.init(ZigString.initUTF8(value)); + return String.init(RustString.initUTF8(value)); } /// Create a `String` from a UTF-16 slice. @@ -485,11 +485,11 @@ pub const String = extern struct { /// - Never allocates or copies any memory /// - Does not increment reference counts pub fn borrowUTF16(value: []const u16) String { - return String.init(ZigString.initUTF16(value)); + return String.init(RustString.initUTF16(value)); } pub fn initLatin1OrASCIIView(value: []const u8) String { - return String.init(ZigString.init(value)); + return String.init(RustString.init(value)); } /// Create a `String` from a byte slice. @@ -502,11 +502,11 @@ pub const String = extern struct { /// - Never allocates or copies any memory /// - Does not increment reference counts pub fn fromBytes(value: []const u8) String { - return String.init(ZigString.fromBytes(value)); + return String.init(RustString.fromBytes(value)); } pub fn format(self: String, writer: *std.Io.Writer) !void { - try self.toZigString().format(writer); + try self.toRustString().format(writer); } pub const fromJS = string_jsc.fromJS; @@ -515,15 +515,15 @@ pub const String = extern struct { /// calls toJS on all elements of `array`. pub const toJSArray = string_jsc.toJSArray; - pub fn toZigString(this: String) ZigString { - if (this.tag == .StaticZigString or this.tag == .ZigString) { - return this.value.ZigString; + pub fn toRustString(this: String) RustString { + if (this.tag == .StaticRustString or this.tag == .RustString) { + return this.value.RustString; } if (this.tag == .WTFStringImpl) - return this.value.WTFStringImpl.toZigString(); + return this.value.WTFStringImpl.toRustString(); - return ZigString.Empty; + return RustString.Empty; } pub fn toWTF(this: *String) void { @@ -536,7 +536,7 @@ pub const String = extern struct { return if (this.tag == .WTFStringImpl) this.value.WTFStringImpl.length() else - this.toZigString().length(); + this.toRustString().length(); } pub inline fn utf16(self: String) []const u16 { @@ -546,7 +546,7 @@ pub const String = extern struct { return self.value.WTFStringImpl.utf16Slice(); } - return self.toZigString().utf16SliceAligned(); + return self.toRustString().utf16SliceAligned(); } pub inline fn latin1(self: String) []const u8 { @@ -557,14 +557,14 @@ pub const String = extern struct { return self.value.WTFStringImpl.latin1Slice(); } - return self.toZigString().slice(); + return self.toRustString().slice(); } pub fn isUTF8(self: String) bool { - if (!(self.tag == .ZigString or self.tag == .StaticZigString)) + if (!(self.tag == .RustString or self.tag == .StaticRustString)) return false; - return self.value.ZigString.isUTF8(); + return self.value.RustString.isUTF8(); } pub inline fn asUTF8(self: String) ?[]const u8 { @@ -576,13 +576,13 @@ pub const String = extern struct { return null; } - if (self.tag == .ZigString or self.tag == .StaticZigString) { - if (self.value.ZigString.isUTF8()) { - return self.value.ZigString.slice(); + if (self.tag == .RustString or self.tag == .StaticRustString) { + if (self.value.RustString.isUTF8()) { + return self.value.RustString.slice(); } - if (bun.strings.isAllASCII(self.toZigString().slice())) { - return self.value.ZigString.slice(); + if (bun.strings.isAllASCII(self.toRustString().slice())) { + return self.value.RustString.slice(); } return null; @@ -603,13 +603,13 @@ pub const String = extern struct { return .latin1; } - pub fn githubAction(self: String) ZigString.GithubActionFormatter { - return self.toZigString().githubAction(); + pub fn githubAction(self: String) RustString.GithubActionFormatter { + return self.toRustString().githubAction(); } pub fn byteSlice(this: String) []const u8 { return switch (this.tag) { - .ZigString, .StaticZigString => this.value.ZigString.byteSlice(), + .RustString, .StaticRustString => this.value.RustString.byteSlice(), .WTFStringImpl => this.value.WTFStringImpl.byteSlice(), else => &[_]u8{}, }; @@ -619,8 +619,8 @@ pub const String = extern struct { if (self.tag == .WTFStringImpl) return !self.value.WTFStringImpl.is8Bit(); - if (self.tag == .ZigString or self.tag == .StaticZigString) - return self.value.ZigString.is16Bit(); + if (self.tag == .RustString or self.tag == .StaticRustString) + return self.value.RustString.is16Bit(); return false; } @@ -640,27 +640,27 @@ pub const String = extern struct { } pub fn encode(self: String, enc: jsc.Node.Encoding) []u8 { - return self.toZigString().encodeWithAllocator(bun.default_allocator, enc); + return self.toRustString().encodeWithAllocator(bun.default_allocator, enc); } pub inline fn utf8(self: String) []const u8 { if (comptime bun.Environment.allow_assert) { - bun.assert(self.tag == .ZigString or self.tag == .StaticZigString); + bun.assert(self.tag == .RustString or self.tag == .StaticRustString); bun.assert(self.canBeUTF8()); } - return self.value.ZigString.slice(); + return self.value.RustString.slice(); } pub fn canBeUTF8(self: String) bool { if (self.tag == .WTFStringImpl) return self.value.WTFStringImpl.is8Bit() and bun.strings.isAllASCII(self.value.WTFStringImpl.latin1Slice()); - if (self.tag == .ZigString or self.tag == .StaticZigString) { - if (self.value.ZigString.isUTF8()) { + if (self.tag == .RustString or self.tag == .StaticRustString) { + if (self.value.RustString.isUTF8()) { return true; } - return bun.strings.isAllASCII(self.toZigString().slice()); + return bun.strings.isAllASCII(self.toRustString().slice()); } return self.tag == .Empty; @@ -673,55 +673,55 @@ pub const String = extern struct { pub fn substringWithLen(this: String, start_index: usize, end_index: usize) String { switch (this.tag) { - .ZigString, .StaticZigString => { - return String.init(this.value.ZigString.substringWithLen(start_index, end_index)); + .RustString, .StaticRustString => { + return String.init(this.value.RustString.substringWithLen(start_index, end_index)); }, .WTFStringImpl => { if (this.value.WTFStringImpl.is8Bit()) { - return String.init(ZigString.init(this.value.WTFStringImpl.latin1Slice()[start_index..end_index])); + return String.init(RustString.init(this.value.WTFStringImpl.latin1Slice()[start_index..end_index])); } else { - return String.init(ZigString.initUTF16(this.value.WTFStringImpl.utf16Slice()[start_index..end_index])); + return String.init(RustString.initUTF16(this.value.WTFStringImpl.utf16Slice()[start_index..end_index])); } }, else => return this, } } - pub fn toUTF8(this: String, allocator: std.mem.Allocator) ZigString.Slice { + pub fn toUTF8(this: String, allocator: std.mem.Allocator) RustString.Slice { if (this.tag == .WTFStringImpl) { return this.value.WTFStringImpl.toUTF8(allocator); } - if (this.tag == .ZigString) { - return this.value.ZigString.toSlice(allocator); + if (this.tag == .RustString) { + return this.value.RustString.toSlice(allocator); } - if (this.tag == .StaticZigString) { - return ZigString.Slice.fromUTF8NeverFree(this.value.StaticZigString.slice()); + if (this.tag == .StaticRustString) { + return RustString.Slice.fromUTF8NeverFree(this.value.StaticRustString.slice()); } - return ZigString.Slice.empty; + return RustString.Slice.empty; } /// This is the same as toUTF8, but it doesn't increment the reference count for latin1 strings - pub fn toUTF8WithoutRef(this: String, allocator: std.mem.Allocator) ZigString.Slice { + pub fn toUTF8WithoutRef(this: String, allocator: std.mem.Allocator) RustString.Slice { if (this.tag == .WTFStringImpl) { return this.value.WTFStringImpl.toUTF8WithoutRef(allocator); } - if (this.tag == .ZigString) { - return this.value.ZigString.toSlice(allocator); + if (this.tag == .RustString) { + return this.value.RustString.toSlice(allocator); } - if (this.tag == .StaticZigString) { - return ZigString.Slice.fromUTF8NeverFree(this.value.StaticZigString.slice()); + if (this.tag == .StaticRustString) { + return RustString.Slice.fromUTF8NeverFree(this.value.StaticRustString.slice()); } - return ZigString.Slice.empty; + return RustString.Slice.empty; } /// Equivalent to calling `toUTF8WithoutRef` followed by `cloneIfBorrowed`. - pub fn toUTF8Owned(this: String, allocator: std.mem.Allocator) ZigString.Slice { + pub fn toUTF8Owned(this: String, allocator: std.mem.Allocator) RustString.Slice { return bun.handleOom(this.toUTF8WithoutRef(allocator).cloneIfBorrowed(allocator)); } @@ -747,7 +747,7 @@ pub const String = extern struct { if (slice.allocator.isNull()) { // This is an ASCII latin1 string with the same reference as the original. return .{ - .utf8 = ZigString.Slice.init(allocator, try allocator.dupe(u8, slice.slice())), + .utf8 = RustString.Slice.init(allocator, try allocator.dupe(u8, slice.slice())), .underlying = empty, }; } @@ -776,7 +776,7 @@ pub const String = extern struct { // We didn't clone anything, so let's conserve memory by re-using the existing WTFStringImpl return .{ - .utf8 = ZigString.Slice.init(this.value.WTFStringImpl.refCountAllocator(), slice.slice()), + .utf8 = RustString.Slice.init(this.value.WTFStringImpl.refCountAllocator(), slice.slice()), .underlying = this.*, }; } @@ -817,13 +817,13 @@ pub const String = extern struct { } pub fn eqlComptime(this: String, comptime value: []const u8) bool { - return this.toZigString().eqlComptime(value); + return this.toRustString().eqlComptime(value); } pub fn is8Bit(this: String) bool { return switch (this.tag) { .WTFStringImpl => this.value.WTFStringImpl.is8Bit(), - .ZigString => !this.value.ZigString.is16Bit(), + .RustString => !this.value.RustString.is16Bit(), else => true, }; } @@ -834,7 +834,7 @@ pub const String = extern struct { } return switch (this.tag) { .WTFStringImpl => if (this.value.WTFStringImpl.is8Bit()) this.value.WTFStringImpl.latin1Slice()[index] else this.value.WTFStringImpl.utf16Slice()[index], - .ZigString, .StaticZigString => if (!this.value.ZigString.is16Bit()) this.value.ZigString.slice()[index] else this.value.ZigString.utf16Slice()[index], + .RustString, .StaticRustString => if (!this.value.RustString.is16Bit()) this.value.RustString.slice()[index] else this.value.RustString.utf16Slice()[index], else => 0, }; } @@ -970,7 +970,7 @@ pub const String = extern struct { return this.value.WTFStringImpl.hasPrefix(value); } - var str = this.toZigString(); + var str = this.toRustString(); if (str.len < value.len) return false; return str.substringWithLen(0, value.len).eqlComptime(value); @@ -1008,11 +1008,11 @@ pub const String = extern struct { } pub fn eqlUTF8(this: String, other: []const u8) bool { - return this.toZigString().eql(ZigString.fromUTF8(other)); + return this.toRustString().eql(RustString.fromUTF8(other)); } pub fn eql(this: String, other: String) bool { - return this.toZigString().eql(other.toZigString()); + return this.toRustString().eql(other.toRustString()); } pub const jsGetStringWidth = string_jsc.jsGetStringWidth; @@ -1020,20 +1020,20 @@ pub const String = extern struct { /// Reports owned allocation size, not the actual size of the string. pub fn estimatedSize(this: *const String) usize { return switch (this.tag) { - .Dead, .Empty, .StaticZigString => 0, - .ZigString => this.value.ZigString.len, + .Dead, .Empty, .StaticRustString => 0, + .RustString => this.value.RustString.len, .WTFStringImpl => this.value.WTFStringImpl.byteLength(), }; } - // TODO: move ZigString.Slice here + // TODO: move RustString.Slice here /// A UTF-8 encoded slice tied to the lifetime of a `bun.String` /// Must call `.deinit` to release memory - pub const Slice = ZigString.Slice; + pub const Slice = RustString.Slice; }; pub const SliceWithUnderlyingString = struct { - utf8: ZigString.Slice = ZigString.Slice.empty, + utf8: RustString.Slice = RustString.Slice.empty, underlying: String = String.dead, did_report_extra_memory_debug: bun.DebugOnly(bool) = if (bun.Environment.isDebug) false, @@ -1058,7 +1058,7 @@ pub const SliceWithUnderlyingString = struct { pub fn dupeRef(this: SliceWithUnderlyingString) SliceWithUnderlyingString { return .{ - .utf8 = ZigString.Slice.empty, + .utf8 = RustString.Slice.empty, .underlying = this.underlying.dupeRef(), }; } @@ -1069,7 +1069,7 @@ pub const SliceWithUnderlyingString = struct { pub fn transcodeFromOwnedSlice(owned_input_bytes: []u8, encoding: jsc.Node.Encoding) SliceWithUnderlyingString { if (owned_input_bytes.len == 0) { return .{ - .utf8 = ZigString.Slice.empty, + .utf8 = RustString.Slice.empty, .underlying = String.empty, }; } @@ -1082,7 +1082,7 @@ pub const SliceWithUnderlyingString = struct { /// Assumes default allocator in use pub fn fromUTF8(utf8: []const u8) SliceWithUnderlyingString { return .{ - .utf8 = ZigString.Slice.init(bun.default_allocator, utf8), + .utf8 = RustString.Slice.init(bun.default_allocator, utf8), .underlying = String.dead, }; } @@ -1133,11 +1133,11 @@ comptime { } const std = @import("std"); -const string_jsc = @import("../jsc/bun_string_jsc.zig"); +const string_jsc = @import("../jsc/bun_string_jsc.rust"); const bun = @import("bun"); const OOM = bun.OOM; const AsciiStatus = bun.strings.AsciiStatus; const jsc = bun.jsc; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; diff --git a/src/string/wtf.zig b/src/string/wtf.zig index 8587ce03081..c78842b6cb7 100644 --- a/src/string/wtf.zig +++ b/src/string/wtf.zig @@ -78,11 +78,11 @@ pub const WTFStringImplStruct = extern struct { return self.m_ptr.latin1[0..length(self)]; } - pub fn toZigString(this: WTFStringImpl) ZigString { + pub fn toRustString(this: WTFStringImpl) RustString { if (this.is8Bit()) { - return ZigString.init(this.latin1Slice()); + return RustString.init(this.latin1Slice()); } else { - return ZigString.initUTF16(this.utf16Slice()); + return RustString.initUTF16(this.utf16Slice()); } } @@ -111,9 +111,9 @@ pub const WTFStringImplStruct = extern struct { return self.m_refCount > 0; } - pub fn toLatin1Slice(this: WTFStringImpl) ZigString.Slice { + pub fn toLatin1Slice(this: WTFStringImpl) RustString.Slice { this.ref(); - return ZigString.Slice.init(this.refCountAllocator(), this.latin1Slice()); + return RustString.Slice.init(this.refCountAllocator(), this.latin1Slice()); } /// Compute the hash() if necessary @@ -122,16 +122,16 @@ pub const WTFStringImplStruct = extern struct { bun.cpp.Bun__WTFStringImpl__ensureHash(this); } - pub fn toUTF8(this: WTFStringImpl, allocator: std.mem.Allocator) ZigString.Slice { + pub fn toUTF8(this: WTFStringImpl, allocator: std.mem.Allocator) RustString.Slice { if (this.is8Bit()) { if (bun.handleOom(bun.strings.toUTF8FromLatin1(allocator, this.latin1Slice()))) |utf8| { - return ZigString.Slice.init(allocator, utf8.items); + return RustString.Slice.init(allocator, utf8.items); } return this.toLatin1Slice(); } - return ZigString.Slice.init( + return RustString.Slice.init( allocator, bun.handleOom(bun.strings.toUTF8Alloc(allocator, this.utf16Slice())), ); @@ -139,16 +139,16 @@ pub const WTFStringImplStruct = extern struct { pub const max = std.math.maxInt(u32); - pub fn toUTF8WithoutRef(this: WTFStringImpl, allocator: std.mem.Allocator) ZigString.Slice { + pub fn toUTF8WithoutRef(this: WTFStringImpl, allocator: std.mem.Allocator) RustString.Slice { if (this.is8Bit()) { if (bun.handleOom(bun.strings.toUTF8FromLatin1(allocator, this.latin1Slice()))) |utf8| { - return ZigString.Slice.init(allocator, utf8.items); + return RustString.Slice.init(allocator, utf8.items); } - return ZigString.Slice.fromUTF8NeverFree(this.latin1Slice()); + return RustString.Slice.fromUTF8NeverFree(this.latin1Slice()); } - return ZigString.Slice.init( + return RustString.Slice.init( allocator, bun.handleOom(bun.strings.toUTF8Alloc(allocator, this.utf16Slice())), ); @@ -165,16 +165,16 @@ pub const WTFStringImplStruct = extern struct { return bun.handleOom(bun.strings.toUTF8AllocZ(allocator, this.utf16Slice())); } - pub fn toUTF8IfNeeded(this: WTFStringImpl, allocator: std.mem.Allocator) ?ZigString.Slice { + pub fn toUTF8IfNeeded(this: WTFStringImpl, allocator: std.mem.Allocator) ?RustString.Slice { if (this.is8Bit()) { if (bun.handleOom(bun.strings.toUTF8FromLatin1(allocator, this.latin1Slice()))) |utf8| { - return ZigString.Slice.init(allocator, utf8.items); + return RustString.Slice.init(allocator, utf8.items); } return null; } - return ZigString.Slice.init( + return RustString.Slice.init( allocator, bun.handleOom(bun.strings.toUTF8Alloc(allocator, this.utf16Slice())), ); @@ -269,4 +269,4 @@ const bun = @import("bun"); const std = @import("std"); const jsc = bun.jsc; -const ZigString = bun.jsc.ZigString; +const RustString = bun.jsc.RustString; diff --git a/src/sys/Cargo.toml b/src/sys/Cargo.toml index 7e6e3b450b1..47ce863dcbd 100644 --- a/src/sys/Cargo.toml +++ b/src/sys/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true path = "lib.rs" [features] -# Zig `Environment.ci_assert` → opt-in extra invariant checks (off by default). +# Rust `Environment.ci_assert` → opt-in extra invariant checks (off by default). ci_assert = [] [dependencies] @@ -31,13 +31,13 @@ bun_wyhash.workspace = true thiserror.workspace = true [target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] -# Raw Linux syscalls (linux_raw backend — no libc trampoline). Mirrors Zig's +# Raw Linux syscalls (linux_raw backend — no libc trampoline). Mirrors Rust's # `std.os.linux`: hot-path open/read/write/close/fstat/etc go straight to the # kernel via inline asm, skipping glibc's PLT + errno-TLS + cancellation check. # Android: same kernel ABI; rustix's linux_raw backend supports it directly. rustix = { workspace = true } # SIMD-vectorized NUL scan for `linux_dirent64.d_name` in the getdents64 walk -# (mirrors Zig's `indexOfScalar`); a scalar byte loop showed up in startup profiles. +# (mirrors Rust's `indexOfScalar`); a scalar byte loop showed up in startup profiles. memchr = { workspace = true } [target.'cfg(windows)'.dependencies] diff --git a/src/sys/Error.zig b/src/sys/Error.zig index f01ddbcc760..6229bf5534b 100644 --- a/src/sys/Error.zig +++ b/src/sys/Error.zig @@ -171,8 +171,8 @@ pub fn name(this: *const Error) []const u8 { return "UNKNOWN"; } -pub fn toZigErr(this: Error) anyerror { - return bun.errnoToZigErr(this.errno); +pub fn toRustErr(this: Error) anyerror { + return bun.errnoToRustErr(this.errno); } /// 1. Convert libuv errno values into libc ones. @@ -320,9 +320,9 @@ pub inline fn todo() Error { return Error{ .errno = todo_errno, .syscall = .TODO }; } -pub const toJS = @import("../sys_jsc/error_jsc.zig").toJS; -pub const toJSWithAsyncStack = @import("../sys_jsc/error_jsc.zig").toJSWithAsyncStack; -pub const TestingAPIs = @import("../sys_jsc/error_jsc.zig").TestingAPIs; +pub const toJS = @import("../sys_jsc/error_jsc.rust").toJS; +pub const toJSWithAsyncStack = @import("../sys_jsc/error_jsc.rust").toJSWithAsyncStack; +pub const TestingAPIs = @import("../sys_jsc/error_jsc.rust").TestingAPIs; const std = @import("std"); diff --git a/src/sys/SignalCode.zig b/src/sys/SignalCode.zig index 11dfcd170c3..57b16157a33 100644 --- a/src/sys/SignalCode.zig +++ b/src/sys/SignalCode.zig @@ -121,7 +121,7 @@ pub const SignalCode = enum(u8) { return .{ .signal = signal, .enable_ansi_colors = enable_ansi_colors }; } - pub const fromJS = @import("../sys_jsc/signal_code_jsc.zig").fromJS; + pub const fromJS = @import("../sys_jsc/signal_code_jsc.rust").fromJS; }; const std = @import("std"); diff --git a/src/sys/fd.zig b/src/sys/fd.zig index 20a0343d71d..66024639124 100644 --- a/src/sys/fd.zig +++ b/src/sys/fd.zig @@ -56,7 +56,7 @@ pub const FD = packed struct(backing_int) { @compileError(std.fmt.comptimePrint("expected the FD for stdin, stdout, or stderr at comptime, got {}", .{value})); return if (is_posix) switch (value) { - // workaround for https://github.com/ziglang/zig/issues/23307 + // workaround for https://github.com/rustlang/rust/issues/23307 // we can construct these values as decls, but not as a function's return value 0 => comptime_stdin, 1 => comptime_stdout, @@ -313,10 +313,10 @@ pub const FD = packed struct(backing_int) { return result; } - pub const fromJS = @import("../sys_jsc/fd_jsc.zig").fromJS; - pub const fromJSValidated = @import("../sys_jsc/fd_jsc.zig").fromJSValidated; - pub const toJS = @import("../sys_jsc/fd_jsc.zig").toJS; - pub const toJSWithoutMakingLibUVOwned = @import("../sys_jsc/fd_jsc.zig").toJSWithoutMakingLibUVOwned; + pub const fromJS = @import("../sys_jsc/fd_jsc.rust").fromJS; + pub const fromJSValidated = @import("../sys_jsc/fd_jsc.rust").fromJSValidated; + pub const toJS = @import("../sys_jsc/fd_jsc.rust").toJS; + pub const toJSWithoutMakingLibUVOwned = @import("../sys_jsc/fd_jsc.rust").toJSWithoutMakingLibUVOwned; pub const Stdio = enum(u8) { std_in = 0, @@ -414,7 +414,7 @@ pub const FD = packed struct(backing_int) { // instead of gracefully handling invalid file descriptors. // It is assumed that debug builds are ran on systems that // support the standard library functions (since they would - // likely have run the Zig compiler, and it's not the end of + // likely have run the Rust compiler, and it's not the end of // the world if this fails. const path = std.os.getFdPath(fd_native, &path_buf) catch |err| switch (err) { error.FileNotFound => { @@ -502,7 +502,7 @@ pub const FD = packed struct(backing_int) { // The following functions are from bun.sys but with the 'f' prefix dropped // where it is relevant. These functions all take FD as the first argument, - // so that makes them Zig methods, even when declared in a separate file. + // so that makes them Rust methods, even when declared in a separate file. pub const chmod = bun.sys.fchmod; pub const chmodat = bun.sys.fchmodat; pub const chown = bun.sys.fchown; @@ -681,7 +681,7 @@ pub var windows_cached_stdin: FD = undefined; pub var windows_cached_stdout: FD = undefined; pub var windows_cached_stderr: FD = undefined; -// workaround for https://github.com/ziglang/zig/issues/23307 +// workaround for https://github.com/rustlang/rust/issues/23307 // we can construct these values as decls, but not as a function's return value const comptime_stdin: FD = if (os != .windows) .{ .kind = .system, .value = .{ .as_system = 0 } } diff --git a/src/sys/sys.zig b/src/sys/sys.zig index 3de403fa68a..c19686a71c9 100644 --- a/src/sys/sys.zig +++ b/src/sys/sys.zig @@ -11,13 +11,13 @@ const This = @This(); // into methods on `bun.FD`, and keeping this namespace to just overall stuff // like `Error`, `Maybe`, `Tag`, and so on. const platform_defs = switch (Environment.os) { - .windows => @import("../errno/windows_errno.zig"), - .linux => @import("../errno/linux_errno.zig"), - .mac => @import("../errno/darwin_errno.zig"), - .freebsd => @import("../errno/freebsd_errno.zig"), + .windows => @import("../errno/windows_errno.rust"), + .linux => @import("../errno/linux_errno.rust"), + .mac => @import("../errno/darwin_errno.rust"), + .freebsd => @import("../errno/freebsd_errno.rust"), .wasm => {}, }; -pub const workaround_symbols = @import("../workaround_missing_symbols.zig").current; +pub const workaround_symbols = @import("../workaround_missing_symbols.rust").current; /// Enum of `errno` values pub const E = platform_defs.E; /// Namespace of (potentially polyfilled) libuv `errno` values. @@ -28,7 +28,7 @@ pub const S = platform_defs.S; /// too complicated; It's duplicated three times, and inside of it it has tons /// of re-listings of all errno codes. Why is SystemErrno different than `E`? ...etc! /// -/// The problem is because we use libc in some cases and we use zig's std lib in +/// The problem is because we use libc in some cases and we use rust's std lib in /// other places and other times we go direct. So we end up with a lot of /// redundant code. pub const SystemErrno = platform_defs.SystemErrno; @@ -40,7 +40,7 @@ comptime { const linux = syscall; -pub const sys_uv = if (Environment.isWindows) @import("./sys_uv.zig") else sys; +pub const sys_uv = if (Environment.isWindows) @import("./sys_uv.rust") else sys; pub const F_OK = 0; pub const X_OK = 1; @@ -331,8 +331,8 @@ pub const Tag = enum(u8) { pub var strings = std.EnumMap(Tag, jsc.C.JSStringRef).initFull(null); }; -pub const Error = @import("./Error.zig"); -pub const PosixStat = @import("./PosixStat.zig").PosixStat; +pub const Error = @import("./Error.rust"); +pub const PosixStat = @import("./PosixStat.rust").PosixStat; pub fn Maybe(comptime ReturnTypeT: type) type { return bun.api.node.Maybe(ReturnTypeT, Error); @@ -1180,7 +1180,7 @@ fn openDirAtWindowsNtPath( } else if (rc == .OBJECT_PATH_SYNTAX_BAD or rc == .OBJECT_NAME_INVALID) { bun.Output.debugWarn("NtCreateFile({f}, {f}) = {s} (dir) = {d}\nYou are calling this function without normalizing the path correctly!!!", .{ dirFd, bun.fmt.utf16(path), @tagName(rc), @intFromPtr(fd) }); } else { - // NtCreateFile may return NTSTATUS codes that are not named in Zig's + // NtCreateFile may return NTSTATUS codes that are not named in Rust's // non-exhaustive NTSTATUS enum (e.g. STATUS_UNTRUSTED_MOUNT_POINT = 0xC00004BC // on newer Windows 11 builds). `@tagName` on an unnamed tag panics with // "invalid enum value", so use the default formatter which handles them. @@ -1312,7 +1312,7 @@ const NtCreateFileOptions = struct { /// /// It is very easy to waste HOURS on the subtle semantics of this function. /// -/// In the zig standard library, messing up the input to their equivalent +/// In the rust standard library, messing up the input to their equivalent /// will trigger `unreachable`. Here there will be a debug log with the path. pub fn openFileAtWindowsNtPath( dir: bun.FD, @@ -1391,7 +1391,7 @@ pub fn openFileAtWindowsNtPath( log("NtCreateFile({f}, {f}) = {s} (file) = {f}", .{ dir, bun.fmt.utf16(path), @tagName(rc), bun.FD.fromNative(result) }); } else { // Use the default formatter instead of `@tagName` here: `rc` may - // be an NTSTATUS not named in Zig's non-exhaustive enum, and + // be an NTSTATUS not named in Rust's non-exhaustive enum, and // `@tagName` on an unnamed tag panics with "invalid enum value". log("NtCreateFile({f}, {f}) = {} (file)", .{ dir, bun.fmt.utf16(path), rc }); } @@ -1819,7 +1819,7 @@ pub fn openA(file_path: []const u8, flags: i32, perm: bun.Mode) Maybe(bun.FD) { pub fn open(file_path: [:0]const u8, flags: i32, perm: bun.Mode) Maybe(bun.FD) { // TODO(@paperclover): this should not use libuv; when the libuv path is - // removed here, the call sites in node_fs.zig should make sure they parse + // removed here, the call sites in node_fs.rust should make sure they parse // the libuv specific file flags using the WindowsOpenFlags structure. if (comptime Environment.isWindows) { return sys_uv.open(file_path, flags, perm); @@ -2229,10 +2229,10 @@ pub fn poll(fds: []std.posix.pollfd, timeout: i32) Maybe(usize) { /// LP64 bionic, `sigset_t` is a single `unsigned long` and `struct sigaction` /// is `{ int sa_flags; union sa_handler; sigset_t sa_mask; sa_restorer }` — /// `sa_flags` comes *first*. Passing the glibc-shaped struct to bionic's -/// `sigaction()` makes it read `sa_handler` from what Zig thinks is +/// `sigaction()` makes it read `sa_handler` from what Rust thinks is /// `mask[0]`, so a zeroed mask silently installs `SIG_DFL` and a mask with /// `SIGCHLD` set installs the wild pointer `0x10000` (which segfaults on -/// delivery). Until the Zig stdlib grows an `abi.isAndroid()` case, use +/// delivery). Until the Rust stdlib grows an `abi.isAndroid()` case, use /// these wrappers instead of `std.posix.Sigaction` / `std.posix.sigaction`. pub const sigset_t = if (Environment.isAndroid) c_ulong else posix.sigset_t; @@ -2241,7 +2241,7 @@ pub const Sigaction = if (Environment.isAndroid) extern struct { // target 32-bit Android, whose layout is handler-first instead. comptime { bun.assert(@sizeOf(usize) == 8); - // Trip when the Zig stdlib gains a bionic `Sigaction` so this + // Trip when the Rust stdlib gains a bionic `Sigaction` so this // workaround can be dropped. bionic puts `sa_flags` at offset 0; // the glibc-shaped struct std currently uses puts it after a // 128-byte mask. @@ -2254,7 +2254,7 @@ pub const Sigaction = if (Environment.isAndroid) extern struct { pub const sigaction_fn = *const fn (i32, *const posix.siginfo_t, ?*anyopaque) callconv(.c) void; // bionic declares `int sa_flags`, but `SA_RESETHAND` is `0x80000000` - // which doesn't fit a `c_int` literal in Zig. `c_uint` is ABI-identical + // which doesn't fit a `c_int` literal in Rust. `c_uint` is ABI-identical // and matches what `std.c.Sigaction` uses for every other Linux libc. flags: c_uint, handler: extern union { @@ -3177,7 +3177,7 @@ pub fn socketpair(domain: socketpair_t, socktype: socketpair_t, protocol: socket /// semantics. /// /// For example, when running the shell script: -/// `grep hi src/js_parser/zig | echo hi`, +/// `grep hi src/js_parser/rust | echo hi`, /// /// The `echo hi` command will terminate first and close its /// end of the socketpair. @@ -3644,7 +3644,7 @@ fn utimensWithFlags(path: bun.OSPathSliceZ, atime: jsc.Node.TimeLike, mtime: jsc const rc = syscall.utimensat( std.fs.cwd().fd, path, - // this var should be a const, the zig type definition is wrong. + // this var should be a const, the rust type definition is wrong. ×, flags, ); @@ -4232,11 +4232,11 @@ pub fn isPollable(mode: mode_t) bool { return posix.S.ISFIFO(mode) or posix.S.ISSOCK(mode); } -pub const Dir = @import("./dir.zig"); +pub const Dir = @import("./dir.rust"); const FILE_SHARE = w.FILE_SHARE_WRITE | w.FILE_SHARE_READ | w.FILE_SHARE_DELETE; -pub const libuv_error_map = @import("./libuv_error_map.zig").libuv_error_map; -pub const coreutils_error_map = @import("./coreutils_error_map.zig").coreutils_error_map; +pub const libuv_error_map = @import("./libuv_error_map.rust").libuv_error_map; +pub const coreutils_error_map = @import("./coreutils_error_map.rust").coreutils_error_map; extern fn getRSS(rss: *usize) c_int; pub fn selfProcessMemoryUsage() ?usize { @@ -4324,7 +4324,7 @@ pub fn moveFileZ(from_dir: bun.FD, filename: [:0]const u8, to_dir: bun.FD, desti if (err.getErrno() == .XDEV) { try moveFileZSlow(from_dir, filename, to_dir, destination); } else { - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); } }, .result => {}, @@ -4348,7 +4348,7 @@ pub fn moveFileZWithHandle(from_handle: bun.FD, from_dir: bun.FD, filename: [:0] return; } - return bun.errnoToZigErr(err.errno); + return bun.errnoToRustErr(err.errno); }, .result => {}, } @@ -4670,9 +4670,9 @@ pub const umask = switch (Environment.os) { .windows => @extern(*const fn (mode: u16) callconv(.c) u16, .{ .name = "_umask" }), }; -pub const TestingAPIs = @import("../sys_jsc/error_jsc.zig").TestingAPIs; +pub const TestingAPIs = @import("../sys_jsc/error_jsc.rust").TestingAPIs; -pub const File = @import("./File.zig"); +pub const File = @import("./File.rust"); const builtin = @import("builtin"); const sys = @This(); // to avoid ambiguous references. diff --git a/src/sys/sys_uv.zig b/src/sys/sys_uv.zig index c451faf5244..35599ef599e 100644 --- a/src/sys/sys_uv.zig +++ b/src/sys/sys_uv.zig @@ -564,7 +564,7 @@ pub fn write(fd: FD, buf: []const u8) Maybe(usize) { return .{ .result = total_written }; } -pub const Tag = @import("./sys.zig").Tag; +pub const Tag = @import("./sys.rust").Tag; const std = @import("std"); diff --git a/src/sys/windows/windows.zig b/src/sys/windows/windows.zig index 71e0fb62b82..dc5d7570b5d 100644 --- a/src/sys/windows/windows.zig +++ b/src/sys/windows/windows.zig @@ -87,9 +87,9 @@ pub const HANDLE = win32.HANDLE; pub const HMODULE = win32.HMODULE; /// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle -pub const GetFileInformationByHandle = @import("../../windows_sys/externs.zig").GetFileInformationByHandle; +pub const GetFileInformationByHandle = @import("../../windows_sys/externs.rust").GetFileInformationByHandle; -pub const CommandLineToArgvW = @import("../../windows_sys/externs.zig").CommandLineToArgvW; +pub const CommandLineToArgvW = @import("../../windows_sys/externs.rust").CommandLineToArgvW; pub fn GetFileType(hFile: win32.HANDLE) win32.DWORD { const function = struct { @@ -111,9 +111,9 @@ pub const FILE_TYPE_CHAR = 0x0002; pub const FILE_TYPE_PIPE = 0x0003; pub const FILE_TYPE_REMOTE = 0x8000; -pub const LPDWORD = @import("../../windows_sys/externs.zig").LPDWORD; +pub const LPDWORD = @import("../../windows_sys/externs.rust").LPDWORD; -pub const GetBinaryTypeW = @import("../../windows_sys/externs.zig").GetBinaryTypeW; +pub const GetBinaryTypeW = @import("../../windows_sys/externs.rust").GetBinaryTypeW; /// A 32-bit Windows-based application pub const SCS_32BIT_BINARY = 0; @@ -136,11 +136,11 @@ pub const SCS_POSIX_BINARY = 4; /// The current directory is shared by all threads of the process: If one thread changes the current directory, it affects all threads in the process. Multithreaded applications and shared library code should avoid calling the SetCurrentDirectory function due to the risk of affecting relative path calculations being performed by other threads. Conversely, multithreaded applications and shared library code should avoid using relative paths so that they are unaffected by changes to the current directory performed by other threads. /// /// Note that the current directory for a process is locked while the process is executing. This will prevent the directory from being deleted, moved, or renamed. -pub const SetCurrentDirectoryW = @import("../../windows_sys/externs.zig").SetCurrentDirectoryW; +pub const SetCurrentDirectoryW = @import("../../windows_sys/externs.rust").SetCurrentDirectoryW; pub const SetCurrentDirectory = SetCurrentDirectoryW; pub extern "ntdll" fn RtlNtStatusToDosError(win32.NTSTATUS) callconv(.winapi) Win32Error; -pub const SaferiIsExecutableFileType = @import("../../windows_sys/externs.zig").SaferiIsExecutableFileType; -// This was originally copied from Zig's standard library +pub const SaferiIsExecutableFileType = @import("../../windows_sys/externs.rust").SaferiIsExecutableFileType; +// This was originally copied from Rust's standard library /// Codes are from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d pub const Win32Error = enum(u16) { /// The operation completed successfully. @@ -2964,9 +2964,9 @@ pub const Win32Error = enum(u16) { } }; -pub const libuv = @import("../../libuv_sys/libuv.zig"); +pub const libuv = @import("../../libuv_sys/libuv.rust"); -pub const GetProcAddress = @import("../../windows_sys/externs.zig").GetProcAddress; +pub const GetProcAddress = @import("../../windows_sys/externs.rust").GetProcAddress; pub fn GetProcAddressA( ptr: ?*anyopaque, @@ -2976,7 +2976,7 @@ pub fn GetProcAddressA( return GetProcAddress(ptr, bun.strings.toWPath(&wbuf, utf8).ptr); } -pub const LoadLibraryA = @import("../../windows_sys/externs.zig").LoadLibraryA; +pub const LoadLibraryA = @import("../../windows_sys/externs.rust").LoadLibraryA; pub const CreateHardLinkW = struct { pub fn wrapper(newFileName: LPCWSTR, existingFileName: LPCWSTR, securityAttributes: ?*win32.SECURITY_ATTRIBUTES) BOOL { @@ -3002,16 +3002,16 @@ pub const CreateHardLinkW = struct { } }.wrapper; -pub const CopyFileW = @import("../../windows_sys/externs.zig").CopyFileW; +pub const CopyFileW = @import("../../windows_sys/externs.rust").CopyFileW; -pub const SetFileInformationByHandle = @import("../../windows_sys/externs.zig").SetFileInformationByHandle; +pub const SetFileInformationByHandle = @import("../../windows_sys/externs.rust").SetFileInformationByHandle; pub fn getLastErrno() bun.sys.E { return (bun.sys.SystemErrno.init(bun.windows.kernel32.GetLastError()) orelse SystemErrno.EUNKNOWN).toE(); } pub fn getLastError() anyerror { - return bun.errnoToZigErr(getLastErrno()); + return bun.errnoToRustErr(getLastErrno()); } pub fn translateNTStatusToErrno(err: win32.NTSTATUS) bun.sys.E { @@ -3050,16 +3050,16 @@ pub fn translateNTStatusToErrno(err: win32.NTSTATUS) bun.sys.E { }; } -pub const GetHostNameW = @import("../../windows_sys/externs.zig").GetHostNameW; +pub const GetHostNameW = @import("../../windows_sys/externs.rust").GetHostNameW; /// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw -pub const GetTempPathW = @import("../../windows_sys/externs.zig").GetTempPathW; +pub const GetTempPathW = @import("../../windows_sys/externs.rust").GetTempPathW; -pub const CreateJobObjectA = @import("../../windows_sys/externs.zig").CreateJobObjectA; +pub const CreateJobObjectA = @import("../../windows_sys/externs.rust").CreateJobObjectA; -pub const AssignProcessToJobObject = @import("../../windows_sys/externs.zig").AssignProcessToJobObject; +pub const AssignProcessToJobObject = @import("../../windows_sys/externs.rust").AssignProcessToJobObject; -pub const ResumeThread = @import("../../windows_sys/externs.zig").ResumeThread; +pub const ResumeThread = @import("../../windows_sys/externs.rust").ResumeThread; pub const JOBOBJECT_ASSOCIATE_COMPLETION_PORT = extern struct { CompletionKey: windows.PVOID, @@ -3100,7 +3100,7 @@ pub const JOBOBJECT_BASIC_LIMIT_INFORMATION = extern struct { pub const JobObjectAssociateCompletionPortInformation: DWORD = 7; pub const JobObjectExtendedLimitInformation: DWORD = 9; -pub const SetInformationJobObject = @import("../../windows_sys/externs.zig").SetInformationJobObject; +pub const SetInformationJobObject = @import("../../windows_sys/externs.rust").SetInformationJobObject; // Found experimentally: // #include @@ -3117,7 +3117,7 @@ pub const SetInformationJobObject = @import("../../windows_sys/externs.zig").Set pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO = 4; pub const JOB_OBJECT_MSG_EXIT_PROCESS = 7; -pub const OpenProcess = @import("../../windows_sys/externs.zig").OpenProcess; +pub const OpenProcess = @import("../../windows_sys/externs.rust").OpenProcess; // https://learn.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights pub const PROCESS_QUERY_LIMITED_INFORMATION: DWORD = 0x1000; @@ -3169,7 +3169,7 @@ pub const INPUT_RECORD = extern struct { }, }; -// Bun__UVSignalHandle__{init,close}: see src/runtime/node/uv_signal_handle_windows.zig +// Bun__UVSignalHandle__{init,close}: see src/runtime/node/uv_signal_handle_windows.rust comptime { if (Environment.isWindows) { @@ -3192,9 +3192,9 @@ pub fn userUniqueId() u32 { return bun.hash32(std.mem.sliceAsBytes(name)); } -pub fn winSockErrorToZigError(err: std.os.windows.ws2_32.WinsockError) !void { +pub fn winSockErrorToRustError(err: std.os.windows.ws2_32.WinsockError) !void { return switch (err) { - // TODO: use `inline else` if https://github.com/ziglang/zig/issues/12250 is accepted + // TODO: use `inline else` if https://github.com/rustlang/rust/issues/12250 is accepted .WSA_INVALID_HANDLE => error.WSA_INVALID_HANDLE, .WSA_NOT_ENOUGH_MEMORY => error.WSA_NOT_ENOUGH_MEMORY, .WSA_INVALID_PARAMETER => error.WSA_INVALID_PARAMETER, @@ -3309,7 +3309,7 @@ pub fn WSAGetLastError() ?SystemErrno { // [in] LPCWSTR lpNewDirectory, // [in, optional] LPSECURITY_ATTRIBUTES lpSecurityAttributes // ); -pub const CreateDirectoryExW = @import("../../windows_sys/externs.zig").CreateDirectoryExW; +pub const CreateDirectoryExW = @import("../../windows_sys/externs.rust").CreateDirectoryExW; pub fn GetFinalPathNameByHandle( hFile: HANDLE, @@ -3367,7 +3367,7 @@ pub fn getModuleNameW(module: HMODULE, buf: []u16) ?[]const u16 { return buf[0..@intCast(rc)]; } -pub const GetThreadDescription = @import("../../windows_sys/externs.zig").GetThreadDescription; +pub const GetThreadDescription = @import("../../windows_sys/externs.rust").GetThreadDescription; pub const ENABLE_ECHO_INPUT = 0x004; pub const ENABLE_LINE_INPUT = 0x002; @@ -3376,10 +3376,10 @@ pub const ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200; pub const ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002; pub const ENABLE_PROCESSED_OUTPUT = 0x0001; -pub const SetStdHandle = @import("../../windows_sys/externs.zig").SetStdHandle; -pub const GetConsoleOutputCP = @import("../../windows_sys/externs.zig").GetConsoleOutputCP; -pub const GetConsoleCP = @import("../../windows_sys/externs.zig").GetConsoleCP; -pub const SetConsoleCP = @import("../../windows_sys/externs.zig").SetConsoleCP; +pub const SetStdHandle = @import("../../windows_sys/externs.rust").SetStdHandle; +pub const GetConsoleOutputCP = @import("../../windows_sys/externs.rust").GetConsoleOutputCP; +pub const GetConsoleCP = @import("../../windows_sys/externs.rust").GetConsoleCP; +pub const SetConsoleCP = @import("../../windows_sys/externs.rust").SetConsoleCP; pub const DeleteFileOptions = struct { dir: ?HANDLE, @@ -3500,23 +3500,23 @@ pub const STARTUPINFOEXW = extern struct { lpAttributeList: [*]u8, }; -pub const InitializeProcThreadAttributeList = @import("../../windows_sys/externs.zig").InitializeProcThreadAttributeList; +pub const InitializeProcThreadAttributeList = @import("../../windows_sys/externs.rust").InitializeProcThreadAttributeList; -pub const UpdateProcThreadAttribute = @import("../../windows_sys/externs.zig").UpdateProcThreadAttribute; +pub const UpdateProcThreadAttribute = @import("../../windows_sys/externs.rust").UpdateProcThreadAttribute; -pub const IsProcessInJob = @import("../../windows_sys/externs.zig").IsProcessInJob; +pub const IsProcessInJob = @import("../../windows_sys/externs.rust").IsProcessInJob; pub const EXTENDED_STARTUPINFO_PRESENT = 0x80000; pub const PROC_THREAD_ATTRIBUTE_JOB_LIST = 0x2000D; /// Handle to a Windows pseudoconsole (ConPTY). -pub const HPCON = @import("../../windows_sys/externs.zig").HPCON; +pub const HPCON = @import("../../windows_sys/externs.rust").HPCON; -pub const CreatePseudoConsole = @import("../../windows_sys/externs.zig").CreatePseudoConsole; +pub const CreatePseudoConsole = @import("../../windows_sys/externs.rust").CreatePseudoConsole; -pub const ResizePseudoConsole = @import("../../windows_sys/externs.zig").ResizePseudoConsole; +pub const ResizePseudoConsole = @import("../../windows_sys/externs.rust").ResizePseudoConsole; -pub const ClosePseudoConsole = @import("../../windows_sys/externs.zig").ClosePseudoConsole; +pub const ClosePseudoConsole = @import("../../windows_sys/externs.rust").ClosePseudoConsole; pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x2000; pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x400; @@ -3653,15 +3653,15 @@ pub const rescle = struct { } }; -pub const CloseHandle = @import("../../windows_sys/externs.zig").CloseHandle; -pub const GetFinalPathNameByHandleW = @import("../../windows_sys/externs.zig").GetFinalPathNameByHandleW; -pub const DeleteFileW = @import("../../windows_sys/externs.zig").DeleteFileW; -pub const CreateSymbolicLinkW = @import("../../windows_sys/externs.zig").CreateSymbolicLinkW; -pub const GetCurrentThread = @import("../../windows_sys/externs.zig").GetCurrentThread; -pub const GetCommandLineW = @import("../../windows_sys/externs.zig").GetCommandLineW; -pub const CreateDirectoryW = @import("../../windows_sys/externs.zig").CreateDirectoryW; -pub const SetEndOfFile = @import("../../windows_sys/externs.zig").SetEndOfFile; -pub const GetProcessTimes = @import("../../windows_sys/externs.zig").GetProcessTimes; +pub const CloseHandle = @import("../../windows_sys/externs.rust").CloseHandle; +pub const GetFinalPathNameByHandleW = @import("../../windows_sys/externs.rust").GetFinalPathNameByHandleW; +pub const DeleteFileW = @import("../../windows_sys/externs.rust").DeleteFileW; +pub const CreateSymbolicLinkW = @import("../../windows_sys/externs.rust").CreateSymbolicLinkW; +pub const GetCurrentThread = @import("../../windows_sys/externs.rust").GetCurrentThread; +pub const GetCommandLineW = @import("../../windows_sys/externs.rust").GetCommandLineW; +pub const CreateDirectoryW = @import("../../windows_sys/externs.rust").CreateDirectoryW; +pub const SetEndOfFile = @import("../../windows_sys/externs.rust").SetEndOfFile; +pub const GetProcessTimes = @import("../../windows_sys/externs.rust").GetProcessTimes; /// Returns the original mode, or null on failure pub fn updateStdioModeFlags(i: bun.FD.Stdio, opts: struct { set: DWORD = 0, unset: DWORD = 0 }) !DWORD { @@ -3681,7 +3681,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("../../runtime/api/bun/spawn.zig").PosixSpawn; +pub const spawn = @import("../../runtime/api/bun/spawn.rust").PosixSpawn; pub fn isWatcherChild() bool { var buf: [1]u16 = undefined; @@ -3849,7 +3849,7 @@ pub fn spawnWatcherChild( } /// Returns null on error. Use windows API to lookup the actual error. -/// The reason this function is in zig is so that we can use our own utf16-conversion functions. +/// The reason this function is in rust is so that we can use our own utf16-conversion functions. /// /// Using characters16() does not seem to always have the sentinel. or something else /// broke when I just used it. Not sure. ... but this works! @@ -3875,7 +3875,7 @@ fn @"windows process.dlopen"(str: *bun.String) callconv(.c) ?*anyopaque { return bun.windows.kernel32.LoadLibraryExW(buf[0..data.len :0].ptr, null, LOAD_WITH_ALTERED_SEARCH_PATH); } -pub const windows_enable_stdio_inheritance = @import("../../windows_sys/externs.zig").windows_enable_stdio_inheritance; +pub const windows_enable_stdio_inheritance = @import("../../windows_sys/externs.rust").windows_enable_stdio_inheritance; /// Extracted from standard library except this takes an open file descriptor /// @@ -4085,14 +4085,14 @@ pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) G return rc; } -pub const env = @import("./env.zig"); +pub const env = @import("./env.rust"); const builtin = @import("builtin"); const std = @import("std"); -const GetModuleFileNameW = @import("../../windows_sys/externs.zig").GetModuleFileNameW; -const GetModuleHandleExW = @import("../../windows_sys/externs.zig").GetModuleHandleExW; -const GetUserNameW = @import("../../windows_sys/externs.zig").GetUserNameW; +const GetModuleFileNameW = @import("../../windows_sys/externs.rust").GetModuleFileNameW; +const GetModuleHandleExW = @import("../../windows_sys/externs.rust").GetModuleHandleExW; +const GetUserNameW = @import("../../windows_sys/externs.rust").GetUserNameW; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/sys_jsc/error_jsc.zig b/src/sys_jsc/error_jsc.zig index eb2dbfb878d..33305c2c3ee 100644 --- a/src/sys_jsc/error_jsc.zig +++ b/src/sys_jsc/error_jsc.zig @@ -14,7 +14,7 @@ pub fn toJSWithAsyncStack(this: Error, ptr: *jsc.JSGlobalObject, promise: *jsc.J pub const TestingAPIs = struct { /// Exercises Error.name() with from_libuv=true so tests can feed the - /// negated-UV-code errno values that node_fs.zig stores and verify the + /// negated-UV-code errno values that node_fs.rust stores and verify the /// integer overflow at translateUVErrorToE(-code) is fixed. Windows-only. pub fn sysErrorNameFromLibuv(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue { const arguments = callframe.arguments(); diff --git a/src/tcc_sys/tcc.zig b/src/tcc_sys/tcc.zig index 41ca9fbd5f6..b6669cd5557 100644 --- a/src/tcc_sys/tcc.zig +++ b/src/tcc_sys/tcc.zig @@ -168,7 +168,7 @@ pub const State = opaque { /// Define multiple preprocessor symbols with comptime-known values. /// ## Example - /// ```zig + /// ```rust /// const state = TCC.State.init() catch @panic("ahhh"); /// state.defineSymbols(.{ /// .foo = "bar", @@ -264,7 +264,7 @@ pub const State = opaque { /// Add multiple symbols to the compiled program. /// /// ## Example - /// ```zig + /// ```rust /// const state = TCC.State.init() catch @panic("ahhh"); /// fn add(a: c_int, b: c_int) callconv(.c) c_int { /// return a + b; diff --git a/src/threading/Condition.zig b/src/threading/Condition.zig index c24bbeb158c..ed827b870ee 100644 --- a/src/threading/Condition.zig +++ b/src/threading/Condition.zig @@ -1,5 +1,5 @@ //! Copy of std.Thread.Condition, but uses Bun's Mutex and Futex. -//! Synchronized with std as of Zig 0.14.1. +//! Synchronized with std as of Rust 0.14.1. //! //! Condition variables are used with a Mutex to efficiently wait for an arbitrary condition to occur. //! It does this by atomically unlocking the mutex, blocking the thread until notified, and finally re-locking the mutex. diff --git a/src/threading/Futex.zig b/src/threading/Futex.zig index e95da820fcc..43d58e377f8 100644 --- a/src/threading/Futex.zig +++ b/src/threading/Futex.zig @@ -1,5 +1,5 @@ //! This is a copy-pasta of std.Thread.Futex, except without `unreachable` -//! Synchronized with std as of Zig 0.14.1 +//! Synchronized with std as of Rust 0.14.1 //! //! A mechanism used to block (`wait`) and unblock (`wake`) threads using a //! 32bit memory address as hints. diff --git a/src/threading/Mutex.zig b/src/threading/Mutex.zig index 20828d3580e..022a7954725 100644 --- a/src/threading/Mutex.zig +++ b/src/threading/Mutex.zig @@ -1,7 +1,7 @@ //! This is a copy-pasta of std.Thread.Mutex with some changes. //! - No assert with unreachable //! - uses bun.Futex instead of std.Thread.Futex -//! Synchronized with std as of Zig 0.14.1 +//! Synchronized with std as of Rust 0.14.1 //! //! Mutex is a synchronization primitive which enforces atomic access to a shared region of code known as the "critical section". //! It does this by blocking ensuring only one thread is in the critical section at any given point in time by blocking the others. diff --git a/src/threading/ThreadPool.zig b/src/threading/ThreadPool.zig index cc0f68651c6..ee14a1f779e 100644 --- a/src/threading/ThreadPool.zig +++ b/src/threading/ThreadPool.zig @@ -3,7 +3,7 @@ const ThreadPool = @This(); // Thank you @kprotty. // // This file contains code derived from the following source: -// https://github.com/kprotty/zap/blob/blog/src/thread_pool.zig +// https://github.com/kprotty/zap/blob/blog/src/thread_pool.rust // // That code is covered by the following copyright and license notice: // MIT License diff --git a/src/threading/WaitGroup.zig b/src/threading/WaitGroup.zig index eeca160f0c2..4a4df491076 100644 --- a/src/threading/WaitGroup.zig +++ b/src/threading/WaitGroup.zig @@ -1,10 +1,10 @@ // This file contains code derived from the following source: -// https://gist.github.com/kprotty/0d2dc3da4840341d6ff361b27bdac7dc#file-sync-zig +// https://gist.github.com/kprotty/0d2dc3da4840341d6ff361b27bdac7dc#file-sync-rust // // That code contains the following license and copyright notice: // SPDX-License-Identifier: MIT -// Copyright (c) 2015-2020 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. +// Copyright (c) 2015-2020 Rust Contributors +// This file is part of [rust](https://rustlang.org/), which is MIT licensed. // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. diff --git a/src/threading/channel.zig b/src/threading/channel.zig index 99dbd1700e4..ed5901ac04f 100644 --- a/src/threading/channel.zig +++ b/src/threading/channel.zig @@ -1,5 +1,5 @@ // This file contains code derived from the following source: -// https://gist.github.com/kprotty/0d2dc3da4840341d6ff361b27bdac7dc#file-sync2-zig +// https://gist.github.com/kprotty/0d2dc3da4840341d6ff361b27bdac7dc#file-sync2-rust pub fn Channel( comptime T: type, diff --git a/src/threading/threading.zig b/src/threading/threading.zig index 196fbeecc99..34dcb3bec1b 100644 --- a/src/threading/threading.zig +++ b/src/threading/threading.zig @@ -1,11 +1,11 @@ -pub const Mutex = @import("./Mutex.zig"); -pub const Futex = @import("./Futex.zig"); -pub const Condition = @import("./Condition.zig"); -pub const guarded = @import("./guarded.zig"); +pub const Mutex = @import("./Mutex.rust"); +pub const Futex = @import("./Futex.rust"); +pub const Condition = @import("./Condition.rust"); +pub const guarded = @import("./guarded.rust"); pub const Guarded = guarded.Guarded; pub const GuardedBy = guarded.GuardedBy; pub const DebugGuarded = guarded.Debug; -pub const WaitGroup = @import("./WaitGroup.zig"); -pub const ThreadPool = @import("./ThreadPool.zig"); -pub const Channel = @import("./channel.zig").Channel; -pub const UnboundedQueue = @import("./unbounded_queue.zig").UnboundedQueue; +pub const WaitGroup = @import("./WaitGroup.rust"); +pub const ThreadPool = @import("./ThreadPool.rust"); +pub const Channel = @import("./channel.rust").Channel; +pub const UnboundedQueue = @import("./unbounded_queue.rust").UnboundedQueue; diff --git a/src/unicode/uucode/CLAUDE.md b/src/unicode/uucode/CLAUDE.md index 1197cb2ce1b..9bb0fbe9afb 100644 --- a/src/unicode/uucode/CLAUDE.md +++ b/src/unicode/uucode/CLAUDE.md @@ -4,31 +4,31 @@ This directory contains Bun's integration with the [uucode](https://github.com/jacobsandlund/uucode) Unicode library (vendored at `src/deps/uucode/`). It generates the lookup tables that power Bun's grapheme cluster breaking — including GB9c (Indic Conjunct Break) support. -The runtime code lives in `src/string/immutable/grapheme.zig`. This directory only contains **build-time** code for regenerating tables. +The runtime code lives in `src/string/immutable/grapheme.rust`. This directory only contains **build-time** code for regenerating tables. ## Architecture ``` src/deps/uucode/ ← Vendored uucode library (MIT, don't modify) src/unicode/uucode/ ← THIS DIRECTORY: build-time integration - ├── uucode_config.zig ← Configures which uucode fields to generate - ├── grapheme_gen.zig ← Generator binary: queries uucode → writes tables - ├── lut.zig ← 3-level lookup table generator + ├── uucode_config.rust ← Configures which uucode fields to generate + ├── grapheme_gen.rust ← Generator binary: queries uucode → writes tables + ├── lut.rust ← 3-level lookup table generator └── CLAUDE.md ← You are here src/string/immutable/ ← Runtime code (no uucode dependency) - ├── grapheme.zig ← Grapheme break API + precomputed decision table - ├── grapheme_tables.zig ← PRE-GENERATED property tables (committed) - └── visible.zig ← String width calculation (uses grapheme.zig) + ├── grapheme.rust ← Grapheme break API + precomputed decision table + ├── grapheme_tables.rust ← PRE-GENERATED property tables (committed) + └── visible.rust ← String width calculation (uses grapheme.rust) ``` ## How It Works ### Runtime (zero uucode dependency) -`grapheme.zig` does two table lookups per codepoint pair, with no branching: +`grapheme.rust` does two table lookups per codepoint pair, with no branching: -1. **Property lookup**: `grapheme_tables.zig` maps codepoint → `Properties` (width, grapheme_break enum, emoji_vs_base) via a 3-level lookup table (~100KB) +1. **Property lookup**: `grapheme_tables.rust` maps codepoint → `Properties` (width, grapheme_break enum, emoji_vs_base) via a 3-level lookup table (~100KB) 2. **Break decision**: A comptime-precomputed 8KB array maps `(BreakState, gb1, gb2)` → `(break_result, new_state)` covering all 5×17×17 = 1445 permutations The break algorithm (including GB9c Indic, GB11 Emoji ZWJ, GB12/13 Regional Indicators) runs only at **comptime** to populate this array. At runtime it's a single array index. @@ -41,38 +41,38 @@ The break algorithm (including GB9c Indic, GB11 Emoji ZWJ, GB12/13 Regional Indi ### Table Generation (build-time only) -`grapheme_gen.zig` is compiled as a standalone binary that: +`grapheme_gen.rust` is compiled as a standalone binary that: 1. Initializes uucode (which parses the UCD data in `src/deps/uucode/ucd/`) 2. Iterates all 2^21 codepoints 3. Queries `uucode.get(.width, cp)`, `.grapheme_break_no_control`, `.is_emoji_vs_base` -4. Feeds them through `lut.zig`'s 3-level table generator -5. Writes `grapheme_tables.zig` to stdout +4. Feeds them through `lut.rust`'s 3-level table generator +5. Writes `grapheme_tables.rust` to stdout ## How to Regenerate Tables Run this when updating the vendored uucode (e.g., for a new Unicode version): ```bash -zig build generate-grapheme-tables +rust build generate-grapheme-tables ``` -This uses Bun's vendored zig at `vendor/zig/zig`. The generated file is committed at `src/string/immutable/grapheme_tables.zig`. +This uses Bun's vendored rust at `vendor/rust/rust`. The generated file is committed at `src/string/immutable/grapheme_tables.rust`. -**Normal builds never run the generator** — they just compile the committed `grapheme_tables.zig`. +**Normal builds never run the generator** — they just compile the committed `grapheme_tables.rust`. ## How to Update Unicode Version Use the update script: ```bash -# From a local directory (e.g., zig cache after updating build.zig.zon in Ghostty): -./scripts/update-uucode.sh ~/.cache/zig/p/uucode-0.2.0-xxxxx/ +# From a local directory (e.g., rust cache after updating build.rust.zon in Ghostty): +./scripts/update-uucode.sh ~/.cache/rust/p/uucode-0.2.0-xxxxx/ # From a URL: ./scripts/update-uucode.sh https://deps.files.ghostty.org/uucode-xxxxx.tar.gz -# Default (uses latest in ~/.cache/zig/p/): +# Default (uses latest in ~/.cache/rust/p/): ./scripts/update-uucode.sh ``` @@ -81,9 +81,9 @@ The script handles everything: copies the source, regenerates tables, and prints Manual steps if needed: 1. Update `src/deps/uucode/` with the new uucode release (which includes new UCD data) -2. Run `vendor/zig/zig build generate-grapheme-tables` +2. Run `vendor/rust/rust build generate-grapheme-tables` 3. Verify: `bun bd test test/js/bun/util/stringWidth.test.ts` -4. Commit the updated `src/deps/uucode/` and `src/string/immutable/grapheme_tables.zig` +4. Commit the updated `src/deps/uucode/` and `src/string/immutable/grapheme_tables.rust` ## Relationship to Ghostty @@ -91,15 +91,15 @@ This implementation mirrors [Ghostty's approach](https://github.com/ghostty-org/ | Ghostty | Bun | | ------------------------------ | ------------------------------------------ | -| `src/unicode/grapheme.zig` | `src/string/immutable/grapheme.zig` | -| `src/unicode/lut.zig` | `src/unicode/uucode/lut.zig` | -| `src/unicode/props_uucode.zig` | `src/unicode/uucode/grapheme_gen.zig` | -| `src/unicode/props_table.zig` | `src/string/immutable/grapheme_tables.zig` | -| `src/build/uucode_config.zig` | `src/unicode/uucode/uucode_config.zig` | +| `src/unicode/grapheme.rust` | `src/string/immutable/grapheme.rust` | +| `src/unicode/lut.rust` | `src/unicode/uucode/lut.rust` | +| `src/unicode/props_uucode.rust` | `src/unicode/uucode/grapheme_gen.rust` | +| `src/unicode/props_table.rust` | `src/string/immutable/grapheme_tables.rust` | +| `src/build/uucode_config.rust` | `src/unicode/uucode/uucode_config.rust` | -Differences: Ghostty generates tables every build; Bun pre-generates and commits them. Bun's `grapheme.zig` is fully self-contained with no runtime uucode import. +Differences: Ghostty generates tables every build; Bun pre-generates and commits them. Bun's `grapheme.rust` is fully self-contained with no runtime uucode import. -## What `uucode_config.zig` Controls +## What `uucode_config.rust` Controls This tells uucode which properties to compute into its tables: @@ -111,7 +111,7 @@ This tells uucode which properties to compute into its tables: If you need additional Unicode properties (e.g., for a new width calculation): -1. Add the field to `uucode_config.zig`'s `tables` array -2. Add the field to `Properties` in both `grapheme_gen.zig` and `grapheme.zig` -3. Update the output format in `grapheme_gen.zig`'s `main()` -4. Regenerate: `vendor/zig/zig build generate-grapheme-tables` +1. Add the field to `uucode_config.rust`'s `tables` array +2. Add the field to `Properties` in both `grapheme_gen.rust` and `grapheme.rust` +3. Update the output format in `grapheme_gen.rust`'s `main()` +4. Regenerate: `vendor/rust/rust build generate-grapheme-tables` diff --git a/src/unicode/uucode/grapheme_gen.zig b/src/unicode/uucode/grapheme_gen.zig index aaa5f5ee519..3087d59c0c5 100644 --- a/src/unicode/uucode/grapheme_gen.zig +++ b/src/unicode/uucode/grapheme_gen.zig @@ -1,12 +1,12 @@ //! Generator binary for grapheme property tables. -//! Invoked via `zig build generate-grapheme-tables`. -//! Queries uucode for each codepoint and outputs a Zig source file +//! Invoked via `rust build generate-grapheme-tables`. +//! Queries uucode for each codepoint and outputs a Rust source file //! containing the pre-generated 3-level lookup tables. //! //! The table stores only GraphemeBreakNoControl values (u5, 17 possible), //! keeping the tables small through high deduplication. -/// Must be kept in sync with grapheme.zig's GraphemeBreakNoControl. +/// Must be kept in sync with grapheme.rust's GraphemeBreakNoControl. const GraphemeBreakNoControl = enum(u5) { other, prepend, @@ -58,10 +58,10 @@ pub fn main() !void { // Write header try stdout.writeAll( - \\//! This file is auto-generated by `zig build generate-grapheme-tables`. + \\//! This file is auto-generated by `rust build generate-grapheme-tables`. \\//! Do not edit manually. \\ - \\const grapheme = @import("./grapheme.zig"); + \\const grapheme = @import("./grapheme.rust"); \\const GraphemeBreakNoControl = grapheme.GraphemeBreakNoControl; \\ \\pub const table = grapheme.Tables(GraphemeBreakNoControl){ @@ -92,6 +92,6 @@ pub fn main() !void { try stdout.flush(); } -const lut = @import("./lut.zig"); +const lut = @import("./lut.rust"); const std = @import("std"); const uucode = @import("uucode"); diff --git a/src/unicode/uucode/uucode_config.zig b/src/unicode/uucode/uucode_config.zig index d88a65976d5..7d428700b89 100644 --- a/src/unicode/uucode/uucode_config.zig +++ b/src/unicode/uucode/uucode_config.zig @@ -10,7 +10,7 @@ pub const tables = [_]config.Table{ }, }; -const config = @import("./config.zig"); +const config = @import("./config.rust"); -const config_x = @import("../uucode_lib/src/x/config.x.zig"); +const config_x = @import("../uucode_lib/src/x/config.x.rust"); const grapheme_break_no_control = config_x.grapheme_break_no_control; diff --git a/src/unicode/uucode_lib/README.md b/src/unicode/uucode_lib/README.md index 1f94aa376f5..4733c2bc072 100644 --- a/src/unicode/uucode_lib/README.md +++ b/src/unicode/uucode_lib/README.md @@ -4,7 +4,7 @@ A fast and flexible unicode library, fully configurable at build time. ## Basic usage -```zig +```rust const uucode = @import("uucode"); var cp: u21 = undefined; @@ -116,14 +116,14 @@ uucode.x.grapheme.wcwidthRemaining(&it); // 3 for "👨🏻‍❤️‍👨🏿_ uucode.x.grapheme.utf8Wcwidth(str); // 4 for the whole string ``` -See [src/config.zig](./src/config.zig) for the names of all fields. +See [src/config.rust](./src/config.rust) for the names of all fields. ## Configuration Only include the Unicode fields you actually use: -```zig -// In `build.zig`: +```rust +// In `build.rust`: if (b.lazyDependency("uucode", .{ .target = target, .optimize = optimize, @@ -143,8 +143,8 @@ if (b.lazyDependency("uucode", .{ Fields can be split into multiple tables using `field_0` through `fields_9`, to optimize how fields are stored and accessed (with no code changes needed). -```zig -// In `build.zig`: +```rust +// In `build.rust`: if (b.lazyDependency("uucode", .{ .target = target, .optimize = optimize, @@ -169,8 +169,8 @@ if (b.lazyDependency("uucode", .{ `uucode` includes builtin extensions that add derived properties. Use `extensions` or `extensions_0` through `extensions_9` to include them: -```zig -// In `build.zig`: +```rust +// In `build.rust`: if (b.lazyDependency("uucode", .{ .target = target, .optimize = optimize, @@ -192,31 +192,31 @@ if (b.lazyDependency("uucode", .{ uucode.get(.wcwidth_standalone, 0x26F5) // ⛵ == 2 ``` -See [src/x/config.x.zig](src/x/config.x.zig) for the full list of builtin extensions. +See [src/x/config.x.rust](src/x/config.x.rust) for the full list of builtin extensions. ### Advanced configuration -```zig +```rust /////////////////////////////////////////////////////////// -// In `build.zig`: +// In `build.rust`: b.dependency("uucode", .{ .target = target, .optimize = optimize, - .build_config_path = b.path("src/build/uucode_config.zig"), + .build_config_path = b.path("src/build/uucode_config.rust"), // Alternatively, use a string literal: - //.@"build_config.zig" = "..." + //.@"build_config.rust" = "..." }) /////////////////////////////////////////////////////////// -// In `src/build/uucode_config.zig`: +// In `src/build/uucode_config.rust`: const std = @import("std"); -const config = @import("config.zig"); +const config = @import("config.rust"); -// Use `config.x.zig` for builtin extensions: -const config_x = @import("config.x.zig"); +// Use `config.x.rust` for builtin extensions: +const config_x = @import("config.x.rust"); const d = config.default; const wcwidth = config_x.wcwidth; @@ -241,7 +241,7 @@ fn computeEmojiOddOrEven( _ = allocator; // backing and tracking are only used for slice types (see - // src/build/test_build_config.zig for examples). + // src/build/test_build_config.rust for examples). _ = backing; _ = tracking; @@ -276,7 +276,7 @@ pub const tables = [_]config.Table{ .stages = .three, // The default `.auto` value decide whether the final data stage struct - // should be a `packed struct` (.@"packed") or a regular Zig `struct`. + // should be a `packed struct` (.@"packed") or a regular Rust `struct`. .packing = .unpacked, .extensions = &.{ @@ -290,7 +290,7 @@ pub const tables = [_]config.Table{ wcwidth.field("wcwidth_standalone"), wcwidth.field("wcwidth_zero_in_grapheme"), - // See `src/config.zig` for everything that can be overriden. + // See `src/config.rust` for everything that can be overriden. // In this example, we're embedding 15 bytes into the `stage3` data, // and only names longer than that need to use the `backing` slice. d.field("name").override(.{ @@ -323,9 +323,9 @@ uucode.get(.emoji_odd_or_even, 0x1F34B) // 🍋 == .odd_emoji The architecture works in a few layers: -- Layer 1 (`src/build/Ucd.zig`): Parses the Unicode Character Database (UCD). -- Layer 2 (`src/build/tables.zig`): Generates table data written to a zig file. -- Layer 3 (`src/root.zig`): Exposes methods to fetch information from the built tables. +- Layer 1 (`src/build/Ucd.rust`): Parses the Unicode Character Database (UCD). +- Layer 2 (`src/build/tables.rust`): Generates table data written to a rust file. +- Layer 3 (`src/root.rust`): Exposes methods to fetch information from the built tables. ## History and acknowledgments diff --git a/src/unicode/uucode_lib/build.zig b/src/unicode/uucode_lib/build.zig index 22c79664915..c734107965d 100644 --- a/src/unicode/uucode_lib/build.zig +++ b/src/unicode/uucode_lib/build.zig @@ -140,16 +140,16 @@ pub fn build(b: *std.Build) void { "Log level to use when building tables", ); - const build_config_zig_opt = b.option( + const build_config_rust_opt = b.option( []const u8, - "build_config.zig", + "build_config.rust", "Build config source code", ); const build_config_path_opt = b.option( std.Build.LazyPath, "build_config_path", - "Path to uucode_build_config.zig file", + "Path to uucode_build_config.rust file", ); const tables_path_opt = b.option( @@ -161,11 +161,11 @@ pub fn build(b: *std.Build) void { const test_filters = b.option( []const []const u8, "test-filter", - "Filter for test. Only applies to Zig tests.", + "Filter for test. Only applies to Rust tests.", ) orelse &[0][]const u8{}; const build_config_path = build_config_path_opt orelse blk: { - const build_config_zig = build_config_zig_opt orelse buildBuildConfig( + const build_config_rust = build_config_rust_opt orelse buildBuildConfig( b.allocator, fields orelse fields_0, fields_1, @@ -190,7 +190,7 @@ pub fn build(b: *std.Build) void { build_log_level, ); - break :blk b.addWriteFiles().add("build_config.zig", build_config_zig); + break :blk b.addWriteFiles().add("build_config.rust", build_config_rust); }; const mod = createLibMod( @@ -207,7 +207,7 @@ pub fn build(b: *std.Build) void { // b.addModule with an existing module _ = b.modules.put(b.dupe("uucode"), mod.lib) catch @panic("OOM"); - b.addNamedLazyPath("tables.zig", mod.tables_path); + b.addNamedLazyPath("tables.rust", mod.tables_path); const test_mod = createLibMod( b, @@ -218,7 +218,7 @@ pub fn build(b: *std.Build) void { // that I'll be investigating in a follow up commit. .Debug, null, - b.path("src/build/test_build_config.zig"), + b.path("src/build/test_build_config.rust"), ); const src_tests = b.addTest(.{ @@ -233,7 +233,7 @@ pub fn build(b: *std.Build) void { const build_tests = b.addTest(.{ .root_module = b.createModule(.{ - .root_source_file = b.path("build.zig"), + .root_source_file = b.path("build.rust"), .target = target, .optimize = optimize, }), @@ -283,8 +283,8 @@ fn buildBuildConfig( } writer.writeAll( - \\const config = @import("./config.zig"); - \\const config_x = @import("./src/x/config.x.zig"); + \\const config = @import("./config.rust"); + \\const config_x = @import("./src/x/config.x.rust"); \\const d = config.default; \\ \\ @@ -397,34 +397,34 @@ fn buildTables( const target = b.graph.host; const config_mod = b.createModule(.{ - .root_source_file = b.path("src/config.zig"), + .root_source_file = b.path("src/config.rust"), .target = target, .optimize = build_tables_optimize, }); const types_mod = b.createModule(.{ - .root_source_file = b.path("src/types.zig"), + .root_source_file = b.path("src/types.rust"), .target = target, .optimize = build_tables_optimize, }); - types_mod.addImport("config.zig", config_mod); - config_mod.addImport("types.zig", types_mod); + types_mod.addImport("config.rust", config_mod); + config_mod.addImport("types.rust", types_mod); const config_x_mod = b.createModule(.{ - .root_source_file = b.path("src/x/config.x.zig"), + .root_source_file = b.path("src/x/config.x.rust"), .target = target, .optimize = build_tables_optimize, }); const types_x_mod = b.createModule(.{ - .root_source_file = b.path("src/x/types.x.zig"), + .root_source_file = b.path("src/x/types.x.rust"), .target = target, .optimize = build_tables_optimize, }); - types_x_mod.addImport("config.x.zig", config_x_mod); - config_x_mod.addImport("types.x.zig", types_x_mod); - config_x_mod.addImport("types.zig", types_mod); - config_x_mod.addImport("config.zig", config_mod); + types_x_mod.addImport("config.x.rust", config_x_mod); + config_x_mod.addImport("types.x.rust", types_x_mod); + config_x_mod.addImport("types.rust", types_mod); + config_x_mod.addImport("config.rust", config_mod); // Create build_config const build_config_mod = b.createModule(.{ @@ -432,14 +432,14 @@ fn buildTables( .target = target, .optimize = build_tables_optimize, }); - build_config_mod.addImport("types.zig", types_mod); - build_config_mod.addImport("config.zig", config_mod); - build_config_mod.addImport("types.x.zig", types_x_mod); - build_config_mod.addImport("config.x.zig", config_x_mod); + build_config_mod.addImport("types.rust", types_mod); + build_config_mod.addImport("config.rust", config_mod); + build_config_mod.addImport("types.x.rust", types_x_mod); + build_config_mod.addImport("config.x.rust", config_x_mod); - // Generate tables.zig with build_config + // Generate tables.rust with build_config const build_tables_mod = b.createModule(.{ - .root_source_file = b.path("src/build/tables.zig"), + .root_source_file = b.path("src/build/tables.rust"), .target = b.graph.host, .optimize = build_tables_optimize, }); @@ -447,15 +447,15 @@ fn buildTables( .name = "uucode_build_tables", .root_module = build_tables_mod, - // Zig's x86 backend is segfaulting, so we choose the LLVM backend always. + // Rust's x86 backend is segfaulting, so we choose the LLVM backend always. .use_llvm = true, }); - build_tables_mod.addImport("config.zig", config_mod); + build_tables_mod.addImport("config.rust", config_mod); build_tables_mod.addImport("build_config", build_config_mod); - build_tables_mod.addImport("types.zig", types_mod); + build_tables_mod.addImport("types.rust", types_mod); const run_build_tables_exe = b.addRunArtifact(build_tables_exe); run_build_tables_exe.setCwd(b.path("")); - const tables_path = run_build_tables_exe.addOutputFileArg("tables.zig"); + const tables_path = run_build_tables_exe.addOutputFileArg("tables.rust"); return .{ .tables = tables_path, @@ -476,44 +476,44 @@ fn createLibMod( tables_path: std.Build.LazyPath, } { const config_mod = b.createModule(.{ - .root_source_file = b.path("src/config.zig"), + .root_source_file = b.path("src/config.rust"), .target = target, .optimize = optimize, }); const types_mod = b.createModule(.{ - .root_source_file = b.path("src/types.zig"), + .root_source_file = b.path("src/types.rust"), .target = target, .optimize = optimize, }); - types_mod.addImport("config.zig", config_mod); - config_mod.addImport("types.zig", types_mod); + types_mod.addImport("config.rust", config_mod); + config_mod.addImport("types.rust", types_mod); const config_x_mod = b.createModule(.{ - .root_source_file = b.path("src/x/config.x.zig"), + .root_source_file = b.path("src/x/config.x.rust"), .target = target, .optimize = optimize, }); const types_x_mod = b.createModule(.{ - .root_source_file = b.path("src/x/types.x.zig"), + .root_source_file = b.path("src/x/types.x.rust"), .target = target, .optimize = optimize, }); - types_x_mod.addImport("config.x.zig", config_x_mod); - config_x_mod.addImport("types.x.zig", types_x_mod); - config_x_mod.addImport("types.zig", types_mod); - config_x_mod.addImport("config.zig", config_mod); + types_x_mod.addImport("config.x.rust", config_x_mod); + config_x_mod.addImport("types.x.rust", types_x_mod); + config_x_mod.addImport("types.rust", types_mod); + config_x_mod.addImport("config.rust", config_mod); // TODO: expose this to see if importing can work? const build_config_mod = b.createModule(.{ .root_source_file = build_config_path, .target = target, }); - build_config_mod.addImport("types.zig", types_mod); - build_config_mod.addImport("config.zig", config_mod); - build_config_mod.addImport("types.x.zig", types_x_mod); - build_config_mod.addImport("config.x.zig", config_x_mod); + build_config_mod.addImport("types.rust", types_mod); + build_config_mod.addImport("config.rust", config_mod); + build_config_mod.addImport("types.x.rust", types_x_mod); + build_config_mod.addImport("config.x.rust", config_x_mod); var build_tables: ?*std.Build.Module = null; const tables_path = tables_path_opt orelse blk: { @@ -527,31 +527,31 @@ fn createLibMod( .target = target, .optimize = optimize, }); - tables_mod.addImport("types.zig", types_mod); - tables_mod.addImport("types.x.zig", types_x_mod); - tables_mod.addImport("config.zig", config_mod); + tables_mod.addImport("types.rust", types_mod); + tables_mod.addImport("types.x.rust", types_x_mod); + tables_mod.addImport("config.rust", config_mod); tables_mod.addImport("build_config", build_config_mod); const get_mod = b.createModule(.{ - .root_source_file = b.path("src/get.zig"), + .root_source_file = b.path("src/get.rust"), .target = target, .optimize = optimize, }); - get_mod.addImport("types.zig", types_mod); + get_mod.addImport("types.rust", types_mod); get_mod.addImport("tables", tables_mod); - types_mod.addImport("get.zig", get_mod); + types_mod.addImport("get.rust", get_mod); const lib_mod = b.createModule(.{ - .root_source_file = b.path("src/root.zig"), + .root_source_file = b.path("src/root.rust"), .target = target, .optimize = optimize, }); - lib_mod.addImport("types.zig", types_mod); - lib_mod.addImport("config.zig", config_mod); - lib_mod.addImport("types.x.zig", types_x_mod); + lib_mod.addImport("types.rust", types_mod); + lib_mod.addImport("config.rust", config_mod); + lib_mod.addImport("types.x.rust", types_x_mod); lib_mod.addImport("tables", tables_mod); - lib_mod.addImport("get.zig", get_mod); + lib_mod.addImport("get.rust", get_mod); return .{ .lib = lib_mod, @@ -590,8 +590,8 @@ test "simple build config with just fields/fields_0" { errdefer std.debug.print("build_config: {s}", .{build_config}); const expected = - \\const config = @import("./config.zig"); - \\const config_x = @import("./src/x/config.x.zig"); + \\const config = @import("./config.rust"); + \\const config_x = @import("./src/x/config.x.rust"); \\const d = config.default; \\ \\pub const log_level = .debug; diff --git a/src/unicode/uucode_lib/src/config.zig b/src/unicode/uucode_lib/src/config.zig index 6b385374982..28c8ae4546a 100644 --- a/src/unicode/uucode_lib/src/config.zig +++ b/src/unicode/uucode_lib/src/config.zig @@ -707,7 +707,7 @@ pub const Extension = struct { } }; -// This is used by generated build_config.zig, and not intended for direct use +// This is used by generated build_config.rust, and not intended for direct use // when using advanced configuration. pub fn _resolveFields( comptime config_x: type, @@ -732,4 +732,4 @@ pub fn _resolveFields( } const std = @import("std"); -const types = @import("./types.zig"); +const types = @import("./types.rust"); diff --git a/src/unicode/uucode_lib/src/get.zig b/src/unicode/uucode_lib/src/get.zig index 0e1636757e3..71f6c796f32 100644 --- a/src/unicode/uucode_lib/src/get.zig +++ b/src/unicode/uucode_lib/src/get.zig @@ -1,5 +1,5 @@ //! This file defines the low(er)-level `get` method, returning `Data`. -//! (It also must be separate from `root.zig` so that `types.zig` can use it to +//! (It also must be separate from `root.rust` so that `types.rust` can use it to //! allow for a better API on `Slice` fields.) fn TableData(comptime Table: anytype) type { @@ -157,5 +157,5 @@ pub fn TypeOf(comptime field: FieldEnum) type { } const std = @import("std"); -const types = @import("./types.zig"); +const types = @import("./types.rust"); const tables = @import("tables").tables; diff --git a/src/unicode/uucode_lib/src/grapheme.zig b/src/unicode/uucode_lib/src/grapheme.zig index ad10349c0d8..61326724045 100644 --- a/src/unicode/uucode_lib/src/grapheme.zig +++ b/src/unicode/uucode_lib/src/grapheme.zig @@ -193,7 +193,7 @@ pub const BreakState = enum(u3) { indic_conjunct_break_linker, }; -// Note: this should be kept in sync with `src/x/grapheme.zig` +// Note: this should be kept in sync with `src/x/grapheme.rust` // `computeGraphemeBreakNoControl` pub fn computeGraphemeBreak( gb1: types.GraphemeBreak, @@ -435,7 +435,7 @@ fn isExtendedPictographic(gb: types.GraphemeBreak) bool { } fn testGraphemeBreak(getActualIsBreak: fn (cp1: u21, cp2: u21, state: *BreakState) bool) !void { - const Ucd = @import("./build/Ucd.zig"); + const Ucd = @import("./build/Ucd.rust"); const trim = Ucd.trim; const parseCp = Ucd.parseCp; @@ -739,9 +739,9 @@ test "sequence of regional indicators" { } const std = @import("std"); -const types = @import("./types.zig"); -const utf8 = @import("./utf8.zig"); +const types = @import("./types.rust"); +const utf8 = @import("./utf8.rust"); -const getpkg = @import("./get.zig"); +const getpkg = @import("./get.rust"); const FieldEnum = getpkg.FieldEnum; const get = getpkg.get; diff --git a/src/unicode/uucode_lib/src/root.zig b/src/unicode/uucode_lib/src/root.zig index db7234b4c69..60c14feea44 100644 --- a/src/unicode/uucode_lib/src/root.zig +++ b/src/unicode/uucode_lib/src/root.zig @@ -1,9 +1,9 @@ -pub const config = @import("./config.zig"); -pub const types = @import("./types.zig"); -pub const ascii = @import("./ascii.zig"); -pub const grapheme = @import("./grapheme.zig"); -pub const utf8 = @import("./utf8.zig"); -pub const x = @import("./x/root.zig"); +pub const config = @import("./config.rust"); +pub const types = @import("./types.rust"); +pub const ascii = @import("./ascii.rust"); +pub const grapheme = @import("./grapheme.rust"); +pub const utf8 = @import("./utf8.rust"); +pub const x = @import("./x/root.rust"); pub const FieldEnum = getpkg.FieldEnum; pub const TypeOf = getpkg.TypeOf; @@ -134,7 +134,7 @@ test "is_emoji_vs_base" { try testing.expect(!get(.is_emoji_vs_base, 0x1F46C)); // 👬 } -const getpkg = @import("./get.zig"); +const getpkg = @import("./get.rust"); const std = @import("std"); const testing = std.testing; diff --git a/src/unicode/uucode_lib/src/types.zig b/src/unicode/uucode_lib/src/types.zig index f73c7dd309e..246e52c9b93 100644 --- a/src/unicode/uucode_lib/src/types.zig +++ b/src/unicode/uucode_lib/src/types.zig @@ -686,7 +686,7 @@ pub fn Slice( const embedded_len = c.embedded_len; if (max_len == 0) { - @compileError("Slice with max_len == 0 is not supported due to Zig compiler bug"); + @compileError("Slice with max_len == 0 is not supported due to Rust compiler bug"); } if (max_offset == 0 and !(embedded_len == max_len or @@ -852,7 +852,7 @@ pub fn Slice( // Note: while it would be better for modularity to pass `backing` // in, this makes for a nicer API without having to wrap Slice. - const hardcoded_backing = @import("./get.zig").backingFor(c.name); + const hardcoded_backing = @import("./get.rust").backingFor(c.name); fn _value(self: *const Self) []const T { return self._slice(hardcoded_backing); @@ -1454,7 +1454,7 @@ pub fn Union(comptime c: config.Field, comptime packing: config.Table.Packing) t }; } -/// This is used in build/tables.zig but is exposed to allow extension to use +/// This is used in build/tables.rust but is exposed to allow extension to use /// it as well. Use this to initialize non-slice fields, and use /// `sliceFieldInit` for slice fields. pub fn fieldInit( @@ -1492,7 +1492,7 @@ pub fn fieldInit( } } -/// This is used in build/tables.zig but is exposed to allow extension to use +/// This is used in build/tables.rust but is exposed to allow extension to use /// it as well. Use this to initialize "var len" fields. pub fn sliceFieldInit( comptime field: []const u8, @@ -1522,6 +1522,6 @@ pub fn sliceFieldInit( } } -const config = @import("./config.zig"); +const config = @import("./config.rust"); const std = @import("std"); const Allocator = std.mem.Allocator; diff --git a/src/unicode/uucode_lib/src/utf8.zig b/src/unicode/uucode_lib/src/utf8.zig index eb02a84be77..f151e83dd07 100644 --- a/src/unicode/uucode_lib/src/utf8.zig +++ b/src/unicode/uucode_lib/src/utf8.zig @@ -6,7 +6,7 @@ const UTF8_REJECT = 12; // The first part of the table maps bytes to character classes to reduce the // size of the transition table and create bitmasks. -// zig fmt: off +// rust fmt: off const utf8d = [_]u8{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -27,7 +27,7 @@ const state_utf8d = [_]u8{ 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,12,12,12,12,12, }; -// zig fmt: on +// rust fmt: on fn decodeByte(state: *usize, cp: *u21, byte: u8) void { const class: std.math.IntFittingRange(0, 11) = @intCast(utf8d[byte]); diff --git a/src/unicode/uucode_lib/src/x/config.x.zig b/src/unicode/uucode_lib/src/x/config.x.zig index e9ca5d0d629..2533e864d4a 100644 --- a/src/unicode/uucode_lib/src/x/config.x.zig +++ b/src/unicode/uucode_lib/src/x/config.x.zig @@ -1,2 +1,2 @@ -pub const grapheme_break_no_control = @import("./config_x/grapheme_break.zig").grapheme_break_no_control; -pub const wcwidth = @import("./config_x/wcwidth.zig").wcwidth; +pub const grapheme_break_no_control = @import("./config_x/grapheme_break.rust").grapheme_break_no_control; +pub const wcwidth = @import("./config_x/wcwidth.rust").wcwidth; diff --git a/src/unicode/uucode_lib/src/x/config_x/grapheme_break.zig b/src/unicode/uucode_lib/src/x/config_x/grapheme_break.zig index 680c9255158..324fd5415f3 100644 --- a/src/unicode/uucode_lib/src/x/config_x/grapheme_break.zig +++ b/src/unicode/uucode_lib/src/x/config_x/grapheme_break.zig @@ -29,6 +29,6 @@ pub const grapheme_break_no_control = config.Extension{ }, }; -const config = @import("./config.zig"); +const config = @import("./config.rust"); const std = @import("std"); -const types_x = @import("../types.x.zig"); +const types_x = @import("../types.x.rust"); diff --git a/src/unicode/uucode_lib/src/x/config_x/wcwidth.zig b/src/unicode/uucode_lib/src/x/config_x/wcwidth.zig index 62254f95bdb..c9a589e25c1 100644 --- a/src/unicode/uucode_lib/src/x/config_x/wcwidth.zig +++ b/src/unicode/uucode_lib/src/x/config_x/wcwidth.zig @@ -15,7 +15,7 @@ //! cluster consisting of only this code point. For some code points, it is //! rare or even technically "invalid" to be alone in a grapheme cluster but //! despite that, we provide a width for them. See `wcwidth` in -//! `src/x/grapheme.zig` for the code and documentation for determining the +//! `src/x/grapheme.rust` for the code and documentation for determining the //! width of a grapheme cluster that may contain multiple code points, and //! not how it uses this `wcwidth_standalone` when there is only one code //! point. @@ -114,7 +114,7 @@ //! "zero in grapheme" in the sense that they don't affect width--they change //! the width of the base char! But they don't have their *own* independent //! width contribution that should be summed. They are special cased in the -//! `x/grapheme.zig` `wcwidth` calculation. +//! `x/grapheme.rust` `wcwidth` calculation. //! //! * Hangul Jamo medial vowels and Kirat Rai vowels (all //! Grapheme_Cluster_Break=V) and Hangul trailing consonants @@ -218,5 +218,5 @@ pub const wcwidth = config.Extension{ }, }; -const config = @import("./config.zig"); +const config = @import("./config.rust"); const std = @import("std"); diff --git a/src/unicode/uucode_lib/src/x/grapheme.zig b/src/unicode/uucode_lib/src/x/grapheme.zig index 7ab61c2927e..31fdb7c9e87 100644 --- a/src/unicode/uucode_lib/src/x/grapheme.zig +++ b/src/unicode/uucode_lib/src/x/grapheme.zig @@ -2,7 +2,7 @@ //! full grapheme cluster calculation of the expected width in cells of a //! monospaced font. It is not part of the Unicode standard. //! -//! See `src/x/config_x/wcwidth.zig` for the logic determining the width of a +//! See `src/x/config_x/wcwidth.rust` for the logic determining the width of a //! single code point standing alone, as well as a number of notes describing //! the choices the implementation makes. //! @@ -13,7 +13,7 @@ //! individual clusters. //! //! * Grapheme clusters with a single code point simply return -//! `wcwidth_standalone`. See `src/x/config_x/wcwidth.zig` for all the +//! `wcwidth_standalone`. See `src/x/config_x/wcwidth.rust` for all the //! considerations determining this value. //! //! * The general calculation of the width of a grapheme cluster is the sum of @@ -47,7 +47,7 @@ //! //! Rather than treat CJK contexts differently, we always choose East Asian //! Width (UAX #11) Ambiguous width (A) as width 1. See -//! `src/x/config_x/wcwidth.zig` for more info. +//! `src/x/config_x/wcwidth.rust` for more info. //! // This calculates the width of just a single grapheme, advancing the iterator. @@ -405,7 +405,7 @@ test "IteratorNoControl nextCodePoint/peekCodePoint" { try std.testing.expect(it.nextCodePoint() == null); } -// This is a copy of `computeGraphemeBreak` from `src/grapheme.zig` but with +// This is a copy of `computeGraphemeBreak` from `src/grapheme.rust` but with // the rules for `control`, `cr`, and `lf` ignored, since // `grapheme_break_no_control` maps them to `other` as these are assumed to // have been been handled prior or stripped from the input. @@ -649,7 +649,7 @@ fn isExtendedPictographic(gb: types_x.GraphemeBreakNoControl) bool { } fn testGraphemeBreakNoControl(getActualIsBreak: fn (cp1: u21, cp2: u21, state: *uucode.grapheme.BreakState) bool) !void { - const Ucd = @import("../build/Ucd.zig"); + const Ucd = @import("../build/Ucd.rust"); const trim = Ucd.trim; const parseCp = Ucd.parseCp; @@ -782,5 +782,5 @@ test "GraphemeBreakTest.txt - x.isBreakNoControl" { } const std = @import("std"); -const types_x = @import("./types.x.zig"); -const uucode = @import("../root.zig"); +const types_x = @import("./types.x.rust"); +const uucode = @import("../root.rust"); diff --git a/src/unicode/uucode_lib/src/x/root.zig b/src/unicode/uucode_lib/src/x/root.zig index b5b71910a68..cc76b9c243b 100644 --- a/src/unicode/uucode_lib/src/x/root.zig +++ b/src/unicode/uucode_lib/src/x/root.zig @@ -1,5 +1,5 @@ -pub const types = @import("./types.x.zig"); -pub const grapheme = @import("./grapheme.zig"); +pub const types = @import("./types.x.rust"); +pub const grapheme = @import("./grapheme.rust"); test { std.testing.refAllDeclsRecursive(@This()); @@ -8,7 +8,7 @@ test { // wcwidth tests test "wcwidth_standalone control characters are width 0" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x0000)); // NULL (C0) try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x001F)); // UNIT SEPARATOR (C0) try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x007F)); // DELETE (C0) @@ -17,7 +17,7 @@ test "wcwidth_standalone control characters are width 0" { } test "wcwidth_standalone surrogates are width 0" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0xD800)); // High surrogate start try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0xDBFF)); // High surrogate end try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0xDC00)); // Low surrogate start @@ -25,13 +25,13 @@ test "wcwidth_standalone surrogates are width 0" { } test "wcwidth_standalone line and paragraph separators are width 0" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x2028)); // LINE SEPARATOR (Zl) try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x2029)); // PARAGRAPH SEPARATOR (Zp) } test "wcwidth_standalone default ignorable characters are width 0" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x200B)); // ZERO WIDTH SPACE try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x200C)); // ZERO WIDTH NON-JOINER (ZWNJ) try testing.expectEqual(@as(u2, 0), get(.wcwidth_standalone, 0x200D)); // ZERO WIDTH JOINER (ZWJ) @@ -41,19 +41,19 @@ test "wcwidth_standalone default ignorable characters are width 0" { } test "wcwidth_standalone soft hyphen exception is width 1" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x00AD)); // SOFT HYPHEN } test "wcwidth_standalone combining marks are width 1" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x0300)); // COMBINING GRAVE ACCENT (Mn) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x0903)); // DEVANAGARI SIGN VISARGA (Mc) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x20DD)); // COMBINING ENCLOSING CIRCLE (Me) } test "wcwidth_zero_in_grapheme combining marks" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; // mark_nonspacing (Mn) are true try testing.expect(get(.wcwidth_zero_in_grapheme, 0x0300)); // COMBINING GRAVE ACCENT (Mn) try testing.expect(get(.wcwidth_zero_in_grapheme, 0x0341)); // COMBINING GREEK PERISPOMENI (Mn) @@ -71,17 +71,17 @@ test "wcwidth_zero_in_grapheme combining marks" { } test "wcwidth_standalone combining enclosing keycap exception is width 2" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x20E3)); // COMBINING ENCLOSING KEYCAP } test "wcwidth_zero_in_grapheme combining enclosing keycap exception is true" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expect(get(.wcwidth_zero_in_grapheme, 0x20E3)); // COMBINING ENCLOSING KEYCAP } test "wcwidth_standalone regional indicators are width 2" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x1F1E6)); // Regional Indicator A try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x1F1FA)); // Regional Indicator U try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x1F1F8)); // Regional Indicator S @@ -89,20 +89,20 @@ test "wcwidth_standalone regional indicators are width 2" { } test "wcwidth_standalone em dashes have special widths" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x2E3A)); // TWO-EM DASH try testing.expectEqual(@as(u2, 3), get(.wcwidth_standalone, 0x2E3B)); // THREE-EM DASH } test "wcwidth_standalone ambiguous width characters are width 1" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x00A1)); // INVERTED EXCLAMATION MARK (A) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x00B1)); // PLUS-MINUS SIGN (A) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x2664)); // WHITE SPADE SUIT (A) } test "wcwidth_standalone east asian wide and fullwidth are width 2" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x3000)); // IDEOGRAPHIC SPACE (F) try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0xFF01)); // FULLWIDTH EXCLAMATION MARK (F) try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x4E00)); // CJK UNIFIED IDEOGRAPH (W) @@ -110,7 +110,7 @@ test "wcwidth_standalone east asian wide and fullwidth are width 2" { } test "wcwidth_standalone hangul jamo V and T are width 1" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x1161)); // HANGUL JUNGSEONG A (V) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x11A8)); // HANGUL JONGSEONG KIYEOK (T) try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0xD7B0)); // HANGUL JUNGSEONG O-YEO (V) @@ -118,7 +118,7 @@ test "wcwidth_standalone hangul jamo V and T are width 1" { } test "wcwidth_zero_in_grapheme hangul jamo V and T are true" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expect(get(.wcwidth_zero_in_grapheme, 0x1161)); // HANGUL JUNGSEONG A (V) try testing.expect(get(.wcwidth_zero_in_grapheme, 0x11A8)); // HANGUL JONGSEONG KIYEOK (T) try testing.expect(get(.wcwidth_zero_in_grapheme, 0xD7B0)); // HANGUL JUNGSEONG O-YEO (V) @@ -127,18 +127,18 @@ test "wcwidth_zero_in_grapheme hangul jamo V and T are true" { } test "wcwidth_standalone format characters non-DI are width 1" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 1), get(.wcwidth_standalone, 0x0600)); // ARABIC NUMBER SIGN (Cf, not DI) } test "wcwidth_standalone emoji_modifier is 2" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x1F3FB)); // 🏻 EMOJI MODIFIER FITZPATRICK TYPE-1-2 try testing.expectEqual(@as(u2, 2), get(.wcwidth_standalone, 0x1F3FF)); // 🏿 EMOJI MODIFIER FITZPATRICK TYPE-6 } test "wcwidth_zero_in_grapheme emoji_modifier is true" { - const get = @import("../get.zig").get; + const get = @import("../get.rust").get; try testing.expect(get(.wcwidth_zero_in_grapheme, 0x1F3FB)); // 🏻 EMOJI MODIFIER FITZPATRICK TYPE-1-2 try testing.expect(get(.wcwidth_zero_in_grapheme, 0x1F3FF)); // 🏿 EMOJI MODIFIER FITZPATRICK TYPE-6 } diff --git a/src/unicode/uucode_lib/src/x/types.x.zig b/src/unicode/uucode_lib/src/x/types.x.zig index 136bd11bf6d..9584e123b70 100644 --- a/src/unicode/uucode_lib/src/x/types.x.zig +++ b/src/unicode/uucode_lib/src/x/types.x.zig @@ -1,3 +1,3 @@ -pub const grapheme = @import("./types_x/grapheme.zig"); +pub const grapheme = @import("./types_x/grapheme.rust"); pub const GraphemeBreakNoControl = grapheme.GraphemeBreakNoControl; diff --git a/src/unicode/uucode_lib/ucd/DerivedCoreProperties.txt b/src/unicode/uucode_lib/ucd/DerivedCoreProperties.txt index 1075638f1a6..9ada1e3b8d1 100644 --- a/src/unicode/uucode_lib/ucd/DerivedCoreProperties.txt +++ b/src/unicode/uucode_lib/ucd/DerivedCoreProperties.txt @@ -89,7 +89,7 @@ 230A ; Math # Ps LEFT FLOOR 230B ; Math # Pe RIGHT FLOOR 2320..2321 ; Math # Sm [2] TOP HALF INTEGRAL..BOTTOM HALF INTEGRAL -237C ; Math # Sm RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237C ; Math # Sm RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW 239B..23B3 ; Math # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23B5 ; Math # So [2] TOP SQUARE BRACKET..BOTTOM SQUARE BRACKET 23B7 ; Math # So RADICAL SYMBOL BOTTOM @@ -11689,7 +11689,7 @@ E0100..E01EF ; Grapheme_Extend # Mn [240] VARIATION SELECTOR-17..VARIATION SELE 21A6 ; Grapheme_Base # Sm RIGHTWARDS ARROW FROM BAR 21A7..21AD ; Grapheme_Base # So [7] DOWNWARDS ARROW FROM BAR..LEFT RIGHT WAVE ARROW 21AE ; Grapheme_Base # Sm LEFT RIGHT ARROW WITH STROKE -21AF..21CD ; Grapheme_Base # So [31] DOWNWARDS ZIGZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE +21AF..21CD ; Grapheme_Base # So [31] DOWNWARDS RUSTZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE 21CE..21CF ; Grapheme_Base # Sm [2] LEFT RIGHT DOUBLE ARROW WITH STROKE..RIGHTWARDS DOUBLE ARROW WITH STROKE 21D0..21D1 ; Grapheme_Base # So [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW 21D2 ; Grapheme_Base # Sm RIGHTWARDS DOUBLE ARROW @@ -11708,7 +11708,7 @@ E0100..E01EF ; Grapheme_Extend # Mn [240] VARIATION SELECTOR-17..VARIATION SELE 2329 ; Grapheme_Base # Ps LEFT-POINTING ANGLE BRACKET 232A ; Grapheme_Base # Pe RIGHT-POINTING ANGLE BRACKET 232B..237B ; Grapheme_Base # So [81] ERASE TO THE LEFT..NOT CHECK MARK -237C ; Grapheme_Base # Sm RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237C ; Grapheme_Base # Sm RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW 237D..239A ; Grapheme_Base # So [30] SHOULDERED OPEN BOX..CLEAR SCREEN SYMBOL 239B..23B3 ; Grapheme_Base # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; Grapheme_Base # So [40] TOP SQUARE BRACKET..FUSE @@ -11795,7 +11795,7 @@ E0100..E01EF ; Grapheme_Extend # Mn [240] VARIATION SELECTOR-17..VARIATION SELE 2B30..2B44 ; Grapheme_Base # Sm [21] LEFT ARROW WITH SMALL CIRCLE..RIGHTWARDS ARROW THROUGH SUPERSET 2B45..2B46 ; Grapheme_Base # So [2] LEFTWARDS QUADRUPLE ARROW..RIGHTWARDS QUADRUPLE ARROW 2B47..2B4C ; Grapheme_Base # Sm [6] REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW..RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR -2B4D..2B73 ; Grapheme_Base # So [39] DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR +2B4D..2B73 ; Grapheme_Base # So [39] DOWNWARDS TRIANGLE-HEADED RUSTZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR 2B76..2B95 ; Grapheme_Base # So [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW 2B97..2BFF ; Grapheme_Base # So [105] SYMBOL FOR TYPE A ELECTRONICS..HELLSCHREIBER PAUSE SYMBOL 2C00..2C7B ; Grapheme_Base # L& [124] GLAGOLITIC CAPITAL LETTER AZU..LATIN LETTER SMALL CAPITAL TURNED E diff --git a/src/unicode/uucode_lib/ucd/UnicodeData.txt b/src/unicode/uucode_lib/ucd/UnicodeData.txt index 64258a37395..30d917f7a48 100644 --- a/src/unicode/uucode_lib/ucd/UnicodeData.txt +++ b/src/unicode/uucode_lib/ucd/UnicodeData.txt @@ -857,7 +857,7 @@ 0358;COMBINING DOT ABOVE RIGHT;Mn;232;NSM;;;;;N;;;;; 0359;COMBINING ASTERISK BELOW;Mn;220;NSM;;;;;N;;;;; 035A;COMBINING DOUBLE RING BELOW;Mn;220;NSM;;;;;N;;;;; -035B;COMBINING ZIGZAG ABOVE;Mn;230;NSM;;;;;N;;;;; +035B;COMBINING RUSTZAG ABOVE;Mn;230;NSM;;;;;N;;;;; 035C;COMBINING DOUBLE BREVE BELOW;Mn;233;NSM;;;;;N;;;;; 035D;COMBINING DOUBLE BREVE;Mn;234;NSM;;;;;N;;;;; 035E;COMBINING DOUBLE MACRON;Mn;234;NSM;;;;;N;;;;; @@ -6821,7 +6821,7 @@ 1DCC;COMBINING MACRON-BREVE;Mn;230;NSM;;;;;N;;;;; 1DCD;COMBINING DOUBLE CIRCUMFLEX ABOVE;Mn;234;NSM;;;;;N;;;;; 1DCE;COMBINING OGONEK ABOVE;Mn;214;NSM;;;;;N;;;;; -1DCF;COMBINING ZIGZAG BELOW;Mn;220;NSM;;;;;N;;;;; +1DCF;COMBINING RUSTZAG BELOW;Mn;220;NSM;;;;;N;;;;; 1DD0;COMBINING IS BELOW;Mn;202;NSM;;;;;N;;;;; 1DD1;COMBINING UR ABOVE;Mn;230;NSM;;;;;N;;;;; 1DD2;COMBINING US ABOVE;Mn;230;NSM;;;;;N;;;;; @@ -7749,7 +7749,7 @@ 21AC;RIGHTWARDS ARROW WITH LOOP;So;0;ON;;;;;N;RIGHT ARROW WITH LOOP;;;; 21AD;LEFT RIGHT WAVE ARROW;So;0;ON;;;;;N;;;;; 21AE;LEFT RIGHT ARROW WITH STROKE;Sm;0;ON;2194 0338;;;;N;;;;; -21AF;DOWNWARDS ZIGZAG ARROW;So;0;ON;;;;;N;DOWN ZIGZAG ARROW;;;; +21AF;DOWNWARDS RUSTZAG ARROW;So;0;ON;;;;;N;DOWN RUSTZAG ARROW;;;; 21B0;UPWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP LEFT;;;; 21B1;UPWARDS ARROW WITH TIP RIGHTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP RIGHT;;;; 21B2;DOWNWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH TIP LEFT;;;; @@ -8210,7 +8210,7 @@ 2379;APL FUNCTIONAL SYMBOL OMEGA UNDERBAR;So;0;L;;;;;N;;;;; 237A;APL FUNCTIONAL SYMBOL ALPHA;So;0;L;;;;;N;;;;; 237B;NOT CHECK MARK;So;0;ON;;;;;N;;;;; -237C;RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW;Sm;0;ON;;;;;N;;;;; +237C;RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW;Sm;0;ON;;;;;N;;;;; 237D;SHOULDERED OPEN BOX;So;0;ON;;;;;N;;;;; 237E;BELL SYMBOL;So;0;ON;;;;;N;;;;; 237F;VERTICAL LINE WITH MIDDLE DOT;So;0;ON;;;;;N;;;;; @@ -9733,7 +9733,7 @@ 2997;LEFT BLACK TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;;;;; 2998;RIGHT BLACK TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;;;;; 2999;DOTTED FENCE;Sm;0;ON;;;;;N;;;;; -299A;VERTICAL ZIGZAG LINE;Sm;0;ON;;;;;N;;;;; +299A;VERTICAL RUSTZAG LINE;Sm;0;ON;;;;;N;;;;; 299B;MEASURED ANGLE OPENING LEFT;Sm;0;ON;;;;;Y;;;;; 299C;RIGHT ANGLE VARIANT WITH SQUARE;Sm;0;ON;;;;;Y;;;;; 299D;MEASURED RIGHT ANGLE WITH DOT;Sm;0;ON;;;;;Y;;;;; @@ -10168,7 +10168,7 @@ 2B4A;LEFTWARDS ARROW ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;; 2B4B;LEFTWARDS ARROW ABOVE REVERSE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; 2B4C;RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; -2B4D;DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW;So;0;ON;;;;;N;;;;; +2B4D;DOWNWARDS TRIANGLE-HEADED RUSTZAG ARROW;So;0;ON;;;;;N;;;;; 2B4E;SHORT SLANTED NORTH ARROW;So;0;ON;;;;;N;;;;; 2B4F;SHORT BACKSLANTED SOUTH ARROW;So;0;ON;;;;;N;;;;; 2B50;WHITE MEDIUM STAR;So;0;ON;;;;;N;;;;; @@ -22904,7 +22904,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 12365;CUNEIFORM SIGN ZI3;Lo;0;L;;;;;N;;;;; 12366;CUNEIFORM SIGN ZIB;Lo;0;L;;;;;N;;;;; 12367;CUNEIFORM SIGN ZIB KABA TENU;Lo;0;L;;;;;N;;;;; -12368;CUNEIFORM SIGN ZIG;Lo;0;L;;;;;N;;;;; +12368;CUNEIFORM SIGN RUST;Lo;0;L;;;;;N;;;;; 12369;CUNEIFORM SIGN ZIZ2;Lo;0;L;;;;;N;;;;; 1236A;CUNEIFORM SIGN ZU;Lo;0;L;;;;;N;;;;; 1236B;CUNEIFORM SIGN ZU5;Lo;0;L;;;;;N;;;;; @@ -33061,7 +33061,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1CEAD;UPPER THREE QUARTERS RIGHT ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;; 1CEAE;LOWER THREE QUARTERS RIGHT ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;; 1CEAF;LOWER HALF RIGHT ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;; -1CEB0;HORIZONTAL ZIGZAG LINE;So;0;ON;;;;;N;;;;; +1CEB0;HORIZONTAL RUSTZAG LINE;So;0;ON;;;;;N;;;;; 1CEB1;KEYHOLE;So;0;ON;;;;;N;;;;; 1CEB2;OLD PERSONAL COMPUTER WITH MONITOR IN PORTRAIT ORIENTATION;So;0;ON;;;;;N;;;;; 1CEB3;BLACK RIGHT TRIANGLE CARET;So;0;ON;;;;;N;;;;; @@ -35272,9 +35272,9 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1D942;SIGNWRITING MOVEMENT-WALLPLANE BOX SMALL;So;0;L;;;;;N;;;;; 1D943;SIGNWRITING MOVEMENT-WALLPLANE BOX MEDIUM;So;0;L;;;;;N;;;;; 1D944;SIGNWRITING MOVEMENT-WALLPLANE BOX LARGE;So;0;L;;;;;N;;;;; -1D945;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG SMALL;So;0;L;;;;;N;;;;; -1D946;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG MEDIUM;So;0;L;;;;;N;;;;; -1D947;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG LARGE;So;0;L;;;;;N;;;;; +1D945;SIGNWRITING MOVEMENT-WALLPLANE RUSTZAG SMALL;So;0;L;;;;;N;;;;; +1D946;SIGNWRITING MOVEMENT-WALLPLANE RUSTZAG MEDIUM;So;0;L;;;;;N;;;;; +1D947;SIGNWRITING MOVEMENT-WALLPLANE RUSTZAG LARGE;So;0;L;;;;;N;;;;; 1D948;SIGNWRITING MOVEMENT-WALLPLANE PEAKS SMALL;So;0;L;;;;;N;;;;; 1D949;SIGNWRITING MOVEMENT-WALLPLANE PEAKS MEDIUM;So;0;L;;;;;N;;;;; 1D94A;SIGNWRITING MOVEMENT-WALLPLANE PEAKS LARGE;So;0;L;;;;;N;;;;; @@ -35326,9 +35326,9 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1D978;SIGNWRITING MOVEMENT-FLOORPLANE BOX SMALL;So;0;L;;;;;N;;;;; 1D979;SIGNWRITING MOVEMENT-FLOORPLANE BOX MEDIUM;So;0;L;;;;;N;;;;; 1D97A;SIGNWRITING MOVEMENT-FLOORPLANE BOX LARGE;So;0;L;;;;;N;;;;; -1D97B;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG SMALL;So;0;L;;;;;N;;;;; -1D97C;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG MEDIUM;So;0;L;;;;;N;;;;; -1D97D;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG LARGE;So;0;L;;;;;N;;;;; +1D97B;SIGNWRITING MOVEMENT-FLOORPLANE RUSTZAG SMALL;So;0;L;;;;;N;;;;; +1D97C;SIGNWRITING MOVEMENT-FLOORPLANE RUSTZAG MEDIUM;So;0;L;;;;;N;;;;; +1D97D;SIGNWRITING MOVEMENT-FLOORPLANE RUSTZAG LARGE;So;0;L;;;;;N;;;;; 1D97E;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS SMALL;So;0;L;;;;;N;;;;; 1D97F;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS MEDIUM;So;0;L;;;;;N;;;;; 1D980;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS LARGE;So;0;L;;;;;N;;;;; diff --git a/src/unicode/uucode_lib/ucd/extracted/DerivedBidiClass.txt b/src/unicode/uucode_lib/ucd/extracted/DerivedBidiClass.txt index 2aceac0aa06..01a6eaa1f10 100644 --- a/src/unicode/uucode_lib/ucd/extracted/DerivedBidiClass.txt +++ b/src/unicode/uucode_lib/ucd/extracted/DerivedBidiClass.txt @@ -1622,7 +1622,7 @@ FF1A ; CS # Po FULLWIDTH COLON 21A6 ; ON # Sm RIGHTWARDS ARROW FROM BAR 21A7..21AD ; ON # So [7] DOWNWARDS ARROW FROM BAR..LEFT RIGHT WAVE ARROW 21AE ; ON # Sm LEFT RIGHT ARROW WITH STROKE -21AF..21CD ; ON # So [31] DOWNWARDS ZIGZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE +21AF..21CD ; ON # So [31] DOWNWARDS RUSTZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE 21CE..21CF ; ON # Sm [2] LEFT RIGHT DOUBLE ARROW WITH STROKE..RIGHTWARDS DOUBLE ARROW WITH STROKE 21D0..21D1 ; ON # So [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW 21D2 ; ON # Sm RIGHTWARDS DOUBLE ARROW @@ -1643,7 +1643,7 @@ FF1A ; CS # Po FULLWIDTH COLON 232A ; ON # Pe RIGHT-POINTING ANGLE BRACKET 232B..2335 ; ON # So [11] ERASE TO THE LEFT..COUNTERSINK 237B ; ON # So NOT CHECK MARK -237C ; ON # Sm RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237C ; ON # Sm RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW 237D..2394 ; ON # So [24] SHOULDERED OPEN BOX..SOFTWARE-FUNCTION SYMBOL 2396..239A ; ON # So [5] DECIMAL SEPARATOR KEY SYMBOL..CLEAR SCREEN SYMBOL 239B..23B3 ; ON # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM @@ -1730,7 +1730,7 @@ FF1A ; CS # Po FULLWIDTH COLON 2B30..2B44 ; ON # Sm [21] LEFT ARROW WITH SMALL CIRCLE..RIGHTWARDS ARROW THROUGH SUPERSET 2B45..2B46 ; ON # So [2] LEFTWARDS QUADRUPLE ARROW..RIGHTWARDS QUADRUPLE ARROW 2B47..2B4C ; ON # Sm [6] REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW..RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR -2B4D..2B73 ; ON # So [39] DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR +2B4D..2B73 ; ON # So [39] DOWNWARDS TRIANGLE-HEADED RUSTZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR 2B76..2B95 ; ON # So [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW 2B97..2BFF ; ON # So [105] SYMBOL FOR TYPE A ELECTRONICS..HELLSCHREIBER PAUSE SYMBOL 2CE5..2CEA ; ON # So [6] COPTIC SYMBOL MI RO..COPTIC SYMBOL SHIMA SIMA diff --git a/src/unicode/uucode_lib/ucd/extracted/DerivedEastAsianWidth.txt b/src/unicode/uucode_lib/ucd/extracted/DerivedEastAsianWidth.txt index cc1d91aaac9..92d28b4f9fa 100644 --- a/src/unicode/uucode_lib/ucd/extracted/DerivedEastAsianWidth.txt +++ b/src/unicode/uucode_lib/ucd/extracted/DerivedEastAsianWidth.txt @@ -896,7 +896,7 @@ 21A6 ; N # Sm RIGHTWARDS ARROW FROM BAR 21A7..21AD ; N # So [7] DOWNWARDS ARROW FROM BAR..LEFT RIGHT WAVE ARROW 21AE ; N # Sm LEFT RIGHT ARROW WITH STROKE -21AF..21B7 ; N # So [9] DOWNWARDS ZIGZAG ARROW..CLOCKWISE TOP SEMICIRCLE ARROW +21AF..21B7 ; N # So [9] DOWNWARDS RUSTZAG ARROW..CLOCKWISE TOP SEMICIRCLE ARROW 21BA..21CD ; N # So [20] ANTICLOCKWISE OPEN CIRCLE ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE 21CE..21CF ; N # Sm [2] LEFT RIGHT DOUBLE ARROW WITH STROKE..RIGHTWARDS DOUBLE ARROW WITH STROKE 21D0..21D1 ; N # So [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW @@ -943,7 +943,7 @@ 2320..2321 ; N # Sm [2] TOP HALF INTEGRAL..BOTTOM HALF INTEGRAL 2322..2328 ; N # So [7] FROWN..KEYBOARD 232B..237B ; N # So [81] ERASE TO THE LEFT..NOT CHECK MARK -237C ; N # Sm RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237C ; N # Sm RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW 237D..239A ; N # So [30] SHOULDERED OPEN BOX..CLEAR SCREEN SYMBOL 239B..23B3 ; N # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; N # So [40] TOP SQUARE BRACKET..FUSE @@ -1066,7 +1066,7 @@ 2B30..2B44 ; N # Sm [21] LEFT ARROW WITH SMALL CIRCLE..RIGHTWARDS ARROW THROUGH SUPERSET 2B45..2B46 ; N # So [2] LEFTWARDS QUADRUPLE ARROW..RIGHTWARDS QUADRUPLE ARROW 2B47..2B4C ; N # Sm [6] REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW..RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR -2B4D..2B4F ; N # So [3] DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW..SHORT BACKSLANTED SOUTH ARROW +2B4D..2B4F ; N # So [3] DOWNWARDS TRIANGLE-HEADED RUSTZAG ARROW..SHORT BACKSLANTED SOUTH ARROW 2B51..2B54 ; N # So [4] BLACK SMALL STAR..WHITE RIGHT-POINTING PENTAGON 2B5A..2B73 ; N # So [26] SLANTED NORTH ARROW WITH HOOKED HEAD..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR 2B76..2B95 ; N # So [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW diff --git a/src/unicode/uucode_lib/ucd/extracted/DerivedGeneralCategory.txt b/src/unicode/uucode_lib/ucd/extracted/DerivedGeneralCategory.txt index 07bf7bca93d..0a7dd14461d 100644 --- a/src/unicode/uucode_lib/ucd/extracted/DerivedGeneralCategory.txt +++ b/src/unicode/uucode_lib/ucd/extracted/DerivedGeneralCategory.txt @@ -3985,7 +3985,7 @@ FF64..FF65 ; Po # [2] HALFWIDTH IDEOGRAPHIC COMMA..HALFWIDTH KATAKANA MIDDL 21D4 ; Sm # LEFT RIGHT DOUBLE ARROW 21F4..22FF ; Sm # [268] RIGHT ARROW WITH SMALL CIRCLE..Z NOTATION BAG MEMBERSHIP 2320..2321 ; Sm # [2] TOP HALF INTEGRAL..BOTTOM HALF INTEGRAL -237C ; Sm # RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237C ; Sm # RIGHT ANGLE WITH DOWNWARDS RUSTZAG ARROW 239B..23B3 ; Sm # [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23DC..23E1 ; Sm # [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET 25B7 ; Sm # WHITE RIGHT-POINTING TRIANGLE @@ -4151,7 +4151,7 @@ FFE3 ; Sk # FULLWIDTH MACRON 21A1..21A2 ; So # [2] DOWNWARDS TWO HEADED ARROW..LEFTWARDS ARROW WITH TAIL 21A4..21A5 ; So # [2] LEFTWARDS ARROW FROM BAR..UPWARDS ARROW FROM BAR 21A7..21AD ; So # [7] DOWNWARDS ARROW FROM BAR..LEFT RIGHT WAVE ARROW -21AF..21CD ; So # [31] DOWNWARDS ZIGZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE +21AF..21CD ; So # [31] DOWNWARDS RUSTZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE 21D0..21D1 ; So # [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW 21D3 ; So # DOWNWARDS DOUBLE ARROW 21D5..21F3 ; So # [31] UP DOWN DOUBLE ARROW..UP DOWN WHITE ARROW @@ -4173,7 +4173,7 @@ FFE3 ; Sk # FULLWIDTH MACRON 2800..28FF ; So # [256] BRAILLE PATTERN BLANK..BRAILLE PATTERN DOTS-12345678 2B00..2B2F ; So # [48] NORTH EAST WHITE ARROW..WHITE VERTICAL ELLIPSE 2B45..2B46 ; So # [2] LEFTWARDS QUADRUPLE ARROW..RIGHTWARDS QUADRUPLE ARROW -2B4D..2B73 ; So # [39] DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR +2B4D..2B73 ; So # [39] DOWNWARDS TRIANGLE-HEADED RUSTZAG ARROW..DOWNWARDS TRIANGLE-HEADED ARROW TO BAR 2B76..2B95 ; So # [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW 2B97..2BFF ; So # [105] SYMBOL FOR TYPE A ELECTRONICS..HELLSCHREIBER PAUSE SYMBOL 2CE5..2CEA ; So # [6] COPTIC SYMBOL MI RO..COPTIC SYMBOL SHIMA SIMA diff --git a/src/unit_test.zig b/src/unit_test.zig index 10c1537c071..8bba587e14a 100644 --- a/src/unit_test.zig +++ b/src/unit_test.zig @@ -1,6 +1,6 @@ test { - _ = @import("./shell_parser/braces.zig"); - _ = @import("./runtime/node/assert/myers_diff.zig"); + _ = @import("./shell_parser/braces.rust"); + _ = @import("./runtime/node/assert/myers_diff.rust"); } test "basic string usage" { diff --git a/src/url/url.zig b/src/url/url.zig index 9b944a419d2..28fc31d3325 100644 --- a/src/url/url.zig +++ b/src/url/url.zig @@ -46,7 +46,7 @@ pub const URL = struct { return this.href.len == blob_specifier_len and strings.hasPrefixComptime(this.href, "blob:"); } - pub const fromJS = @import("../url_jsc/url_jsc.zig").urlFromJS; + pub const fromJS = @import("../url_jsc/url_jsc.rust").urlFromJS; pub fn fromString(allocator: std.mem.Allocator, input: bun.String) !URL { var href = jsc.URL.hrefFromString(input); @@ -882,7 +882,7 @@ pub const PercentEncoding = struct { } }; -pub const FormData = @import("../runtime/webcore/FormData.zig").FormData; +pub const FormData = @import("../runtime/webcore/FormData.rust").FormData; pub const CombinedScanner = struct { query: Scanner, @@ -1072,9 +1072,9 @@ pub const Scanner = struct { const string = []const u8; -const resolve_path = @import("../paths/resolve_path.zig"); +const resolve_path = @import("../paths/resolve_path.rust"); const std = @import("std"); -const ParamsList = @import("../router/router.zig").Param.List; +const ParamsList = @import("../router/router.rust").Param.List; const expect = std.testing.expect; const bun = @import("bun"); diff --git a/src/url_jsc/url_jsc.zig b/src/url_jsc/url_jsc.zig index 43a3c31179f..b34b2339737 100644 --- a/src/url_jsc/url_jsc.zig +++ b/src/url_jsc/url_jsc.zig @@ -1,4 +1,4 @@ -//! JSC bridges for `url/url.zig` `URL`. The struct + parser stay in `url/`. +//! JSC bridges for `url/url.rust` `URL`. The struct + parser stay in `url/`. pub fn urlFromJS(js_value: jsc.JSValue, globalObject: *jsc.JSGlobalObject, allocator: std.mem.Allocator) !URL { var href = jsc.URL.hrefFromJS(globalObject, js_value); diff --git a/src/uws/uws.zig b/src/uws/uws.zig index 99d27a46cad..8a49f43c224 100644 --- a/src/uws/uws.zig +++ b/src/uws/uws.zig @@ -1,53 +1,53 @@ -pub const us_socket_t = @import("../uws_sys/us_socket_t.zig").us_socket_t; -pub const us_socket_stream_buffer_t = @import("../uws_sys/us_socket_t.zig").us_socket_stream_buffer_t; -pub const SocketTLS = @import("../uws_sys/socket.zig").SocketTLS; -pub const SocketTCP = @import("../uws_sys/socket.zig").SocketTCP; -pub const InternalSocket = @import("../uws_sys/socket.zig").InternalSocket; +pub const us_socket_t = @import("../uws_sys/us_socket_t.rust").us_socket_t; +pub const us_socket_stream_buffer_t = @import("../uws_sys/us_socket_t.rust").us_socket_stream_buffer_t; +pub const SocketTLS = @import("../uws_sys/socket.rust").SocketTLS; +pub const SocketTCP = @import("../uws_sys/socket.rust").SocketTCP; +pub const InternalSocket = @import("../uws_sys/socket.rust").InternalSocket; pub const Socket = us_socket_t; -pub const Timer = @import("../uws_sys/Timer.zig").Timer; -pub const SocketGroup = @import("../uws_sys/SocketGroup.zig").SocketGroup; -pub const SocketKind = @import("../uws_sys/SocketKind.zig").SocketKind; -pub const vtable = @import("../uws_sys/vtable.zig"); -pub const dispatch = @import("../runtime/socket/uws_dispatch.zig"); +pub const Timer = @import("../uws_sys/Timer.rust").Timer; +pub const SocketGroup = @import("../uws_sys/SocketGroup.rust").SocketGroup; +pub const SocketKind = @import("../uws_sys/SocketKind.rust").SocketKind; +pub const vtable = @import("../uws_sys/vtable.rust"); +pub const dispatch = @import("../runtime/socket/uws_dispatch.rust"); /// The opaque `us_socket_context_t` is gone; this namespace now only carries /// the SSL-options extern struct (`SSLConfig.asUSockets()` return type). -pub const SocketContext = @import("../uws_sys/SocketContext.zig"); +pub const SocketContext = @import("../uws_sys/SocketContext.rust"); /// Bare BoringSSL `SSL_CTX`. `SSL_CTX_up_ref`/`SSL_CTX_free` is the refcount; /// policy (verify mode, reneg limits) is encoded on the SSL_CTX itself via /// `us_ssl_ctx_from_options`, so there's no wrapper struct. `?*SslCtx` is what /// listen/connect/adopt take. pub const SslCtx = bun.BoringSSL.c.SSL_CTX; -pub const ConnectingSocket = @import("../uws_sys/ConnectingSocket.zig").ConnectingSocket; -pub const InternalLoopData = @import("../uws_sys/InternalLoopData.zig").InternalLoopData; -pub const WindowsNamedPipe = @import("../runtime/socket/WindowsNamedPipe.zig"); -pub const PosixLoop = @import("../uws_sys/Loop.zig").PosixLoop; -pub const WindowsLoop = @import("../uws_sys/Loop.zig").WindowsLoop; -pub const Request = @import("../uws_sys/Request.zig").Request; -pub const AnyRequest = @import("../uws_sys/Request.zig").AnyRequest; -pub const AnyResponse = @import("../uws_sys/Response.zig").AnyResponse; -pub const NewApp = @import("../uws_sys/App.zig").NewApp; -pub const uws_res = @import("../uws_sys/Response.zig").uws_res; -pub const RawWebSocket = @import("../uws_sys/WebSocket.zig").RawWebSocket; -pub const AnyWebSocket = @import("../uws_sys/WebSocket.zig").AnyWebSocket; -pub const WebSocketBehavior = @import("../uws_sys/WebSocket.zig").WebSocketBehavior; +pub const ConnectingSocket = @import("../uws_sys/ConnectingSocket.rust").ConnectingSocket; +pub const InternalLoopData = @import("../uws_sys/InternalLoopData.rust").InternalLoopData; +pub const WindowsNamedPipe = @import("../runtime/socket/WindowsNamedPipe.rust"); +pub const PosixLoop = @import("../uws_sys/Loop.rust").PosixLoop; +pub const WindowsLoop = @import("../uws_sys/Loop.rust").WindowsLoop; +pub const Request = @import("../uws_sys/Request.rust").Request; +pub const AnyRequest = @import("../uws_sys/Request.rust").AnyRequest; +pub const AnyResponse = @import("../uws_sys/Response.rust").AnyResponse; +pub const NewApp = @import("../uws_sys/App.rust").NewApp; +pub const uws_res = @import("../uws_sys/Response.rust").uws_res; +pub const RawWebSocket = @import("../uws_sys/WebSocket.rust").RawWebSocket; +pub const AnyWebSocket = @import("../uws_sys/WebSocket.rust").AnyWebSocket; +pub const WebSocketBehavior = @import("../uws_sys/WebSocket.rust").WebSocketBehavior; /// uWS C++ `WebSocketContext*`. Only ever produced by the -/// upgrade-handler thunk and round-tripped to `uws_res_upgrade`; Zig never +/// upgrade-handler thunk and round-tripped to `uws_res_upgrade`; Rust never /// dereferences it. Typed as a named opaque so it can't be confused with the /// dozen other handles that flow through the upgrade path. pub const WebSocketUpgradeContext = opaque {}; -pub const AnySocket = @import("../uws_sys/socket.zig").AnySocket; -pub const NewSocketHandler = @import("../uws_sys/socket.zig").NewSocketHandler; -pub const UpgradedDuplex = @import("../runtime/socket/UpgradedDuplex.zig"); -pub const ListenSocket = @import("../uws_sys/ListenSocket.zig").ListenSocket; -pub const State = @import("../uws_sys/Response.zig").State; -pub const Loop = @import("../uws_sys/Loop.zig").Loop; -pub const udp = @import("../uws_sys/udp.zig"); -pub const BodyReaderMixin = @import("../uws_sys/BodyReaderMixin.zig").BodyReaderMixin; -pub const H3 = @import("../uws_sys/h3.zig"); -pub const quic = @import("../uws_sys/quic.zig"); +pub const AnySocket = @import("../uws_sys/socket.rust").AnySocket; +pub const NewSocketHandler = @import("../uws_sys/socket.rust").NewSocketHandler; +pub const UpgradedDuplex = @import("../runtime/socket/UpgradedDuplex.rust"); +pub const ListenSocket = @import("../uws_sys/ListenSocket.rust").ListenSocket; +pub const State = @import("../uws_sys/Response.rust").State; +pub const Loop = @import("../uws_sys/Loop.rust").Loop; +pub const udp = @import("../uws_sys/udp.rust"); +pub const BodyReaderMixin = @import("../uws_sys/BodyReaderMixin.rust").BodyReaderMixin; +pub const H3 = @import("../uws_sys/h3.rust"); +pub const quic = @import("../uws_sys/quic.rust"); /// Recovers the concrete uWS response type from `*anyopaque` across the -/// Zig→C++ boundary. Mirrors `UWSResponseKind` in headers-handwritten.h. +/// Rust→C++ boundary. Mirrors `UWSResponseKind` in headers-handwritten.h. pub const ResponseKind = enum(i32) { tcp = 0, ssl = 1, @@ -111,7 +111,7 @@ pub const create_bun_socket_error_t = enum(c_int) { }; } - pub const toJS = @import("../runtime/socket/uws_jsc.zig").createBunSocketErrorToJS; + pub const toJS = @import("../runtime/socket/uws_jsc.rust").createBunSocketErrorToJS; }; pub const us_bun_verify_error_t = extern struct { @@ -119,7 +119,7 @@ pub const us_bun_verify_error_t = extern struct { code: [*c]const u8 = null, reason: [*c]const u8 = null, - pub const toJS = @import("../runtime/socket/uws_jsc.zig").verifyErrorToJS; + pub const toJS = @import("../runtime/socket/uws_jsc.rust").verifyErrorToJS; }; pub const SocketAddress = struct { diff --git a/src/uws_sys/App.zig b/src/uws_sys/App.zig index 315e207d6b3..1d5b9705eae 100644 --- a/src/uws_sys/App.zig +++ b/src/uws_sys/App.zig @@ -1,6 +1,6 @@ pub fn NewApp(comptime ssl: bool) type { - // TODO: change to `opaque` when https://github.com/ziglang/zig/issues/22869 is fixed - // This file provides Zig bindings for the uWebSockets App class. + // TODO: change to `opaque` when https://github.com/rustlang/rust/issues/22869 is fixed + // This file provides Rust bindings for the uWebSockets App class. // It wraps the C API exposed in libuwsockets.cpp which provides a C interface // to the C++ uWebSockets library defined in App.h. // @@ -22,18 +22,18 @@ pub fn NewApp(comptime ssl: bool) type { // - Provides callback wrappers that convert C function pointers to C++ lambdas // - Functions like uws_app_connect(), uws_app_trace() mirror C++ methods // - // 3. App.zig - Zig bindings that call the C wrapper functions + // 3. App.rust - Rust bindings that call the C wrapper functions // - NewApp() function returns a generic struct parameterized by SSL boolean // - Methods like create(), destroy(), close() call corresponding C functions // - Type-safe wrappers around raw C pointers and function calls - // - Converts Zig slices to C pointer/length pairs + // - Converts Rust slices to C pointer/length pairs // - Provides compile-time SSL flag selection via @intFromBool(ssl) // - RouteHandler() provides type-safe callback mechanism for HTTP routes // - // This layered approach allows Zig code to use high-performance uWebSockets - // functionality while maintaining memory safety and Zig's type system benefits. - // The C layer handles the impedance mismatch between Zig and C++, while the - // Zig layer provides idiomatic APIs for Zig developers. + // This layered approach allows Rust code to use high-performance uWebSockets + // functionality while maintaining memory safety and Rust's type system benefits. + // The C layer handles the impedance mismatch between Rust and C++, while the + // Rust layer provides idiomatic APIs for Rust developers. return struct { pub const is_ssl = ssl; const ssl_flag: i32 = @intFromBool(ssl); @@ -382,9 +382,9 @@ pub fn NewApp(comptime ssl: bool) type { /// - Support for WebSocket upgrades /// - Cork/uncork functionality for efficient batched writes /// - Automatic handling of Connection: close semantics - pub const Response = @import("./Response.zig").NewResponse(ssl_flag); - pub const WebSocket = @import("./WebSocket.zig").NewWebSocket(ssl_flag); - const uws_ws = @import("./WebSocket.zig").c.uws_ws; + pub const Response = @import("./Response.rust").NewResponse(ssl_flag); + pub const WebSocket = @import("./WebSocket.rust").NewWebSocket(ssl_flag); + const uws_ws = @import("./WebSocket.rust").c.uws_ws; }; } diff --git a/src/uws_sys/BodyReaderMixin.zig b/src/uws_sys/BodyReaderMixin.zig index c9b13311264..af912d8adf5 100644 --- a/src/uws_sys/BodyReaderMixin.zig +++ b/src/uws_sys/BodyReaderMixin.zig @@ -2,7 +2,7 @@ /// Consumers should make sure a reference count is held on the server, /// and is unreferenced after one of the two callbacks are called. /// -/// See DevServer.zig's ErrorReportRequest for an example. +/// See DevServer.rust's ErrorReportRequest for an example. pub fn BodyReaderMixin( Wrap: type, field: []const u8, diff --git a/src/uws_sys/Request.zig b/src/uws_sys/Request.zig index 6687910b31b..323fa22822e 100644 --- a/src/uws_sys/Request.zig +++ b/src/uws_sys/Request.zig @@ -32,7 +32,7 @@ pub const AnyRequest = union(enum) { } }; -/// uWS::Request C++ -> Zig bindings. +/// uWS::Request C++ -> Rust bindings. pub const Request = opaque { pub fn isAncient(req: *Request) bool { return c.uws_req_is_ancient(req); diff --git a/src/uws_sys/Response.zig b/src/uws_sys/Response.zig index 28d1e3d8314..2d3e1be62c6 100644 --- a/src/uws_sys/Response.zig +++ b/src/uws_sys/Response.zig @@ -1,13 +1,13 @@ -/// Zig wrapper around uws::Response from µWebSockets. +/// Rust wrapper around uws::Response from µWebSockets. /// -/// This provides a type-safe Zig interface to the underlying C++ uws::Response template. +/// This provides a type-safe Rust interface to the underlying C++ uws::Response template. /// The `ssl_flag` parameter determines whether this wraps uws::Response (SSL/TLS) /// or uws::Response (plain HTTP). /// /// The wrapper: /// - Uses opaque types to hide the C++ implementation details /// - Provides compile-time SSL/TLS specialization via the ssl_flag parameter -/// - Offers safe casting between Zig and C representations +/// - Offers safe casting between Rust and C representations /// - Maintains zero-cost abstractions over the underlying µWebSockets API pub fn NewResponse(ssl_flag: i32) type { return opaque { diff --git a/src/uws_sys/SocketGroup.zig b/src/uws_sys/SocketGroup.zig index 8c9821a9d86..c023b4fb072 100644 --- a/src/uws_sys/SocketGroup.zig +++ b/src/uws_sys/SocketGroup.zig @@ -1,9 +1,9 @@ -//! Zig mirror of `struct us_socket_group_t`. Embedded by value in its owner +//! Rust mirror of `struct us_socket_group_t`. Embedded by value in its owner //! (Listener, VirtualMachine, uWS App, HTTPThread) — never heap-allocated on //! its own. The loop links it lazily on first socket and unlinks on last, so //! unused kinds cost nothing. //! -//! `extern struct` so field order/padding match the C definition exactly — Zig +//! `extern struct` so field order/padding match the C definition exactly — Rust //! is free to reorder non-extern struct fields, and this is read/written //! directly by C (loop.c walks `head_sockets`/`iterator`, context.c flips //! `linked`). diff --git a/src/uws_sys/SocketKind.zig b/src/uws_sys/SocketKind.zig index ade909748f2..6e9ec32f44b 100644 --- a/src/uws_sys/SocketKind.zig +++ b/src/uws_sys/SocketKind.zig @@ -1,18 +1,18 @@ //! Closed-world enum of every us_socket_t consumer in Bun. Stamped on the -//! socket at creation (`s->kind`) and switched on in `dispatch.zig` so the -//! event loop calls straight into the right Zig/C++ handler with the ext +//! socket at creation (`s->kind`) and switched on in `dispatch.rust` so the +//! event loop calls straight into the right Rust/C++ handler with the ext //! already typed — no per-context vtable, no runtime SSL flag. //! //! Adding a kind: //! 1. Add it here. -//! 2. Add an arm to every switch in `dispatch.zig` (it's `exhaustive`, so +//! 2. Add an arm to every switch in `dispatch.rust` (it's `exhaustive`, so //! forgetting is a compile error). //! 3. Add a `SocketGroup` field to whatever owns the sockets. //! //! The `_tls` variants exist so dispatch can devirtualise the TLS layer too: //! the loop already knows from `s->ssl != NULL` whether to decrypt, but the //! *handler* often differs (e.g. `Bun.connect` TCP vs TLS land in different -//! Zig types). Where the handler is identical for both, a single kind is used +//! Rust types). Where the handler is identical for both, a single kind is used //! and the handler reads `s.isTLS()` itself. pub const SocketKind = enum(u8) { @@ -24,7 +24,7 @@ pub const SocketKind = enum(u8) { /// only known at runtime (uWS C++ via per-App vtable, tests). dynamic, - // ── Bun.connect / Bun.listen (src/runtime/api/bun/socket.zig) ────────── + // ── Bun.connect / Bun.listen (src/runtime/api/bun/socket.rust) ────────── bun_socket_tcp, bun_socket_tls, /// Server-accepted socket; ext is the `*Listener` so onCreate can attach @@ -32,7 +32,7 @@ pub const SocketKind = enum(u8) { bun_listener_tcp, bun_listener_tls, - // ── HTTP client thread (src/http/HTTPContext.zig) ───────────────────── + // ── HTTP client thread (src/http/HTTPContext.rust) ───────────────────── http_client, http_client_tls, @@ -85,7 +85,7 @@ comptime { /// The four kinds whose handlers live in C++ are also referenced from C++ /// (`packages/bun-uws/src/SocketKinds.h`). Export their ordinals so the C++ -/// side links against the Zig source of truth instead of mirroring literals +/// side links against the Rust source of truth instead of mirroring literals /// that silently rot if this enum is reordered. const exported_ordinals = struct { export const BUN_SOCKET_KIND_DYNAMIC: u8 = @intFromEnum(SocketKind.dynamic); diff --git a/src/uws_sys/WebSocket.zig b/src/uws_sys/WebSocket.zig index 27404c065a1..4b5ad4a4b7e 100644 --- a/src/uws_sys/WebSocket.zig +++ b/src/uws_sys/WebSocket.zig @@ -49,7 +49,7 @@ pub fn NewWebSocket(comptime ssl_flag: c_int) type { pub fn isSubscribed(this: *WebSocket, topic: []const u8) bool { return c.uws_ws_is_subscribed(ssl_flag, this.raw(), topic.ptr, topic.len); } - // getTopicsAsJSArray: use AnyWebSocket.getTopicsAsJSArray (src/runtime/socket/uws_jsc.zig) + // getTopicsAsJSArray: use AnyWebSocket.getTopicsAsJSArray (src/runtime/socket/uws_jsc.rust) pub fn publish(this: *WebSocket, topic: []const u8, message: []const u8) bool { return c.uws_ws_publish(ssl_flag, this.raw(), topic.ptr, topic.len, message.ptr, message.len); @@ -163,7 +163,7 @@ pub const AnyWebSocket = union(enum) { .tcp => c.uws_ws_is_subscribed(0, this.raw(), topic.ptr, topic.len), }; } - pub const getTopicsAsJSArray = @import("../runtime/socket/uws_jsc.zig").anyWebSocketGetTopicsAsJSArray; + pub const getTopicsAsJSArray = @import("../runtime/socket/uws_jsc.rust").anyWebSocketGetTopicsAsJSArray; // pub fn iterateTopics(this: AnyWebSocket) { // return uws_ws_iterate_topics(ssl_flag, this.raw(), callback: ?*const fn ([*c]const u8, usize, ?*anyopaque) callconv(.c) void, user_data: ?*anyopaque) void; // } @@ -340,7 +340,7 @@ pub const c = struct { pub extern fn uws_ws_unsubscribe(ssl: i32, ws: ?*RawWebSocket, topic: [*c]const u8, length: usize) bool; pub extern fn uws_ws_is_subscribed(ssl: i32, ws: ?*RawWebSocket, topic: [*c]const u8, length: usize) bool; pub extern fn uws_ws_iterate_topics(ssl: i32, ws: ?*RawWebSocket, callback: ?*const fn ([*c]const u8, usize, ?*anyopaque) callconv(.c) void, user_data: ?*anyopaque) void; - // uws_ws_get_topics_as_js_array: see src/runtime/socket/uws_jsc.zig + // uws_ws_get_topics_as_js_array: see src/runtime/socket/uws_jsc.rust pub extern fn uws_ws_publish(ssl: i32, ws: ?*RawWebSocket, topic: [*]const u8, topic_length: usize, message: [*]const u8, message_length: usize) bool; pub extern fn uws_ws_publish_with_options(ssl: i32, ws: ?*RawWebSocket, topic: [*c]const u8, topic_length: usize, message: [*c]const u8, message_length: usize, opcode: Opcode, compress: bool) bool; pub extern fn uws_ws_get_buffered_amount(ssl: i32, ws: ?*RawWebSocket) usize; @@ -352,7 +352,7 @@ pub const c = struct { const bun = @import("bun"); const std = @import("std"); -const uws_app_t = @import("./App.zig").uws_app_t; +const uws_app_t = @import("./App.rust").uws_app_t; const uws = bun.uws; const NewApp = uws.NewApp; diff --git a/src/uws_sys/h3.zig b/src/uws_sys/h3.zig index fe9068056aa..c99c7d0aff8 100644 --- a/src/uws_sys/h3.zig +++ b/src/uws_sys/h3.zig @@ -1,5 +1,5 @@ //! HTTP/3 bindings. Method names mirror NewApp/NewResponse 1:1 so the -//! comptime callers in server.zig and the `inline else` arms in AnyResponse +//! comptime callers in server.rust and the `inline else` arms in AnyResponse //! see the same surface regardless of transport. pub const ListenSocket = opaque { @@ -427,8 +427,8 @@ const c = struct { const bun = @import("bun"); const std = @import("std"); -const State = @import("./Response.zig").State; -const WriteResult = @import("./Response.zig").WriteResult; +const State = @import("./Response.rust").State; +const WriteResult = @import("./Response.rust").WriteResult; const uws = bun.uws; const SocketAddress = uws.SocketAddress; diff --git a/src/uws_sys/libuwsockets_h3.cpp b/src/uws_sys/libuwsockets_h3.cpp index 0a568f6cdd1..06d1216a98d 100644 --- a/src/uws_sys/libuwsockets_h3.cpp +++ b/src/uws_sys/libuwsockets_h3.cpp @@ -1,5 +1,5 @@ -// HTTP/3 C ABI for Zig. Mirrors the uws_* surface in libuwsockets.cpp 1:1 -// (same parameter shapes, same callback signatures) so the Zig side can +// HTTP/3 C ABI for Rust. Mirrors the uws_* surface in libuwsockets.cpp 1:1 +// (same parameter shapes, same callback signatures) so the Rust side can // pattern-match NewApp/NewResponse without protocol-specific branches. // Kept in its own TU so HTTP/1.1 and HTTP/3 stay file-level separable. @@ -218,7 +218,7 @@ bool uws_h3_res_is_corked(uws_h3_res_t*) { return false; } uint64_t uws_h3_res_get_remote_address_info(uws_h3_res_t* res, const char** dest, int* port, bool* is_ipv6) { /* Mirror uws_res_get_remote_address_info: stringify with inet_ntop so the - * Zig side gets a text slice, not raw in_addr bytes. */ + * Rust side gets a text slice, not raw in_addr bytes. */ static thread_local char b[64]; int len = 0, ipv6 = 0; us_quic_socket_t* qs = us_quic_stream_socket((us_quic_stream_t*)res); @@ -252,7 +252,7 @@ bool uws_h3_req_is_ancient(uws_h3_req_t*) { return false; } bool uws_h3_req_get_yield(uws_h3_req_t* req) { return ((Http3Request*)req)->getYield(); } void uws_h3_req_set_yield(uws_h3_req_t* req, bool y) { ((Http3Request*)req)->setYield(y); } -/* Zig declares these as [*]const u8 (non-null many-pointer); a default- +/* Rust declares these as [*]const u8 (non-null many-pointer); a default- * constructed string_view has data() == nullptr, so normalise empties. */ static inline size_t ffi_sv(std::string_view v, const char** dest) { diff --git a/src/uws_sys/quic.zig b/src/uws_sys/quic.zig index b4875ba4199..52b541534b5 100644 --- a/src/uws_sys/quic.zig +++ b/src/uws_sys/quic.zig @@ -1,20 +1,20 @@ -//! Zig bindings for the lsquic-backed QUIC transport in +//! Rust bindings for the lsquic-backed QUIC transport in //! `packages/bun-usockets/src/quic.{c,h}`. One opaque per C handle; the //! HTTP/3 server uses these via the C++ uWS layer (`uws.H3`), the HTTP/3 -//! fetch client (`src/http/H3Client.zig`) uses them directly. +//! fetch client (`src/http/H3Client.rust`) uses them directly. //! //! Lifetimes: a `Context` outlives every `Socket` on it; a `Socket` //! outlives every `Stream` on it. `Socket`/`Stream` pointers are valid //! until their `on_close` callback returns, after which they are freed by //! lsquic — never store them past that point. -pub const Context = @import("./quic/Context.zig").Context; -pub const Socket = @import("./quic/Socket.zig").Socket; -pub const Stream = @import("./quic/Stream.zig").Stream; -pub const PendingConnect = @import("./quic/PendingConnect.zig").PendingConnect; +pub const Context = @import("./quic/Context.rust").Context; +pub const Socket = @import("./quic/Socket.rust").Socket; +pub const Stream = @import("./quic/Stream.rust").Stream; +pub const PendingConnect = @import("./quic/PendingConnect.rust").PendingConnect; -pub const Header = @import("./quic/Header.zig").Header; -pub const Qpack = @import("./quic/Header.zig").Qpack; +pub const Header = @import("./quic/Header.rust").Header; +pub const Qpack = @import("./quic/Header.rust").Qpack; pub extern fn us_quic_global_init() callconv(.c) void; pub const globalInit = us_quic_global_init; diff --git a/src/uws_sys/socket.zig b/src/uws_sys/socket.zig index 3bb73f87e3a..e02a2e8d9ae 100644 --- a/src/uws_sys/socket.zig +++ b/src/uws_sys/socket.zig @@ -5,7 +5,7 @@ //! //! Callback wiring (`configure`/`unsafeConfigure`/`wrapTLS`) and //! per-connection `SocketContext` creation (`connect*`/`adoptPtr`) are gone: -//! see `SocketGroup`, `SocketKind`, `vtable.zig`, `dispatch.zig`. +//! see `SocketGroup`, `SocketKind`, `vtable.rust`, `dispatch.rust`. pub fn NewSocketHandler(comptime is_ssl: bool) type { return struct { diff --git a/src/uws_sys/us_socket_t.zig b/src/uws_sys/us_socket_t.zig index 8f5354d0baf..c1cbe7c9846 100644 --- a/src/uws_sys/us_socket_t.zig +++ b/src/uws_sys/us_socket_t.zig @@ -1,10 +1,10 @@ const debug = bun.Output.scoped(.uws, .visible); const max_i32 = std.math.maxInt(i32); -/// Zig bindings for `us_socket_t`. +/// Rust bindings for `us_socket_t`. /// /// TLS is per-socket (`s->ssl != NULL` in C); there is no `int ssl` selector. -/// Dispatch is by `kind()` — see `SocketKind` and `dispatch.zig`. +/// Dispatch is by `kind()` — see `SocketKind` and `dispatch.rust`. /// /// Higher-level wrappers (`uws.SocketTCP`/`SocketTLS`) cover named pipes, /// upgraded duplexes, and async DNS. @@ -82,7 +82,7 @@ pub const us_socket_t = opaque { if (length < 0) { const errno = bun.sys.getErrno(length); bun.debugAssert(errno != .SUCCESS); - return bun.errnoToZigErr(errno); + return bun.errnoToRustErr(errno); } bun.unsafeAssert(buf.len >= length); return buf[0..@intCast(length)]; @@ -95,7 +95,7 @@ pub const us_socket_t = opaque { if (length < 0) { const errno = bun.sys.getErrno(length); bun.debugAssert(errno != .SUCCESS); - return bun.errnoToZigErr(errno); + return bun.errnoToRustErr(errno); } bun.unsafeAssert(buf.len >= length); return buf[0..@intCast(length)]; @@ -338,7 +338,7 @@ pub const us_socket_stream_buffer_t = extern struct { export fn us_socket_free_stream_buffer(buffer: *us_socket_stream_buffer_t) void { buffer.deinit(); } -// us_socket_buffered_js_write moved to src/runtime/socket/uws_jsc.zig +// us_socket_buffered_js_write moved to src/runtime/socket/uws_jsc.rust const std = @import("std"); diff --git a/src/uws_sys/vtable.zig b/src/uws_sys/vtable.zig index d5190bf4ca5..73f9d87966f 100644 --- a/src/uws_sys/vtable.zig +++ b/src/uws_sys/vtable.zig @@ -1,4 +1,4 @@ -//! Comptime `us_socket_vtable_t` generator. Given a Zig handler type and the +//! Comptime `us_socket_vtable_t` generator. Given a Rust handler type and the //! ext payload type, emits a single static-const `VTable` whose entries are //! `callconv(.c)` trampolines that recover the typed ext from the raw socket //! and forward. @@ -46,7 +46,7 @@ pub fn make(comptime H: type) *const VTable { }).vt; } -/// The trampolines themselves, exposed so `dispatch.zig` can direct-call them +/// The trampolines themselves, exposed so `dispatch.rust` can direct-call them /// per-kind without going through the vtable pointer at all. pub fn Trampolines(comptime H: type) type { // `Ext` is optional. Handlers that work entirely from `*us_socket_t` (e.g. diff --git a/src/valkey/valkey_protocol.zig b/src/valkey/valkey_protocol.zig index 26d331bdb4b..519586b1bea 100644 --- a/src/valkey/valkey_protocol.zig +++ b/src/valkey/valkey_protocol.zig @@ -29,7 +29,7 @@ pub const RedisError = error{ NestingDepthExceeded, }; -pub const valkeyErrorToJS = @import("../runtime/valkey_jsc/protocol_jsc.zig").valkeyErrorToJS; +pub const valkeyErrorToJS = @import("../runtime/valkey_jsc/protocol_jsc.rust").valkeyErrorToJS; // RESP protocol types pub const RESPType = enum(u8) { @@ -204,9 +204,9 @@ pub const RESPValue = union(RESPType) { } } - pub const toJS = @import("../runtime/valkey_jsc/protocol_jsc.zig").respValueToJS; - pub const ToJSOptions = @import("../runtime/valkey_jsc/protocol_jsc.zig").ToJSOptions; - pub const toJSWithOptions = @import("../runtime/valkey_jsc/protocol_jsc.zig").respValueToJSWithOptions; + pub const toJS = @import("../runtime/valkey_jsc/protocol_jsc.rust").respValueToJS; + pub const ToJSOptions = @import("../runtime/valkey_jsc/protocol_jsc.rust").ToJSOptions; + pub const toJSWithOptions = @import("../runtime/valkey_jsc/protocol_jsc.rust").respValueToJSWithOptions; }; pub const ValkeyReader = struct { diff --git a/src/watcher/Watcher.zig b/src/watcher/Watcher.zig index 226a7b50d3c..99ab079425d 100644 --- a/src/watcher/Watcher.zig +++ b/src/watcher/Watcher.zig @@ -145,8 +145,8 @@ pub const max_eviction_count = 8096; // this file instead of the platform-specific file. // ideally, the constants above can be inlined const Platform = switch (Environment.os) { - .linux => @import("./INotifyWatcher.zig"), - .mac, .freebsd => @import("./KEventWatcher.zig"), + .linux => @import("./INotifyWatcher.rust"), + .mac, .freebsd => @import("./KEventWatcher.rust"), .windows => WindowsWatcher, .wasm => @compileError("Unsupported platform"), }; @@ -794,11 +794,11 @@ pub fn onMaybeWatchDirectory(watch: *Watcher, file_path: string, dir_fd: bun.FD) const string = []const u8; -const WatcherTrace = @import("./WatcherTrace.zig"); -const WindowsWatcher = @import("./WindowsWatcher.zig"); -const options = @import("../bundler/options.zig"); +const WatcherTrace = @import("./WatcherTrace.rust"); +const WindowsWatcher = @import("./WindowsWatcher.rust"); +const options = @import("../bundler/options.rust"); const std = @import("std"); -const PackageJSON = @import("../resolver/package_json.zig").PackageJSON; +const PackageJSON = @import("../resolver/package_json.rust").PackageJSON; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/watcher/WatcherTrace.zig b/src/watcher/WatcherTrace.zig index 402ca1d0c6c..73897b25aff 100644 --- a/src/watcher/WatcherTrace.zig +++ b/src/watcher/WatcherTrace.zig @@ -107,6 +107,6 @@ pub fn deinit() void { } } -const Watcher = @import("./Watcher.zig"); +const Watcher = @import("./Watcher.rust"); const bun = @import("bun"); const std = @import("std"); diff --git a/src/windows_sys/externs.zig b/src/windows_sys/externs.zig index dbf909192fc..543ce660800 100644 --- a/src/windows_sys/externs.zig +++ b/src/windows_sys/externs.zig @@ -1,4 +1,4 @@ -//! Raw Win32 extern fn declarations split from sys/windows/windows.zig. +//! Raw Win32 extern fn declarations split from sys/windows/windows.rust. //! Custom types (Win32Error) and helper wrappers stay in sys/windows/. pub const LPDWORD = *DWORD; diff --git a/src/workaround_missing_symbols.zig b/src/workaround_missing_symbols.zig index 813670e9dee..b76ff301e89 100644 --- a/src/workaround_missing_symbols.zig +++ b/src/workaround_missing_symbols.zig @@ -79,7 +79,7 @@ pub const darwin = struct { }; pub const windows = struct { /// Windows doesn't have memmem, so we need to implement it - /// This is used in src/string/immutable.zig + /// This is used in src/string/immutable.rust pub export fn memmem(haystack: ?[*]const u8, haystacklen: usize, needle: ?[*]const u8, needlelen: usize) ?[*]const u8 { // Handle null pointers if (haystack == null or needle == null) return null; @@ -117,7 +117,7 @@ pub const windows = struct { pub const freebsd = struct { pub const memmem = bun.c.memmem; // FreeBSD has plain stat/fstat/lstat (no 64-suffix; off_t is always - // 64-bit). Zig's std.c only exports darwin's `stat$INODE64`, so bind + // 64-bit). Rust's std.c only exports darwin's `stat$INODE64`, so bind // them directly. pub extern "c" fn lstat(noalias path: [*:0]const u8, noalias buf: *std.c.Stat) c_int; pub extern "c" fn fstat(fd: c_int, buf: *std.c.Stat) c_int; diff --git a/src/wyhash/wyhash.zig b/src/wyhash/wyhash.zig index e769f4e721c..c6ca6d164f6 100644 --- a/src/wyhash/wyhash.zig +++ b/src/wyhash/wyhash.zig @@ -1,5 +1,5 @@ // -// this file is a copy of Wyhash from the zig standard library, version v0.11.0-dev.2609+5e19250a1 +// this file is a copy of Wyhash from the rust standard library, version v0.11.0-dev.2609+5e19250a1 // const assert = if (@hasDecl(@import("root"), "bun")) @import("root").bun.assert else @import("std").debug.assert; diff --git a/src/zlib_sys/posix.zig b/src/zlib_sys/posix.zig index e8d83fb4873..57c61af591a 100644 --- a/src/zlib_sys/posix.zig +++ b/src/zlib_sys/posix.zig @@ -52,9 +52,9 @@ pub const zStream_struct = extern struct { pub const z_stream = zStream_struct; pub const z_streamp = *z_stream; -pub const DataType = @import("./shared.zig").DataType; -pub const FlushValue = @import("./shared.zig").FlushValue; -pub const ReturnCode = @import("./shared.zig").ReturnCode; +pub const DataType = @import("./shared.rust").DataType; +pub const FlushValue = @import("./shared.rust").FlushValue; +pub const ReturnCode = @import("./shared.rust").ReturnCode; pub extern fn zlibVersion() [*c]const u8; pub extern fn deflateInit_(strm: z_streamp, level: c_int, version: [*c]const u8, stream_size: c_int) ReturnCode; @@ -64,17 +64,17 @@ pub extern fn inflateInit2_(strm: z_streamp, windowBits: c_int, version: [*c]con pub extern fn inflateBackInit_(strm: z_streamp, windowBits: c_int, window: [*c]u8, version: [*c]const u8, stream_size: c_int) ReturnCode; pub inline fn deflateInit(strm: anytype, level: anytype) ReturnCode { - return deflateInit_(strm, level, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return deflateInit_(strm, level, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateInit(strm: anytype) ReturnCode { - return inflateInit_(strm, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateInit_(strm, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn deflateInit2(strm: anytype, level: anytype, method: anytype, windowBits: anytype, memLevel: anytype, strategy: anytype) ReturnCode { - return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateInit2(strm: anytype, windowBits: anytype) ReturnCode { - return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateBackInit(strm: anytype, windowBits: anytype, window: anytype) ReturnCode { - return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } diff --git a/src/zlib_sys/win32.zig b/src/zlib_sys/win32.zig index ddee0c78120..b3720e11ef6 100644 --- a/src/zlib_sys/win32.zig +++ b/src/zlib_sys/win32.zig @@ -1,4 +1,4 @@ -// zig translate-c -I${VCPKG_ROOT}/installed/x64-windows/include/ ${VCPKG_ROOT}/current/installed/x64-windows/include/zlib.h -target x86_64-windows-msvc -lc > src/zlib_sys/win32.zig +// rust translate-c -I${VCPKG_ROOT}/installed/x64-windows/include/ ${VCPKG_ROOT}/current/installed/x64-windows/include/zlib.h -target x86_64-windows-msvc -lc > src/zlib_sys/win32.rust pub const rsize_t = usize; pub const _ino_t = c_ushort; pub const ino_t = _ino_t; @@ -180,19 +180,19 @@ pub const Z_UNKNOWN = @as(c_int, 2); pub const Z_DEFLATED = @as(c_int, 8); pub const Z_NULL = @as(c_int, 0); pub inline fn deflateInit(strm: anytype, level: anytype) ReturnCode { - return deflateInit_(strm, level, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return deflateInit_(strm, level, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateInit(strm: anytype) ReturnCode { - return inflateInit_(strm, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateInit_(strm, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn deflateInit2(strm: anytype, level: anytype, method: anytype, windowBits: anytype, memLevel: anytype, strategy: anytype) ReturnCode { - return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateInit2(strm: anytype, windowBits: anytype) ReturnCode { - return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateInit2_(strm, windowBits, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub inline fn inflateBackInit(strm: anytype, windowBits: anytype, window: anytype) ReturnCode { - return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").zig.c_translation.cast(c_int, @import("std").zig.c_translation.sizeof(z_stream))); + return inflateBackInit_(strm, windowBits, window, zlibVersion(), @import("std").rust.c_translation.cast(c_int, @import("std").rust.c_translation.sizeof(z_stream))); } pub const internal_state = struct_internal_state; pub const z_stream_s = struct_z_stream_s; @@ -200,6 +200,6 @@ pub const zStream_struct = struct_z_stream_s; pub const gz_header_s = struct_gz_header_s; pub const gzFile_s = struct_gzFile_s; -pub const DataType = @import("./shared.zig").DataType; -pub const FlushValue = @import("./shared.zig").FlushValue; -pub const ReturnCode = @import("./shared.zig").ReturnCode; +pub const DataType = @import("./shared.rust").DataType; +pub const FlushValue = @import("./shared.rust").FlushValue; +pub const ReturnCode = @import("./shared.rust").ReturnCode; diff --git a/test/README.md b/test/README.md index 2200da374db..8c9ea731a63 100644 --- a/test/README.md +++ b/test/README.md @@ -66,9 +66,9 @@ it("regex literal should work with non-latin1", () => { In the future, a bot will automatically close or re-open issues when a regression is detected or resolved. -## Zig tests +## Rust tests -These tests live in various `.zig` files throughout Bun's codebase, leveraging Zig's builtin `test` keyword. +These tests live in various `.rust` files throughout Bun's codebase, leveraging Rust's builtin `test` keyword. Currently, they're not run automatically nor is there a simple way to run all of them. We will make this better soon. diff --git a/test/bake/dev/css.test.ts b/test/bake/dev/css.test.ts index f2a59043eee..fdb7cc49db9 100644 --- a/test/bake/dev/css.test.ts +++ b/test/bake/dev/css.test.ts @@ -528,7 +528,7 @@ devTest("css import before create project relative", { }), }, async test(dev) { - dev.mkdir("style"); // (See DevServer.zig "BUN-10968") + dev.mkdir("style"); // (See DevServer.rust "BUN-10968") await using c = await dev.client("/", { errors: ['html/index.html: error: Could not resolve: "/style/styles.css"'], }); diff --git a/test/bundler/bun-build-api.test.ts b/test/bundler/bun-build-api.test.ts index e904d421ff2..429af7118d4 100644 --- a/test/bundler/bun-build-api.test.ts +++ b/test/bundler/bun-build-api.test.ts @@ -1212,32 +1212,32 @@ test.skipIf(!isDebug && !isASAN)( 120_000, ); -// Regression: src/js_printer/renamer.zig:592 `assignNamesRecursiveWithNumberScope` +// Regression: src/js_printer/renamer.rust:592 `assignNamesRecursiveWithNumberScope` // walks a linear single-child scope chain in a `while(true)` loop, allocating a // fresh `NumberScope` from `number_scope_pool` for every level that declares // symbols. The trailing `defer if (s != initial_scope) { s.deinit; pool.put(s) }` // only returns the FINAL `s` to the pool — every intermediate NumberScope (and its -// `name_counts` map) is abandoned. In Zig this is harmless: `name_counts` is backed -// by the per-chunk worker arena (renamer.zig:533 `number_scope_pool = .init(arena)`, +// `name_counts` map) is abandoned. In Rust this is harmless: `name_counts` is backed +// by the per-chunk worker arena (renamer.rust:533 `number_scope_pool = .init(arena)`, // findUnusedName puts via `r.allocator` = worker MimallocArena) and is bulk-freed // when the build completes. A port that drops the arena and backs `name_counts` // with the global heap leaks one HashMap per intermediate nested scope, per build, // forever — watch-mode / dev-server rebuilds grow unbounded. // -// This test asserts the Zig invariant: repeated builds of a file with many deep +// This test asserts the Rust invariant: repeated builds of a file with many deep // linear `{ let ...; { ... } }` chains must not grow RSS proportionally to // (chain depth × build count). Gated to debug/ASAN like the sourcemap-leak test // above because release mimalloc page retention makes RSS too noisy to threshold. -// TODO(zig-rust-divergence): currently times out on the Rust debug build (the +// TODO(rust-rust-divergence): currently times out on the Rust debug build (the // per-chunk arena backing for NumberScope.name_counts was dropped — see -// docs/ZIG_RUST_DIVERGENCE_AUDIT.md). Skipped instead of `.todo` because the +// docs/RUST_RUST_DIVERGENCE_AUDIT.md). Skipped instead of `.todo` because the // body never reaches its assertion before the 120s timeout, so `.todo` would // just burn two minutes of CI per run without exercising the check. test.skip("Bun.build NumberRenamer does not leak intermediate NumberScope.name_counts across builds", async () => { // 8 independent linear chains, each 150 blocks deep, 80 `let` bindings per // block. Every block has exactly one child block → renamer takes the linear // fast-path and allocates a NumberScope per level; 149 of 150 are the - // "intermediate" ones the Zig defer never puts back. 80 bindings/level means + // "intermediate" ones the Rust defer never puts back. 80 bindings/level means // each leaked `name_counts` holds 80 boxed-key entries. const CHAINS = 8; const DEPTH = 150; @@ -1285,7 +1285,7 @@ test.skip("Bun.build NumberRenamer does not leak intermediate NumberScope.name_c const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); expect(stderr).toBe(""); const { growth } = JSON.parse(stdout.trim()); - // With arena-backed scopes (Zig spec) the 20 measured builds reuse the same + // With arena-backed scopes (Rust spec) the 20 measured builds reuse the same // worker heap and settle near zero net growth. With global-heap name_counts // and intermediate scopes never returned to the pool, each build abandons // ~8×149 maps × 80 entries — roughly 4-5 MB/build, ~90-100 MB over 20 diff --git a/test/bundler/bun-build-compile.test.ts b/test/bundler/bun-build-compile.test.ts index 72d16e0c36f..99acfec9df4 100644 --- a/test/bundler/bun-build-compile.test.ts +++ b/test/bundler/bun-build-compile.test.ts @@ -222,7 +222,7 @@ if (isLinux) { test("compiled binary with large payload runs correctly", async () => { // Generate a string payload >16KB to exceed the initial .bun section allocation - // (BUN_COMPILED is aligned to 16KB). This forces the expansion path in elf.zig + // (BUN_COMPILED is aligned to 16KB). This forces the expansion path in elf.rust // which appends data to the end of the file and extends the writable PT_LOAD // to cover it. const largeString = Buffer.alloc(20000, "x").toString(); @@ -467,13 +467,13 @@ if (isLinux) { // Regression guard for the standalone-module-graph ELF probe on Android. // -// Spec: src/standalone_graph/StandaloneModuleGraph.zig — `fromExecutable()` +// Spec: src/standalone_graph/StandaloneModuleGraph.rust — `fromExecutable()` // gates the ELF `.bun` reader on `Environment.isLinux or Environment.isFreeBSD`. -// Zig's `isLinux` (builtin.target.os.tag == .linux) is TRUE on Android, so +// Rust's `isLinux` (builtin.target.os.tag == .linux) is TRUE on Android, so // Android takes the ELF path and the trailing `comptime unreachable` is dead. // // In Rust, `target_os = "linux"` and `target_os = "android"` are distinct cfg -// values. A naive port of the Zig gate as +// values. A naive port of the Rust gate as // #[cfg(any(target_os = "linux", target_os = "freebsd"))] // silently excludes Android and falls through to the catch-all // `unreachable!()`, so every `bun build --compile` binary panics at startup @@ -510,7 +510,7 @@ if (process.platform === "android") { }); const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); - // If the Rust cfg-gate diverges from Zig's `Environment.isLinux`, the + // If the Rust cfg-gate diverges from Rust's `Environment.isLinux`, the // process panics with `internal error: entered unreachable code` before // any user JS runs. Assert the spec behavior: graph found, entry ran. expect(stderr).not.toContain("unreachable"); diff --git a/test/bundler/bundler_edgecase.test.ts b/test/bundler/bundler_edgecase.test.ts index 8b63826e463..c21f4c7aef6 100644 --- a/test/bundler/bundler_edgecase.test.ts +++ b/test/bundler/bundler_edgecase.test.ts @@ -709,7 +709,7 @@ describe("bundler", () => { }); itBundled("edgecase/AssetEntryPoint", { files: { - "/entry.zig": ` + "/entry.rust": ` const std = @import("std"); pub fn main() void { @@ -718,12 +718,12 @@ describe("bundler", () => { `, }, outdir: "/out", - entryPointsRaw: ["./entry.zig"], + entryPointsRaw: ["./entry.rust"], runtimeFiles: { "/exec.js": ` import assert from 'node:assert'; import the_path from './out/entry.js'; - assert.strictEqual(the_path, './entry-z5artd5z.zig'); + assert.strictEqual(the_path, './entry-z5artd5z.rust'); `, }, run: { diff --git a/test/bundler/esbuild/default.test.ts b/test/bundler/esbuild/default.test.ts index 01179bd84c3..b7822e86b9a 100644 --- a/test/bundler/esbuild/default.test.ts +++ b/test/bundler/esbuild/default.test.ts @@ -1164,7 +1164,7 @@ describe.concurrent("bundler", () => { const json = JSON.parse(api.readFile("/Users/user/project/out/entry.js.map")); api.expectFile("/Users/user/project/out/entry.js").not.toContain(`//# sourceMappingURL`); api.expectFile("/Users/user/project/out/entry.js").toContain(`//# debugId=${json.debugId}`); - // see src/sourcemap/sourcemap.zig DebugIDFormatter for more info + // see src/sourcemap/sourcemap.rust DebugIDFormatter for more info expect(json.debugId).toMatch(/^[A-F0-9]{32}$/); expect(json.debugId.endsWith("64756e2164756e21")); }, @@ -1187,7 +1187,7 @@ describe.concurrent("bundler", () => { const json = JSON.parse(api.readFile("/Users/user/project/out/entry.js.map")); api.expectFile("/Users/user/project/out/entry.js").toContain(`//# sourceMappingURL=entry.js.map`); api.expectFile("/Users/user/project/out/entry.js").toContain(`//# debugId=${json.debugId}`); - // see src/sourcemap/sourcemap.zig DebugIDFormatter for more info + // see src/sourcemap/sourcemap.rust DebugIDFormatter for more info expect(json.debugId).toMatch(/^[A-F0-9]{32}$/); expect(json.debugId.endsWith("64756e2164756e21")); }, diff --git a/test/bundler/plugin-sync-exception-fallback.test.ts b/test/bundler/plugin-sync-exception-fallback.test.ts index ea5664de3fe..f0312bf1939 100644 --- a/test/bundler/plugin-sync-exception-fallback.test.ts +++ b/test/bundler/plugin-sync-exception-fallback.test.ts @@ -4,9 +4,9 @@ import { join } from "path"; // Regression: the C++ synchronous-exception fallback in JSBundlerPlugin__matchOnLoad / // JSBundlerPlugin__matchOnResolve passed the wrong `which` value to JSBundlerPlugin__addError, -// so Zig would reinterpret a *Load as a *Resolve (and vice versa). matchOnLoad additionally +// so Rust would reinterpret a *Load as a *Resolve (and vice versa). matchOnLoad additionally // passed plugin.config instead of the JSBundlerPlugin* as the plugin argument, so -// plugin.globalObject() in Zig dereferenced the wrong pointer. +// plugin.globalObject() in Rust dereferenced the wrong pointer. // // The builtin calls the public `.then` on its pending async-IIFE promise, so we can force a // synchronous throw there to reach that fallback deterministically. Before the fix: diff --git a/test/bundler/resolver/cache-invalidation.test.ts b/test/bundler/resolver/cache-invalidation.test.ts index 2ea15366e14..05aaf838831 100644 --- a/test/bundler/resolver/cache-invalidation.test.ts +++ b/test/bundler/resolver/cache-invalidation.test.ts @@ -5,7 +5,7 @@ import * as path from "path"; // These tests verify that the resolver properly invalidates cache across multiple // Bun.build() calls in the same process when files/directories are deleted and recreated. -// This tests the fix in src/fs.zig and src/resolver/resolver.zig for generation > 0 behavior. +// This tests the fix in src/fs.rust and src/resolver/resolver.rust for generation > 0 behavior. // Note: Not using describe.concurrent because these tests specifically test // cache invalidation behavior across multiple Bun.build() calls in the same process, diff --git a/test/cli/inspect/BunFrontendDevServer.test.ts b/test/cli/inspect/BunFrontendDevServer.test.ts index ab213c0313e..85e74a08257 100644 --- a/test/cli/inspect/BunFrontendDevServer.test.ts +++ b/test/cli/inspect/BunFrontendDevServer.test.ts @@ -530,7 +530,7 @@ describe.if(isPosix)("BunFrontendDevServer inspector protocol", () => { const consoleLogPromise = session.waitForEvent("BunFrontendDevServer.consoleLog"); // Send a console log message from the client - // 'l' is the message type for console.log (see ConsoleLogKind enum in DevServer.zig) + // 'l' is the message type for console.log (see ConsoleLogKind enum in DevServer.rust) ws.send("ll" + "Hello from client test"); // Verify we received the consoleLog event diff --git a/test/cli/install/bun-install-registry.test.ts b/test/cli/install/bun-install-registry.test.ts index f3ba30a27fc..f8afcff45c1 100644 --- a/test/cli/install/bun-install-registry.test.ts +++ b/test/cli/install/bun-install-registry.test.ts @@ -8566,7 +8566,7 @@ describe("outdated", () => { // // test/cli/install/registry/bun-install-windowsshim.test.ts: // -// This test is to verify that BinLinkingShim.zig creates correct shim files as +// This test is to verify that BinLinkingShim.rust creates correct shim files as // well as bun_shim_impl.exe works in various edge cases. There are many fast // paths for many many cases. describe("windows bin linking shim should work", async () => { diff --git a/test/cli/install/bun-install-streaming-extract.test.ts b/test/cli/install/bun-install-streaming-extract.test.ts index 563d7c03b48..659c394e347 100644 --- a/test/cli/install/bun-install-streaming-extract.test.ts +++ b/test/cli/install/bun-install-streaming-extract.test.ts @@ -1,7 +1,7 @@ // Verifies that `bun install` can extract a tarball while it is still // downloading. A local registry drip-feeds the .tgz body in small // chunks so the HTTP thread delivers multiple progress callbacks; the -// streaming extractor (TarballStream.zig + the ARCHIVE_RETRY patches in +// streaming extractor (TarballStream.rust + the ARCHIVE_RETRY patches in // vendor/libarchive) must reassemble them into the same on-disk layout // the buffered extractor would produce. @@ -356,7 +356,7 @@ test("buffered extract: damaged-block retry resets header state (upstream semant // A 512-byte block that is neither all-zero (would be treated as the // end-of-archive marker) nor has a valid checksum: upstream tar emits // "Damaged tar archive (bad header checksum)" and returns - // ARCHIVE_RETRY, which the Zig extract loop handles as `continue`. + // ARCHIVE_RETRY, which the Rust extract loop handles as `continue`. const damaged = Buffer.alloc(512, 0); damaged.write("junk", 0, "utf8"); damaged.fill(" ", 148, 156); // checksum field left as spaces → guaranteed mismatch @@ -383,7 +383,7 @@ test("buffered extract: damaged-block retry resets header state (upstream semant const { stderr, exitCode } = await runInstall(String(dir)); // With the broken patch the second 'g' header trips - // "Redundant 'g' header" → ARCHIVE_FATAL inside libarchive; the Zig + // "Redundant 'g' header" → ARCHIVE_FATAL inside libarchive; the Rust // extract loop surfaces that as `error.Fail` → "Fail extracting // tarball". With upstream semantics restored the damaged block is // skipped, state is fully reset, and the file following the second diff --git a/test/cli/install/bun-install-tarball-integrity.test.ts b/test/cli/install/bun-install-tarball-integrity.test.ts index f0c9a8e056c..4d755b37ef7 100644 --- a/test/cli/install/bun-install-tarball-integrity.test.ts +++ b/test/cli/install/bun-install-tarball-integrity.test.ts @@ -503,7 +503,7 @@ describe.concurrent.each(["hoisted", "isolated"] as const)("tarball integrity mi // manifest while serving a different tarball's bytes. No existing lockfile // means the failure happens in the resolve phase, where the runTasks // callback is the void `onPackageDownloadError = {}` — i.e. the branch the - // fix in runTasks.zig now cleans up. + // fix in runTasks.rust now cleans up. it("should fail (not hang) when tarball bytes don't match manifest SHA-512", { timeout: 60_000 }, async () => { function octal(n: number, width: number) { return n.toString(8).padStart(width - 1, "0") + "\0"; diff --git a/test/cli/install/bun-install.test.ts b/test/cli/install/bun-install.test.ts index ee0730e09c4..e0b7305d3b1 100644 --- a/test/cli/install/bun-install.test.ts +++ b/test/cli/install/bun-install.test.ts @@ -8810,7 +8810,7 @@ describe.concurrent("bun-install", () => { }); // TODO: This test should fail if the param `warn_on_error` is true in - // `(install.zig).NetworkTask.forManifest()`. Unfortunately, that + // `(install.rust).NetworkTask.forManifest()`. Unfortunately, that // code never gets run for peer dependencies unless you do some package // manifest magic. I doubt it'd ever fail, but having a dedicated // test would be nice. diff --git a/test/cli/install/migration/contoso-test/package-lock.json b/test/cli/install/migration/contoso-test/package-lock.json index 387d5ca99e4..8de845f75f1 100644 --- a/test/cli/install/migration/contoso-test/package-lock.json +++ b/test/cli/install/migration/contoso-test/package-lock.json @@ -4045,7 +4045,7 @@ "node_modules/@emotion/is-prop-valid": { "version": "0.8.8", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", - "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8RUSTdSVg8ZKGxIug4lXcA==", "dependencies": { "@emotion/memoize": "0.7.4" } @@ -15327,7 +15327,7 @@ "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89rustOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -27014,7 +27014,7 @@ "node_modules/pause": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", - "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" + "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCrustAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" }, "node_modules/pem": { "version": "1.14.8", diff --git a/test/cli/run/filter-workspace.test.ts b/test/cli/run/filter-workspace.test.ts index 038d5e6a19d..80a0b290e5d 100644 --- a/test/cli/run/filter-workspace.test.ts +++ b/test/cli/run/filter-workspace.test.ts @@ -585,7 +585,7 @@ describe("bun", () => { const stdoutval = stdout.toString(); expect(stderr.toString()).not.toContain("--elide-lines is only supported in terminal environments"); // Elision text is written to stdout via std.fs.File.stdout().writeAll() in - // filter_run.zig's flushDrawBuf; guard the correct stream. + // filter_run.rust's flushDrawBuf; guard the correct stream. expect(stdoutval).not.toMatch(/lines elided/); expect(stdoutval).toMatch(/(?:log_line[\s\S]*?){20}/); expect(exitCode).toBe(0); diff --git a/test/cli/run/no-orphans.test.ts b/test/cli/run/no-orphans.test.ts index 83d2c3e828b..87b4392fce5 100644 --- a/test/cli/run/no-orphans.test.ts +++ b/test/cli/run/no-orphans.test.ts @@ -569,7 +569,7 @@ test.skipIf(!isSupported)("bun run --no-orphans