bio-dts 0.9.0 → 0.10.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/lib/post-transform.js +24 -13
- package/package.json +1 -1
package/lib/post-transform.js
CHANGED
|
@@ -559,21 +559,20 @@ declare function p${
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
const {
|
|
565
|
-
value
|
|
566
|
-
} = path;
|
|
562
|
+
function transformPath(path) {
|
|
567
563
|
|
|
568
564
|
// filter private members
|
|
569
|
-
if (!isPublic(value)) {
|
|
565
|
+
if (!isPublic(path.value)) {
|
|
570
566
|
return replace(path);
|
|
571
567
|
}
|
|
572
568
|
|
|
569
|
+
// generate overloads based on @overlord annotation
|
|
573
570
|
if (generateOverloads(path)) {
|
|
574
571
|
return false;
|
|
575
572
|
}
|
|
576
573
|
|
|
574
|
+
// fix optional before required args
|
|
575
|
+
// (just fine in JavaScript)
|
|
577
576
|
if (fixOptionalArgsMethods(path)) {
|
|
578
577
|
return false;
|
|
579
578
|
}
|
|
@@ -582,15 +581,27 @@ declare function p${
|
|
|
582
581
|
cleanComments(path);
|
|
583
582
|
|
|
584
583
|
fixTypeExport(path);
|
|
585
|
-
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const nodes = [ body ];
|
|
587
|
+
|
|
588
|
+
while (nodes.length) {
|
|
589
|
+
const node = nodes.shift();
|
|
586
590
|
|
|
587
|
-
|
|
588
|
-
try {
|
|
589
|
-
path.replace(...args);
|
|
590
|
-
} catch (err) {
|
|
591
|
-
console.error('Failed to replace path', path, ...args, err);
|
|
591
|
+
traverse(node, transformPath);
|
|
592
592
|
|
|
593
|
-
|
|
593
|
+
while (replacements.length) {
|
|
594
|
+
const [ path, args ] = replacements.shift();
|
|
595
|
+
|
|
596
|
+
try {
|
|
597
|
+
const replacedPaths = path.replace(...args);
|
|
598
|
+
|
|
599
|
+
nodes.push(...replacedPaths);
|
|
600
|
+
} catch (err) {
|
|
601
|
+
console.error('Failed to replace path', path, ...args, err);
|
|
602
|
+
|
|
603
|
+
throw error(path.value, 'failed to replace path: ' + err.message);
|
|
604
|
+
}
|
|
594
605
|
}
|
|
595
606
|
}
|
|
596
607
|
|