@typespec/compiler 0.56.0-dev.12 → 0.56.0-dev.14
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.js +2 -2
- package/dist/src/core/checker.d.ts.map +1 -1
- package/dist/src/core/checker.js +10 -4
- package/dist/src/core/checker.js.map +1 -1
- package/dist/src/core/node-host.js +1 -1
- package/dist/src/core/node-host.js.map +1 -1
- package/dist/src/core/program.d.ts.map +1 -1
- package/dist/src/core/program.js +8 -3
- package/dist/src/core/program.js.map +1 -1
- package/dist/src/core/types.d.ts +15 -0
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/types.js.map +1 -1
- package/dist/src/lib/decorators.d.ts +1 -3
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +0 -8
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/lib/intrinsic-decorators.d.ts +6 -0
- package/dist/src/lib/intrinsic-decorators.d.ts.map +1 -0
- package/dist/src/lib/intrinsic-decorators.js +10 -0
- package/dist/src/lib/intrinsic-decorators.js.map +1 -0
- package/dist/src/testing/test-host.js +2 -2
- package/dist/src/testing/test-host.js.map +1 -1
- package/lib/{lib.tsp → intrinsics.tsp} +3 -75
- package/lib/{decorators.tsp → std/decorators.tsp} +1 -1
- package/lib/std/main.tsp +5 -0
- package/lib/std/types.tsp +76 -0
- package/package.json +3 -3
- package/lib/main.tsp +0 -4
- /package/lib/{projected-names.tsp → std/projected-names.tsp} +0 -0
- /package/lib/{reflection.tsp → std/reflection.tsp} +0 -0
package/dist/manifest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/core/checker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/core/checker.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,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F;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/src/core/checker.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $docFromComment,
|
|
1
|
+
import { $docFromComment, isArrayModelType } from "../lib/decorators.js";
|
|
2
|
+
import { getIndexer } from "../lib/intrinsic-decorators.js";
|
|
2
3
|
import { MultiKeyMap, createRekeyableMap, isArray, mutate } from "../utils/misc.js";
|
|
3
4
|
import { createSymbol, createSymbolTable } from "./binder.js";
|
|
4
5
|
import { createChangeIdentifierCodeFix } from "./compiler-code-fixes/change-identifier.codefix.js";
|
|
@@ -76,9 +77,6 @@ export function createChecker(program) {
|
|
|
76
77
|
}
|
|
77
78
|
const typespecNamespaceBinding = globalNamespaceNode.symbol.exports.get("TypeSpec");
|
|
78
79
|
if (typespecNamespaceBinding) {
|
|
79
|
-
// the TypeSpec namespace binding will be absent if we've passed
|
|
80
|
-
// the no-std-lib option.
|
|
81
|
-
// the first declaration here is the JS file for the TypeSpec script.
|
|
82
80
|
initializeTypeSpecIntrinsics();
|
|
83
81
|
for (const file of program.sourceFiles.values()) {
|
|
84
82
|
addUsingSymbols(typespecNamespaceBinding.exports, file.locals);
|
|
@@ -1029,6 +1027,7 @@ export function createChecker(program) {
|
|
|
1029
1027
|
properties: properties,
|
|
1030
1028
|
decorators: [],
|
|
1031
1029
|
derivedModels: [],
|
|
1030
|
+
sourceModels: [],
|
|
1032
1031
|
});
|
|
1033
1032
|
const indexers = [];
|
|
1034
1033
|
const modelOptions = options.filter((entry) => {
|
|
@@ -1057,6 +1056,7 @@ export function createChecker(program) {
|
|
|
1057
1056
|
}
|
|
1058
1057
|
}
|
|
1059
1058
|
for (const [_, option] of modelOptions) {
|
|
1059
|
+
intersection.sourceModels.push({ usage: "intersection", model: option });
|
|
1060
1060
|
const allProps = walkPropertiesInherited(option);
|
|
1061
1061
|
for (const prop of allProps) {
|
|
1062
1062
|
if (properties.has(prop.name)) {
|
|
@@ -1956,12 +1956,14 @@ export function createChecker(program) {
|
|
|
1956
1956
|
properties: createRekeyableMap(),
|
|
1957
1957
|
namespace: getParentNamespaceType(node),
|
|
1958
1958
|
decorators,
|
|
1959
|
+
sourceModels: [],
|
|
1959
1960
|
derivedModels: [],
|
|
1960
1961
|
});
|
|
1961
1962
|
linkType(links, type, mapper);
|
|
1962
1963
|
const isBase = checkModelIs(node, node.is, mapper);
|
|
1963
1964
|
if (isBase) {
|
|
1964
1965
|
type.sourceModel = isBase;
|
|
1966
|
+
type.sourceModels.push({ usage: "is", model: isBase });
|
|
1965
1967
|
// copy decorators
|
|
1966
1968
|
decorators.push(...isBase.decorators);
|
|
1967
1969
|
if (isBase.indexer) {
|
|
@@ -2037,6 +2039,7 @@ export function createChecker(program) {
|
|
|
2037
2039
|
namespace: getParentNamespaceType(node),
|
|
2038
2040
|
decorators: [],
|
|
2039
2041
|
derivedModels: [],
|
|
2042
|
+
sourceModels: [],
|
|
2040
2043
|
});
|
|
2041
2044
|
checkModelProperties(node, properties, type, mapper);
|
|
2042
2045
|
return finishType(type);
|
|
@@ -2519,6 +2522,7 @@ export function createChecker(program) {
|
|
|
2519
2522
|
target: targetNode,
|
|
2520
2523
|
}));
|
|
2521
2524
|
}
|
|
2525
|
+
parentModel.sourceModels.push({ usage: "spread", model: targetType });
|
|
2522
2526
|
const props = [];
|
|
2523
2527
|
// copy each property
|
|
2524
2528
|
for (const prop of walkPropertiesInherited(targetType)) {
|
|
@@ -3640,6 +3644,7 @@ export function createChecker(program) {
|
|
|
3640
3644
|
decorators: [],
|
|
3641
3645
|
properties: createRekeyableMap(),
|
|
3642
3646
|
derivedModels: [],
|
|
3647
|
+
sourceModels: [],
|
|
3643
3648
|
});
|
|
3644
3649
|
for (const propNode of node.properties) {
|
|
3645
3650
|
if (propNode.kind === SyntaxKind.ProjectionModelProperty) {
|
|
@@ -4643,6 +4648,7 @@ export function filterModelProperties(program, model, filter) {
|
|
|
4643
4648
|
properties,
|
|
4644
4649
|
decorators: [],
|
|
4645
4650
|
derivedModels: [],
|
|
4651
|
+
sourceModels: [{ usage: "spread", model }],
|
|
4646
4652
|
});
|
|
4647
4653
|
for (const property of walkPropertiesInherited(model)) {
|
|
4648
4654
|
if (filter(property)) {
|