unplugin-oxc 0.5.0 → 0.5.2
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 +13 -2
- package/dist/api.d.ts +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/farm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/rolldown.js +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-pBkchcHA.js → src-zdyCluyM.js} +24 -27
- package/dist/unloader.js +1 -1
- package/dist/vite.js +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# unplugin-oxc
|
|
1
|
+
# unplugin-oxc
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![Unit Test][unit-test-src]][unit-test-href]
|
|
4
6
|
|
|
5
7
|
[Oxc](https://oxc.rs/) integration for unplugin.
|
|
6
8
|
|
|
@@ -164,3 +166,12 @@ interface Options {
|
|
|
164
166
|
## License
|
|
165
167
|
|
|
166
168
|
[MIT](./LICENSE) License © 2025-PRESENT [三咲智子](https://github.com/sxzz)
|
|
169
|
+
|
|
170
|
+
<!-- Badges -->
|
|
171
|
+
|
|
172
|
+
[npm-version-src]: https://img.shields.io/npm/v/unplugin-oxc.svg
|
|
173
|
+
[npm-version-href]: https://npmjs.com/package/unplugin-oxc
|
|
174
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-oxc
|
|
175
|
+
[npm-downloads-href]: https://www.npmcharts.com/compare/unplugin-oxc?interval=30
|
|
176
|
+
[unit-test-src]: https://github.com/unplugin/unplugin-oxc/actions/workflows/unit-test.yml/badge.svg
|
|
177
|
+
[unit-test-href]: https://github.com/unplugin/unplugin-oxc/actions/workflows/unit-test.yml
|
package/dist/api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/esbuild.js
CHANGED
package/dist/farm.js
CHANGED
package/dist/index.js
CHANGED
package/dist/rolldown.js
CHANGED
package/dist/rollup.js
CHANGED
package/dist/rspack.js
CHANGED
|
@@ -23,8 +23,7 @@ function resolveOptions(options, framework) {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/core/utils.ts
|
|
25
25
|
function getModuleFormat(id) {
|
|
26
|
-
|
|
27
|
-
switch (ext) {
|
|
26
|
+
switch (path.extname(id)) {
|
|
28
27
|
case ".mjs":
|
|
29
28
|
case ".mts": return "module";
|
|
30
29
|
case ".cjs":
|
|
@@ -102,30 +101,6 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
|
|
|
102
101
|
map: result.map
|
|
103
102
|
};
|
|
104
103
|
} : 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
|
-
};
|
|
129
104
|
return {
|
|
130
105
|
name: "unplugin-oxc",
|
|
131
106
|
enforce: options.enforce,
|
|
@@ -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
package/dist/vite.js
CHANGED
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-oxc",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Oxc integration for unplugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -63,27 +63,27 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"oxc-minify": ">=0.
|
|
67
|
-
"oxc-resolver": "^11.
|
|
68
|
-
"oxc-transform": ">=0.
|
|
69
|
-
"unplugin": "^2.3.
|
|
70
|
-
"unplugin-utils": "^0.
|
|
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"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@sxzz/eslint-config": "^7.1.
|
|
74
|
-
"@sxzz/prettier-config": "^2.2.
|
|
75
|
-
"@sxzz/test-utils": "^0.5.
|
|
76
|
-
"@types/node": "^24.
|
|
73
|
+
"@sxzz/eslint-config": "^7.1.4",
|
|
74
|
+
"@sxzz/prettier-config": "^2.2.4",
|
|
75
|
+
"@sxzz/test-utils": "^0.5.11",
|
|
76
|
+
"@types/node": "^24.5.0",
|
|
77
77
|
"bumpp": "^10.2.3",
|
|
78
|
-
"eslint": "^9.
|
|
78
|
+
"eslint": "^9.35.0",
|
|
79
79
|
"prettier": "^3.6.2",
|
|
80
|
-
"rollup": "^4.
|
|
80
|
+
"rollup": "^4.50.2",
|
|
81
81
|
"tinyexec": "^1.0.1",
|
|
82
|
-
"tsdown": "^0.
|
|
83
|
-
"tsx": "^4.20.
|
|
82
|
+
"tsdown": "^0.15.1",
|
|
83
|
+
"tsx": "^4.20.5",
|
|
84
84
|
"typescript": "^5.9.2",
|
|
85
85
|
"unloader": "^0.5.0",
|
|
86
|
-
"vite": "^7.1.
|
|
86
|
+
"vite": "^7.1.5",
|
|
87
87
|
"vitest": "^3.2.4"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
@@ -97,6 +97,6 @@
|
|
|
97
97
|
"dev": "tsdown --watch",
|
|
98
98
|
"test": "vitest",
|
|
99
99
|
"typecheck": "tsc --noEmit",
|
|
100
|
-
"release": "bumpp
|
|
100
|
+
"release": "bumpp"
|
|
101
101
|
}
|
|
102
102
|
}
|