Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ unctxPlugin.vite();
unctxPlugin.webpack();
```

Acorn is used by default. To use the experimental Oxc transform, install the
optional parser dependencies and select it in the plugin options:

```sh
pnpm add oxc-parser oxc-walker
```
Comment on lines +142 to +144

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Install the optional Oxc packages as dev dependencies.

These packages are only needed for the build-time transform, so pnpm add puts them in runtime dependencies unnecessarily.

Proposed fix
-pnpm add oxc-parser oxc-walker
+pnpm add -D oxc-parser oxc-walker
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```sh
pnpm add oxc-parser oxc-walker
```
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 142 - 144, The README install command is adding the
optional Oxc packages as runtime dependencies, but they should be installed as
dev dependencies for the build-time transform. Update the install instruction
that mentions oxc-parser and oxc-walker to use the dev-dependency form, and keep
the guidance aligned with their build-only usage.


```js
unctxPlugin.vite({ parser: "oxc" });
```

Use `ctx.callAsync` instead of `ctx.call`:

```js
Expand Down
8 changes: 7 additions & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ export default defineBuildConfig({
entries: [
{
type: "bundle",
input: ["src/index.ts", "src/transform.ts", "src/plugin.ts"],
input: [
"src/index.ts",
"src/transform.ts",
"src/transform/acorn.ts",
"src/transform/oxc.ts",
"src/plugin.ts",
],
},
],
});
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"exports": {
".": "./dist/index.mjs",
"./transform": "./dist/transform.mjs",
"./transform/acorn": "./dist/transform/acorn.mjs",
"./transform/oxc": "./dist/transform/oxc.mjs",
"./plugin": "./dist/plugin.mjs"
},
"types": "./dist/index.d.mts",
Expand All @@ -30,14 +32,29 @@
"magic-string": "^0.30.21",
"unplugin": "^2.3.11"
},
"peerDependencies": {
"oxc-parser": "^0.137.0",
"oxc-walker": "^1.0.0"
},
"peerDependenciesMeta": {
"oxc-parser": {
"optional": true
},
"oxc-walker": {
"optional": true
}
},
"devDependencies": {
"@types/estree": "^1.0.8",
"@types/node": "^25.0.2",
"@vitest/coverage-v8": "^4.0.16",
"changelogen": "^0.6.2",
"eslint": "^9.39.2",
"eslint-config-unjs": "^0.5.0",
"jiti": "^2.6.1",
"obuild": "^0.4.8",
"oxc-parser": "^0.137.0",
"oxc-walker": "^1.0.0",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"vitest": "^4.0.16"
Expand Down
Loading
Loading