@typespec/compiler 0.45.0-dev.2 → 0.45.0-dev.20
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/core/checker.d.ts.map +1 -1
- package/dist/core/checker.js +90 -23
- package/dist/core/checker.js.map +1 -1
- package/dist/core/cli/args.d.ts +1 -1
- package/dist/core/cli/args.d.ts.map +1 -1
- package/dist/core/cli/args.js +10 -8
- package/dist/core/cli/args.js.map +1 -1
- package/dist/core/cli/cli.js +13 -6
- package/dist/core/cli/cli.js.map +1 -1
- package/dist/core/decorator-utils.js +1 -1
- package/dist/core/decorator-utils.js.map +1 -1
- package/dist/core/entrypoint-resolution.d.ts +10 -0
- package/dist/core/entrypoint-resolution.d.ts.map +1 -0
- package/dist/core/entrypoint-resolution.js +39 -0
- package/dist/core/entrypoint-resolution.js.map +1 -0
- package/dist/core/fetch.d.ts +11 -0
- package/dist/core/fetch.d.ts.map +1 -0
- package/dist/core/fetch.js +38 -0
- package/dist/core/fetch.js.map +1 -0
- package/dist/core/messages.d.ts +7 -25
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +2 -8
- package/dist/core/messages.js.map +1 -1
- package/dist/core/module-resolver.d.ts +1 -0
- package/dist/core/module-resolver.d.ts.map +1 -1
- package/dist/core/module-resolver.js.map +1 -1
- package/dist/core/node-host.js +2 -2
- package/dist/core/node-host.js.map +1 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +4 -3
- package/dist/core/parser.js.map +1 -1
- package/dist/core/program.d.ts.map +1 -1
- package/dist/core/program.js +4 -54
- package/dist/core/program.js.map +1 -1
- package/dist/core/type-utils.d.ts +4 -1
- package/dist/core/type-utils.d.ts.map +1 -1
- package/dist/core/type-utils.js +17 -0
- package/dist/core/type-utils.js.map +1 -1
- package/dist/core/types.d.ts +3 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/formatter/parser.js +1 -1
- package/dist/formatter/parser.js.map +1 -1
- package/dist/formatter/print/comment-handler.js +1 -0
- package/dist/formatter/print/comment-handler.js.map +1 -1
- package/dist/init/init.d.ts.map +1 -1
- package/dist/init/init.js +9 -7
- package/dist/init/init.js.map +1 -1
- package/dist/lib/decorators.d.ts +25 -0
- package/dist/lib/decorators.d.ts.map +1 -1
- package/dist/lib/decorators.js +37 -10
- package/dist/lib/decorators.js.map +1 -1
- package/dist/manifest.js +1 -1
- package/dist/server/completion.js +2 -2
- package/dist/server/completion.js.map +1 -1
- package/dist/server/serverlib.d.ts.map +1 -1
- package/dist/server/serverlib.js +141 -71
- package/dist/server/serverlib.js.map +1 -1
- package/dist/server/type-details.d.ts +1 -10
- package/dist/server/type-details.d.ts.map +1 -1
- package/dist/server/type-details.js +43 -27
- package/dist/server/type-details.js.map +1 -1
- package/dist/server/type-signature.js +19 -3
- package/dist/server/type-signature.js.map +1 -1
- package/lib/decorators.tsp +7 -2
- package/lib/lib.tsp +15 -3
- package/package.json +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../core/checker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAqC,MAAM,oBAAoB,CAAC;AAGxF,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../core/checker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAqC,MAAM,oBAAoB,CAAC;AAGxF,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUzD,OAAO,EAIL,cAAc,EACd,kBAAkB,EAQlB,UAAU,EACV,gBAAgB,EAMhB,SAAS,EAKT,YAAY,EAEZ,cAAc,EAId,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EAOX,KAAK,EAGL,aAAa,EAKb,SAAS,EACT,sBAAsB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S,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,aAAa;IACrB,WAAW,EAAE,uBAAuB,EAAE,CAAC;IACvC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAAC;CAC5D;AAED,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAaD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CA2oJvD;AAqFD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,GAC5C,KAAK,CAyEP;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EACnC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,GAC3C,KAAK,CAmCP;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAcxF;AAED;;;;;;;GAOG;AACH,wBAAiB,uBAAuB,CAAC,KAAK,EAAE,KAAK,2CAapD;AAYD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAEpF"}
|
package/dist/core/checker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDeprecated, getIndexer } from "../lib/decorators.js";
|
|
1
|
+
import { $docFromComment, getDeprecated, getIndexer } from "../lib/decorators.js";
|
|
2
2
|
import { createSymbol, createSymbolTable } from "./binder.js";
|
|
3
3
|
import { ProjectionError, compilerAssert } from "./diagnostics.js";
|
|
4
4
|
import { validateInheritanceDiscriminatedUnions } from "./helpers/discriminator-utils.js";
|
|
@@ -6,7 +6,7 @@ import { getNamespaceFullName, getTypeName } from "./helpers/index.js";
|
|
|
6
6
|
import { createDiagnostic } from "./messages.js";
|
|
7
7
|
import { getIdentifierContext, hasParseError, visitChildren } from "./parser.js";
|
|
8
8
|
import { createProjectionMembers } from "./projection-members.js";
|
|
9
|
-
import { getParentTemplateNode, isNeverType, isTemplateInstance, isUnknownType, isVoidType, } from "./type-utils.js";
|
|
9
|
+
import { getFullyQualifiedSymbolName, getParentTemplateNode, isNeverType, isTemplateInstance, isUnknownType, isVoidType, } from "./type-utils.js";
|
|
10
10
|
import { IdentifierKind, SyntaxKind, } from "./types.js";
|
|
11
11
|
import { MultiKeyMap, createRekeyableMap, isArray, mutate } from "./util.js";
|
|
12
12
|
/**
|
|
@@ -380,23 +380,6 @@ export function createChecker(program) {
|
|
|
380
380
|
// bubbles out somewhere its not supposed to be.
|
|
381
381
|
return errorType;
|
|
382
382
|
}
|
|
383
|
-
function getFullyQualifiedSymbolName(sym, options) {
|
|
384
|
-
if (!sym)
|
|
385
|
-
return "";
|
|
386
|
-
if (sym.symbolSource)
|
|
387
|
-
sym = sym.symbolSource;
|
|
388
|
-
const parent = sym.parent && !(sym.parent.flags & 2097152 /* SymbolFlags.SourceFile */) ? sym.parent : undefined;
|
|
389
|
-
const name = sym.flags & 16384 /* SymbolFlags.Decorator */ ? sym.name.slice(1) : sym.name;
|
|
390
|
-
if (parent === null || parent === void 0 ? void 0 : parent.name) {
|
|
391
|
-
return `${getFullyQualifiedSymbolName(parent)}.${name}`;
|
|
392
|
-
}
|
|
393
|
-
else if (options === null || options === void 0 ? void 0 : options.useGlobalPrefixAtTopLevel) {
|
|
394
|
-
return `global.${name}`;
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
return name;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
383
|
/**
|
|
401
384
|
* Return a fully qualified id of node
|
|
402
385
|
*/
|
|
@@ -1107,6 +1090,9 @@ export function createChecker(program) {
|
|
|
1107
1090
|
sourceOperation,
|
|
1108
1091
|
interface: parentInterface,
|
|
1109
1092
|
});
|
|
1093
|
+
if (links) {
|
|
1094
|
+
linkType(links, operationType, mapper);
|
|
1095
|
+
}
|
|
1110
1096
|
decorators.push(...checkDecorators(operationType, node, mapper));
|
|
1111
1097
|
operationType.parameters.namespace = namespace;
|
|
1112
1098
|
const parent = node.parent;
|
|
@@ -1125,9 +1111,6 @@ export function createChecker(program) {
|
|
|
1125
1111
|
namespace === null || namespace === void 0 ? void 0 : namespace.operations.set(name, operationType);
|
|
1126
1112
|
}
|
|
1127
1113
|
}
|
|
1128
|
-
if (links) {
|
|
1129
|
-
linkType(links, operationType, mapper);
|
|
1130
|
-
}
|
|
1131
1114
|
return operationType;
|
|
1132
1115
|
}
|
|
1133
1116
|
function checkOperationIs(operation, opReference, mapper) {
|
|
@@ -2179,6 +2162,7 @@ export function createChecker(program) {
|
|
|
2179
2162
|
}
|
|
2180
2163
|
}
|
|
2181
2164
|
function checkModelProperty(prop, mapper) {
|
|
2165
|
+
var _a, _b, _c;
|
|
2182
2166
|
const links = getSymbolLinksForMember(prop);
|
|
2183
2167
|
if (links && links.declaredType && mapper === undefined) {
|
|
2184
2168
|
return links.declaredType;
|
|
@@ -2202,6 +2186,16 @@ export function createChecker(program) {
|
|
|
2202
2186
|
const parentTemplate = getParentTemplateNode(prop);
|
|
2203
2187
|
linkMapper(type, mapper);
|
|
2204
2188
|
if (!parentTemplate || shouldCreateTypeForTemplate(parentTemplate, mapper)) {
|
|
2189
|
+
if (((_b = (_a = prop.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === SyntaxKind.OperationSignatureDeclaration &&
|
|
2190
|
+
((_c = prop.parent.parent.parent) === null || _c === void 0 ? void 0 : _c.kind) === SyntaxKind.OperationStatement) {
|
|
2191
|
+
const doc = extractParamDoc(prop.parent.parent.parent, type.name);
|
|
2192
|
+
if (doc) {
|
|
2193
|
+
type.decorators.unshift({
|
|
2194
|
+
decorator: $docFromComment,
|
|
2195
|
+
args: [{ value: createLiteralType(doc) }],
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2205
2199
|
finishType(type);
|
|
2206
2200
|
}
|
|
2207
2201
|
return type;
|
|
@@ -3436,9 +3430,18 @@ export function createChecker(program) {
|
|
|
3436
3430
|
type = createType({ kind: "Boolean", value });
|
|
3437
3431
|
break;
|
|
3438
3432
|
case "number":
|
|
3433
|
+
let valueAsString;
|
|
3434
|
+
if (node) {
|
|
3435
|
+
compilerAssert(node.kind === SyntaxKind.NumericLiteral, "Must pass numeric literal node or undefined when creating a numeric literal type");
|
|
3436
|
+
valueAsString = node.valueAsString;
|
|
3437
|
+
}
|
|
3438
|
+
else {
|
|
3439
|
+
valueAsString = String(value);
|
|
3440
|
+
}
|
|
3439
3441
|
type = createType({
|
|
3440
3442
|
kind: "Number",
|
|
3441
3443
|
value,
|
|
3444
|
+
valueAsString,
|
|
3442
3445
|
});
|
|
3443
3446
|
break;
|
|
3444
3447
|
}
|
|
@@ -3592,7 +3595,27 @@ export function createChecker(program) {
|
|
|
3592
3595
|
}
|
|
3593
3596
|
return [true, []];
|
|
3594
3597
|
}
|
|
3595
|
-
if (target.kind === "Model" &&
|
|
3598
|
+
if (target.kind === "Model" &&
|
|
3599
|
+
source.kind === "Model" &&
|
|
3600
|
+
target.name !== "object" &&
|
|
3601
|
+
target.indexer === undefined &&
|
|
3602
|
+
source.indexer &&
|
|
3603
|
+
source.indexer.key.name === "integer") {
|
|
3604
|
+
return [
|
|
3605
|
+
false,
|
|
3606
|
+
[
|
|
3607
|
+
createDiagnostic({
|
|
3608
|
+
code: "missing-index",
|
|
3609
|
+
format: {
|
|
3610
|
+
indexType: getTypeName(source.indexer.key),
|
|
3611
|
+
sourceType: getTypeName(target),
|
|
3612
|
+
},
|
|
3613
|
+
target: diagnosticTarget,
|
|
3614
|
+
}),
|
|
3615
|
+
],
|
|
3616
|
+
];
|
|
3617
|
+
}
|
|
3618
|
+
else if (target.kind === "Model" && target.indexer !== undefined && source.kind === "Model") {
|
|
3596
3619
|
return isIndexerValid(source, target, diagnosticTarget);
|
|
3597
3620
|
}
|
|
3598
3621
|
else if (target.kind === "Model" && source.kind === "Model") {
|
|
@@ -3685,6 +3708,10 @@ export function createChecker(program) {
|
|
|
3685
3708
|
}
|
|
3686
3709
|
if (target.name === "numeric")
|
|
3687
3710
|
return true;
|
|
3711
|
+
if (target.name === "decimal")
|
|
3712
|
+
return true;
|
|
3713
|
+
if (target.name === "decimal128")
|
|
3714
|
+
return true;
|
|
3688
3715
|
const isInt = Number.isInteger(source.value);
|
|
3689
3716
|
if (target.name === "integer")
|
|
3690
3717
|
return isInt;
|
|
@@ -4094,8 +4121,48 @@ function linkMapper(typeDef, mapper) {
|
|
|
4094
4121
|
typeDef.templateArguments = mapper.args;
|
|
4095
4122
|
}
|
|
4096
4123
|
}
|
|
4124
|
+
function extractMainDoc(type) {
|
|
4125
|
+
var _a;
|
|
4126
|
+
if (((_a = type.node) === null || _a === void 0 ? void 0 : _a.docs) === undefined) {
|
|
4127
|
+
return undefined;
|
|
4128
|
+
}
|
|
4129
|
+
let mainDoc = "";
|
|
4130
|
+
for (const doc of type.node.docs) {
|
|
4131
|
+
mainDoc += getDocContent(doc.content);
|
|
4132
|
+
}
|
|
4133
|
+
const trimmed = mainDoc.trim();
|
|
4134
|
+
return trimmed === "" ? undefined : trimmed;
|
|
4135
|
+
}
|
|
4136
|
+
function extractParamDoc(node, paramName) {
|
|
4137
|
+
if (node.docs === undefined) {
|
|
4138
|
+
return undefined;
|
|
4139
|
+
}
|
|
4140
|
+
for (const doc of node.docs) {
|
|
4141
|
+
for (const tag of doc.tags) {
|
|
4142
|
+
if (tag.kind === SyntaxKind.DocParamTag && tag.paramName.sv === paramName) {
|
|
4143
|
+
return getDocContent(tag.content);
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
return undefined;
|
|
4148
|
+
}
|
|
4149
|
+
function getDocContent(content) {
|
|
4150
|
+
const docs = [];
|
|
4151
|
+
for (const node of content) {
|
|
4152
|
+
compilerAssert(node.kind === SyntaxKind.DocText, "No other doc content node kinds exist yet. Update this code appropriately when more are added.");
|
|
4153
|
+
docs.push(node.text);
|
|
4154
|
+
}
|
|
4155
|
+
return docs.join("");
|
|
4156
|
+
}
|
|
4097
4157
|
function finishTypeForProgramAndChecker(program, typePrototype, typeDef) {
|
|
4098
4158
|
if ("decorators" in typeDef) {
|
|
4159
|
+
const docComment = extractMainDoc(typeDef);
|
|
4160
|
+
if (docComment) {
|
|
4161
|
+
typeDef.decorators.unshift({
|
|
4162
|
+
decorator: $docFromComment,
|
|
4163
|
+
args: [{ value: program.checker.createLiteralType(docComment) }],
|
|
4164
|
+
});
|
|
4165
|
+
}
|
|
4099
4166
|
for (const decApp of typeDef.decorators) {
|
|
4100
4167
|
applyDecoratorToType(program, decApp, typeDef);
|
|
4101
4168
|
}
|