unplugin-isolated-decl 0.6.7 → 0.7.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.
@@ -10,22 +10,18 @@ function tryImport(pkg) {
10
10
  }
11
11
  async function oxcTransform(id, code) {
12
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
- }
13
+ if (!oxc) return {
14
+ code: "",
15
+ errors: ["oxc-transform is required for transforming TypeScript, please install `oxc-transform`."]
16
+ };
19
17
  return oxc.isolatedDeclaration(id, code, { sourcemap: false });
20
18
  }
21
19
  async function swcTransform(id, code) {
22
20
  const swc = await tryImport("@swc/core");
23
- if (!swc) {
24
- return {
25
- code: "",
26
- errors: ["SWC is required for transforming TypeScript, please install `@swc/core`."]
27
- };
28
- }
21
+ if (!swc) return {
22
+ code: "",
23
+ errors: ["SWC is required for transforming TypeScript, please install `@swc/core`."]
24
+ };
29
25
  try {
30
26
  const result = await swc.transform(code, {
31
27
  filename: id,
@@ -51,18 +47,14 @@ async function swcTransform(id, code) {
51
47
  }
52
48
  async function tsTransform(id, code, transformOptions) {
53
49
  const ts = await tryImport("typescript");
54
- if (!ts) {
55
- return {
56
- code: "",
57
- errors: ["TypeScript is required for transforming TypeScript, please install `typescript`."]
58
- };
59
- }
60
- if (!ts.transpileDeclaration) {
61
- return {
62
- code: "",
63
- errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+."]
64
- };
65
- }
50
+ if (!ts) return {
51
+ code: "",
52
+ errors: ["TypeScript is required for transforming TypeScript, please install `typescript`."]
53
+ };
54
+ if (!ts.transpileDeclaration) return {
55
+ code: "",
56
+ errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+."]
57
+ };
66
58
  const { outputText, diagnostics } = ts.transpileDeclaration(code, {
67
59
  fileName: id,
68
60
  reportDiagnostics: true,
@@ -9,22 +9,18 @@ function tryImport(pkg) {
9
9
  }
10
10
  async function oxcTransform(id, code) {
11
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
- }
12
+ if (!oxc) return {
13
+ code: "",
14
+ errors: ["oxc-transform is required for transforming TypeScript, please install `oxc-transform`."]
15
+ };
18
16
  return oxc.isolatedDeclaration(id, code, { sourcemap: false });
19
17
  }
20
18
  async function swcTransform(id, code) {
21
19
  const swc = await tryImport("@swc/core");
22
- if (!swc) {
23
- return {
24
- code: "",
25
- errors: ["SWC is required for transforming TypeScript, please install `@swc/core`."]
26
- };
27
- }
20
+ if (!swc) return {
21
+ code: "",
22
+ errors: ["SWC is required for transforming TypeScript, please install `@swc/core`."]
23
+ };
28
24
  try {
29
25
  const result = await swc.transform(code, {
30
26
  filename: id,
@@ -50,18 +46,14 @@ async function swcTransform(id, code) {
50
46
  }
51
47
  async function tsTransform(id, code, transformOptions) {
52
48
  const ts = await tryImport("typescript");
53
- if (!ts) {
54
- return {
55
- code: "",
56
- errors: ["TypeScript is required for transforming TypeScript, please install `typescript`."]
57
- };
58
- }
59
- if (!ts.transpileDeclaration) {
60
- return {
61
- code: "",
62
- errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+."]
63
- };
64
- }
49
+ if (!ts) return {
50
+ code: "",
51
+ errors: ["TypeScript is required for transforming TypeScript, please install `typescript`."]
52
+ };
53
+ if (!ts.transpileDeclaration) return {
54
+ code: "",
55
+ errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+."]
56
+ };
65
57
  const { outputText, diagnostics } = ts.transpileDeclaration(code, {
66
58
  fileName: id,
67
59
  reportDiagnostics: true,
package/dist/vite.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const require_src_index = require('./src_index-tVPRzUWA.cjs');
3
- require('./transformer-9aaNC01N.cjs');
2
+ const require_src = require('./src-C3bhcfQ9.cjs');
3
+ require('./transformer-C4rLQvdl.cjs');
4
4
 
5
5
  //#region src/vite.ts
6
- var vite_default = require_src_index.IsolatedDecl.vite;
6
+ var vite_default = require_src.IsolatedDecl.vite;
7
7
 
8
8
  //#endregion
9
9
  module.exports = vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,3 +1,21 @@
1
+ /**
2
+ * This entry file is for Vite plugin.
3
+ *
4
+ * @module
5
+ */
1
6
  import { IsolatedDecl } from "./index.js";
7
+ /**
8
+ * Vite plugin
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // vite.config.js
13
+ * import IsolatedDecl from 'unplugin-isolated-decl/vite'
14
+ *
15
+ * export default {
16
+ * plugins: [IsolatedDecl()],
17
+ * }
18
+ * ```
19
+ */
2
20
  declare const _default: typeof IsolatedDecl.vite;
3
21
  export = _default;
package/dist/vite.d.ts CHANGED
@@ -1,3 +1,21 @@
1
+ /**
2
+ * This entry file is for Vite plugin.
3
+ *
4
+ * @module
5
+ */
1
6
  import { IsolatedDecl } from "./index.js";
7
+ /**
8
+ * Vite plugin
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // vite.config.js
13
+ * import IsolatedDecl from 'unplugin-isolated-decl/vite'
14
+ *
15
+ * export default {
16
+ * plugins: [IsolatedDecl()],
17
+ * }
18
+ * ```
19
+ */
2
20
  declare const _default: typeof IsolatedDecl.vite;
3
21
  export default _default;
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-GSFmnEOV.js";
2
- import { IsolatedDecl } from "./src_index-jESannmB.js";
1
+ import "./transformer-DDte86lZ.js";
2
+ import { IsolatedDecl } from "./src-B4aBGZxL.js";
3
3
 
4
4
  //#region src/vite.ts
5
5
  var vite_default = IsolatedDecl.vite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-isolated-decl",
3
- "version": "0.6.7",
3
+ "version": "0.7.0",
4
4
  "description": "A blazing-fast tool for generating isolated declarations.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -47,6 +47,10 @@
47
47
  "require": "./dist/esbuild.cjs",
48
48
  "import": "./dist/esbuild.js"
49
49
  },
50
+ "./farm": {
51
+ "require": "./dist/farm.cjs",
52
+ "import": "./dist/farm.js"
53
+ },
50
54
  "./api": {
51
55
  "require": "./dist/api.cjs",
52
56
  "import": "./dist/api.js"
@@ -84,31 +88,32 @@
84
88
  }
85
89
  },
86
90
  "dependencies": {
87
- "@rollup/pluginutils": "^5.1.2",
91
+ "@rollup/pluginutils": "^5.1.3",
88
92
  "magic-string": "^0.30.12",
89
- "oxc-parser": "^0.31.0",
90
- "unplugin": "^1.14.1"
93
+ "oxc-parser": "^0.36.0",
94
+ "unplugin": "^1.16.0"
91
95
  },
92
96
  "devDependencies": {
93
- "@swc/core": "^1.7.35",
94
- "@sxzz/eslint-config": "^4.4.0",
97
+ "@farmfe/core": "^1.4.1",
98
+ "@oxc-project/types": "^0.36.0",
99
+ "@swc/core": "^1.9.2",
100
+ "@sxzz/eslint-config": "^4.4.1",
95
101
  "@sxzz/prettier-config": "^2.0.2",
96
- "@types/node": "^22.7.5",
97
- "@typescript-eslint/typescript-estree": "^8.8.1",
98
- "bumpp": "^9.7.1",
102
+ "@types/node": "^22.9.0",
103
+ "bumpp": "^9.8.1",
99
104
  "esbuild": "^0.24.0",
100
- "eslint": "^9.12.0",
105
+ "eslint": "^9.15.0",
101
106
  "fast-glob": "^3.3.2",
102
- "oxc-transform": "^0.31.0",
107
+ "oxc-transform": "^0.36.0",
103
108
  "prettier": "^3.3.3",
104
109
  "rolldown": "nightly",
105
- "rollup": "^4.24.0",
110
+ "rollup": "^4.27.2",
106
111
  "rollup-plugin-esbuild": "^6.1.1",
107
- "tsdown": "^0.2.17",
108
- "tsx": "^4.19.1",
112
+ "tsdown": "^0.3.0",
113
+ "tsx": "^4.19.2",
109
114
  "typescript": "^5.6.3",
110
- "vite": "^5.4.9",
111
- "vitest": "^2.1.3"
115
+ "vite": "^5.4.11",
116
+ "vitest": "^2.1.5"
112
117
  },
113
118
  "engines": {
114
119
  "node": ">=18.12.0"