@typespec/html-program-viewer 0.67.0-dev.4 → 0.67.0-dev.5

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.
@@ -1,6 +1,6 @@
1
1
  const manifest = {
2
2
  "version": "0.66.0",
3
- "commit": "b4b7705c61f186590c6a6d086a131cd71ee4c48c"
3
+ "commit": "32ca22f9d14ae0c73f965270330f0e1b81d78b0b"
4
4
  };
5
5
 
6
6
  export { manifest as default };
@@ -17882,202 +17882,6 @@ function normalizeSlashes(path) {
17882
17882
  return path.replace(backslashRegExp, directorySeparator);
17883
17883
  }
17884
17884
 
17885
- function createSourceFile(text, path) {
17886
- let lineStarts = undefined;
17887
- return {
17888
- text,
17889
- path,
17890
- getLineStarts,
17891
- getLineAndCharacterOfPosition,
17892
- };
17893
- function getLineStarts() {
17894
- return (lineStarts = lineStarts ?? scanLineStarts(text));
17895
- }
17896
- function getLineAndCharacterOfPosition(position) {
17897
- const starts = getLineStarts();
17898
- let line = binarySearch(starts, position);
17899
- // When binarySearch returns < 0 indicating that the value was not found, it
17900
- // returns the bitwise complement of the index where the value would need to
17901
- // be inserted to keep the array sorted. So flipping the bits back to this
17902
- // positive index tells us what the line number would be if we were to
17903
- // create a new line starting at the given position, and subtracting 1 from
17904
- // that therefore gives us the line number we're after.
17905
- if (line < 0) {
17906
- line = ~line - 1;
17907
- }
17908
- return {
17909
- line,
17910
- character: position - starts[line],
17911
- };
17912
- }
17913
- }
17914
- function scanLineStarts(text) {
17915
- const starts = [];
17916
- let start = 0;
17917
- let pos = 0;
17918
- while (pos < text.length) {
17919
- const ch = text.charCodeAt(pos);
17920
- pos++;
17921
- switch (ch) {
17922
- case 13 /* CharCode.CarriageReturn */:
17923
- if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
17924
- pos++;
17925
- }
17926
- // fallthrough
17927
- case 10 /* CharCode.LineFeed */:
17928
- starts.push(start);
17929
- start = pos;
17930
- break;
17931
- }
17932
- }
17933
- starts.push(start);
17934
- return starts;
17935
- }
17936
- /**
17937
- * Search sorted array of numbers for the given value. If found, return index
17938
- * in array where value was found. If not found, return a negative number that
17939
- * is the bitwise complement of the index where value would need to be inserted
17940
- * to keep the array sorted.
17941
- */
17942
- function binarySearch(array, value) {
17943
- let low = 0;
17944
- let high = array.length - 1;
17945
- while (low <= high) {
17946
- const middle = low + ((high - low) >> 1);
17947
- const v = array[middle];
17948
- if (v < value) {
17949
- low = middle + 1;
17950
- }
17951
- else if (v > value) {
17952
- high = middle - 1;
17953
- }
17954
- else {
17955
- return middle;
17956
- }
17957
- }
17958
- return ~low;
17959
- }
17960
-
17961
- var ResolutionResultFlags;
17962
- (function (ResolutionResultFlags) {
17963
- ResolutionResultFlags[ResolutionResultFlags["None"] = 0] = "None";
17964
- ResolutionResultFlags[ResolutionResultFlags["Resolved"] = 2] = "Resolved";
17965
- ResolutionResultFlags[ResolutionResultFlags["Unknown"] = 4] = "Unknown";
17966
- ResolutionResultFlags[ResolutionResultFlags["Ambiguous"] = 8] = "Ambiguous";
17967
- ResolutionResultFlags[ResolutionResultFlags["NotFound"] = 16] = "NotFound";
17968
- ResolutionResultFlags[ResolutionResultFlags["ResolutionFailed"] = 28] = "ResolutionFailed";
17969
- })(ResolutionResultFlags || (ResolutionResultFlags = {}));
17970
- /**
17971
- * AST types
17972
- */
17973
- var SyntaxKind;
17974
- (function (SyntaxKind) {
17975
- SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
17976
- SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
17977
- SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
17978
- SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
17979
- SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
17980
- SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
17981
- SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
17982
- SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
17983
- SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
17984
- SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
17985
- SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
17986
- SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
17987
- SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
17988
- SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
17989
- SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
17990
- SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
17991
- SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
17992
- SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
17993
- SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
17994
- SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
17995
- SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
17996
- SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
17997
- SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
17998
- SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
17999
- SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
18000
- SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
18001
- SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
18002
- SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
18003
- SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
18004
- SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
18005
- SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
18006
- SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
18007
- SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
18008
- SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
18009
- SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
18010
- SyntaxKind[SyntaxKind["StringTemplateExpression"] = 35] = "StringTemplateExpression";
18011
- SyntaxKind[SyntaxKind["StringTemplateHead"] = 36] = "StringTemplateHead";
18012
- SyntaxKind[SyntaxKind["StringTemplateMiddle"] = 37] = "StringTemplateMiddle";
18013
- SyntaxKind[SyntaxKind["StringTemplateTail"] = 38] = "StringTemplateTail";
18014
- SyntaxKind[SyntaxKind["StringTemplateSpan"] = 39] = "StringTemplateSpan";
18015
- SyntaxKind[SyntaxKind["ExternKeyword"] = 40] = "ExternKeyword";
18016
- SyntaxKind[SyntaxKind["VoidKeyword"] = 41] = "VoidKeyword";
18017
- SyntaxKind[SyntaxKind["NeverKeyword"] = 42] = "NeverKeyword";
18018
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 43] = "UnknownKeyword";
18019
- SyntaxKind[SyntaxKind["ValueOfExpression"] = 44] = "ValueOfExpression";
18020
- SyntaxKind[SyntaxKind["TypeReference"] = 45] = "TypeReference";
18021
- SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 46] = "TemplateParameterDeclaration";
18022
- SyntaxKind[SyntaxKind["EmptyStatement"] = 47] = "EmptyStatement";
18023
- SyntaxKind[SyntaxKind["InvalidStatement"] = 48] = "InvalidStatement";
18024
- SyntaxKind[SyntaxKind["LineComment"] = 49] = "LineComment";
18025
- SyntaxKind[SyntaxKind["BlockComment"] = 50] = "BlockComment";
18026
- SyntaxKind[SyntaxKind["Doc"] = 51] = "Doc";
18027
- SyntaxKind[SyntaxKind["DocText"] = 52] = "DocText";
18028
- SyntaxKind[SyntaxKind["DocParamTag"] = 53] = "DocParamTag";
18029
- SyntaxKind[SyntaxKind["DocPropTag"] = 54] = "DocPropTag";
18030
- SyntaxKind[SyntaxKind["DocReturnsTag"] = 55] = "DocReturnsTag";
18031
- SyntaxKind[SyntaxKind["DocErrorsTag"] = 56] = "DocErrorsTag";
18032
- SyntaxKind[SyntaxKind["DocTemplateTag"] = 57] = "DocTemplateTag";
18033
- SyntaxKind[SyntaxKind["DocUnknownTag"] = 58] = "DocUnknownTag";
18034
- SyntaxKind[SyntaxKind["Return"] = 59] = "Return";
18035
- SyntaxKind[SyntaxKind["JsNamespaceDeclaration"] = 60] = "JsNamespaceDeclaration";
18036
- SyntaxKind[SyntaxKind["TemplateArgument"] = 61] = "TemplateArgument";
18037
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 62] = "TypeOfExpression";
18038
- SyntaxKind[SyntaxKind["ObjectLiteral"] = 63] = "ObjectLiteral";
18039
- SyntaxKind[SyntaxKind["ObjectLiteralProperty"] = 64] = "ObjectLiteralProperty";
18040
- SyntaxKind[SyntaxKind["ObjectLiteralSpreadProperty"] = 65] = "ObjectLiteralSpreadProperty";
18041
- SyntaxKind[SyntaxKind["ArrayLiteral"] = 66] = "ArrayLiteral";
18042
- SyntaxKind[SyntaxKind["ConstStatement"] = 67] = "ConstStatement";
18043
- SyntaxKind[SyntaxKind["CallExpression"] = 68] = "CallExpression";
18044
- SyntaxKind[SyntaxKind["ScalarConstructor"] = 69] = "ScalarConstructor";
18045
- })(SyntaxKind || (SyntaxKind = {}));
18046
- var IdentifierKind;
18047
- (function (IdentifierKind) {
18048
- IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
18049
- IdentifierKind[IdentifierKind["TemplateArgument"] = 1] = "TemplateArgument";
18050
- IdentifierKind[IdentifierKind["Decorator"] = 2] = "Decorator";
18051
- IdentifierKind[IdentifierKind["Function"] = 3] = "Function";
18052
- IdentifierKind[IdentifierKind["Using"] = 4] = "Using";
18053
- IdentifierKind[IdentifierKind["Declaration"] = 5] = "Declaration";
18054
- IdentifierKind[IdentifierKind["ModelExpressionProperty"] = 6] = "ModelExpressionProperty";
18055
- IdentifierKind[IdentifierKind["ModelStatementProperty"] = 7] = "ModelStatementProperty";
18056
- IdentifierKind[IdentifierKind["ObjectLiteralProperty"] = 8] = "ObjectLiteralProperty";
18057
- IdentifierKind[IdentifierKind["Other"] = 9] = "Other";
18058
- })(IdentifierKind || (IdentifierKind = {}));
18059
- /** Used to explicitly specify that a diagnostic has no target. */
18060
- const NoTarget = Symbol.for("NoTarget");
18061
- var ListenerFlow;
18062
- (function (ListenerFlow) {
18063
- /**
18064
- * Do not navigate any containing or referenced type.
18065
- */
18066
- ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
18067
- })(ListenerFlow || (ListenerFlow = {}));
18068
-
18069
- let manifest;
18070
- try {
18071
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
18072
- // @ts-ignore
18073
- manifest = (await import('../manifest-DRAJnEGG.js')).default;
18074
- }
18075
- catch {
18076
- const name = "../dist/manifest.js";
18077
- manifest = (await import(/* @vite-ignore */ /* webpackIgnore: true */ name)).default;
18078
- }
18079
- manifest.version;
18080
-
18081
17885
  /**
18082
17886
  * Recursively calls Object.freeze such that all objects and arrays
18083
17887
  * referenced are frozen.
@@ -18426,6 +18230,7 @@ const diagnostics = {
18426
18230
  severity: "error",
18427
18231
  messages: {
18428
18232
  default: "Keyword cannot be used as identifier.",
18233
+ future: paramMessage `${"name"} is a reserved keyword`,
18429
18234
  },
18430
18235
  },
18431
18236
  "invalid-directive-location": {
@@ -18634,7 +18439,8 @@ const diagnostics = {
18634
18439
  messages: {
18635
18440
  default: paramMessage `${"name"} refers to a type, but is being used as a value here.`,
18636
18441
  model: paramMessage `${"name"} refers to a model type, but is being used as a value here. Use #{} to create an object value.`,
18637
- tuple: paramMessage `${"name"} refers to a tuple type, but is being used as a value here. Use #[] to create an array value.`,
18442
+ modelExpression: `Is a model expression type, but is being used as a value here. Use #{} to create an object value.`,
18443
+ tuple: `Is a tuple type, but is being used as a value here. Use #[] to create an array value.`,
18638
18444
  templateConstraint: paramMessage `${"name"} template parameter can be a type but is being used as a value here.`,
18639
18445
  },
18640
18446
  },
@@ -28236,6 +28042,190 @@ function findYamlNode(file, path, kind = "value") {
28236
28042
  return current ?? undefined;
28237
28043
  }
28238
28044
 
28045
+ function createSourceFile(text, path) {
28046
+ let lineStarts = undefined;
28047
+ return {
28048
+ text,
28049
+ path,
28050
+ getLineStarts,
28051
+ getLineAndCharacterOfPosition,
28052
+ };
28053
+ function getLineStarts() {
28054
+ return (lineStarts = lineStarts ?? scanLineStarts(text));
28055
+ }
28056
+ function getLineAndCharacterOfPosition(position) {
28057
+ const starts = getLineStarts();
28058
+ let line = binarySearch(starts, position);
28059
+ // When binarySearch returns < 0 indicating that the value was not found, it
28060
+ // returns the bitwise complement of the index where the value would need to
28061
+ // be inserted to keep the array sorted. So flipping the bits back to this
28062
+ // positive index tells us what the line number would be if we were to
28063
+ // create a new line starting at the given position, and subtracting 1 from
28064
+ // that therefore gives us the line number we're after.
28065
+ if (line < 0) {
28066
+ line = ~line - 1;
28067
+ }
28068
+ return {
28069
+ line,
28070
+ character: position - starts[line],
28071
+ };
28072
+ }
28073
+ }
28074
+ function scanLineStarts(text) {
28075
+ const starts = [];
28076
+ let start = 0;
28077
+ let pos = 0;
28078
+ while (pos < text.length) {
28079
+ const ch = text.charCodeAt(pos);
28080
+ pos++;
28081
+ switch (ch) {
28082
+ case 13 /* CharCode.CarriageReturn */:
28083
+ if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
28084
+ pos++;
28085
+ }
28086
+ // fallthrough
28087
+ case 10 /* CharCode.LineFeed */:
28088
+ starts.push(start);
28089
+ start = pos;
28090
+ break;
28091
+ }
28092
+ }
28093
+ starts.push(start);
28094
+ return starts;
28095
+ }
28096
+ /**
28097
+ * Search sorted array of numbers for the given value. If found, return index
28098
+ * in array where value was found. If not found, return a negative number that
28099
+ * is the bitwise complement of the index where value would need to be inserted
28100
+ * to keep the array sorted.
28101
+ */
28102
+ function binarySearch(array, value) {
28103
+ let low = 0;
28104
+ let high = array.length - 1;
28105
+ while (low <= high) {
28106
+ const middle = low + ((high - low) >> 1);
28107
+ const v = array[middle];
28108
+ if (v < value) {
28109
+ low = middle + 1;
28110
+ }
28111
+ else if (v > value) {
28112
+ high = middle - 1;
28113
+ }
28114
+ else {
28115
+ return middle;
28116
+ }
28117
+ }
28118
+ return ~low;
28119
+ }
28120
+
28121
+ var ResolutionResultFlags;
28122
+ (function (ResolutionResultFlags) {
28123
+ ResolutionResultFlags[ResolutionResultFlags["None"] = 0] = "None";
28124
+ ResolutionResultFlags[ResolutionResultFlags["Resolved"] = 2] = "Resolved";
28125
+ ResolutionResultFlags[ResolutionResultFlags["Unknown"] = 4] = "Unknown";
28126
+ ResolutionResultFlags[ResolutionResultFlags["Ambiguous"] = 8] = "Ambiguous";
28127
+ ResolutionResultFlags[ResolutionResultFlags["NotFound"] = 16] = "NotFound";
28128
+ ResolutionResultFlags[ResolutionResultFlags["ResolutionFailed"] = 28] = "ResolutionFailed";
28129
+ })(ResolutionResultFlags || (ResolutionResultFlags = {}));
28130
+ /**
28131
+ * AST types
28132
+ */
28133
+ var SyntaxKind;
28134
+ (function (SyntaxKind) {
28135
+ SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
28136
+ SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
28137
+ SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
28138
+ SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
28139
+ SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
28140
+ SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
28141
+ SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
28142
+ SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
28143
+ SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
28144
+ SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
28145
+ SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
28146
+ SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
28147
+ SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
28148
+ SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
28149
+ SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
28150
+ SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
28151
+ SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
28152
+ SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
28153
+ SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
28154
+ SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
28155
+ SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
28156
+ SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
28157
+ SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
28158
+ SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
28159
+ SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
28160
+ SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
28161
+ SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
28162
+ SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
28163
+ SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
28164
+ SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
28165
+ SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
28166
+ SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
28167
+ SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
28168
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
28169
+ SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
28170
+ SyntaxKind[SyntaxKind["StringTemplateExpression"] = 35] = "StringTemplateExpression";
28171
+ SyntaxKind[SyntaxKind["StringTemplateHead"] = 36] = "StringTemplateHead";
28172
+ SyntaxKind[SyntaxKind["StringTemplateMiddle"] = 37] = "StringTemplateMiddle";
28173
+ SyntaxKind[SyntaxKind["StringTemplateTail"] = 38] = "StringTemplateTail";
28174
+ SyntaxKind[SyntaxKind["StringTemplateSpan"] = 39] = "StringTemplateSpan";
28175
+ SyntaxKind[SyntaxKind["ExternKeyword"] = 40] = "ExternKeyword";
28176
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 41] = "VoidKeyword";
28177
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 42] = "NeverKeyword";
28178
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 43] = "UnknownKeyword";
28179
+ SyntaxKind[SyntaxKind["ValueOfExpression"] = 44] = "ValueOfExpression";
28180
+ SyntaxKind[SyntaxKind["TypeReference"] = 45] = "TypeReference";
28181
+ SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 46] = "TemplateParameterDeclaration";
28182
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 47] = "EmptyStatement";
28183
+ SyntaxKind[SyntaxKind["InvalidStatement"] = 48] = "InvalidStatement";
28184
+ SyntaxKind[SyntaxKind["LineComment"] = 49] = "LineComment";
28185
+ SyntaxKind[SyntaxKind["BlockComment"] = 50] = "BlockComment";
28186
+ SyntaxKind[SyntaxKind["Doc"] = 51] = "Doc";
28187
+ SyntaxKind[SyntaxKind["DocText"] = 52] = "DocText";
28188
+ SyntaxKind[SyntaxKind["DocParamTag"] = 53] = "DocParamTag";
28189
+ SyntaxKind[SyntaxKind["DocPropTag"] = 54] = "DocPropTag";
28190
+ SyntaxKind[SyntaxKind["DocReturnsTag"] = 55] = "DocReturnsTag";
28191
+ SyntaxKind[SyntaxKind["DocErrorsTag"] = 56] = "DocErrorsTag";
28192
+ SyntaxKind[SyntaxKind["DocTemplateTag"] = 57] = "DocTemplateTag";
28193
+ SyntaxKind[SyntaxKind["DocUnknownTag"] = 58] = "DocUnknownTag";
28194
+ SyntaxKind[SyntaxKind["Return"] = 59] = "Return";
28195
+ SyntaxKind[SyntaxKind["JsNamespaceDeclaration"] = 60] = "JsNamespaceDeclaration";
28196
+ SyntaxKind[SyntaxKind["TemplateArgument"] = 61] = "TemplateArgument";
28197
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 62] = "TypeOfExpression";
28198
+ SyntaxKind[SyntaxKind["ObjectLiteral"] = 63] = "ObjectLiteral";
28199
+ SyntaxKind[SyntaxKind["ObjectLiteralProperty"] = 64] = "ObjectLiteralProperty";
28200
+ SyntaxKind[SyntaxKind["ObjectLiteralSpreadProperty"] = 65] = "ObjectLiteralSpreadProperty";
28201
+ SyntaxKind[SyntaxKind["ArrayLiteral"] = 66] = "ArrayLiteral";
28202
+ SyntaxKind[SyntaxKind["ConstStatement"] = 67] = "ConstStatement";
28203
+ SyntaxKind[SyntaxKind["CallExpression"] = 68] = "CallExpression";
28204
+ SyntaxKind[SyntaxKind["ScalarConstructor"] = 69] = "ScalarConstructor";
28205
+ })(SyntaxKind || (SyntaxKind = {}));
28206
+ var IdentifierKind;
28207
+ (function (IdentifierKind) {
28208
+ IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
28209
+ IdentifierKind[IdentifierKind["TemplateArgument"] = 1] = "TemplateArgument";
28210
+ IdentifierKind[IdentifierKind["Decorator"] = 2] = "Decorator";
28211
+ IdentifierKind[IdentifierKind["Function"] = 3] = "Function";
28212
+ IdentifierKind[IdentifierKind["Using"] = 4] = "Using";
28213
+ IdentifierKind[IdentifierKind["Declaration"] = 5] = "Declaration";
28214
+ IdentifierKind[IdentifierKind["ModelExpressionProperty"] = 6] = "ModelExpressionProperty";
28215
+ IdentifierKind[IdentifierKind["ModelStatementProperty"] = 7] = "ModelStatementProperty";
28216
+ IdentifierKind[IdentifierKind["ObjectLiteralProperty"] = 8] = "ObjectLiteralProperty";
28217
+ IdentifierKind[IdentifierKind["Other"] = 9] = "Other";
28218
+ })(IdentifierKind || (IdentifierKind = {}));
28219
+ /** Used to explicitly specify that a diagnostic has no target. */
28220
+ const NoTarget = Symbol.for("NoTarget");
28221
+ var ListenerFlow;
28222
+ (function (ListenerFlow) {
28223
+ /**
28224
+ * Do not navigate any containing or referenced type.
28225
+ */
28226
+ ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
28227
+ })(ListenerFlow || (ListenerFlow = {}));
28228
+
28239
28229
  function getSourceLocation(target, options = {}) {
28240
28230
  if (target === NoTarget || target === undefined) {
28241
28231
  return undefined;
@@ -29325,18 +29315,7 @@ const [getDiscriminatedOptions, setDiscriminatedOptions] = useStateMap(createSta
29325
29315
  // #endregion
29326
29316
 
29327
29317
  function getDiscriminatedUnion(typeOrProgram, typeOrDiscriminator) {
29328
- if ("propertyName" in typeOrDiscriminator) {
29329
- const type = typeOrProgram;
29330
- switch (type.kind) {
29331
- case "Model":
29332
- return getDiscriminatedUnionFromInheritance(type, typeOrDiscriminator);
29333
- case "Union":
29334
- return getDiscriminatedUnionForUnionLegacy(type, typeOrDiscriminator);
29335
- }
29336
- }
29337
- else {
29338
- return getDiscriminatedUnionForUnion(typeOrProgram, typeOrDiscriminator);
29339
- }
29318
+ return getDiscriminatedUnionForUnion(typeOrProgram, typeOrDiscriminator);
29340
29319
  }
29341
29320
  function getDiscriminatedUnionForUnion(program, type) {
29342
29321
  const options = getDiscriminatedOptions(program, type);
@@ -29400,51 +29379,6 @@ function getDiscriminatedUnionForUnion(program, type) {
29400
29379
  diagnostics,
29401
29380
  ];
29402
29381
  }
29403
- function getDiscriminatedUnionForUnionLegacy(type, discriminator) {
29404
- const variants = new Map();
29405
- const diagnostics = [];
29406
- const duplicates = new DuplicateTracker();
29407
- for (const variant of type.variants.values()) {
29408
- if (variant.type.kind !== "Model") {
29409
- diagnostics.push(createDiagnostic({
29410
- code: "invalid-discriminated-union-variant",
29411
- format: { name: variant.name.toString() },
29412
- target: variant,
29413
- }));
29414
- continue;
29415
- }
29416
- const prop = getDiscriminatorProperty(variant.type, discriminator, diagnostics);
29417
- if (prop === undefined) {
29418
- diagnostics.push(createDiagnostic({
29419
- code: "invalid-discriminated-union-variant",
29420
- messageId: "noDiscriminant",
29421
- format: { name: variant.name.toString(), discriminant: discriminator.propertyName },
29422
- target: variant,
29423
- }));
29424
- continue;
29425
- }
29426
- const key = getStringValue(prop.type);
29427
- if (key) {
29428
- duplicates.track(key, variant.type);
29429
- variants.set(key, variant.type);
29430
- }
29431
- else {
29432
- diagnostics.push(createDiagnostic({
29433
- code: "invalid-discriminated-union-variant",
29434
- messageId: "wrongDiscriminantType",
29435
- format: { name: variant.name.toString(), discriminant: discriminator.propertyName },
29436
- target: variant.type,
29437
- }));
29438
- }
29439
- }
29440
- reportDuplicateDiscriminatorValues(duplicates, diagnostics);
29441
- const discriminatedUnion = {
29442
- kind: "legacy",
29443
- propertyName: discriminator.propertyName,
29444
- variants,
29445
- };
29446
- return [discriminatedUnion, diagnostics];
29447
- }
29448
29382
  function getDiscriminatedUnionFromInheritance(type, discriminator) {
29449
29383
  const variants = new Map();
29450
29384
  const diagnostics = [];
@@ -30432,7 +30366,42 @@ var Token;
30432
30366
  // Add new non-statement keyword above
30433
30367
  /** @internal */ Token[Token["__EndKeyword"] = 80] = "__EndKeyword";
30434
30368
  ///////////////////////////////////////////////////////////////
30435
- /** @internal */ Token[Token["__Count"] = 80] = "__Count";
30369
+ /** @internal */ Token[Token["__StartReservedKeyword"] = 80] = "__StartReservedKeyword";
30370
+ ///////////////////////////////////////////////////////////////
30371
+ // List of keywords that have special meaning in the language but are reserved for future use
30372
+ Token[Token["StatemachineKeyword"] = 80] = "StatemachineKeyword";
30373
+ Token[Token["MacroKeyword"] = 81] = "MacroKeyword";
30374
+ Token[Token["PackageKeyword"] = 82] = "PackageKeyword";
30375
+ Token[Token["MetadataKeyword"] = 83] = "MetadataKeyword";
30376
+ Token[Token["EnvKeyword"] = 84] = "EnvKeyword";
30377
+ Token[Token["ArgKeyword"] = 85] = "ArgKeyword";
30378
+ Token[Token["DeclareKeyword"] = 86] = "DeclareKeyword";
30379
+ Token[Token["ArrayKeyword"] = 87] = "ArrayKeyword";
30380
+ Token[Token["StructKeyword"] = 88] = "StructKeyword";
30381
+ Token[Token["RecordKeyword"] = 89] = "RecordKeyword";
30382
+ Token[Token["ModuleKeyword"] = 90] = "ModuleKeyword";
30383
+ Token[Token["TraitKeyword"] = 91] = "TraitKeyword";
30384
+ Token[Token["ThisKeyword"] = 92] = "ThisKeyword";
30385
+ Token[Token["SelfKeyword"] = 93] = "SelfKeyword";
30386
+ Token[Token["SuperKeyword"] = 94] = "SuperKeyword";
30387
+ Token[Token["KeyofKeyword"] = 95] = "KeyofKeyword";
30388
+ Token[Token["WithKeyword"] = 96] = "WithKeyword";
30389
+ Token[Token["ImplementsKeyword"] = 97] = "ImplementsKeyword";
30390
+ Token[Token["ImplKeyword"] = 98] = "ImplKeyword";
30391
+ Token[Token["SatisfiesKeyword"] = 99] = "SatisfiesKeyword";
30392
+ Token[Token["FlagKeyword"] = 100] = "FlagKeyword";
30393
+ Token[Token["AutoKeyword"] = 101] = "AutoKeyword";
30394
+ Token[Token["PartialKeyword"] = 102] = "PartialKeyword";
30395
+ Token[Token["PrivateKeyword"] = 103] = "PrivateKeyword";
30396
+ Token[Token["PublicKeyword"] = 104] = "PublicKeyword";
30397
+ Token[Token["ProtectedKeyword"] = 105] = "ProtectedKeyword";
30398
+ Token[Token["InternalKeyword"] = 106] = "InternalKeyword";
30399
+ Token[Token["SealedKeyword"] = 107] = "SealedKeyword";
30400
+ Token[Token["LocalKeyword"] = 108] = "LocalKeyword";
30401
+ Token[Token["AsyncKeyword"] = 109] = "AsyncKeyword";
30402
+ /** @internal */ Token[Token["__EndReservedKeyword"] = 110] = "__EndReservedKeyword";
30403
+ ///////////////////////////////////////////////////////////////
30404
+ /** @internal */ Token[Token["__Count"] = 110] = "__Count";
30436
30405
  })(Token || (Token = {}));
30437
30406
  /** @internal */
30438
30407
  getTokenDisplayTable([
@@ -30516,6 +30485,37 @@ getTokenDisplayTable([
30516
30485
  [Token.NeverKeyword, "'never'"],
30517
30486
  [Token.UnknownKeyword, "'unknown'"],
30518
30487
  [Token.ExternKeyword, "'extern'"],
30488
+ // Reserved keywords
30489
+ [Token.StatemachineKeyword, "'statemachine'"],
30490
+ [Token.MacroKeyword, "'macro'"],
30491
+ [Token.PackageKeyword, "'package'"],
30492
+ [Token.MetadataKeyword, "'metadata'"],
30493
+ [Token.EnvKeyword, "'env'"],
30494
+ [Token.ArgKeyword, "'arg'"],
30495
+ [Token.DeclareKeyword, "'declare'"],
30496
+ [Token.ArrayKeyword, "'array'"],
30497
+ [Token.StructKeyword, "'struct'"],
30498
+ [Token.RecordKeyword, "'record'"],
30499
+ [Token.ModuleKeyword, "'module'"],
30500
+ [Token.TraitKeyword, "'trait'"],
30501
+ [Token.ThisKeyword, "'this'"],
30502
+ [Token.SelfKeyword, "'self'"],
30503
+ [Token.SuperKeyword, "'super'"],
30504
+ [Token.KeyofKeyword, "'keyof'"],
30505
+ [Token.WithKeyword, "'with'"],
30506
+ [Token.ImplementsKeyword, "'implements'"],
30507
+ [Token.ImplKeyword, "'impl'"],
30508
+ [Token.SatisfiesKeyword, "'satisfies'"],
30509
+ [Token.FlagKeyword, "'flag'"],
30510
+ [Token.AutoKeyword, "'auto'"],
30511
+ [Token.PartialKeyword, "'partial'"],
30512
+ [Token.PrivateKeyword, "'private'"],
30513
+ [Token.PublicKeyword, "'public'"],
30514
+ [Token.ProtectedKeyword, "'protected'"],
30515
+ [Token.InternalKeyword, "'internal'"],
30516
+ [Token.SealedKeyword, "'sealed'"],
30517
+ [Token.LocalKeyword, "'local'"],
30518
+ [Token.AsyncKeyword, "'async'"],
30519
30519
  ]);
30520
30520
  /** @internal */
30521
30521
  const Keywords = new Map([
@@ -30547,6 +30547,71 @@ const Keywords = new Map([
30547
30547
  ["never", Token.NeverKeyword],
30548
30548
  ["unknown", Token.UnknownKeyword],
30549
30549
  ["extern", Token.ExternKeyword],
30550
+ // Reserved keywords
30551
+ ["statemachine", Token.StatemachineKeyword],
30552
+ ["macro", Token.MacroKeyword],
30553
+ ["package", Token.PackageKeyword],
30554
+ ["metadata", Token.MetadataKeyword],
30555
+ ["env", Token.EnvKeyword],
30556
+ ["arg", Token.ArgKeyword],
30557
+ ["declare", Token.DeclareKeyword],
30558
+ ["array", Token.ArrayKeyword],
30559
+ ["struct", Token.StructKeyword],
30560
+ ["record", Token.RecordKeyword],
30561
+ ["module", Token.ModuleKeyword],
30562
+ ["trait", Token.TraitKeyword],
30563
+ ["this", Token.ThisKeyword],
30564
+ ["self", Token.SelfKeyword],
30565
+ ["super", Token.SuperKeyword],
30566
+ ["keyof", Token.KeyofKeyword],
30567
+ ["with", Token.WithKeyword],
30568
+ ["implements", Token.ImplementsKeyword],
30569
+ ["impl", Token.ImplKeyword],
30570
+ ["satisfies", Token.SatisfiesKeyword],
30571
+ ["flag", Token.FlagKeyword],
30572
+ ["auto", Token.AutoKeyword],
30573
+ ["partial", Token.PartialKeyword],
30574
+ ["private", Token.PrivateKeyword],
30575
+ ["public", Token.PublicKeyword],
30576
+ ["protected", Token.ProtectedKeyword],
30577
+ ["internal", Token.InternalKeyword],
30578
+ ["sealed", Token.SealedKeyword],
30579
+ ["local", Token.LocalKeyword],
30580
+ ["async", Token.AsyncKeyword],
30581
+ ]);
30582
+ /** @internal */
30583
+ const ReservedKeywords = new Map([
30584
+ // Reserved keywords
30585
+ ["statemachine", Token.StatemachineKeyword],
30586
+ ["macro", Token.MacroKeyword],
30587
+ ["package", Token.PackageKeyword],
30588
+ ["metadata", Token.MetadataKeyword],
30589
+ ["env", Token.EnvKeyword],
30590
+ ["arg", Token.ArgKeyword],
30591
+ ["declare", Token.DeclareKeyword],
30592
+ ["array", Token.ArrayKeyword],
30593
+ ["struct", Token.StructKeyword],
30594
+ ["record", Token.RecordKeyword],
30595
+ ["module", Token.ModuleKeyword],
30596
+ ["trait", Token.TraitKeyword],
30597
+ ["this", Token.ThisKeyword],
30598
+ ["self", Token.SelfKeyword],
30599
+ ["super", Token.SuperKeyword],
30600
+ ["keyof", Token.KeyofKeyword],
30601
+ ["with", Token.WithKeyword],
30602
+ ["implements", Token.ImplementsKeyword],
30603
+ ["impl", Token.ImplKeyword],
30604
+ ["satisfies", Token.SatisfiesKeyword],
30605
+ ["flag", Token.FlagKeyword],
30606
+ ["auto", Token.AutoKeyword],
30607
+ ["partial", Token.PartialKeyword],
30608
+ ["private", Token.PrivateKeyword],
30609
+ ["public", Token.PublicKeyword],
30610
+ ["protected", Token.ProtectedKeyword],
30611
+ ["internal", Token.InternalKeyword],
30612
+ ["sealed", Token.SealedKeyword],
30613
+ ["local", Token.LocalKeyword],
30614
+ ["async", Token.AsyncKeyword],
30550
30615
  ]);
30551
30616
  var TokenFlags;
30552
30617
  (function (TokenFlags) {
@@ -30582,8 +30647,9 @@ function getTokenDisplayTable(entries) {
30582
30647
  * printIdentifier("foo bar") // `foo bar`
30583
30648
  * ```
30584
30649
  */
30585
- function printIdentifier(sv) {
30586
- if (needBacktick(sv)) {
30650
+ function printIdentifier(sv,
30651
+ /** @internal */ context = "disallow-reserved") {
30652
+ if (needBacktick(sv, context)) {
30587
30653
  const escapedString = sv
30588
30654
  .replace(/\\/g, "\\\\")
30589
30655
  .replace(/\n/g, "\\n")
@@ -30596,10 +30662,13 @@ function printIdentifier(sv) {
30596
30662
  return sv;
30597
30663
  }
30598
30664
  }
30599
- function needBacktick(sv) {
30665
+ function needBacktick(sv, context) {
30600
30666
  if (sv.length === 0) {
30601
30667
  return false;
30602
30668
  }
30669
+ if (context === "allow-reserved" && ReservedKeywords.has(sv)) {
30670
+ return false;
30671
+ }
30603
30672
  if (Keywords.has(sv)) {
30604
30673
  return true;
30605
30674
  }
@@ -31035,6 +31104,13 @@ defineKit({
31035
31104
  }
31036
31105
  return undefined;
31037
31106
  },
31107
+ getDiscriminatedUnion(model) {
31108
+ const discriminator = getDiscriminator(this.program, model);
31109
+ if (!discriminator) {
31110
+ return undefined;
31111
+ }
31112
+ return ignoreDiagnostics(getDiscriminatedUnionFromInheritance(model, discriminator));
31113
+ },
31038
31114
  },
31039
31115
  });
31040
31116
 
@@ -31286,11 +31362,18 @@ defineKit({
31286
31362
  return getPlausibleName(type);
31287
31363
  },
31288
31364
  getDiscriminator(type) {
31289
- return getDiscriminator(this.program, type);
31290
- },
31291
- getDiscriminatedUnion(type) {
31292
- const [union] = getDiscriminatedUnion(this.program, type);
31293
- return union;
31365
+ let discriminator;
31366
+ if ($$1.model.is(type)) {
31367
+ discriminator = getDiscriminator(this.program, type);
31368
+ }
31369
+ else {
31370
+ const unionDiscriminator = ignoreDiagnostics(getDiscriminatedUnion(this.program, type));
31371
+ const propertyName = unionDiscriminator?.options.discriminatorPropertyName;
31372
+ if (propertyName) {
31373
+ discriminator = { propertyName };
31374
+ }
31375
+ }
31376
+ return discriminator;
31294
31377
  },
31295
31378
  maxValue(type) {
31296
31379
  return getMaxValue(this.program, type);
@@ -31414,6 +31497,9 @@ defineKit({
31414
31497
  isExpression(type) {
31415
31498
  return type.name === undefined || type.name === "";
31416
31499
  },
31500
+ getDiscriminatedUnion(type) {
31501
+ return ignoreDiagnostics(getDiscriminatedUnion(this.program, type));
31502
+ },
31417
31503
  },
31418
31504
  });
31419
31505
 
@@ -33482,6 +33568,18 @@ if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
33482
33568
 
33483
33569
  const CompilerPackageRoot = undefined;
33484
33570
 
33571
+ let manifest;
33572
+ try {
33573
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33574
+ // @ts-ignore
33575
+ manifest = (await import('../manifest-CrFWPTea.js')).default;
33576
+ }
33577
+ catch {
33578
+ const name = "../dist/manifest.js";
33579
+ manifest = (await import(/* @vite-ignore */ /* webpackIgnore: true */ name)).default;
33580
+ }
33581
+ manifest.version;
33582
+
33485
33583
  var main$4 = {};
33486
33584
 
33487
33585
  var api$2 = {};
@@ -44777,7 +44875,7 @@ function computeReferences(node) {
44777
44875
  return { pathToNode, typeToPath };
44778
44876
  }
44779
44877
  function computeTree(program) {
44780
- const root = program.checker.getGlobalNamespaceType();
44878
+ const root = program.getGlobalNamespaceType();
44781
44879
  const namespaces = expandNamespaces(root);
44782
44880
  return {
44783
44881
  kind: "list",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/html-program-viewer",
3
- "version": "0.67.0-dev.4",
3
+ "version": "0.67.0-dev.5",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting an html view of the program.",
6
6
  "homepage": "https://typespec.io",
package/dist/emitter.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { EmitContext, JSONSchemaType, Program } from '@typespec/compiler';
2
- export interface HtmlProgramViewerOptions {
3
- /**
4
- * Override compiler output-dir
5
- */
6
- "output-dir"?: string;
7
- }
8
- export declare function renderProgram(program: Program): string;
9
- export declare const libDef: {
10
- readonly name: "@typespec/html-program-viewer";
11
- readonly diagnostics: {};
12
- readonly emitter: {
13
- readonly options: JSONSchemaType<HtmlProgramViewerOptions>;
14
- };
15
- };
16
- export declare const $lib: import('@typespec/compiler').TypeSpecLibrary<{
17
- [code: string]: import('@typespec/compiler').DiagnosticMessages;
18
- }, HtmlProgramViewerOptions, never>;
19
- export declare function $onEmit(context: EmitContext<HtmlProgramViewerOptions>): Promise<void>;
20
- //# sourceMappingURL=emitter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAWD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAQ7C;AAED,eAAO,MAAM,MAAM;;;;0BAIkB,cAAc,CAAC,wBAAwB,CAAC;;CAEnE,CAAC;AAEX,eAAO,MAAM,IAAI;;mCAAgC,CAAC;AAElD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,wBAAwB,CAAC,iBAgB3E"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './emitter.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}