@typespec/compiler 1.18.0-dev.9 → 1.19.0-dev.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/generated-defs/TypeSpec.d.ts +16 -1
- package/dist/generated-defs/TypeSpec.d.ts.map +1 -1
- package/dist/manifest.js +2 -2
- package/dist/src/ast/index.d.ts +2 -0
- package/dist/src/ast/index.d.ts.map +1 -1
- package/dist/src/ast/index.js +1 -0
- package/dist/src/ast/index.js.map +1 -1
- package/dist/src/ast/suppressions.d.ts +59 -0
- package/dist/src/ast/suppressions.d.ts.map +1 -0
- package/dist/src/ast/suppressions.js +102 -0
- package/dist/src/ast/suppressions.js.map +1 -0
- package/dist/src/config/linter-disables.d.ts +23 -0
- package/dist/src/config/linter-disables.d.ts.map +1 -0
- package/dist/src/config/linter-disables.js +85 -0
- package/dist/src/config/linter-disables.js.map +1 -0
- package/dist/src/core/checker.d.ts.map +1 -1
- package/dist/src/core/checker.js +37 -19
- package/dist/src/core/checker.js.map +1 -1
- package/dist/src/core/cli/actions/compile/args.d.ts +9 -0
- package/dist/src/core/cli/actions/compile/args.d.ts.map +1 -1
- package/dist/src/core/cli/actions/compile/args.js +65 -0
- package/dist/src/core/cli/actions/compile/args.js.map +1 -1
- package/dist/src/core/cli/cli.js +16 -0
- package/dist/src/core/cli/cli.js.map +1 -1
- package/dist/src/core/directives.d.ts +3 -0
- package/dist/src/core/directives.d.ts.map +1 -0
- package/dist/src/core/directives.js +21 -0
- package/dist/src/core/directives.js.map +1 -0
- package/dist/src/core/features.d.ts +3 -0
- package/dist/src/core/features.d.ts.map +1 -1
- package/dist/src/core/features.js +3 -0
- package/dist/src/core/features.js.map +1 -1
- package/dist/src/core/helpers/type-name-utils.d.ts.map +1 -1
- package/dist/src/core/helpers/type-name-utils.js +2 -0
- package/dist/src/core/helpers/type-name-utils.js.map +1 -1
- package/dist/src/core/js-marshaller.d.ts.map +1 -1
- package/dist/src/core/js-marshaller.js +1 -0
- package/dist/src/core/js-marshaller.js.map +1 -1
- package/dist/src/core/linter.d.ts +2 -0
- package/dist/src/core/linter.d.ts.map +1 -1
- package/dist/src/core/linter.js +10 -7
- package/dist/src/core/linter.js.map +1 -1
- package/dist/src/core/messages.d.ts +56 -2
- package/dist/src/core/messages.d.ts.map +1 -1
- package/dist/src/core/messages.js +19 -1
- package/dist/src/core/messages.js.map +1 -1
- package/dist/src/core/options.d.ts.map +1 -1
- package/dist/src/core/program.js +20 -1
- package/dist/src/core/program.js.map +1 -1
- package/dist/src/core/scanner.d.ts.map +1 -1
- package/dist/src/core/scanner.js +0 -1
- package/dist/src/core/scanner.js.map +1 -1
- package/dist/src/core/suppression-tracking.d.ts +2 -1
- package/dist/src/core/suppression-tracking.d.ts.map +1 -1
- package/dist/src/core/suppression-tracking.js +10 -32
- package/dist/src/core/suppression-tracking.js.map +1 -1
- package/dist/src/core/type-relation-checker.d.ts +1 -0
- package/dist/src/core/type-relation-checker.d.ts.map +1 -1
- package/dist/src/core/type-relation-checker.js +25 -9
- package/dist/src/core/type-relation-checker.js.map +1 -1
- package/dist/src/core/type-utils.d.ts +5 -3
- package/dist/src/core/type-utils.d.ts.map +1 -1
- package/dist/src/core/type-utils.js +10 -2
- package/dist/src/core/type-utils.js.map +1 -1
- package/dist/src/core/types.d.ts +21 -2
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/types.js.map +1 -1
- package/dist/src/experimental/mutators.js +69 -3
- package/dist/src/experimental/mutators.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/examples.d.ts +1 -1
- package/dist/src/lib/examples.d.ts.map +1 -1
- package/dist/src/lib/examples.js +3 -1
- package/dist/src/lib/examples.js.map +1 -1
- package/dist/src/lib/tsp-index.d.ts.map +1 -1
- package/dist/src/lib/tsp-index.js +2 -0
- package/dist/src/lib/tsp-index.js.map +1 -1
- package/dist/src/lib/typeref.d.ts +3 -0
- package/dist/src/lib/typeref.d.ts.map +1 -0
- package/dist/src/lib/typeref.js +17 -0
- package/dist/src/lib/typeref.js.map +1 -0
- package/dist/src/testing/tester.d.ts.map +1 -1
- package/dist/src/testing/tester.js +14 -1
- package/dist/src/testing/tester.js.map +1 -1
- package/dist/src/yaml/parser.d.ts +2 -0
- package/dist/src/yaml/parser.d.ts.map +1 -1
- package/dist/src/yaml/parser.js +6 -6
- package/dist/src/yaml/parser.js.map +1 -1
- package/lib/intrinsics.tsp +6 -0
- package/lib/std/types.tsp +15 -0
- package/package.json +14 -15
- package/templates/scaffolding.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/yaml/parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAsB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/yaml/parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAsB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC,CAG1F;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,UAAU,GAC1B,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC,CAe3D"}
|
package/dist/src/yaml/parser.js
CHANGED
|
@@ -2,6 +2,11 @@ import { parseDocument } from "yaml";
|
|
|
2
2
|
import { createDiagnosticCollector } from "../core/diagnostics.js";
|
|
3
3
|
import { createSourceFile } from "../core/source-file.js";
|
|
4
4
|
export function parseYaml(source) {
|
|
5
|
+
const [{ file, doc }, diagnostics] = parseYamlDocument(source);
|
|
6
|
+
return [{ kind: "yaml-script", file, value: doc.toJSON(), doc }, diagnostics];
|
|
7
|
+
}
|
|
8
|
+
/** Parse YAML without converting the document to JavaScript values. */
|
|
9
|
+
export function parseYamlDocument(source) {
|
|
5
10
|
const diagnostics = createDiagnosticCollector();
|
|
6
11
|
const file = typeof source === "string" ? createSourceFile(source, "<anonymous file>") : source;
|
|
7
12
|
const doc = parseDocument(file.text, {
|
|
@@ -13,12 +18,7 @@ export function parseYaml(source) {
|
|
|
13
18
|
for (const warning of doc.warnings) {
|
|
14
19
|
diagnostics.add(convertYamlErrorToDiagnostic("warning", warning, file));
|
|
15
20
|
}
|
|
16
|
-
return diagnostics.wrap({
|
|
17
|
-
kind: "yaml-script",
|
|
18
|
-
file,
|
|
19
|
-
value: doc.toJSON(),
|
|
20
|
-
doc,
|
|
21
|
-
});
|
|
21
|
+
return diagnostics.wrap({ file, doc });
|
|
22
22
|
}
|
|
23
23
|
function convertYamlErrorToDiagnostic(severity, error, file) {
|
|
24
24
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/yaml/parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,MAAM,UAAU,SAAS,CAAC,MAA2B;IACnD,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,MAAM,IAAI,GAAG,OAAO,M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* A reference to a type assignable to `T`, created with `typeref`.
|
|
235
|
+
* @template T The constraint on the referenced type.
|
|
236
|
+
*/
|
|
237
|
+
scalar TypeRef<T = unknown>;
|
package/lib/std/types.tsp
CHANGED
|
@@ -79,3 +79,18 @@ model OmitDefaults<Source> {
|
|
|
79
79
|
model DefaultKeyVisibility<Source, Visibility extends valueof Reflection.EnumMember> {
|
|
80
80
|
...Source;
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates an opaque value referencing an existing type.
|
|
85
|
+
* The reference preserves the type's identity and can be stored in object and array values.
|
|
86
|
+
* The result has type `TypeRef<target>`; JavaScript implementations receive a `TypeRefValue`.
|
|
87
|
+
* Requires the `typeref` compiler feature.
|
|
88
|
+
* @param target The type to reference.
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsp
|
|
91
|
+
* model Item { id: string; }
|
|
92
|
+
* const entry = #{ name: "item", type: typeref(Item) };
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
#suppress "experimental-feature"
|
|
96
|
+
extern fn typeref(target: unknown): valueof TypeRef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/compiler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0-dev.0",
|
|
4
4
|
"description": "TypeSpec compiler and standard library",
|
|
5
5
|
"author": "Microsoft Corporation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -88,39 +88,38 @@
|
|
|
88
88
|
],
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@babel/code-frame": "^8.0.0",
|
|
91
|
-
"@inquirer/checkbox": "^5.2.
|
|
92
|
-
"@inquirer/confirm": "^6.3.
|
|
93
|
-
"@inquirer/input": "^5.1.
|
|
94
|
-
"@inquirer/select": "^5.2.
|
|
91
|
+
"@inquirer/checkbox": "^5.2.8",
|
|
92
|
+
"@inquirer/confirm": "^6.3.5",
|
|
93
|
+
"@inquirer/input": "^5.1.9",
|
|
94
|
+
"@inquirer/select": "^5.2.8",
|
|
95
95
|
"ajv": "^8.20.0",
|
|
96
96
|
"change-case": "^5.4.4",
|
|
97
97
|
"env-paths": "^4.0.0",
|
|
98
98
|
"is-unicode-supported": "^2.1.0",
|
|
99
99
|
"mustache": "^4.2.0",
|
|
100
100
|
"picocolors": "^1.1.1",
|
|
101
|
-
"prettier": "^3.9.
|
|
101
|
+
"prettier": "^3.9.10",
|
|
102
102
|
"semver": "^7.8.5",
|
|
103
103
|
"tar": "^7.5.22",
|
|
104
|
-
"temporal-polyfill": "^1.0.
|
|
105
|
-
"vscode-languageserver": "^
|
|
106
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
104
|
+
"temporal-polyfill": "^1.0.6",
|
|
105
|
+
"vscode-languageserver": "^11.0.0",
|
|
106
|
+
"vscode-languageserver-textdocument": "^1.0.16",
|
|
107
107
|
"yaml": "^2.9.0",
|
|
108
108
|
"yargs": "^18.2.0"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@types/babel__code-frame": "^7.27.0",
|
|
112
111
|
"@types/mustache": "^4.2.6",
|
|
113
|
-
"@types/node": "^26.6.
|
|
112
|
+
"@types/node": "^26.6.5",
|
|
114
113
|
"@types/semver": "^7.8.0",
|
|
115
114
|
"@types/yargs": "^17.0.35",
|
|
116
|
-
"@typespec/internal-build-utils": "^0.
|
|
117
|
-
"@vitest/coverage-v8": "^5.0.
|
|
118
|
-
"@vitest/ui": "^5.0.
|
|
115
|
+
"@typespec/internal-build-utils": "^0.88.0 || >= 0.89.0-dev.0",
|
|
116
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
117
|
+
"@vitest/ui": "^5.0.5",
|
|
119
118
|
"pathe": "^2.0.3",
|
|
120
119
|
"rimraf": "^6.1.3",
|
|
121
120
|
"tmlanguage-generator": "^0.6.8 || >= 0.6.9-dev.8",
|
|
122
121
|
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
123
|
-
"vitest": "^5.0.
|
|
122
|
+
"vitest": "^5.0.5",
|
|
124
123
|
"vscode-oniguruma": "^2.0.1",
|
|
125
124
|
"vscode-textmate": "^9.3.2"
|
|
126
125
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"empty": {
|
|
3
3
|
"title": "Empty project",
|
|
4
4
|
"description": "Create an empty project with just the bare minimum to get started.",
|
|
5
|
-
"compilerVersion": "1.
|
|
5
|
+
"compilerVersion": "1.18.0",
|
|
6
6
|
"libraries": [],
|
|
7
7
|
"config": {
|
|
8
8
|
"kind": "project"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"rest": {
|
|
12
12
|
"title": "Generic REST API",
|
|
13
13
|
"description": "Create a project representing a generic REST API service.",
|
|
14
|
-
"compilerVersion": "1.
|
|
14
|
+
"compilerVersion": "1.18.0",
|
|
15
15
|
"libraries": [
|
|
16
16
|
"@typespec/http",
|
|
17
17
|
"@typespec/rest",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"target": "library",
|
|
83
83
|
"title": "TypeSpec library",
|
|
84
84
|
"description": "Build your own TypeSpec library with custom types, decorators or linters.",
|
|
85
|
-
"compilerVersion": "1.
|
|
85
|
+
"compilerVersion": "1.18.0",
|
|
86
86
|
"libraries": [],
|
|
87
87
|
"files": [
|
|
88
88
|
{
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"target": "library",
|
|
156
156
|
"title": "TypeSpec emitter",
|
|
157
157
|
"description": "Create a new package that emits artifacts from TypeSpec.",
|
|
158
|
-
"compilerVersion": "1.
|
|
158
|
+
"compilerVersion": "1.18.0",
|
|
159
159
|
"libraries": [],
|
|
160
160
|
"files": [
|
|
161
161
|
{
|