rolldown-plugin-dts 0.9.7 → 0.9.9
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/index.js +22 -7
- package/package.json +11 -10
package/dist/index.js
CHANGED
|
@@ -229,6 +229,7 @@ const RE_TS = /\.([cm]?)tsx?$/;
|
|
|
229
229
|
const RE_DTS = /\.d\.([cm]?)ts$/;
|
|
230
230
|
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
|
|
231
231
|
const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
|
|
232
|
+
const RE_CSS = /\.css$/;
|
|
232
233
|
function filename_js_to_dts(id) {
|
|
233
234
|
return id.replace(RE_JS, ".d.$1ts");
|
|
234
235
|
}
|
|
@@ -827,7 +828,10 @@ function createGeneratePlugin({ compilerOptions = {}, isolatedDeclarations, emit
|
|
|
827
828
|
});
|
|
828
829
|
}
|
|
829
830
|
dtsCode = result.code;
|
|
830
|
-
if (result.map)
|
|
831
|
+
if (result.map) {
|
|
832
|
+
map = result.map;
|
|
833
|
+
map.sourcesContent = void 0;
|
|
834
|
+
}
|
|
831
835
|
} else {
|
|
832
836
|
const module = createOrGetTsModule(programs, compilerOptions, id, isEntry, dtsMap);
|
|
833
837
|
const result = tscEmit(module);
|
|
@@ -835,9 +839,8 @@ function createGeneratePlugin({ compilerOptions = {}, isolatedDeclarations, emit
|
|
|
835
839
|
dtsCode = result.code;
|
|
836
840
|
map = result.map;
|
|
837
841
|
}
|
|
838
|
-
if (!dtsCode) return this.error(new Error(`Failed to generate dts for ${id}`));
|
|
839
842
|
return {
|
|
840
|
-
code: dtsCode,
|
|
843
|
+
code: dtsCode || "",
|
|
841
844
|
moduleSideEffects: false,
|
|
842
845
|
map
|
|
843
846
|
};
|
|
@@ -879,6 +882,11 @@ function createDtsResolvePlugin({ tsconfig, resolve, resolvePaths }) {
|
|
|
879
882
|
order: "pre",
|
|
880
883
|
async handler(id, importer, options) {
|
|
881
884
|
if (!importer || !RE_DTS.test(importer) && !this.getModuleInfo(importer)?.meta.dtsFile) return;
|
|
885
|
+
if (RE_CSS.test(id)) return {
|
|
886
|
+
id,
|
|
887
|
+
external: true,
|
|
888
|
+
moduleSideEffects: false
|
|
889
|
+
};
|
|
882
890
|
if (RE_NODE_MODULES.test(importer)) {
|
|
883
891
|
const resolution$1 = resolver(id, importer);
|
|
884
892
|
if (resolution$1) return {
|
|
@@ -889,10 +897,17 @@ function createDtsResolvePlugin({ tsconfig, resolve, resolvePaths }) {
|
|
|
889
897
|
if (!resolvePaths && (RE_NODE_MODULES.test(id) || !isRelative(id))) return resolveDependency(id, importer);
|
|
890
898
|
let resolution = await this.resolve(id, importer, options);
|
|
891
899
|
if (!resolution && !id.endsWith(".d")) resolution = await this.resolve(`${id}.d`, importer, options);
|
|
892
|
-
if (resolution?.id
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
900
|
+
if (resolution?.id) {
|
|
901
|
+
if (RE_CSS.test(resolution.id)) return {
|
|
902
|
+
id,
|
|
903
|
+
external: true,
|
|
904
|
+
moduleSideEffects: false
|
|
905
|
+
};
|
|
906
|
+
if (resolution.id.startsWith("\0")) return {
|
|
907
|
+
...resolution,
|
|
908
|
+
meta
|
|
909
|
+
};
|
|
910
|
+
}
|
|
896
911
|
if (resolvePaths && (RE_NODE_MODULES.test(resolution?.id || id) || !isRelative(resolution?.id || id))) return resolveDependency(id, importer);
|
|
897
912
|
if (!resolution || resolution.external) return resolution;
|
|
898
913
|
if (RE_JS.test(resolution.id)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "A Rolldown plugin to bundle dts files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/generator": "^7.27.
|
|
41
|
-
"@babel/parser": "^7.27.
|
|
42
|
-
"@babel/types": "^7.27.
|
|
40
|
+
"@babel/generator": "^7.27.1",
|
|
41
|
+
"@babel/parser": "^7.27.1",
|
|
42
|
+
"@babel/types": "^7.27.1",
|
|
43
43
|
"ast-kit": "^1.4.3",
|
|
44
44
|
"debug": "^4.4.0",
|
|
45
45
|
"dts-resolver": "^1.0.1",
|
|
46
46
|
"get-tsconfig": "^4.10.0",
|
|
47
|
-
"oxc-transform": "^0.
|
|
47
|
+
"oxc-transform": "^0.67.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@sxzz/eslint-config": "^6.
|
|
50
|
+
"@sxzz/eslint-config": "^6.2.0",
|
|
51
51
|
"@sxzz/prettier-config": "^2.2.1",
|
|
52
|
-
"@sxzz/test-utils": "^0.5.
|
|
52
|
+
"@sxzz/test-utils": "^0.5.6",
|
|
53
53
|
"@types/babel__generator": "^7.27.0",
|
|
54
54
|
"@types/debug": "^4.1.12",
|
|
55
55
|
"@types/diff": "^7.0.2",
|
|
56
|
-
"@types/node": "^22.15.
|
|
56
|
+
"@types/node": "^22.15.3",
|
|
57
57
|
"bumpp": "^10.1.0",
|
|
58
58
|
"diff": "^7.0.0",
|
|
59
59
|
"eslint": "^9.25.1",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"rolldown": "1.0.0-beta.8-commit.6aca0ce",
|
|
63
63
|
"rollup-plugin-dts": "^6.2.1",
|
|
64
64
|
"tinyglobby": "^0.2.13",
|
|
65
|
-
"tsdown": "^0.
|
|
66
|
-
"tsx": "^4.19.
|
|
65
|
+
"tsdown": "^0.10.2",
|
|
66
|
+
"tsx": "^4.19.4",
|
|
67
67
|
"typescript": "^5.8.3",
|
|
68
68
|
"vitest": "^3.1.2"
|
|
69
69
|
},
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"node": ">=20.18.0"
|
|
72
72
|
},
|
|
73
73
|
"resolutions": {
|
|
74
|
+
"rolldown": "1.0.0-beta.8-commit.6aca0ce",
|
|
74
75
|
"rolldown-plugin-dts": "workspace:*"
|
|
75
76
|
},
|
|
76
77
|
"prettier": "@sxzz/prettier-config",
|