renovate[bot] 21390ce2ad chore: bump up esbuild version to ^0.28.0 [SECURITY] (#15662)
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [esbuild](https://redirect.github.com/evanw/esbuild) | [`^0.25.0` →
`^0.28.0`](https://renovatebot.com/diffs/npm/esbuild/0.25.12/0.28.1) |
![age](https://developer.mend.io/api/mc/badges/age/npm/esbuild/0.28.1?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/esbuild/0.25.12/0.28.1?slim=true)
|

---

### esbuild allows arbitrary file read when running the development
server on Windows

[GHSA-g7r4-m6w7-qqqr](https://redirect.github.com/advisories/GHSA-g7r4-m6w7-qqqr)

<details>
<summary>More information</summary>

#### Details
##### Summary

The development server contains a path traversal vulnerability on
Windows when serving files from `servedir`.

Due to the use of `path.Clean()` (which only normalizes forward-slash
`/` separators) instead of a Windows-aware path normalization function,
it is possible to craft requests using backslashes (`\`) that bypass the
intended directory containment logic. An attacker can escape the
configured `servedir` root and access arbitrary files on the filesystem.
This issue affects Windows environments only.

##### Details

The request path is sanitized using:
```go
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L165
queryPath := path.Clean(req.URL.Path)[1:]
```

However:
- `path.Clean()` is POSIX-style and only understands `/` (docs:
`https://pkg.go.dev/path#Clean`)
- On Windows, `\` is a valid path separator
- `path.Clean()` does not treat `\` as a separator

Later, the server constructs the absolute path:
```go
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L221
absPath := h.fs.Join(h.servedir, queryPath)
```

If `queryPath` contains sequences such as:
```
..\..\..\..\..\..\..\Windows\system.ini
```

`path.Clean()` will not normalize them, but the Windows filesystem will
interpret `\` as directory separators when resolving `absPath`.
Because the implementation does not verify that the final resolved path
remains within `servedir`, it allows directory traversal outside the
intended root directory.

##### Vulnerable Code

```go
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L165
	queryPath := path.Clean(req.URL.Path)[1:]
	....
	// Check for a file in the "servedir" directory
	if h.servedir != "" && kind != fs.FileEntry {
		absPath := h.fs.Join(h.servedir, queryPath)
		if absDir := h.fs.Dir(absPath); absDir != absPath {
			if entries, err, _ := h.fs.ReadDirectory(absDir); err == nil {
				if entry, _ := entries.Get(h.fs.Base(absPath)); entry != nil && entry.Kind(h.fs) == fs.FileEntry {
	....				
```

##### Steps to reproduce

```
npm install --save-exact --save-dev esbuild

echo "console.log(1)" > app.js

.\node_modules\.bin\esbuild --version
0.27.3

.\node_modules\.bin\esbuild app.js --bundle --outdir=www --servedir=www --watch

curl -i --path-as-is "http://localhost:8000/..\..\..\..\..\..\..\Windows\system.ini"
<content of Windows\system.ini>
```

##### Impact

- Arbitrary file read on Windows
- Exposure of sensitive files

#### Severity
- CVSS Score: 2.5 / 10 (Low)
- Vector String: `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N`

#### References
-
[https://github.com/evanw/esbuild/security/advisories/GHSA-g7r4-m6w7-qqqr](https://redirect.github.com/evanw/esbuild/security/advisories/GHSA-g7r4-m6w7-qqqr)
-
[https://github.com/evanw/esbuild/releases/tag/v0.28.1](https://redirect.github.com/evanw/esbuild/releases/tag/v0.28.1)
-
[https://github.com/advisories/GHSA-g7r4-m6w7-qqqr](https://redirect.github.com/advisories/GHSA-g7r4-m6w7-qqqr)

This data is provided by the [GitHub Advisory
Database](https://redirect.github.com/advisories/GHSA-g7r4-m6w7-qqqr)
([CC-BY
4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Release Notes

<details>
<summary>evanw/esbuild (esbuild)</summary>

###
[`v0.28.1`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0281)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.28.0...v0.28.1)

- Disallow `\` in local development server HTTP requests
([GHSA-g7r4-m6w7-qqqr](https://redirect.github.com/evanw/esbuild/security/advisories/GHSA-g7r4-m6w7-qqqr))

This release fixes a security issue where HTTP requests to esbuild's
local development server could traverse outside of the serve directory
on Windows using a `\` backslash character. It happened due to the use
of Go's `path.Clean()` function, which only handles Unix-style `/`
characters. HTTP requests with paths containing `\` are no longer
allowed.

Thanks to [@&#8203;dellalibera](https://redirect.github.com/dellalibera)
for reporting this issue.

- Add integrity checks to the Deno API
([GHSA-gv7w-rqvm-qjhr](https://redirect.github.com/evanw/esbuild/security/advisories/GHSA-gv7w-rqvm-qjhr))

The previous release of esbuild added integrity checks to esbuild's npm
install script. This release also adds integrity checks to esbuild's
Deno install script. Now esbuild's Deno API will also fail with an error
if the downloaded esbuild binary contains something other than the
expected content.

Note that esbuild's Deno API installs from `registry.npmjs.org` by
default, but allows the `NPM_CONFIG_REGISTRY` environment variable to
override this with a custom package registry. This change means that the
esbuild executable served by `NPM_CONFIG_REGISTRY` must now match the
expected content.

Thanks to [@&#8203;sondt99](https://redirect.github.com/sondt99) for
reporting this issue.

- Avoid inlining `using` and `await using` declarations
([#&#8203;4482](https://redirect.github.com/evanw/esbuild/issues/4482))

Previously esbuild's minifier sometimes incorrectly inlined `using` and
`await using` declarations into subsequent uses of that declaration,
which then fails to dispose of the resource correctly. This bug happened
because inlining was done for `let` and `const` declarations by avoiding
doing it for `var` declarations, which no longer worked when more
declaration types were added. Here's an example:

  ```js
  // Original code
  {
    using x = new Resource()
    x.activate()
  }

  // Old output (with --minify)
  new Resource().activate();

  // New output (with --minify)
  {using e=new Resource;e.activate()}
  ```

- Fix module evaluation when an error is thrown
([#&#8203;4461](https://redirect.github.com/evanw/esbuild/issues/4461),
[#&#8203;4467](https://redirect.github.com/evanw/esbuild/pull/4467))

If an error is thrown during module evaluation, esbuild previously
didn't preserve the state of the module for subsequent module
references. This was observable if `import()` or `require()` is used to
import a module multiple times. The thrown error is supposed to be
thrown by every call to `import()` or `require()`, not just the first.
With this release, esbuild will now throw the same error every time you
call `import()` or `require()` on a module that throws during its
evaluation.

- Fix some edge cases around the `new` operator
([#&#8203;4477](https://redirect.github.com/evanw/esbuild/issues/4477))

Previously esbuild incorrectly printed certain edge cases involving
complex expressions inside the target of a `new` expression
(specifically an optional chain and/or a tagged template literal). The
generated code for the `new` target was not correctly wrapped with
parentheses, and either contained a syntax error or had different
semantics. These edge cases have been fixed so that they now correctly
wrap the `new` target in parentheses. Here is an example of some
affected code:

  ```js
  // Original code
  new (foo()`bar`)()
  new (foo()?.bar)()

  // Old output
  new foo()`bar`();
  new (foo())?.bar();

  // New output
  new (foo())`bar`();
  new (foo()?.bar)();
  ```

- Fix renaming of nested `var` declarations
([#&#8203;4471](https://redirect.github.com/evanw/esbuild/issues/4471))

This release fixes a bug where `var` declarations in nested scopes that
are hoisted up to module scope were not correctly being renamed during
bundling. That could previously lead to name collisions when
minification was disabled, which could potentially cause a behavior
change. The bug has been fixed so that these hoisted declarations are
now considered to be module-level symbols during the name collision
avoidance pass.

- Emit `var` instead of `const` for certain TypeScript-only constructs
for ES5
([#&#8203;4448](https://redirect.github.com/evanw/esbuild/issues/4448))

While esbuild doesn't generally support converting `const` to `var` for
ES5 due to nested scoping rules (which is currently a build-time error),
esbuild previously incorrectly converted TypeScript-only `import`
assignment constructs into a `const` declaration even when targeting
ES5. With this release, esbuild will now use `var` for this case
instead:

  ```js
  // Original code
  import x = require('y')

  // Old output (with --target=es5)
  const x = require("y");

  // New output (with --target=es5)
  var x = require("y");
  ```

###
[`v0.28.0`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0280)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.7...v0.28.0)

- Add support for `with { type: 'text' }` imports
([#&#8203;4435](https://redirect.github.com/evanw/esbuild/issues/4435))

The [import text](https://redirect.github.com/tc39/proposal-import-text)
proposal has reached stage 3 in the TC39 process, which means that it's
recommended for implementation. It has also already been implemented by
[Deno](https://docs.deno.com/examples/importing_text/) and
[Bun](https://bun.com/docs/guides/runtime/import-html). So with this
release, esbuild also adds support for it. This behaves exactly the same
as esbuild's existing [`text`
loader](https://esbuild.github.io/content-types/#text). Here's an
example:

  ```js
  import string from './example.txt' with { type: 'text' }
  console.log(string)
  ```

- Add integrity checks to fallback download path
([#&#8203;4343](https://redirect.github.com/evanw/esbuild/issues/4343))

Installing esbuild via npm is somewhat complicated with several
different edge cases (see [esbuild's
documentation](https://esbuild.github.io/getting-started/#additional-npm-flags)
for details). If the regular installation of esbuild's platform-specific
package fails, esbuild's install script attempts to download the
platform-specific package itself (first with the `npm` command, and then
with a HTTP request to `registry.npmjs.org` as a last resort).

This last resort path previously didn't have any integrity checks. With
this release, esbuild will now verify that the hash of the downloaded
binary matches the expected hash for the current release. This means the
hashes for all of esbuild's platform-specific binary packages will now
be embedded in the top-level `esbuild` package. Hopefully this should
work without any problems. But just in case, this change is being done
as a breaking change release.

- Update the Go compiler from 1.25.7 to 1.26.1

This upgrade should not affect anything. However, there have been some
significant internal changes to the Go compiler, so esbuild could
potentially behave differently in certain edge cases:

- It now uses the [new garbage
collector](https://go.dev/doc/go1.26#new-garbage-collector) that comes
with Go 1.26.
- The Go compiler is now more aggressive with allocating memory on the
stack.
- The executable format that the Go linker uses has undergone several
changes.
- The WebAssembly build now unconditionally makes use of the sign
extension and non-trapping floating-point to integer conversion
instructions.

You can read the [Go 1.26 release notes](https://go.dev/doc/go1.26) for
more information.

###
[`v0.27.7`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0277)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.5...v0.27.7)

- Fix lowering of define semantics for TypeScript parameter properties
([#&#8203;4421](https://redirect.github.com/evanw/esbuild/issues/4421))

The previous release incorrectly generated class fields for TypeScript
parameter properties even when the configured target environment does
not support class fields. With this release, the generated class fields
will now be correctly lowered in this case:

  ```ts
  // Original code
  class Foo {
    constructor(public x = 1) {}
    y = 2
  }

  // Old output (with --loader=ts --target=es2021)
  class Foo {
    constructor(x = 1) {
      this.x = x;
      __publicField(this, "y", 2);
    }
    x;
  }

  // New output (with --loader=ts --target=es2021)
  class Foo {
    constructor(x = 1) {
      __publicField(this, "x", x);
      __publicField(this, "y", 2);
    }
  }
  ```

###
[`v0.27.5`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0275)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.4...v0.27.5)

- Fix for an async generator edge case
([#&#8203;4401](https://redirect.github.com/evanw/esbuild/issues/4401),
[#&#8203;4417](https://redirect.github.com/evanw/esbuild/pull/4417))

Support for transforming async generators into the equivalent state
machine was added in version 0.19.0. However, the generated state
machine didn't work correctly when polling async generators
concurrently, such as in the following code:

  ```js
  async function* inner() { yield 1; yield 2 }
  async function* outer() { yield* inner() }
  let gen = outer()
  for await (let x of [gen.next(), gen.next()]) console.log(x)
  ```

Previously esbuild's output of the above code behaved incorrectly when
async generators were transformed (such as with
`--supported:async-generator=false`). The transformation should be fixed
starting with this release.

This fix was contributed by
[@&#8203;2767mr](https://redirect.github.com/2767mr).

- Fix a regression when `metafile` is enabled
([#&#8203;4420](https://redirect.github.com/evanw/esbuild/issues/4420),
[#&#8203;4418](https://redirect.github.com/evanw/esbuild/pull/4418))

This release fixes a regression introduced by the previous release. When
`metafile: true` was enabled in esbuild's JavaScript API, builds with
build errors were incorrectly throwing an error about an empty JSON
string instead of an object containing the build errors.

- Use define semantics for TypeScript parameter properties
([#&#8203;4421](https://redirect.github.com/evanw/esbuild/issues/4421))

Parameter properties are a TypeScript-specific code generation feature
that converts constructor parameters into class fields when they are
prefixed by certain keywords. When `"useDefineForClassFields": true` is
present in `tsconfig.json`, the TypeScript compiler automatically
generates class field declarations for parameter properties. Previously
esbuild didn't do this, but esbuild will now do this starting with this
release:

  ```ts
  // Original code
  class Foo {
    constructor(public x: number) {}
  }

  // Old output (with --loader=ts)
  class Foo {
    constructor(x) {
      this.x = x;
    }
  }

  // New output (with --loader=ts)
  class Foo {
    constructor(x) {
      this.x = x;
    }
    x;
  }
  ```

- Allow `es2025` as a target in `tsconfig.json`
([#&#8203;4432](https://redirect.github.com/evanw/esbuild/issues/4432))

TypeScript recently [added
`es2025`](https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#es2025-option-for-target-and-lib)
as a compilation target, so esbuild now supports this in the `target`
field of `tsconfig.json` files, such as in the following configuration
file:

  ```json
  {
    "compilerOptions": {
      "target": "ES2025"
    }
  }
  ```

As a reminder, the only thing that esbuild uses this field for is
determining whether or not to use legacy TypeScript behavior for class
fields. You can read more in [the
documentation](https://esbuild.github.io/content-types/#tsconfig-json).

###
[`v0.27.4`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0274)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.3...v0.27.4)

- Fix a regression with CSS media queries
([#&#8203;4395](https://redirect.github.com/evanw/esbuild/issues/4395),
[#&#8203;4405](https://redirect.github.com/evanw/esbuild/issues/4405),
[#&#8203;4406](https://redirect.github.com/evanw/esbuild/issues/4406))

Version 0.25.11 of esbuild introduced support for parsing media queries.
This unintentionally introduced a regression with printing media queries
that use the `<media-type> and <media-condition-without-or>` grammar.
Specifically, esbuild was failing to wrap an `or` clause with
parentheses when inside `<media-condition-without-or>`. This release
fixes the regression.

  Here is an example:

  ```css
  /* Original code */
  @media only screen and ((min-width: 10px) or (min-height: 10px)) {
    a { color: red }
  }

  /* Old output (incorrect) */
  @media only screen and (min-width: 10px) or (min-height: 10px) {
    a {
      color: red;
    }
  }

  /* New output (correct) */
  @media only screen and ((min-width: 10px) or (min-height: 10px)) {
    a {
      color: red;
    }
  }
  ```

- Fix an edge case with the `inject` feature
([#&#8203;4407](https://redirect.github.com/evanw/esbuild/issues/4407))

This release fixes an edge case where esbuild's `inject` feature could
not be used with arbitrary module namespace names exported using an
`export {} from` statement with bundling disabled and a target
environment where arbitrary module namespace names is unsupported.

  With the fix, the following `inject` file:

  ```js
  import jquery from 'jquery';
  export { jquery as 'window.jQuery' };
  ```

Can now always be rewritten as this without esbuild sometimes
incorrectly generating an error:

  ```js
  export { default as 'window.jQuery' } from 'jquery';
  ```

- Attempt to improve API handling of huge metafiles
([#&#8203;4329](https://redirect.github.com/evanw/esbuild/issues/4329),
[#&#8203;4415](https://redirect.github.com/evanw/esbuild/issues/4415))

This release contains a few changes that attempt to improve the behavior
of esbuild's JavaScript API with huge metafiles (esbuild's name for the
build metadata, formatted as a JSON object). The JavaScript API is
designed to return the metafile JSON as a JavaScript object in memory,
which makes it easy to access from within a JavaScript-based plugin.
Multiple people have encountered issues where this API breaks down with
a pathologically-large metafile.

The primary issue is that V8 has an implementation-specific maximum
string length, so using the `JSON.parse` API with large enough strings
is impossible. This release will now attempt to use a fallback
JavaScript-based JSON parser that operates directly on the UTF8-encoded
JSON bytes instead of using `JSON.parse` when the JSON metafile is too
big to fit in a JavaScript string. The new fallback path has not yet
been heavily-tested. The metafile will also now be generated with
whitespace removed if the bundle is significantly large, which will
reduce the size of the metafile JSON slightly.

However, hitting this case is potentially a sign that something else is
wrong. Ideally you wouldn't be building something so enormous that the
build metadata can't even fit inside a JavaScript string. You may want
to consider optimizing your project, or breaking up your project into
multiple parts that are built independently. Another option could
potentially be to use esbuild's command-line API instead of its
JavaScript API, which is more efficient (although of course then you
can't use JavaScript plugins, so it may not be an option).

###
[`v0.27.3`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0273)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.2...v0.27.3)

- Preserve URL fragments in data URLs
([#&#8203;4370](https://redirect.github.com/evanw/esbuild/issues/4370))

  Consider the following HTML, CSS, and SVG:

  - `index.html`:

    ```html
    <!DOCTYPE html>
    <html>
      <head><link rel="stylesheet" href="icons.css"></head>
      <body><div class="triangle"></div></body>
    </html>
    ```

  - `icons.css`:

    ```css
    .triangle {
      width: 10px;
      height: 10px;
      background: currentColor;
      clip-path: url(./triangle.svg#x);
    }
    ```

  - `triangle.svg`:

    ```xml
    <svg xmlns="http://www.w3.org/2000/svg">
      <defs>
        <clipPath id="x">
          <path d="M0 0H10V10Z"/>
        </clipPath>
      </defs>
    </svg>
    ```

The CSS uses a URL fragment (the `#x`) to reference the `clipPath`
element in the SVG file. Previously esbuild's CSS bundler didn't
preserve the URL fragment when bundling the SVG using the `dataurl`
loader, which broke the bundled CSS. With this release, esbuild will now
preserve the URL fragment in the bundled CSS:

  ```css
  /* icons.css */
  .triangle {
    width: 10px;
    height: 10px;
    background: currentColor;
clip-path: url('data:image/svg+xml,<svg
xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="x"><path d="M0
0H10V10Z"/></clipPath></defs></svg>#x');
  }
  ```

- Parse and print CSS `@scope` rules
([#&#8203;4322](https://redirect.github.com/evanw/esbuild/issues/4322))

This release includes dedicated support for parsing `@scope` rules in
CSS. These rules include optional "start" and "end" selector lists. One
important consequence of this is that the local/global status of names
in selector lists is now respected, which improves the correctness of
esbuild's support for [CSS
modules](https://esbuild.github.io/content-types/#local-css).
Minification of selectors inside `@scope` rules has also improved
slightly.

  Here's an example:

  ```css
  /* Original code */
  @scope (:global(.foo)) to (:local(.bar)) {
    .bar {
      color: red;
    }
  }

  /* Old output (with --loader=local-css --minify) */
  @scope (:global(.foo)) to (:local(.bar)){.o{color:red}}

  /* New output (with --loader=local-css --minify) */
  @scope(.foo)to (.o){.o{color:red}}
  ```

- Fix a minification bug with lowering of `for await`
([#&#8203;4378](https://redirect.github.com/evanw/esbuild/pull/4378),
[#&#8203;4385](https://redirect.github.com/evanw/esbuild/pull/4385))

This release fixes a bug where the minifier would incorrectly strip the
variable in the automatically-generated `catch` clause of lowered `for
await` loops. The code that generated the loop previously failed to mark
the internal variable references as used.

- Update the Go compiler from v1.25.5 to v1.25.7
([#&#8203;4383](https://redirect.github.com/evanw/esbuild/issues/4383),
[#&#8203;4388](https://redirect.github.com/evanw/esbuild/pull/4388))

This PR was contributed by
[@&#8203;MikeWillCook](https://redirect.github.com/MikeWillCook).

###
[`v0.27.2`](https://redirect.github.com/evanw/esbuild/releases/tag/v0.27.2)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.1...v0.27.2)

- Allow import path specifiers starting with `#/`
([#&#8203;4361](https://redirect.github.com/evanw/esbuild/pull/4361))

Previously the specification for `package.json` disallowed import path
specifiers starting with `#/`, but this restriction [has recently been
relaxed](https://redirect.github.com/nodejs/node/pull/60864) and support
for it is being added across the JavaScript ecosystem. One use case is
using it for a wildcard pattern such as mapping `#/*` to `./src/*`
(previously you had to use another character such as `#_*` instead,
which was more confusing). There is some more context in
[nodejs/node#49182](https://redirect.github.com/nodejs/node/issues/49182).

This change was contributed by
[@&#8203;hybrist](https://redirect.github.com/hybrist).

- Automatically add the `-webkit-mask` prefix
([#&#8203;4357](https://redirect.github.com/evanw/esbuild/issues/4357),
[#&#8203;4358](https://redirect.github.com/evanw/esbuild/issues/4358))

This release automatically adds the `-webkit-` vendor prefix for the
[`mask`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/mask)
CSS shorthand property:

  ```css
  /* Original code */
  main {
    mask: url(x.png) center/5rem no-repeat
  }

  /* Old output (with --target=chrome110) */
  main {
    mask: url(x.png) center/5rem no-repeat;
  }

  /* New output (with --target=chrome110) */
  main {
    -webkit-mask: url(x.png) center/5rem no-repeat;
    mask: url(x.png) center/5rem no-repeat;
  }
  ```

This change was contributed by
[@&#8203;BPJEnnova](https://redirect.github.com/BPJEnnova).

- Additional minification of `switch` statements
([#&#8203;4176](https://redirect.github.com/evanw/esbuild/issues/4176),
[#&#8203;4359](https://redirect.github.com/evanw/esbuild/issues/4359))

This release contains additional minification patterns for reducing
`switch` statements. Here is an example:

  ```js
  // Original code
  switch (x) {
    case 0:
      foo()
      break
    case 1:
    default:
      bar()
  }

  // Old output (with --minify)
  switch(x){case 0:foo();break;case 1:default:bar()}

  // New output (with --minify)
  x===0?foo():bar();
  ```

- Forbid `using` declarations inside `switch` clauses
([#&#8203;4323](https://redirect.github.com/evanw/esbuild/issues/4323))

This is a rare change to remove something that was previously possible.
The [Explicit Resource
Management](https://redirect.github.com/tc39/proposal-explicit-resource-management)
proposal introduced `using` declarations. These were previously allowed
inside `case` and `default` clauses in `switch` statements. This had
well-defined semantics and was already widely implemented (by V8,
SpiderMonkey, TypeScript, esbuild, and others). However, it was
considered to be too confusing because of how scope works in switch
statements, so it has been removed from the specification. This edge
case will now be a syntax error. See
[tc39/proposal-explicit-resource-management#215](https://redirect.github.com/tc39/proposal-explicit-resource-management/issues/215)
and
[rbuckton/ecma262#14](https://redirect.github.com/rbuckton/ecma262/pull/14)
for details.

  Here is an example of code that is no longer allowed:

  ```js
  switch (mode) {
    case 'read':
      using readLock = db.read()
      return readAll(readLock)

    case 'write':
      using writeLock = db.write()
      return writeAll(writeLock)
  }
  ```

That code will now have to be modified to look like this instead (note
the additional `{` and `}` block statements around each case body):

  ```js
  switch (mode) {
    case 'read': {
      using readLock = db.read()
      return readAll(readLock)
    }
    case 'write': {
      using writeLock = db.write()
      return writeAll(writeLock)
    }
  }
  ```

This is not being released in one of esbuild's breaking change releases
since this feature hasn't been finalized yet, and esbuild always tracks
the current state of the specification (so esbuild's previous behavior
was arguably incorrect).

###
[`v0.27.1`](https://redirect.github.com/evanw/esbuild/releases/tag/v0.27.1)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.0...v0.27.1)

- Fix bundler bug with `var` nested inside `if`
([#&#8203;4348](https://redirect.github.com/evanw/esbuild/issues/4348))

This release fixes a bug with the bundler that happens when importing an
ES module using `require` (which causes it to be wrapped) and there's a
top-level `var` inside an `if` statement without being wrapped in a `{
... }` block (and a few other conditions). The bundling transform needed
to hoist these `var` declarations outside of the lazy ES module wrapper
for correctness. See the issue for details.

- Fix minifier bug with `for` inside `try` inside label
([#&#8203;4351](https://redirect.github.com/evanw/esbuild/issues/4351))

This fixes an old regression from [version
v0.21.4](https://redirect.github.com/evanw/esbuild/releases/v0.21.4).
Some code was introduced to move the label inside the `try` statement to
address a problem with transforming labeled `for await` loops to avoid
the `await` (the transformation involves converting the `for await` loop
into a `for` loop and wrapping it in a `try` statement). However, it
introduces problems for cross-compiled JVM code that uses all three of
these features heavily. This release restricts this transform to only
apply to `for` loops that esbuild itself generates internally as part of
the `for await` transform. Here is an example of some affected code:

  ```js
  // Original code
  d: {
    e: {
      try {
        while (1) { break d }
      } catch { break e; }
    }
  }

  // Old output (with --minify)
  a:try{e:for(;;)break a}catch{break e}

  // New output (with --minify)
  a:e:try{for(;;)break a}catch{break e}
  ```

- Inline IIFEs containing a single expression
([#&#8203;4354](https://redirect.github.com/evanw/esbuild/issues/4354))

Previously inlining of IIFEs (immediately-invoked function expressions)
only worked if the body contained a single `return` statement. Now it
should also work if the body contains a single expression statement
instead:

  ```js
  // Original code
  const foo = () => {
    const cb = () => {
      console.log(x())
    }
    return cb()
  }

  // Old output (with --minify)
  const foo=()=>(()=>{console.log(x())})();

  // New output (with --minify)
  const foo=()=>{console.log(x())};
  ```

- The minifier now strips empty `finally` clauses
([#&#8203;4353](https://redirect.github.com/evanw/esbuild/issues/4353))

This improvement means that `finally` clauses containing dead code can
potentially cause the associated `try` statement to be removed from the
output entirely in minified builds:

  ```js
  // Original code
  function foo(callback) {
    if (DEBUG) stack.push(callback.name);
    try {
      callback();
    } finally {
      if (DEBUG) stack.pop();
    }
  }

  // Old output (with --minify --define:DEBUG=false)
  function foo(a){try{a()}finally{}}

  // New output (with --minify --define:DEBUG=false)
  function foo(a){a()}
  ```

- Allow tree-shaking of the `Symbol` constructor

With this release, calling `Symbol` is now considered to be side-effect
free when the argument is known to be a primitive value. This means
esbuild can now tree-shake module-level symbol variables:

  ```js
  // Original code
  const a = Symbol('foo')
  const b = Symbol(bar)

  // Old output (with --tree-shaking=true)
  const a = Symbol("foo");
  const b = Symbol(bar);

  // New output (with --tree-shaking=true)
  const b = Symbol(bar);
  ```

###
[`v0.27.0`](https://redirect.github.com/evanw/esbuild/releases/tag/v0.27.0)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.26.0...v0.27.0)

**This release deliberately contains backwards-incompatible changes.**
To avoid automatically picking up releases like this, you should either
be pinning the exact version of `esbuild` in your `package.json` file
(recommended) or be using a version range syntax that only accepts patch
upgrades such as `^0.26.0` or `~0.26.0`. See npm's documentation about
[semver](https://docs.npmjs.com/cli/v6/using-npm/semver/) for more
information.

- Use `Uint8Array.fromBase64` if available
([#&#8203;4286](https://redirect.github.com/evanw/esbuild/issues/4286))

With this release, esbuild's `binary` loader will now use the new
[`Uint8Array.fromBase64`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64)
function unless it's unavailable in the configured target environment.
If it's unavailable, esbuild's previous code for this will be used as a
fallback. Note that this means you may now need to specify `target` when
using this feature with Node (for example `--target=node22`) unless
you're using Node v25+.

- Update the Go compiler from v1.23.12 to v1.25.4
([#&#8203;4208](https://redirect.github.com/evanw/esbuild/issues/4208),
[#&#8203;4311](https://redirect.github.com/evanw/esbuild/pull/4311))

  This raises the operating system requirements for running esbuild:

  - Linux: now requires a kernel version of 3.2 or later
  - macOS: now requires macOS 12 (Monterey) or later

###
[`v0.26.0`](https://redirect.github.com/evanw/esbuild/releases/tag/v0.26.0)

[Compare
Source](https://redirect.github.com/evanw/esbuild/compare/v0.25.12...v0.26.0)

- Enable trusted publishing
([#&#8203;4281](https://redirect.github.com/evanw/esbuild/issues/4281))

GitHub and npm are recommending that maintainers for packages such as
esbuild switch to [trusted
publishing](https://docs.npmjs.com/trusted-publishers). With this
release, a VM on GitHub will now build and publish all of esbuild's
packages to npm instead of me. In theory.

Unfortunately there isn't really a way to test that this works other
than to do it live. So this release is that live test. Hopefully this
release is uneventful and is exactly the same as the previous one (well,
except for the green provenance attestation checkmark on npm that
happens with trusted publishing).

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMjUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEyNS4xIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-07 02:12:30 +08:00
2026-08-11 03:09:54 +08:00
2026-09-20 13:01:49 +08:00
2026-09-20 13:01:49 +08:00
2026-02-06 19:49:02 +08:00
2023-07-10 06:19:59 +00:00
2026-08-11 03:09:54 +08:00
2023-05-03 00:47:43 -05:00
2025-12-29 19:08:49 +08:00
2023-09-15 07:50:00 +00:00
2026-07-15 13:25:57 +08:00

AFFiNE.Pro
Write, Draw and Plan All at Once

affine logo

A privacy-focused, local-first, open-source, and ready-to-use alternative for Notion & Miro.
One hyper-fused platform for wildly creative minds.



AFFiNE - One app for all - Where Notion meets Miro | Product Hunt


Releases All Contributors TypeScript-version-icon


Docs, canvas and tables are hyper-merged with AFFiNE - just like the word affine (əˈfʌɪn | a-fine).

Getting started & staying tuned with us.

Star us, and you will receive all release notifications from GitHub without any delay!

What is AFFiNE

AFFiNE is an open-source, all-in-one workspace and an operating system for all the building blocks that assemble your knowledge base and much more -- wiki, knowledge management, presentation and digital assets. It's a better alternative to Notion and Miro.

Features

A true canvas for blocks in any form. Docs and whiteboard are now fully merged.

  • Many editor apps claim to be a canvas for productivity, but AFFiNE is one of the very few which allows you to put any building block on an edgeless canvas -- rich text, sticky notes, any embedded web pages, multi-view databases, linked pages, shapes and even slides. We have it all.

Multimodal AI partner ready to kick in any work

  • Write up professional work report? Turn an outline into expressive and presentable slides? Summary an article into a well-structured mindmap? Sorting your job plan and backlog for tasks? Or... draw and code prototype apps and web pages directly all with one prompt? With you, AFFiNE AI pushes your creativity to the edge of your imagination, just like Canvas AI to generate mind map for brainstorming.

Local-first & Real-time collaborative

  • We love the idea of local-first that you always own your data on your disk, in spite of the cloud. Furthermore, AFFiNE supports real-time sync and collaborations on web and cross-platform clients.

Self-host & Shape your own AFFiNE

  • You have the freedom to manage, self-host, fork and build your own AFFiNE. Plugin community and third-party blocks are coming soon. More tractions on Blocksuite. Check there to learn how to self-host AFFiNE.

Acknowledgement

“We shape our tools and thereafter our tools shape us”. A lot of pioneers have inspired us along the way, e.g.:

  • Quip & Notion with their great concept of “everything is a block”
  • Trello with their Kanban
  • Airtable & Miro with their no-code programmable datasheets
  • Miro & Whimiscal with their edgeless visual whiteboard
  • Remote & Capacities with their object-based tag system

There is a large overlap of their atomic “building blocks” between these apps. They are not open source, nor do they have a plugin system like Vscode for contributors to customize. We want to have something that contains all the features we love and also goes one step even further.

Thanks for checking us out, we appreciate your interest and sincerely hope that AFFiNE resonates with you! 🎵 Checking https://affine.pro/ for more details ions.

Contributing

Bug Reports Feature Requests Questions/Discussions AFFiNE Community
Create a bug report Submit a feature request Check GitHub Discussion Visit the AFFiNE's Discord
Something isn't working as expected An idea for a new feature, or improvements Discuss and ask questions A place to ask, learn and engage with others

Calling all developers, testers, tech writers and more! Contributions of all types are more than welcome, you can read more in docs/types-of-contributions.md. If you are interested in contributing code, read our docs/CONTRIBUTING.md and feel free to check out our GitHub issues to get stuck in to show us what you’re made of.

Before you start contributing, please sign our Contributor License Agreement — it takes less than a minute with your GitHub account. Pull requests cannot be merged until every committer has signed (the license/cla check on your PR). Full text: CLA.md.

For bug reports, feature requests and other suggestions you can also create a new issue and choose the most appropriate template for your feedback.

For translation and language support you can visit our Discord.

If you have questions, you are welcome to contact us. One of the best places to get more info and learn more is in the Discord where you can engage with other like-minded individuals.

Templates

AFFiNE now provides pre-built templates from our team. Following are the Top 10 most popular templates among AFFiNE users,if you want to contribute, you can contribute your own template so other people can use it too.

Blog

Welcome to the AFFiNE blog section! Here, you’ll find the latest insights, tips, and guides on how to maximize your experience with AFFiNE and AFFiNE AI, the leading Canvas AI tool for flexible note-taking and creative organization.

Ecosystem

Name
@affine/component AFFiNE Component Resources
@toeverything/theme AFFiNE theme

Upstreams

We would also like to give thanks to open-source projects that make AFFiNE possible:

  • Blocksuite - 💠 BlockSuite is the open-source collaborative editor project behind AFFiNE.

  • y-octo - 🐙 y-octo is a native, high-performance, thread-safe YJS CRDT implementation, serving as the core engine enabling the AFFiNE Client/Server to achieve "local-first" functionality.

  • OctoBase - 🐙 OctoBase is the open-source database behind AFFiNE, local-first, yet collaborative. A light-weight, scalable, data engine written in Rust.

  • yjs - Fundamental support of CRDTs for our implementation on state management and data sync on web.

  • electron - Build cross-platform desktop apps with JavaScript, HTML, and CSS.

  • React - The library for web and native user interfaces.

  • napi-rs - A framework for building compiled Node.js add-ons in Rust via Node-API.

  • Jotai - Primitive and flexible state management for React.

  • async-call-rpc - A lightweight JSON RPC client & server.

  • Vite - Next generation frontend tooling.

  • Other upstream dependencies.

Thanks a lot to the community for providing such powerful and simple libraries, so that we can focus more on the implementation of the product logic, and we hope that in the future our projects will also provide a more easy-to-use knowledge base for everyone.

Contributors

We would like to express our gratitude to all the individuals who have already contributed to AFFiNE! If you have any AFFiNE-related project, documentation, tool or template, please feel free to contribute it by submitting a pull request to our curated list on GitHub: awesome-affine.

contributors

Self-Host

Begin with Docker to deploy your own feature-rich, unrestricted version of AFFiNE. Our team is diligently updating to the latest version. For more information on how to self-host AFFiNE, please refer to our documentation.

Deploy to Render

Run on Sealos

Feature Request

For feature requests, please see discussions.

Building

Codespaces

From the GitHub repo main page, click the green "Code" button and select "Create codespace on master". This will open a new Codespace with the (supposedly auto-forked AFFiNE repo cloned, built, and ready to go).

Local

See BUILDING.md for instructions on how to build AFFiNE from source code.

Contributing

We welcome contributions from everyone. See docs/contributing/tutorial.md for details.

License

Editions

  • AFFiNE Community Edition (CE) is the current available version, it's free for self-host under the MIT license.

  • AFFiNE Enterprise Edition (EE) is yet to be published, it will have more advanced features and enterprise-oriented offerings, including but not exclusive to rebranding and SSO, advanced admin and audit, etc., you may refer to https://affine.pro/pricing for more information

See LICENSE for details.

Languages
TypeScript 81.1%
Rust 11.9%
Swift 4.7%
Kotlin 1.1%
JavaScript 0.4%
Other 0.6%