@glutinum/cli 1.0.0-beta.7 → 1.0.0-beta.8
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/Glutinum.Converter/Hosting.js +2 -2
- package/dist/Glutinum.Converter/Packages.js +12 -21
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/TypeNode.js +48 -1941
- package/dist/Glutinum.Converter/Reader/UtilityType.js +803 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +87 -47
- package/dist/Glutinum.Converter/Transform.js +83 -961
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/package.json +1 -1
|
@@ -610,73 +610,91 @@ export function readHeritageClauses(reader, heritageClauses) {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
else if (item_1(0, declarations).parent.kind === 308) {
|
|
628
|
-
const sourceFile = item_1(0, declarations).parent;
|
|
629
|
-
return sourceFile.fileName.endsWith("/lib.es5.d.ts");
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
return false;
|
|
633
|
-
}
|
|
613
|
+
function libDeclaration(symbolOpt) {
|
|
614
|
+
let option_3;
|
|
615
|
+
const option_1 = symbolOpt;
|
|
616
|
+
if (option_1 != null) {
|
|
617
|
+
const symbol = option_1;
|
|
618
|
+
option_3 = symbol.declarations;
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
option_3 = undefined;
|
|
622
|
+
}
|
|
623
|
+
if (option_3 != null) {
|
|
624
|
+
const declarations = option_3;
|
|
625
|
+
if ((declarations.length === 0) ? true : Operators_IsNull(item_1(0, declarations).parent)) {
|
|
626
|
+
return undefined;
|
|
634
627
|
}
|
|
635
628
|
else {
|
|
636
|
-
return
|
|
637
|
-
Equals: (x, y) => (x === y),
|
|
638
|
-
GetHashCode: (x) => (stringHash(x) | 0),
|
|
639
|
-
});
|
|
629
|
+
return item_1(0, declarations);
|
|
640
630
|
}
|
|
641
631
|
}
|
|
642
632
|
else {
|
|
643
|
-
return
|
|
633
|
+
return undefined;
|
|
644
634
|
}
|
|
645
635
|
}
|
|
646
636
|
|
|
647
637
|
/**
|
|
648
|
-
* `
|
|
638
|
+
* `Omit`, `Partial` and the other utility types are declared at the top of `lib.es5.d.ts`
|
|
649
639
|
*/
|
|
650
|
-
export function
|
|
651
|
-
let
|
|
640
|
+
export function isFromEs5Lib(symbolOpt) {
|
|
641
|
+
let declaration, symbol;
|
|
642
|
+
let matchResult, symbol_1;
|
|
652
643
|
if (symbolOpt != null) {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
if (matchValue != null) {
|
|
657
|
-
if ((declarations = matchValue, declarations.length > 0)) {
|
|
658
|
-
matchResult = 0;
|
|
659
|
-
declarations_1 = matchValue;
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
matchResult = 1;
|
|
663
|
-
}
|
|
644
|
+
if ((symbol = symbolOpt, symbol.declarations == null)) {
|
|
645
|
+
matchResult = 0;
|
|
646
|
+
symbol_1 = symbolOpt;
|
|
664
647
|
}
|
|
665
648
|
else {
|
|
666
649
|
matchResult = 1;
|
|
667
650
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
matchResult = 1;
|
|
654
|
+
}
|
|
655
|
+
switch (matchResult) {
|
|
656
|
+
case 0:
|
|
657
|
+
return contains(symbol_1.name, ofArray(["Iterable", "IterableIterator"]), {
|
|
658
|
+
Equals: (x, y) => (x === y),
|
|
659
|
+
GetHashCode: (x) => (stringHash(x) | 0),
|
|
660
|
+
});
|
|
661
|
+
default: {
|
|
662
|
+
const matchValue = libDeclaration(symbolOpt);
|
|
663
|
+
let matchResult_1, declaration_1;
|
|
664
|
+
if (matchValue != null) {
|
|
665
|
+
if ((declaration = matchValue, declaration.parent.kind === 308)) {
|
|
666
|
+
matchResult_1 = 0;
|
|
667
|
+
declaration_1 = matchValue;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
matchResult_1 = 1;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
matchResult_1 = 1;
|
|
675
|
+
}
|
|
676
|
+
switch (matchResult_1) {
|
|
677
|
+
case 0:
|
|
678
|
+
return declaration_1.parent.fileName.endsWith("/lib.es5.d.ts");
|
|
679
|
+
default:
|
|
680
|
+
return false;
|
|
672
681
|
}
|
|
673
|
-
default:
|
|
674
|
-
return false;
|
|
675
682
|
}
|
|
676
683
|
}
|
|
677
|
-
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* `PromiseConstructor` of `lib.es2015.promise.d.ts`: a type of the ECMAScript libraries
|
|
688
|
+
*/
|
|
689
|
+
export function isFromEsLib(symbolOpt) {
|
|
690
|
+
const matchValue = libDeclaration(symbolOpt);
|
|
691
|
+
if (matchValue == null) {
|
|
678
692
|
return false;
|
|
679
693
|
}
|
|
694
|
+
else {
|
|
695
|
+
const declaration = matchValue;
|
|
696
|
+
return normalizePath(declaration.getSourceFile().fileName).indexOf("/lib/lib.es") >= 0;
|
|
697
|
+
}
|
|
680
698
|
}
|
|
681
699
|
|
|
682
700
|
export const knownExternalTypeNames = ofSeq(["Date", "Promise", "Array", "ReadonlyArray", "Boolean", "Function", "Error", "RegExp", "Iterable", "IterableIterator", "IteratorObject", "ArrayIterator", "MapIterator", "SetIterator", "StringIterator", "Uint8Array", "Int8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array"], {
|
|
@@ -1713,3 +1731,25 @@ export function isPrivateMember(modifiers, name) {
|
|
|
1713
1731
|
}
|
|
1714
1732
|
}
|
|
1715
1733
|
|
|
1734
|
+
/**
|
|
1735
|
+
* The node a reference lands at, the reference itself unless members are read for another declaration
|
|
1736
|
+
*/
|
|
1737
|
+
export function landingOf(reader, node) {
|
|
1738
|
+
if (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing.length === 0) {
|
|
1739
|
+
return node;
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
return item_1(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing.length - 1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
export function isLibraryName(reader, name) {
|
|
1747
|
+
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
1748
|
+
if (matchValue == null) {
|
|
1749
|
+
return false;
|
|
1750
|
+
}
|
|
1751
|
+
else {
|
|
1752
|
+
return matchValue.IsLibraryName(name);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
|