aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.devcontainer/scripts/nice.sh2
-rw-r--r--Dockerfile.base2
-rw-r--r--README.md53
-rw-r--r--build-id2
-rw-r--r--examples/next/package.json8
-rw-r--r--packages/bun-landing/index.css28
-rw-r--r--packages/bun-landing/page.tsx2
-rw-r--r--src/cli.zig2
-rw-r--r--src/http_client_async.zig29
-rw-r--r--src/install/install.zig14
-rw-r--r--src/resolver/tsconfig_json.zig15
-rw-r--r--src/string_immutable.zig2
-rw-r--r--src/thread_pool.zig9
-rw-r--r--types/bun/bun.d.ts4
14 files changed, 108 insertions, 64 deletions
diff --git a/.devcontainer/scripts/nice.sh b/.devcontainer/scripts/nice.sh
index d5f2a0601..4b6499dea 100644
--- a/.devcontainer/scripts/nice.sh
+++ b/.devcontainer/scripts/nice.sh
@@ -1,7 +1,7 @@
#!/bin/bash
chsh -s $(which zsh)
-sh -c "$(curl -fsSL https://starship.rs/install.sh) -- --platform linux_musl"
+sh -c "$(curl -fsSL https://starship.rs/install.sh) -- --platform linux_musl" -- --yes
echo "eval \"$(starship init zsh)\"" >>~/.zshrc
curl https://github.com/Jarred-Sumner/vscode-zig/releases/download/fork-v1/zig-0.2.5.vsix >/home/ubuntu/vscode-zig.vsix
diff --git a/Dockerfile.base b/Dockerfile.base
index 197191edb..cf49aca82 100644
--- a/Dockerfile.base
+++ b/Dockerfile.base
@@ -19,6 +19,7 @@ RUN apt-get update && \
wget https://apt.llvm.org/llvm.sh --no-check-certificate && \
chmod +x llvm.sh && \
./llvm.sh 13 && \
+ curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
@@ -35,7 +36,6 @@ RUN apt-get update && \
nodejs \
gcc \
g++ \
- npm \
clang-13 \
clang-format-13 \
libc++-13-dev \
diff --git a/README.md b/README.md
index d951dc441..e504cc3db 100644
--- a/README.md
+++ b/README.md
@@ -317,7 +317,7 @@ bun add preact
<details> <summary><strong>For Linux users</strong>: <code>bun install</code> needs Linux Kernel 5.6 or higher to work well</summary>
-The minimum Linux Kernel version is 5.1. If you're on Linux kernel 5.1 - 5.5, `bun install` should still work, but HTTP requests will be slow due to lack of support for io_uring's `connect()` operation.
+The minimum Linux Kernel version is 5.1. If you're on Linux kernel 5.1 - 5.5, `bun install` should still work, but HTTP requests will be slow due to a lack of support for io_uring's `connect()` operation.
If you're using Ubuntu 20.04, here's how to install a [newer kernel](https://wiki.ubuntu.com/Kernel/LTSEnablementStack):
@@ -362,7 +362,7 @@ Assuming a package.json with a `"clean"` command in `"scripts"`:
> Application commands are native ways to interact with apps in the Discord client. There are 3 types of commands accessible in different interfaces: the chat input, a message's context menu (top-right menu or right-clicking in a message), and a user's context menu (right-clicking on a user).
-To get started you can use interactions template:
+To get started you can use the interactions template:
```bash
bun create discord-interactions my-interactions-bot
@@ -373,7 +373,7 @@ If you don't have a Discord bot/application yet, you can create one [here (https
Invite bot to your server by visiting `https://discord.com/api/oauth2/authorize?client_id=<your_application_id>&scope=bot%20applications.commands`
-Afterwards you will need to get your bot's token, public key, and application id from application page and put them into `.env.example` file
+Afterwards you will need to get your bot's token, public key, and application id from the application page and put them into `.env.example` file
Then you can run the http server that will handle your interactions:
@@ -384,7 +384,7 @@ mv .env.example .env
bun run.js # listening on port 1337
```
-Discord does not accept insecure http server, so you will need provide SSL certificate or put interactions server behind a secure reverse proxy. For development you can use ngrok/cloudflare tunnel to expose local port as secure URL.
+Discord does not accept an insecure HTTP server, so you will need to provide an SSL certificate or put the interactions server behind a secure reverse proxy. For development you can use ngrok/cloudflare tunnel to expose local ports as secure URL.
## Using bun with Next.js
@@ -416,12 +416,13 @@ Here’s what doesn’t work yet:
- `proxy` and anything else in `next.config.js`
- API routes, middleware (middleware is easier to support though! similar SSR API)
- styled-jsx (technically not Next.js but often used with it)
+- React Server Components
When using Next.js, bun automatically reads configuration from `.env.local`, `.env.development` and `.env` (in that order). `process.env.NEXT_PUBLIC_` and `process.env.NEXT_` automatically are replaced via `--define`.
Currently, any time you import new dependencies from `node_modules`, you will need to re-run `bun bun --use next`. This will eventually be automatic.
-## Using bun with single page apps
+## Using bun with single-page apps
In your project folder root (where `package.json` is):
@@ -478,7 +479,7 @@ Here are examples of routing source code file paths:
| /src/index.tsx | src/index.tsx |
| /pages/index.js | pages/index.js |
-You do not need to include file extensions in `import` paths. CommonJS-style import paths without the file extension works.
+You do not need to include file extensions in `import` paths. CommonJS-style import paths without the file extension work.
You can override the public directory by passing `--public-dir="path-to-folder"`.
@@ -512,7 +513,7 @@ And to the `types` field in your `tsconfig.json`:
## Not implemented yet
-bun is a project with incredibly large scope, and it’s early days.
+bun is a project with an incredibly large scope and still in it's early days.
You can see [Bun's Roadmap](https://github.com/Jarred-Sumner/bun/issues/159), but here are some additional things that are planned:
@@ -557,7 +558,7 @@ Longer-term, bun intends to replace Node.js, Webpack, Babel, yarn, and PostCSS (
### Upcoming breaking changes
- Bun's CLI flags will change to better support bun as a JavaScript runtime. They were chosen when bun was just a frontend development tool.
-- Bun's bundling format will change to accomdate production browser bundles and on-demand production bundling
+- Bun's bundling format will change to accommodate production browser bundles and on-demand production bundling
## Configuration
@@ -1075,7 +1076,7 @@ export interface Lockfile {
#### Configuring with environment variables
-Environment variables have higher priority than `bunfig.toml`.
+Environment variables have a higher priority than `bunfig.toml`.
| Name | Description |
| -------------------------------- | ------------------------------------------------------------- |
@@ -1090,7 +1091,7 @@ Environment variables have higher priority than `bunfig.toml`.
bun always tries to use the fastest available installation method for the target platform. On macOS, that’s `clonefile` and on Linux, that’s `hardlink`. You can change which installation method is used with the `--backend` flag. When unavailable or on error, `clonefile` and `hardlink` fallsback to a platform-specific implementation of copying files.
-bun stores installed packages from npm in `~/.bun/install/cache/${name}@${version}`. Note that if the semver version has a `build` or a `pre` tag, it is replaced with a hash of that value instead. This is to reduce chances of errors from long file paths, but unfortunately complicates figuring out where a package was installed on disk.
+bun stores installed packages from npm in `~/.bun/install/cache/${name}@${version}`. Note that if the semver version has a `build` or a `pre` tag, it is replaced with a hash of that value instead. This is to reduce the chances of errors from long file paths but unfortunately complicates figuring out where a package was installed on disk.
When the `node_modules` folder exists, before installing, bun checks if the `"name"` and `"version"` in `package/package.json` in the expected node_modules folder matches the expected `name` and `version`. This is how it determines whether or not it should install. It uses a custom JSON parser which stops parsing as soon as it finds `"name"` and `"version"`.
@@ -1139,11 +1140,11 @@ rm -rf ~/.bun/install/cache
bun uses a binary format for caching NPM registry responses. This loads much faster than JSON and tends to be smaller on disk.
You will see these files in `~/.bun/install/cache/*.npm`. The filename pattern is `${hash(packageName)}.npm`. It’s a hash so that extra directories don’t need to be created for scoped packages
-bun’s usage of `Cache-Control` ignores `Age`. This improves performance, but means bun may be about 5 minutes out of date to receive the the latest package version metadata from npm.
+bun’s usage of `Cache-Control` ignores `Age`. This improves performance but means bun may be about 5 minutes out of date to receive the latest package version metadata from npm.
### `bun run`
-`bun run` is a fast `package.json` scripts runner. Instead of waiting 170ms for your npm client to start every time, you wait 6ms for bun.
+`bun run` is a fast `package.json` script runner. Instead of waiting 170ms for your npm client to start every time, you wait 6ms for bun.
By default, `bun run` prints the script that will be invoked:
@@ -1319,7 +1320,7 @@ By default, `bun create` will cancel if there are existing files it would overwr
#### Publishing a new template
-Clone this repository and a new folder in `examples/` with your new template. The `package.json` must have a `name` that starts with `@bun-examples/`. Do not worry about publishing it, that will happen automaticallly after the PR is merged.
+Clone this repository and a new folder in `examples/` with your new template. The `package.json` must have a `name` that starts with `@bun-examples/`. Do not worry about publishing it, that will happen automatically after the PR is merged.
Make sure to include a `.gitignore` that includes `node_modules` so that `node_modules` aren’t checked in to git when people download the template.
@@ -1443,11 +1444,11 @@ Here are some of the questions `.bun` files answer:
- how big is each imported dependency?
- what is the hash of the bundle’s contents? (for etags)
- what is the name & version of every npm package exported in this bundle?
-- what modules from which packages are used in this project? ("project" defined as all the entry points used to generate the .bun)
+- what modules from which packages are used in this project? ("project" is defined as all the entry points used to generate the .bun)
All in one file.
-It’s a little like a build cache, but designed for reuse across builds.
+It’s a little like a build cache but designed for reuse across builds.
#### Position-independent code
@@ -1489,7 +1490,7 @@ Note that `.bun` is a binary file format, so just opening it in VSCode or vim mi
#### Advanced
-By default, `bun bun` only bundles external dependencies that are `import`ed or `require`d in either app code or another external dependency. An "external depenendency" is defined as, "A JavaScript-like file that has `/node_modules/` in the resolved file path and a corresponding `package.json`".
+By default, `bun bun` only bundles external dependencies that are `import`ed or `require`d in either app code or another external dependency. An "external dependency" is defined as, "A JavaScript-like file that has `/node_modules/` in the resolved file path and a corresponding `package.json`".
To force bun to bundle packages which are not located in a `node_modules` folder (i.e. the final, resolved path following all symlinks), add a `bun` section to the root project’s `package.json` with `alwaysBundle` set to an array of package names to always bundle. Here’s an example:
@@ -1514,7 +1515,7 @@ export var $eb6819b = $$m({
Is generated like this:
-1. Murmur3 32 bit hash of `package.name@package.version`. This is the hash uniquely identifying the npm package.
+1. Murmur3 32-bit hash of `package.name@package.version`. This is the hash uniquely identifying the npm package.
2. Wyhash 64 of the `package.hash` + `package_path`. `package_path` means "relative to the root of the npm package, where is the module imported?". For example, if you imported `react/jsx-dev-runtime.js`, the `package_path` is `jsx-dev-runtime.js`. `react-dom/cjs/react-dom.development.js` would be `cjs/react-dom.development.js`
3. Truncate the hash generated above to a `u32`
@@ -1591,7 +1592,7 @@ Two ways to start an HTTP server with bun.js:
1. `export default` an object with a `fetch` function
-If the file used to start bun has a default export with a `fetch` function, it will start the http server.
+If the file used to start bun has a default export with a `fetch` function, it will start the HTTP server.
```ts
// hi.js
@@ -1604,9 +1605,9 @@ export default {
// bun ./hi.js
```
-`fetch` receives a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object and must return either a [`Response` ](https://developer.mozilla.org/en-US/docs/Web/API/Response) or a [`Promise<Response>`](https://developer.mozilla.org/en-US/docs/Web/API/Response). In a future version, it might have an additional arguments for things like cookies.
+`fetch` receives a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object and must return either a [`Response` ](https://developer.mozilla.org/en-US/docs/Web/API/Response) or a [`Promise<Response>`](https://developer.mozilla.org/en-US/docs/Web/API/Response). In a future version, it might have additional arguments for things like cookies.
-2. `Bun.serve` starts the http server explicitly
+2. `Bun.serve` starts the HTTP server explicitly
```ts
Bun.serve({
@@ -1896,7 +1897,7 @@ var db = new Database();
db.close();
```
-Note: `close()` is called automatically when the database is garbage collected. It is safe to call multiple times, but has no effect after the first.
+Note: `close()` is called automatically when the database is garbage collected. It is safe to call multiple times but has no effect after the first.
#### Database.prototype.query
@@ -2075,9 +2076,9 @@ insertMany.immediate(cats); // uses "BEGIN IMMEDIATE"
insertMany.exclusive(cats); // uses "BEGIN EXCLUSIVE"
```
-Any arguments passed to the transaction function will be forwarded to the wrapped function, and any values returned from the wrapped function will be returned from the transaction function. The wrapped function will also have access to the same this binding as the transaction function.
+Any arguments passed to the transaction function will be forwarded to the wrapped function, and any values returned from the wrapped function will be returned from the transaction function. The wrapped function will also have access to the same binding as the transaction function.
-bun:sqlite's transaction implementation is based on [better-sqlite3](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#transactionfunction---function) (along with this section of the docs), so thanks to Joshua Wise and better-sqlite3 constributors.
+bun:sqlite's transaction implementation is based on [better-sqlite3](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#transactionfunction---function) (along with this section of the docs), so thanks to Joshua Wise and better-sqlite3 contributors.
#### Database.prototype.serialize
@@ -2124,7 +2125,7 @@ var db = new Database();
db.loadExtension("myext");
```
-If you're on macOS, you will need to first use a custom SQLite install (you can install with homebrew). By default, bun uses Apple's propietary build of SQLite because it benchmarks about 50% faster. However, they disabled extension support, so you will need to have a custom build of SQLite to use extensions on macOS.
+If you're on macOS, you will need to first use a custom SQLite install (you can install with homebrew). By default, bun uses Apple's proprietary build of SQLite because it benchmarks about 50% faster. However, they disabled extension support, so you will need to have a custom build of SQLite to use extensions on macOS.
```ts
import { Database } from "bun:sqlite";
@@ -2667,7 +2668,7 @@ Bun represents [pointers](<https://en.wikipedia.org/wiki/Pointer_(computer_progr
<summary>How does a 64 bit pointer fit in a JavaScript number?</summary>
-64-bit processors support up to [52 bits of addressible space](https://en.wikipedia.org/wiki/64-bit_computing#Limits_of_processors).
+64-bit processors support up to [52 bits of addressable space](https://en.wikipedia.org/wiki/64-bit_computing#Limits_of_processors).
[JavaScript numbers](https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64) support 53 bits of usable space, so that leaves us with about 11 bits of extra space.
@@ -2952,7 +2953,7 @@ export default jsx(
);
```
-If a macro is used, it will be run in the same thread as the transpiler, but in a separate event loop from the rest of your application. Currently, globals between macros and regular code are shared, which means it is possible (but not recommended) to share state between macros and regular code. Attempting to use AST nodes outside of a macro is undefined behavior.
+If a macro is used, it will be run in the same thread as the transpiler, but in a separate event loop from the rest of your application. Currently, globals between macros and regular code are shared, which means it is possible (but not recommended) to share states between macros and regular code. Attempting to use AST nodes outside of a macro is undefined behavior.
#### `Bun.Transpiler.transform`
diff --git a/build-id b/build-id
index d00491fd7..0cfbf0888 100644
--- a/build-id
+++ b/build-id
@@ -1 +1 @@
-1
+2
diff --git a/examples/next/package.json b/examples/next/package.json
index 3963ff5cc..1fbf8e85b 100644
--- a/examples/next/package.json
+++ b/examples/next/package.json
@@ -1,15 +1,15 @@
{
"name": "@bun-examples/next",
- "version": "0.0.51",
+ "version": "0.0.52",
"main": "index.js",
"dependencies": {
"next": "^12.1.0",
- "react": "^17",
- "react-dom": "^17",
+ "react": "^18",
+ "react-dom": "^18",
"react-is": "^17.0.2"
},
"devDependencies": {
- "@types/react": "latest",
+ "@types/react": "^18",
"bun-framework-next": "^12",
"typescript": "latest"
},
diff --git a/packages/bun-landing/index.css b/packages/bun-landing/index.css
index fde6270c1..769aa0899 100644
--- a/packages/bun-landing/index.css
+++ b/packages/bun-landing/index.css
@@ -17,9 +17,11 @@
--vertical-padding: 4rem;
--line-height: 1.4;
}
+
* {
box-sizing: border-box;
}
+
head,
body,
:root {
@@ -37,14 +39,17 @@ a {
text-decoration: none;
transition: transform 0.1s linear;
}
+
a:visited {
color: inherit;
}
+
a:hover {
text-decoration: underline;
transform: scale(1.06, 1.06);
transform-origin: middle center;
}
+
#header-wrap,
#pitch {
background-color: var(--black);
@@ -58,6 +63,7 @@ a:hover {
gap: 24px;
align-items: center;
}
+
main {
width: auto;
@@ -141,6 +147,7 @@ header {
cursor: pointer;
transform: scale(1.06);
}
+
#HeaderInstallButton {
transition: transform 0.1s linear;
background: #00a6e1;
@@ -259,10 +266,8 @@ header {
.InstallBox-copy {
height: 100%;
-
display: flex;
align-items: center;
-
color: var(--orange-light);
transition: transform 0.05s linear;
transition-property: color, transform;
@@ -336,6 +341,7 @@ header {
list-style-type: none;
padding: 0;
}
+
.BarGraph,
.ActiveTab,
.Graphs {
@@ -381,10 +387,8 @@ header {
.BarGraphBar {
margin: 0 auto;
-
width: var(--primary);
height: var(--opposite);
-
background-color: rgb(93, 89, 134);
position: relative;
height: calc(200px * var(--level));
@@ -404,9 +408,6 @@ header {
border-right-color: transparent;
}
-.BarGraph--horizontal .BarGraphBar {
-}
-
.BarGraph--vertical .BarGraphBar {
max-width: 90%;
}
@@ -417,8 +418,9 @@ header {
font-family: var(--monospace-font);
width: 100%;
text-align: center;
-
position: relative;
+ display: flex;
+ justify-content: center;
}
.CardContent {
@@ -457,10 +459,8 @@ header {
.BarGraph--vertical .BarGraphBar {
height: var(--primary);
width: var(--opposite);
-
transform: scaleX(var(--level));
transform-origin: bottom left;
-
max-height: 40px;
margin-top: 1rem;
margin-bottom: 1rem;
@@ -532,8 +532,6 @@ header {
display: grid;
}
-#explain-section {
-}
#explain ul {
font-size: 1.2rem;
}
@@ -608,10 +606,6 @@ header {
--background: #ff17ff;
}
-ul,
-li {
-}
-
.mono {
font-family: var(--monospace-font);
border-radius: 6px;
@@ -917,4 +911,4 @@ img {
position: absolute;
white-space: nowrap;
width: 1px;
-} \ No newline at end of file
+}
diff --git a/packages/bun-landing/page.tsx b/packages/bun-landing/page.tsx
index 21f8aeb52..d3f4cd867 100644
--- a/packages/bun-landing/page.tsx
+++ b/packages/bun-landing/page.tsx
@@ -564,7 +564,7 @@ export default ({ inlineCSS }) => (
<NodeJS href="https://github.com/Jarred-Sumner/bun/issues/158">
Node-API
</NodeJS>{" "}
- bun.js implements most of{' '}
+ bun.js implements most of{" "}
<a
href="https://nodejs.org/api/n-api.html#node-api"
target="_blank"
diff --git a/src/cli.zig b/src/cli.zig
index e9798eba8..32ad9bca5 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -696,7 +696,7 @@ pub const HelpCommand = struct {
\\> <r> <b><magenta>bun <r><d> ./a.ts ./b.jsx<r> Bundle dependencies of input files into a <r><magenta>.bun<r>
\\
\\> <r> <b><cyan>create <r><d>next ./app<r> Start a new project from a template <d>(bun c)<r>
- \\> <r> <b><magenta>run <r><d> test <r> Run a package.json script or executable<r>
+ \\> <r> <b><magenta>run <r><d> test <r> Run JavaScript with bun, a package.json script, or a bin<r>
\\> <r> <b><green>install<r> Install dependencies for a package.json <d>(bun i)<r>
\\> <r> <b><blue>add <r><d> {s:<16}<r> Add a dependency to package.json <d>(bun a)<r>
\\> <r> remove <r><d> {s:<16}<r> Remove a dependency from package.json <d>(bun rm)<r>
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index f3fbd45cf..33f004f28 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -42,7 +42,34 @@ pub fn onThreadStart(_: ?*anyopaque) ?*anyopaque {
default_allocator = default_arena.allocator();
NetworkThread.address_list_cached = NetworkThread.AddressListCache.init(default_allocator);
AsyncIO.global = AsyncIO.init(1024, 0) catch |err| {
- Output.prettyErrorln("<r><red>error<r>: Failed to initialize network thread: <red><b>{s}<r>.\nHTTP requests will not work. Please file an issue and run strace().", .{@errorName(err)});
+ log: {
+ if (comptime Environment.isLinux) {
+ if (err == error.SystemOutdated) {
+ Output.prettyErrorln(
+ \\<red>error<r>: Linux kernel version doesn't support io_uring, which Bun depends on.
+ \\
+ \\To fix this error: <b>please upgrade to a newer Linux kernel<r>.
+ \\
+ \\If you're using Windows Subsystem for Linux, here's how:
+ \\ 1. Open PowerShell as an administrator
+ \\ 2. Run this:
+ \\ <cyan>wsl --update<r>
+ \\ <cyan>wsl --shutdown<r>
+ \\
+ \\If that doesn't work (and you're on a Windows machine), try this:
+ \\ 1. Open Windows Update
+ \\ 2. Download any updates to Windows Subsystem for Linux
+ \\
+ \\If you're still having trouble, ask for help in bun's discord https://bun.sh/discord
+ \\
+ , .{});
+ break :log;
+ }
+ }
+
+ Output.prettyErrorln("<r><red>error<r>: Failed to initialize network thread: <red><b>{s}<r>.\nHTTP requests will not work. Please file an issue and run strace().", .{@errorName(err)});
+ }
+
Output.flush();
os.exit(1);
};
diff --git a/src/install/install.zig b/src/install/install.zig
index 5f890e832..051eebb03 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -185,7 +185,13 @@ const NetworkTask = struct {
PackageManager.instance.network_channel.writeItem(@fieldParentPtr(NetworkTask, "http", http)) catch {};
}
- const default_headers_buf: string = "Acceptapplication/vnd.npm.install-v1+json";
+ // We must use a less restrictive Acccept header value
+ // https://github.com/Jarred-Sumner/bun/issues/341
+ // https://www.jfrog.com/jira/browse/RTFACT-18398
+ const accept_header_value = "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*";
+
+ const default_headers_buf: string = "Accept" ++ accept_header_value;
+
pub fn forManifest(
this: *NetworkTask,
name: string,
@@ -218,7 +224,7 @@ const NetworkTask = struct {
}
if (header_builder.header_count > 0) {
- header_builder.count("Accept", "application/vnd.npm.install-v1+json");
+ header_builder.count("Accept", accept_header_value);
if (last_modified.len > 0 and etag.len > 0) {
header_builder.content.count(last_modified);
}
@@ -236,7 +242,7 @@ const NetworkTask = struct {
header_builder.append("If-Modified-Since", last_modified);
}
- header_builder.append("Accept", "application/vnd.npm.install-v1+json");
+ header_builder.append("Accept", accept_header_value);
if (last_modified.len > 0 and etag.len > 0) {
last_modified = header_builder.content.append(last_modified);
@@ -1094,7 +1100,7 @@ const PackageInstall = struct {
return result;
} else |err| {
switch (err) {
- error.NotSameFilesystem, error.NotSupported => {
+ error.NotSameFileSystem, error.NotSupported => {
supported_method = .copyfile;
},
error.FileNotFound => return Result{
diff --git a/src/resolver/tsconfig_json.zig b/src/resolver/tsconfig_json.zig
index 68217191a..34732beb8 100644
--- a/src/resolver/tsconfig_json.zig
+++ b/src/resolver/tsconfig_json.zig
@@ -325,9 +325,24 @@ pub const TSConfigJSON = struct {
return &([_]string{});
}
const parts_count = std.mem.count(u8, text, ".");
+
+ if (parts_count == 0) {
+ if (!js_lexer.isIdentifier(text)) {
+ const warn = source.rangeOfString(loc);
+ log.addRangeWarningFmt(source, warn, allocator, "Invalid JSX member expression: \"{s}\"", .{text}) catch {};
+ return &([_]string{});
+ }
+
+ var members = allocator.alloc(string, 1) catch unreachable;
+
+ members[0] = text;
+ return members;
+ }
+
const parts = allocator.alloc(string, parts_count) catch unreachable;
var iter = std.mem.tokenize(u8, text, ".");
var i: usize = 0;
+
while (iter.next()) |part| {
if (!js_lexer.isIdentifier(part)) {
const warn = source.rangeOfString(loc);
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index 5ee958b40..8f347b047 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -482,7 +482,7 @@ pub fn eqlAnyComptime(self: string, comptime list: []const string) bool {
return false;
}
-/// Count the occurences of a character in an ASCII byte array
+/// Count the occurrences of a character in an ASCII byte array
/// uses SIMD
pub fn countChar(self: string, char: u8) usize {
var total: usize = 0;
diff --git a/src/thread_pool.zig b/src/thread_pool.zig
index 514225d98..03fe6f211 100644
--- a/src/thread_pool.zig
+++ b/src/thread_pool.zig
@@ -184,12 +184,13 @@ noinline fn notifySlow(self: *ThreadPool, is_waking: bool) void {
// We signaled to spawn a new thread
if (can_wake and sync.spawned < self.max_threads) {
- const spawn_config = std.Thread.SpawnConfig{};
- if (Environment.isMac) {
+ const spawn_config = if (Environment.isMac)
// stack size must be a multiple of page_size
// macOS will fail to spawn a thread if the stack size is not a multiple of page_size
- spawn_config.stack_size = ((self.stack_size + (std.mem.page_size / 2)) / std.mem.page_size) * std.mem.page_size;
- }
+ std.Thread.SpawnConfig{ .stack_size = ((std.Thread.SpawnConfig{}).stack_size + (std.mem.page_size / 2) / std.mem.page_size) * std.mem.page_size }
+ else
+ std.Thread.SpawnConfig{};
+
const thread = std.Thread.spawn(spawn_config, Thread.run, .{self}) catch return self.unregister(null);
// if (self.name.len > 0) thread.setName(self.name) catch {};
return thread.detach();
diff --git a/types/bun/bun.d.ts b/types/bun/bun.d.ts
index 197577579..f99694e01 100644
--- a/types/bun/bun.d.ts
+++ b/types/bun/bun.d.ts
@@ -322,7 +322,7 @@ declare module "bun" {
interface Sink<T> {
write(chunk: string | ArrayBufferView | ArrayBuffer): number;
- drain(): Promise<number> | number;
+ flush(): Promise<number> | number;
end(): T;
}
@@ -339,7 +339,7 @@ declare module "bun" {
} = {}): void;
write(chunk: string | ArrayBufferView | ArrayBuffer): number;
- drain(): number;
+ flush(): number;
end(): ArrayBuffer;
}