@glutinum/cli 1.0.0-beta.1 → 1.0.0-beta.11

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.
Files changed (155) hide show
  1. package/README.md +16 -0
  2. package/dist/Glutinum.Converter/Abbreviations.js +16 -39
  3. package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
  4. package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
  5. package/dist/Glutinum.Converter/FsharpAST.js +117 -66
  6. package/dist/Glutinum.Converter/Generate.js +52 -26
  7. package/dist/Glutinum.Converter/GlueAST.js +85 -46
  8. package/dist/Glutinum.Converter/Hosting.js +148 -174
  9. package/dist/Glutinum.Converter/Merge.js +463 -355
  10. package/dist/Glutinum.Converter/Packages.js +387 -97
  11. package/dist/Glutinum.Converter/Printer.js +439 -400
  12. package/dist/Glutinum.Converter/Read.js +362 -100
  13. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
  14. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
  15. package/dist/Glutinum.Converter/Reader/Declaration.js +13 -19
  16. package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
  17. package/dist/Glutinum.Converter/Reader/Documentation.js +28 -40
  18. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
  19. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +104 -37
  20. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +24 -39
  21. package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
  22. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -17
  23. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +16 -22
  24. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +49 -6
  25. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
  26. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +4 -4
  27. package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
  28. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +54 -6
  29. package/dist/Glutinum.Converter/Reader/Node.js +11 -14
  30. package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
  31. package/dist/Glutinum.Converter/Reader/Report.js +4 -4
  32. package/dist/Glutinum.Converter/Reader/TypeNode.js +390 -1584
  33. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +80 -53
  34. package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
  35. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +24 -47
  36. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +24 -6
  37. package/dist/Glutinum.Converter/Reader/Types.js +297 -17
  38. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +16 -30
  39. package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
  40. package/dist/Glutinum.Converter/Reader/Utils.js +497 -111
  41. package/dist/Glutinum.Converter/Reader/VariableStatement.js +7 -8
  42. package/dist/Glutinum.Converter/Transform.js +2915 -8180
  43. package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
  44. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
  45. package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
  46. package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
  47. package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
  48. package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
  49. package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
  50. package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
  51. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
  52. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
  53. package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
  54. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
  55. package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +338 -0
  56. package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
  57. package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
  58. package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
  59. package/dist/Glutinum.Converter/Utils/List.js +2 -2
  60. package/dist/Glutinum.Converter/Utils/Naming.js +6 -6
  61. package/dist/Glutinum.Converter/Utils/String.js +16 -5
  62. package/dist/Program.js +104 -241
  63. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +2 -2
  64. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +4 -4
  65. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +2 -2
  66. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +5 -5
  67. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +4 -4
  68. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +3 -3
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +1 -1
  70. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +3 -3
  71. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +1 -1
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +1 -1
  73. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +4 -4
  74. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +1 -1
  75. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +3 -3
  76. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +1 -1
  77. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +1 -1
  78. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +1 -1
  79. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +2 -2
  80. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +2 -2
  81. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +1 -1
  82. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +7 -7
  83. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +1 -1
  84. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Async.js +21 -7
  85. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/AsyncBuilder.js +51 -6
  86. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CHANGELOG.md +23 -1
  87. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CollectionUtil.js +10 -16
  88. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MailboxProcessor.js +19 -3
  89. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableMap.js +5 -1
  90. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableSet.js +5 -1
  91. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Util.js +15 -3
  92. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/package.json +1 -1
  93. package/package.json +3 -2
  94. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Array.js +0 -0
  95. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BigInt.js +0 -0
  96. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BitConverter.js +0 -0
  97. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Boolean.js +0 -0
  98. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Char.js +0 -0
  99. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Choice.js +0 -0
  100. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/ConditionalWeakTable.js +0 -0
  101. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Date.js +0 -0
  102. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOffset.js +0 -0
  103. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnly.js +0 -0
  104. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnlyTemporal.js +0 -0
  105. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeFormat.js +0 -0
  106. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeOffsetTemporal.js +0 -0
  107. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeTemporal.js +0 -0
  108. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Decimal.js +0 -0
  109. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Directory.js +0 -0
  110. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Double.js +0 -0
  111. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Encoding.js +0 -0
  112. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Environment.js +0 -0
  113. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Event.js +0 -0
  114. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Collections.js +0 -0
  115. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.CompilerServices.js +0 -0
  116. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.js +0 -0
  117. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/File.js +0 -0
  118. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Global.js +0 -0
  119. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Guid.js +0 -0
  120. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Int32.js +0 -0
  121. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/List.js +0 -0
  122. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Long.js +0 -0
  123. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Map.js +0 -0
  124. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MapUtil.js +0 -0
  125. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Native.js +0 -0
  126. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Numeric.js +0 -0
  127. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Observable.js +0 -0
  128. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Option.js +0 -0
  129. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Path.js +0 -0
  130. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/README.md +0 -0
  131. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Random.js +0 -0
  132. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Range.js +0 -0
  133. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Reflection.js +0 -0
  134. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/RegExp.js +0 -0
  135. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Result.js +0 -0
  136. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq.js +0 -0
  137. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq2.js +0 -0
  138. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Set.js +0 -0
  139. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/String.js +0 -0
  140. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Collections.Generic.js +0 -0
  141. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Text.js +0 -0
  142. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.js +0 -0
  143. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Task.js +0 -0
  144. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TaskBuilder.js +0 -0
  145. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnly.js +0 -0
  146. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnlyTemporal.js +0 -0
  147. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpan.js +0 -0
  148. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpanTemporal.js +0 -0
  149. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Timer.js +0 -0
  150. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Types.js +0 -0
  151. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Unicode.13.0.0.js +0 -0
  152. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Uri.js +0 -0
  153. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/big.d.ts +0 -0
  154. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/lib/big.js +0 -0
  155. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/quotation.js +0 -0
@@ -1,24 +1,23 @@
1
1
 
2
- import { orElse, defaultArg, some } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
3
- import { tryParse } from "../../fable_modules/fable-library-js.5.17.2/Int32.js";
4
- import { FSharpRef } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
5
- import { GlueTypeParameter, GlueType, GlueAccessor, GlueLiteral } from "../GlueAST.js";
6
- import { tryParse as tryParse_1 } from "../../fable_modules/fable-library-js.5.17.2/Double.js";
7
- import { comparePrimitives, stringHash, defaultOf } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
8
- import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
9
- import { normalizePath } from "../Utils/String.js";
10
- import { class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
11
- import { tryPick, last, toList, tryHead, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
12
- import { PackageContext__ModulePath_Z55EFCE8F, PackageContext__IsEntryFile_Z721C83C5, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
13
- import { append, cons, tryHead as tryHead_1, exists as exists_1, tryFind, isEmpty, filter, head, tryItem, mapIndexed, choose, ofArray, contains, collect as collect_1, empty, map as map_1 } from "../../fable_modules/fable-library-js.5.17.2/List.js";
14
- import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
15
- import { contains as contains_1, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
16
- import { ofList, empty as empty_1 } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
17
- import { replace } from "../../fable_modules/fable-library-js.5.17.2/RegExp.js";
18
- import { substring, split } from "../../fable_modules/fable-library-js.5.17.2/String.js";
2
+ import { orElse, defaultArg, some } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
3
+ import { GlueTypeParameter, GlueAccessor, GlueLiteral, GlueType, GluePrimitive } from "../GlueAST.js";
4
+ import { tryParse } from "../../fable_modules/fable-library-js.5.21.0/Int32.js";
5
+ import { FSharpRef } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
6
+ import { tryParse as tryParse_1 } from "../../fable_modules/fable-library-js.5.21.0/Double.js";
7
+ import { equals, comparePrimitives, stringHash, defaultOf } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
8
+ import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
9
+ import { withoutDeclarationExtension, normalizePath } from "../Utils/String.js";
10
+ import { class_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
11
+ import { tryPick, map as map_2, last, iterate, toList, tryHead, exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
12
+ import { PackageContext__ModulePath_Z7E147617, PackageContext__NestedAmbientModuleSegments_32BC514A, PackageContext__IsExternalLibFile_Z721C83C5, PackageContext__IsEntryFile_Z721C83C5, ambientSpecifier, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
13
+ import { tail, append, cons, tryHead as tryHead_1, exists as exists_1, tryFind, isEmpty, filter, head, tryItem, mapIndexed, choose, ofArray, contains, collect as collect_1, empty, map as map_1 } from "../../fable_modules/fable-library-js.5.21.0/List.js";
14
+ import { item as item_1 } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
15
+ import { contains as contains_1, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
16
+ import { ofList, empty as empty_1 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
17
+ import { substring, split } from "../../fable_modules/fable-library-js.5.21.0/String.js";
19
18
  import { sanitizeTypeName, removeSurroundingQuotes } from "../Utils/Naming.js";
20
19
  import { ts } from "@ts-morph/bootstrap";
21
- import { FSharpChoice$3, FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.17.2/Choice.js";
20
+ import { FSharpChoice$3, FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.21.0/Choice.js";
22
21
 
23
22
  export function $007CHasTypeFlags$007C_$007C(flag, flags) {
24
23
  if ((flags & flag) !== 0) {
@@ -29,6 +28,61 @@ export function $007CHasTypeFlags$007C_$007C(flag, flags) {
29
28
  }
30
29
  }
31
30
 
31
+ export const typeNodeBuilderFlags = 1 | 16384;
32
+
33
+ /**
34
+ * The primitive a type resolves to by its flags, `obj` for the others
35
+ */
36
+ export function primitiveOfFlags(typ) {
37
+ const matchValue = typ.flags;
38
+ if ($007CHasTypeFlags$007C_$007C(32, matchValue) != null) {
39
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
40
+ }
41
+ else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
42
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
43
+ }
44
+ else if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
45
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
46
+ }
47
+ else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
48
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
49
+ }
50
+ else if ($007CHasTypeFlags$007C_$007C(16, matchValue) != null) {
51
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
52
+ }
53
+ else {
54
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
55
+ }
56
+ }
57
+
58
+ export function removeParenthesizedType(node_mut) {
59
+ removeParenthesizedType:
60
+ while (true) {
61
+ const node = node_mut;
62
+ if (node.kind === 197) {
63
+ node_mut = node.type;
64
+ continue removeParenthesizedType;
65
+ }
66
+ else {
67
+ return node;
68
+ }
69
+ break;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Read with `item` among the ones in progress, so that a declaration reaching itself is detected
75
+ */
76
+ export function withInProgress(inProgress, item, read) {
77
+ void (inProgress.push(item));
78
+ try {
79
+ return read();
80
+ }
81
+ finally {
82
+ inProgress.splice(inProgress.length - 1, 1);
83
+ }
84
+ }
85
+
32
86
  export function $007CHasSymbolFlags$007C_$007C(flag, flags) {
33
87
  if ((flags & flag) !== 0) {
34
88
  return some(undefined);
@@ -168,13 +222,15 @@ export function tryReadLiteral(checker, expression) {
168
222
  }
169
223
 
170
224
  /**
171
- * Nodes synthesized by <c>typeToTypeNode</c> have no source text
172
225
  * An `Identifier` and a `StringLiteral` both carry the name in `text`
173
226
  */
174
227
  export function moduleExportNameText(name) {
175
228
  return name.text;
176
229
  }
177
230
 
231
+ /**
232
+ * Nodes synthesized by <c>typeToTypeNode</c> have no source text
233
+ */
178
234
  export function identifierText(node) {
179
235
  if (Operators_IsNull(node.text)) {
180
236
  return node.getText();
@@ -197,14 +253,29 @@ export function entityNameText(node) {
197
253
  }
198
254
 
199
255
  /**
200
- * Identity of an anonymous type, a node synthesized by `typeToTypeNode` has none
256
+ * A node synthesized by `typeToTypeNode` has a negative position, or in TypeScript 6 a
257
+ * position without a source file; the checker throws when given one as enclosing declaration
201
258
  */
202
- export function typeLiteralId(node) {
259
+ export function enclosingDeclarationOf(node) {
203
260
  if ((node.pos < 0) ? true : Operators_IsNull(node.getSourceFile())) {
204
261
  return undefined;
205
262
  }
206
263
  else {
207
- return `${normalizePath(node.getSourceFile().fileName)}:${node.pos}`;
264
+ return node;
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Identity of an anonymous type, a node synthesized by `typeToTypeNode` has none
270
+ */
271
+ export function typeLiteralId(node) {
272
+ let node_1;
273
+ const option_1 = enclosingDeclarationOf(node);
274
+ if (option_1 != null) {
275
+ return (node_1 = option_1, `${normalizePath(node_1.getSourceFile().fileName)}:${node_1.pos}`);
276
+ }
277
+ else {
278
+ return undefined;
208
279
  }
209
280
  }
210
281
 
@@ -495,82 +566,135 @@ export function resolvedBaseTypeArguments(checker, expression) {
495
566
  }
496
567
  }
497
568
 
569
+ function readExternalBase(reader, clauseType) {
570
+ const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
571
+ if (matchValue == null) {
572
+ }
573
+ else {
574
+ const packageContext = matchValue;
575
+ let option_5;
576
+ let option_3;
577
+ const option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(clauseType.expression);
578
+ let mapping;
579
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
580
+ mapping = ((symbol) => followAlias(checker, symbol));
581
+ const option_1 = option;
582
+ option_3 = ((option_1 != null) ? mapping(option_1) : undefined);
583
+ if (option_3 != null) {
584
+ const symbol_1 = option_3;
585
+ option_5 = symbol_1.declarations;
586
+ }
587
+ else {
588
+ option_5 = undefined;
589
+ }
590
+ if (option_5 != null) {
591
+ iterate((declaration) => {
592
+ const declaration_1 = declaration;
593
+ if (((declaration_1.kind === 265) && !reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.HasRead6C0FD055"](declaration_1)) && (PackageContext__TryFindExternalModulePath_Z721C83C5(packageContext, declaration_1.getSourceFile().fileName) != null)) {
594
+ reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1);
595
+ }
596
+ }, option_5);
597
+ }
598
+ }
599
+ }
600
+
498
601
  export function readHeritageClauses(reader, heritageClauses) {
499
602
  if (heritageClauses == null) {
500
603
  return empty();
501
604
  }
502
605
  else {
503
- return collect_1((clause) => map_1((typNode) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode), toList(clause.types)), toList(heritageClauses));
606
+ return collect_1((clause) => map_1((clauseType) => {
607
+ readExternalBase(reader, clauseType);
608
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](clauseType);
609
+ }, toList(clause.types)), toList(heritageClauses));
504
610
  }
505
611
  }
506
612
 
507
- /**
508
- * Determine if the type is from the ES5 library
509
- *
510
- * This is to detect native utility types usage
511
- */
512
- export function isFromEs5Lib(symbolOpt) {
513
- if (symbolOpt != null) {
514
- const symbol = symbolOpt;
515
- const matchValue = symbol.declarations;
516
- if (matchValue != null) {
517
- const declarations = matchValue;
518
- if ((declarations.length === 0) ? true : Operators_IsNull(item(0, declarations).parent)) {
519
- return false;
520
- }
521
- else if (item(0, declarations).parent.kind === 308) {
522
- const sourceFile = item(0, declarations).parent;
523
- return sourceFile.fileName.endsWith("/lib.es5.d.ts");
524
- }
525
- else {
526
- return false;
527
- }
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;
528
627
  }
529
628
  else {
530
- return contains(symbol.name, ofArray(["Iterable", "IterableIterator"]), {
531
- Equals: (x, y) => (x === y),
532
- GetHashCode: (x) => (stringHash(x) | 0),
533
- });
629
+ return item_1(0, declarations);
534
630
  }
535
631
  }
536
632
  else {
537
- return false;
633
+ return undefined;
538
634
  }
539
635
  }
540
636
 
541
637
  /**
542
- * `PromiseConstructor` of `lib.es2015.promise.d.ts`: a type of the ECMAScript libraries
638
+ * `Omit`, `Partial` and the other utility types are declared at the top of `lib.es5.d.ts`
543
639
  */
544
- export function isFromEsLib(symbolOpt) {
545
- let declarations;
640
+ export function isFromEs5Lib(symbolOpt) {
641
+ let declaration, symbol;
642
+ let matchResult, symbol_1;
546
643
  if (symbolOpt != null) {
547
- const symbol = symbolOpt;
548
- const matchValue = symbol.declarations;
549
- let matchResult, declarations_1;
550
- if (matchValue != null) {
551
- if ((declarations = matchValue, declarations.length > 0)) {
552
- matchResult = 0;
553
- declarations_1 = matchValue;
554
- }
555
- else {
556
- matchResult = 1;
557
- }
644
+ if ((symbol = symbolOpt, symbol.declarations == null)) {
645
+ matchResult = 0;
646
+ symbol_1 = symbolOpt;
558
647
  }
559
648
  else {
560
649
  matchResult = 1;
561
650
  }
562
- switch (matchResult) {
563
- case 0: {
564
- const fileName = normalizePath(item(0, declarations_1).getSourceFile().fileName);
565
- return fileName.indexOf("/lib/lib.es") >= 0;
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;
566
681
  }
567
- default:
568
- return false;
569
682
  }
570
683
  }
571
- else {
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) {
572
692
  return false;
573
693
  }
694
+ else {
695
+ const declaration = matchValue;
696
+ return normalizePath(declaration.getSourceFile().fileName).indexOf("/lib/lib.es") >= 0;
697
+ }
574
698
  }
575
699
 
576
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"], {
@@ -594,7 +718,19 @@ export function resolveAlias(checker, symbol) {
594
718
  }
595
719
 
596
720
  /**
597
- * Name of the declaration behind an `import { X as Y }` alias, `None` for a non-renamed symbol
721
+ * `type X` beside `export { x as X }` is one symbol flagged both `TypeAlias` and `Alias`
722
+ */
723
+ export function resolveValueAlias(checker, symbol) {
724
+ const matchValue = symbol.flags;
725
+ if ($007CHasSymbolFlags$007C_$007C(788968, matchValue) != null) {
726
+ return symbol;
727
+ }
728
+ else {
729
+ return resolveAlias(checker, symbol);
730
+ }
731
+ }
732
+
733
+ /**
598
734
  * `Omit<LabelOption, "rotate">` where `interface LabelOption<T = Params>`: `T` is `Params`
599
735
  */
600
736
  export function defaultTypeArguments(reader, typeNode) {
@@ -662,42 +798,63 @@ export function declaredName(symbol) {
662
798
  }
663
799
  }
664
800
 
801
+ /**
802
+ * Name of the declaration behind an `import { X as Y }` alias, `None` for a non-renamed symbol
803
+ */
665
804
  export function importedName(checker, symbol) {
666
805
  let target, target_1;
806
+ let isType;
667
807
  const matchValue = symbol.flags;
668
- if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue) != null) {
669
- const matchValue_1 = resolveAlias(checker, symbol);
670
- let matchResult, target_2, target_3;
671
- if (matchValue_1 != null) {
672
- if ((target = matchValue_1, target.name === "default")) {
673
- matchResult = 0;
674
- target_2 = matchValue_1;
675
- }
676
- else if ((target_1 = matchValue_1, (target_1.name !== symbol.name) && (target_1.name !== "export="))) {
677
- matchResult = 1;
678
- target_3 = matchValue_1;
679
- }
680
- else {
681
- matchResult = 2;
682
- }
808
+ isType = ($007CHasSymbolFlags$007C_$007C(788968, matchValue) != null);
809
+ const matchValue_1 = symbol.flags;
810
+ let matchResult;
811
+ if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue_1) != null) {
812
+ if (!isType) {
813
+ matchResult = 0;
683
814
  }
684
815
  else {
685
- matchResult = 2;
686
- }
687
- switch (matchResult) {
688
- case 0:
689
- return declaredName(target_2);
690
- case 1:
691
- return target_3.name;
692
- default:
693
- return undefined;
816
+ matchResult = 1;
694
817
  }
695
818
  }
696
- else if (symbol.name === "default") {
697
- return declaredName(symbol);
698
- }
699
819
  else {
700
- return undefined;
820
+ matchResult = 1;
821
+ }
822
+ switch (matchResult) {
823
+ case 0: {
824
+ const matchValue_2 = resolveAlias(checker, symbol);
825
+ let matchResult_1, target_2, target_3;
826
+ if (matchValue_2 != null) {
827
+ if ((target = matchValue_2, target.name === "default")) {
828
+ matchResult_1 = 0;
829
+ target_2 = matchValue_2;
830
+ }
831
+ else if ((target_1 = matchValue_2, (target_1.name !== symbol.name) && (target_1.name !== "export="))) {
832
+ matchResult_1 = 1;
833
+ target_3 = matchValue_2;
834
+ }
835
+ else {
836
+ matchResult_1 = 2;
837
+ }
838
+ }
839
+ else {
840
+ matchResult_1 = 2;
841
+ }
842
+ switch (matchResult_1) {
843
+ case 0:
844
+ return declaredName(target_2);
845
+ case 1:
846
+ return target_3.name;
847
+ default:
848
+ return undefined;
849
+ }
850
+ }
851
+ default:
852
+ if (symbol.name === "default") {
853
+ return declaredName(symbol);
854
+ }
855
+ else {
856
+ return undefined;
857
+ }
701
858
  }
702
859
  }
703
860
 
@@ -959,10 +1116,10 @@ export function promotedAmbientModule(sourceFile) {
959
1116
  }
960
1117
  else {
961
1118
  const ambientModules = map_1((statement_2) => statement_2, filter(isAmbientModule, statements));
962
- const fileName = replace(last(split(normalizePath(sourceFile.fileName), ["/"], undefined, 0)), "\\.d\\.[cm]?ts$", "");
1119
+ const fileName_1 = withoutDeclarationExtension(last(split(normalizePath(sourceFile.fileName), ["/"], undefined, 0)));
963
1120
  const namedLikeTheFile = filter((moduleDeclaration_2) => {
964
1121
  let name;
965
- return ((name = removeSurroundingQuotes(moduleDeclaration_2.name.text), name.startsWith("node:") ? substring(name, "node:".length) : name)) === fileName;
1122
+ return ((name = removeSurroundingQuotes(moduleDeclaration_2.name.text), name.startsWith("node:") ? substring(name, "node:".length) : name)) === fileName_1;
966
1123
  }, ambientModules);
967
1124
  return orElse(orElse(tryFind((moduleDeclaration_1) => {
968
1125
  let body;
@@ -990,6 +1147,23 @@ export function promotedAmbientModule(sourceFile) {
990
1147
  }
991
1148
  }
992
1149
 
1150
+ /**
1151
+ * The names of the ambient modules the program declares, `node:fs` when declared as such
1152
+ */
1153
+ export function ambientModuleNames(checker) {
1154
+ return ofSeq(map_2((symbol) => removeSurroundingQuotes(symbol.name), checker.getAmbientModules()), {
1155
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
1156
+ });
1157
+ }
1158
+
1159
+ /**
1160
+ * The specifier of the ambient module a file is made of, `node:fs` when the program declares
1161
+ * that alias too
1162
+ */
1163
+ export function ambientModuleSpecifier(ambientModuleNames_1, moduleDeclaration) {
1164
+ return ambientSpecifier(ambientModuleNames_1, removeSurroundingQuotes(moduleDeclaration.name.text));
1165
+ }
1166
+
993
1167
  export function isPromotedAmbientModule(declaration) {
994
1168
  const parent = declaration.parent;
995
1169
  if (!Operators_IsNull(parent) && (parent.kind === 308)) {
@@ -1062,6 +1236,62 @@ export function isExportedDeclaration(statement, names) {
1062
1236
  }
1063
1237
  }
1064
1238
 
1239
+ /**
1240
+ * `declare class Client {}; export { Client as default }`
1241
+ */
1242
+ export function isDefaultInExportList(statement, name) {
1243
+ if (statement.parent.kind === 308) {
1244
+ return exists((other) => {
1245
+ let exportClause;
1246
+ if (other.kind === 279) {
1247
+ const exportDeclaration = other;
1248
+ if (exportDeclaration.moduleSpecifier == null) {
1249
+ const matchValue_1 = exportDeclaration.exportClause;
1250
+ let matchResult, exportClause_1;
1251
+ if (matchValue_1 != null) {
1252
+ if ((exportClause = matchValue_1, exportClause.kind === 280)) {
1253
+ matchResult = 0;
1254
+ exportClause_1 = matchValue_1;
1255
+ }
1256
+ else {
1257
+ matchResult = 1;
1258
+ }
1259
+ }
1260
+ else {
1261
+ matchResult = 1;
1262
+ }
1263
+ switch (matchResult) {
1264
+ case 0:
1265
+ return exists((specifier) => {
1266
+ const matchValue_2 = specifier.propertyName;
1267
+ if (matchValue_2 == null) {
1268
+ return false;
1269
+ }
1270
+ else if (identifierText(matchValue_2) === name) {
1271
+ return identifierText(specifier.name) === "default";
1272
+ }
1273
+ else {
1274
+ return false;
1275
+ }
1276
+ }, exportClause_1.elements);
1277
+ default:
1278
+ return false;
1279
+ }
1280
+ }
1281
+ else {
1282
+ return false;
1283
+ }
1284
+ }
1285
+ else {
1286
+ return false;
1287
+ }
1288
+ }, statement.getSourceFile().statements);
1289
+ }
1290
+ else {
1291
+ return false;
1292
+ }
1293
+ }
1294
+
1065
1295
  /**
1066
1296
  * `declare class Dispatcher {}; export default Dispatcher` or `export = Dispatcher`
1067
1297
  */
@@ -1161,8 +1391,8 @@ export function isGlobalScriptOfPackage(packageContext, sourceFile) {
1161
1391
  }
1162
1392
  else {
1163
1393
  const packageContext_1 = packageContext;
1164
- if (!(ts.isExternalModule(sourceFile)) && (promotedAmbientModule(sourceFile) == null)) {
1165
- return !PackageContext__IsEntryFile_Z721C83C5(packageContext_1, sourceFile.fileName);
1394
+ if ((!(ts.isExternalModule(sourceFile)) && (promotedAmbientModule(sourceFile) == null)) && !PackageContext__IsEntryFile_Z721C83C5(packageContext_1, sourceFile.fileName)) {
1395
+ return !PackageContext__IsExternalLibFile_Z721C83C5(packageContext_1, sourceFile.fileName);
1166
1396
  }
1167
1397
  else {
1168
1398
  return false;
@@ -1272,10 +1502,42 @@ function namespaceChain(packageContext, declaration) {
1272
1502
  else {
1273
1503
  const moduleDeclaration = node;
1274
1504
  const rawName = removeSurroundingQuotes(moduleDeclaration.name.getText());
1275
- const name = isTopLevelModuleDeclaration(packageContext, node) ? sanitizeTypeName(rawName + "_") : sanitizeTypeName(rawName);
1276
- node_mut = node.parent;
1277
- acc_mut = cons(name, acc);
1278
- continue collect;
1505
+ const sourceFile = node.getSourceFile();
1506
+ let ambientModuleOfScript;
1507
+ let matchResult, packageContext_2;
1508
+ if (packageContext != null) {
1509
+ if (isAmbientModuleDeclaration(node) && !(ts.isExternalModule(sourceFile))) {
1510
+ matchResult = 0;
1511
+ packageContext_2 = packageContext;
1512
+ }
1513
+ else {
1514
+ matchResult = 1;
1515
+ }
1516
+ }
1517
+ else {
1518
+ matchResult = 1;
1519
+ }
1520
+ switch (matchResult) {
1521
+ case 0: {
1522
+ const option_1 = PackageContext__TryFindPackage_Z721C83C5(packageContext_2, sourceFile.fileName);
1523
+ ambientModuleOfScript = ((option_1 != null) ? PackageContext__NestedAmbientModuleSegments_32BC514A(packageContext_2, option_1, sourceFile.fileName, rawName) : undefined);
1524
+ break;
1525
+ }
1526
+ default:
1527
+ ambientModuleOfScript = undefined;
1528
+ }
1529
+ if (ambientModuleOfScript == null) {
1530
+ const name = isTopLevelModuleDeclaration(packageContext, node) ? sanitizeTypeName(rawName + "_") : sanitizeTypeName(rawName);
1531
+ node_mut = node.parent;
1532
+ acc_mut = cons(name, acc);
1533
+ continue collect;
1534
+ }
1535
+ else {
1536
+ const segments = ambientModuleOfScript;
1537
+ node_mut = node.parent;
1538
+ acc_mut = append(segments, acc);
1539
+ continue collect;
1540
+ }
1279
1541
  }
1280
1542
  }
1281
1543
  else {
@@ -1290,11 +1552,45 @@ function namespaceChain(packageContext, declaration) {
1290
1552
  return collect(declaration.parent, empty());
1291
1553
  }
1292
1554
 
1555
+ function topLevelDeclarationName(declaration) {
1556
+ const top = (node_mut) => {
1557
+ top:
1558
+ while (true) {
1559
+ const node = node_mut;
1560
+ const matchValue = node.parent;
1561
+ if (equals(matchValue, defaultOf())) {
1562
+ return node;
1563
+ }
1564
+ else if (matchValue.kind === 308) {
1565
+ return node;
1566
+ }
1567
+ else {
1568
+ node_mut = matchValue;
1569
+ continue top;
1570
+ }
1571
+ break;
1572
+ }
1573
+ };
1574
+ const top_1 = top(declaration);
1575
+ const matchValue_1 = top_1.name;
1576
+ if (equals(matchValue_1, defaultOf())) {
1577
+ if ((top_1.kind === 244) && (declaration.kind === 261)) {
1578
+ return declaration.name.getText();
1579
+ }
1580
+ else {
1581
+ return undefined;
1582
+ }
1583
+ }
1584
+ else {
1585
+ return matchValue_1.getText();
1586
+ }
1587
+ }
1588
+
1293
1589
  /**
1294
1590
  * The F# modules qualifying a declaration from another file: its file modules and its namespaces
1295
1591
  */
1296
1592
  export function modulePathForDeclaration(packageContext, declaration) {
1297
- return append(PackageContext__ModulePath_Z55EFCE8F(packageContext, normalizePath(declaration.getSourceFile().fileName), !isPackageGlobal(packageContext, declaration)), namespaceChain(packageContext, declaration));
1593
+ return append(PackageContext__ModulePath_Z7E147617(packageContext, normalizePath(declaration.getSourceFile().fileName), !isPackageGlobal(packageContext, declaration), topLevelDeclarationName(declaration)), namespaceChain(packageContext, declaration));
1298
1594
  }
1299
1595
 
1300
1596
  /**
@@ -1302,7 +1598,7 @@ export function modulePathForDeclaration(packageContext, declaration) {
1302
1598
  * in package mode, and the namespaces when the reference is written qualified.
1303
1599
  */
1304
1600
  export function modulePathForSymbol(checker, packageContext, isQualified, symbolOpt) {
1305
- let declaration_3;
1601
+ let option_3, declaration_4;
1306
1602
  let matchValue;
1307
1603
  const option_1 = symbolOpt;
1308
1604
  matchValue = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
@@ -1327,19 +1623,75 @@ export function modulePathForSymbol(checker, packageContext, isQualified, symbol
1327
1623
  }
1328
1624
  switch (matchResult) {
1329
1625
  case 0: {
1330
- filePath = PackageContext__ModulePath_Z55EFCE8F(packageContext_1, fileName, (declaration == null) ? true : !isPackageGlobal(packageContext_1, declaration));
1626
+ filePath = PackageContext__ModulePath_Z7E147617(packageContext_1, fileName, (declaration == null) ? true : !isPackageGlobal(packageContext_1, declaration), (option_3 = declaration, (option_3 != null) ? topLevelDeclarationName(option_3) : undefined));
1331
1627
  break;
1332
1628
  }
1333
1629
  default:
1334
1630
  filePath = empty();
1335
1631
  }
1336
- return append(filePath, (declaration != null) ? ((isQualified ? true : !isEmpty(filePath)) ? ((declaration_3 = declaration, namespaceChain(packageContext, declaration_3))) : empty()) : empty());
1632
+ return append(filePath, (declaration != null) ? ((isQualified ? true : !isEmpty(filePath)) ? ((declaration_4 = declaration, namespaceChain(packageContext, declaration_4))) : empty()) : empty());
1337
1633
  }
1338
1634
  else {
1339
1635
  return empty();
1340
1636
  }
1341
1637
  }
1342
1638
 
1639
+ /**
1640
+ * The declaration is in a namespace the landing node does not see, an enclosing one is seen
1641
+ */
1642
+ export function crossesNamespace(checker, packageContext, symbolOpt, landing) {
1643
+ const isEnclosing = (declared_mut, landed_mut) => {
1644
+ isEnclosing:
1645
+ while (true) {
1646
+ const declared = declared_mut, landed = landed_mut;
1647
+ let matchResult, d_1, declared_2, l_1, landed_2;
1648
+ if (!isEmpty(declared)) {
1649
+ if (!isEmpty(landed)) {
1650
+ if (head(declared) === head(landed)) {
1651
+ matchResult = 1;
1652
+ d_1 = head(declared);
1653
+ declared_2 = tail(declared);
1654
+ l_1 = head(landed);
1655
+ landed_2 = tail(landed);
1656
+ }
1657
+ else {
1658
+ matchResult = 2;
1659
+ }
1660
+ }
1661
+ else {
1662
+ matchResult = 2;
1663
+ }
1664
+ }
1665
+ else {
1666
+ matchResult = 0;
1667
+ }
1668
+ switch (matchResult) {
1669
+ case 0:
1670
+ return true;
1671
+ case 1: {
1672
+ declared_mut = declared_2;
1673
+ landed_mut = landed_2;
1674
+ continue isEnclosing;
1675
+ }
1676
+ default:
1677
+ return false;
1678
+ }
1679
+ break;
1680
+ }
1681
+ };
1682
+ let matchValue_1;
1683
+ let option_3;
1684
+ const option_1 = symbolOpt;
1685
+ option_3 = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
1686
+ matchValue_1 = ((option_3 != null) ? mainDeclaration(packageContext, option_3) : undefined);
1687
+ if (matchValue_1 == null) {
1688
+ return false;
1689
+ }
1690
+ else {
1691
+ return !isEnclosing(namespaceChain(packageContext, matchValue_1), namespaceChain(packageContext, landing));
1692
+ }
1693
+ }
1694
+
1343
1695
  export function Type_StringLiteral_$007CString$007COther$007C(literalType) {
1344
1696
  const matchValue = literalType.flags;
1345
1697
  if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
@@ -1367,3 +1719,37 @@ export function Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(literalType
1367
1719
  }
1368
1720
  }
1369
1721
 
1722
+ /**
1723
+ * `private x` and `#x` are both private, an F# interface has no such member
1724
+ */
1725
+ export function isPrivateMember(modifiers, name) {
1726
+ if (ModifierUtil_HasModifier_742AC9D(modifiers, 123)) {
1727
+ return true;
1728
+ }
1729
+ else {
1730
+ return name.kind === 81;
1731
+ }
1732
+ }
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
+