unplugin-isolated-decl 0.15.6 → 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 };
@@ -1,6 +1,6 @@
1
1
  import type { IsolatedDeclarationsOptions } from "oxc-transform";
2
2
  import type { TranspileOptions } from "typescript";
3
- import type { FilterPattern } from "unplugin-utils";
3
+ import type { FilterPattern } from "unplugin";
4
4
  /**
5
5
  * Represents the options for the plugin.
6
6
  */
package/dist/esbuild.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
4
2
  //#region src/esbuild.ts
5
3
  /**
6
4
  * This entry file is for esbuild plugin.
@@ -20,7 +18,5 @@ import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
20
18
  * ```
21
19
  */
22
20
  const esbuild = IsolatedDecl.esbuild;
23
- var esbuild_default = esbuild;
24
-
25
21
  //#endregion
26
- export { esbuild_default as default, esbuild as "module.exports" };
22
+ export { esbuild as default, esbuild as "module.exports" };
package/dist/farm.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
4
2
  //#region src/farm.ts
5
3
  /**
6
4
  * This entry file is for Farm plugin.
@@ -21,7 +19,5 @@ import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
21
19
  * ```
22
20
  */
23
21
  const farm = IsolatedDecl.farm;
24
- var farm_default = farm;
25
-
26
22
  //#endregion
27
- export { farm_default as default, farm as "module.exports" };
23
+ export { farm as default, farm as "module.exports" };
package/dist/index.mjs CHANGED
@@ -1,4 +1,2 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
4
- export { IsolatedDecl };
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
2
+ export { IsolatedDecl };
package/dist/rolldown.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
4
2
  //#region src/rolldown.ts
5
3
  /**
6
4
  * This entry file is for Rolldown plugin.
@@ -21,7 +19,5 @@ import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
21
19
  * ```
22
20
  */
23
21
  const rolldown = IsolatedDecl.rolldown;
24
- var rolldown_default = rolldown;
25
-
26
22
  //#endregion
27
- export { rolldown_default as default, rolldown as "module.exports" };
23
+ export { rolldown as default, rolldown as "module.exports" };
package/dist/rollup.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
4
2
  //#region src/rollup.ts
5
3
  /**
6
4
  * This entry file is for Rollup plugin.
@@ -21,7 +19,5 @@ import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
21
19
  * ```
22
20
  */
23
21
  const rollup = IsolatedDecl.rollup;
24
- var rollup_default = rollup;
25
-
26
22
  //#endregion
27
- 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
  /**
@@ -136,9 +132,14 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
136
132
  farmPluginContext = this;
137
133
  outputFiles = Object.create(null);
138
134
  },
139
- transformInclude: (id) => filter(id),
140
- transform(code, id) {
141
- return transform(this, code, id);
135
+ transform: {
136
+ filter: { id: {
137
+ include: options.include,
138
+ exclude: options.exclude
139
+ } },
140
+ handler(code, id) {
141
+ return transform(this, code, id);
142
+ }
142
143
  },
143
144
  esbuild: { setup: esbuildSetup },
144
145
  rollup,
@@ -182,10 +183,10 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
182
183
  const { source } = i;
183
184
  let { value } = source;
184
185
  if (options.rewriteImports) {
185
- const result$1 = options.rewriteImports(value, id);
186
- if (typeof result$1 === "string") {
187
- source.value = value = result$1;
188
- 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);
189
190
  }
190
191
  }
191
192
  if (path.isAbsolute(value) || value[0] === ".") {
@@ -209,14 +210,14 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
209
210
  for (const { source } of typeImports) {
210
211
  const resolved = (await resolve(context, source.value, id))?.id;
211
212
  if (resolved && filter(resolved) && !outputFiles[stripExt(resolved)]) {
212
- let source$1;
213
+ let source;
213
214
  try {
214
- source$1 = await readFile(resolved, "utf8");
215
+ source = await readFile(resolved, "utf8");
215
216
  } catch {
216
217
  continue;
217
218
  }
218
219
  debug("transform type import:", resolved);
219
- await transform(context, source$1, resolved);
220
+ await transform(context, source, resolved);
220
221
  }
221
222
  }
222
223
  }
@@ -381,6 +382,5 @@ async function resolve(context, id, importer) {
381
382
  function patchCjsDefaultExport(source) {
382
383
  return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
383
384
  }
384
-
385
385
  //#endregion
386
- 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,6 +1,4 @@
1
- import "./transformer-CDjTlq6t.mjs";
2
- import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
3
-
1
+ import { t as IsolatedDecl } from "./src-C4IZ1TdD.mjs";
4
2
  //#region src/vite.ts
5
3
  /**
6
4
  * This entry file is for Vite plugin.
@@ -21,7 +19,5 @@ import { t as IsolatedDecl } from "./src-CxymJW35.mjs";
21
19
  * ```
22
20
  */
23
21
  const vite = IsolatedDecl.vite;
24
- var vite_default = vite;
25
-
26
22
  //#endregion
27
- export { vite_default as default, vite as "module.exports" };
23
+ export { vite as default, vite as "module.exports" };
package/package.json CHANGED
@@ -1,32 +1,26 @@
1
1
  {
2
2
  "name": "unplugin-isolated-decl",
3
- "version": "0.15.6",
4
- "description": "A blazing-fast tool for generating isolated declarations.",
5
3
  "type": "module",
6
- "keywords": [
7
- "unplugin",
8
- "rollup",
9
- "vite",
10
- "esbuild",
11
- "webpack"
12
- ],
4
+ "version": "0.16.0",
5
+ "description": "A blazing-fast tool for generating isolated declarations.",
6
+ "author": "Kevin Deng <sxzz@sxzz.moe>",
13
7
  "license": "MIT",
8
+ "funding": "https://github.com/sponsors/sxzz",
14
9
  "homepage": "https://github.com/unplugin/unplugin-isolated-decl#readme",
15
- "bugs": {
16
- "url": "https://github.com/unplugin/unplugin-isolated-decl/issues"
17
- },
18
10
  "repository": {
19
11
  "type": "git",
20
12
  "url": "git+https://github.com/unplugin/unplugin-isolated-decl.git"
21
13
  },
22
- "author": "Kevin Deng <sxzz@sxzz.moe>",
23
- "funding": "https://github.com/sponsors/sxzz",
24
- "files": [
25
- "dist"
14
+ "bugs": {
15
+ "url": "https://github.com/unplugin/unplugin-isolated-decl/issues"
16
+ },
17
+ "keywords": [
18
+ "unplugin",
19
+ "rollup",
20
+ "vite",
21
+ "esbuild",
22
+ "webpack"
26
23
  ],
27
- "main": "./dist/index.mjs",
28
- "module": "./dist/index.mjs",
29
- "types": "./dist/index.d.mts",
30
24
  "exports": {
31
25
  ".": "./dist/index.mjs",
32
26
  "./api": "./dist/api.mjs",
@@ -45,12 +39,18 @@
45
39
  ]
46
40
  }
47
41
  },
42
+ "files": [
43
+ "dist"
44
+ ],
48
45
  "publishConfig": {
49
46
  "access": "public"
50
47
  },
48
+ "engines": {
49
+ "node": "^20.19.0 || >=22.12.0"
50
+ },
51
51
  "peerDependencies": {
52
52
  "@swc/core": "^1.6.6",
53
- "typescript": "^5.5.2"
53
+ "typescript": "^5.5.2 || ^6.0.0"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@swc/core": {
@@ -62,38 +62,36 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "magic-string": "^0.30.21",
65
- "obug": "^2.0.0",
66
- "oxc-parser": ">=0.98.0",
67
- "oxc-transform": ">=0.98.0",
68
- "unplugin": "^2.3.10",
65
+ "obug": "^2.1.1",
66
+ "oxc-parser": ">=0.127.0",
67
+ "oxc-transform": ">=0.127.0",
68
+ "unplugin": "^3.0.0",
69
69
  "unplugin-utils": "^0.3.1"
70
70
  },
71
71
  "devDependencies": {
72
+ "@arethetypeswrong/core": "^0.18.2",
72
73
  "@farmfe/core": "^1.7.11",
73
- "@oxc-project/types": "^0.98.0",
74
+ "@oxc-project/types": "^0.127.0",
74
75
  "@rollup/plugin-alias": "^6.0.0",
75
- "@swc/core": "^1.15.2",
76
- "@sxzz/eslint-config": "^7.2.10",
77
- "@sxzz/prettier-config": "^2.2.4",
78
- "@sxzz/test-utils": "^0.5.12",
79
- "@types/node": "^24.10.1",
80
- "bumpp": "^10.3.1",
81
- "esbuild": "^0.27.0",
82
- "eslint": "^9.39.1",
83
- "fast-glob": "^3.3.3",
84
- "prettier": "^3.6.2",
85
- "publint": "^0.3.15",
86
- "rolldown": "^1.0.0-beta.50",
87
- "rollup": "^4.53.2",
88
- "tinyglobby": "^0.2.15",
89
- "tsdown": "^0.16.5",
90
- "typescript": "^5.9.3",
91
- "unplugin-oxc": "^0.5.5",
92
- "vite": "^7.2.2",
93
- "vitest": "^4.0.10"
94
- },
95
- "engines": {
96
- "node": ">=20.18.0"
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"
97
95
  },
98
96
  "resolutions": {
99
97
  "@changesets/cli": "-",
@@ -106,7 +104,7 @@
106
104
  "build": "tsdown",
107
105
  "dev": "tsdown --watch",
108
106
  "test": "vitest",
109
- "typecheck": "tsc --noEmit",
107
+ "typecheck": "tsgo --noEmit",
110
108
  "release": "bumpp"
111
109
  }
112
110
  }