unplugin-oxc 0.5.2 → 0.5.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © 2024-PRESENT 三咲智子 (https://github.com/sxzz)
3
+ Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -165,7 +165,7 @@ interface Options {
165
165
 
166
166
  ## License
167
167
 
168
- [MIT](./LICENSE) License © 2025-PRESENT [三咲智子](https://github.com/sxzz)
168
+ [MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz)
169
169
 
170
170
  <!-- Badges -->
171
171
 
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/esbuild.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/esbuild.ts
4
4
  /**
5
+ * This entry file is for esbuild plugin. Requires esbuild >= 0.15
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Esbuild plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/farm.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
5
+ * This entry file is for Farm plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Farm plugin
6
11
  *
7
12
  * @example
@@ -1,7 +1,6 @@
1
1
  import { NapiResolveOptions } from "oxc-resolver";
2
2
  import { TransformOptions } from "oxc-transform";
3
- import { UnpluginInstance } from "unplugin";
4
- import { FilterPattern } from "unplugin-utils";
3
+ import { FilterPattern, UnpluginInstance } from "unplugin";
5
4
  import { MinifyOptions } from "oxc-minify";
6
5
 
7
6
  //#region src/core/options.d.ts
@@ -42,4 +41,4 @@ interface Options {
42
41
  //#region src/index.d.ts
43
42
  declare const Oxc: UnpluginInstance<Options | undefined, false>;
44
43
  //#endregion
45
- export { Oxc };
44
+ export { Oxc as t };
@@ -0,0 +1,2 @@
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
+ export { Oxc };
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
+
3
+ export { Oxc };
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/rolldown.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/rolldown.ts
4
4
  /**
5
+ * This entry file is for Rolldown plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Rolldown plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/rollup.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/rollup.ts
4
4
  /**
5
+ * This entry file is for Rollup plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Rollup plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/rspack.ts
4
4
  /**
5
+ * This entry file is for Rspack plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Rspack plugin
6
11
  *
7
12
  * @example
@@ -4,8 +4,14 @@ import process from "node:process";
4
4
  import { ResolverFactory } from "oxc-resolver";
5
5
  import { transform } from "oxc-transform";
6
6
  import { createUnplugin } from "unplugin";
7
- import { createFilter } from "unplugin-utils";
8
7
 
8
+ //#region node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
9
+ function toArray(array) {
10
+ array = array ?? [];
11
+ return Array.isArray(array) ? array : [array];
12
+ }
13
+
14
+ //#endregion
9
15
  //#region src/core/options.ts
10
16
  function resolveOptions(options, framework) {
11
17
  return {
@@ -38,8 +44,7 @@ function getModuleFormat(id) {
38
44
  //#region src/index.ts
39
45
  const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
40
46
  const options = resolveOptions(rawOptions, framework);
41
- const filter = createFilter(options.include, options.exclude);
42
- const resolveId = options.resolve !== false ? (id, importer, resolveOptions$1) => {
47
+ const resolveId = options.resolve === false ? void 0 : (id, importer, resolveOptions$1) => {
43
48
  if (!options.resolveNodeModules && id[0] !== "." && !path.isAbsolute(id)) return;
44
49
  const resolver = new ResolverFactory({
45
50
  extensions: [
@@ -76,8 +81,8 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
76
81
  format
77
82
  };
78
83
  }
79
- } : void 0;
80
- const transform$1 = options.transform !== false ? (code, id, ...args) => {
84
+ };
85
+ const transform$1 = options.transform === false ? void 0 : (code, id, ...args) => {
81
86
  const [transformOptions] = args;
82
87
  const result = transform(id, code, {
83
88
  ...options.transform,
@@ -89,8 +94,8 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
89
94
  code: result.code,
90
95
  map: result.map
91
96
  };
92
- } : void 0;
93
- const renderChunk = options.minify !== false ? async (code, chunk) => {
97
+ };
98
+ const renderChunk = options.minify === false ? void 0 : async (code, chunk) => {
94
99
  const { minify } = await import("oxc-minify");
95
100
  const result = minify(chunk.fileName, code, {
96
101
  ...options.minify === true ? {} : options.minify,
@@ -100,23 +105,17 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
100
105
  code: result.code,
101
106
  map: result.map
102
107
  };
103
- } : void 0;
104
- return {
105
- name: "unplugin-oxc",
106
- enforce: options.enforce,
107
- resolveId,
108
- transformInclude(id) {
109
- return filter(id);
108
+ };
109
+ const unloader = {
110
+ options(config) {
111
+ config.sourcemap ||= options.sourcemap;
110
112
  },
111
- transform: transform$1,
112
- rollup: { renderChunk },
113
- rolldown: { renderChunk },
114
- vite: { renderChunk },
115
- unloader: {
116
- options(config) {
117
- config.sourcemap ||= options.sourcemap;
118
- },
119
- load(id) {
113
+ load: {
114
+ filter: { id: {
115
+ include: [/\.json$/, ...toArray(options.include)],
116
+ exclude: options.exclude
117
+ } },
118
+ handler(id) {
120
119
  if (id.endsWith(".json")) {
121
120
  let code = readFileSync(id, "utf8");
122
121
  const json = JSON.parse(code);
@@ -131,11 +130,26 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
131
130
  format: "module"
132
131
  };
133
132
  }
134
- if (!filter(id)) return;
135
133
  return readFileSync(id, "utf8");
136
134
  }
137
135
  }
138
136
  };
137
+ return {
138
+ name: "unplugin-oxc",
139
+ enforce: options.enforce,
140
+ resolveId,
141
+ transform: transform$1 ? {
142
+ filter: { id: {
143
+ include: options.include,
144
+ exclude: options.exclude
145
+ } },
146
+ handler: transform$1
147
+ } : void 0,
148
+ rollup: { renderChunk },
149
+ rolldown: { renderChunk },
150
+ vite: { renderChunk },
151
+ unloader
152
+ };
139
153
  });
140
154
  function guessSourceType(id, format) {
141
155
  if (format === "module" || format === "module-typescript") return "module";
@@ -145,4 +159,4 @@ function guessSourceType(id, format) {
145
159
  }
146
160
 
147
161
  //#endregion
148
- export { Oxc };
162
+ export { Oxc as t };
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/unloader.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/unloader.ts
4
4
  /**
5
+ * This entry file is for Unloader plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Unloader plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/vite.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/vite.ts
4
4
  /**
5
+ * This entry file is for Vite plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Vite plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
1
+ import { t as Oxc } from "./index-Bkkz82qt.mjs";
2
2
 
3
3
  //#region src/webpack.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
1
+ import { t as Oxc } from "./src-Cwmf7KjW.mjs";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  /**
5
+ * This entry file is for webpack plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Webpack plugin
6
11
  *
7
12
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-oxc",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Oxc integration for unplugin.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,25 +22,25 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/unplugin/unplugin-oxc.git"
24
24
  },
25
- "author": "三咲智子 Kevin Deng <sxzz@sxzz.moe>",
25
+ "author": "Kevin Deng <sxzz@sxzz.moe>",
26
26
  "funding": "https://github.com/sponsors/sxzz",
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "main": "./dist/index.js",
31
- "module": "./dist/index.js",
32
- "types": "./dist/index.d.ts",
30
+ "main": "./dist/index.mjs",
31
+ "module": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
33
33
  "exports": {
34
- ".": "./dist/index.js",
35
- "./api": "./dist/api.js",
36
- "./esbuild": "./dist/esbuild.js",
37
- "./farm": "./dist/farm.js",
38
- "./rolldown": "./dist/rolldown.js",
39
- "./rollup": "./dist/rollup.js",
40
- "./rspack": "./dist/rspack.js",
41
- "./unloader": "./dist/unloader.js",
42
- "./vite": "./dist/vite.js",
43
- "./webpack": "./dist/webpack.js",
34
+ ".": "./dist/index.mjs",
35
+ "./api": "./dist/api.mjs",
36
+ "./esbuild": "./dist/esbuild.mjs",
37
+ "./farm": "./dist/farm.mjs",
38
+ "./rolldown": "./dist/rolldown.mjs",
39
+ "./rollup": "./dist/rollup.mjs",
40
+ "./rspack": "./dist/rspack.mjs",
41
+ "./unloader": "./dist/unloader.mjs",
42
+ "./vite": "./dist/vite.mjs",
43
+ "./webpack": "./dist/webpack.mjs",
44
44
  "./package.json": "./package.json"
45
45
  },
46
46
  "typesVersions": {
@@ -63,28 +63,28 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "oxc-minify": ">=0.89.0",
67
- "oxc-resolver": "^11.8.0",
68
- "oxc-transform": ">=0.89.0",
69
- "unplugin": "^2.3.10",
70
- "unplugin-utils": "^0.3.0"
66
+ "oxc-minify": ">=0.97.0",
67
+ "oxc-resolver": "^11.13.2",
68
+ "oxc-transform": ">=0.97.0",
69
+ "unplugin": "^2.3.10"
71
70
  },
72
71
  "devDependencies": {
73
- "@sxzz/eslint-config": "^7.1.4",
72
+ "@antfu/utils": "^9.3.0",
73
+ "@sxzz/eslint-config": "^7.2.10",
74
74
  "@sxzz/prettier-config": "^2.2.4",
75
- "@sxzz/test-utils": "^0.5.11",
76
- "@types/node": "^24.5.0",
77
- "bumpp": "^10.2.3",
78
- "eslint": "^9.35.0",
75
+ "@sxzz/test-utils": "^0.5.12",
76
+ "@types/node": "^24.10.1",
77
+ "bumpp": "^10.3.1",
78
+ "eslint": "^9.39.1",
79
79
  "prettier": "^3.6.2",
80
- "rollup": "^4.50.2",
81
- "tinyexec": "^1.0.1",
82
- "tsdown": "^0.15.1",
83
- "tsx": "^4.20.5",
84
- "typescript": "^5.9.2",
85
- "unloader": "^0.5.0",
86
- "vite": "^7.1.5",
87
- "vitest": "^3.2.4"
80
+ "rollup": "^4.53.2",
81
+ "tinyexec": "^1.0.2",
82
+ "tsdown": "^0.16.4",
83
+ "tsx": "^4.20.6",
84
+ "typescript": "^5.9.3",
85
+ "unloader": "^0.8.0",
86
+ "vite": "^7.2.2",
87
+ "vitest": "^4.0.8"
88
88
  },
89
89
  "engines": {
90
90
  "node": ">=20.19.0"
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Oxc } from "./index-DCbJ-kOf.js";
2
- export { Oxc };
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { Oxc } from "./src-zdyCluyM.js";
2
-
3
- export { Oxc };
File without changes
File without changes