unplugin-isolated-decl 0.5.2 → 0.6.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/api.cjs +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/core/options.d.cts +23 -11
- package/dist/core/options.d.ts +23 -11
- package/dist/core/transformer.d.cts +3 -3
- package/dist/core/transformer.d.ts +3 -3
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/rolldown.cjs +2 -2
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.ts +1 -1
- package/dist/rolldown.js +2 -2
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/{src_index-ytEwnjsz.cjs → src_index--m5BPU5W.cjs} +2 -2
- package/dist/{src_index-ZsbwyfTU.js → src_index-pbl3XXPp.js} +2 -2
- package/dist/{transformer-5sKdcRP0.js → transformer-YxBC7dLI.js} +19 -10
- package/dist/{transformer-AnxdogMH.cjs → transformer-ZHFQTLaY.cjs} +19 -10
- package/dist/vite.cjs +2 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/package.json +6 -2
package/dist/api.cjs
CHANGED
package/dist/api.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { oxcTransform, swcTransform, tsTransform } from
|
|
1
|
+
export { oxcTransform, swcTransform, tsTransform } from './core/transformer';
|
package/dist/api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { oxcTransform, swcTransform, tsTransform } from
|
|
1
|
+
export { oxcTransform, swcTransform, tsTransform } from './core/transformer';
|
package/dist/api.js
CHANGED
package/dist/core/options.d.cts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import type { FilterPattern } from
|
|
2
|
-
import type { TranspileOptions } from
|
|
1
|
+
import type { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import type { TranspileOptions } from 'typescript';
|
|
3
3
|
export type Options = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
include?: FilterPattern;
|
|
5
|
+
exclude?: FilterPattern;
|
|
6
|
+
enforce?: 'pre' | 'post' | undefined;
|
|
7
|
+
ignoreErrors?: boolean;
|
|
8
|
+
/** An extra directory layer for output files. */
|
|
9
|
+
extraOutdir?: string;
|
|
10
|
+
} & ({
|
|
11
|
+
/**
|
|
12
|
+
* `oxc-transform` or `@swc/core` should be installed yourself
|
|
13
|
+
* if you want to use `oxc` or `swc` transformer.
|
|
14
|
+
*/
|
|
15
|
+
transformer?: 'oxc' | 'swc';
|
|
16
|
+
} | {
|
|
17
|
+
/**
|
|
18
|
+
* `typescript` should be installed yourself.
|
|
19
|
+
* @default 'typescript'
|
|
20
|
+
*/
|
|
21
|
+
transformer: 'typescript';
|
|
22
|
+
/** Only for typescript transformer */
|
|
23
|
+
transformOptions?: TranspileOptions;
|
|
12
24
|
});
|
|
13
25
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
14
|
-
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options,
|
|
26
|
+
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir'>>;
|
|
15
27
|
export declare function resolveOptions(options: Options): OptionsResolved;
|
|
16
28
|
export {};
|
package/dist/core/options.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import type { FilterPattern } from
|
|
2
|
-
import type { TranspileOptions } from
|
|
1
|
+
import type { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import type { TranspileOptions } from 'typescript';
|
|
3
3
|
export type Options = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
include?: FilterPattern;
|
|
5
|
+
exclude?: FilterPattern;
|
|
6
|
+
enforce?: 'pre' | 'post' | undefined;
|
|
7
|
+
ignoreErrors?: boolean;
|
|
8
|
+
/** An extra directory layer for output files. */
|
|
9
|
+
extraOutdir?: string;
|
|
10
|
+
} & ({
|
|
11
|
+
/**
|
|
12
|
+
* `oxc-transform` or `@swc/core` should be installed yourself
|
|
13
|
+
* if you want to use `oxc` or `swc` transformer.
|
|
14
|
+
*/
|
|
15
|
+
transformer?: 'oxc' | 'swc';
|
|
16
|
+
} | {
|
|
17
|
+
/**
|
|
18
|
+
* `typescript` should be installed yourself.
|
|
19
|
+
* @default 'typescript'
|
|
20
|
+
*/
|
|
21
|
+
transformer: 'typescript';
|
|
22
|
+
/** Only for typescript transformer */
|
|
23
|
+
transformOptions?: TranspileOptions;
|
|
12
24
|
});
|
|
13
25
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
14
|
-
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options,
|
|
26
|
+
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce' | 'extraOutdir'>>;
|
|
15
27
|
export declare function resolveOptions(options: Options): OptionsResolved;
|
|
16
28
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TranspileOptions } from
|
|
1
|
+
import type { TranspileOptions } from 'typescript';
|
|
2
2
|
export interface TransformResult {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
code: string;
|
|
4
|
+
errors: Array<string>;
|
|
5
5
|
}
|
|
6
6
|
export declare function oxcTransform(id: string, code: string): Promise<TransformResult>;
|
|
7
7
|
export declare function swcTransform(id: string, code: string): Promise<TransformResult>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TranspileOptions } from
|
|
1
|
+
import type { TranspileOptions } from 'typescript';
|
|
2
2
|
export interface TransformResult {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
code: string;
|
|
4
|
+
errors: Array<string>;
|
|
5
5
|
}
|
|
6
6
|
export declare function oxcTransform(id: string, code: string): Promise<TransformResult>;
|
|
7
7
|
export declare function swcTransform(id: string, code: string): Promise<TransformResult>;
|
package/dist/esbuild.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_src_index = require('./src_index
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src_index = require('./src_index--m5BPU5W.cjs');
|
|
3
|
+
require('./transformer-ZHFQTLaY.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/esbuild.ts
|
|
6
6
|
var esbuild_default = require_src_index.IsolatedDecl.esbuild;
|
package/dist/esbuild.d.cts
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_src_index = require('./src_index
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src_index = require('./src_index--m5BPU5W.cjs');
|
|
3
|
+
require('./transformer-ZHFQTLaY.cjs');
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, 'IsolatedDecl', {
|
|
6
6
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UnpluginInstance } from
|
|
2
|
-
import { type Options } from
|
|
1
|
+
import { type UnpluginInstance } from 'unplugin';
|
|
2
|
+
import { type Options } from './core/options';
|
|
3
3
|
export type { Options };
|
|
4
4
|
export declare const IsolatedDecl: UnpluginInstance<Options | undefined, false>;
|
|
5
5
|
export declare function lowestCommonAncestor(...filepaths: string[]): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UnpluginInstance } from
|
|
2
|
-
import { type Options } from
|
|
1
|
+
import { type UnpluginInstance } from 'unplugin';
|
|
2
|
+
import { type Options } from './core/options';
|
|
3
3
|
export type { Options };
|
|
4
4
|
export declare const IsolatedDecl: UnpluginInstance<Options | undefined, false>;
|
|
5
5
|
export declare function lowestCommonAncestor(...filepaths: string[]): string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./transformer-
|
|
2
|
-
import { IsolatedDecl, lowestCommonAncestor } from "./src_index-
|
|
1
|
+
import "./transformer-YxBC7dLI.js";
|
|
2
|
+
import { IsolatedDecl, lowestCommonAncestor } from "./src_index-pbl3XXPp.js";
|
|
3
3
|
|
|
4
4
|
export { IsolatedDecl, lowestCommonAncestor };
|
package/dist/rolldown.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_src_index = require('./src_index
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src_index = require('./src_index--m5BPU5W.cjs');
|
|
3
|
+
require('./transformer-ZHFQTLaY.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/rolldown.ts
|
|
6
6
|
var rolldown_default = require_src_index.IsolatedDecl.rolldown;
|
package/dist/rolldown.d.cts
CHANGED
package/dist/rolldown.d.ts
CHANGED
package/dist/rolldown.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_src_index = require('./src_index
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src_index = require('./src_index--m5BPU5W.cjs');
|
|
3
|
+
require('./transformer-ZHFQTLaY.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/rollup.ts
|
|
6
6
|
var rollup_default = require_src_index.IsolatedDecl.rollup;
|
package/dist/rollup.d.cts
CHANGED
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
const require_transformer = require('./transformer-
|
|
25
|
+
const require_transformer = require('./transformer-ZHFQTLaY.cjs');
|
|
26
26
|
const { mkdir, readFile, writeFile } = __toESM(require("node:fs/promises"));
|
|
27
27
|
const { default: path } = __toESM(require("node:path"));
|
|
28
28
|
const { createFilter } = __toESM(require("@rollup/pluginutils"));
|
|
@@ -35,7 +35,7 @@ function resolveOptions(options) {
|
|
|
35
35
|
include: options.include || [/\.[cm]?ts$/],
|
|
36
36
|
exclude: options.exclude || [/node_modules/],
|
|
37
37
|
enforce: "enforce" in options ? options.enforce : "pre",
|
|
38
|
-
transformer: options.transformer || "
|
|
38
|
+
transformer: options.transformer || "typescript",
|
|
39
39
|
ignoreErrors: options.ignoreErrors || false,
|
|
40
40
|
extraOutdir: options.extraOutdir
|
|
41
41
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { oxcTransform, swcTransform, tsTransform } from "./transformer-
|
|
1
|
+
import { oxcTransform, swcTransform, tsTransform } from "./transformer-YxBC7dLI.js";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { default as path } from "node:path";
|
|
4
4
|
import { createFilter } from "@rollup/pluginutils";
|
|
@@ -11,7 +11,7 @@ function resolveOptions(options) {
|
|
|
11
11
|
include: options.include || [/\.[cm]?ts$/],
|
|
12
12
|
exclude: options.exclude || [/node_modules/],
|
|
13
13
|
enforce: "enforce" in options ? options.enforce : "pre",
|
|
14
|
-
transformer: options.transformer || "
|
|
14
|
+
transformer: options.transformer || "typescript",
|
|
15
15
|
ignoreErrors: options.ignoreErrors || false,
|
|
16
16
|
extraOutdir: options.extraOutdir
|
|
17
17
|
};
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/core/transformer.ts
|
|
3
|
+
function tryImport(pkg) {
|
|
4
|
+
try {
|
|
5
|
+
return import(pkg);
|
|
6
|
+
} catch {
|
|
7
|
+
return Promise.resolve(null);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
3
10
|
async function oxcTransform(id, code) {
|
|
4
|
-
const
|
|
5
|
-
|
|
11
|
+
const oxc = await tryImport("oxc-transform");
|
|
12
|
+
if (!oxc) {
|
|
13
|
+
return {
|
|
14
|
+
code: "",
|
|
15
|
+
errors: ["oxc-transform is required for transforming TypeScript, please install `oxc-transform`.",]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return oxc.isolatedDeclaration(id, code, { sourcemap: false });
|
|
6
19
|
}
|
|
7
20
|
async function swcTransform(id, code) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
swc = await import("@swc/core");
|
|
11
|
-
} catch {
|
|
21
|
+
const swc = await tryImport("@swc/core");
|
|
22
|
+
if (!swc) {
|
|
12
23
|
return {
|
|
13
24
|
code: "",
|
|
14
25
|
errors: ["SWC is required for transforming TypeScript, please install `@swc/core`.",]
|
|
@@ -38,10 +49,8 @@ async function swcTransform(id, code) {
|
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
51
|
async function tsTransform(id, code, transformOptions) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ts = await import("typescript");
|
|
44
|
-
} catch {
|
|
52
|
+
const ts = await tryImport("typescript");
|
|
53
|
+
if (!ts) {
|
|
45
54
|
return {
|
|
46
55
|
code: "",
|
|
47
56
|
errors: ["TypeScript is required for transforming TypeScript, please install `typescript`.",]
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
//#region src/core/transformer.ts
|
|
4
|
+
function tryImport(pkg) {
|
|
5
|
+
try {
|
|
6
|
+
return import(pkg);
|
|
7
|
+
} catch {
|
|
8
|
+
return Promise.resolve(null);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
4
11
|
async function oxcTransform(id, code) {
|
|
5
|
-
const
|
|
6
|
-
|
|
12
|
+
const oxc = await tryImport("oxc-transform");
|
|
13
|
+
if (!oxc) {
|
|
14
|
+
return {
|
|
15
|
+
code: "",
|
|
16
|
+
errors: ["oxc-transform is required for transforming TypeScript, please install `oxc-transform`.",]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return oxc.isolatedDeclaration(id, code, { sourcemap: false });
|
|
7
20
|
}
|
|
8
21
|
async function swcTransform(id, code) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
swc = await import("@swc/core");
|
|
12
|
-
} catch {
|
|
22
|
+
const swc = await tryImport("@swc/core");
|
|
23
|
+
if (!swc) {
|
|
13
24
|
return {
|
|
14
25
|
code: "",
|
|
15
26
|
errors: ["SWC is required for transforming TypeScript, please install `@swc/core`.",]
|
|
@@ -39,10 +50,8 @@ async function swcTransform(id, code) {
|
|
|
39
50
|
}
|
|
40
51
|
}
|
|
41
52
|
async function tsTransform(id, code, transformOptions) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
ts = await import("typescript");
|
|
45
|
-
} catch {
|
|
53
|
+
const ts = await tryImport("typescript");
|
|
54
|
+
if (!ts) {
|
|
46
55
|
return {
|
|
47
56
|
code: "",
|
|
48
57
|
errors: ["TypeScript is required for transforming TypeScript, please install `typescript`.",]
|
package/dist/vite.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_src_index = require('./src_index
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src_index = require('./src_index--m5BPU5W.cjs');
|
|
3
|
+
require('./transformer-ZHFQTLaY.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/vite.ts
|
|
6
6
|
var vite_default = require_src_index.IsolatedDecl.vite;
|
package/dist/vite.d.cts
CHANGED
package/dist/vite.d.ts
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.6.0",
|
|
4
4
|
"description": "A blazing-fast tool for generating isolated declarations, powered by Oxc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -69,12 +69,16 @@
|
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@swc/core": "^1.6.6",
|
|
72
|
+
"oxc-transform": "^0.28.0",
|
|
72
73
|
"typescript": "^5.5.2"
|
|
73
74
|
},
|
|
74
75
|
"peerDependenciesMeta": {
|
|
75
76
|
"@swc/core": {
|
|
76
77
|
"optional": true
|
|
77
78
|
},
|
|
79
|
+
"oxc-transform": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
78
82
|
"typescript": {
|
|
79
83
|
"optional": true
|
|
80
84
|
}
|
|
@@ -82,7 +86,6 @@
|
|
|
82
86
|
"dependencies": {
|
|
83
87
|
"@rollup/pluginutils": "^5.1.0",
|
|
84
88
|
"oxc-parser": "^0.27.0",
|
|
85
|
-
"oxc-transform": "^0.27.0",
|
|
86
89
|
"unplugin": "^1.14.0"
|
|
87
90
|
},
|
|
88
91
|
"devDependencies": {
|
|
@@ -94,6 +97,7 @@
|
|
|
94
97
|
"esbuild": "^0.23.1",
|
|
95
98
|
"eslint": "^9.10.0",
|
|
96
99
|
"fast-glob": "^3.3.2",
|
|
100
|
+
"oxc-transform": "^0.27.0",
|
|
97
101
|
"prettier": "^3.3.3",
|
|
98
102
|
"rolldown": "nightly",
|
|
99
103
|
"rollup": "^4.21.2",
|