@nhtio/vite-plugins 0.1.0-master-78c49aee → 0.1.0-master-ab16b60e
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/dts_complex.mjs
CHANGED
|
@@ -336079,34 +336079,52 @@ const unpluginFactory = (options2) => {
|
|
|
336079
336079
|
return result;
|
|
336080
336080
|
}
|
|
336081
336081
|
if (targetFile.startsWith(runtimeConfiguration.root)) {
|
|
336082
|
-
const
|
|
336082
|
+
const relativeToRoot = relative(runtimeConfiguration.root, targetFile).replace(
|
|
336083
336083
|
/\.(ts|tsx|cts|mts)$/,
|
|
336084
336084
|
".d.ts"
|
|
336085
336085
|
);
|
|
336086
|
-
const
|
|
336087
|
-
|
|
336088
|
-
|
|
336086
|
+
const potentialPaths = [
|
|
336087
|
+
// Direct relative to project root
|
|
336088
|
+
join(runtimeConfiguration.tempDirPath, relativeToRoot),
|
|
336089
|
+
// Without first directory (e.g., src/)
|
|
336090
|
+
join(runtimeConfiguration.tempDirPath, relativeToRoot.replace(/^[^/]+\//, ""))
|
|
336091
|
+
];
|
|
336092
|
+
const matchingFiles = Array.from(tmpDirRootNames).filter(
|
|
336093
|
+
(emittedPath) => emittedPath.endsWith(relativeToRoot)
|
|
336089
336094
|
);
|
|
336090
336095
|
if (runtimeConfiguration.debug) {
|
|
336091
|
-
console.log("[dts_complex]
|
|
336092
|
-
console.log("[dts_complex]
|
|
336093
|
-
console.log(
|
|
336094
|
-
|
|
336095
|
-
|
|
336096
|
-
)
|
|
336096
|
+
console.log("[dts_complex] relativeToRoot:", relativeToRoot);
|
|
336097
|
+
console.log("[dts_complex] potentialPaths:", potentialPaths);
|
|
336098
|
+
console.log("[dts_complex] matchingFiles:", matchingFiles);
|
|
336099
|
+
}
|
|
336100
|
+
for (const possiblePath of potentialPaths) {
|
|
336101
|
+
if (tmpDirRootNames.has(possiblePath)) {
|
|
336102
|
+
const relativeSpec = computeRelativePath(possiblePath);
|
|
336103
|
+
if (relativeSpec !== moduleName) {
|
|
336104
|
+
if (runtimeConfiguration.debug) {
|
|
336105
|
+
console.log("[dts_complex] -> Using emitted (exact):", relativeSpec);
|
|
336106
|
+
}
|
|
336107
|
+
return relativeSpec;
|
|
336108
|
+
}
|
|
336109
|
+
}
|
|
336097
336110
|
}
|
|
336098
|
-
if (
|
|
336099
|
-
const relativeSpec = computeRelativePath(
|
|
336111
|
+
if (matchingFiles.length === 1) {
|
|
336112
|
+
const relativeSpec = computeRelativePath(matchingFiles[0]);
|
|
336100
336113
|
if (relativeSpec !== moduleName) {
|
|
336101
336114
|
if (runtimeConfiguration.debug) {
|
|
336102
|
-
console.log("[dts_complex] -> Using emitted:", relativeSpec);
|
|
336115
|
+
console.log("[dts_complex] -> Using emitted (suffix):", relativeSpec);
|
|
336103
336116
|
}
|
|
336104
336117
|
return relativeSpec;
|
|
336105
336118
|
}
|
|
336106
|
-
}
|
|
336119
|
+
}
|
|
336120
|
+
if (runtimeConfiguration.debug) {
|
|
336107
336121
|
console.log("[dts_complex] -> Emitted file not found in tmpDirRootNames");
|
|
336108
336122
|
}
|
|
336109
336123
|
}
|
|
336124
|
+
} else if (runtimeConfiguration.debug) {
|
|
336125
|
+
console.log("[dts_complex] Resolving:", moduleName);
|
|
336126
|
+
console.log("[dts_complex] From file:", sourceFile.fileName);
|
|
336127
|
+
console.log("[dts_complex] -> Symbol not found, keeping as-is");
|
|
336110
336128
|
}
|
|
336111
336129
|
return void 0;
|
|
336112
336130
|
};
|
|
@@ -336163,12 +336181,15 @@ const unpluginFactory = (options2) => {
|
|
|
336163
336181
|
};
|
|
336164
336182
|
try {
|
|
336165
336183
|
await pMap(
|
|
336166
|
-
|
|
336167
|
-
async (
|
|
336168
|
-
if (!dirent.isFile() || !dirent.name.endsWith(".d.ts")) return;
|
|
336169
|
-
const absolutePath = join(dirent.parentPath, dirent.name);
|
|
336184
|
+
Array.from(tmpDirRootNames),
|
|
336185
|
+
async (absolutePath) => {
|
|
336170
336186
|
const sourceFile = tmpDirProgram.getSourceFile(absolutePath);
|
|
336171
|
-
if (!sourceFile)
|
|
336187
|
+
if (!sourceFile) {
|
|
336188
|
+
if (runtimeConfiguration.debug) {
|
|
336189
|
+
console.log("[dts_complex] Skipping file not in program:", absolutePath);
|
|
336190
|
+
}
|
|
336191
|
+
return;
|
|
336192
|
+
}
|
|
336172
336193
|
const transformResult = ts.transform(sourceFile, [tmpDirTransformer]);
|
|
336173
336194
|
const printer = ts.createPrinter();
|
|
336174
336195
|
const newContent = printer.printFile(transformResult.transformed[0]);
|
|
@@ -336234,4 +336255,4 @@ const dtsComplex = /* @__PURE__ */ createVitePlugin(unpluginFactory);
|
|
|
336234
336255
|
export {
|
|
336235
336256
|
dtsComplex as d
|
|
336236
336257
|
};
|
|
336237
|
-
//# sourceMappingURL=index-
|
|
336258
|
+
//# sourceMappingURL=index-Cbnpkv0N.mjs.map
|