Skip to content

Commit

Permalink
Merge branch 'main' into expose-necessary-api-for-httppart
Browse files Browse the repository at this point in the history
  • Loading branch information
msyyc authored Jul 2, 2024
2 parents 4ffd83e + c824745 commit 18a508c
Show file tree
Hide file tree
Showing 244 changed files with 7,073 additions and 4,278 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/allow-override-verb-2024-6-1-19-54-42.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: feature
packages:
- "@typespec/http"
---

Allow overriding base operation verb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/compiler"
---

Deprecate getAssetEmitter and recommend calling `createAssetEmitter` directly
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/json-schema"
- "@typespec/openapi3"
---

Fix issue that could result in invalid document generation when running `tsp compile` from another directory
25 changes: 25 additions & 0 deletions .chronus/changes/upgrade-deps-july-2024-2024-6-1-20-41-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: dependencies
packages:
- "@typespec/bundler"
- "@typespec/compiler"
- "@typespec/eslint-plugin"
- "@typespec/html-program-viewer"
- "@typespec/http"
- "@typespec/internal-build-utils"
- "@typespec/json-schema"
- "@typespec/library-linter"
- "@typespec/openapi"
- "@typespec/openapi3"
- "@typespec/playground"
- "@typespec/prettier-plugin-typespec"
- "@typespec/protobuf"
- "@typespec/rest"
- tmlanguage-generator
- typespec-vscode
- "@typespec/versioning"
- "@typespec/xml"
---

Dependency updates July 2024
2 changes: 1 addition & 1 deletion docs/extending-typespec/create-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Decorators can be implemented in JavaScript by prefixing the function name with
// model.ts
import type { DecoratorContext, Type } from "@typespec/compiler";

export function $logType(context: DecoratorContext, target: Type, name: valueof string) {
export function $logType(context: DecoratorContext, target: Type, name: string) {
console.log(name + ": " + targetType.kind);
}
```
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@
"@octokit/plugin-rest-endpoint-methods": "^13.2.1",
"@pnpm/find-workspace-packages": "^6.0.9",
"@types/node": "~18.11.19",
"@typescript-eslint/parser": "^7.9.0",
"@typescript-eslint/utils": "^7.9.0",
"@typescript-eslint/parser": "^7.15.0",
"@typescript-eslint/utils": "^7.15.0",
"@vitest/coverage-v8": "^1.6.0",
"c8": "^9.1.0",
"cspell": "^8.8.1",
"c8": "^10.1.2",
"cspell": "^8.9.1",
"eslint": "^8.57.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-unicorn": "^53.0.0",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-plugin-vitest": "^0.5.4",
"picocolors": "~1.0.1",
"prettier": "~3.2.5",
"prettier-plugin-organize-imports": "~3.2.4",
"prettier": "~3.3.2",
"prettier-plugin-organize-imports": "~4.0.0",
"rimraf": "~5.0.7",
"syncpack": "^12.3.2",
"tsx": "^4.10.5",
"typescript": "~5.4.5",
"typescript-eslint": "^7.9.0",
"syncpack": "^12.3.3",
"tsx": "^4.16.0",
"typescript": "~5.5.3",
"typescript-eslint": "^7.15.0",
"vitest": "^1.6.0",
"yaml": "~2.4.2"
"yaml": "~2.4.5"
},
"syncpack": {
"dependencyTypes": [
Expand Down
4 changes: 2 additions & 2 deletions packages/best-practices/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"@typespec/compiler": "workspace:~",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"rimraf": "~5.0.7",
"typescript": "~5.4.5",
"typescript": "~5.5.3",
"vitest": "^1.6.0"
}
}
8 changes: 4 additions & 4 deletions packages/bundle-uploader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"!dist/test/**"
],
"dependencies": {
"@azure/identity": "~4.2.1",
"@azure/storage-blob": "~12.18.0",
"@azure/identity": "~4.3.0",
"@azure/storage-blob": "~12.23.0",
"@pnpm/find-workspace-packages": "^6.0.9",
"@typespec/bundler": "workspace:~",
"json5": "^2.2.3",
Expand All @@ -50,9 +50,9 @@
"@types/semver": "^7.5.8",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"rimraf": "~5.0.7",
"typescript": "~5.4.5",
"typescript": "~5.5.3",
"vitest": "^1.6.0"
}
}
10 changes: 5 additions & 5 deletions packages/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@
],
"dependencies": {
"@rollup/plugin-alias": "~5.1.0",
"@rollup/plugin-commonjs": "~25.0.7",
"@rollup/plugin-commonjs": "~26.0.1",
"@rollup/plugin-json": "~6.1.0",
"@rollup/plugin-multi-entry": "~6.0.1",
"@rollup/plugin-node-resolve": "~15.2.3",
"@rollup/plugin-virtual": "~3.0.2",
"@typespec/compiler": "workspace:~",
"picocolors": "~1.0.1",
"rollup": "~4.17.2",
"rollup": "~4.18.0",
"yargs": "~17.7.2"
},
"devDependencies": {
"@types/node": "~18.11.19",
"@types/yargs": "~17.0.32",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"rimraf": "~5.0.7",
"typescript": "~5.4.5",
"vite": "^5.2.11",
"typescript": "~5.5.3",
"vite": "^5.3.2",
"vitest": "^1.6.0"
}
}
2 changes: 1 addition & 1 deletion packages/bundler/src/vite/vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function typespecBundlePlugin(options: TypeSpecBundlePluginOptions): Plug
await watchBundleLibrary(config.root, library, (bundle) => {
bundles[library] = bundle;
definitions[library] = bundle.definition;
server.hot.send({ type: "full-reload" });
server.ws.send({ type: "full-reload" });
});
}

Expand Down
14 changes: 7 additions & 7 deletions packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@babel/code-frame": "~7.24.2",
"ajv": "~8.13.0",
"@babel/code-frame": "~7.24.7",
"ajv": "~8.16.0",
"change-case": "~5.4.4",
"globby": "~14.0.1",
"globby": "~14.0.2",
"mustache": "~4.2.0",
"picocolors": "~1.0.1",
"prettier": "~3.2.5",
"prettier": "~3.3.2",
"prompts": "~2.4.2",
"semver": "^7.6.2",
"vscode-languageserver": "~9.0.1",
"vscode-languageserver-textdocument": "~1.0.11",
"yaml": "~2.4.2",
"yaml": "~2.4.5",
"yargs": "~17.7.2"
},
"devDependencies": {
Expand All @@ -106,13 +106,13 @@
"@typespec/internal-build-utils": "workspace:~",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"grammarkdown": "~3.3.2",
"rimraf": "~5.0.7",
"source-map-support": "~0.5.21",
"tmlanguage-generator": "workspace:~",
"ts-node": "~10.9.2",
"typescript": "~5.4.5",
"typescript": "~5.5.3",
"vitest": "^1.6.0",
"vscode-oniguruma": "~2.0.1",
"vscode-textmate": "~9.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler/src/core/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export enum Token {

///////////////////////////////////////////////////////////////
// Trivia
/**@internal */ __StartTrivia,
/** @internal */ __StartTrivia,

SingleLineComment = __StartTrivia,
MultiLineComment,
Expand Down Expand Up @@ -383,7 +383,7 @@ export function isTrivia(token: Token) {
return token >= Token.__StartTrivia && token < Token.__EndTrivia;
}

export function isComment(token: Token) {
export function isComment(token: Token): boolean {
return token === Token.SingleLineComment || token === Token.MultiLineComment;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/compiler/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,8 @@ export interface EmitContext<TOptions extends object = Record<string, never>> {
/**
* Get an asset emitter to write emitted output to disk using a TypeEmitter
*
* @deprecated call {@link createAssetEmitter} directly instead.
*
* @param TypeEmitterClass The TypeEmitter to construct your emitted output
*/
getAssetEmitter<T>(TypeEmitterClass: typeof TypeEmitter<T, TOptions>): AssetEmitter<T, TOptions>;
Expand Down
12 changes: 6 additions & 6 deletions packages/eslint-plugin-typespec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
},
"devDependencies": {
"@types/node": "~18.11.19",
"@typescript-eslint/parser": "^7.9.0",
"@typescript-eslint/rule-tester": "^7.9.0",
"@typescript-eslint/types": "^7.9.0",
"@typescript-eslint/parser": "^7.15.0",
"@typescript-eslint/rule-tester": "^7.15.0",
"@typescript-eslint/types": "^7.15.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"eslint": "^8.57.0",
"rimraf": "~5.0.7",
"typescript": "~5.4.5",
"typescript": "~5.5.3",
"vitest": "^1.6.0"
},
"dependencies": {
"@typescript-eslint/utils": "^7.9.0"
"@typescript-eslint/utils": "^7.15.0"
}
}
10 changes: 5 additions & 5 deletions packages/html-program-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@
},
"dependencies": {
"@emotion/react": "^11.11.4",
"prettier": "~3.2.5",
"prettier": "~3.3.2",
"react": "~18.3.1",
"react-dom": "~18.3.1",
"react-is": "~18.3.1"
},
"devDependencies": {
"@babel/core": "^7.24.5",
"@babel/core": "^7.24.7",
"@types/node": "~18.11.19",
"@types/react": "~18.3.2",
"@types/react": "~18.3.3",
"@types/react-dom": "~18.3.0",
"@typespec/compiler": "workspace:~",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"rimraf": "~5.0.7",
"typescript": "~5.4.5",
"typescript": "~5.5.3",
"vitest": "^1.6.0"
}
}
11 changes: 3 additions & 8 deletions packages/http-client-csharp/emitter/src/lib/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
} from "../type/input-type.js";
import { LiteralTypeContext } from "../type/literal-type-context.js";
import { Usage } from "../type/usage.js";
import { getFullNamespaceString } from "./utils.js";

export function fromSdkType(
sdkType: SdkType,
Expand Down Expand Up @@ -87,7 +86,7 @@ export function fromSdkModelType(
inputModelType = {
Kind: "model",
Name: modelTypeName,
Namespace: getFullNamespaceString((modelType.__raw as Model).namespace), // TODO -- use the value from TCGC when this is included in TCGC
CrossLanguageDefinitionId: modelType.crossLanguageDefinitionId,
Access: getAccessOverride(
context,
modelType.__raw as Model
Expand All @@ -113,7 +112,6 @@ export function fromSdkModelType(
property,
{
ModelName: modelTypeName,
Namespace: inputModelType.Namespace,
} as LiteralTypeContext,
[]
);
Expand Down Expand Up @@ -203,12 +201,9 @@ export function fromSdkEnumType(
const newInputEnumType: InputEnumType = {
Kind: "enum",
Name: enumName,
CrossLanguageDefinitionId: enumType.crossLanguageDefinitionId,
ValueType: fromSdkBuiltInType(enumType.valueType),
Values: enumType.values.map((v) => fromSdkEnumValueType(v)),
Namespace: getFullNamespaceString(
// Enum and Union have optional namespace property
(enumType.__raw! as any).namespace
),
Accessibility: getAccessOverride(
context,
enumType.__raw as any
Expand Down Expand Up @@ -312,7 +307,7 @@ function fromSdkConstantType(
Name: enumName,
ValueType: fromSdkBuiltInType(constantType.valueType),
Values: allowValues,
Namespace: literalTypeContext.Namespace,
CrossLanguageDefinitionId: "",
Accessibility: undefined,
Deprecated: undefined,
Description: `The ${enumName}`, // TODO -- what should we put here?
Expand Down
24 changes: 1 addition & 23 deletions packages/http-client-csharp/emitter/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import {
getLibraryName,
getSdkModel,
} from "@azure-tools/typespec-client-generator-core";
import {
Enum,
EnumMember,
Model,
ModelProperty,
Namespace,
Operation,
Scalar,
} from "@typespec/compiler";
import { Enum, EnumMember, Model, ModelProperty, Operation, Scalar } from "@typespec/compiler";
import { InputConstant } from "../type/input-constant.js";
import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
import { InputParameter } from "../type/input-parameter.js";
Expand Down Expand Up @@ -47,20 +39,6 @@ export function getTypeName(
return name;
}

export function getFullNamespaceString(namespace: Namespace | undefined): string {
if (!namespace || !namespace.name) {
return "";
}

let namespaceString: string = namespace.name;
let current: Namespace | undefined = namespace.namespace;
while (current && current.name) {
namespaceString = `${current.name}.${namespaceString}`;
current = current.namespace;
}
return namespaceString;
}

export function createContentTypeOrAcceptParameter(
mediaTypes: string[],
name: string,
Expand Down
Loading

0 comments on commit 18a508c

Please sign in to comment.