unplugin-isolated-decl 0.15.7 → 0.16.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.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { a as tsTransform, i as swcTransform, r as oxcTransform } from "./transformer-CDjTlq6t.mjs";
2
-
3
- export { oxcTransform, swcTransform, tsTransform };
1
+ import { a as tsTransform, i as swcTransform, r as oxcTransform } from "./transformer-UfUlpcf6.mjs";
2
+ export { oxcTransform, swcTransform, tsTransform };
package/dist/esbuild.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
3
2
  //#region src/esbuild.ts
4
3
  /**
5
4
  * This entry file is for esbuild plugin.
@@ -19,7 +18,5 @@ import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
19
18
  * ```
20
19
  */
21
20
  const esbuild = IsolatedDecl.esbuild;
22
- var esbuild_default = esbuild;
23
-
24
21
  //#endregion
25
- export { esbuild_default as default, esbuild as "module.exports" };
22
+ export { esbuild as default, esbuild as "module.exports" };
package/dist/farm.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
3
2
  //#region src/farm.ts
4
3
  /**
5
4
  * This entry file is for Farm plugin.
@@ -20,7 +19,5 @@ import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
20
19
  * ```
21
20
  */
22
21
  const farm = IsolatedDecl.farm;
23
- var farm_default = farm;
24
-
25
22
  //#endregion
26
- export { farm_default as default, farm as "module.exports" };
23
+ export { farm as default, farm as "module.exports" };
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
3
- export { IsolatedDecl };
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
2
+ export { IsolatedDecl };
package/dist/rolldown.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
3
2
  //#region src/rolldown.ts
4
3
  /**
5
4
  * This entry file is for Rolldown plugin.
@@ -20,7 +19,5 @@ import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
20
19
  * ```
21
20
  */
22
21
  const rolldown = IsolatedDecl.rolldown;
23
- var rolldown_default = rolldown;
24
-
25
22
  //#endregion
26
- export { rolldown_default as default, rolldown as "module.exports" };
23
+ export { rolldown as default, rolldown as "module.exports" };
package/dist/rollup.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
3
2
  //#region src/rollup.ts
4
3
  /**
5
4
  * This entry file is for Rollup plugin.
@@ -20,7 +19,5 @@ import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
20
19
  * ```
21
20
  */
22
21
  const rollup = IsolatedDecl.rollup;
23
- var rollup_default = rollup;
24
-
25
22
  //#endregion
26
- export { rollup_default as default, rollup as "module.exports" };
23
+ export { rollup as default, rollup as "module.exports" };
@@ -1,4 +1,4 @@
1
- import { a as tsTransform, i as swcTransform, n as generateDtsMap, r as oxcTransform, t as appendMapUrl } from "./transformer-CDjTlq6t.mjs";
1
+ import { a as tsTransform, i as swcTransform, n as generateDtsMap, r as oxcTransform, t as appendMapUrl } from "./transformer-UfUlpcf6.mjs";
2
2
  import path from "node:path";
3
3
  import { mkdir, readFile, writeFile } from "node:fs/promises";
4
4
  import MagicString from "magic-string";
@@ -6,7 +6,6 @@ import { parse } from "oxc-parser";
6
6
  import { createUnplugin } from "unplugin";
7
7
  import { createFilter } from "unplugin-utils";
8
8
  import { createDebug } from "obug";
9
-
10
9
  //#region src/core/utils.ts
11
10
  const debug = createDebug("unplugin-isolated-decl");
12
11
  function lowestCommonAncestor(...filepaths) {
@@ -45,7 +44,6 @@ function endsWithIndex(s) {
45
44
  function shouldAddIndex(id, resolved) {
46
45
  return !endsWithIndex(id) && endsWithIndex(resolved);
47
46
  }
48
-
49
47
  //#endregion
50
48
  //#region src/core/ast.ts
51
49
  function filterImports(program) {
@@ -60,7 +58,7 @@ function rewriteImports(s, imports, entryMap, inputBase, entryFileNames, srcFile
60
58
  const entry = entryAlias || srcRel;
61
59
  const resolvedEntry = entryFileNames.replaceAll("[name]", entry);
62
60
  const emitDir = path.dirname(resolvedEntry);
63
- const emitDtsName = resolvedEntry.replace(/\.(.)?[jt]sx?$/, (_, s$1) => `.d.${s$1 || ""}ts`);
61
+ const emitDtsName = resolvedEntry.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
64
62
  const offset = path.relative(emitDir, srcDirRel);
65
63
  for (const i of imports) {
66
64
  const { source } = i;
@@ -86,7 +84,6 @@ function rewriteImports(s, imports, entryMap, inputBase, entryFileNames, srcFile
86
84
  function pathRelative(from, to) {
87
85
  return path.join(path.relative(from, path.dirname(to)), path.basename(to));
88
86
  }
89
-
90
87
  //#endregion
91
88
  //#region src/core/options.ts
92
89
  function resolveOptions(options) {
@@ -104,7 +101,6 @@ function resolveOptions(options) {
104
101
  transformOptions: options.transformOptions
105
102
  };
106
103
  }
107
-
108
104
  //#endregion
109
105
  //#region src/index.ts
110
106
  /**
@@ -187,10 +183,10 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
187
183
  const { source } = i;
188
184
  let { value } = source;
189
185
  if (options.rewriteImports) {
190
- const result$1 = options.rewriteImports(value, id);
191
- if (typeof result$1 === "string") {
192
- source.value = value = result$1;
193
- s.overwrite(source.start + 1, source.end - 1, result$1);
186
+ const result = options.rewriteImports(value, id);
187
+ if (typeof result === "string") {
188
+ source.value = value = result;
189
+ s.overwrite(source.start + 1, source.end - 1, result);
194
190
  }
195
191
  }
196
192
  if (path.isAbsolute(value) || value[0] === ".") {
@@ -214,14 +210,14 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
214
210
  for (const { source } of typeImports) {
215
211
  const resolved = (await resolve(context, source.value, id))?.id;
216
212
  if (resolved && filter(resolved) && !outputFiles[stripExt(resolved)]) {
217
- let source$1;
213
+ let source;
218
214
  try {
219
- source$1 = await readFile(resolved, "utf8");
215
+ source = await readFile(resolved, "utf8");
220
216
  } catch {
221
217
  continue;
222
218
  }
223
219
  debug("transform type import:", resolved);
224
- await transform(context, source$1, resolved);
220
+ await transform(context, source, resolved);
225
221
  }
226
222
  }
227
223
  }
@@ -386,6 +382,5 @@ async function resolve(context, id, importer) {
386
382
  function patchCjsDefaultExport(source) {
387
383
  return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
388
384
  }
389
-
390
385
  //#endregion
391
- export { IsolatedDecl as t };
386
+ export { IsolatedDecl as t };
@@ -1,5 +1,4 @@
1
1
  import path from "node:path";
2
-
3
2
  //#region src/core/transformer.ts
4
3
  function tryImport(pkg) {
5
4
  return import(pkg).catch(() => null);
@@ -105,6 +104,5 @@ function generateDtsMap(mappings, src, dts) {
105
104
  mappings
106
105
  });
107
106
  }
108
-
109
107
  //#endregion
110
- export { tsTransform as a, swcTransform as i, generateDtsMap as n, oxcTransform as r, appendMapUrl as t };
108
+ export { tsTransform as a, swcTransform as i, generateDtsMap as n, oxcTransform as r, appendMapUrl as t };
package/dist/vite.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
2
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
3
2
  //#region src/vite.ts
4
3
  /**
5
4
  * This entry file is for Vite plugin.
@@ -20,7 +19,5 @@ import { t as IsolatedDecl } from "./src-BYD-yWlY.mjs";
20
19
  * ```
21
20
  */
22
21
  const vite = IsolatedDecl.vite;
23
- var vite_default = vite;
24
-
25
22
  //#endregion
26
- export { vite_default as default, vite as "module.exports" };
23
+ export { vite as default, vite as "module.exports" };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-isolated-decl",
3
3
  "type": "module",
4
- "version": "0.15.7",
4
+ "version": "0.16.0",
5
5
  "description": "A blazing-fast tool for generating isolated declarations.",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -31,9 +31,6 @@
31
31
  "./vite": "./dist/vite.mjs",
32
32
  "./package.json": "./package.json"
33
33
  },
34
- "main": "./dist/index.mjs",
35
- "module": "./dist/index.mjs",
36
- "types": "./dist/index.d.mts",
37
34
  "typesVersions": {
38
35
  "*": {
39
36
  "*": [
@@ -49,11 +46,11 @@
49
46
  "access": "public"
50
47
  },
51
48
  "engines": {
52
- "node": ">=20.19.0"
49
+ "node": "^20.19.0 || >=22.12.0"
53
50
  },
54
51
  "peerDependencies": {
55
52
  "@swc/core": "^1.6.6",
56
- "typescript": "^5.5.2"
53
+ "typescript": "^5.5.2 || ^6.0.0"
57
54
  },
58
55
  "peerDependenciesMeta": {
59
56
  "@swc/core": {
@@ -66,35 +63,35 @@
66
63
  "dependencies": {
67
64
  "magic-string": "^0.30.21",
68
65
  "obug": "^2.1.1",
69
- "oxc-parser": ">=0.103.0",
70
- "oxc-transform": ">=0.103.0",
71
- "unplugin": "^2.3.11",
66
+ "oxc-parser": ">=0.127.0",
67
+ "oxc-transform": ">=0.127.0",
68
+ "unplugin": "^3.0.0",
72
69
  "unplugin-utils": "^0.3.1"
73
70
  },
74
71
  "devDependencies": {
72
+ "@arethetypeswrong/core": "^0.18.2",
75
73
  "@farmfe/core": "^1.7.11",
76
- "@oxc-project/types": "^0.103.0",
74
+ "@oxc-project/types": "^0.127.0",
77
75
  "@rollup/plugin-alias": "^6.0.0",
78
- "@swc/core": "^1.15.5",
79
- "@sxzz/eslint-config": "^7.4.3",
80
- "@sxzz/prettier-config": "^2.2.6",
81
- "@sxzz/test-utils": "^0.5.14",
82
- "@types/node": "^25.0.2",
83
- "@typescript/native-preview": "7.0.0-dev.20251215.1",
84
- "bumpp": "^10.3.2",
85
- "esbuild": "^0.27.1",
86
- "eslint": "^9.39.2",
87
- "fast-glob": "^3.3.3",
88
- "prettier": "^3.7.4",
89
- "publint": "^0.3.16",
90
- "rolldown": "^1.0.0-beta.54",
91
- "rollup": "^4.53.4",
92
- "tinyglobby": "^0.2.15",
93
- "tsdown": "^0.18.0",
94
- "typescript": "^5.9.3",
95
- "unplugin-oxc": "^0.5.6",
96
- "vite": "^7.3.0",
97
- "vitest": "^4.0.15"
76
+ "@swc/core": "^1.15.30",
77
+ "@sxzz/eslint-config": "^7.8.4",
78
+ "@sxzz/prettier-config": "^2.3.1",
79
+ "@sxzz/test-utils": "^0.5.16",
80
+ "@types/node": "^25.6.0",
81
+ "@typescript/native-preview": "7.0.0-dev.20260422.1",
82
+ "bumpp": "^11.0.1",
83
+ "esbuild": "^0.28.0",
84
+ "eslint": "^10.2.1",
85
+ "prettier": "^3.8.3",
86
+ "publint": "^0.3.18",
87
+ "rolldown": "^1.0.0-rc.17",
88
+ "rollup": "^4.60.2",
89
+ "tinyglobby": "^0.2.16",
90
+ "tsdown": "^0.21.9",
91
+ "typescript": "^6.0.3",
92
+ "unplugin-oxc": "^0.6.0",
93
+ "vite": "^8.0.9",
94
+ "vitest": "^4.1.5"
98
95
  },
99
96
  "resolutions": {
100
97
  "@changesets/cli": "-",