Commit graph

4469 commits

Author SHA1 Message Date
overlookmotel
c04b9aa5db fix(transformer): add to SymbolTable::declarations for all symbols (#4460)
`declarations` field of `SymbolTable` is part of the SoA group field. For it to be valid to index into with `SymbolId`, an entry must be added for every new symbol which is created.
2024-07-26 00:14:29 +00:00
overlookmotel
a49f4915de refactor(semantic): re-order SymbolTable fields (#4459)
Group the fields which are SoA indexed by `ScopeId` together.
2024-07-25 14:38:36 +00:00
Dunqing
e4ca06ae8c
fix(semantic): incorrect symbol’s scope_id after var hoisting (#4458)
Bug found in https://github.com/rolldown/rolldown/pull/1726
2024-07-25 21:12:26 +08:00
Boshen
e1ca4122d8 chore(codegen): port over esbuild codegen tests (all ignored right now) (#4457) 2024-07-25 10:00:34 +00:00
Dunqing
aaee07e170 feat(ast): add AstKind::AssignmentTargetPattern, AstKind::ArrayAssignmentTarget and AstKind::ObjectAssignmentTarget (#4456)
close: #4435
2024-07-25 09:32:33 +00:00
cinchen
e3b0c4066a
feat(linter): eslint-plugin-vitest/no-identical-title (#4422)
support
[eslint-plugin-vitest/no-identical-title](https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md)

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-07-25 00:24:19 -04:00
Dunqing
855f2f6286
fix(website): incorrect reference displayed (#4453)
close: #4447
2024-07-24 23:13:18 -04:00
Don Isaac
77bd5f102c
fix(semantic): use correct span for namespace symbols (#4448)
Before:
```ts
    namespace N {}
// ---------------
```

After:
```ts
    namespace N {}
//            -
```

Found while working on #4427
2024-07-25 09:43:06 +08:00
Dunqing
7cd53f3897 refactor(semantic): var hoisting (#4379)
close: #4323

This PR refactors the var hoisting logic to avoid inserting the same symbol into every scope that can be hosted.
2024-07-25 00:55:02 +00:00
DonIsaac
fd363d1c8b feat(ast): add AstKind::get_container_scope_id (#4450)
Part of #4445
2024-07-25 00:51:00 +00:00
DonIsaac
871b3d6135 docs(semantic): add doc comments for SymbolTester and SemanticTester (#4433) 2024-07-24 16:58:13 +00:00
DonIsaac
4f5a7cbf3c refactor(semantic): mark SemanticTester and SymbolTester as must_use (#4430) 2024-07-24 16:58:11 +00:00
DonIsaac
4b274a8e6f test(semantic): add more test cases for symbol references (#4429) 2024-07-24 16:58:09 +00:00
overlookmotel
9c5d2f9d6a refactor(ast/builder): use Box::new_in over .into_in (#4428)
In `AstBuilder`'s `alloc_*` methods, use `Box::new_in` instead of `.into_in`. This is more explicit, so I feel easier to understand. It may also make life easier for compiler by not requiring it to perform type coercion.
2024-07-24 16:34:32 +00:00
Dunqing
46cf7179a4 chore(semantic): fix incorrect reference id in snapshot (#4441) 2024-07-24 12:51:57 +00:00
oxc-bot
aa56eb4d1d
Release crates v0.22.0 (#4434)
## [0.22.0] - 2024-07-23

- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329)
(Dunqing)

- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364) (Dunqing)

### Features

- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309)
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357)
(Jaden Rodriguez)
- 68efcd4 linter/react-perf: Handle new objects and arrays in prop
assignment patterns (#4396) (DonIsaac)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407)
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334) (DonIsaac)

### Bug Fixes

- aece1df ast: Visit `Program`s `hashbang` field first (#4368)
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374)
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350) (Boshen)
- ac08de8 linter/react_perf: Allow new objects, array, fns, etc in top
scope (#4395) (DonIsaac)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352) (DonIsaac)

### Performance

- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384)
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361)
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356)
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377) (DonIsaac)

### Refactor

- 504daed allocator: Rename fn params for `Box::new_in` (#4431)
(overlookmotel)
- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376)
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375)
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289)
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346)
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371) (rzvxa)
- 0e1ea90 isolated-declarations: Remove useless code from scope (#4420)
(Dunqing)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370)
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369)
(overlookmotel)
- 729b288 semantic: Shorten code (#4358) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336)
(DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-07-24 08:23:27 +08:00
DonIsaac
e8071e3db4 feat(syntax): add boolean check methods for typescript-related symbol flags (#4426) 2024-07-23 22:23:08 +00:00
overlookmotel
0677a91e14 refactor(allocator): make Box::new_in code more explicit (#4432)
Replace `.into` with `NonNull::from`. I feel this is a bit clearer.
2024-07-23 15:41:31 +00:00
overlookmotel
504daeda24 refactor(allocator): rename fn params for Box::new_in (#4431)
Rename function params for `Box::new_in` to be more descriptive and match our naming conventions.
2024-07-23 15:24:30 +00:00
Boshen
9e301755ea
ci: pass secret to reusable workflow 2024-07-23 22:50:50 +08:00
Boshen
4246a21c6d
ci: run cargo check before cargo release-oxc 2024-07-23 22:25:40 +08:00
Boshen
52f65e976d
ci: remove top level env 2024-07-23 22:24:10 +08:00
Boshen
f005416bc3
ci: run cargo check in prepare_release_crates 2024-07-23 22:18:46 +08:00
Boshen
fb15a19040
chore: fix cyclic dependencies by moving mangler tests to oxc_minifier 2024-07-23 22:13:13 +08:00
Boshen
6beef7414c
ci: add check job (publish --dry-run) in prepare_release_crates 2024-07-23 22:05:21 +08:00
Boshen
269151d7f0
ci: use bot account with PAT in reusable_prepare_release 2024-07-23 22:01:41 +08:00
cinchen
c9367820ef
feat(linter): eslint-plugin-vitest/no-conditional-expect (#4425)
support
[eslint-plugin-vitest/no-conditional-expect](https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md)
2024-07-23 21:50:45 +08:00
cinchen
27fdd69448
feat(linter): eslint-plugin-vitest/no-commented-out-tests (#4424) 2024-07-23 08:52:39 -04:00
Dunqing
0e1ea90282 refactor(isolated-declarations): remove useless code from scope (#4420)
The original logic was written to fix incorrect TypeScript ast scopes. Now the scopes are correct so they can be removed
2024-07-23 09:39:16 +00:00
Dunqing
25dab7b1ac
Revert "chore: fix failed publish caused by cyclic dev dependencies " (#4419)
Reverts oxc-project/oxc#4416

This trick doesn't work for crates that have circular dependencies on
each other that all need to be published!
2024-07-23 15:56:42 +08:00
Dunqing
426016d1d6
Revert "Release crates v0.22.0" (#4418)
Still release failed. Reverts oxc-project/oxc#4417
2024-07-23 15:51:01 +08:00
github-actions[bot]
f76113cd8f
Release crates v0.22.0 (#4417)
## [0.22.0] - 2024-07-23

- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329)
(Dunqing)

- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364) (Dunqing)

### Features

- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309)
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357)
(Jaden Rodriguez)
- 68efcd4 linter/react-perf: Handle new objects and arrays in prop
assignment patterns (#4396) (DonIsaac)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407)
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334) (DonIsaac)

### Bug Fixes

- aece1df ast: Visit `Program`s `hashbang` field first (#4368)
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374)
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350) (Boshen)
- ac08de8 linter/react_perf: Allow new objects, array, fns, etc in top
scope (#4395) (DonIsaac)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352) (DonIsaac)

### Performance

- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384)
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361)
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356)
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377) (DonIsaac)

### Refactor

- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376)
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375)
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289)
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346)
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371) (rzvxa)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370)
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369)
(overlookmotel)
- 729b288 semantic: Shorten code (#4358) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336)
(DonIsaac)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-23 13:24:08 +08:00
IWANABETHATGUY
01f33cfe1c
chore: fix failed publish caused by cyclic dev dependencies (#4416)
1. This looks like caused by
https://github.com/rust-lang/cargo/issues/4242

## Ref
1. https://github.com/rust-lang/futures-rs/pull/2305
2024-07-23 13:10:53 +08:00
Dunqing
c1cf0e6dd9
Revert "Release crates v0.22.0" (#4415)
Reverts oxc-project/oxc#4414
2024-07-23 09:59:38 +08:00
DonIsaac
68efcd4000 feat(linter/react-perf): handle new objects and arrays in prop assignment patterns (#4396)
# What This PR Does

Massively improves all `react-perf` rules
- feat: handle new objects/etc assigned to variables
```tsx
const Foo = () => {
  const x = { foo: 'bar' } // <- now reports this new object
  return <Bar x={x} />
}
```
- feat: handle new objects/etc in binding patterns
```tsx
const Foo = ({ x = [] }) => {
  //           ^^^^^^ now reports this new array
  return <Bar x={x} />
}
```
-feat: nice and descriptive labels for new objects/etc assigned to intermediate variables
```
  ⚠ eslint-plugin-react-perf(jsx-no-new-object-as-prop): JSX attribute values should not contain objects created in the same scope.
   ╭─[jsx_no_new_object_as_prop.tsx:1:27]
 1 │ const Foo = () => { const x = {}; return <Bar x={x} /> }
   ·                           ┬   ─┬                 ┬
   ·                           │    │                 ╰── And used here
   ·                           │    ╰── And assigned a new value here
   ·                           ╰── The prop was declared here
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).
```
- feat: consider `Object.assign()` and `Object.create()` as a new object
- feat: consider `arr.[map, filter, concat]` as a new array
- refactor: move shared implementation code to `ReactPerfRule` in `oxc_linter::utils::react_perf`
2024-07-23 01:52:59 +00:00
DonIsaac
ac08de817e fix(linter/react_perf): allow new objects, array, fns, etc in top scope (#4395)
Consider the following code:
```tsx
import { FC } from 'react'
import { SvgIcon } from '@mui/material'

const StyledIcon = <SvgIcon sx={{ padding: 1, color: '#ff0000' }} />
//          reported violation  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
export const MyComponent: FC = () => {
    return (
        <div>
            {StyledIcon}
            {/* ... */}
        </div>
    )
}
```

This should not be a violation since the JSX is pre-computed and re-used, which
does not break React's `Object.is()` checks.
2024-07-23 01:39:07 +00:00
github-actions[bot]
00c7b7dad4
Release crates v0.22.0 (#4414)
## [0.22.0] - 2024-07-22

- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329)
(Dunqing)

- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364) (Dunqing)

### Features

- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309)
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357)
(Jaden Rodriguez)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407)
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334) (DonIsaac)

### Bug Fixes

- aece1df ast: Visit `Program`s `hashbang` field first (#4368)
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374)
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350) (Boshen)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352) (DonIsaac)

### Performance

- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384)
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361)
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356)
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377) (DonIsaac)

### Refactor

- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376)
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375)
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289)
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346)
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371) (rzvxa)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370)
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369)
(overlookmotel)
- 729b288 semantic: Shorten code (#4358) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336)
(DonIsaac)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-23 09:38:03 +08:00
Dunqing
85a7cea9d1 refactor(semantic)!: remove name from reference (#4329)
related to: https://github.com/oxc-project/backlog/issues/32
2024-07-22 15:59:23 +00:00
Boshen
e33ec18d78 feat(minifier): compress typeof foo == "undefined" into typeof foo > "u" (#4412)
```
> monitor-oxc@ test /home/runner/work/monitor-oxc/monitor-oxc
> node src/main.test.mjs

/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.development.js:2375
		if (void 0 === __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1;
		^

ReferenceError: __REACT_DEVTOOLS_GLOBAL_HOOK__ is not defined
    at injectInternals (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.development.js:2375:3)
```
2024-07-22 12:44:33 +00:00
Boshen
267f7c4398
fix(minifier): skip Object.defineProperty(exports, ...) for cjs-module-lexer (#4409)
```
> monitor-oxc@ test /home/runner/work/monitor-oxc/monitor-oxc
> node src/main.test.mjs

file:///home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/inquirer@[10](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:11).0.1/node_modules/inquirer/dist/esm/ui/prompt.mjs:2
import { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } from "rxjs";
                ^^^^^
SyntaxError: Named export 'EMPTY' not found. The requested module 'rxjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'rxjs';
const { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:[12](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:13)3:5)

Node.js v20.15.1
```

Export is undefined when `enumerable` is "!0".
See `https://github.com/nodejs/cjs-module-lexer/issues/64`
2024-07-22 20:32:15 +08:00
Dunqing
1b51511bb6 perf(semantic): use Atom instead of CompactStr for UnresolvedReferencesStack (#4401)
related: #4394

The `UnresolvedReferencesStack` is only used for resolving references, and the `Atom` clone is cheap, So we can safely change `CompactStr`to `Atom`
2024-07-22 12:18:37 +00:00
overlookmotel
bc8d4e5876 fix(semantic): correct comment (#4410)
Correct a code comment.
2024-07-22 12:14:33 +00:00
Boshen
0deb027e6b
feat(minfier): dce if (xxx) else if (false) { REMOVE } (#4407) 2024-07-22 19:57:35 +08:00
overlookmotel
d79b60afc4 example(semantic): examples print parser errors (#4405)
Examples for `Semantic` print parser errors if parsing fails.
2024-07-22 11:05:03 +00:00
Dunqing
40f93564ac perf(semantic): calculate number of nodes, scopes, symbols, references before visiting AST (#4367)
context: #4328
2024-07-22 10:47:54 +00:00
renovate[bot]
910f2a0a0a
chore(deps): update rust crate handlebars to v6 (#4402)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [handlebars](https://togithub.com/sunng87/handlebars-rust) |
workspace.dependencies | major | `5.1.2` -> `6.0.0` |

---

### Release Notes

<details>
<summary>sunng87/handlebars-rust (handlebars)</summary>

###
[`v6.0.0`](https://togithub.com/sunng87/handlebars-rust/blob/HEAD/CHANGELOG.md#600---2024-07-20)

[Compare
Source](https://togithub.com/sunng87/handlebars-rust/compare/v5.1.2...v6.0.0)

- \[Fixed] Various indent issue with partials, empty lines and helpers
\[[#&#8203;646](https://togithub.com/sunng87/handlebars-rust/issues/646)]

\[[#&#8203;654](https://togithub.com/sunng87/handlebars-rust/issues/654)]
\[[#&#8203;658](https://togithub.com/sunng87/handlebars-rust/issues/658)]
- \[Fixed] Bug when accessing nested path
\[[#&#8203;651](https://togithub.com/sunng87/handlebars-rust/issues/651)]
- \[Added] New public access to `PathSeg`
\[[#&#8203;656](https://togithub.com/sunng87/handlebars-rust/issues/656)]
- \[Added] New API to set single block params in `BlockContext`
\[[#&#8203;655](https://togithub.com/sunng87/handlebars-rust/issues/655)]
- \[Added] `From<RenderError>` for `RenderErrorReason`
\[[#&#8203;644](https://togithub.com/sunng87/handlebars-rust/issues/644)]
- \[Changed] Add `non_exhaustive` attribute to all public memebers
\[[#&#8203;647](https://togithub.com/sunng87/handlebars-rust/issues/647)]
- \[Changed] `RenderContext` API and improved performance for partial
rendering

\[[#&#8203;661](https://togithub.com/sunng87/handlebars-rust/issues/661)]
\[[#&#8203;662](https://togithub.com/sunng87/handlebars-rust/issues/662)]
- \[Changed] Improved error messsage for template parsing
\[[#&#8203;638](https://togithub.com/sunng87/handlebars-rust/issues/638)]

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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 has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-22 05:04:02 +00:00
renovate[bot]
21c7b090dd
chore(deps): update pnpm to v9.6.0 (#4400)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pnpm](https://pnpm.io) ([source](https://togithub.com/pnpm/pnpm)) |
[`9.5.0` -> `9.6.0`](https://renovatebot.com/diffs/npm/pnpm/9.5.0/9.6.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.5.0/9.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.5.0/9.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pnpm/pnpm (pnpm)</summary>

### [`v9.6.0`](https://togithub.com/pnpm/pnpm/releases/tag/v9.6.0): pnpm
9.6

[Compare Source](https://togithub.com/pnpm/pnpm/compare/v9.5.0...v9.6.0)

#### Minor Changes

- Support specifying node version (via `pnpm.executionEnv.nodeVersion`
in `package.json`) for running lifecycle scripts per each package in a
workspace [#&#8203;6720](https://togithub.com/pnpm/pnpm/issues/6720).
- Overrides now support the [`catalogs:`
protocol](https://pnpm.io/catalogs)
[#&#8203;8303](https://togithub.com/pnpm/pnpm/issues/8303).

#### Patch Changes

- The `pnpm deploy` command now supports the [`catalog:`
protocol](https://pnpm.io/catalogs)
[#&#8203;8298](https://togithub.com/pnpm/pnpm/pull/8298).
- The `pnpm outdated` command now supports the [`catalog:`
protocol](https://pnpm.io/catalogs)
[#&#8203;8304](https://togithub.com/pnpm/pnpm/pull/8304).
- Correct the error message when trying to run `pnpm patch` without
`node_modules/.modules.yaml`
[#&#8203;8257](https://togithub.com/pnpm/pnpm/issues/8257).
- Silent reporting fixed with the `pnpm exec` command
[#&#8203;7608](https://togithub.com/pnpm/pnpm/issues/7608).
- Add registries information to the calculation of dlx cache hash
[#&#8203;8299](https://togithub.com/pnpm/pnpm/pull/8299).

#### Platinum Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://bit.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/bit.svg"
width="80"></a>
      </td>
      <td align="center" valign="middle">
<a href="https://figma.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/figma.svg"
width="80"></a>
      </td>
    </tr>
  </tbody>
</table>

#### Gold Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://discord.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/discord.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/discord_light.svg" />
<img src="https://pnpm.io/img/users/discord.svg" width="220" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://prisma.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/prisma.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/prisma_light.svg" />
<img src="https://pnpm.io/img/users/prisma.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://uscreen.de/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/uscreen.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/uscreen_light.svg" />
<img src="https://pnpm.io/img/users/uscreen.svg" width="180" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://www.jetbrains.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<img src="https://pnpm.io/img/users/jetbrains.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://nx.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/nx.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/nx_light.svg" />
            <img src="https://pnpm.io/img/users/nx.svg" width="120" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://coderabbit.ai/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/coderabbit.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/coderabbit_light.svg" />
<img src="https://pnpm.io/img/users/coderabbit.svg" width="220" />
          </picture>
        </a>
      </td>
    </tr>
  </tbody>
</table>

#### Our Silver Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a
href="https://leniolabs.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <img src="https://pnpm.io/img/users/leniolabs.jpg" width="80">
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://vercel.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/vercel.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/vercel_light.svg" />
<img src="https://pnpm.io/img/users/vercel.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://depot.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/depot.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/depot_light.svg" />
<img src="https://pnpm.io/img/users/depot.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://moonrepo.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/moonrepo.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/moonrepo_light.svg" />
<img src="https://pnpm.io/img/users/moonrepo.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://devowl.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<img src="https://pnpm.io/img/users/devowlio.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://macpaw.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/macpaw.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/macpaw_light.svg" />
<img src="https://pnpm.io/img/users/macpaw.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://cerbos.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/cerbos.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/cerbos_light.svg" />
<img src="https://pnpm.io/img/users/cerbos.svg" width="180" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://vpsserver.com/en-us/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
<img src="https://pnpm.io/img/users/vpsserver.svg" width="180" />
        </a>
      </td>
    </tr>
  </tbody>
</table>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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 has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-22 02:21:31 +00:00
renovate[bot]
79eb662f3f
chore(deps): update rust crates (#4399)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[json-strip-comments](https://togithub.com/oxc-project/json-strip-comments)
| workspace.dependencies | patch | `1.0.2` -> `1.0.4` |
| [oxc_resolver](https://togithub.com/oxc-project/oxc-resolver) |
workspace.dependencies | patch | `1.10.0` -> `1.10.2` |
| [similar](https://togithub.com/mitsuhiko/similar) |
workspace.dependencies | minor | `2.5.0` -> `2.6.0` |
| [tokio](https://tokio.rs)
([source](https://togithub.com/tokio-rs/tokio)) | workspace.dependencies
| patch | `1.38.0` -> `1.38.1` |

---

### Release Notes

<details>
<summary>oxc-project/oxc-resolver (oxc_resolver)</summary>

###
[`v1.10.2`](https://togithub.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#1102---2024-07-16)

[Compare
Source](https://togithub.com/oxc-project/oxc-resolver/compare/oxc_resolver-v1.10.1...oxc_resolver-v1.10.2)

##### Chore

-   Release FreeBSD

###
[`v1.10.1`](https://togithub.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#1101---2024-07-15)

[Compare
Source](https://togithub.com/oxc-project/oxc-resolver/compare/oxc_resolver-v1.10.0...oxc_resolver-v1.10.1)

##### Fixed

- resolve module `ipaddr.js` correctly when `extensionAlias` is provided
([#&#8203;228](https://togithub.com/oxc-project/oxc_resolver/pull/228))

</details>

<details>
<summary>mitsuhiko/similar (similar)</summary>

###
[`v2.6.0`](https://togithub.com/mitsuhiko/similar/blob/HEAD/CHANGELOG.md#260)

[Compare
Source](https://togithub.com/mitsuhiko/similar/compare/2.5.0...2.6.0)

- Bump bstr dependency to 1.5.
[#&#8203;69](https://togithub.com/mitsuhiko/similar/issues/69)

</details>

<details>
<summary>tokio-rs/tokio (tokio)</summary>

###
[`v1.38.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.38.1):
Tokio v1.38.1

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.38.0...tokio-1.38.1)

### 1.38.1 (July 16th, 2024)

This release fixes the bug identified as ([#&#8203;6682]), which caused
timers not
to fire when they should.

##### Fixed

- time: update `wake_up` while holding all the locks of sharded time
wheels ([#&#8203;6683])

[#&#8203;6682]: https://togithub.com/tokio-rs/tokio/pull/6682

[#&#8203;6683]: https://togithub.com/tokio-rs/tokio/pull/6683

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

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

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-22 00:05:23 +00:00
DonIsaac
289dc39865 fix(linter): overflow in no-obj-calls (#4397)
Closes #4389
2024-07-21 23:35:47 +00:00
renovate[bot]
c294833b12
chore(deps): update dependency @codemirror/view to v6.28.6 (#4398)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@codemirror/view](https://togithub.com/codemirror/view) | [`6.28.5`
->
`6.28.6`](https://renovatebot.com/diffs/npm/@codemirror%2fview/6.28.5/6.28.6)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@codemirror%2fview/6.28.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@codemirror%2fview/6.28.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@codemirror%2fview/6.28.5/6.28.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@codemirror%2fview/6.28.5/6.28.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>codemirror/view (@&#8203;codemirror/view)</summary>

###
[`v6.28.6`](https://togithub.com/codemirror/view/blob/HEAD/CHANGELOG.md#6286-2024-07-19)

[Compare
Source](https://togithub.com/codemirror/view/compare/6.28.5...6.28.6)

##### Bug fixes

Fix an issue where the editor got confused about the position of
inserted text when using Chrome's `EditContext` and canceling
transactions for typed text.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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 has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-21 22:54:42 +00:00