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 +1 -1
- package/README.md +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/esbuild.js +3 -2
- package/dist/farm.js +3 -2
- package/dist/index.js +1 -1
- package/dist/rolldown.js +3 -2
- package/dist/rollup.js +3 -2
- package/dist/rspack.js +3 -2
- package/dist/{src-pBkchcHA.js → src-q7oiMldm.js} +29 -32
- package/dist/unloader.js +3 -2
- package/dist/vite.js +3 -2
- package/dist/webpack.js +3 -2
- package/package.json +17 -17
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright ©
|
|
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
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-
|
|
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 {
|
|
19
|
+
export { esbuild_default as default, esbuild as "module.exports" };
|
package/dist/farm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
21
|
+
export { farm_default as default, farm as "module.exports" };
|
package/dist/index.js
CHANGED
package/dist/rolldown.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
21
|
+
export { rolldown_default as default, rolldown as "module.exports" };
|
package/dist/rollup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
21
|
+
export { rollup_default as default, rollup as "module.exports" };
|
package/dist/rspack.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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
|
-
}
|
|
81
|
-
const transform$1 = options.transform
|
|
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
|
-
}
|
|
94
|
-
const renderChunk = options.minify
|
|
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-
|
|
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 {
|
|
21
|
+
export { unloader_default as default, unloader as "module.exports" };
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
21
|
+
export { vite_default as default, vite as "module.exports" };
|
package/dist/webpack.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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 {
|
|
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.
|
|
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": "
|
|
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.
|
|
67
|
-
"oxc-resolver": "^11.
|
|
68
|
-
"oxc-transform": ">=0.
|
|
69
|
-
"unplugin": "^2.3.
|
|
70
|
-
"unplugin-utils": "^0.
|
|
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.
|
|
73
|
+
"@sxzz/eslint-config": "^7.2.7",
|
|
74
74
|
"@sxzz/prettier-config": "^2.2.4",
|
|
75
|
-
"@sxzz/test-utils": "^0.5.
|
|
76
|
-
"@types/node": "^24.
|
|
77
|
-
"bumpp": "^10.
|
|
78
|
-
"eslint": "^9.
|
|
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.
|
|
80
|
+
"rollup": "^4.52.4",
|
|
81
81
|
"tinyexec": "^1.0.1",
|
|
82
|
-
"tsdown": "^0.
|
|
83
|
-
"tsx": "^4.20.
|
|
84
|
-
"typescript": "^5.9.
|
|
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.
|
|
86
|
+
"vite": "^7.1.9",
|
|
87
87
|
"vitest": "^3.2.4"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|