unplugin-isolated-decl 0.4.7 → 0.5.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_transformer = require('./transformer-wFl7-Qrk.cjs');
2
+ const require_transformer = require('./transformer-ZZscAG9G.cjs');
3
3
 
4
4
  Object.defineProperty(exports, 'oxcTransform', {
5
5
  enumerable: true,
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { oxcTransform, swcTransform, tsTransform } from "./transformer-69vts78l.js";
1
+ import { oxcTransform, swcTransform, tsTransform } from "./transformer-2hVUBpkW.js";
2
2
 
3
3
  export { oxcTransform, swcTransform, tsTransform };
@@ -1,6 +1,6 @@
1
1
  import type { TranspileOptions } from "typescript";
2
2
  export interface TransformResult {
3
- sourceText: string;
3
+ code: string;
4
4
  errors: Array<string>;
5
5
  }
6
6
  export declare function oxcTransform(id: string, code: string): TransformResult;
@@ -1,6 +1,6 @@
1
1
  import type { TranspileOptions } from "typescript";
2
2
  export interface TransformResult {
3
- sourceText: string;
3
+ code: string;
4
4
  errors: Array<string>;
5
5
  }
6
6
  export declare function oxcTransform(id: string, code: string): TransformResult;
package/dist/esbuild.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-t9_prpkU.cjs');
2
+ require('./transformer-ZZscAG9G.cjs');
3
+ const require_src_index = require('./src_index-2j2jy32a.cjs');
4
4
 
5
5
  //#region src/esbuild.ts
6
6
  var esbuild_default = require_src_index.IsolatedDecl.esbuild;
package/dist/esbuild.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
1
+ import "./transformer-2hVUBpkW.js";
2
+ import { IsolatedDecl } from "./src_index-GOBsoA4f.js";
3
3
 
4
4
  //#region src/esbuild.ts
5
5
  var esbuild_default = IsolatedDecl.esbuild;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-t9_prpkU.cjs');
2
+ require('./transformer-ZZscAG9G.cjs');
3
+ const require_src_index = require('./src_index-2j2jy32a.cjs');
4
4
 
5
5
  Object.defineProperty(exports, 'IsolatedDecl', {
6
6
  enumerable: true,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./transformer-69vts78l.js";
2
- import { IsolatedDecl, lowestCommonAncestor } from "./src_index-IB8kj2gH.js";
1
+ import "./transformer-2hVUBpkW.js";
2
+ import { IsolatedDecl, lowestCommonAncestor } from "./src_index-GOBsoA4f.js";
3
3
 
4
4
  export { IsolatedDecl, lowestCommonAncestor };
package/dist/rolldown.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-t9_prpkU.cjs');
2
+ require('./transformer-ZZscAG9G.cjs');
3
+ const require_src_index = require('./src_index-2j2jy32a.cjs');
4
4
 
5
5
  //#region src/rolldown.ts
6
6
  var rolldown_default = require_src_index.IsolatedDecl.rolldown;
package/dist/rolldown.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
1
+ import "./transformer-2hVUBpkW.js";
2
+ import { IsolatedDecl } from "./src_index-GOBsoA4f.js";
3
3
 
4
4
  //#region src/rolldown.ts
5
5
  var rolldown_default = IsolatedDecl.rolldown;
package/dist/rollup.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-t9_prpkU.cjs');
2
+ require('./transformer-ZZscAG9G.cjs');
3
+ const require_src_index = require('./src_index-2j2jy32a.cjs');
4
4
 
5
5
  //#region src/rollup.ts
6
6
  var rollup_default = require_src_index.IsolatedDecl.rollup;
package/dist/rollup.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
1
+ import "./transformer-2hVUBpkW.js";
2
+ import { IsolatedDecl } from "./src_index-GOBsoA4f.js";
3
3
 
4
4
  //#region src/rollup.ts
5
5
  var rollup_default = IsolatedDecl.rollup;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_transformer = require('./transformer-wFl7-Qrk.cjs');
2
+ const require_transformer = require('./transformer-ZZscAG9G.cjs');
3
3
  const { mkdir, readFile, writeFile } = __toESM(require("node:fs/promises"));
4
4
  const { default: path } = __toESM(require("node:path"));
5
5
  const { createFilter } = __toESM(require("@rollup/pluginutils"));
@@ -23,9 +23,6 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
23
23
  const options = resolveOptions(rawOptions);
24
24
  const filter = createFilter(options.include, options.exclude);
25
25
  const outputFiles = {};
26
- function stripExt(filename) {
27
- return filename.replace(/\.(.?)[jt]s$/, "");
28
- }
29
26
  function addOutput(filename, source) {
30
27
  outputFiles[stripExt(filename)] = source;
31
28
  }
@@ -119,7 +116,7 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
119
116
  break;
120
117
  case "typescript": result = await require_transformer.tsTransform(id, code, options.transformOptions);
121
118
  }
122
- const { sourceText, errors } = result;
119
+ const { code: sourceText, errors } = result;
123
120
  if (errors.length) {
124
121
  if (options.ignoreErrors) {
125
122
  this.warn(errors[0]);
@@ -164,6 +161,9 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
164
161
  }
165
162
  }
166
163
  });
164
+ function stripExt(filename) {
165
+ return filename.replace(/\.(.?)[jt]s$/, "");
166
+ }
167
167
  function lowestCommonAncestor(...filepaths) {
168
168
  if (filepaths.length === 0) return "";
169
169
  if (filepaths.length === 1) return path.dirname(filepaths[0]);
@@ -1,4 +1,4 @@
1
- import { oxcTransform, swcTransform, tsTransform } from "./transformer-69vts78l.js";
1
+ import { oxcTransform, swcTransform, tsTransform } from "./transformer-2hVUBpkW.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";
@@ -22,9 +22,6 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
22
22
  const options = resolveOptions(rawOptions);
23
23
  const filter = createFilter(options.include, options.exclude);
24
24
  const outputFiles = {};
25
- function stripExt(filename) {
26
- return filename.replace(/\.(.?)[jt]s$/, "");
27
- }
28
25
  function addOutput(filename, source) {
29
26
  outputFiles[stripExt(filename)] = source;
30
27
  }
@@ -118,7 +115,7 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
118
115
  break;
119
116
  case "typescript": result = await tsTransform(id, code, options.transformOptions);
120
117
  }
121
- const { sourceText, errors } = result;
118
+ const { code: sourceText, errors } = result;
122
119
  if (errors.length) {
123
120
  if (options.ignoreErrors) {
124
121
  this.warn(errors[0]);
@@ -163,6 +160,9 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
163
160
  }
164
161
  }
165
162
  });
163
+ function stripExt(filename) {
164
+ return filename.replace(/\.(.?)[jt]s$/, "");
165
+ }
166
166
  function lowestCommonAncestor(...filepaths) {
167
167
  if (filepaths.length === 0) return "";
168
168
  if (filepaths.length === 1) return path.dirname(filepaths[0]);
@@ -2,7 +2,7 @@ import { isolatedDeclaration } from "oxc-transform";
2
2
 
3
3
  //#region src/core/transformer.ts
4
4
  function oxcTransform(id, code) {
5
- return isolatedDeclaration(id, code);
5
+ return isolatedDeclaration(id, code, { sourcemap: false });
6
6
  }
7
7
  async function swcTransform(id, code) {
8
8
  let swc;
@@ -10,7 +10,7 @@ async function swcTransform(id, code) {
10
10
  swc = await import("@swc/core");
11
11
  } catch {
12
12
  return {
13
- sourceText: "",
13
+ code: "",
14
14
  errors: ["SWC is required for transforming TypeScript, please install `@swc/core`.",]
15
15
  };
16
16
  }
@@ -27,12 +27,12 @@ async function swcTransform(id, code) {
27
27
  });
28
28
  const output = JSON.parse(result.output);
29
29
  return {
30
- sourceText: output.__swc_isolated_declarations__,
30
+ code: output.__swc_isolated_declarations__,
31
31
  errors: []
32
32
  };
33
33
  } catch (error) {
34
34
  return {
35
- sourceText: "",
35
+ code: "",
36
36
  errors: [error.toString()]
37
37
  };
38
38
  }
@@ -43,13 +43,13 @@ async function tsTransform(id, code, transformOptions) {
43
43
  ts = await import("typescript");
44
44
  } catch {
45
45
  return {
46
- sourceText: "",
46
+ code: "",
47
47
  errors: ["TypeScript is required for transforming TypeScript, please install `typescript`.",]
48
48
  };
49
49
  }
50
50
  if (!ts.transpileDeclaration) {
51
51
  return {
52
- sourceText: "",
52
+ code: "",
53
53
  errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+.",]
54
54
  };
55
55
  }
@@ -64,7 +64,7 @@ async function tsTransform(id, code, transformOptions) {
64
64
  getNewLine: () => ts.sys.newLine
65
65
  }),] : [];
66
66
  return {
67
- sourceText: outputText,
67
+ code: outputText,
68
68
  errors
69
69
  };
70
70
  }
@@ -26,7 +26,7 @@ const { isolatedDeclaration } = __toESM(require("oxc-transform"));
26
26
 
27
27
  //#region src/core/transformer.ts
28
28
  function oxcTransform(id, code) {
29
- return isolatedDeclaration(id, code);
29
+ return isolatedDeclaration(id, code, { sourcemap: false });
30
30
  }
31
31
  async function swcTransform(id, code) {
32
32
  let swc;
@@ -34,7 +34,7 @@ async function swcTransform(id, code) {
34
34
  swc = await import("@swc/core");
35
35
  } catch {
36
36
  return {
37
- sourceText: "",
37
+ code: "",
38
38
  errors: ["SWC is required for transforming TypeScript, please install `@swc/core`.",]
39
39
  };
40
40
  }
@@ -51,12 +51,12 @@ async function swcTransform(id, code) {
51
51
  });
52
52
  const output = JSON.parse(result.output);
53
53
  return {
54
- sourceText: output.__swc_isolated_declarations__,
54
+ code: output.__swc_isolated_declarations__,
55
55
  errors: []
56
56
  };
57
57
  } catch (error) {
58
58
  return {
59
- sourceText: "",
59
+ code: "",
60
60
  errors: [error.toString()]
61
61
  };
62
62
  }
@@ -67,13 +67,13 @@ async function tsTransform(id, code, transformOptions) {
67
67
  ts = await import("typescript");
68
68
  } catch {
69
69
  return {
70
- sourceText: "",
70
+ code: "",
71
71
  errors: ["TypeScript is required for transforming TypeScript, please install `typescript`.",]
72
72
  };
73
73
  }
74
74
  if (!ts.transpileDeclaration) {
75
75
  return {
76
- sourceText: "",
76
+ code: "",
77
77
  errors: ["TypeScript version is too low, please upgrade to TypeScript 5.5.2+.",]
78
78
  };
79
79
  }
@@ -88,7 +88,7 @@ async function tsTransform(id, code, transformOptions) {
88
88
  getNewLine: () => ts.sys.newLine
89
89
  }),] : [];
90
90
  return {
91
- sourceText: outputText,
91
+ code: outputText,
92
92
  errors
93
93
  };
94
94
  }
package/dist/vite.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-t9_prpkU.cjs');
2
+ require('./transformer-ZZscAG9G.cjs');
3
+ const require_src_index = require('./src_index-2j2jy32a.cjs');
4
4
 
5
5
  //#region src/vite.ts
6
6
  var vite_default = require_src_index.IsolatedDecl.vite;
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
1
+ import "./transformer-2hVUBpkW.js";
2
+ import { IsolatedDecl } from "./src_index-GOBsoA4f.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.4.7",
3
+ "version": "0.5.0",
4
4
  "description": "A blazing-fast tool for generating isolated declarations, powered by Oxc.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -81,27 +81,27 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@rollup/pluginutils": "^5.1.0",
84
- "oxc-parser": "^0.25.0",
85
- "oxc-transform": "^0.24.3",
86
- "unplugin": "^1.12.2"
84
+ "oxc-parser": "^0.27.0",
85
+ "oxc-transform": "^0.27.0",
86
+ "unplugin": "^1.14.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@swc/core": "^1.7.11",
90
- "@sxzz/eslint-config": "^3.17.2",
89
+ "@swc/core": "^1.7.24",
90
+ "@sxzz/eslint-config": "^4.2.0",
91
91
  "@sxzz/prettier-config": "^2.0.2",
92
- "@types/node": "^20.16.0",
93
- "bumpp": "^9.5.1",
92
+ "@types/node": "^22.5.4",
93
+ "bumpp": "^9.5.2",
94
94
  "esbuild": "^0.23.1",
95
- "eslint": "^9.9.0",
95
+ "eslint": "^9.10.0",
96
96
  "fast-glob": "^3.3.2",
97
97
  "prettier": "^3.3.3",
98
98
  "rolldown": "nightly",
99
- "rollup": "^4.21.0",
99
+ "rollup": "^4.21.2",
100
100
  "rollup-plugin-esbuild": "^6.1.1",
101
- "tsdown": "^0.2.6",
102
- "tsx": "^4.17.0",
103
- "typescript": "^5.5.4",
104
- "vite": "^5.4.1",
101
+ "tsdown": "^0.2.15",
102
+ "tsx": "^4.19.0",
103
+ "typescript": "^5.6.2",
104
+ "vite": "^5.4.3",
105
105
  "vitest": "^2.0.5"
106
106
  },
107
107
  "engines": {