rolldown-plugin-dts 0.15.2 → 0.15.3
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.
|
@@ -9,6 +9,5 @@ declare const RE_VUE: RegExp;
|
|
|
9
9
|
declare function filename_js_to_dts(id: string): string;
|
|
10
10
|
declare function filename_to_dts(id: string): string;
|
|
11
11
|
declare function filename_dts_to(id: string, ext: "js" | "ts"): string;
|
|
12
|
-
declare function isRelative(id: string): boolean;
|
|
13
12
|
//#endregion
|
|
14
|
-
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
13
|
+
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
|
|
3
1
|
//#region src/filename.ts
|
|
4
2
|
const RE_JS = /\.([cm]?)jsx?$/;
|
|
5
3
|
const RE_TS = /\.([cm]?)tsx?$/;
|
|
@@ -17,9 +15,6 @@ function filename_to_dts(id) {
|
|
|
17
15
|
function filename_dts_to(id, ext) {
|
|
18
16
|
return id.replace(RE_DTS, `.$1${ext}`);
|
|
19
17
|
}
|
|
20
|
-
function isRelative(id) {
|
|
21
|
-
return path.isAbsolute(id) || id[0] === ".";
|
|
22
|
-
}
|
|
23
18
|
|
|
24
19
|
//#endregion
|
|
25
|
-
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
20
|
+
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts };
|
package/dist/filename.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
2
|
-
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts } from "./filename-DUAyqgqS.js";
|
|
2
|
+
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts };
|
package/dist/filename.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts } from "./filename-DtB5setL.js";
|
|
2
2
|
|
|
3
|
-
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts
|
|
3
|
+
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE } from "./filename-
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE } from "./filename-DUAyqgqS.js";
|
|
2
2
|
import { IsolatedDeclarationsOptions } from "rolldown/experimental";
|
|
3
3
|
import { TsConfigJson } from "get-tsconfig";
|
|
4
4
|
import { Plugin } from "rolldown";
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts } from "./filename-
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts } from "./filename-DtB5setL.js";
|
|
2
2
|
import { createContext, globalContext, invalidateContextFile } from "./context-BG0dlajy.js";
|
|
3
3
|
import Debug from "debug";
|
|
4
4
|
import _generate from "@babel/generator";
|
|
5
5
|
import { parse } from "@babel/parser";
|
|
6
6
|
import * as t from "@babel/types";
|
|
7
7
|
import { isDeclarationType, isTypeOf, resolveString } from "ast-kit";
|
|
8
|
-
import path from "node:path";
|
|
9
8
|
import { fork, spawn } from "node:child_process";
|
|
10
9
|
import { existsSync } from "node:fs";
|
|
11
10
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
12
11
|
import { tmpdir } from "node:os";
|
|
12
|
+
import path from "node:path";
|
|
13
13
|
import { ResolverFactory, isolatedDeclaration } from "rolldown/experimental";
|
|
14
14
|
import process from "node:process";
|
|
15
15
|
import { getTsconfig, parseTsconfig } from "get-tsconfig";
|
|
@@ -906,29 +906,27 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
|
|
|
906
906
|
moduleSideEffects: false
|
|
907
907
|
};
|
|
908
908
|
if (!importer || !RE_DTS.test(importer)) return;
|
|
909
|
-
if (RE_CSS.test(id)) return
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
if (!resolution || !RE_TS.test(resolution) && !RE_VUE.test(resolution)) {
|
|
917
|
-
const result = await this.resolve(id, importer, options);
|
|
918
|
-
if (!result || !RE_TS.test(result.id)) return external;
|
|
919
|
-
resolution = result.id;
|
|
909
|
+
if (RE_CSS.test(id)) return external;
|
|
910
|
+
const rolldownResolution = await this.resolve(id, importer, options);
|
|
911
|
+
let dtsResolution = resolver(id, importer);
|
|
912
|
+
dtsResolution &&= path.normalize(dtsResolution);
|
|
913
|
+
if (!dtsResolution || !RE_TS.test(dtsResolution) && !RE_VUE.test(dtsResolution)) {
|
|
914
|
+
if (!rolldownResolution || !RE_TS.test(rolldownResolution.id) && !RE_VUE.test(rolldownResolution.id)) return external;
|
|
915
|
+
dtsResolution = rolldownResolution.id;
|
|
920
916
|
}
|
|
921
|
-
if (
|
|
917
|
+
if (RE_NODE_MODULES.test(dtsResolution)) {
|
|
922
918
|
let shouldResolve;
|
|
923
919
|
if (typeof resolve === "boolean") shouldResolve = resolve;
|
|
924
920
|
else shouldResolve = resolve.some((pattern) => typeof pattern === "string" ? id === pattern : pattern.test(id));
|
|
925
|
-
if (!shouldResolve)
|
|
921
|
+
if (!shouldResolve) if (RE_NODE_MODULES.test(importer)) {
|
|
922
|
+
if (rolldownResolution?.external) return external;
|
|
923
|
+
} else return external;
|
|
926
924
|
}
|
|
927
|
-
if (RE_TS.test(
|
|
928
|
-
await this.load({ id:
|
|
929
|
-
|
|
925
|
+
if (RE_TS.test(dtsResolution) && !RE_DTS.test(dtsResolution) || RE_VUE.test(dtsResolution)) {
|
|
926
|
+
await this.load({ id: dtsResolution });
|
|
927
|
+
dtsResolution = filename_to_dts(dtsResolution);
|
|
930
928
|
}
|
|
931
|
-
if (RE_DTS.test(
|
|
929
|
+
if (RE_DTS.test(dtsResolution)) return dtsResolution;
|
|
932
930
|
}
|
|
933
931
|
}
|
|
934
932
|
};
|