unplugin-isolated-decl 0.11.2 → 0.13.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/README.md CHANGED
@@ -101,12 +101,11 @@ export interface Options {
101
101
  exclude?: FilterPattern
102
102
  enforce?: 'pre' | 'post' | undefined
103
103
  /**
104
- * You need to install one of the supported transformers yourself.
105
- * oxc: oxc-transform
104
+ * You should install the transformer manually if you are not using oxc.
106
105
  * swc: @swc/core
107
106
  * typescript: typescript
108
107
  *
109
- * @default typescript
108
+ * @default oxc
110
109
  */
111
110
  transformer?: 'oxc' | 'swc' | 'typescript'
112
111
  /**
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { oxcTransform, swcTransform, tsTransform } from "./transformer-CBYRFUWY.js";
1
+ import { oxcTransform, swcTransform, tsTransform } from "./transformer-Bp3NCHCk.js";
2
2
 
3
3
  export { oxcTransform, swcTransform, tsTransform };
@@ -1,3 +1,4 @@
1
+ import type { IsolatedDeclarationsOptions } from "oxc-transform";
1
2
  import type { TranspileOptions } from "typescript";
2
3
  import type { FilterPattern } from "unplugin-utils";
3
4
  /**
@@ -25,14 +26,18 @@ export type Options = {
25
26
  rewriteImports?: (id: string, importer: string) => string | void | null | undefined
26
27
  } & ({
27
28
  /**
28
- * `oxc-transform` or `@swc/core` should be installed yourself
29
- * if you want to use `oxc` or `swc` transformer.
29
+ * @default 'oxc'
30
30
  */
31
- transformer?: "oxc" | "swc"
31
+ transformer?: "oxc"
32
+ transformOptions?: Omit<IsolatedDeclarationsOptions, "sourceMap">
33
+ } | {
34
+ /**
35
+ * `@swc/core` should be installed yourself.
36
+ */
37
+ transformer?: "swc"
32
38
  } | {
33
39
  /**
34
40
  * `typescript` should be installed yourself.
35
- * @default 'typescript'
36
41
  */
37
42
  transformer?: "typescript"
38
43
  /** Only for typescript transformer */
@@ -42,6 +47,8 @@ type Overwrite<
42
47
  T,
43
48
  U
44
49
  > = Pick<T, Exclude<keyof T, keyof U>> & U;
45
- export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, "enforce" | "extraOutdir" | "rewriteImports" | "inputBase">>;
50
+ export type OptionsResolved = Overwrite<Required<Options> & {
51
+ transformOptions?: any
52
+ }, Pick<Options, "enforce" | "extraOutdir" | "rewriteImports" | "inputBase">>;
46
53
  export declare function resolveOptions(options: Options): OptionsResolved;
47
54
  export {};
@@ -1,3 +1,4 @@
1
+ import type { IsolatedDeclarationsOptions } from "oxc-transform";
1
2
  import type { TranspileOptions } from "typescript";
2
3
  export interface TransformResult {
3
4
  code: string;
@@ -7,7 +8,7 @@ export interface TransformResult {
7
8
  /**
8
9
  * Transform isolated declarations with `oxc-transform`.
9
10
  */
10
- export declare function oxcTransform(id: string, code: string, sourceMap?: boolean): Promise<TransformResult>;
11
+ export declare function oxcTransform(id: string, code: string, transformOptions?: IsolatedDeclarationsOptions): Promise<TransformResult>;
11
12
  /**
12
13
  * Transform isolated declarations with `@swc/core`.
13
14
  */
package/dist/esbuild.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  //#region src/esbuild.ts
5
5
  /**
package/dist/farm.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  //#region src/farm.ts
5
5
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  export { IsolatedDecl };
package/dist/rolldown.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  //#region src/rolldown.ts
5
5
  /**
package/dist/rollup.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  //#region src/rollup.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { appendMapUrl, generateDtsMap, oxcTransform, swcTransform, tsTransform } from "./transformer-CBYRFUWY.js";
1
+ import { appendMapUrl, generateDtsMap, oxcTransform, swcTransform, tsTransform } from "./transformer-Bp3NCHCk.js";
2
2
  import path from "node:path";
3
3
  import { mkdir, readFile, writeFile } from "node:fs/promises";
4
4
  import MagicString from "magic-string";
@@ -98,12 +98,13 @@ function resolveOptions(options) {
98
98
  exclude: options.exclude || [/node_modules/],
99
99
  enforce: "enforce" in options ? options.enforce : "pre",
100
100
  sourceMap: options.sourceMap || false,
101
- transformer: options.transformer || "typescript",
101
+ transformer: options.transformer || "oxc",
102
102
  ignoreErrors: options.ignoreErrors || false,
103
103
  extraOutdir: options.extraOutdir,
104
104
  patchCjsDefaultExport: options.patchCjsDefaultExport || false,
105
105
  rewriteImports: options.rewriteImports,
106
- inputBase: options.inputBase
106
+ inputBase: options.inputBase,
107
+ transformOptions: options.transformOptions
107
108
  };
108
109
  }
109
110
 
@@ -151,7 +152,10 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
151
152
  let result;
152
153
  switch (options.transformer) {
153
154
  case "oxc":
154
- result = await oxcTransform(id, code, options.sourceMap);
155
+ result = await oxcTransform(id, code, {
156
+ ...options.transformOptions,
157
+ sourcemap: options.sourceMap
158
+ });
155
159
  break;
156
160
  case "swc":
157
161
  result = await swcTransform(id, code);
@@ -4,13 +4,13 @@ import path from "node:path";
4
4
  function tryImport(pkg) {
5
5
  return import(pkg).catch(() => null);
6
6
  }
7
- async function oxcTransform(id, code, sourceMap) {
7
+ async function oxcTransform(id, code, transformOptions) {
8
8
  const oxc = await tryImport("oxc-transform");
9
9
  if (!oxc) return {
10
10
  code: "",
11
11
  errors: ["oxc-transform is required for transforming TypeScript, please install `oxc-transform`."]
12
12
  };
13
- const result = oxc.isolatedDeclaration(id, code, { sourcemap: sourceMap });
13
+ const result = oxc.isolatedDeclaration(id, code, transformOptions);
14
14
  return {
15
15
  ...result,
16
16
  map: result.map?.mappings,
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-CBYRFUWY.js";
2
- import { IsolatedDecl } from "./src-eMzdAZrI.js";
1
+ import "./transformer-Bp3NCHCk.js";
2
+ import { IsolatedDecl } from "./src-YG5t1Y3E.js";
3
3
 
4
4
  //#region src/vite.ts
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-isolated-decl",
3
- "version": "0.11.2",
3
+ "version": "0.13.0",
4
4
  "description": "A blazing-fast tool for generating isolated declarations.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -49,16 +49,12 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@swc/core": "^1.6.6",
52
- "oxc-transform": ">=0.42.0",
53
52
  "typescript": "^5.5.2"
54
53
  },
55
54
  "peerDependenciesMeta": {
56
55
  "@swc/core": {
57
56
  "optional": true
58
57
  },
59
- "oxc-transform": {
60
- "optional": true
61
- },
62
58
  "typescript": {
63
59
  "optional": true
64
60
  }
@@ -66,35 +62,35 @@
66
62
  "dependencies": {
67
63
  "debug": "^4.4.0",
68
64
  "magic-string": "^0.30.17",
69
- "oxc-parser": "^0.51.0",
65
+ "oxc-parser": "^0.53.0",
66
+ "oxc-transform": "^0.53.0",
70
67
  "unplugin": "^2.2.0",
71
68
  "unplugin-utils": "^0.2.4"
72
69
  },
73
70
  "devDependencies": {
74
71
  "@farmfe/core": "^1.6.6",
75
- "@oxc-project/types": "^0.51.0",
72
+ "@oxc-project/types": "^0.53.0",
76
73
  "@rollup/plugin-alias": "^5.1.1",
77
- "@swc/core": "^1.10.16",
78
- "@sxzz/eslint-config": "^5.1.1",
74
+ "@swc/core": "^1.11.5",
75
+ "@sxzz/eslint-config": "^5.2.0",
79
76
  "@sxzz/prettier-config": "^2.2.0",
80
77
  "@sxzz/test-utils": "^0.5.1",
81
78
  "@types/debug": "^4.1.12",
82
- "@types/node": "^22.13.4",
79
+ "@types/node": "^22.13.8",
83
80
  "bumpp": "^10.0.3",
84
81
  "esbuild": "^0.25.0",
85
- "eslint": "^9.20.1",
82
+ "eslint": "^9.21.0",
86
83
  "fast-glob": "^3.3.3",
87
- "oxc-transform": "^0.51.0",
88
- "prettier": "^3.5.1",
84
+ "prettier": "^3.5.3",
89
85
  "rolldown": "^1.0.0-beta.3",
90
- "rollup": "^4.34.8",
91
- "tinyglobby": "^0.2.10",
92
- "tsdown": "^0.5.9",
93
- "tsx": "^4.19.2",
94
- "typescript": "^5.7.3",
95
- "unplugin-oxc": "^0.2.4",
96
- "vite": "^6.1.0",
97
- "vitest": "^3.0.5"
86
+ "rollup": "^4.34.9",
87
+ "tinyglobby": "^0.2.12",
88
+ "tsdown": "^0.6.0",
89
+ "tsx": "^4.19.3",
90
+ "typescript": "^5.8.2",
91
+ "unplugin-oxc": "^0.2.5",
92
+ "vite": "^6.2.0",
93
+ "vitest": "^3.0.7"
98
94
  },
99
95
  "engines": {
100
96
  "node": ">=18.12.0"