unplugin-isolated-decl 0.8.2 → 0.9.0
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/core/options.d.cts +3 -1
- package/dist/core/options.d.ts +3 -1
- package/dist/core/utils.d.cts +1 -1
- package/dist/core/utils.d.ts +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/farm.cjs +1 -1
- package/dist/farm.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-DF97Tiay.js → src-CglEH7vG.js} +9 -8
- package/dist/{src-CUBv8HDT.cjs → src-wtIilNZo.cjs} +9 -8
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/package.json +11 -11
package/dist/core/options.d.cts
CHANGED
|
@@ -14,6 +14,8 @@ export type Options = {
|
|
|
14
14
|
autoAddExts?: boolean;
|
|
15
15
|
/** Patch `export default` in `.d.cts` to `export = ` */
|
|
16
16
|
patchCjsDefaultExport?: boolean;
|
|
17
|
+
/** Base directory for input files. */
|
|
18
|
+
inputBase?: string;
|
|
17
19
|
rewriteImports?: (id: string, importer: string) => string | void | null | undefined;
|
|
18
20
|
} & ({
|
|
19
21
|
/**
|
|
@@ -31,6 +33,6 @@ export type Options = {
|
|
|
31
33
|
transformOptions?: TranspileOptions;
|
|
32
34
|
});
|
|
33
35
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
34
|
-
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir' | 'rewriteImports'>>;
|
|
36
|
+
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir' | 'rewriteImports' | 'inputBase'>>;
|
|
35
37
|
export declare function resolveOptions(options: Options): OptionsResolved;
|
|
36
38
|
export {};
|
package/dist/core/options.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export type Options = {
|
|
|
14
14
|
autoAddExts?: boolean;
|
|
15
15
|
/** Patch `export default` in `.d.cts` to `export = ` */
|
|
16
16
|
patchCjsDefaultExport?: boolean;
|
|
17
|
+
/** Base directory for input files. */
|
|
18
|
+
inputBase?: string;
|
|
17
19
|
rewriteImports?: (id: string, importer: string) => string | void | null | undefined;
|
|
18
20
|
} & ({
|
|
19
21
|
/**
|
|
@@ -31,6 +33,6 @@ export type Options = {
|
|
|
31
33
|
transformOptions?: TranspileOptions;
|
|
32
34
|
});
|
|
33
35
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
34
|
-
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir' | 'rewriteImports'>>;
|
|
36
|
+
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir' | 'rewriteImports' | 'inputBase'>>;
|
|
35
37
|
export declare function resolveOptions(options: Options): OptionsResolved;
|
|
36
38
|
export {};
|
package/dist/core/utils.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import Debug from 'debug';
|
|
|
2
2
|
export declare const debug: Debug.Debugger;
|
|
3
3
|
export declare function lowestCommonAncestor(...filepaths: string[]): string;
|
|
4
4
|
export declare function stripExt(filename: string): string;
|
|
5
|
-
export declare function resolveEntry(input: string | string[] | Record<string, string
|
|
5
|
+
export declare function resolveEntry(input: string | string[] | Record<string, string>, userInputBase?: string): {
|
|
6
6
|
entryMap: Record<string, string> | undefined;
|
|
7
7
|
inputBase: string;
|
|
8
8
|
};
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Debug from 'debug';
|
|
|
2
2
|
export declare const debug: Debug.Debugger;
|
|
3
3
|
export declare function lowestCommonAncestor(...filepaths: string[]): string;
|
|
4
4
|
export declare function stripExt(filename: string): string;
|
|
5
|
-
export declare function resolveEntry(input: string | string[] | Record<string, string
|
|
5
|
+
export declare function resolveEntry(input: string | string[] | Record<string, string>, userInputBase?: string): {
|
|
6
6
|
entryMap: Record<string, string> | undefined;
|
|
7
7
|
inputBase: string;
|
|
8
8
|
};
|
package/dist/esbuild.cjs
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/farm.cjs
CHANGED
package/dist/farm.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
|
@@ -30,11 +30,11 @@ else {
|
|
|
30
30
|
function stripExt(filename) {
|
|
31
31
|
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
32
32
|
}
|
|
33
|
-
function resolveEntry(input) {
|
|
33
|
+
function resolveEntry(input, userInputBase) {
|
|
34
34
|
if (typeof input === "string") input = [input];
|
|
35
35
|
const entryMap = !Array.isArray(input) ? Object.fromEntries(Object.entries(input).map(([k, v]) => [path$2.resolve(stripExt(v)), k])) : undefined;
|
|
36
36
|
const arr = Array.isArray(input) && input ? input : Object.values(input);
|
|
37
|
-
const inputBase = lowestCommonAncestor(...arr);
|
|
37
|
+
const inputBase = userInputBase || lowestCommonAncestor(...arr);
|
|
38
38
|
return {
|
|
39
39
|
entryMap,
|
|
40
40
|
inputBase
|
|
@@ -100,7 +100,8 @@ function resolveOptions(options) {
|
|
|
100
100
|
extraOutdir: options.extraOutdir,
|
|
101
101
|
autoAddExts: options.autoAddExts || false,
|
|
102
102
|
patchCjsDefaultExport: options.patchCjsDefaultExport || false,
|
|
103
|
-
rewriteImports: options.rewriteImports
|
|
103
|
+
rewriteImports: options.rewriteImports,
|
|
104
|
+
inputBase: options.inputBase
|
|
104
105
|
};
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -203,7 +204,7 @@ else {
|
|
|
203
204
|
}
|
|
204
205
|
function rollupRenderStart(outputOptions, inputOptions) {
|
|
205
206
|
const { input } = inputOptions;
|
|
206
|
-
const { inputBase, entryMap } = resolveEntry(input);
|
|
207
|
+
const { inputBase, entryMap } = resolveEntry(input, options.inputBase);
|
|
207
208
|
debug("[rollup] input base:", inputBase);
|
|
208
209
|
let { entryFileNames = "[name].js" } = outputOptions;
|
|
209
210
|
if (typeof entryFileNames !== "string") return this.error("entryFileNames must be a string");
|
|
@@ -222,8 +223,8 @@ else {
|
|
|
222
223
|
}
|
|
223
224
|
function farmRenderStart(config) {
|
|
224
225
|
const { input = {}, output = {} } = config;
|
|
225
|
-
const { inputBase, entryMap } = resolveEntry(input);
|
|
226
|
-
debug("[farm]
|
|
226
|
+
const { inputBase, entryMap } = resolveEntry(input, options.inputBase);
|
|
227
|
+
debug("[farm] input base:", inputBase);
|
|
227
228
|
if (output && typeof output.entryFilename !== "string") return console.error("entryFileName must be a string");
|
|
228
229
|
const extFormatMap = new Map([
|
|
229
230
|
["cjs", "cjs"],
|
|
@@ -251,8 +252,8 @@ else {
|
|
|
251
252
|
const esbuildOptions = build.initialOptions;
|
|
252
253
|
const entries = esbuildOptions.entryPoints;
|
|
253
254
|
if (!(entries && Array.isArray(entries) && entries.every((entry) => typeof entry === "string"))) throw new Error("unsupported entryPoints, must be an string[]");
|
|
254
|
-
const inputBase = lowestCommonAncestor(...entries);
|
|
255
|
-
debug("[esbuild]
|
|
255
|
+
const inputBase = options.inputBase || lowestCommonAncestor(...entries);
|
|
256
|
+
debug("[esbuild] input base:", inputBase);
|
|
256
257
|
const jsExt = esbuildOptions.outExtension?.[".js"];
|
|
257
258
|
let outExt;
|
|
258
259
|
switch (jsExt) {
|
|
@@ -54,11 +54,11 @@ else {
|
|
|
54
54
|
function stripExt(filename) {
|
|
55
55
|
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
56
56
|
}
|
|
57
|
-
function resolveEntry(input) {
|
|
57
|
+
function resolveEntry(input, userInputBase) {
|
|
58
58
|
if (typeof input === "string") input = [input];
|
|
59
59
|
const entryMap = !Array.isArray(input) ? Object.fromEntries(Object.entries(input).map(([k, v]) => [node_path.default.resolve(stripExt(v)), k])) : undefined;
|
|
60
60
|
const arr = Array.isArray(input) && input ? input : Object.values(input);
|
|
61
|
-
const inputBase = lowestCommonAncestor(...arr);
|
|
61
|
+
const inputBase = userInputBase || lowestCommonAncestor(...arr);
|
|
62
62
|
return {
|
|
63
63
|
entryMap,
|
|
64
64
|
inputBase
|
|
@@ -124,7 +124,8 @@ function resolveOptions(options) {
|
|
|
124
124
|
extraOutdir: options.extraOutdir,
|
|
125
125
|
autoAddExts: options.autoAddExts || false,
|
|
126
126
|
patchCjsDefaultExport: options.patchCjsDefaultExport || false,
|
|
127
|
-
rewriteImports: options.rewriteImports
|
|
127
|
+
rewriteImports: options.rewriteImports,
|
|
128
|
+
inputBase: options.inputBase
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -227,7 +228,7 @@ else {
|
|
|
227
228
|
}
|
|
228
229
|
function rollupRenderStart(outputOptions, inputOptions) {
|
|
229
230
|
const { input } = inputOptions;
|
|
230
|
-
const { inputBase, entryMap } = resolveEntry(input);
|
|
231
|
+
const { inputBase, entryMap } = resolveEntry(input, options.inputBase);
|
|
231
232
|
debug$1("[rollup] input base:", inputBase);
|
|
232
233
|
let { entryFileNames = "[name].js" } = outputOptions;
|
|
233
234
|
if (typeof entryFileNames !== "string") return this.error("entryFileNames must be a string");
|
|
@@ -246,8 +247,8 @@ else {
|
|
|
246
247
|
}
|
|
247
248
|
function farmRenderStart(config) {
|
|
248
249
|
const { input = {}, output = {} } = config;
|
|
249
|
-
const { inputBase, entryMap } = resolveEntry(input);
|
|
250
|
-
debug$1("[farm]
|
|
250
|
+
const { inputBase, entryMap } = resolveEntry(input, options.inputBase);
|
|
251
|
+
debug$1("[farm] input base:", inputBase);
|
|
251
252
|
if (output && typeof output.entryFilename !== "string") return console.error("entryFileName must be a string");
|
|
252
253
|
const extFormatMap = new Map([
|
|
253
254
|
["cjs", "cjs"],
|
|
@@ -275,8 +276,8 @@ else {
|
|
|
275
276
|
const esbuildOptions = build.initialOptions;
|
|
276
277
|
const entries = esbuildOptions.entryPoints;
|
|
277
278
|
if (!(entries && Array.isArray(entries) && entries.every((entry) => typeof entry === "string"))) throw new Error("unsupported entryPoints, must be an string[]");
|
|
278
|
-
const inputBase = lowestCommonAncestor(...entries);
|
|
279
|
-
debug$1("[esbuild]
|
|
279
|
+
const inputBase = options.inputBase || lowestCommonAncestor(...entries);
|
|
280
|
+
debug$1("[esbuild] input base:", inputBase);
|
|
280
281
|
const jsExt = esbuildOptions.outExtension?.[".js"];
|
|
281
282
|
let outExt;
|
|
282
283
|
switch (jsExt) {
|
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.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A blazing-fast tool for generating isolated declarations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -90,26 +90,26 @@
|
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@rollup/pluginutils": "^5.1.3",
|
|
92
92
|
"debug": "^4.3.7",
|
|
93
|
-
"magic-string": "^0.30.
|
|
94
|
-
"oxc-parser": "^0.
|
|
95
|
-
"unplugin": "^
|
|
93
|
+
"magic-string": "^0.30.14",
|
|
94
|
+
"oxc-parser": "^0.38.0",
|
|
95
|
+
"unplugin": "^2.0.0-beta.1"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@farmfe/core": "^1.4.
|
|
99
|
-
"@oxc-project/types": "^0.
|
|
98
|
+
"@farmfe/core": "^1.4.4",
|
|
99
|
+
"@oxc-project/types": "^0.38.0",
|
|
100
100
|
"@rollup/plugin-alias": "^5.1.1",
|
|
101
101
|
"@swc/core": "^1.9.3",
|
|
102
|
-
"@sxzz/eslint-config": "^4.
|
|
102
|
+
"@sxzz/eslint-config": "^4.5.0",
|
|
103
103
|
"@sxzz/prettier-config": "^2.0.2",
|
|
104
104
|
"@sxzz/test-utils": "^0.3.7",
|
|
105
105
|
"@types/debug": "^4.1.12",
|
|
106
|
-
"@types/node": "^22.
|
|
106
|
+
"@types/node": "^22.10.1",
|
|
107
107
|
"bumpp": "^9.8.1",
|
|
108
108
|
"esbuild": "^0.24.0",
|
|
109
109
|
"eslint": "^9.15.0",
|
|
110
110
|
"fast-glob": "^3.3.2",
|
|
111
|
-
"oxc-transform": "^0.
|
|
112
|
-
"prettier": "^3.
|
|
111
|
+
"oxc-transform": "^0.38.0",
|
|
112
|
+
"prettier": "^3.4.1",
|
|
113
113
|
"rolldown": "nightly",
|
|
114
114
|
"rollup": "^4.27.4",
|
|
115
115
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"tsx": "^4.19.2",
|
|
118
118
|
"typescript": "^5.7.2",
|
|
119
119
|
"vite": "^5.4.11",
|
|
120
|
-
"vitest": "^2.1.
|
|
120
|
+
"vitest": "^2.1.6"
|
|
121
121
|
},
|
|
122
122
|
"engines": {
|
|
123
123
|
"node": ">=18.12.0"
|