unplugin-oxc 0.5.1 → 0.5.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/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
 
package/dist/api.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export { };
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/esbuild.ts
4
4
  /**
@@ -13,6 +13,7 @@ import { Oxc } from "./src-pBkchcHA.js";
13
13
  ```
14
14
  */
15
15
  const esbuild = Oxc.esbuild;
16
+ var esbuild_default = esbuild;
16
17
 
17
18
  //#endregion
18
- export { esbuild as default, esbuild as "module.exports" };
19
+ export { esbuild_default as default, esbuild as "module.exports" };
package/dist/farm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const farm = Oxc.farm;
18
+ var farm_default = farm;
18
19
 
19
20
  //#endregion
20
- export { farm as default, farm as "module.exports" };
21
+ export { farm_default as default, farm as "module.exports" };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  export { Oxc };
package/dist/rolldown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/rolldown.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const rolldown = Oxc.rolldown;
18
+ var rolldown_default = rolldown;
18
19
 
19
20
  //#endregion
20
- export { rolldown as default, rolldown as "module.exports" };
21
+ export { rolldown_default as default, rolldown as "module.exports" };
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/rollup.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const rollup = Oxc.rollup;
18
+ var rollup_default = rollup;
18
19
 
19
20
  //#endregion
20
- export { rollup as default, rollup as "module.exports" };
21
+ export { rollup_default as default, rollup as "module.exports" };
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/rspack.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const rspack = Oxc.rspack;
18
+ var rspack_default = rspack;
18
19
 
19
20
  //#endregion
20
- export { rspack as default, rspack as "module.exports" };
21
+ export { rspack_default as default, rspack as "module.exports" };
@@ -23,8 +23,7 @@ function resolveOptions(options, framework) {
23
23
  //#endregion
24
24
  //#region src/core/utils.ts
25
25
  function getModuleFormat(id) {
26
- const ext = path.extname(id);
27
- switch (ext) {
26
+ switch (path.extname(id)) {
28
27
  case ".mjs":
29
28
  case ".mts": return "module";
30
29
  case ".cjs":
@@ -40,7 +39,7 @@ function getModuleFormat(id) {
40
39
  const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
41
40
  const options = resolveOptions(rawOptions, framework);
42
41
  const filter = createFilter(options.include, options.exclude);
43
- const resolveId = options.resolve !== false ? (id, importer, resolveOptions$1) => {
42
+ const resolveId = options.resolve === false ? void 0 : (id, importer, resolveOptions$1) => {
44
43
  if (!options.resolveNodeModules && id[0] !== "." && !path.isAbsolute(id)) return;
45
44
  const resolver = new ResolverFactory({
46
45
  extensions: [
@@ -77,8 +76,8 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
77
76
  format
78
77
  };
79
78
  }
80
- } : void 0;
81
- const transform$1 = options.transform !== false ? (code, id, ...args) => {
79
+ };
80
+ const transform$1 = options.transform === false ? void 0 : (code, id, ...args) => {
82
81
  const [transformOptions] = args;
83
82
  const result = transform(id, code, {
84
83
  ...options.transform,
@@ -90,8 +89,8 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
90
89
  code: result.code,
91
90
  map: result.map
92
91
  };
93
- } : void 0;
94
- const renderChunk = options.minify !== false ? async (code, chunk) => {
92
+ };
93
+ const renderChunk = options.minify === false ? void 0 : async (code, chunk) => {
95
94
  const { minify } = await import("oxc-minify");
96
95
  const result = minify(chunk.fileName, code, {
97
96
  ...options.minify === true ? {} : options.minify,
@@ -101,30 +100,6 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
101
100
  code: result.code,
102
101
  map: result.map
103
102
  };
104
- } : void 0;
105
- const unloader = {
106
- options(config) {
107
- config.sourcemap ||= options.sourcemap;
108
- },
109
- load(id) {
110
- if (id.endsWith(".json")) {
111
- let code = readFileSync(id, "utf8");
112
- const json = JSON.parse(code);
113
- code = `const json = ${code}\nexport default json\n`;
114
- const i = 0;
115
- for (const key of Object.keys(json)) {
116
- const sanitizedKey = `_${key.replaceAll(/\W/g, "_")}${i}`;
117
- code += `\nconst ${sanitizedKey} = json[${JSON.stringify(key)}]\nexport { ${sanitizedKey} as ${JSON.stringify(key)} }\n`;
118
- }
119
- return {
120
- code,
121
- format: "module"
122
- };
123
- }
124
- if (!filter(id)) return;
125
- const contents = readFileSync(id, "utf8");
126
- return contents;
127
- }
128
103
  };
129
104
  return {
130
105
  name: "unplugin-oxc",
@@ -137,7 +112,29 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
137
112
  rollup: { renderChunk },
138
113
  rolldown: { renderChunk },
139
114
  vite: { renderChunk },
140
- unloader
115
+ unloader: {
116
+ options(config) {
117
+ config.sourcemap ||= options.sourcemap;
118
+ },
119
+ load(id) {
120
+ if (id.endsWith(".json")) {
121
+ let code = readFileSync(id, "utf8");
122
+ const json = JSON.parse(code);
123
+ code = `const json = ${code}\nexport default json\n`;
124
+ const i = 0;
125
+ for (const key of Object.keys(json)) {
126
+ const sanitizedKey = `_${key.replaceAll(/\W/g, "_")}${i}`;
127
+ code += `\nconst ${sanitizedKey} = json[${JSON.stringify(key)}]\nexport { ${sanitizedKey} as ${JSON.stringify(key)} }\n`;
128
+ }
129
+ return {
130
+ code,
131
+ format: "module"
132
+ };
133
+ }
134
+ if (!filter(id)) return;
135
+ return readFileSync(id, "utf8");
136
+ }
137
+ }
141
138
  };
142
139
  });
143
140
  function guessSourceType(id, format) {
package/dist/unloader.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/unloader.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const unloader = Oxc.unloader;
18
+ var unloader_default = unloader;
18
19
 
19
20
  //#endregion
20
- export { unloader as default, unloader as "module.exports" };
21
+ export { unloader_default as default, unloader as "module.exports" };
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/vite.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const vite = Oxc.vite;
18
+ var vite_default = vite;
18
19
 
19
20
  //#endregion
20
- export { vite as default, vite as "module.exports" };
21
+ export { vite_default as default, vite as "module.exports" };
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Oxc } from "./src-pBkchcHA.js";
1
+ import { Oxc } from "./src-q7oiMldm.js";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  /**
@@ -15,6 +15,7 @@ import { Oxc } from "./src-pBkchcHA.js";
15
15
  * ```
16
16
  */
17
17
  const webpack = Oxc.webpack;
18
+ var webpack_default = webpack;
18
19
 
19
20
  //#endregion
20
- export { webpack as default, webpack as "module.exports" };
21
+ export { webpack_default as default, webpack as "module.exports" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-oxc",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Oxc integration for unplugin.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,7 +22,7 @@
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"
@@ -63,27 +63,27 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "oxc-minify": ">=0.82.2",
67
- "oxc-resolver": "^11.6.1",
68
- "oxc-transform": ">=0.82.2",
69
- "unplugin": "^2.3.6",
70
- "unplugin-utils": "^0.2.5"
66
+ "oxc-minify": ">=0.94.0",
67
+ "oxc-resolver": "^11.9.0",
68
+ "oxc-transform": ">=0.94.0",
69
+ "unplugin": "^2.3.10",
70
+ "unplugin-utils": "^0.3.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@sxzz/eslint-config": "^7.1.4",
73
+ "@sxzz/eslint-config": "^7.2.7",
74
74
  "@sxzz/prettier-config": "^2.2.4",
75
- "@sxzz/test-utils": "^0.5.9",
76
- "@types/node": "^24.3.0",
77
- "bumpp": "^10.2.3",
78
- "eslint": "^9.33.0",
75
+ "@sxzz/test-utils": "^0.5.11",
76
+ "@types/node": "^24.7.0",
77
+ "bumpp": "^10.3.1",
78
+ "eslint": "^9.37.0",
79
79
  "prettier": "^3.6.2",
80
- "rollup": "^4.46.3",
80
+ "rollup": "^4.52.4",
81
81
  "tinyexec": "^1.0.1",
82
- "tsdown": "^0.14.1",
83
- "tsx": "^4.20.4",
84
- "typescript": "^5.9.2",
82
+ "tsdown": "^0.15.6",
83
+ "tsx": "^4.20.6",
84
+ "typescript": "^5.9.3",
85
85
  "unloader": "^0.5.0",
86
- "vite": "^7.1.3",
86
+ "vite": "^7.1.9",
87
87
  "vitest": "^3.2.4"
88
88
  },
89
89
  "engines": {