bun-types 1.1.28-canary.20240917T140517 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ffi.d.ts +48 -0
  2. package/package.json +1 -1
package/ffi.d.ts CHANGED
@@ -659,6 +659,54 @@ declare module "bun:ffi" {
659
659
  * Map of symbols to load where the key is the symbol name and the value is the {@link FFIFunction}
660
660
  */
661
661
  symbols: Fns;
662
+
663
+ /**
664
+ * Map of symbols to define where the key is the symbol name and the value is the symbol value
665
+ *
666
+ * Equivalent to `-D` option in gcc/clang.
667
+ *
668
+ * @example
669
+ * ```js
670
+ * import { cc } from "bun:ffi";
671
+ * const {symbols: {hello}} = cc({
672
+ * source: hello,
673
+ * define: {
674
+ * "NDEBUG": "1",
675
+ * },
676
+ * symbols: {
677
+ * hello: {
678
+ * returns: "cstring",
679
+ * args: [],
680
+ * },
681
+ * },
682
+ * });
683
+ * ```
684
+ */
685
+ define?: Record<string, string>;
686
+
687
+ /**
688
+ * Flags to pass to the compiler. Note: we do not make gurantees about which specific version of the compiler is used.
689
+ *
690
+ * @default "-std=c11 -Wl,--export-all-symbols -g -O2"
691
+ *
692
+ * This is useful for passing macOS frameworks to link against. Or if there are other options you want to pass to the compiler.
693
+ *
694
+ * @example
695
+ * ```js
696
+ * import { cc } from "bun:ffi";
697
+ * const {symbols: {hello}} = cc({
698
+ * source: hello,
699
+ * flags: ["-framework CoreFoundation", "-framework Security"],
700
+ * symbols: {
701
+ * hello: {
702
+ * returns: "cstring",
703
+ * args: [],
704
+ * },
705
+ * },
706
+ * });
707
+ * ```
708
+ */
709
+ flags?: string | string[];
662
710
  }): Library<Fns>;
663
711
 
664
712
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.28-canary.20240917T140517",
2
+ "version": "1.1.28",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",