unplugin-oxc 0.5.3 → 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/dist/{esbuild.d.ts → esbuild.d.mts} +1 -1
- package/dist/{esbuild.js → esbuild.mjs} +6 -1
- package/dist/{farm.d.ts → farm.d.mts} +1 -1
- package/dist/{farm.js → farm.mjs} +6 -1
- package/dist/{index-DCbJ-kOf.d.ts → index-Bkkz82qt.d.mts} +2 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -0
- package/dist/{rolldown.d.ts → rolldown.d.mts} +1 -1
- package/dist/{rolldown.js → rolldown.mjs} +6 -1
- package/dist/{rollup.d.ts → rollup.d.mts} +1 -1
- package/dist/{rollup.js → rollup.mjs} +6 -1
- package/dist/{rspack.d.ts → rspack.d.mts} +1 -1
- package/dist/{rspack.js → rspack.mjs} +6 -1
- package/dist/{src-q7oiMldm.js → src-Cwmf7KjW.mjs} +33 -19
- package/dist/{unloader.d.ts → unloader.d.mts} +1 -1
- package/dist/{unloader.js → unloader.mjs} +6 -1
- package/dist/{vite.d.ts → vite.d.mts} +1 -1
- package/dist/{vite.js → vite.mjs} +6 -1
- package/dist/{webpack.d.ts → webpack.d.mts} +1 -1
- package/dist/{webpack.js → webpack.mjs} +6 -1
- package/package.json +29 -29
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- /package/dist/{api.d.ts → api.d.mts} +0 -0
- /package/dist/{api.js → api.mjs} +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { Oxc } from "./src-
|
|
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,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 };
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -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,7 +44,6 @@ 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
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({
|
|
@@ -101,22 +106,16 @@ const Oxc = createUnplugin((rawOptions = {}, { framework }) => {
|
|
|
101
106
|
map: result.map
|
|
102
107
|
};
|
|
103
108
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
resolveId,
|
|
108
|
-
transformInclude(id) {
|
|
109
|
-
return filter(id);
|
|
109
|
+
const unloader = {
|
|
110
|
+
options(config) {
|
|
111
|
+
config.sourcemap ||= options.sourcemap;
|
|
110
112
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-oxc",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Oxc integration for unplugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"main": "./dist/index.
|
|
31
|
-
"module": "./dist/index.
|
|
32
|
-
"types": "./dist/index.d.
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
33
|
"exports": {
|
|
34
|
-
".": "./dist/index.
|
|
35
|
-
"./api": "./dist/api.
|
|
36
|
-
"./esbuild": "./dist/esbuild.
|
|
37
|
-
"./farm": "./dist/farm.
|
|
38
|
-
"./rolldown": "./dist/rolldown.
|
|
39
|
-
"./rollup": "./dist/rollup.
|
|
40
|
-
"./rspack": "./dist/rspack.
|
|
41
|
-
"./unloader": "./dist/unloader.
|
|
42
|
-
"./vite": "./dist/vite.
|
|
43
|
-
"./webpack": "./dist/webpack.
|
|
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.
|
|
67
|
-
"oxc-resolver": "^11.
|
|
68
|
-
"oxc-transform": ">=0.
|
|
69
|
-
"unplugin": "^2.3.10"
|
|
70
|
-
"unplugin-utils": "^0.3.1"
|
|
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
|
-
"@
|
|
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.
|
|
76
|
-
"@types/node": "^24.
|
|
75
|
+
"@sxzz/test-utils": "^0.5.12",
|
|
76
|
+
"@types/node": "^24.10.1",
|
|
77
77
|
"bumpp": "^10.3.1",
|
|
78
|
-
"eslint": "^9.
|
|
78
|
+
"eslint": "^9.39.1",
|
|
79
79
|
"prettier": "^3.6.2",
|
|
80
|
-
"rollup": "^4.
|
|
81
|
-
"tinyexec": "^1.0.
|
|
82
|
-
"tsdown": "^0.
|
|
80
|
+
"rollup": "^4.53.2",
|
|
81
|
+
"tinyexec": "^1.0.2",
|
|
82
|
+
"tsdown": "^0.16.4",
|
|
83
83
|
"tsx": "^4.20.6",
|
|
84
84
|
"typescript": "^5.9.3",
|
|
85
|
-
"unloader": "^0.
|
|
86
|
-
"vite": "^7.
|
|
87
|
-
"vitest": "^
|
|
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
package/dist/index.js
DELETED
|
File without changes
|
/package/dist/{api.js → api.mjs}
RENAMED
|
File without changes
|