Commit graph

17 commits

Author SHA1 Message Date
Boshen
cbaeea6d02 refactor(minifier): clean up some tests (#5910) 2024-09-20 05:55:05 +00:00
Boshen
144611ef49 refactor(minifier): align ast pass names with closure compiler (#5908) 2024-09-20 05:20:07 +00:00
Boshen
e968e9ffd0 feat(minifier): constant fold nullish coalescing operator (#5761) 2024-09-13 13:25:58 +00:00
Boshen
8ff013ada1 fix(minifier): handle dce CallExpression::callee (#5752) 2024-09-13 10:46:14 +00:00
Boshen
2890c98d62 refactor(minifier): add tests for remove_syntax (#5749) 2024-09-13 08:59:45 +00:00
Boshen
6bc13f6cd4 feat(minifier): add MinimizeConditions pass (#5747)
I expect small performance regression.

But managed to improve the following case from react.developmement.js

```
oxc  main ❯ diff before.js after.js
670c670
< 		if (!(dispatcher !== null)) throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
---
> 		if (dispatcher === null) throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
```
2024-09-13 08:31:45 +00:00
Boshen
746f7b3a02 refactor(minifier): align code with closure compiler (#5717)
also fixes #4341
2024-09-12 04:18:41 +00:00
Boshen
68c3cf544f feat(minifier): fold void 1 -> void 0 (#5670) 2024-09-10 08:11:10 +00:00
Boshen
c6bbf94f4c feat(minifier): constant fold unary expression (#5669) 2024-09-10 07:18:54 +00:00
Boshen
86256ea238 feat(minifier): constant fold typeof (#5666)
closes #5628
2024-09-10 04:43:00 +00:00
Boshen
ba4b68cf63 feat(minifier): remove parenthesized expression for dce (#5439)
relates #5436
2024-09-04 12:58:39 +00:00
Boshen
46cb1c1b7b fix(minifier): handle Object.definedPropert(exports for @babel/types/lib/index.js (#4933)
Discoverd in `monitor-oxc`

```javascript
Object.keys(_index6).forEach(function(key) {
	if (key === "default" || key === "__esModule") return;
	if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
	if (key in exports && exports[key] === _index6[key]) return;
	Object.defineProperty(exports, key, {
		enumerable: true,
		get: function() {
			return _index6[key];
		}
	});
});
```

🙃
2024-08-16 06:48:15 +00:00
Boshen
81fd6379e8 fix(minifier): do not fold 0 && (module.exports = {}) for cjs-module-lexer (#4878) 2024-08-13 12:54:59 +00:00
Boshen
879a271d47 fix(minifier): do not join require calls for cjs-module-lexer (#4875) 2024-08-13 12:21:37 +00:00
Boshen
fae8a62a62 fix(minifier): temporarily bail constant folding for tagged template (#4842)
closes #4341
2024-08-12 07:38:25 +00:00
Boshen
fbfd852cf8 refactor(minifier): add NodeUtil trait for accessing symbols on ast nodes (#4734) 2024-08-08 02:48:25 +00:00
Boshen
17602db6de
refactor(minifier): move tests and files around 2024-08-07 20:01:55 +08:00