unplugin-oxc 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  - 🦾 **Powerful**: Supports TypeScript and React JSX transformation, identifier replacement, syntax lowering, and more.
11
11
  - 📦 **Zero Config**: No configuration needed for TypeScript support.
12
12
  - 🎨 **Customizable**: Fine-tune transform, resolve, and minify options.
13
- - 😈 **Drop-in Replacement**: Easily replace [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild).
13
+ - 😈 **Drop-in Replacement**: Easily replace [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild) and [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve).
14
14
 
15
15
  ## Installation
16
16
 
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/esbuild.ts
4
4
  /**
package/dist/farm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ interface Options {
31
31
  /**
32
32
  * Minify options passed to `oxc-minify`
33
33
  */
34
- minify?: Omit<MinifyOptions, "sourcemap"> | false;
34
+ minify?: Omit<MinifyOptions, "sourcemap"> | boolean;
35
35
  /**
36
36
  * Default: `true` on unloader, `false` on others.
37
37
  */
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  export { Oxc };
package/dist/rolldown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/rolldown.ts
4
4
  /**
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/rollup.ts
4
4
  /**
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/rspack.ts
4
4
  /**
@@ -27,7 +27,7 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
27
27
  const filter = createFilter(options.include, options.exclude);
28
28
  const renderChunk = options.minify !== false ? (code, chunk) => {
29
29
  const result = minify(chunk.fileName, code, {
30
- ...options.minify,
30
+ ...options.minify === true ? {} : options.minify,
31
31
  sourcemap: options.sourcemap
32
32
  });
33
33
  return {
@@ -42,15 +42,30 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
42
42
  if (!options.resolveNodeModules && id[0] !== "." && id[0] !== "/") return;
43
43
  const resolver = new ResolverFactory({
44
44
  extensions: [
45
+ ".mjs",
46
+ ".js",
45
47
  ".ts",
46
- ".mts",
47
- ".cts",
48
- ".tsx"
48
+ ".jsx",
49
+ ".tsx",
50
+ ".json",
51
+ ".node"
49
52
  ],
53
+ conditionNames: [
54
+ "import",
55
+ "require",
56
+ "browser",
57
+ "node",
58
+ "default"
59
+ ],
60
+ builtinModules: true,
50
61
  ...options.resolve
51
62
  });
52
63
  const directory = path.dirname(importer || id);
53
64
  const resolved = await resolver.async(directory, id);
65
+ if (resolved.error?.startsWith("Builtin module")) return {
66
+ id,
67
+ external: true
68
+ };
54
69
  if (resolved.path) return resolved.path;
55
70
  } : undefined,
56
71
  transformInclude(id) {
package/dist/unloader.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/unloader.ts
4
4
  /**
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/vite.ts
4
4
  /**
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-C7AaF2B_.js";
1
+ import { Oxc } from "./src-CFVXTEFR.js";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-oxc",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Oxc integration for unplugin.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -58,11 +58,11 @@
58
58
  "unloader": "*"
59
59
  },
60
60
  "dependencies": {
61
- "oxc-minify": "^0.49.0",
61
+ "oxc-minify": "^0.50.0",
62
62
  "oxc-resolver": "^4.0.0",
63
- "oxc-transform": "^0.49.0",
63
+ "oxc-transform": "^0.50.0",
64
64
  "unplugin": "^2.2.0",
65
- "unplugin-utils": "^0.2.3"
65
+ "unplugin-utils": "^0.2.4"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@sxzz/eslint-config": "^5.0.2",
@@ -70,7 +70,7 @@
70
70
  "@sxzz/test-utils": "^0.5.1",
71
71
  "@types/node": "^22.13.1",
72
72
  "bumpp": "^10.0.3",
73
- "eslint": "^9.20.0",
73
+ "eslint": "^9.20.1",
74
74
  "prettier": "^3.5.0",
75
75
  "rollup": "^4.34.6",
76
76
  "tsdown": "^0.5.9",