diff --git a/bun.lock b/bun.lock index 97a14cb1..63372a38 100644 --- a/bun.lock +++ b/bun.lock @@ -6,19 +6,21 @@ "dependencies": { "@iconify/react": "^6.0.0", "@mui/icons-material": "^7.3.1", - "i18next": "^25.3.2", + "@mui/x-date-pickers": "^8.11.0", + "dayjs": "^1.11.18", + "i18next": "^25.4.2", "i18next-browser-languagedetector": "^8.2.0", "i18next-fs-backend": "^2.6.0", "i18next-http-backend": "^3.0.2", - "node": "^22.18.0", - "react": "^19", - "react-dom": "^19", - "react-i18next": "^15.6.1", + "node": "^22.19.0", + "react": "^19.1.1", + "react-dom": "^19.1.1", + "react-i18next": "^15.7.3", }, "devDependencies": { "@types/bun": "latest", - "@types/react": "^19", - "@types/react-dom": "^19", + "@types/react": "^19.1.12", + "@types/react-dom": "^19.1.9", }, }, }, @@ -61,21 +63,25 @@ "@mui/utils": ["@mui/utils@7.3.1", "", { "dependencies": { "@babel/runtime": "^7.28.2", "@mui/types": "^7.4.5", "@types/prop-types": "^15.7.15", "clsx": "^2.1.1", "prop-types": "^15.8.1", "react-is": "^19.1.1" }, "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-/31y4wZqVWa0jzMnzo6JPjxwP6xXy4P3+iLbosFg/mJQowL1KIou0LC+lquWW60FKVbKz5ZUWBg2H3jausa0pw=="], + "@mui/x-date-pickers": ["@mui/x-date-pickers@8.11.0", "", { "dependencies": { "@babel/runtime": "^7.28.2", "@mui/utils": "^7.3.1", "@mui/x-internals": "8.11.0", "@types/react-transition-group": "^4.4.12", "clsx": "^2.1.1", "prop-types": "^15.8.1", "react-transition-group": "^4.4.5" }, "peerDependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0", "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0", "date-fns": "^2.25.0 || ^3.2.0 || ^4.0.0", "date-fns-jalali": "^2.13.0-0 || ^3.2.0-0 || ^4.0.0-0", "dayjs": "^1.10.7", "luxon": "^3.0.2", "moment": "^2.29.4", "moment-hijri": "^2.1.2 || ^3.0.0", "moment-jalaali": "^0.7.4 || ^0.8.0 || ^0.9.0 || ^0.10.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/react", "@emotion/styled", "date-fns", "date-fns-jalali", "dayjs", "luxon", "moment", "moment-hijri", "moment-jalaali"] }, "sha512-UHGVG8+zb9GkpUpHHCBCRA4ugrz1XOsGIPTs1cHDtZ/DNkCi+hrhKW1EH5Scoxn9GjE3PXxiN5eH+ZVpeq0jcw=="], + + "@mui/x-internals": ["@mui/x-internals@8.11.0", "", { "dependencies": { "@babel/runtime": "^7.28.2", "@mui/utils": "^7.3.1", "reselect": "^5.1.1", "use-sync-external-store": "^1.5.0" }, "peerDependencies": { "react": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-SFPMLMkNWSEOxIgKMQ9RqEL01klb1lwIdd4f4d18fJNrJOlTxeIDWd6eVllS5sRLdKVsE5FC1802V+yLe6W+pQ=="], + "@popperjs/core": ["@popperjs/core@2.11.8", "", {}, "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A=="], - "@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="], + "@types/bun": ["@types/bun@1.2.21", "", { "dependencies": { "bun-types": "1.2.21" } }, "sha512-NiDnvEqmbfQ6dmZ3EeUO577s4P5bf4HCTXtI6trMc6f6RzirY5IrF3aIookuSpyslFzrnvv2lmEWv5HyC1X79A=="], "@types/node": ["@types/node@24.1.0", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w=="], "@types/prop-types": ["@types/prop-types@15.7.15", "", {}, "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw=="], - "@types/react": ["@types/react@19.1.8", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="], + "@types/react": ["@types/react@19.1.12", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-cMoR+FoAf/Jyq6+Df2/Z41jISvGZZ2eTlnsaJRptmZ76Caldwy1odD4xTr/gNV9VLj0AWgg/nmkevIyUfIIq5w=="], - "@types/react-dom": ["@types/react-dom@19.1.6", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw=="], + "@types/react-dom": ["@types/react-dom@19.1.9", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-qXRuZaOsAdXKFyOhRBg6Lqqc0yay13vN7KrIg4L7N4aaHN68ma9OK3NE1BoDFgFOTfM7zg+3/8+2n8rLUH3OKQ=="], "@types/react-transition-group": ["@types/react-transition-group@4.4.12", "", { "peerDependencies": { "@types/react": "*" } }, "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w=="], - "bun-types": ["bun-types@1.2.19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="], + "bun-types": ["bun-types@1.2.21", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-sa2Tj77Ijc/NTLS0/Odjq/qngmEPZfbfnOERi0KRUYhT9R8M4VBioWVmMWE5GrYbKMc+5lVybXygLdibHaqVqw=="], "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], @@ -83,11 +89,13 @@ "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + "dayjs": ["dayjs@1.11.18", "", {}, "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA=="], + "dom-helpers": ["dom-helpers@5.2.1", "", { "dependencies": { "@babel/runtime": "^7.8.7", "csstype": "^3.0.2" } }, "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA=="], "html-parse-stringify": ["html-parse-stringify@3.0.1", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="], - "i18next": ["i18next@25.3.2", "", { "dependencies": { "@babel/runtime": "^7.27.6" }, "peerDependencies": { "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-JSnbZDxRVbphc5jiptxr3o2zocy5dEqpVm9qCGdJwRNO+9saUJS0/u4LnM/13C23fUEWxAylPqKU/NpMV/IjqA=="], + "i18next": ["i18next@25.4.2", "", { "dependencies": { "@babel/runtime": "^7.27.6" }, "peerDependencies": { "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-gD4T25a6ovNXsfXY1TwHXXXLnD/K2t99jyYMCSimSCBnBRJVQr5j+VAaU83RJCPzrTGhVQ6dqIga66xO2rtd5g=="], "i18next-browser-languagedetector": ["i18next-browser-languagedetector@8.2.0", "", { "dependencies": { "@babel/runtime": "^7.23.2" } }, "sha512-P+3zEKLnOF0qmiesW383vsLdtQVyKtCNA9cjSoKCppTKPQVfKd2W8hbVo5ZhNJKDqeM7BOcvNoKJOjpHh4Js9g=="], @@ -99,7 +107,7 @@ "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="], - "node": ["node@22.18.0", "", { "dependencies": { "node-bin-setup": "^1.0.0" }, "bin": { "node": "bin/node" } }, "sha512-3njku3qUgOVps16gg1+y1L9AseQoZFUZmd2ASA3+K/pryQLoiEoHkjQ6UmVSysW2EkvdILBKsUYM9RpBKJ47+w=="], + "node": ["node@22.19.0", "", { "dependencies": { "node-bin-setup": "^1.0.0" }, "bin": { "node": "bin/node" } }, "sha512-Cgt3vsL2HqwXRnA3bGZpatYnKGO1UmE4z0jpxlTfqghEmRe9p0sIF2yvgWUE8Zg7C3o2SZsKQ1m0eaZ5n4SyKA=="], "node-bin-setup": ["node-bin-setup@1.1.4", "", {}, "sha512-vWNHOne0ZUavArqPP5LJta50+S8R261Fr5SvGul37HbEDcowvLjwdvd0ZeSr0r2lTSrPxl6okq9QUw8BFGiAxA=="], @@ -109,16 +117,18 @@ "prop-types": ["prop-types@15.8.1", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="], - "react": ["react@19.1.0", "", {}, "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg=="], + "react": ["react@19.1.1", "", {}, "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ=="], - "react-dom": ["react-dom@19.1.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g=="], + "react-dom": ["react-dom@19.1.1", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.1" } }, "sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw=="], - "react-i18next": ["react-i18next@15.6.1", "", { "dependencies": { "@babel/runtime": "^7.27.6", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { "i18next": ">= 23.2.3", "react": ">= 16.8.0", "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-uGrzSsOUUe2sDBG/+FJq2J1MM+Y4368/QW8OLEKSFvnDflHBbZhSd1u3UkW0Z06rMhZmnB/AQrhCpYfE5/5XNg=="], + "react-i18next": ["react-i18next@15.7.3", "", { "dependencies": { "@babel/runtime": "^7.27.6", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { "i18next": ">= 25.4.1", "react": ">= 16.8.0", "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-AANws4tOE+QSq/IeMF/ncoHlMNZaVLxpa5uUGW1wjike68elVYr0018L9xYoqBr1OFO7G7boDPrbn0HpMCJxTw=="], "react-is": ["react-is@19.1.1", "", {}, "sha512-tr41fA15Vn8p4X9ntI+yCyeGSf1TlYaY5vlTZfQmeLBrFo3psOPX6HhTDnFNL9uj3EhP0KAQ80cugCl4b4BERA=="], "react-transition-group": ["react-transition-group@4.4.5", "", { "dependencies": { "@babel/runtime": "^7.5.5", "dom-helpers": "^5.0.1", "loose-envify": "^1.4.0", "prop-types": "^15.6.2" }, "peerDependencies": { "react": ">=16.6.0", "react-dom": ">=16.6.0" } }, "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g=="], + "reselect": ["reselect@5.1.1", "", {}, "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w=="], + "scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="], "stylis": ["stylis@4.2.0", "", {}, "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw=="], @@ -127,6 +137,8 @@ "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="], + "use-sync-external-store": ["use-sync-external-store@1.5.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A=="], + "void-elements": ["void-elements@3.1.0", "", {}, "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w=="], "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], diff --git a/node_modules/@types/bun/README.md b/node_modules/@types/bun/README.md index b23ff544..e0a2da3e 100644 --- a/node_modules/@types/bun/README.md +++ b/node_modules/@types/bun/README.md @@ -13,7 +13,7 @@ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree ```` ### Additional Details - * Last updated: Sat, 19 Jul 2025 15:35:34 GMT + * Last updated: Tue, 26 Aug 2025 05:02:57 GMT * Dependencies: [bun-types](https://npmjs.com/package/bun-types) # Credits diff --git a/node_modules/@types/bun/package.json b/node_modules/@types/bun/package.json index f2192305..2a2ceb05 100644 --- a/node_modules/@types/bun/package.json +++ b/node_modules/@types/bun/package.json @@ -1,6 +1,6 @@ { "name": "@types/bun", - "version": "1.2.19", + "version": "1.2.21", "description": "TypeScript definitions for bun", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bun", "license": "MIT", @@ -45,9 +45,9 @@ }, "scripts": {}, "dependencies": { - "bun-types": "1.2.19" + "bun-types": "1.2.21" }, "peerDependencies": {}, - "typesPublisherContentHash": "8da2dd3c51d5ee111d571de82c46eca1d872d4f3a39c3e3a06eff0ab145d6882", - "typeScriptVersion": "5.1" + "typesPublisherContentHash": "95edf465084e25778ca108276e8cf5eade636e3fed1e56e4e91d1d0cfabf74b3", + "typeScriptVersion": "5.2" } \ No newline at end of file diff --git a/node_modules/@types/react-dom/README.md b/node_modules/@types/react-dom/README.md index 41cee7a5..0c7fc0cb 100644 --- a/node_modules/@types/react-dom/README.md +++ b/node_modules/@types/react-dom/README.md @@ -8,7 +8,7 @@ This package contains type definitions for react-dom (https://react.dev/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom. ### Additional Details - * Last updated: Wed, 04 Jun 2025 12:44:27 GMT + * Last updated: Thu, 28 Aug 2025 12:02:46 GMT * Dependencies: none * Peer dependencies: [@types/react](https://npmjs.com/package/@types/react) diff --git a/node_modules/@types/react-dom/canary.d.ts b/node_modules/@types/react-dom/canary.d.ts index ae1434c3..de0f3b1f 100644 --- a/node_modules/@types/react-dom/canary.d.ts +++ b/node_modules/@types/react-dom/canary.d.ts @@ -30,3 +30,8 @@ import React = require("react"); import ReactDOM = require("."); export {}; + +declare module "react" { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface CacheSignal extends AbortSignal {} +} diff --git a/node_modules/@types/react-dom/experimental.d.ts b/node_modules/@types/react-dom/experimental.d.ts index 4ac4260a..a9df5f7e 100644 --- a/node_modules/@types/react-dom/experimental.d.ts +++ b/node_modules/@types/react-dom/experimental.d.ts @@ -72,6 +72,7 @@ declare module "react" { listener: EventListener, optionsOrUseCapture?: Parameters[2], ): void; + experimental_scrollIntoView(alignToTop?: boolean): void; } } diff --git a/node_modules/@types/react-dom/package.json b/node_modules/@types/react-dom/package.json index 2232b7fb..d534989a 100644 --- a/node_modules/@types/react-dom/package.json +++ b/node_modules/@types/react-dom/package.json @@ -1,6 +1,6 @@ { "name": "@types/react-dom", - "version": "19.1.6", + "version": "19.1.9", "description": "TypeScript definitions for react-dom", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom", "license": "MIT", @@ -123,6 +123,6 @@ "peerDependencies": { "@types/react": "^19.0.0" }, - "typesPublisherContentHash": "7b56a76f96eb2aa35d120d8e3b6f3d4d931764fe44b89b21cd496919cab0e223", - "typeScriptVersion": "5.1" + "typesPublisherContentHash": "7dbb3f6967ec6ea50b0b724a9bb3c8d7c7b80b27e0134b57296d46f7b9291d18", + "typeScriptVersion": "5.2" } \ No newline at end of file diff --git a/node_modules/@types/react-dom/server.d.ts b/node_modules/@types/react-dom/server.d.ts index 8facba7c..584d1403 100644 --- a/node_modules/@types/react-dom/server.d.ts +++ b/node_modules/@types/react-dom/server.d.ts @@ -22,7 +22,7 @@ declare global { } import { ReactNode } from "react"; -import { ErrorInfo } from "./client"; +import { ErrorInfo, ReactFormState } from "./client"; export type BootstrapScriptDescriptor = { src: string; @@ -42,6 +42,7 @@ export interface RenderToPipeableStreamOptions { onShellError?: (error: unknown) => void; onAllReady?: () => void; onError?: (error: unknown, errorInfo: ErrorInfo) => string | void; + formState?: ReactFormState | null; } export interface PipeableStream { @@ -93,6 +94,7 @@ export interface RenderToReadableStreamOptions { progressiveChunkSize?: number; signal?: AbortSignal; onError?: (error: unknown, errorInfo: ErrorInfo) => string | void; + formState?: ReactFormState | null; } export interface ReactDOMServerReadableStream extends ReadableStream { diff --git a/node_modules/@types/react/README.md b/node_modules/@types/react/README.md index 01e3bc75..28fcc481 100644 --- a/node_modules/@types/react/README.md +++ b/node_modules/@types/react/README.md @@ -8,7 +8,7 @@ This package contains type definitions for react (https://react.dev/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. ### Additional Details - * Last updated: Wed, 11 Jun 2025 13:41:16 GMT + * Last updated: Wed, 27 Aug 2025 17:02:32 GMT * Dependencies: [csstype](https://npmjs.com/package/csstype) # Credits diff --git a/node_modules/@types/react/canary.d.ts b/node_modules/@types/react/canary.d.ts index 9ebb13b0..9c1f29d4 100644 --- a/node_modules/@types/react/canary.d.ts +++ b/node_modules/@types/react/canary.d.ts @@ -32,4 +32,7 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export function unstable_useCacheRefresh(): () => void; + + export interface CacheSignal {} + export function cacheSignal(): null | CacheSignal; } diff --git a/node_modules/@types/react/experimental.d.ts b/node_modules/@types/react/experimental.d.ts index 7bcaf5f9..48955344 100644 --- a/node_modules/@types/react/experimental.d.ts +++ b/node_modules/@types/react/experimental.d.ts @@ -226,6 +226,11 @@ declare module "." { | "hidden" | "visible" | undefined; + /** + * A name for this Activity boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; children: ReactNode; } diff --git a/node_modules/@types/react/index.d.ts b/node_modules/@types/react/index.d.ts index f868e82e..f61f6ac0 100644 --- a/node_modules/@types/react/index.d.ts +++ b/node_modules/@types/react/index.d.ts @@ -1779,8 +1779,6 @@ declare namespace React { * `useImperativeHandle` customizes the instance value that is exposed to parent components when using * `ref`. As always, imperative code using refs should be avoided in most cases. * - * `useImperativeHandle` should be used with `React.forwardRef`. - * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useImperativeHandle} */ @@ -3365,6 +3363,7 @@ declare namespace React { charSet?: string | undefined; crossOrigin?: CrossOrigin; defer?: boolean | undefined; + fetchPriority?: "high" | "low" | "auto" | undefined; integrity?: string | undefined; noModule?: boolean | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; @@ -3572,7 +3571,21 @@ declare namespace React { direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; - dominantBaseline?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; @@ -3719,7 +3732,7 @@ declare namespace React { tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; - textAnchor?: string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; diff --git a/node_modules/@types/react/package.json b/node_modules/@types/react/package.json index 51521e8c..80a4356c 100644 --- a/node_modules/@types/react/package.json +++ b/node_modules/@types/react/package.json @@ -1,6 +1,6 @@ { "name": "@types/react", - "version": "19.1.8", + "version": "19.1.12", "description": "TypeScript definitions for react", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react", "license": "MIT", @@ -205,6 +205,6 @@ "csstype": "^3.0.2" }, "peerDependencies": {}, - "typesPublisherContentHash": "585a01b49a65d7fbb67c6837bf92323a5aeed126fb67079897cfc5b780c19454", - "typeScriptVersion": "5.1" + "typesPublisherContentHash": "59e7509ab740518a751d8910ee1150e7e8056ac89bef5db10db693128940b821", + "typeScriptVersion": "5.2" } \ No newline at end of file diff --git a/node_modules/@types/react/ts5.0/canary.d.ts b/node_modules/@types/react/ts5.0/canary.d.ts index 9ebb13b0..9c1f29d4 100644 --- a/node_modules/@types/react/ts5.0/canary.d.ts +++ b/node_modules/@types/react/ts5.0/canary.d.ts @@ -32,4 +32,7 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export function unstable_useCacheRefresh(): () => void; + + export interface CacheSignal {} + export function cacheSignal(): null | CacheSignal; } diff --git a/node_modules/@types/react/ts5.0/experimental.d.ts b/node_modules/@types/react/ts5.0/experimental.d.ts index 7bcaf5f9..48955344 100644 --- a/node_modules/@types/react/ts5.0/experimental.d.ts +++ b/node_modules/@types/react/ts5.0/experimental.d.ts @@ -226,6 +226,11 @@ declare module "." { | "hidden" | "visible" | undefined; + /** + * A name for this Activity boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; children: ReactNode; } diff --git a/node_modules/@types/react/ts5.0/index.d.ts b/node_modules/@types/react/ts5.0/index.d.ts index bc856000..8f8c6180 100644 --- a/node_modules/@types/react/ts5.0/index.d.ts +++ b/node_modules/@types/react/ts5.0/index.d.ts @@ -1777,8 +1777,6 @@ declare namespace React { * `useImperativeHandle` customizes the instance value that is exposed to parent components when using * `ref`. As always, imperative code using refs should be avoided in most cases. * - * `useImperativeHandle` should be used with `React.forwardRef`. - * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useImperativeHandle} */ @@ -3363,6 +3361,7 @@ declare namespace React { charSet?: string | undefined; crossOrigin?: CrossOrigin; defer?: boolean | undefined; + fetchPriority?: "high" | "low" | "auto" | undefined; integrity?: string | undefined; noModule?: boolean | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; @@ -3570,7 +3569,21 @@ declare namespace React { direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; - dominantBaseline?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; @@ -3717,7 +3730,7 @@ declare namespace React { tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; - textAnchor?: string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; diff --git a/node_modules/@types/react/ts5.0/v18/index.d.ts b/node_modules/@types/react/ts5.0/v18/index.d.ts index e1227116..b5a29469 100644 --- a/node_modules/@types/react/ts5.0/v18/index.d.ts +++ b/node_modules/@types/react/ts5.0/v18/index.d.ts @@ -3733,7 +3733,21 @@ declare namespace React { direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; - dominantBaseline?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; @@ -3880,7 +3894,7 @@ declare namespace React { tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; - textAnchor?: string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; diff --git a/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts b/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts index 6ba74e50..4bef7213 100644 --- a/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts +++ b/node_modules/@types/react/ts5.0/v18/ts5.0/index.d.ts @@ -3734,7 +3734,21 @@ declare namespace React { direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; - dominantBaseline?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; @@ -3881,7 +3895,7 @@ declare namespace React { tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; - textAnchor?: string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; diff --git a/node_modules/bun-types/bun.d.ts b/node_modules/bun-types/bun.d.ts index 9eb1cf37..c67f7d69 100644 --- a/node_modules/bun-types/bun.d.ts +++ b/node_modules/bun-types/bun.d.ts @@ -14,14 +14,13 @@ * This module aliases `globalThis.Bun`. */ declare module "bun" { - type DistributedOmit = T extends T ? Omit : never; type PathLike = string | NodeJS.TypedArray | ArrayBufferLike | URL; type ArrayBufferView = | NodeJS.TypedArray | DataView; type BufferSource = NodeJS.TypedArray | DataView | ArrayBufferLike; type StringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike; - type XMLHttpRequestBodyInit = Blob | BufferSource | string | FormData | Iterable; + type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; type ReadableStreamController = ReadableStreamDefaultController; type ReadableStreamDefaultReadResult = | ReadableStreamDefaultReadValueResult @@ -68,39 +67,31 @@ declare module "bun" { ? T : Otherwise // Not defined in lib dom (or anywhere else), so no conflict. We can safely use our own definition : Otherwise; // Lib dom not loaded anyway, so no conflict. We can safely use our own definition + + /** + * Like Omit, but correctly distributes over unions. Most useful for removing + * properties from union options objects, like {@link Bun.SQL.Options} + * + * @example + * ```ts + * type X = Bun.DistributedOmit<{type?: 'a', url?: string} | {type?: 'b', flag?: boolean}, "url"> + * // `{type?: 'a'} | {type?: 'b', flag?: boolean}` (Omit applied to each union item instead of entire type) + * + * type X = Omit<{type?: 'a', url?: string} | {type?: 'b', flag?: boolean}, "url">; + * // `{type?: "a" | "b" | undefined}` (Missing `flag` property and no longer a union) + * ``` + */ + type DistributedOmit = T extends T ? Omit : never; + + type KeysInBoth = Extract; + type MergeInner = Omit> & + Omit> & { + [Key in KeysInBoth]: A[Key] | B[Key]; + }; + type Merge = MergeInner & MergeInner; + type DistributedMerge = T extends T ? Merge> : never; } - /** @deprecated This type is unused in Bun's types and might be removed in the near future */ - type Platform = - | "aix" - | "android" - | "darwin" - | "freebsd" - | "haiku" - | "linux" - | "openbsd" - | "sunos" - | "win32" - | "cygwin" - | "netbsd"; - - /** @deprecated This type is unused in Bun's types and might be removed in the near future */ - type Architecture = "arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x64"; - - /** @deprecated This type is unused in Bun's types and might be removed in the near future */ - type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; - - /** - * Most of the time the unhandledRejection will be an Error, but this should not be relied upon - * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. - * - * @deprecated This type is unused in Bun's types and might be removed in the near future - */ - type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; - - /** @deprecated This type is unused in Bun's types and might be removed in the near future */ - type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: unknown) => void; - interface ErrorEventInit extends EventInit { colno?: number; error?: any; @@ -596,6 +587,23 @@ declare module "bun" { options?: StringWidthOptions, ): number; + /** + * Remove ANSI escape codes from a string. + * + * @category Utilities + * + * @param input The string to remove ANSI escape codes from. + * @returns The string with ANSI escape codes removed. + * + * @example + * ```ts + * import { stripANSI } from "bun"; + * + * console.log(stripANSI("\u001b[31mhello\u001b[39m")); // "hello" + * ``` + */ + function stripANSI(input: string): string; + /** * TOML related APIs */ @@ -826,7 +834,7 @@ declare module "bun" { buffers: Array, maxLength: number, asUint8Array: true, - ): Uint8Array; + ): Uint8Array; /** * Consume all data from a {@link ReadableStream} until it closes or errors. @@ -843,35 +851,6 @@ declare module "bun" { stream: ReadableStream, ): Promise | ArrayBuffer; - /** - * Consume all data from a {@link ReadableStream} until it closes or errors. - * - * Concatenate the chunks into a single {@link ArrayBuffer}. - * - * Each chunk must be a TypedArray or an ArrayBuffer. If you need to support - * chunks of different types, consider {@link readableStreamToBlob} - * - * @param stream The stream to consume. - * @returns A promise that resolves with the concatenated chunks or the concatenated chunks as a {@link Uint8Array}. - * - * @deprecated Use {@link ReadableStream.bytes} - */ - function readableStreamToBytes( - stream: ReadableStream, - ): Promise | Uint8Array; - - /** - * Consume all data from a {@link ReadableStream} until it closes or errors. - * - * Concatenate the chunks into a single {@link Blob}. - * - * @param stream The stream to consume. - * @returns A promise that resolves with the concatenated chunks as a {@link Blob}. - * - * @deprecated Use {@link ReadableStream.blob} - */ - function readableStreamToBlob(stream: ReadableStream): Promise; - /** * Consume all data from a {@link ReadableStream} until it closes or errors. * @@ -904,30 +883,6 @@ declare module "bun" { multipartBoundaryExcludingDashes?: string | NodeJS.TypedArray | ArrayBufferView, ): Promise; - /** - * Consume all data from a {@link ReadableStream} until it closes or errors. - * - * Concatenate the chunks into a single string. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}. - * - * @param stream The stream to consume. - * @returns A promise that resolves with the concatenated chunks as a {@link String}. - * - * @deprecated Use {@link ReadableStream.text} - */ - function readableStreamToText(stream: ReadableStream): Promise; - - /** - * Consume all data from a {@link ReadableStream} until it closes or errors. - * - * Concatenate the chunks into a single string and parse as JSON. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}. - * - * @param stream The stream to consume. - * @returns A promise that resolves with the concatenated chunks as a {@link String}. - * - * @deprecated Use {@link ReadableStream.json} - */ - function readableStreamToJSON(stream: ReadableStream): Promise; - /** * Consume all data from a {@link ReadableStream} until it closes or errors. * @@ -1027,8 +982,8 @@ declare module "bun" { * * This API might change later to separate Uint8ArraySink and ArrayBufferSink */ - flush(): number | Uint8Array | ArrayBuffer; - end(): ArrayBuffer | Uint8Array; + flush(): number | Uint8Array | ArrayBuffer; + end(): ArrayBuffer | Uint8Array; } /** DNS Related APIs */ @@ -1312,656 +1267,6 @@ declare module "bun" { stat(): Promise; } - namespace SQL { - type AwaitPromisesArray>> = { - [K in keyof T]: Awaited; - }; - - type ContextCallbackResult = T extends Array> ? AwaitPromisesArray : Awaited; - type ContextCallback = (sql: SQL) => Promise; - - /** - * Configuration options for SQL client connection and behavior - * - * @example - * ```ts - * const config: Bun.SQL.Options = { - * host: 'localhost', - * port: 5432, - * user: 'dbuser', - * password: 'secretpass', - * database: 'myapp', - * idleTimeout: 30, - * max: 20, - * onconnect: (client) => { - * console.log('Connected to database'); - * } - * }; - * ``` - */ - interface Options { - /** - * Connection URL (can be string or URL object) - */ - url?: URL | string | undefined; - - /** - * Database server hostname - * @default "localhost" - */ - host?: string | undefined; - - /** - * Database server hostname (alias for host) - * @deprecated Prefer {@link host} - * @default "localhost" - */ - hostname?: string | undefined; - - /** - * Database server port number - * @default 5432 - */ - port?: number | string | undefined; - - /** - * Database user for authentication - * @default "postgres" - */ - username?: string | undefined; - - /** - * Database user for authentication (alias for username) - * @deprecated Prefer {@link username} - * @default "postgres" - */ - user?: string | undefined; - - /** - * Database password for authentication - * @default "" - */ - password?: string | (() => MaybePromise) | undefined; - - /** - * Database password for authentication (alias for password) - * @deprecated Prefer {@link password} - * @default "" - */ - pass?: string | (() => MaybePromise) | undefined; - - /** - * Name of the database to connect to - * @default The username value - */ - database?: string | undefined; - - /** - * Name of the database to connect to (alias for database) - * @deprecated Prefer {@link database} - * @default The username value - */ - db?: string | undefined; - - /** - * Database adapter/driver to use - * @default "postgres" - */ - adapter?: "postgres" /*| "sqlite" | "mysql"*/ | (string & {}) | undefined; - - /** - * Maximum time in seconds to wait for connection to become available - * @default 0 (no timeout) - */ - idleTimeout?: number | undefined; - - /** - * Maximum time in seconds to wait for connection to become available (alias for idleTimeout) - * @deprecated Prefer {@link idleTimeout} - * @default 0 (no timeout) - */ - idle_timeout?: number | undefined; - - /** - * Maximum time in seconds to wait when establishing a connection - * @default 30 - */ - connectionTimeout?: number | undefined; - - /** - * Maximum time in seconds to wait when establishing a connection (alias for connectionTimeout) - * @deprecated Prefer {@link connectionTimeout} - * @default 30 - */ - connection_timeout?: number | undefined; - - /** - * Maximum time in seconds to wait when establishing a connection (alias for connectionTimeout) - * @deprecated Prefer {@link connectionTimeout} - * @default 30 - */ - connectTimeout?: number | undefined; - - /** - * Maximum time in seconds to wait when establishing a connection (alias for connectionTimeout) - * @deprecated Prefer {@link connectionTimeout} - * @default 30 - */ - connect_timeout?: number | undefined; - - /** - * Maximum lifetime in seconds of a connection - * @default 0 (no maximum lifetime) - */ - maxLifetime?: number | undefined; - - /** - * Maximum lifetime in seconds of a connection (alias for maxLifetime) - * @deprecated Prefer {@link maxLifetime} - * @default 0 (no maximum lifetime) - */ - max_lifetime?: number | undefined; - - /** - * Whether to use TLS/SSL for the connection - * @default false - */ - tls?: TLSOptions | boolean | undefined; - - /** - * Whether to use TLS/SSL for the connection (alias for tls) - * @default false - */ - ssl?: TLSOptions | boolean | undefined; - - // `.path` is currently unsupported in Bun, the implementation is incomplete. - // - // /** - // * Unix domain socket path for connection - // * @default "" - // */ - // path?: string | undefined; - - /** - * Callback function executed when a connection is established - */ - onconnect?: ((client: SQL) => void) | undefined; - - /** - * Callback function executed when a connection is closed - */ - onclose?: ((client: SQL) => void) | undefined; - - /** - * Postgres client runtime configuration options - * - * @see https://www.postgresql.org/docs/current/runtime-config-client.html - */ - connection?: Record | undefined; - - /** - * Maximum number of connections in the pool - * @default 10 - */ - max?: number | undefined; - - /** - * By default values outside i32 range are returned as strings. If this is true, values outside i32 range are returned as BigInts. - * @default false - */ - bigint?: boolean | undefined; - - /** - * Automatic creation of prepared statements - * @default true - */ - prepare?: boolean | undefined; - } - - /** - * Represents a SQL query that can be executed, with additional control methods - * Extends Promise to allow for async/await usage - */ - interface Query extends Promise { - /** - * Indicates if the query is currently executing - */ - active: boolean; - - /** - * Indicates if the query has been cancelled - */ - cancelled: boolean; - - /** - * Cancels the executing query - */ - cancel(): Query; - - /** - * Executes the query as a simple query, no parameters are allowed but can execute multiple commands separated by semicolons - */ - simple(): Query; - - /** - * Executes the query - */ - execute(): Query; - - /** - * Returns the raw query result - */ - raw(): Query; - - /** - * Returns only the values from the query result - */ - values(): Query; - } - - /** - * Callback function type for transaction contexts - * @param sql Function to execute SQL queries within the transaction - */ - type TransactionContextCallback = ContextCallback; - - /** - * Callback function type for savepoint contexts - * @param sql Function to execute SQL queries within the savepoint - */ - type SavepointContextCallback = ContextCallback; - - /** - * SQL.Helper represents a parameter or serializable - * value inside of a query. - * - * @example - * ```ts - * const helper = sql(users, 'id'); - * await sql`insert into users ${helper}`; - * ``` - */ - interface Helper { - readonly value: T[]; - readonly columns: (keyof T)[]; - } - } - - /** - * Main SQL client interface providing connection and transaction management - */ - interface SQL extends AsyncDisposable { - /** - * Executes a SQL query using template literals - * @example - * ```ts - * const [user] = await sql`select * from users where id = ${1}`; - * ``` - */ - (strings: TemplateStringsArray, ...values: unknown[]): SQL.Query; - - /** - * Execute a SQL query using a string - */ - (string: string): SQL.Query; - - /** - * Helper function for inserting an object into a query - * - * @example - * ```ts - * // Insert an object - * const result = await sql`insert into users ${sql(users)} returning *`; - * - * // Or pick specific columns - * const result = await sql`insert into users ${sql(users, "id", "name")} returning *`; - * - * // Or a single object - * const result = await sql`insert into users ${sql(user)} returning *`; - * ``` - */ - ( - obj: T | T[] | readonly T[], - ...columns: readonly Keys[] - ): SQL.Helper>; - - /** - * Helper function for inserting any serializable value into a query - * - * @example - * ```ts - * const result = await sql`SELECT * FROM users WHERE id IN ${sql([1, 2, 3])}`; - * ``` - */ - (value: T): SQL.Helper; - - /** - * Commits a distributed transaction also know as prepared transaction in postgres or XA transaction in MySQL - * - * @param name - The name of the distributed transaction - * - * @example - * ```ts - * await sql.commitDistributed("my_distributed_transaction"); - * ``` - */ - commitDistributed(name: string): Promise; - - /** - * Rolls back a distributed transaction also know as prepared transaction in postgres or XA transaction in MySQL - * - * @param name - The name of the distributed transaction - * - * @example - * ```ts - * await sql.rollbackDistributed("my_distributed_transaction"); - * ``` - */ - rollbackDistributed(name: string): Promise; - - /** Waits for the database connection to be established - * - * @example - * ```ts - * await sql.connect(); - * ``` - */ - connect(): Promise; - - /** - * Closes the database connection with optional timeout in seconds. If timeout is 0, it will close immediately, if is not provided it will wait for all queries to finish before closing. - * - * @param options - The options for the close - * - * @example - * ```ts - * await sql.close({ timeout: 1 }); - * ``` - */ - close(options?: { timeout?: number }): Promise; - - /** - * Closes the database connection with optional timeout in seconds. If timeout is 0, it will close immediately, if is not provided it will wait for all queries to finish before closing. - * This is an alias of {@link SQL.close} - * - * @param options - The options for the close - * - * @example - * ```ts - * await sql.end({ timeout: 1 }); - * ``` - */ - end(options?: { timeout?: number }): Promise; - - /** - * Flushes any pending operations - * - * @example - * ```ts - * sql.flush(); - * ``` - */ - flush(): void; - - /** - * The reserve method pulls out a connection from the pool, and returns a client that wraps the single connection. - * - * This can be used for running queries on an isolated connection. - * Calling reserve in a reserved Sql will return a new reserved connection, not the same connection (behavior matches postgres package). - * - * @example - * ```ts - * const reserved = await sql.reserve(); - * await reserved`select * from users`; - * await reserved.release(); - * // with in a production scenario would be something more like - * const reserved = await sql.reserve(); - * try { - * // ... queries - * } finally { - * await reserved.release(); - * } - * - * // Bun supports Symbol.dispose and Symbol.asyncDispose - * { - * // always release after context (safer) - * using reserved = await sql.reserve() - * await reserved`select * from users` - * } - * ``` - */ - reserve(): Promise; - - /** - * Begins a new transaction. - * - * Will reserve a connection for the transaction and supply a scoped sql instance for all transaction uses in the callback function. sql.begin will resolve with the returned value from the callback function. - * BEGIN is automatically sent with the optional options, and if anything fails ROLLBACK will be called so the connection can be released and execution can continue. - * @example - * const [user, account] = await sql.begin(async sql => { - * const [user] = await sql` - * insert into users ( - * name - * ) values ( - * 'Murray' - * ) - * returning * - * ` - * const [account] = await sql` - * insert into accounts ( - * user_id - * ) values ( - * ${ user.user_id } - * ) - * returning * - * ` - * return [user, account] - * }) - */ - begin(fn: SQL.TransactionContextCallback): Promise>; - - /** - * Begins a new transaction with options. - * - * Will reserve a connection for the transaction and supply a scoped sql instance for all transaction uses in the callback function. sql.begin will resolve with the returned value from the callback function. - * BEGIN is automatically sent with the optional options, and if anything fails ROLLBACK will be called so the connection can be released and execution can continue. - * @example - * const [user, account] = await sql.begin("read write", async sql => { - * const [user] = await sql` - * insert into users ( - * name - * ) values ( - * 'Murray' - * ) - * returning * - * ` - * const [account] = await sql` - * insert into accounts ( - * user_id - * ) values ( - * ${ user.user_id } - * ) - * returning * - * ` - * return [user, account] - * }) - */ - begin(options: string, fn: SQL.TransactionContextCallback): Promise>; - - /** - * Alternative method to begin a transaction. - * - * Will reserve a connection for the transaction and supply a scoped sql instance for all transaction uses in the callback function. sql.transaction will resolve with the returned value from the callback function. - * BEGIN is automatically sent with the optional options, and if anything fails ROLLBACK will be called so the connection can be released and execution can continue. - * @alias begin - * @example - * const [user, account] = await sql.transaction(async sql => { - * const [user] = await sql` - * insert into users ( - * name - * ) values ( - * 'Murray' - * ) - * returning * - * ` - * const [account] = await sql` - * insert into accounts ( - * user_id - * ) values ( - * ${ user.user_id } - * ) - * returning * - * ` - * return [user, account] - * }) - */ - transaction(fn: SQL.TransactionContextCallback): Promise>; - - /** - * Alternative method to begin a transaction with options - * Will reserve a connection for the transaction and supply a scoped sql instance for all transaction uses in the callback function. sql.transaction will resolve with the returned value from the callback function. - * BEGIN is automatically sent with the optional options, and if anything fails ROLLBACK will be called so the connection can be released and execution can continue. - * - * @alias {@link begin} - * - * @example - * const [user, account] = await sql.transaction("read write", async sql => { - * const [user] = await sql` - * insert into users ( - * name - * ) values ( - * 'Murray' - * ) - * returning * - * ` - * const [account] = await sql` - * insert into accounts ( - * user_id - * ) values ( - * ${ user.user_id } - * ) - * returning * - * ` - * return [user, account] - * }); - */ - transaction(options: string, fn: SQL.TransactionContextCallback): Promise>; - - /** - * Begins a distributed transaction - * Also know as Two-Phase Commit, in a distributed transaction, Phase 1 involves the coordinator preparing nodes by ensuring data is written and ready to commit, while Phase 2 finalizes with nodes committing or rolling back based on the coordinator's decision, ensuring durability and releasing locks. - * In PostgreSQL and MySQL distributed transactions persist beyond the original session, allowing privileged users or coordinators to commit/rollback them, ensuring support for distributed transactions, recovery, and administrative tasks. - * beginDistributed will automatic rollback if any exception are not caught, and you can commit and rollback later if everything goes well. - * PostgreSQL natively supports distributed transactions using PREPARE TRANSACTION, while MySQL uses XA Transactions, and MSSQL also supports distributed/XA transactions. However, in MSSQL, distributed transactions are tied to the original session, the DTC coordinator, and the specific connection. - * These transactions are automatically committed or rolled back following the same rules as regular transactions, with no option for manual intervention from other sessions, in MSSQL distributed transactions are used to coordinate transactions using Linked Servers. - * - * @example - * await sql.beginDistributed("numbers", async sql => { - * await sql`create table if not exists numbers (a int)`; - * await sql`insert into numbers values(1)`; - * }); - * // later you can call - * await sql.commitDistributed("numbers"); - * // or await sql.rollbackDistributed("numbers"); - */ - beginDistributed( - name: string, - fn: SQL.TransactionContextCallback, - ): Promise>; - - /** Alternative method to begin a distributed transaction - * @alias {@link beginDistributed} - */ - distributed(name: string, fn: SQL.TransactionContextCallback): Promise>; - - /**If you know what you're doing, you can use unsafe to pass any string you'd like. - * Please note that this can lead to SQL injection if you're not careful. - * You can also nest sql.unsafe within a safe sql expression. This is useful if only part of your fraction has unsafe elements. - * @example - * const result = await sql.unsafe(`select ${danger} from users where id = ${dragons}`) - */ - unsafe(string: string, values?: any[]): SQL.Query; - - /** - * Reads a file and uses the contents as a query. - * Optional parameters can be used if the file includes $1, $2, etc - * @example - * const result = await sql.file("query.sql", [1, 2, 3]); - */ - file(filename: string, values?: any[]): SQL.Query; - - /** - * Current client options - */ - options: SQL.Options; - } - - const SQL: { - /** - * Creates a new SQL client instance - * - * @param connectionString - The connection string for the SQL client - * - * @example - * ```ts - * const sql = new SQL("postgres://localhost:5432/mydb"); - * const sql = new SQL(new URL("postgres://localhost:5432/mydb")); - * ``` - */ - new (connectionString: string | URL): SQL; - - /** - * Creates a new SQL client instance with options - * - * @param connectionString - The connection string for the SQL client - * @param options - The options for the SQL client - * - * @example - * ```ts - * const sql = new SQL("postgres://localhost:5432/mydb", { idleTimeout: 1000 }); - * ``` - */ - new (connectionString: string | URL, options: Omit): SQL; - - /** - * Creates a new SQL client instance with options - * - * @param options - The options for the SQL client - * - * @example - * ```ts - * const sql = new SQL({ url: "postgres://localhost:5432/mydb", idleTimeout: 1000 }); - * ``` - */ - new (options?: SQL.Options): SQL; - }; - - /** - * Represents a reserved connection from the connection pool - * Extends SQL with additional release functionality - */ - interface ReservedSQL extends SQL, Disposable { - /** - * Releases the client back to the connection pool - */ - release(): void; - } - - /** - * Represents a client within a transaction context - * Extends SQL with savepoint functionality - */ - interface TransactionSQL extends SQL { - /** Creates a savepoint within the current transaction */ - savepoint(name: string, fn: SQLSavepointContextCallback): Promise; - savepoint(fn: SQLSavepointContextCallback): Promise; - } - - /** - * Represents a savepoint within a transaction - */ - interface SavepointSQL extends SQL {} - type CSRFAlgorithm = "blake2b256" | "blake2b512" | "sha256" | "sha384" | "sha512" | "sha512-256"; interface CSRFGenerateOptions { @@ -2009,16 +1314,6 @@ declare module "bun" { maxAge?: number; } - /** - * SQL client - */ - const sql: SQL; - - /** - * SQL client for PostgreSQL - */ - const postgres: SQL; - /** * Generate and verify CSRF tokens * @@ -2333,12 +1628,25 @@ declare module "bun" { kind: ImportKind; } + namespace Build { + type Architecture = "x64" | "arm64"; + type Libc = "glibc" | "musl"; + type SIMD = "baseline" | "modern"; + type Target = + | `bun-darwin-${Architecture}` + | `bun-darwin-x64-${SIMD}` + | `bun-linux-${Architecture}` + | `bun-linux-${Architecture}-${Libc}` + | "bun-windows-x64" + | `bun-windows-x64-${SIMD}` + | `bun-linux-x64-${SIMD}-${Libc}`; + } + /** * @see [Bun.build API docs](https://bun.com/docs/bundler#api) */ - interface BuildConfig { + interface BuildConfigBase { entrypoints: string[]; // list of file path - outdir?: string; // output directory /** * @default "browser" */ @@ -2376,7 +1684,6 @@ declare module "bun" { asset?: string; }; // | string; root?: string; // project root - splitting?: boolean; // default true, enable code splitting plugins?: BunPlugin[]; // manifest?: boolean; // whether to return manifest external?: string[]; @@ -2525,8 +1832,61 @@ declare module "bun" { * ``` */ tsconfig?: string; + + outdir?: string; } + interface CompileBuildOptions { + target?: Bun.Build.Target; + execArgv?: string[]; + executablePath?: string; + outfile?: string; + windows?: { + hideConsole?: boolean; + icon?: string; + title?: string; + publisher?: string; + version?: string; + description?: string; + copyright?: string; + }; + } + + // Compile build config - uses outfile for executable output + interface CompileBuildConfig extends BuildConfigBase { + /** + * Create a standalone executable + * + * When `true`, creates an executable for the current platform. + * When a target string, creates an executable for that platform. + * + * @example + * ```ts + * // Create executable for current platform + * await Bun.build({ + * entrypoints: ['./app.js'], + * compile: { + * target: 'linux-x64', + * }, + * outfile: './my-app' + * }); + * + * // Cross-compile for Linux x64 + * await Bun.build({ + * entrypoints: ['./app.js'], + * compile: 'linux-x64', + * outfile: './my-app' + * }); + * ``` + */ + compile: boolean | Bun.Build.Target | CompileBuildOptions; + } + + /** + * @see [Bun.build API docs](https://bun.com/docs/bundler#api) + */ + type BuildConfig = BuildConfigBase | CompileBuildConfig; + /** * Hash and verify passwords using argon2 or bcrypt * @@ -2765,6 +2125,287 @@ declare module "bun" { ): string; }; + /** + * Securely store and retrieve sensitive credentials using the operating system's native credential storage. + * + * Uses platform-specific secure storage: + * - **macOS**: Keychain Services + * - **Linux**: libsecret (GNOME Keyring, KWallet, etc.) + * - **Windows**: Windows Credential Manager + * + * @category Security + * + * @example + * ```ts + * import { secrets } from "bun"; + * + * // Store a credential + * await secrets.set({ + * service: "my-cli-tool", + * name: "github-token", + * value: "ghp_xxxxxxxxxxxxxxxxxxxx" + * }); + * + * // Retrieve a credential + * const token = await secrets.get({ + * service: "my-cli-tool", + * name: "github-token" + * }); + * + * if (token) { + * console.log("Token found:", token); + * } else { + * console.log("Token not found"); + * } + * + * // Delete a credential + * const deleted = await secrets.delete({ + * service: "my-cli-tool", + * name: "github-token" + * }); + * console.log("Deleted:", deleted); // true if deleted, false if not found + * ``` + * + * @example + * ```ts + * // Replace plaintext config files + * import { secrets } from "bun"; + * + * // Instead of storing in ~/.npmrc + * await secrets.set({ + * service: "npm-registry", + * name: "https://registry.npmjs.org", + * value: "npm_xxxxxxxxxxxxxxxxxxxx" + * }); + * + * // Instead of storing in ~/.aws/credentials + * await secrets.set({ + * service: "aws-cli", + * name: "default", + * value: process.env.AWS_SECRET_ACCESS_KEY + * }); + * + * // Load at runtime with fallback + * const apiKey = await secrets.get({ + * service: "my-app", + * name: "api-key" + * }) || process.env.API_KEY; + * ``` + */ + const secrets: { + /** + * Retrieve a stored credential from the operating system's secure storage. + * + * @param options - The service and name identifying the credential + * @returns The stored credential value, or null if not found + * + * @example + * ```ts + * const password = await Bun.secrets.get({ + * service: "my-database", + * name: "admin" + * }); + * + * if (password) { + * await connectToDatabase(password); + * } + * ``` + * + * @example + * ```ts + * // Check multiple possible locations + * const token = + * await Bun.secrets.get({ service: "github", name: "token" }) || + * await Bun.secrets.get({ service: "gh-cli", name: "github.com" }) || + * process.env.GITHUB_TOKEN; + * ``` + */ + get(options: { + /** + * The service or application name. + * + * Use a unique identifier for your application to avoid conflicts. + * Consider using reverse domain notation for production apps (e.g., "com.example.myapp"). + */ + service: string; + + /** + * The account name, username, or resource identifier. + * + * This identifies the specific credential within the service. + * Common patterns include usernames, email addresses, or resource URLs. + */ + name: string; + }): Promise; + + /** + * Store or update a credential in the operating system's secure storage. + * + * If a credential already exists for the given service/name combination, it will be replaced. + * The credential is encrypted by the operating system and only accessible to the current user. + * + * @param options - The service and name identifying the credential + * @param value - The secret value to store (e.g., password, API key, token) + * + * @example + * ```ts + * // Store an API key + * await Bun.secrets.set({ + * service: "openai-api", + * name: "production", + * value: "sk-proj-xxxxxxxxxxxxxxxxxxxx" + * }); + * ``` + * + * @example + * ```ts + * // Update an existing credential + * const newPassword = generateSecurePassword(); + * await Bun.secrets.set({ + * service: "email-server", + * name: "admin@example.com", + * value: newPassword + * }); + * ``` + * + * @example + * ```ts + * // Store credentials from environment variables + * if (process.env.DATABASE_PASSWORD) { + * await Bun.secrets.set({ + * service: "postgres", + * name: "production", + * value: process.env.DATABASE_PASSWORD + * }); + * delete process.env.DATABASE_PASSWORD; // Remove from memory + * } + * ``` + * + * @example + * ```ts + * // Delete a credential using empty string (equivalent to delete()) + * await Bun.secrets.set({ + * service: "my-service", + * name: "api-key", + * value: "" // Empty string deletes the credential + * }); + * ``` + * + * @example + * ```ts + * // Store credential with unrestricted access for CI environments + * await Bun.secrets.set({ + * service: "github-actions", + * name: "deploy-token", + * value: process.env.DEPLOY_TOKEN, + * allowUnrestrictedAccess: true // Allows access without user interaction on macOS + * }); + * ``` + */ + set(options: { + /** + * The service or application name. + * + * Use a unique identifier for your application to avoid conflicts. + * Consider using reverse domain notation for production apps (e.g., "com.example.myapp"). + */ + service: string; + + /** + * The account name, username, or resource identifier. + * + * This identifies the specific credential within the service. + * Common patterns include usernames, email addresses, or resource URLs. + */ + name: string; + + /** + * The secret value to store. + * + * This should be a sensitive credential like a password, API key, or token. + * The value is encrypted by the operating system before storage. + * + * Note: To delete a credential, use the delete() method or pass an empty string. + * An empty string value will delete the credential if it exists. + */ + value: string; + + /** + * Allow unrestricted access to stored credentials on macOS. + * + * When true, allows all applications to access this keychain item without user interaction. + * This is useful for CI environments but reduces security. + * + * @default false + * @platform macOS - Only affects macOS keychain behavior. Ignored on other platforms. + */ + allowUnrestrictedAccess?: boolean; + }): Promise; + + /** + * Delete a stored credential from the operating system's secure storage. + * + * @param options - The service and name identifying the credential + * @returns true if a credential was deleted, false if not found + * + * @example + * ```ts + * // Delete a single credential + * const deleted = await Bun.secrets.delete({ + * service: "my-app", + * name: "api-key" + * }); + * + * if (deleted) { + * console.log("Credential removed successfully"); + * } else { + * console.log("Credential was not found"); + * } + * ``` + * + * @example + * ```ts + * // Clean up multiple credentials + * const services = ["github", "npm", "docker"]; + * for (const service of services) { + * await Bun.secrets.delete({ + * service, + * name: "token" + * }); + * } + * ``` + * + * @example + * ```ts + * // Clean up on uninstall + * if (process.argv.includes("--uninstall")) { + * const deleted = await Bun.secrets.delete({ + * service: "my-cli-tool", + * name: "config" + * }); + * process.exit(deleted ? 0 : 1); + * } + * ``` + */ + delete(options: { + /** + * The service or application name. + * + * Use a unique identifier for your application to avoid conflicts. + * Consider using reverse domain notation for production apps (e.g., "com.example.myapp"). + */ + service: string; + + /** + * The account name, username, or resource identifier. + * + * This identifies the specific credential within the service. + * Common patterns include usernames, email addresses, or resource URLs. + */ + name: string; + }): Promise; + }; + /** * A build artifact represents a file that was generated by the bundler @see {@link Bun.build} * @@ -3682,7 +3323,7 @@ declare module "bun" { /** * If set, the HTTP server will listen on a unix socket instead of a port. - * (Cannot be used with hostname+port) + * (Cannot use unix with port + hostname) */ unix?: never; @@ -3705,9 +3346,21 @@ declare module "bun" { interface UnixServeOptions extends GenericServeOptions { /** * If set, the HTTP server will listen on a unix socket instead of a port. - * (Cannot be used with hostname+port) */ unix: string; + + /** + * If set, the HTTP server will listen on this port + * (Cannot use port with unix) + */ + port?: never; + + /** + * If set, the HTTP server will listen on this hostname + * (Cannot use hostname with unix) + */ + hostname?: never; + /** * Handle HTTP requests * @@ -4385,11 +4038,11 @@ declare module "bun" { * The type of options that can be passed to {@link serve}, with support for `routes` and a safer requirement for `fetch` */ type ServeFunctionOptions> }> = - | (DistributedOmit, WebSocketServeOptions>, "fetch"> & { + | (__internal.DistributedOmit, WebSocketServeOptions>, "fetch"> & { routes: R; fetch?: (this: Server, request: Request, server: Server) => Response | Promise; }) - | (DistributedOmit, WebSocketServeOptions>, "routes"> & { + | (__internal.DistributedOmit, WebSocketServeOptions>, "routes"> & { routes?: never; fetch: (this: Server, request: Request, server: Server) => Response | Promise; }) @@ -4635,7 +4288,7 @@ declare module "bun" { * * @param path The path to the file as a byte buffer (the buffer is copied) if the path starts with `s3://` it will behave like {@link S3File} */ - function file(path: ArrayBufferLike | Uint8Array, options?: BlobPropertyBag): BunFile; + function file(path: ArrayBufferLike | Uint8Array, options?: BlobPropertyBag): BunFile; /** * [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) powered by the fastest system calls available for operating on files. @@ -4658,7 +4311,7 @@ declare module "bun" { * * This can be 3.5x faster than `new Uint8Array(size)`, but if you send uninitialized memory to your users (even unintentionally), it can potentially leak anything recently in memory. */ - function allocUnsafe(size: number): Uint8Array; + function allocUnsafe(size: number): Uint8Array; /** * Options for `Bun.inspect` @@ -4941,7 +4594,7 @@ declare module "bun" { * * To close the file, set the array to `null` and it will be garbage collected eventually. */ - function mmap(path: PathLike, opts?: MMapOptions): Uint8Array; + function mmap(path: PathLike, opts?: MMapOptions): Uint8Array; /** * Write to stdout @@ -4971,8 +4624,8 @@ declare module "bun" { | { r: number; g: number; b: number; a?: number } | [number, number, number] | [number, number, number, number] - | Uint8Array - | Uint8ClampedArray + | Uint8Array + | Uint8ClampedArray | Float32Array | Float64Array | string @@ -5095,7 +4748,7 @@ declare module "bun" { * * **The input buffer must not be garbage collected**. That means you will need to hold on to it for the duration of the string's lifetime. */ - function arrayBufferToString(buffer: Uint8Array | ArrayBufferLike): string; + function arrayBufferToString(buffer: Uint8Array | ArrayBufferLike): string; /** * Cast bytes to a `String` without copying. This is the fastest way to get a `String` from a `Uint16Array` @@ -5644,9 +5297,9 @@ declare module "bun" { * @returns The output buffer with the compressed data */ function deflateSync( - data: Uint8Array | string | ArrayBuffer, + data: Uint8Array | string | ArrayBuffer, options?: ZlibCompressionOptions | LibdeflateCompressionOptions, - ): Uint8Array; + ): Uint8Array; /** * Compresses a chunk of data with `zlib` GZIP algorithm. * @param data The buffer of data to compress @@ -5654,27 +5307,27 @@ declare module "bun" { * @returns The output buffer with the compressed data */ function gzipSync( - data: Uint8Array | string | ArrayBuffer, + data: Uint8Array | string | ArrayBuffer, options?: ZlibCompressionOptions | LibdeflateCompressionOptions, - ): Uint8Array; + ): Uint8Array; /** * Decompresses a chunk of data with `zlib` INFLATE algorithm. * @param data The buffer of data to decompress * @returns The output buffer with the decompressed data */ function inflateSync( - data: Uint8Array | string | ArrayBuffer, + data: Uint8Array | string | ArrayBuffer, options?: ZlibCompressionOptions | LibdeflateCompressionOptions, - ): Uint8Array; + ): Uint8Array; /** * Decompresses a chunk of data with `zlib` GUNZIP algorithm. * @param data The buffer of data to decompress * @returns The output buffer with the decompressed data */ function gunzipSync( - data: Uint8Array | string | ArrayBuffer, + data: Uint8Array | string | ArrayBuffer, options?: ZlibCompressionOptions | LibdeflateCompressionOptions, - ): Uint8Array; + ): Uint8Array; /** * Compresses a chunk of data with the Zstandard (zstd) compression algorithm. @@ -6651,7 +6304,7 @@ declare module "bun" { interface BinaryTypeList { arraybuffer: ArrayBuffer; buffer: Buffer; - uint8array: Uint8Array; + uint8array: Uint8Array; // TODO: DataView // dataview: DataView; } @@ -6829,6 +6482,7 @@ declare module "bun" { * The unix socket to listen on or connect to */ unix: string; + /** * TLS Configuration with which to create the socket */ @@ -7223,7 +6877,7 @@ declare module "bun" { } type ReadableToIO = X extends "pipe" | undefined - ? ReadableStream + ? ReadableStream> : X extends BunFile | ArrayBufferView | number ? number : undefined; @@ -7547,10 +7201,11 @@ declare module "bun" { * Internally, this uses [posix_spawn(2)](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/posix_spawn.2.html) */ function spawnSync< + const In extends SpawnOptions.Writable = "ignore", const Out extends SpawnOptions.Readable = "pipe", - const Err extends SpawnOptions.Readable = "inherit", + const Err extends SpawnOptions.Readable = "pipe", >( - options: SpawnOptions.OptionsObject<"ignore", Out, Err> & { + options: SpawnOptions.OptionsObject & { /** * The command to run * @@ -7582,8 +7237,9 @@ declare module "bun" { * Internally, this uses [posix_spawn(2)](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/posix_spawn.2.html) */ function spawnSync< + const In extends SpawnOptions.Writable = "ignore", const Out extends SpawnOptions.Readable = "pipe", - const Err extends SpawnOptions.Readable = "inherit", + const Err extends SpawnOptions.Readable = "pipe", >( /** * The command to run @@ -7600,7 +7256,7 @@ declare module "bun" { * ``` */ cmds: string[], - options?: SpawnOptions.OptionsObject<"ignore", Out, Err>, + options?: SpawnOptions.OptionsObject, ): SyncSubprocess; /** Utility type for any process from {@link Bun.spawn()} with both stdout and stderr set to `"pipe"` */ diff --git a/node_modules/bun-types/deprecated.d.ts b/node_modules/bun-types/deprecated.d.ts index deae80be..b9084613 100644 --- a/node_modules/bun-types/deprecated.d.ts +++ b/node_modules/bun-types/deprecated.d.ts @@ -1,4 +1,88 @@ declare module "bun" { + /** @deprecated This type is unused in Bun's types and might be removed in the near future */ + type Platform = + | "aix" + | "android" + | "darwin" + | "freebsd" + | "haiku" + | "linux" + | "openbsd" + | "sunos" + | "win32" + | "cygwin" + | "netbsd"; + + /** @deprecated This type is unused in Bun's types and might be removed in the near future */ + type Architecture = "arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x64"; + + /** @deprecated This type is unused in Bun's types and might be removed in the near future */ + type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; + + /** + * Most of the time the unhandledRejection will be an Error, but this should not be relied upon + * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. + * + * @deprecated This type is unused in Bun's types and might be removed in the near future + */ + type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; + + /** @deprecated This type is unused in Bun's types and might be removed in the near future */ + type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: unknown) => void; + + /** + * Consume all data from a {@link ReadableStream} until it closes or errors. + * + * Concatenate the chunks into a single {@link ArrayBuffer}. + * + * Each chunk must be a TypedArray or an ArrayBuffer. If you need to support + * chunks of different types, consider {@link readableStreamToBlob} + * + * @param stream The stream to consume. + * @returns A promise that resolves with the concatenated chunks or the concatenated chunks as a {@link Uint8Array}. + * + * @deprecated Use {@link ReadableStream.bytes} + */ + function readableStreamToBytes( + stream: ReadableStream, + ): Promise> | Uint8Array; + + /** + * Consume all data from a {@link ReadableStream} until it closes or errors. + * + * Concatenate the chunks into a single {@link Blob}. + * + * @param stream The stream to consume. + * @returns A promise that resolves with the concatenated chunks as a {@link Blob}. + * + * @deprecated Use {@link ReadableStream.blob} + */ + function readableStreamToBlob(stream: ReadableStream): Promise; + + /** + * Consume all data from a {@link ReadableStream} until it closes or errors. + * + * Concatenate the chunks into a single string. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}. + * + * @param stream The stream to consume. + * @returns A promise that resolves with the concatenated chunks as a {@link String}. + * + * @deprecated Use {@link ReadableStream.text} + */ + function readableStreamToText(stream: ReadableStream): Promise; + + /** + * Consume all data from a {@link ReadableStream} until it closes or errors. + * + * Concatenate the chunks into a single string and parse as JSON. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}. + * + * @param stream The stream to consume. + * @returns A promise that resolves with the concatenated chunks as a {@link String}. + * + * @deprecated Use {@link ReadableStream.json} + */ + function readableStreamToJSON(stream: ReadableStream): Promise; + interface BunMessageEvent { /** * @deprecated @@ -31,6 +115,9 @@ declare module "bun" { */ type Errorlike = ErrorLike; + /** @deprecated This is unused in Bun's types and may be removed in the future */ + type ShellFunction = (input: Uint8Array) => Uint8Array; + interface TLSOptions { /** * File path to a TLS key @@ -59,7 +146,7 @@ declare module "bun" { } /** @deprecated This type is unused in Bun's declarations and may be removed in the future */ - type ReadableIO = ReadableStream | number | undefined; + type ReadableIO = ReadableStream> | number | undefined; } declare namespace NodeJS { diff --git a/node_modules/bun-types/docs/api/fetch.md b/node_modules/bun-types/docs/api/fetch.md index f77d5523..80527b11 100644 --- a/node_modules/bun-types/docs/api/fetch.md +++ b/node_modules/bun-types/docs/api/fetch.md @@ -320,7 +320,6 @@ Bun automatically sets the `Content-Type` header for request bodies when not exp - For `Blob` objects, uses the blob's `type` - For `FormData`, sets appropriate multipart boundary -- For JSON objects, sets `application/json` ## Debugging @@ -337,7 +336,7 @@ This will print the request and response headers to your terminal: ```sh [fetch] > HTTP/1.1 GET http://example.com/ [fetch] > Connection: keep-alive -[fetch] > User-Agent: Bun/1.2.19 +[fetch] > User-Agent: Bun/1.2.21 [fetch] > Accept: */* [fetch] > Host: example.com [fetch] > Accept-Encoding: gzip, deflate, br diff --git a/node_modules/bun-types/docs/api/http.md b/node_modules/bun-types/docs/api/http.md index 7674ca49..84ab3365 100644 --- a/node_modules/bun-types/docs/api/http.md +++ b/node_modules/bun-types/docs/api/http.md @@ -164,6 +164,70 @@ Static responses do not allocate additional memory after initialization. You can Static route responses are cached for the lifetime of the server object. To reload static routes, call `server.reload(options)`. +### File Responses vs Static Responses + +When serving files in routes, there are two distinct behaviors depending on whether you buffer the file content or serve it directly: + +```ts +Bun.serve({ + routes: { + // Static route - content is buffered in memory at startup + "/logo.png": new Response(await Bun.file("./logo.png").bytes()), + + // File route - content is read from filesystem on each request + "/download.zip": new Response(Bun.file("./download.zip")), + }, +}); +``` + +**Static routes** (`new Response(await file.bytes())`) buffer content in memory at startup: + +- **Zero filesystem I/O** during requests - content served entirely from memory +- **ETag support** - Automatically generates and validates ETags for caching +- **If-None-Match** - Returns `304 Not Modified` when client ETag matches +- **No 404 handling** - Missing files cause startup errors, not runtime 404s +- **Memory usage** - Full file content stored in RAM +- **Best for**: Small static assets, API responses, frequently accessed files + +**File routes** (`new Response(Bun.file(path))`) read from filesystem per request: + +- **Filesystem reads** on each request - checks file existence and reads content +- **Built-in 404 handling** - Returns `404 Not Found` if file doesn't exist or becomes inaccessible +- **Last-Modified support** - Uses file modification time for `If-Modified-Since` headers +- **If-Modified-Since** - Returns `304 Not Modified` when file hasn't changed since client's cached version +- **Range request support** - Automatically handles partial content requests with `Content-Range` headers +- **Streaming transfers** - Uses buffered reader with backpressure handling for efficient memory usage +- **Memory efficient** - Only buffers small chunks during transfer, not entire file +- **Best for**: Large files, dynamic content, user uploads, files that change frequently + +### HTTP Caching Behavior + +Both route types implement HTTP caching standards but with different strategies: + +#### Static Routes Caching + +- **ETag generation**: Automatically computes ETag hash from content at startup +- **If-None-Match**: Validates client ETag against server ETag +- **304 responses**: Returns `304 Not Modified` with empty body when ETags match +- **Cache headers**: Inherits any `Cache-Control` headers you provide in the Response +- **Consistency**: ETag remains constant until server restart or route reload + +#### File Routes Caching + +- **Last-Modified**: Uses file's `mtime` for `Last-Modified` header +- **If-Modified-Since**: Compares client date with file modification time +- **304 responses**: Returns `304 Not Modified` when file unchanged since client's cached version +- **Content-Length**: Automatically set based on current file size +- **Dynamic validation**: Checks file modification time on each request + +#### Status Code Handling + +Both route types automatically adjust status codes: + +- **200 → 204**: Empty files (0 bytes) return `204 No Content` instead of `200 OK` +- **200 → 304**: Successful cache validation returns `304 Not Modified` +- **File routes only**: Missing or inaccessible files return `404 Not Found` + ```ts const server = Bun.serve({ static: { diff --git a/node_modules/bun-types/docs/api/spawn.md b/node_modules/bun-types/docs/api/spawn.md index d5c8ac5a..75f157f0 100644 --- a/node_modules/bun-types/docs/api/spawn.md +++ b/node_modules/bun-types/docs/api/spawn.md @@ -140,7 +140,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie ```ts const proc = Bun.spawn(["bun", "--version"]); const text = await proc.stdout.text(); -console.log(text); // => "1.2.19\n" +console.log(text); // => "1.2.21\n" ``` Configure the output stream by passing one of the following values to `stdout/stderr`: diff --git a/node_modules/bun-types/docs/api/sql.md b/node_modules/bun-types/docs/api/sql.md index 87c06e26..6edfd575 100644 --- a/node_modules/bun-types/docs/api/sql.md +++ b/node_modules/bun-types/docs/api/sql.md @@ -1,20 +1,20 @@ -Bun provides native bindings for working with PostgreSQL databases with a modern, Promise-based API. The interface is designed to be simple and performant, using tagged template literals for queries and offering features like connection pooling, transactions, and prepared statements. +Bun provides native bindings for working with SQL databases through a unified Promise-based API that supports both PostgreSQL and SQLite. The interface is designed to be simple and performant, using tagged template literals for queries and offering features like connection pooling, transactions, and prepared statements. ```ts -import { sql } from "bun"; +import { sql, SQL } from "bun"; +// PostgreSQL (default) const users = await sql` SELECT * FROM users WHERE active = ${true} LIMIT ${10} `; -// Select with multiple conditions -const activeUsers = await sql` - SELECT * - FROM users - WHERE active = ${true} - AND age >= ${18} +// With a a SQLite db +const sqlite = new SQL("sqlite://myapp.db"); +const results = await sqlite` + SELECT * FROM users + WHERE active = ${1} `; ``` @@ -44,6 +44,115 @@ const activeUsers = await sql` {% /features %} +## Database Support + +Bun.SQL provides a unified API for multiple database systems: + +### PostgreSQL + +PostgreSQL is used when: + +- The connection string doesn't match SQLite patterns (it's the fallback adapter) +- The connection string explicitly uses `postgres://` or `postgresql://` protocols +- No connection string is provided and environment variables point to PostgreSQL + +```ts +import { sql } from "bun"; +// Uses PostgreSQL if DATABASE_URL is not set or is a PostgreSQL URL +await sql`SELECT ...`; + +import { SQL } from "bun"; +const pg = new SQL("postgres://user:pass@localhost:5432/mydb"); +await pg`SELECT ...`; +``` + +### SQLite + +SQLite support is now built into Bun.SQL, providing the same tagged template literal interface as PostgreSQL: + +```ts +import { SQL } from "bun"; + +// In-memory database +const memory = new SQL(":memory:"); +const memory2 = new SQL("sqlite://:memory:"); + +// File-based database +const db = new SQL("sqlite://myapp.db"); + +// Using options object +const db2 = new SQL({ + adapter: "sqlite", + filename: "./data/app.db", +}); + +// For simple filenames, specify adapter explicitly +const db3 = new SQL("myapp.db", { adapter: "sqlite" }); +``` + +
+SQLite Connection String Formats + +SQLite accepts various URL formats for connection strings: + +```ts +// Standard sqlite:// protocol +new SQL("sqlite://path/to/database.db"); +new SQL("sqlite:path/to/database.db"); // Without slashes + +// file:// protocol (also recognized as SQLite) +new SQL("file://path/to/database.db"); +new SQL("file:path/to/database.db"); + +// Special :memory: database +new SQL(":memory:"); +new SQL("sqlite://:memory:"); +new SQL("file://:memory:"); + +// Relative and absolute paths +new SQL("sqlite://./local.db"); // Relative to current directory +new SQL("sqlite://../parent/db.db"); // Parent directory +new SQL("sqlite:///absolute/path.db"); // Absolute path + +// With query parameters +new SQL("sqlite://data.db?mode=ro"); // Read-only mode +new SQL("sqlite://data.db?mode=rw"); // Read-write mode (no create) +new SQL("sqlite://data.db?mode=rwc"); // Read-write-create mode (default) +``` + +**Note:** Simple filenames without a protocol (like `"myapp.db"`) require explicitly specifying `{ adapter: "sqlite" }` to avoid ambiguity with PostgreSQL. + +
+ +
+SQLite-Specific Options + +SQLite databases support additional configuration options: + +```ts +const db = new SQL({ + adapter: "sqlite", + filename: "app.db", + + // SQLite-specific options + readonly: false, // Open in read-only mode + create: true, // Create database if it doesn't exist + readwrite: true, // Open for reading and writing + + // Additional Bun:sqlite options + strict: true, // Enable strict mode + safeIntegers: false, // Use JavaScript numbers for integers +}); +``` + +Query parameters in the URL are parsed to set these options: + +- `?mode=ro` → `readonly: true` +- `?mode=rw` → `readonly: false, create: false` +- `?mode=rwc` → `readonly: false, create: true` (default) + +
+ ### Inserting data You can pass JavaScript values directly to the SQL template literal and escaping will be handled for you. @@ -251,14 +360,55 @@ await query; ## Database Environment Variables -`sql` connection parameters can be configured using environment variables. The client checks these variables in a specific order of precedence. +`sql` connection parameters can be configured using environment variables. The client checks these variables in a specific order of precedence and automatically detects the database type based on the connection string format. -The following environment variables can be used to define the connection URL: +### Automatic Database Detection + +When using `Bun.sql()` without arguments or `new SQL()` with a connection string, the adapter is automatically detected based on the URL format. SQLite becomes the default adapter in these cases: + +#### SQLite Auto-Detection + +SQLite is automatically selected when the connection string matches these patterns: + +- `:memory:` - In-memory database +- `sqlite://...` - SQLite protocol URLs +- `sqlite:...` - SQLite protocol without slashes +- `file://...` - File protocol URLs +- `file:...` - File protocol without slashes + +```ts +// These all use SQLite automatically (no adapter needed) +const sql1 = new SQL(":memory:"); +const sql2 = new SQL("sqlite://app.db"); +const sql3 = new SQL("file://./database.db"); + +// Works with DATABASE_URL environment variable +DATABASE_URL=":memory:" bun run app.js +DATABASE_URL="sqlite://myapp.db" bun run app.js +DATABASE_URL="file://./data/app.db" bun run app.js +``` + +#### PostgreSQL Auto-Detection + +PostgreSQL is the default for all other connection strings: + +```bash +# PostgreSQL is detected for these patterns +DATABASE_URL="postgres://user:pass@localhost:5432/mydb" bun run app.js +DATABASE_URL="postgresql://user:pass@localhost:5432/mydb" bun run app.js + +# Or any URL that doesn't match SQLite patterns +DATABASE_URL="localhost:5432/mydb" bun run app.js +``` + +### PostgreSQL Environment Variables + +The following environment variables can be used to define the PostgreSQL connection: | Environment Variable | Description | | --------------------------- | ------------------------------------------ | | `POSTGRES_URL` | Primary connection URL for PostgreSQL | -| `DATABASE_URL` | Alternative connection URL | +| `DATABASE_URL` | Alternative connection URL (auto-detected) | | `PGURL` | Alternative connection URL | | `PG_URL` | Alternative connection URL | | `TLS_POSTGRES_DATABASE_URL` | SSL/TLS-enabled connection URL | @@ -274,6 +424,19 @@ If no connection URL is provided, the system checks for the following individual | `PGPASSWORD` | - | (empty) | Database password | | `PGDATABASE` | - | username | Database name | +### SQLite Environment Variables + +SQLite connections can be configured via `DATABASE_URL` when it contains a SQLite-compatible URL: + +```bash +# These are all recognized as SQLite +DATABASE_URL=":memory:" +DATABASE_URL="sqlite://./app.db" +DATABASE_URL="file:///absolute/path/to/db.sqlite" +``` + +**Note:** PostgreSQL-specific environment variables (`POSTGRES_URL`, `PGHOST`, etc.) are ignored when using SQLite. + ## Runtime Preconnection Bun can preconnect to PostgreSQL at startup to improve performance by establishing database connections before your application code runs. This is useful for reducing connection latency on the first database query. @@ -293,16 +456,18 @@ The `--sql-preconnect` flag will automatically establish a PostgreSQL connection ## Connection Options -You can configure your database connection manually by passing options to the SQL constructor: +You can configure your database connection manually by passing options to the SQL constructor. Options vary depending on the database adapter: + +### PostgreSQL Options ```ts import { SQL } from "bun"; const db = new SQL({ - // Required + // Connection details (adapter is auto-detected as PostgreSQL) url: "postgres://user:pass@localhost:5432/dbname", - // Optional configuration + // Alternative connection parameters hostname: "localhost", port: 5432, database: "myapp", @@ -330,14 +495,53 @@ const db = new SQL({ // Callbacks onconnect: client => { - console.log("Connected to database"); + console.log("Connected to PostgreSQL"); }, onclose: client => { - console.log("Connection closed"); + console.log("PostgreSQL connection closed"); }, }); ``` +### SQLite Options + +```ts +import { SQL } from "bun"; + +const db = new SQL({ + // Required for SQLite + adapter: "sqlite", + filename: "./data/app.db", // or ":memory:" for in-memory database + + // SQLite-specific access modes + readonly: false, // Open in read-only mode + create: true, // Create database if it doesn't exist + readwrite: true, // Allow read and write operations + + // SQLite data handling + strict: true, // Enable strict mode for better type safety + safeIntegers: false, // Use BigInt for integers exceeding JS number range + + // Callbacks + onconnect: client => { + console.log("SQLite database opened"); + }, + onclose: client => { + console.log("SQLite database closed"); + }, +}); +``` + +
+SQLite Connection Notes + +- **Connection Pooling**: SQLite doesn't use connection pooling as it's a file-based database. Each `SQL` instance represents a single connection. +- **Transactions**: SQLite supports nested transactions through savepoints, similar to PostgreSQL. +- **Concurrent Access**: SQLite handles concurrent access through file locking. Use WAL mode for better concurrency. +- **Memory Databases**: Using `:memory:` creates a temporary database that exists only for the connection lifetime. + +
+ ## Dynamic passwords When clients need to use alternative authentication schemes such as access tokens or connections to databases with rotating passwords, provide either a synchronous or asynchronous function that will resolve the dynamic password value at connection time. @@ -353,11 +557,66 @@ const sql = new SQL(url, { }); ``` +## SQLite-Specific Features + +### Query Execution + +SQLite executes queries synchronously, unlike PostgreSQL which uses asynchronous I/O. However, the API remains consistent using Promises: + +```ts +const sqlite = new SQL("sqlite://app.db"); + +// Works the same as PostgreSQL, but executes synchronously under the hood +const users = await sqlite`SELECT * FROM users`; + +// Parameters work identically +const user = await sqlite`SELECT * FROM users WHERE id = ${userId}`; +``` + +### SQLite Pragmas + +You can use PRAGMA statements to configure SQLite behavior: + +```ts +const sqlite = new SQL("sqlite://app.db"); + +// Enable foreign keys +await sqlite`PRAGMA foreign_keys = ON`; + +// Set journal mode to WAL for better concurrency +await sqlite`PRAGMA journal_mode = WAL`; + +// Check integrity +const integrity = await sqlite`PRAGMA integrity_check`; +``` + +### Data Type Differences + +SQLite has a more flexible type system than PostgreSQL: + +```ts +// SQLite stores data in 5 storage classes: NULL, INTEGER, REAL, TEXT, BLOB +const sqlite = new SQL("sqlite://app.db"); + +// SQLite is more lenient with types +await sqlite` + CREATE TABLE flexible ( + id INTEGER PRIMARY KEY, + data TEXT, -- Can store numbers as strings + value NUMERIC, -- Can store integers, reals, or text + blob BLOB -- Binary data + ) +`; + +// JavaScript values are automatically converted +await sqlite`INSERT INTO flexible VALUES (${1}, ${"text"}, ${123.45}, ${Buffer.from("binary")})`; +``` + ## Transactions -To start a new transaction, use `sql.begin`. This method reserves a dedicated connection for the duration of the transaction and provides a scoped `sql` instance to use within the callback function. Once the callback completes, `sql.begin` resolves with the return value of the callback. +To start a new transaction, use `sql.begin`. This method works for both PostgreSQL and SQLite. For PostgreSQL, it reserves a dedicated connection from the pool. For SQLite, it begins a transaction on the single connection. -The `BEGIN` command is sent automatically, including any optional configurations you specify. If an error occurs during the transaction, a `ROLLBACK` is triggered to release the reserved connection and ensure the process continues smoothly. +The `BEGIN` command is sent automatically, including any optional configurations you specify. If an error occurs during the transaction, a `ROLLBACK` is triggered to ensure the process continues smoothly. ### Basic Transactions @@ -552,9 +811,34 @@ Note that disabling prepared statements may impact performance for queries that ## Error Handling -The client provides typed errors for different failure scenarios: +The client provides typed errors for different failure scenarios. Errors are database-specific and extend from base error classes: -### Connection Errors +### Error Classes + +```ts +import { SQL } from "bun"; + +try { + await sql`SELECT * FROM users`; +} catch (error) { + if (error instanceof SQL.PostgresError) { + // PostgreSQL-specific error + console.log(error.code); // PostgreSQL error code + console.log(error.detail); // Detailed error message + console.log(error.hint); // Helpful hint from PostgreSQL + } else if (error instanceof SQL.SQLiteError) { + // SQLite-specific error + console.log(error.code); // SQLite error code (e.g., "SQLITE_CONSTRAINT") + console.log(error.errno); // SQLite error number + console.log(error.byteOffset); // Byte offset in SQL statement (if available) + } else if (error instanceof SQL.SQLError) { + // Generic SQL error (base class) + console.log(error.message); + } +} +``` + +### PostgreSQL Connection Errors | Connection Errors | Description | | --------------------------------- | ---------------------------------------------------- | @@ -619,6 +903,50 @@ The client provides typed errors for different failure scenarios: | `ERR_POSTGRES_UNSAFE_TRANSACTION` | Unsafe transaction operation detected | | `ERR_POSTGRES_INVALID_TRANSACTION_STATE` | Invalid transaction state | +### SQLite-Specific Errors + +SQLite errors provide error codes and numbers that correspond to SQLite's standard error codes: + +
+Common SQLite Error Codes + +| Error Code | errno | Description | +| ------------------- | ----- | ---------------------------------------------------- | +| `SQLITE_CONSTRAINT` | 19 | Constraint violation (UNIQUE, CHECK, NOT NULL, etc.) | +| `SQLITE_BUSY` | 5 | Database is locked | +| `SQLITE_LOCKED` | 6 | Table in the database is locked | +| `SQLITE_READONLY` | 8 | Attempt to write to a readonly database | +| `SQLITE_IOERR` | 10 | Disk I/O error | +| `SQLITE_CORRUPT` | 11 | Database disk image is malformed | +| `SQLITE_FULL` | 13 | Database or disk is full | +| `SQLITE_CANTOPEN` | 14 | Unable to open database file | +| `SQLITE_PROTOCOL` | 15 | Database lock protocol error | +| `SQLITE_SCHEMA` | 17 | Database schema has changed | +| `SQLITE_TOOBIG` | 18 | String or BLOB exceeds size limit | +| `SQLITE_MISMATCH` | 20 | Data type mismatch | +| `SQLITE_MISUSE` | 21 | Library used incorrectly | +| `SQLITE_AUTH` | 23 | Authorization denied | + +Example error handling: + +```ts +const sqlite = new SQL("sqlite://app.db"); + +try { + await sqlite`INSERT INTO users (id, name) VALUES (1, 'Alice')`; + await sqlite`INSERT INTO users (id, name) VALUES (1, 'Bob')`; // Duplicate ID +} catch (error) { + if (error instanceof SQL.SQLiteError) { + if (error.code === "SQLITE_CONSTRAINT") { + console.log("Constraint violation:", error.message); + // Handle unique constraint violation + } + } +} +``` + +
+ ## Numbers and BigInt Bun's SQL client includes special handling for large numbers that exceed the range of a 53-bit integer. Here's how it works: @@ -652,7 +980,6 @@ There's still some things we haven't finished yet. - Connection preloading via `--db-preconnect` Bun CLI flag - MySQL support: [we're working on it](https://github.com/oven-sh/bun/pull/15274) -- SQLite support: planned, but not started. Ideally, we implement it natively instead of wrapping `bun:sqlite`. - Column name transforms (e.g. `snake_case` to `camelCase`). This is mostly blocked on a unicode-aware implementation of changing the case in C++ using WebKit's `WTF::String`. - Column type transforms diff --git a/node_modules/bun-types/docs/api/streams.md b/node_modules/bun-types/docs/api/streams.md index a239ed69..2491fa42 100644 --- a/node_modules/bun-types/docs/api/streams.md +++ b/node_modules/bun-types/docs/api/streams.md @@ -208,8 +208,8 @@ export class ArrayBufferSink { * * This API might change later to separate Uint8ArraySink and ArrayBufferSink */ - flush(): number | Uint8Array | ArrayBuffer; - end(): ArrayBuffer | Uint8Array; + flush(): number | Uint8Array | ArrayBuffer; + end(): ArrayBuffer | Uint8Array; } ``` diff --git a/node_modules/bun-types/docs/api/utils.md b/node_modules/bun-types/docs/api/utils.md index 0201643c..bca5caf5 100644 --- a/node_modules/bun-types/docs/api/utils.md +++ b/node_modules/bun-types/docs/api/utils.md @@ -772,6 +772,65 @@ console.log(obj); // => { foo: "bar" } Internally, [`structuredClone`](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) and [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) serialize and deserialize the same way. This exposes the underlying [HTML Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) to JavaScript as an ArrayBuffer. +## `Bun.stripANSI()` ~6-57x faster `strip-ansi` alternative + +`Bun.stripANSI(text: string): string` + +Strip ANSI escape codes from a string. This is useful for removing colors and formatting from terminal output. + +```ts +const coloredText = "\u001b[31mHello\u001b[0m \u001b[32mWorld\u001b[0m"; +const plainText = Bun.stripANSI(coloredText); +console.log(plainText); // => "Hello World" + +// Works with various ANSI codes +const formatted = "\u001b[1m\u001b[4mBold and underlined\u001b[0m"; +console.log(Bun.stripANSI(formatted)); // => "Bold and underlined" +``` + +`Bun.stripANSI` is significantly faster than the popular [`strip-ansi`](https://www.npmjs.com/package/strip-ansi) npm package: + +```js +> bun bench/snippets/strip-ansi.mjs +cpu: Apple M3 Max +runtime: bun 1.2.21 (arm64-darwin) + +benchmark avg (min … max) p75 / p99 +------------------------------------------------------- ---------- +Bun.stripANSI 11 chars no-ansi 8.13 ns/iter 8.27 ns + (7.45 ns … 33.59 ns) 10.29 ns + +Bun.stripANSI 13 chars ansi 51.68 ns/iter 52.51 ns + (46.16 ns … 113.71 ns) 57.71 ns + +Bun.stripANSI 16,384 chars long-no-ansi 298.39 ns/iter 305.44 ns + (281.50 ns … 331.65 ns) 320.70 ns + +Bun.stripANSI 212,992 chars long-ansi 227.65 µs/iter 234.50 µs + (216.46 µs … 401.92 µs) 262.25 µs +``` + +```js +> node bench/snippets/strip-ansi.mjs +cpu: Apple M3 Max +runtime: node 24.6.0 (arm64-darwin) + +benchmark avg (min … max) p75 / p99 +-------------------------------------------------------- --------- +npm/strip-ansi 11 chars no-ansi 466.79 ns/iter 468.67 ns + (454.08 ns … 570.67 ns) 543.67 ns + +npm/strip-ansi 13 chars ansi 546.77 ns/iter 550.23 ns + (532.74 ns … 651.08 ns) 590.35 ns + +npm/strip-ansi 16,384 chars long-no-ansi 4.85 µs/iter 4.89 µs + (4.71 µs … 5.00 µs) 4.98 µs + +npm/strip-ansi 212,992 chars long-ansi 1.36 ms/iter 1.38 ms + (1.27 ms … 1.73 ms) 1.49 ms + +``` + ## `estimateShallowMemoryUsageOf` in `bun:jsc` The `estimateShallowMemoryUsageOf` function returns a best-effort estimate of the memory usage of an object in bytes, excluding the memory usage of properties or other objects it references. For accurate per-object memory usage, use `Bun.generateHeapSnapshot`. diff --git a/node_modules/bun-types/docs/api/workers.md b/node_modules/bun-types/docs/api/workers.md index 1f0eae3e..b11902ab 100644 --- a/node_modules/bun-types/docs/api/workers.md +++ b/node_modules/bun-types/docs/api/workers.md @@ -1,5 +1,5 @@ {% callout %} -**🚧** — The `Worker` API is still experimental and should not be considered ready for production. +**🚧** — The `Worker` API is still experimental (particularly for terminating workers). We are actively working on improving this. {% /callout %} [`Worker`](https://developer.mozilla.org/en-US/docs/Web/API/Worker) lets you start and communicate with a new JavaScript instance running on a separate thread while sharing I/O resources with the main thread. diff --git a/node_modules/bun-types/docs/bundler/executables.md b/node_modules/bun-types/docs/bundler/executables.md index 76d70195..8b331680 100644 --- a/node_modules/bun-types/docs/bundler/executables.md +++ b/node_modules/bun-types/docs/bundler/executables.md @@ -408,16 +408,119 @@ $ bun build --compile --asset-naming="[name].[ext]" ./index.ts To trim down the size of the executable a little, pass `--minify` to `bun build --compile`. This uses Bun's minifier to reduce the code size. Overall though, Bun's binary is still way too big and we need to make it smaller. +## Using Bun.build() API + +You can also generate standalone executables using the `Bun.build()` JavaScript API. This is useful when you need programmatic control over the build process. + +### Basic usage + +```js +await Bun.build({ + entrypoints: ["./app.ts"], + outdir: "./dist", + compile: { + target: "bun-windows-x64", + outfile: "myapp.exe", + }, +}); +``` + +### Windows metadata with Bun.build() + +When targeting Windows, you can specify metadata through the `windows` object: + +```js +await Bun.build({ + entrypoints: ["./app.ts"], + outdir: "./dist", + compile: { + target: "bun-windows-x64", + outfile: "myapp.exe", + windows: { + title: "My Application", + publisher: "My Company Inc", + version: "1.2.3.4", + description: "A powerful application built with Bun", + copyright: "© 2024 My Company Inc", + hideConsole: false, // Set to true for GUI applications + icon: "./icon.ico", // Path to icon file + }, + }, +}); +``` + +### Cross-compilation with Bun.build() + +You can cross-compile for different platforms: + +```js +// Build for multiple platforms +const platforms = [ + { target: "bun-windows-x64", outfile: "app-windows.exe" }, + { target: "bun-linux-x64", outfile: "app-linux" }, + { target: "bun-darwin-arm64", outfile: "app-macos" }, +]; + +for (const platform of platforms) { + await Bun.build({ + entrypoints: ["./app.ts"], + outdir: "./dist", + compile: platform, + }); +} +``` + ## Windows-specific flags -When compiling a standalone executable on Windows, there are two platform-specific options that can be used to customize metadata on the generated `.exe` file: +When compiling a standalone executable for Windows, there are several platform-specific options that can be used to customize the generated `.exe` file: -- `--windows-icon=path/to/icon.ico` to customize the executable file icon. -- `--windows-hide-console` to disable the background terminal, which can be used for applications that do not need a TTY. +### Visual customization + +- `--windows-icon=path/to/icon.ico` - Set the executable file icon +- `--windows-hide-console` - Disable the background terminal window (useful for GUI applications) + +### Metadata customization + +You can embed version information and other metadata into your Windows executable: + +- `--windows-title ` - Set the product name (appears in file properties) +- `--windows-publisher ` - Set the company name +- `--windows-version ` - Set the version number (e.g. "1.2.3.4") +- `--windows-description ` - Set the file description +- `--windows-copyright ` - Set the copyright information + +#### Example with all metadata flags: + +```sh +bun build --compile ./app.ts \ + --outfile myapp.exe \ + --windows-title "My Application" \ + --windows-publisher "My Company Inc" \ + --windows-version "1.2.3.4" \ + --windows-description "A powerful application built with Bun" \ + --windows-copyright "© 2024 My Company Inc" +``` + +This metadata will be visible in Windows Explorer when viewing the file properties: + +1. Right-click the executable in Windows Explorer +2. Select "Properties" +3. Go to the "Details" tab + +#### Version string format + +The `--windows-version` flag accepts version strings in the following formats: + +- `"1"` - Will be normalized to "1.0.0.0" +- `"1.2"` - Will be normalized to "1.2.0.0" +- `"1.2.3"` - Will be normalized to "1.2.3.0" +- `"1.2.3.4"` - Full version format + +Each version component must be a number between 0 and 65535. {% callout %} -These flags currently cannot be used when cross-compiling because they depend on Windows APIs. +These flags currently cannot be used when cross-compiling because they depend on Windows APIs. They are only available when building on Windows itself. {% /callout %} diff --git a/node_modules/bun-types/docs/bundler/index.md b/node_modules/bun-types/docs/bundler/index.md index 4a8b62ec..a10ce40b 100644 --- a/node_modules/bun-types/docs/bundler/index.md +++ b/node_modules/bun-types/docs/bundler/index.md @@ -1,4 +1,4 @@ -Bun's fast native bundler is now in beta. It can be used via the `bun build` CLI command or the `Bun.build()` JavaScript API. +Bun's fast native bundler can be used via the `bun build` CLI command or the `Bun.build()` JavaScript API. {% codetabs group="a" %} diff --git a/node_modules/bun-types/docs/bundler/loaders.md b/node_modules/bun-types/docs/bundler/loaders.md index fbf29d34..bbd58bcc 100644 --- a/node_modules/bun-types/docs/bundler/loaders.md +++ b/node_modules/bun-types/docs/bundler/loaders.md @@ -1,6 +1,6 @@ The Bun bundler implements a set of default loaders out of the box. As a rule of thumb, the bundler and the runtime both support the same set of file types out of the box. -`.js` `.cjs` `.mjs` `.mts` `.cts` `.ts` `.tsx` `.jsx` `.toml` `.json` `.txt` `.wasm` `.node` `.html` +`.js` `.cjs` `.mjs` `.mts` `.cts` `.ts` `.tsx` `.jsx` `.toml` `.json` `.yaml` `.yml` `.txt` `.wasm` `.node` `.html` Bun uses the file extension to determine which built-in _loader_ should be used to parse the file. Every loader has a name, such as `js`, `tsx`, or `json`. These names are used when building [plugins](https://bun.com/docs/bundler/plugins) that extend Bun with custom loaders. @@ -121,6 +121,55 @@ export default { {% /codetabs %} +### `yaml` + +**YAML loader**. Default for `.yaml` and `.yml`. + +YAML files can be directly imported. Bun will parse them with its fast native YAML parser. + +```ts +import config from "./config.yaml"; +config.database.host; // => "localhost" + +// via import attribute: +// import myCustomYAML from './my.config' with {type: "yaml"}; +``` + +During bundling, the parsed YAML is inlined into the bundle as a JavaScript object. + +```ts +var config = { + database: { + host: "localhost", + port: 5432, + }, + // ...other fields +}; +config.database.host; +``` + +If a `.yaml` or `.yml` file is passed as an entrypoint, it will be converted to a `.js` module that `export default`s the parsed object. + +{% codetabs %} + +```yaml#Input +name: John Doe +age: 35 +email: johndoe@example.com +``` + +```js#Output +export default { + name: "John Doe", + age: 35, + email: "johndoe@example.com" +} +``` + +{% /codetabs %} + +For more details on YAML support including the runtime API `Bun.YAML.parse()`, see the [YAML API documentation](/docs/api/yaml). + ### `text` **Text loader**. Default for `.txt`. diff --git a/node_modules/bun-types/docs/cli/install.md b/node_modules/bun-types/docs/cli/install.md index c013ce7f..06a17949 100644 --- a/node_modules/bun-types/docs/cli/install.md +++ b/node_modules/bun-types/docs/cli/install.md @@ -183,6 +183,30 @@ Bun supports installing dependencies from Git, GitHub, and local or remotely-hos } ``` +## Installation strategies + +Bun supports two package installation strategies that determine how dependencies are organized in `node_modules`: + +### Hoisted installs (default for single projects) + +The traditional npm/Yarn approach that flattens dependencies into a shared `node_modules` directory: + +```bash +$ bun install --linker hoisted +``` + +### Isolated installs + +A pnpm-like approach that creates strict dependency isolation to prevent phantom dependencies: + +```bash +$ bun install --linker isolated +``` + +Isolated installs create a central package store in `node_modules/.bun/` with symlinks in the top-level `node_modules`. This ensures packages can only access their declared dependencies. + +For complete documentation on isolated installs, refer to [Package manager > Isolated installs](https://bun.com/docs/install/isolated). + ## Configuration The default behavior of `bun install` can be configured in `bunfig.toml`. The default values are shown below. @@ -213,11 +237,15 @@ dryRun = false # equivalent to `--concurrent-scripts` flag concurrentScripts = 16 # (cpu count or GOMAXPROCS) x2 + +# installation strategy: "hoisted" or "isolated" +# default: "hoisted" +linker = "hoisted" ``` ## CI/CD -Looking to speed up your CI? Use the official [`oven-sh/setup-bun`](https://github.com/oven-sh/setup-bun) action to install `bun` in a GitHub Actions pipeline. +Use the official [`oven-sh/setup-bun`](https://github.com/oven-sh/setup-bun) action to install `bun` in a GitHub Actions pipeline: ```yaml#.github/workflows/release.yml name: bun-types @@ -236,4 +264,31 @@ jobs: run: bun run build ``` +For CI/CD environments that want to enforce reproducible builds, use `bun ci` to fail the build if the package.json is out of sync with the lockfile: + +```bash +$ bun ci +``` + +This is equivalent to `bun install --frozen-lockfile`. It installs exact versions from `bun.lock` and fails if `package.json` doesn't match the lockfile. To use `bun ci` or `bun install --frozen-lockfile`, you must commit `bun.lock` to version control. + +And instead of running `bun install`, run `bun ci`. + +```yaml#.github/workflows/release.yml +name: bun-types +jobs: + build: + name: build-app + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Install bun + uses: oven-sh/setup-bun@v2 + - name: Install dependencies + run: bun ci + - name: Build app + run: bun run build +``` + {% bunCLIUsage command="install" /%} diff --git a/node_modules/bun-types/docs/cli/pm.md b/node_modules/bun-types/docs/cli/pm.md index ca3971d4..10dbf849 100644 --- a/node_modules/bun-types/docs/cli/pm.md +++ b/node_modules/bun-types/docs/cli/pm.md @@ -213,7 +213,7 @@ To display current package version and help: ```bash $ bun pm version -bun pm version v1.2.19 (ca7428e9) +bun pm version v1.2.21 (ca7428e9) Current package version: v1.0.0 Increment: diff --git a/node_modules/bun-types/docs/cli/publish.md b/node_modules/bun-types/docs/cli/publish.md index b38d9f14..144d9ff6 100644 --- a/node_modules/bun-types/docs/cli/publish.md +++ b/node_modules/bun-types/docs/cli/publish.md @@ -7,7 +7,7 @@ Use `bun publish` to publish a package to the npm registry. $ bun publish ## Output -bun publish v1.2.19 (ca7428e9) +bun publish v1.2.21 (ca7428e9) packed 203B package.json packed 224B README.md diff --git a/node_modules/bun-types/docs/cli/test.md b/node_modules/bun-types/docs/cli/test.md index 1e92dedb..73ba196a 100644 --- a/node_modules/bun-types/docs/cli/test.md +++ b/node_modules/bun-types/docs/cli/test.md @@ -158,7 +158,7 @@ See [Test > Lifecycle](https://bun.com/docs/test/lifecycle) for complete documen ## Mocks -Create mock functions with the `mock` function. Mocks are automatically reset between tests. +Create mock functions with the `mock` function. ```ts import { test, expect, mock } from "bun:test"; diff --git a/node_modules/bun-types/docs/cli/update.md b/node_modules/bun-types/docs/cli/update.md index 671e6c6d..cdb1a222 100644 --- a/node_modules/bun-types/docs/cli/update.md +++ b/node_modules/bun-types/docs/cli/update.md @@ -10,6 +10,86 @@ To update a specific dependency to the latest version: $ bun update [package] ``` +## `--interactive` + +For a more controlled update experience, use the `--interactive` flag to select which packages to update: + +```sh +$ bun update --interactive +$ bun update -i +``` + +This launches an interactive terminal interface that shows all outdated packages with their current and target versions. You can then select which packages to update. + +### Interactive Interface + +The interface displays packages grouped by dependency type: + +``` +? Select packages to update - Space to toggle, Enter to confirm, a to select all, n to select none, i to invert, l to toggle latest + + dependencies Current Target Latest + □ react 17.0.2 18.2.0 18.3.1 + □ lodash 4.17.20 4.17.21 4.17.21 + + devDependencies Current Target Latest + □ typescript 4.8.0 5.0.0 5.3.3 + □ @types/node 16.11.7 18.0.0 20.11.5 + + optionalDependencies Current Target Latest + □ some-optional-package 1.0.0 1.1.0 1.2.0 +``` + +**Sections:** + +- Packages are grouped under section headers: `dependencies`, `devDependencies`, `peerDependencies`, `optionalDependencies` +- Each section shows column headers aligned with the package data + +**Columns:** + +- **Package**: Package name (may have suffix like ` dev`, ` peer`, ` optional` for clarity) +- **Current**: Currently installed version +- **Target**: Version that would be installed (respects semver constraints) +- **Latest**: Latest available version + +### Keyboard Controls + +**Selection:** + +- **Space**: Toggle package selection +- **Enter**: Confirm selections and update +- **a/A**: Select all packages +- **n/N**: Select none +- **i/I**: Invert selection + +**Navigation:** + +- **↑/↓ Arrow keys** or **j/k**: Move cursor +- **l/L**: Toggle between target and latest version for current package + +**Exit:** + +- **Ctrl+C** or **Ctrl+D**: Cancel without updating + +### Visual Indicators + +- **☑** Selected packages (will be updated) +- **□** Unselected packages +- **>** Current cursor position +- **Colors**: Red (major), yellow (minor), green (patch) version changes +- **Underlined**: Currently selected update target + +### Package Grouping + +Packages are organized in sections by dependency type: + +- **dependencies** - Regular runtime dependencies +- **devDependencies** - Development dependencies +- **peerDependencies** - Peer dependencies +- **optionalDependencies** - Optional dependencies + +Within each section, individual packages may have additional suffixes (` dev`, ` peer`, ` optional`) for extra clarity. + ## `--latest` By default, `bun update` will update to the latest version of a dependency that satisfies the version range specified in your `package.json`. @@ -20,6 +100,8 @@ To update to the latest version, regardless of if it's compatible with the curre $ bun update --latest ``` +In interactive mode, you can toggle individual packages between their target version (respecting semver) and latest version using the **l** key. + For example, with the following `package.json`: ```json diff --git a/node_modules/bun-types/docs/guides/ecosystem/nuxt.md b/node_modules/bun-types/docs/guides/ecosystem/nuxt.md index f0de081a..2d69d781 100644 --- a/node_modules/bun-types/docs/guides/ecosystem/nuxt.md +++ b/node_modules/bun-types/docs/guides/ecosystem/nuxt.md @@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app ✔ Which package manager would you like to use? bun ◐ Installing dependencies... -bun install v1.2.19 (16b4bf34) +bun install v1.2.21 (16b4bf34) + @nuxt/devtools@0.8.2 + nuxt@3.7.0 785 packages installed [2.67s] diff --git a/node_modules/bun-types/docs/guides/install/add-peer.md b/node_modules/bun-types/docs/guides/install/add-peer.md index 091b7452..e098f933 100644 --- a/node_modules/bun-types/docs/guides/install/add-peer.md +++ b/node_modules/bun-types/docs/guides/install/add-peer.md @@ -15,7 +15,7 @@ This will add the package to `peerDependencies` in `package.json`. ```json-diff { "peerDependencies": { -+ "@types/bun": "^1.2.19" ++ "@types/bun": "^1.2.21" } } ``` @@ -27,7 +27,7 @@ Running `bun install` will install peer dependencies by default, unless marked o ```json-diff { "peerDependencies": { - "@types/bun": "^1.2.19" + "@types/bun": "^1.2.21" }, "peerDependenciesMeta": { + "@types/bun": { diff --git a/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.md b/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.md index 157264cd..2295c956 100644 --- a/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.md +++ b/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.md @@ -97,7 +97,7 @@ $ bun update $ bun update @types/bun --latest # Update a dependency to a specific version -$ bun update @types/bun@1.2.19 +$ bun update @types/bun@1.2.21 # Update all dependencies to the latest versions $ bun update --latest diff --git a/node_modules/bun-types/docs/guides/test/run-tests.md b/node_modules/bun-types/docs/guides/test/run-tests.md index 970bf01e..397b42db 100644 --- a/node_modules/bun-types/docs/guides/test/run-tests.md +++ b/node_modules/bun-types/docs/guides/test/run-tests.md @@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are ```sh $ bun test -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test.test.js: ✓ add [0.87ms] @@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru ```sh $ bun test test3 -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test3.test.js: ✓ add [1.40ms] @@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test ```sh $ bun test -t add -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test.test.js: ✓ add [1.79ms] diff --git a/node_modules/bun-types/docs/guides/test/snapshot.md b/node_modules/bun-types/docs/guides/test/snapshot.md index 55b7bb6f..90b339ea 100644 --- a/node_modules/bun-types/docs/guides/test/snapshot.md +++ b/node_modules/bun-types/docs/guides/test/snapshot.md @@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e ```sh $ bun test test/snap -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test/snap.test.ts: ✓ snapshot [1.48ms] @@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an ```sh $ bun test -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test/snap.test.ts: ✓ snapshot [1.05ms] @@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag. ```sh $ bun test --update-snapshots -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test/snap.test.ts: ✓ snapshot [0.86ms] diff --git a/node_modules/bun-types/docs/guides/test/update-snapshots.md b/node_modules/bun-types/docs/guides/test/update-snapshots.md index e43d7e10..3a58a6bc 100644 --- a/node_modules/bun-types/docs/guides/test/update-snapshots.md +++ b/node_modules/bun-types/docs/guides/test/update-snapshots.md @@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag. ```sh $ bun test --update-snapshots -bun test v1.2.19 (9c68abdb) +bun test v1.2.21 (9c68abdb) test/snap.test.ts: ✓ snapshot [0.86ms] diff --git a/node_modules/bun-types/docs/guides/util/detect-bun.md b/node_modules/bun-types/docs/guides/util/detect-bun.md index 3d273f48..eba2548e 100644 --- a/node_modules/bun-types/docs/guides/util/detect-bun.md +++ b/node_modules/bun-types/docs/guides/util/detect-bun.md @@ -14,7 +14,7 @@ if (typeof Bun !== "undefined") { --- -In TypeScript environments, the previous approach will result in a type error unless `bun-types` is globally installed. To avoid this, you can check `process.versions` instead. +In TypeScript environments, the previous approach will result in a type error unless `@types/bun` is installed. To avoid this, you can check `process.versions` instead. ```ts if (process.versions.bun) { diff --git a/node_modules/bun-types/docs/guides/util/version.md b/node_modules/bun-types/docs/guides/util/version.md index 7af1648e..41fdb9d2 100644 --- a/node_modules/bun-types/docs/guides/util/version.md +++ b/node_modules/bun-types/docs/guides/util/version.md @@ -5,7 +5,7 @@ name: Get the current Bun version Get the current version of Bun in a semver format. ```ts#index.ts -Bun.version; // => "1.2.19" +Bun.version; // => "1.2.21" ``` --- diff --git a/node_modules/bun-types/docs/install/index.md b/node_modules/bun-types/docs/install/index.md index 9c2474a8..fd9248f8 100644 --- a/node_modules/bun-types/docs/install/index.md +++ b/node_modules/bun-types/docs/install/index.md @@ -81,6 +81,14 @@ $ bun install --verbose # debug logging $ bun install --silent # no logging ``` +To use isolated installs instead of the default hoisted strategy: + +```bash +$ bun install --linker isolated +``` + +Isolated installs create strict dependency isolation similar to pnpm, preventing phantom dependencies and ensuring more deterministic builds. For complete documentation, see [Isolated installs](https://bun.com/docs/install/isolated). + {% details summary="Configuring behavior" %} The default behavior of `bun install` can be configured in `bunfig.toml`: @@ -110,6 +118,10 @@ dryRun = false # equivalent to `--concurrent-scripts` flag concurrentScripts = 16 # (cpu count or GOMAXPROCS) x2 + +# installation strategy: "hoisted" or "isolated" +# default: "hoisted" +linker = "hoisted" ``` {% /details %} diff --git a/node_modules/bun-types/docs/installation.md b/node_modules/bun-types/docs/installation.md index 136120a5..d22e08c4 100644 --- a/node_modules/bun-types/docs/installation.md +++ b/node_modules/bun-types/docs/installation.md @@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us ```bash#macOS/Linux_(curl) $ curl -fsSL https://bun.com/install | bash # for macOS, Linux, and WSL # to install a specific version -$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.19" +$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.21" ``` ```bash#npm @@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin ### Installing a specific version of Bun on Linux/Mac -To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.19`. +To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.21`. ```sh -$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.19" +$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.21" ``` ### Installing a specific version of Bun on Windows @@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num ```sh # PowerShell: -$ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.19" +$ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.21" ``` ## Downloading Bun binaries directly diff --git a/node_modules/bun-types/docs/project/bindgen.md b/node_modules/bun-types/docs/project/bindgen.md index add454a8..810d3c63 100644 --- a/node_modules/bun-types/docs/project/bindgen.md +++ b/node_modules/bun-types/docs/project/bindgen.md @@ -20,7 +20,7 @@ this one: Given a file implementing a simple function, such as `add` ```zig#src/bun.js/math.zig -pub fn add(global: *JSC.JSGlobalObject, a: i32, b: i32) !i32 { +pub fn add(global: *jsc.JSGlobalObject, a: i32, b: i32) !i32 { return std.math.add(i32, a, b) catch { // Binding functions can return `error.OutOfMemory` and `error.JSError`. // Others like `error.Overflow` from `std.math.add` must be converted. @@ -33,7 +33,7 @@ const gen = bun.gen.math; // "math" being this file's basename const std = @import("std"); const bun = @import("bun"); -const JSC = bun.JSC; +const jsc = bun.jsc; ``` Then describe the API schema using a `.bind.ts` function. The binding file goes next to the Zig file. diff --git a/node_modules/bun-types/docs/project/contributing.md b/node_modules/bun-types/docs/project/contributing.md index 2d13dfc9..a62d3257 100644 --- a/node_modules/bun-types/docs/project/contributing.md +++ b/node_modules/bun-types/docs/project/contributing.md @@ -160,6 +160,7 @@ 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/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. diff --git a/node_modules/bun-types/docs/runtime/bun-apis.md b/node_modules/bun-types/docs/runtime/bun-apis.md index a16127fe..44c5d01c 100644 --- a/node_modules/bun-types/docs/runtime/bun-apis.md +++ b/node_modules/bun-types/docs/runtime/bun-apis.md @@ -195,12 +195,12 @@ Click the link in the right column to jump to the associated documentation. --- - Parsing & Formatting -- [`Bun.semver`](https://bun.com/docs/api/semver), `Bun.TOML.parse`, [`Bun.color`](https://bun.com/docs/api/color) +- [`Bun.semver`](https://bun.com/docs/api/semver), `Bun.TOML.parse`, [`Bun.YAML.parse`](https://bun.com/docs/api/yaml), [`Bun.color`](https://bun.com/docs/api/color) --- - Low-level / Internals -- `Bun.mmap`, `Bun.gc`, `Bun.generateHeapSnapshot`, [`bun:jsc`](https://bun.com/docs/api/bun-jsc) +- `Bun.mmap`, `Bun.gc`, `Bun.generateHeapSnapshot`, [`bun:jsc`](https://bun.com/reference/bun/jsc) --- diff --git a/node_modules/bun-types/docs/runtime/bunfig.md b/node_modules/bun-types/docs/runtime/bunfig.md index 84240ab3..4b12e6ba 100644 --- a/node_modules/bun-types/docs/runtime/bunfig.md +++ b/node_modules/bun-types/docs/runtime/bunfig.md @@ -94,6 +94,7 @@ Bun supports the following loaders: - `file` - `json` - `toml` +- `yaml` - `wasm` - `napi` - `base64` @@ -496,6 +497,62 @@ Whether to generate a non-Bun lockfile alongside `bun.lock`. (A `bun.lock` will print = "yarn" ``` +### `install.security.scanner` + +Configure a security scanner to scan packages for vulnerabilities before installation. + +First, install a security scanner from npm: + +```bash +$ bun add -d @acme/bun-security-scanner +``` + +Then configure it in your `bunfig.toml`: + +```toml +[install.security] +scanner = "@acme/bun-security-scanner" +``` + +When a security scanner is configured: + +- Auto-install is automatically disabled for security +- Packages are scanned before installation +- Installation is cancelled if fatal issues are found +- Security warnings are displayed during installation + +Learn more about [using and writing security scanners](/docs/install/security). + +### `install.linker` + +Configure the default linker strategy. Default `"hoisted"`. + +For complete documentation refer to [Package manager > Isolated installs](https://bun.com/docs/install/isolated). + +```toml +[install] +linker = "hoisted" +``` + +Valid values are: + +{% table %} + +- Value +- Description + +--- + +- `"hoisted"` +- Link dependencies in a shared `node_modules` directory. + +--- + +- `"isolated"` +- Link dependencies inside each package installation. + +{% /table %} +