@typespec/html-program-viewer 0.67.0-dev.4 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest-CJDStH3V.js +6 -0
- package/dist/react/index.js +374 -264
- package/package.json +3 -3
- package/dist/emitter.d.ts +0 -20
- package/dist/emitter.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/manifest-DRAJnEGG.js +0 -6
package/dist/react/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,46 @@ var Token;
|
|
|
30432
30366
|
// Add new non-statement keyword above
|
|
30433
30367
|
/** @internal */ Token[Token["__EndKeyword"] = 80] = "__EndKeyword";
|
|
30434
30368
|
///////////////////////////////////////////////////////////////
|
|
30435
|
-
/** @internal */ Token[Token["
|
|
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["ModKeyword"] = 91] = "ModKeyword";
|
|
30384
|
+
Token[Token["PubKeyword"] = 92] = "PubKeyword";
|
|
30385
|
+
Token[Token["SubKeyword"] = 93] = "SubKeyword";
|
|
30386
|
+
Token[Token["TypeRefKeyword"] = 94] = "TypeRefKeyword";
|
|
30387
|
+
Token[Token["TraitKeyword"] = 95] = "TraitKeyword";
|
|
30388
|
+
Token[Token["ThisKeyword"] = 96] = "ThisKeyword";
|
|
30389
|
+
Token[Token["SelfKeyword"] = 97] = "SelfKeyword";
|
|
30390
|
+
Token[Token["SuperKeyword"] = 98] = "SuperKeyword";
|
|
30391
|
+
Token[Token["KeyofKeyword"] = 99] = "KeyofKeyword";
|
|
30392
|
+
Token[Token["WithKeyword"] = 100] = "WithKeyword";
|
|
30393
|
+
Token[Token["ImplementsKeyword"] = 101] = "ImplementsKeyword";
|
|
30394
|
+
Token[Token["ImplKeyword"] = 102] = "ImplKeyword";
|
|
30395
|
+
Token[Token["SatisfiesKeyword"] = 103] = "SatisfiesKeyword";
|
|
30396
|
+
Token[Token["FlagKeyword"] = 104] = "FlagKeyword";
|
|
30397
|
+
Token[Token["AutoKeyword"] = 105] = "AutoKeyword";
|
|
30398
|
+
Token[Token["PartialKeyword"] = 106] = "PartialKeyword";
|
|
30399
|
+
Token[Token["PrivateKeyword"] = 107] = "PrivateKeyword";
|
|
30400
|
+
Token[Token["PublicKeyword"] = 108] = "PublicKeyword";
|
|
30401
|
+
Token[Token["ProtectedKeyword"] = 109] = "ProtectedKeyword";
|
|
30402
|
+
Token[Token["InternalKeyword"] = 110] = "InternalKeyword";
|
|
30403
|
+
Token[Token["SealedKeyword"] = 111] = "SealedKeyword";
|
|
30404
|
+
Token[Token["LocalKeyword"] = 112] = "LocalKeyword";
|
|
30405
|
+
Token[Token["AsyncKeyword"] = 113] = "AsyncKeyword";
|
|
30406
|
+
/** @internal */ Token[Token["__EndReservedKeyword"] = 114] = "__EndReservedKeyword";
|
|
30407
|
+
///////////////////////////////////////////////////////////////
|
|
30408
|
+
/** @internal */ Token[Token["__Count"] = 114] = "__Count";
|
|
30436
30409
|
})(Token || (Token = {}));
|
|
30437
30410
|
/** @internal */
|
|
30438
30411
|
getTokenDisplayTable([
|
|
@@ -30516,6 +30489,41 @@ getTokenDisplayTable([
|
|
|
30516
30489
|
[Token.NeverKeyword, "'never'"],
|
|
30517
30490
|
[Token.UnknownKeyword, "'unknown'"],
|
|
30518
30491
|
[Token.ExternKeyword, "'extern'"],
|
|
30492
|
+
// Reserved keywords
|
|
30493
|
+
[Token.StatemachineKeyword, "'statemachine'"],
|
|
30494
|
+
[Token.MacroKeyword, "'macro'"],
|
|
30495
|
+
[Token.PackageKeyword, "'package'"],
|
|
30496
|
+
[Token.MetadataKeyword, "'metadata'"],
|
|
30497
|
+
[Token.EnvKeyword, "'env'"],
|
|
30498
|
+
[Token.ArgKeyword, "'arg'"],
|
|
30499
|
+
[Token.DeclareKeyword, "'declare'"],
|
|
30500
|
+
[Token.ArrayKeyword, "'array'"],
|
|
30501
|
+
[Token.StructKeyword, "'struct'"],
|
|
30502
|
+
[Token.RecordKeyword, "'record'"],
|
|
30503
|
+
[Token.ModuleKeyword, "'module'"],
|
|
30504
|
+
[Token.ModKeyword, "'mod'"],
|
|
30505
|
+
[Token.PubKeyword, "'pub'"],
|
|
30506
|
+
[Token.SubKeyword, "'sub'"],
|
|
30507
|
+
[Token.TypeRefKeyword, "'typeref'"],
|
|
30508
|
+
[Token.TraitKeyword, "'trait'"],
|
|
30509
|
+
[Token.ThisKeyword, "'this'"],
|
|
30510
|
+
[Token.SelfKeyword, "'self'"],
|
|
30511
|
+
[Token.SuperKeyword, "'super'"],
|
|
30512
|
+
[Token.KeyofKeyword, "'keyof'"],
|
|
30513
|
+
[Token.WithKeyword, "'with'"],
|
|
30514
|
+
[Token.ImplementsKeyword, "'implements'"],
|
|
30515
|
+
[Token.ImplKeyword, "'impl'"],
|
|
30516
|
+
[Token.SatisfiesKeyword, "'satisfies'"],
|
|
30517
|
+
[Token.FlagKeyword, "'flag'"],
|
|
30518
|
+
[Token.AutoKeyword, "'auto'"],
|
|
30519
|
+
[Token.PartialKeyword, "'partial'"],
|
|
30520
|
+
[Token.PrivateKeyword, "'private'"],
|
|
30521
|
+
[Token.PublicKeyword, "'public'"],
|
|
30522
|
+
[Token.ProtectedKeyword, "'protected'"],
|
|
30523
|
+
[Token.InternalKeyword, "'internal'"],
|
|
30524
|
+
[Token.SealedKeyword, "'sealed'"],
|
|
30525
|
+
[Token.LocalKeyword, "'local'"],
|
|
30526
|
+
[Token.AsyncKeyword, "'async'"],
|
|
30519
30527
|
]);
|
|
30520
30528
|
/** @internal */
|
|
30521
30529
|
const Keywords = new Map([
|
|
@@ -30547,6 +30555,75 @@ const Keywords = new Map([
|
|
|
30547
30555
|
["never", Token.NeverKeyword],
|
|
30548
30556
|
["unknown", Token.UnknownKeyword],
|
|
30549
30557
|
["extern", Token.ExternKeyword],
|
|
30558
|
+
// Reserved keywords
|
|
30559
|
+
["statemachine", Token.StatemachineKeyword],
|
|
30560
|
+
["macro", Token.MacroKeyword],
|
|
30561
|
+
["package", Token.PackageKeyword],
|
|
30562
|
+
["metadata", Token.MetadataKeyword],
|
|
30563
|
+
["env", Token.EnvKeyword],
|
|
30564
|
+
["arg", Token.ArgKeyword],
|
|
30565
|
+
["declare", Token.DeclareKeyword],
|
|
30566
|
+
["array", Token.ArrayKeyword],
|
|
30567
|
+
["struct", Token.StructKeyword],
|
|
30568
|
+
["record", Token.RecordKeyword],
|
|
30569
|
+
["module", Token.ModuleKeyword],
|
|
30570
|
+
["mod", Token.ModKeyword],
|
|
30571
|
+
["pub", Token.PubKeyword],
|
|
30572
|
+
["sub", Token.SubKeyword],
|
|
30573
|
+
["typeref", Token.TypeRefKeyword],
|
|
30574
|
+
["trait", Token.TraitKeyword],
|
|
30575
|
+
["this", Token.ThisKeyword],
|
|
30576
|
+
["self", Token.SelfKeyword],
|
|
30577
|
+
["super", Token.SuperKeyword],
|
|
30578
|
+
["keyof", Token.KeyofKeyword],
|
|
30579
|
+
["with", Token.WithKeyword],
|
|
30580
|
+
["implements", Token.ImplementsKeyword],
|
|
30581
|
+
["impl", Token.ImplKeyword],
|
|
30582
|
+
["satisfies", Token.SatisfiesKeyword],
|
|
30583
|
+
["flag", Token.FlagKeyword],
|
|
30584
|
+
["auto", Token.AutoKeyword],
|
|
30585
|
+
["partial", Token.PartialKeyword],
|
|
30586
|
+
["private", Token.PrivateKeyword],
|
|
30587
|
+
["public", Token.PublicKeyword],
|
|
30588
|
+
["protected", Token.ProtectedKeyword],
|
|
30589
|
+
["internal", Token.InternalKeyword],
|
|
30590
|
+
["sealed", Token.SealedKeyword],
|
|
30591
|
+
["local", Token.LocalKeyword],
|
|
30592
|
+
["async", Token.AsyncKeyword],
|
|
30593
|
+
]);
|
|
30594
|
+
/** @internal */
|
|
30595
|
+
const ReservedKeywords = new Map([
|
|
30596
|
+
// Reserved keywords
|
|
30597
|
+
["statemachine", Token.StatemachineKeyword],
|
|
30598
|
+
["macro", Token.MacroKeyword],
|
|
30599
|
+
["package", Token.PackageKeyword],
|
|
30600
|
+
["metadata", Token.MetadataKeyword],
|
|
30601
|
+
["env", Token.EnvKeyword],
|
|
30602
|
+
["arg", Token.ArgKeyword],
|
|
30603
|
+
["declare", Token.DeclareKeyword],
|
|
30604
|
+
["array", Token.ArrayKeyword],
|
|
30605
|
+
["struct", Token.StructKeyword],
|
|
30606
|
+
["record", Token.RecordKeyword],
|
|
30607
|
+
["module", Token.ModuleKeyword],
|
|
30608
|
+
["trait", Token.TraitKeyword],
|
|
30609
|
+
["this", Token.ThisKeyword],
|
|
30610
|
+
["self", Token.SelfKeyword],
|
|
30611
|
+
["super", Token.SuperKeyword],
|
|
30612
|
+
["keyof", Token.KeyofKeyword],
|
|
30613
|
+
["with", Token.WithKeyword],
|
|
30614
|
+
["implements", Token.ImplementsKeyword],
|
|
30615
|
+
["impl", Token.ImplKeyword],
|
|
30616
|
+
["satisfies", Token.SatisfiesKeyword],
|
|
30617
|
+
["flag", Token.FlagKeyword],
|
|
30618
|
+
["auto", Token.AutoKeyword],
|
|
30619
|
+
["partial", Token.PartialKeyword],
|
|
30620
|
+
["private", Token.PrivateKeyword],
|
|
30621
|
+
["public", Token.PublicKeyword],
|
|
30622
|
+
["protected", Token.ProtectedKeyword],
|
|
30623
|
+
["internal", Token.InternalKeyword],
|
|
30624
|
+
["sealed", Token.SealedKeyword],
|
|
30625
|
+
["local", Token.LocalKeyword],
|
|
30626
|
+
["async", Token.AsyncKeyword],
|
|
30550
30627
|
]);
|
|
30551
30628
|
var TokenFlags;
|
|
30552
30629
|
(function (TokenFlags) {
|
|
@@ -30582,8 +30659,9 @@ function getTokenDisplayTable(entries) {
|
|
|
30582
30659
|
* printIdentifier("foo bar") // `foo bar`
|
|
30583
30660
|
* ```
|
|
30584
30661
|
*/
|
|
30585
|
-
function printIdentifier(sv
|
|
30586
|
-
|
|
30662
|
+
function printIdentifier(sv,
|
|
30663
|
+
/** @internal */ context = "disallow-reserved") {
|
|
30664
|
+
if (needBacktick(sv, context)) {
|
|
30587
30665
|
const escapedString = sv
|
|
30588
30666
|
.replace(/\\/g, "\\\\")
|
|
30589
30667
|
.replace(/\n/g, "\\n")
|
|
@@ -30596,10 +30674,13 @@ function printIdentifier(sv) {
|
|
|
30596
30674
|
return sv;
|
|
30597
30675
|
}
|
|
30598
30676
|
}
|
|
30599
|
-
function needBacktick(sv) {
|
|
30677
|
+
function needBacktick(sv, context) {
|
|
30600
30678
|
if (sv.length === 0) {
|
|
30601
30679
|
return false;
|
|
30602
30680
|
}
|
|
30681
|
+
if (context === "allow-reserved" && ReservedKeywords.has(sv)) {
|
|
30682
|
+
return false;
|
|
30683
|
+
}
|
|
30603
30684
|
if (Keywords.has(sv)) {
|
|
30604
30685
|
return true;
|
|
30605
30686
|
}
|
|
@@ -31035,6 +31116,13 @@ defineKit({
|
|
|
31035
31116
|
}
|
|
31036
31117
|
return undefined;
|
|
31037
31118
|
},
|
|
31119
|
+
getDiscriminatedUnion(model) {
|
|
31120
|
+
const discriminator = getDiscriminator(this.program, model);
|
|
31121
|
+
if (!discriminator) {
|
|
31122
|
+
return undefined;
|
|
31123
|
+
}
|
|
31124
|
+
return ignoreDiagnostics(getDiscriminatedUnionFromInheritance(model, discriminator));
|
|
31125
|
+
},
|
|
31038
31126
|
},
|
|
31039
31127
|
});
|
|
31040
31128
|
|
|
@@ -31286,11 +31374,18 @@ defineKit({
|
|
|
31286
31374
|
return getPlausibleName(type);
|
|
31287
31375
|
},
|
|
31288
31376
|
getDiscriminator(type) {
|
|
31289
|
-
|
|
31290
|
-
|
|
31291
|
-
|
|
31292
|
-
|
|
31293
|
-
|
|
31377
|
+
let discriminator;
|
|
31378
|
+
if ($$1.model.is(type)) {
|
|
31379
|
+
discriminator = getDiscriminator(this.program, type);
|
|
31380
|
+
}
|
|
31381
|
+
else {
|
|
31382
|
+
const unionDiscriminator = ignoreDiagnostics(getDiscriminatedUnion(this.program, type));
|
|
31383
|
+
const propertyName = unionDiscriminator?.options.discriminatorPropertyName;
|
|
31384
|
+
if (propertyName) {
|
|
31385
|
+
discriminator = { propertyName };
|
|
31386
|
+
}
|
|
31387
|
+
}
|
|
31388
|
+
return discriminator;
|
|
31294
31389
|
},
|
|
31295
31390
|
maxValue(type) {
|
|
31296
31391
|
return getMaxValue(this.program, type);
|
|
@@ -31414,6 +31509,9 @@ defineKit({
|
|
|
31414
31509
|
isExpression(type) {
|
|
31415
31510
|
return type.name === undefined || type.name === "";
|
|
31416
31511
|
},
|
|
31512
|
+
getDiscriminatedUnion(type) {
|
|
31513
|
+
return ignoreDiagnostics(getDiscriminatedUnion(this.program, type));
|
|
31514
|
+
},
|
|
31417
31515
|
},
|
|
31418
31516
|
});
|
|
31419
31517
|
|
|
@@ -33482,6 +33580,18 @@ if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
|
|
|
33482
33580
|
|
|
33483
33581
|
const CompilerPackageRoot = undefined;
|
|
33484
33582
|
|
|
33583
|
+
let manifest;
|
|
33584
|
+
try {
|
|
33585
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33586
|
+
// @ts-ignore
|
|
33587
|
+
manifest = (await import('../manifest-CJDStH3V.js')).default;
|
|
33588
|
+
}
|
|
33589
|
+
catch {
|
|
33590
|
+
const name = "../dist/manifest.js";
|
|
33591
|
+
manifest = (await import(/* @vite-ignore */ /* webpackIgnore: true */ name)).default;
|
|
33592
|
+
}
|
|
33593
|
+
manifest.version;
|
|
33594
|
+
|
|
33485
33595
|
var main$4 = {};
|
|
33486
33596
|
|
|
33487
33597
|
var api$2 = {};
|
|
@@ -44777,7 +44887,7 @@ function computeReferences(node) {
|
|
|
44777
44887
|
return { pathToNode, typeToPath };
|
|
44778
44888
|
}
|
|
44779
44889
|
function computeTree(program) {
|
|
44780
|
-
const root = program.
|
|
44890
|
+
const root = program.getGlobalNamespaceType();
|
|
44781
44891
|
const namespaces = expandNamespaces(root);
|
|
44782
44892
|
return {
|
|
44783
44893
|
kind: "list",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/html-program-viewer",
|
|
3
|
-
"version": "0.67.0
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec library for emitting an html view of the program.",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"!dist/test/**"
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@typespec/compiler": "^0.
|
|
39
|
+
"@typespec/compiler": "^0.67.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@fluentui/react-components": "~9.60.0",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@types/node": "~22.13.9",
|
|
55
55
|
"@types/react": "~18.3.11",
|
|
56
56
|
"@types/react-dom": "~18.3.0",
|
|
57
|
-
"@typespec/compiler": "^0.66.0 || >=0.67.0-dev <0.67.0",
|
|
58
57
|
"@vitejs/plugin-react": "~4.3.4",
|
|
59
58
|
"@vitest/coverage-v8": "^3.0.7",
|
|
60
59
|
"@vitest/ui": "^3.0.7",
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
"vite-plugin-dts": "4.5.3",
|
|
67
66
|
"vite-plugin-node-polyfills": "^0.23.0",
|
|
68
67
|
"vitest": "^3.0.7",
|
|
68
|
+
"@typespec/compiler": "^0.67.0",
|
|
69
69
|
"@typespec/react-components": "^0.57.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
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
|
package/dist/emitter.d.ts.map
DELETED
|
@@ -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
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|