unplugin-isolated-decl 0.6.3 → 0.6.5
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.cjs +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/rolldown.cjs +1 -1
- package/dist/rolldown.js +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.js +1 -1
- package/dist/{src_index-G1xVigYS.cjs → src_index-BzyMNf8g.cjs} +7 -10
- package/dist/{src_index-KJ4J0Bno.js → src_index-yD9cu-PW.js} +7 -10
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/package.json +9 -9
package/dist/esbuild.cjs
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/dist/rolldown.cjs
CHANGED
package/dist/rolldown.js
CHANGED
package/dist/rollup.cjs
CHANGED
package/dist/rollup.js
CHANGED
|
@@ -33,7 +33,7 @@ const { createUnplugin } = __toESM(require("unplugin"));
|
|
|
33
33
|
//#region src/core/options.ts
|
|
34
34
|
function resolveOptions(options) {
|
|
35
35
|
return {
|
|
36
|
-
include: options.include || [/\.[cm]?
|
|
36
|
+
include: options.include || [/\.[cm]?tsx?$/],
|
|
37
37
|
exclude: options.exclude || [/node_modules/],
|
|
38
38
|
enforce: "enforce" in options ? options.enforce : "pre",
|
|
39
39
|
transformer: options.transformer || "typescript",
|
|
@@ -54,16 +54,13 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
54
54
|
outputFiles[stripExt(filename)] = source;
|
|
55
55
|
}
|
|
56
56
|
const rollup = { renderStart(outputOptions, inputOptions) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (Array.isArray(input)) {
|
|
61
|
-
outBase = lowestCommonAncestor(...input);
|
|
62
|
-
}
|
|
57
|
+
const { input } = inputOptions;
|
|
58
|
+
const normalizedInput = typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input);
|
|
59
|
+
const outBase = lowestCommonAncestor(...normalizedInput);
|
|
63
60
|
if (typeof outputOptions.entryFileNames !== "string") {
|
|
64
61
|
return this.error("entryFileNames must be a string");
|
|
65
62
|
}
|
|
66
|
-
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]
|
|
63
|
+
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
|
|
67
64
|
if (options.extraOutdir) {
|
|
68
65
|
entryFileNames = path.join(options.extraOutdir, entryFileNames);
|
|
69
66
|
}
|
|
@@ -110,7 +107,7 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
110
107
|
}
|
|
111
108
|
const resolved = await resolve(context, i.source.value, id);
|
|
112
109
|
if (!resolved || resolved.external) continue;
|
|
113
|
-
if (resolved.id.endsWith(".ts")) {
|
|
110
|
+
if (resolved.id.endsWith(".ts") || resolved.id.endsWith(".tsx")) {
|
|
114
111
|
s.overwrite(i.source.start, i.source.end, JSON.stringify(`${i.source.value}.js`));
|
|
115
112
|
}
|
|
116
113
|
}
|
|
@@ -234,7 +231,7 @@ async function resolve(context, id, importer) {
|
|
|
234
231
|
};
|
|
235
232
|
}
|
|
236
233
|
function stripExt(filename) {
|
|
237
|
-
return filename.replace(/\.(.?)[jt]
|
|
234
|
+
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
238
235
|
}
|
|
239
236
|
function patchCjsDefaultExport(source) {
|
|
240
237
|
return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
|
|
@@ -9,7 +9,7 @@ import { createUnplugin } from "unplugin";
|
|
|
9
9
|
//#region src/core/options.ts
|
|
10
10
|
function resolveOptions(options) {
|
|
11
11
|
return {
|
|
12
|
-
include: options.include || [/\.[cm]?
|
|
12
|
+
include: options.include || [/\.[cm]?tsx?$/],
|
|
13
13
|
exclude: options.exclude || [/node_modules/],
|
|
14
14
|
enforce: "enforce" in options ? options.enforce : "pre",
|
|
15
15
|
transformer: options.transformer || "typescript",
|
|
@@ -30,16 +30,13 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
30
30
|
outputFiles[stripExt(filename)] = source;
|
|
31
31
|
}
|
|
32
32
|
const rollup = { renderStart(outputOptions, inputOptions) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (Array.isArray(input)) {
|
|
37
|
-
outBase = lowestCommonAncestor(...input);
|
|
38
|
-
}
|
|
33
|
+
const { input } = inputOptions;
|
|
34
|
+
const normalizedInput = typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input);
|
|
35
|
+
const outBase = lowestCommonAncestor(...normalizedInput);
|
|
39
36
|
if (typeof outputOptions.entryFileNames !== "string") {
|
|
40
37
|
return this.error("entryFileNames must be a string");
|
|
41
38
|
}
|
|
42
|
-
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]
|
|
39
|
+
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
|
|
43
40
|
if (options.extraOutdir) {
|
|
44
41
|
entryFileNames = path.join(options.extraOutdir, entryFileNames);
|
|
45
42
|
}
|
|
@@ -86,7 +83,7 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
86
83
|
}
|
|
87
84
|
const resolved = await resolve(context, i.source.value, id);
|
|
88
85
|
if (!resolved || resolved.external) continue;
|
|
89
|
-
if (resolved.id.endsWith(".ts")) {
|
|
86
|
+
if (resolved.id.endsWith(".ts") || resolved.id.endsWith(".tsx")) {
|
|
90
87
|
s.overwrite(i.source.start, i.source.end, JSON.stringify(`${i.source.value}.js`));
|
|
91
88
|
}
|
|
92
89
|
}
|
|
@@ -210,7 +207,7 @@ async function resolve(context, id, importer) {
|
|
|
210
207
|
};
|
|
211
208
|
}
|
|
212
209
|
function stripExt(filename) {
|
|
213
|
-
return filename.replace(/\.(.?)[jt]
|
|
210
|
+
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
214
211
|
}
|
|
215
212
|
function patchCjsDefaultExport(source) {
|
|
216
213
|
return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
|
package/dist/vite.cjs
CHANGED
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-isolated-decl",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "A blazing-fast tool for generating isolated declarations, powered by Oxc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@rollup/pluginutils": "^5.1.
|
|
87
|
+
"@rollup/pluginutils": "^5.1.1",
|
|
88
88
|
"magic-string": "^0.30.11",
|
|
89
|
-
"oxc-parser": "^0.
|
|
89
|
+
"oxc-parser": "^0.30.0",
|
|
90
90
|
"unplugin": "^1.14.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
@@ -94,20 +94,20 @@
|
|
|
94
94
|
"@sxzz/eslint-config": "^4.2.0",
|
|
95
95
|
"@sxzz/prettier-config": "^2.0.2",
|
|
96
96
|
"@types/node": "^22.5.5",
|
|
97
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
97
|
+
"@typescript-eslint/typescript-estree": "^8.6.0",
|
|
98
98
|
"bumpp": "^9.5.2",
|
|
99
|
-
"esbuild": "^0.
|
|
100
|
-
"eslint": "^9.
|
|
99
|
+
"esbuild": "^0.24.0",
|
|
100
|
+
"eslint": "^9.11.0",
|
|
101
101
|
"fast-glob": "^3.3.2",
|
|
102
|
-
"oxc-transform": "^0.
|
|
102
|
+
"oxc-transform": "^0.30.0",
|
|
103
103
|
"prettier": "^3.3.3",
|
|
104
104
|
"rolldown": "nightly",
|
|
105
|
-
"rollup": "^4.
|
|
105
|
+
"rollup": "^4.22.4",
|
|
106
106
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
107
107
|
"tsdown": "^0.2.16",
|
|
108
108
|
"tsx": "^4.19.1",
|
|
109
109
|
"typescript": "^5.6.2",
|
|
110
|
-
"vite": "^5.4.
|
|
110
|
+
"vite": "^5.4.7",
|
|
111
111
|
"vitest": "^2.1.1"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|