mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
update stuff
This commit is contained in:
70
bun.h
70
bun.h
@@ -1,70 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
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;
|
||||
@@ -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);
|
||||
@@ -5,73 +5,67 @@
|
||||
#include <stdint.h>
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user