You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,41 @@
2
2
3
3
## Unreleased
4
4
5
+
* Fix printing of JavaScript decorators in tricky cases ([#3396](https://github.com/evanw/esbuild/issues/3396))
6
+
7
+
This release fixes some bugs where esbuild's pretty-printing of JavaScript decorators could incorrectly produced code with a syntax error. The problem happened because esbuild sometimes substitutes identifiers for other expressions in the pretty-printer itself, but the decision about whether to wrap the expression or not didn't account for this. Here are some examples:
8
+
9
+
```js
10
+
// Original code
11
+
import { constant } from'./constants.js'
12
+
import { imported } from'external'
13
+
import { undef } from'./empty.js'
14
+
classFoo {
15
+
@constant()
16
+
@imported()
17
+
@undef()
18
+
foo
19
+
}
20
+
21
+
// Old output (with --bundle --format=cjs --packages=external --minify-syntax)
22
+
var import_external =require("external");
23
+
var Foo =class {
24
+
@123()
25
+
@(0, import_external.imported)()
26
+
@(void0)()
27
+
foo;
28
+
};
29
+
30
+
// New output (with --bundle --format=cjs --packages=external --minify-syntax)
31
+
var import_external =require("external");
32
+
var Foo =class {
33
+
@(123())
34
+
@((0, import_external.imported)())
35
+
@((void0)())
36
+
foo;
37
+
};
38
+
```
39
+
5
40
* Allow pre-release versions to be passed to `target` ([#3388](https://github.com/evanw/esbuild/issues/3388))
6
41
7
42
People want to be able to pass version numbers for unreleased versions ofnode (which have extra stuff after the version numbers) to esbuild's `target` setting and have esbuild do something reasonable with them. These version strings are of course not present in esbuild's internal feature compatibility table because an unreleased version has not been released yet (by definition). Withthis release, esbuild will now attempt to accept these version strings passed to `target` and do something reasonable with them.
0 commit comments