@glutinum/cli 0.14.1 → 1.0.0-beta.1

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 (39) hide show
  1. package/dist/Glutinum.Converter/FsharpAST.js +38 -4
  2. package/dist/Glutinum.Converter/Generate.js +15 -7
  3. package/dist/Glutinum.Converter/GlueAST.js +45 -36
  4. package/dist/Glutinum.Converter/Hosting.js +918 -0
  5. package/dist/Glutinum.Converter/Merge.js +218 -82
  6. package/dist/Glutinum.Converter/Packages.js +44 -8
  7. package/dist/Glutinum.Converter/Printer.js +77 -49
  8. package/dist/Glutinum.Converter/Read.js +8 -8
  9. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
  10. package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
  11. package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
  12. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
  13. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
  14. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
  15. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
  16. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
  17. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
  18. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
  19. package/dist/Glutinum.Converter/Reader/Node.js +20 -20
  20. package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
  21. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
  22. package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
  23. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
  24. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
  25. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
  26. package/dist/Glutinum.Converter/Reader/Types.js +6 -6
  27. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
  28. package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
  29. package/dist/Glutinum.Converter/Transform.js +2057 -700
  30. package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
  31. package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
  32. package/dist/Glutinum.Converter/Utils/String.js +2 -2
  33. package/dist/Program.js +38 -26
  34. package/package.json +2 -2
  35. package/dist/Glutinum.Converter/TypeScript.js +0 -12
  36. package/src/Glutinum.Converter/js/bootstrap.js +0 -123
  37. package/src/Glutinum.Converter/js/host.js +0 -144
  38. package/src/Glutinum.Converter/js/npm.js +0 -137
  39. package/src/Glutinum.Converter/js/resolve.js +0 -402
@@ -6,17 +6,17 @@ import { GlueTypeParameter, GlueType, GlueAccessor, GlueLiteral } from "../GlueA
6
6
  import { tryParse as tryParse_1 } from "../../fable_modules/fable-library-js.5.17.2/Double.js";
7
7
  import { comparePrimitives, stringHash, defaultOf } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
8
8
  import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
9
+ import { normalizePath } from "../Utils/String.js";
9
10
  import { class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
10
11
  import { tryPick, last, toList, tryHead, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
11
12
  import { PackageContext__ModulePath_Z55EFCE8F, PackageContext__IsEntryFile_Z721C83C5, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
12
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";
13
14
  import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
14
- import { normalizePath } from "../Utils/String.js";
15
15
  import { contains as contains_1, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
16
16
  import { ofList, empty as empty_1 } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
17
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";
18
19
  import { sanitizeTypeName, removeSurroundingQuotes } from "../Utils/Naming.js";
19
- import { substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
20
20
  import { ts } from "@ts-morph/bootstrap";
21
21
  import { FSharpChoice$3, FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.17.2/Choice.js";
22
22
 
@@ -151,7 +151,7 @@ export function tryReadLiteral(checker, expression) {
151
151
  const text_1 = expression.getText();
152
152
  const resolvedType = checker.getTypeAtLocation(expression);
153
153
  const matchValue_2 = resolvedType.flags;
154
- if ($007CHasTypeFlags$007C_$007C(256, matchValue_2) != null) {
154
+ if ($007CHasTypeFlags$007C_$007C(2048, matchValue_2) != null) {
155
155
  const value = resolvedType.value;
156
156
  if (Number.isSafeInteger(value) && !isWrittenAsFloat(text_1)) {
157
157
  return new GlueLiteral(/* Int */ 1, [value]);
@@ -169,7 +169,12 @@ export function tryReadLiteral(checker, expression) {
169
169
 
170
170
  /**
171
171
  * Nodes synthesized by <c>typeToTypeNode</c> have no source text
172
+ * An `Identifier` and a `StringLiteral` both carry the name in `text`
172
173
  */
174
+ export function moduleExportNameText(name) {
175
+ return name.text;
176
+ }
177
+
173
178
  export function identifierText(node) {
174
179
  if (Operators_IsNull(node.text)) {
175
180
  return node.getText();
@@ -183,7 +188,7 @@ export function identifierText(node) {
183
188
  * The last name of `ns.Foo`, `Foo` for an identifier
184
189
  */
185
190
  export function entityNameText(node) {
186
- if (node.kind === 166) {
191
+ if (node.kind === 167) {
187
192
  return identifierText(node.right);
188
193
  }
189
194
  else {
@@ -191,6 +196,18 @@ export function entityNameText(node) {
191
196
  }
192
197
  }
193
198
 
199
+ /**
200
+ * Identity of an anonymous type, a node synthesized by `typeToTypeNode` has none
201
+ */
202
+ export function typeLiteralId(node) {
203
+ if ((node.pos < 0) ? true : Operators_IsNull(node.getSourceFile())) {
204
+ return undefined;
205
+ }
206
+ else {
207
+ return `${normalizePath(node.getSourceFile().fileName)}:${node.pos}`;
208
+ }
209
+ }
210
+
194
211
  /**
195
212
  * Identifiers synthesized by <c>typeToTypeNode</c> carry their symbol, they can't be resolved by position
196
213
  */
@@ -198,10 +215,10 @@ export function symbolAtLocation(checker, node) {
198
215
  if (!Operators_IsNull(node.symbol)) {
199
216
  return node.symbol;
200
217
  }
201
- else if ((node.kind === 166) && !Operators_IsNull(node.right.symbol)) {
218
+ else if ((node.kind === 167) && !Operators_IsNull(node.right.symbol)) {
202
219
  return node.right.symbol;
203
220
  }
204
- else if (((node.kind === 166) && !Operators_IsNull(node.left.symbol)) && ((node.left.symbol.flags & 384) !== 0)) {
221
+ else if (((node.kind === 167) && !Operators_IsNull(node.left.symbol)) && ((node.left.symbol.flags & 384) !== 0)) {
205
222
  return node.left.symbol;
206
223
  }
207
224
  else {
@@ -209,19 +226,28 @@ export function symbolAtLocation(checker, node) {
209
226
  }
210
227
  }
211
228
 
229
+ function followAlias(checker, symbol) {
230
+ if ((symbol.flags & 2097152) !== 0) {
231
+ return checker.getAliasedSymbol(symbol);
232
+ }
233
+ else {
234
+ return symbol;
235
+ }
236
+ }
237
+
212
238
  export function tryGetFullName(checker, node) {
213
239
  if (Operators_IsNull(node.symbol)) {
214
240
  const matchValue = checker.getSymbolAtLocation(node);
215
241
  if (matchValue != null) {
216
242
  const symbol = matchValue;
217
- return checker.getFullyQualifiedName(symbol);
243
+ return checker.getFullyQualifiedName(followAlias(checker, symbol));
218
244
  }
219
245
  else {
220
246
  return undefined;
221
247
  }
222
248
  }
223
249
  else {
224
- return checker.getFullyQualifiedName(node.symbol);
250
+ return checker.getFullyQualifiedName(followAlias(checker, node.symbol));
225
251
  }
226
252
  }
227
253
 
@@ -238,7 +264,7 @@ export function ModifierUtil_$reflection() {
238
264
  return class_type("Glutinum.Converter.Reader.Utils.ModifierUtil", undefined, ModifierUtil);
239
265
  }
240
266
 
241
- export function ModifierUtil_GetAccessor_693AB805(modifiers) {
267
+ export function ModifierUtil_GetAccessor_Z1CCFC6BA(modifiers) {
242
268
  if (modifiers == null) {
243
269
  return GlueAccessor.ReadWrite;
244
270
  }
@@ -250,11 +276,11 @@ export function ModifierUtil_GetAccessor_693AB805(modifiers) {
250
276
  }
251
277
  }
252
278
 
253
- export function ModifierUtil_GetAccessor_Z9A9AE16(modifiers) {
254
- return ModifierUtil_GetAccessor_693AB805(modifiers);
279
+ export function ModifierUtil_GetAccessor_2944DA29(modifiers) {
280
+ return ModifierUtil_GetAccessor_Z1CCFC6BA(modifiers);
255
281
  }
256
282
 
257
- export function ModifierUtil_HasModifier_Z39CCF48F(modifiers, modifier) {
283
+ export function ModifierUtil_HasModifier_1F95D1D2(modifiers, modifier) {
258
284
  if (modifiers == null) {
259
285
  return false;
260
286
  }
@@ -263,8 +289,8 @@ export function ModifierUtil_HasModifier_Z39CCF48F(modifiers, modifier) {
263
289
  }
264
290
  }
265
291
 
266
- export function ModifierUtil_HasModifier_Z687DC302(modifiers, modifier) {
267
- return ModifierUtil_HasModifier_Z39CCF48F(modifiers, modifier);
292
+ export function ModifierUtil_HasModifier_742AC9D(modifiers, modifier) {
293
+ return ModifierUtil_HasModifier_1F95D1D2(modifiers, modifier);
268
294
  }
269
295
 
270
296
  /**
@@ -275,7 +301,7 @@ export function tryReadKeyOfConstraint(reader, typeParameter) {
275
301
  const matchValue = typeParameter.constraint;
276
302
  let matchResult, constraintNode_1;
277
303
  if (matchValue != null) {
278
- if ((constraintNode = matchValue, constraintNode.kind === 198)) {
304
+ if ((constraintNode = matchValue, constraintNode.kind === 199)) {
279
305
  matchResult = 0;
280
306
  constraintNode_1 = matchValue;
281
307
  }
@@ -289,13 +315,13 @@ export function tryReadKeyOfConstraint(reader, typeParameter) {
289
315
  switch (matchResult) {
290
316
  case 0: {
291
317
  const typeOperator = constraintNode_1;
292
- if ((typeOperator.operator === 143) && (typeOperator.type.kind === 183)) {
318
+ if ((typeOperator.operator === 143) && (typeOperator.type.kind === 184)) {
293
319
  const typeReferenceNode = typeOperator.type;
294
320
  if (defaultArg((option_5 = ((option_3 = ((option_1 = symbolAtLocation(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), typeReferenceNode.typeName), (option_1 != null) ? ((symbol = option_1, (matchValue_1 = symbol.flags, ($007CHasSymbolFlags$007C_$007C(2097152, matchValue_1) != null) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getAliasedSymbol(symbol) : symbol))) : undefined)), (option_3 != null) ? ((symbol_1 = option_3, symbol_1.declarations)) : undefined)), (option_5 != null) ? ((declarations = option_5, ((matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), (matchValue_3 = tryHead(declarations), (matchValue_2 != null) && ((matchValue_3 != null) && ((declaration = matchValue_3, (packageContext = matchValue_2, PackageContext__TryFindPackage_Z721C83C5(packageContext, declaration.getSourceFile().fileName) == null))))))) && !exists((declaration_1) => {
295
321
  const matchValue_5 = declaration_1.kind;
296
322
  switch (matchValue_5) {
297
- case 263:
298
323
  case 264:
324
+ case 265:
299
325
  return true;
300
326
  default:
301
327
  return false;
@@ -322,14 +348,38 @@ export function tryReadKeyOfConstraint(reader, typeParameter) {
322
348
  }
323
349
  }
324
350
 
351
+ function tryReadReferenceConstraint(reader, typeParameter) {
352
+ let constraintNode;
353
+ const matchValue = typeParameter.constraint;
354
+ let matchResult, constraintNode_1;
355
+ if (matchValue != null) {
356
+ if ((constraintNode = matchValue, constraintNode.kind === 184)) {
357
+ matchResult = 0;
358
+ constraintNode_1 = matchValue;
359
+ }
360
+ else {
361
+ matchResult = 1;
362
+ }
363
+ }
364
+ else {
365
+ matchResult = 1;
366
+ }
367
+ switch (matchResult) {
368
+ case 0:
369
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode_1);
370
+ default:
371
+ return undefined;
372
+ }
373
+ }
374
+
325
375
  /**
326
- * The type parameters of a member: only a `keyof` constraint is kept
376
+ * The type parameters of a member: a `keyof` or a reference constraint is kept
327
377
  */
328
378
  export function readMemberTypeParameters(reader, typeParameters) {
329
379
  if (typeParameters != null) {
330
380
  return map_1((typeParameter) => {
331
- let option_1, typNode;
332
- return new GlueTypeParameter(identifierText(typeParameter.name), tryReadKeyOfConstraint(reader, typeParameter), (option_1 = typeParameter.default, (option_1 != null) ? ((typNode = option_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode))) : undefined));
381
+ let matchValue, option_1, typNode;
382
+ return new GlueTypeParameter(identifierText(typeParameter.name), (matchValue = tryReadKeyOfConstraint(reader, typeParameter), (matchValue == null) ? tryReadReferenceConstraint(reader, typeParameter) : matchValue), (option_1 = typeParameter.default, (option_1 != null) ? ((typNode = option_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode))) : undefined));
333
383
  }, toList(typeParameters));
334
384
  }
335
385
  else {
@@ -342,7 +392,7 @@ export function readMemberTypeParameters(reader, typeParameters) {
342
392
  */
343
393
  export function isTupleType(typ) {
344
394
  const matchValue = typ.flags;
345
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
395
+ if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
346
396
  const objectFlags = typ.objectFlags;
347
397
  const target = typ.target;
348
398
  if ((objectFlags & 8) !== 0) {
@@ -395,7 +445,7 @@ export function resolvedTypeArguments(checker, typ) {
395
445
  default: {
396
446
  const matchValue_2 = typ.flags;
397
447
  let matchResult_1;
398
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue_2) != null) {
448
+ if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_2) != null) {
399
449
  if ((typ.objectFlags & 4) !== 0) {
400
450
  matchResult_1 = 0;
401
451
  }
@@ -436,7 +486,7 @@ export function resolvedBaseTypeArguments(checker, expression) {
436
486
  const matchValue_2 = symbol_1.flags;
437
487
  isValue = ($007CHasSymbolFlags$007C_$007C(3, matchValue_2) != null);
438
488
  }
439
- if ((((Operators_IsNull(heritageClause) ? true : (heritageClause.kind !== 298)) ? true : (heritageClause.token !== 96)) ? true : (heritageClause.parent.kind !== 263)) ? true : !isValue) {
489
+ if ((((Operators_IsNull(heritageClause) ? true : (heritageClause.kind !== 299)) ? true : (heritageClause.token !== 96)) ? true : (heritageClause.parent.kind !== 264)) ? true : !isValue) {
440
490
  return empty();
441
491
  }
442
492
  else {
@@ -468,9 +518,9 @@ export function isFromEs5Lib(symbolOpt) {
468
518
  if ((declarations.length === 0) ? true : Operators_IsNull(item(0, declarations).parent)) {
469
519
  return false;
470
520
  }
471
- else if (item(0, declarations).parent.kind === 312) {
521
+ else if (item(0, declarations).parent.kind === 308) {
472
522
  const sourceFile = item(0, declarations).parent;
473
- return sourceFile.fileName.endsWith("lib/lib.es5.d.ts");
523
+ return sourceFile.fileName.endsWith("/lib.es5.d.ts");
474
524
  }
475
525
  else {
476
526
  return false;
@@ -549,7 +599,7 @@ export function resolveAlias(checker, symbol) {
549
599
  */
550
600
  export function defaultTypeArguments(reader, typeNode) {
551
601
  let option_16, option_7, option_5, option_3, option, binder, checker, option_1, symbol_1, declaration;
552
- if (typeNode.kind !== 183) {
602
+ if (typeNode.kind !== 184) {
553
603
  return empty_1({
554
604
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
555
605
  });
@@ -588,7 +638,7 @@ export function declaredName(symbol) {
588
638
  option_3 = ((option_1 != null) ? tryHead(option_1) : undefined);
589
639
  if (option_3 != null) {
590
640
  const declaration = option_3;
591
- if (declaration.kind === 277) {
641
+ if (declaration.kind === 278) {
592
642
  const expression = declaration.expression;
593
643
  if (expression.kind === 80) {
594
644
  return identifierText(expression);
@@ -658,11 +708,11 @@ function fileOfDeclaration(declaration) {
658
708
  function isTypeDeclaration(declaration) {
659
709
  const matchValue = declaration.kind;
660
710
  switch (matchValue) {
661
- case 263:
662
711
  case 264:
663
712
  case 265:
664
713
  case 266:
665
714
  case 267:
715
+ case 268:
666
716
  return true;
667
717
  default:
668
718
  return false;
@@ -761,7 +811,7 @@ export function otherFileInterfaceDeclarations(packageContext, symbol, declarati
761
811
  else {
762
812
  const package$ = matchValue_2;
763
813
  return map_1((other_1) => other_1, filter((other) => {
764
- if ((other.kind === 264) && (fileOfDeclaration(other) !== fileOfDeclaration(declaration))) {
814
+ if ((other.kind === 265) && (fileOfDeclaration(other) !== fileOfDeclaration(declaration))) {
765
815
  const matchValue_3 = PackageContext__TryFindPackage_Z721C83C5(packageContext_1, fileOfDeclaration(other));
766
816
  if (matchValue_3 == null) {
767
817
  return false;
@@ -788,7 +838,7 @@ export function isMergedInterfaceDeclaration(checker, packageContext, statement)
788
838
  const matchValue = statement.kind;
789
839
  let matchResult;
790
840
  if (packageContext != null) {
791
- if (matchValue === 264) {
841
+ if (matchValue === 265) {
792
842
  matchResult = 0;
793
843
  }
794
844
  else {
@@ -885,7 +935,7 @@ export function isExternalToPackages(checker, packageContext, symbolOpt) {
885
935
  */
886
936
  export function promotedAmbientModule(sourceFile) {
887
937
  const isAmbientModule = (statement) => {
888
- if (statement.kind === 267) {
938
+ if (statement.kind === 268) {
889
939
  return statement.name.kind === 11;
890
940
  }
891
941
  else {
@@ -896,10 +946,10 @@ export function promotedAmbientModule(sourceFile) {
896
946
  if (exists_1((statement_1) => {
897
947
  const matchValue = statement_1.kind;
898
948
  switch (matchValue) {
899
- case 242:
900
- case 271:
949
+ case 243:
901
950
  case 272:
902
- case 278:
951
+ case 273:
952
+ case 279:
903
953
  return false;
904
954
  default:
905
955
  return !isAmbientModule(statement_1);
@@ -909,7 +959,7 @@ export function promotedAmbientModule(sourceFile) {
909
959
  }
910
960
  else {
911
961
  const ambientModules = map_1((statement_2) => statement_2, filter(isAmbientModule, statements));
912
- const fileName = replace(last(normalizePath(sourceFile.fileName).split("/")), "\\.d\\.[cm]?ts$", "");
962
+ const fileName = replace(last(split(normalizePath(sourceFile.fileName), ["/"], undefined, 0)), "\\.d\\.[cm]?ts$", "");
913
963
  const namedLikeTheFile = filter((moduleDeclaration_2) => {
914
964
  let name;
915
965
  return ((name = removeSurroundingQuotes(moduleDeclaration_2.name.text), name.startsWith("node:") ? substring(name, "node:".length) : name)) === fileName;
@@ -919,7 +969,7 @@ export function promotedAmbientModule(sourceFile) {
919
969
  const matchValue_1 = moduleDeclaration_1.body;
920
970
  let matchResult, body_1;
921
971
  if (matchValue_1 != null) {
922
- if ((body = matchValue_1, body.kind === 268)) {
972
+ if ((body = matchValue_1, body.kind === 269)) {
923
973
  matchResult = 0;
924
974
  body_1 = matchValue_1;
925
975
  }
@@ -932,7 +982,7 @@ export function promotedAmbientModule(sourceFile) {
932
982
  }
933
983
  switch (matchResult) {
934
984
  case 0:
935
- return exists((statement_3) => (statement_3.kind !== 278), body_1.statements);
985
+ return exists((statement_3) => (statement_3.kind !== 279), body_1.statements);
936
986
  default:
937
987
  return false;
938
988
  }
@@ -942,7 +992,7 @@ export function promotedAmbientModule(sourceFile) {
942
992
 
943
993
  export function isPromotedAmbientModule(declaration) {
944
994
  const parent = declaration.parent;
945
- if (!Operators_IsNull(parent) && (parent.kind === 312)) {
995
+ if (!Operators_IsNull(parent) && (parent.kind === 308)) {
946
996
  const matchValue = promotedAmbientModule(parent);
947
997
  if (matchValue == null) {
948
998
  return false;
@@ -965,17 +1015,17 @@ export function isExportedDeclaration(statement, names) {
965
1015
  let hasExportModifier;
966
1016
  const modifiers = statement.modifiers;
967
1017
  hasExportModifier = ((modifiers == null) ? false : exists((modifier) => (modifier.kind === 95), modifiers));
968
- const isInsideNamespace = statement.parent.kind === 268;
969
- const isGlobal = (statement.parent.kind === 312) && !ts.isExternalModule(statement.getSourceFile());
970
- const isInExportList = (statement.parent.kind === 312) && exists((other) => {
1018
+ const isInsideNamespace = statement.parent.kind === 269;
1019
+ const isGlobal = (statement.parent.kind === 308) && !(ts.isExternalModule(statement.getSourceFile()));
1020
+ const isInExportList = (statement.parent.kind === 308) && exists((other) => {
971
1021
  let exportClause;
972
- if (other.kind === 278) {
1022
+ if (other.kind === 279) {
973
1023
  const exportDeclaration = other;
974
1024
  if (exportDeclaration.moduleSpecifier == null) {
975
1025
  const matchValue_1 = exportDeclaration.exportClause;
976
1026
  let matchResult, exportClause_1;
977
1027
  if (matchValue_1 != null) {
978
- if ((exportClause = matchValue_1, exportClause.kind === 279)) {
1028
+ if ((exportClause = matchValue_1, exportClause.kind === 280)) {
979
1029
  matchResult = 0;
980
1030
  exportClause_1 = matchValue_1;
981
1031
  }
@@ -1016,9 +1066,9 @@ export function isExportedDeclaration(statement, names) {
1016
1066
  * `declare class Dispatcher {}; export default Dispatcher` or `export = Dispatcher`
1017
1067
  */
1018
1068
  export function isExportAssignmentTarget(statement, names) {
1019
- if (statement.parent.kind === 312) {
1069
+ if (statement.parent.kind === 308) {
1020
1070
  return exists((other) => {
1021
- if (other.kind === 277) {
1071
+ if (other.kind === 278) {
1022
1072
  const expression = other.expression;
1023
1073
  if (expression.kind === 80) {
1024
1074
  return contains_1(identifierText(expression), names);
@@ -1041,13 +1091,13 @@ export function isExportAssignmentTarget(statement, names) {
1041
1091
  * `declare const wm: WebMidi; export { wm as WebMidi }`: the name the declaration is exported under
1042
1092
  */
1043
1093
  export function exportedAlias(statement, localName) {
1044
- if (statement.parent.kind !== 312) {
1094
+ if (statement.parent.kind !== 308) {
1045
1095
  return undefined;
1046
1096
  }
1047
1097
  else {
1048
1098
  return tryPick((other) => {
1049
1099
  let exportClause;
1050
- if (other.kind !== 278) {
1100
+ if (other.kind !== 279) {
1051
1101
  return undefined;
1052
1102
  }
1053
1103
  else {
@@ -1055,7 +1105,7 @@ export function exportedAlias(statement, localName) {
1055
1105
  const matchValue = exportDeclaration.exportClause;
1056
1106
  let matchResult, exportClause_1;
1057
1107
  if (matchValue != null) {
1058
- if ((exportClause = matchValue, (exportDeclaration.moduleSpecifier == null) && (exportClause.kind === 279))) {
1108
+ if ((exportClause = matchValue, (exportDeclaration.moduleSpecifier == null) && (exportClause.kind === 280))) {
1059
1109
  matchResult = 0;
1060
1110
  exportClause_1 = matchValue;
1061
1111
  }
@@ -1085,7 +1135,7 @@ export function exportedAlias(statement, localName) {
1085
1135
  }
1086
1136
  switch (matchResult_1) {
1087
1137
  case 0:
1088
- return specifier.name.text;
1138
+ return moduleExportNameText(specifier.name);
1089
1139
  default:
1090
1140
  return undefined;
1091
1141
  }
@@ -1111,7 +1161,7 @@ export function isGlobalScriptOfPackage(packageContext, sourceFile) {
1111
1161
  }
1112
1162
  else {
1113
1163
  const packageContext_1 = packageContext;
1114
- if (!ts.isExternalModule(sourceFile) && (promotedAmbientModule(sourceFile) == null)) {
1164
+ if (!(ts.isExternalModule(sourceFile)) && (promotedAmbientModule(sourceFile) == null)) {
1115
1165
  return !PackageContext__IsEntryFile_Z721C83C5(packageContext_1, sourceFile.fileName);
1116
1166
  }
1117
1167
  else {
@@ -1121,7 +1171,7 @@ export function isGlobalScriptOfPackage(packageContext, sourceFile) {
1121
1171
  }
1122
1172
 
1123
1173
  function isAmbientModuleDeclaration(node) {
1124
- if (node.kind === 267) {
1174
+ if (node.kind === 268) {
1125
1175
  return node.name.kind === 11;
1126
1176
  }
1127
1177
  else {
@@ -1139,7 +1189,7 @@ export function isPackageGlobal(packageContext, declaration) {
1139
1189
  while (true) {
1140
1190
  const node = node_mut;
1141
1191
  if (!Operators_IsNull(node)) {
1142
- if ((node.kind === 267) && isGlobalAugmentation(node)) {
1192
+ if ((node.kind === 268) && isGlobalAugmentation(node)) {
1143
1193
  return true;
1144
1194
  }
1145
1195
  else {
@@ -1192,7 +1242,7 @@ export function isPackageGlobal(packageContext, declaration) {
1192
1242
  * A module declaration at the top of a file or of the ambient module the file is made of
1193
1243
  */
1194
1244
  export function isTopLevelModuleDeclaration(packageContext, node) {
1195
- if (!Operators_IsNull(node.parent) && ((node.parent.kind === 312) ? true : (((node.parent.kind === 268) && (node.parent.parent.kind === 267)) && isPromotedAmbientModule(node.parent.parent)))) {
1245
+ if (!Operators_IsNull(node.parent) && ((node.parent.kind === 308) ? true : (((node.parent.kind === 269) && (node.parent.parent.kind === 268)) && isPromotedAmbientModule(node.parent.parent)))) {
1196
1246
  return !isPackageGlobal(packageContext, node);
1197
1247
  }
1198
1248
  else {
@@ -1210,7 +1260,7 @@ function namespaceChain(packageContext, declaration) {
1210
1260
  }
1211
1261
  else {
1212
1262
  const matchValue = node.kind;
1213
- if (matchValue === 267) {
1263
+ if (matchValue === 268) {
1214
1264
  if (isPromotedAmbientModule(node)) {
1215
1265
  node_mut = node.parent;
1216
1266
  acc_mut = acc;
@@ -1292,7 +1342,7 @@ export function modulePathForSymbol(checker, packageContext, isQualified, symbol
1292
1342
 
1293
1343
  export function Type_StringLiteral_$007CString$007COther$007C(literalType) {
1294
1344
  const matchValue = literalType.flags;
1295
- if ($007CHasTypeFlags$007C_$007C(128, matchValue) != null) {
1345
+ if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
1296
1346
  const literalType_1 = literalType;
1297
1347
  return new FSharpChoice$2(/* Choice1Of2 */ 0, [literalType_1.value]);
1298
1348
  }
@@ -1303,7 +1353,7 @@ export function Type_StringLiteral_$007CString$007COther$007C(literalType) {
1303
1353
 
1304
1354
  export function Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(literalType) {
1305
1355
  const matchValue = literalType.flags;
1306
- if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
1356
+ if ($007CHasTypeFlags$007C_$007C(2048, matchValue) != null) {
1307
1357
  const literalType_1 = literalType;
1308
1358
  if (Number.isSafeInteger(literalType_1.value)) {
1309
1359
  return new FSharpChoice$3(/* Choice1Of3 */ 0, [literalType_1.value]);