From 3059f9e98e8ba48dfd596f6c0606ecdc1362306d Mon Sep 17 00:00:00 2001 From: Zack Radisic <56137411+zackradisic@users.noreply.github.com> Date: Mon, 2 Dec 2024 19:38:04 -0800 Subject: [PATCH] update stuff --- bun.h | 70 ------------ packages/bun-build-mdx-rs/build.ts | 16 --- .../bundler_plugin.h | 104 +++++++++--------- 3 files changed, 49 insertions(+), 141 deletions(-) delete mode 100644 bun.h delete mode 100644 packages/bun-build-mdx-rs/build.ts diff --git a/bun.h b/bun.h deleted file mode 100644 index 2fb5377943..0000000000 --- a/bun.h +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include - -typedef int8_t bun_log_level_t; -static const bun_log_level_t BunLogLevelError = 0; -static const bun_log_level_t BunLogLevelWarn = 1; -static const bun_log_level_t BunLogLevelInfo = 2; -static const bun_log_level_t BunLogLevelDebug = 3; - -typedef uint8_t bun_loader_t; -static const bun_loader_t BunLoaderJsx = 0; -static const bun_loader_t BunLoaderJs = 1; -static const bun_loader_t BunLoaderTs = 2; -static const bun_loader_t BunLoaderTsx = 3; -static const bun_loader_t BunLoaderCss = 4; -static const bun_loader_t BunLoaderFile = 5; -static const bun_loader_t BunLoaderJson = 6; -static const bun_loader_t BunLoaderToml = 7; -static const bun_loader_t BunLoaderWasm = 8; -static const bun_loader_t BunLoaderNapi = 9; -static const bun_loader_t BunLoaderBase64 = 10; -static const bun_loader_t BunLoaderDataurl = 11; -static const bun_loader_t BunLoaderText = 12; - -typedef uint8_t bun_target_t; -static const bun_target_t BunTargetBrowser = 0; -static const bun_target_t BunTargetNode = 1; -static const bun_target_t BunTargetBun = 2; - -typedef struct BunLogOptions { - const unsigned char *message_ptr; - size_t message_len; - - const unsigned char *path_ptr; - size_t path_len; - - const unsigned char *source_line_text_ptr; - size_t source_line_text_len; - - bun_log_level_t level; - - int line; - int lineEnd; - int column; - int columnEnd; -} BunLogOptions; - -typedef struct OnBeforeParseArguments { - void *bun; - const unsigned char *path_ptr; - size_t path_len; - const unsigned char *namespace_ptr; - size_t namespace_len; - - bun_loader_t default_loader; -} OnBeforeParseArguments; - -typedef struct OnBeforeParseResult { - unsigned char *source_ptr; - size_t source_len; - bun_loader_t loader; - - int (*const fetchSourceCode)(const OnBeforeParseArguments *args, - struct OnBeforeParseResult *result); - - void *plugin_source_code_context; - void (*free_plugin_source_code_context)(void *context); - - void (*const log)(const OnBeforeParseArguments *args, BunLogOptions *options); -} OnBeforeParseResult; diff --git a/packages/bun-build-mdx-rs/build.ts b/packages/bun-build-mdx-rs/build.ts deleted file mode 100644 index 001ed09d5e..0000000000 --- a/packages/bun-build-mdx-rs/build.ts +++ /dev/null @@ -1,16 +0,0 @@ -const result = await Bun.build({ - entrypoints: ["input/index.ts"], - outdir: "dist", - plugins: [ - { - name: "mdx", - setup(build) { - const plugin = require("/Users/zackradisic/Code/bun/packages/bun-build-mdx-rs/bun-mdx-rs.darwin-arm64.node"); - - build.onBeforeParse({ filter: /\.mdx$/ }, { napiModule: plugin, symbol: "bun_mdx_rs" }); - }, - }, - ], -}); - -console.log(result); diff --git a/packages/bun-native-bundler-plugin-api/bundler_plugin.h b/packages/bun-native-bundler-plugin-api/bundler_plugin.h index bd84c95a5f..ff10c27ccd 100644 --- a/packages/bun-native-bundler-plugin-api/bundler_plugin.h +++ b/packages/bun-native-bundler-plugin-api/bundler_plugin.h @@ -5,73 +5,67 @@ #include typedef enum { - BUN_LOADER_JSX = 0, - BUN_LOADER_JS = 1, - BUN_LOADER_TS = 2, - BUN_LOADER_TSX = 3, - BUN_LOADER_CSS = 4, - BUN_LOADER_FILE = 5, - BUN_LOADER_JSON = 6, - BUN_LOADER_TOML = 7, - BUN_LOADER_WASM = 8, - BUN_LOADER_NAPI = 9, - BUN_LOADER_BASE64 = 10, - BUN_LOADER_DATAURL = 11, - BUN_LOADER_TEXT = 12, - BUN_LOADER_BUNSH = 13, - BUN_LOADER_SQLITE = 14, - BUN_LOADER_SQLITE_EMBEDDED = 15 + BUN_LOADER_JSX = 0, + BUN_LOADER_JS = 1, + BUN_LOADER_TS = 2, + BUN_LOADER_TSX = 3, + BUN_LOADER_CSS = 4, + BUN_LOADER_FILE = 5, + BUN_LOADER_JSON = 6, + BUN_LOADER_TOML = 7, + BUN_LOADER_WASM = 8, + BUN_LOADER_NAPI = 9, + BUN_LOADER_BASE64 = 10, + BUN_LOADER_DATAURL = 11, + BUN_LOADER_TEXT = 12, } BunLoader; -const BunLoader BUN_LOADER_MAX = BUN_LOADER_SQLITE_EMBEDDED; +const BunLoader BUN_LOADER_MAX = BUN_LOADER_TEXT; typedef struct BunLogOptions { - size_t __struct_size; - const uint8_t* message_ptr; - size_t message_len; - const uint8_t* path_ptr; - size_t path_len; - const uint8_t* source_line_text_ptr; - size_t source_line_text_len; - int8_t level; - int line; - int lineEnd; - int column; - int columnEnd; + size_t __struct_size; + const uint8_t *message_ptr; + size_t message_len; + const uint8_t *path_ptr; + size_t path_len; + const uint8_t *source_line_text_ptr; + size_t source_line_text_len; + int8_t level; + int line; + int lineEnd; + int column; + int columnEnd; } BunLogOptions; typedef struct { - size_t __struct_size; - void* bun; - const uint8_t* path_ptr; - size_t path_len; - const uint8_t* namespace_ptr; - size_t namespace_len; - uint8_t default_loader; - void *external; + size_t __struct_size; + void *bun; + const uint8_t *path_ptr; + size_t path_len; + const uint8_t *namespace_ptr; + size_t namespace_len; + uint8_t default_loader; + void *external; } OnBeforeParseArguments; typedef struct OnBeforeParseResult { - size_t __struct_size; - uint8_t* source_ptr; - size_t source_len; - uint8_t loader; - int (*fetchSourceCode)( - const OnBeforeParseArguments* args, - struct OnBeforeParseResult* result - ); - void* plugin_source_code_context; - void (*free_plugin_source_code_context)(void* ctx); - void (*log)(const OnBeforeParseArguments* args, BunLogOptions* options); -} OnBeforeParseResult; - + size_t __struct_size; + uint8_t *source_ptr; + size_t source_len; + uint8_t loader; + int (*fetchSourceCode)(const OnBeforeParseArguments *args, + struct OnBeforeParseResult *result); + void *plugin_source_code_context; + void (*free_plugin_source_code_context)(void *ctx); + void (*log)(const OnBeforeParseArguments *args, BunLogOptions *options); +} OnBeforeParseResult; typedef enum { - BUN_LOG_LEVEL_VERBOSE = 0, - BUN_LOG_LEVEL_DEBUG = 1, - BUN_LOG_LEVEL_INFO = 2, - BUN_LOG_LEVEL_WARN = 3, - BUN_LOG_LEVEL_ERROR = 4, + BUN_LOG_LEVEL_VERBOSE = 0, + BUN_LOG_LEVEL_DEBUG = 1, + BUN_LOG_LEVEL_INFO = 2, + BUN_LOG_LEVEL_WARN = 3, + BUN_LOG_LEVEL_ERROR = 4, } BunLogLevel; const BunLogLevel BUN_LOG_MAX = BUN_LOG_LEVEL_ERROR;