Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to @azure/core-util dev dependency #2634

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/typespec-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"type": "module",
"dependencies": {
"@azure-tools/typespec-ts": "workspace:^0.30.0",
"@azure-tools/typespec-ts": "workspace:^0.30.1",
"@typespec/openapi": ">=0.57.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.43.0 <1.0.0",
"@typespec/openapi3": ">=0.57.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager":">=0.43.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.43.0 <1.0.0",
"@typespec/compiler": ">=0.57.0 <1.0.0",
"@typespec/http": ">=0.57.0 <1.0.0",
"@typespec/rest": ">=0.57.0 <1.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/typespec-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.30.1 (2024-06-29)

- [Bugfix] Remove runtime references to @azure/core-util devDependency. Please refer to [#2634](https://github.com/Azure/autorest.typescript/pull/2634/files).

## 0.30.0 (2024-06-28)

- [Feature] Support non-exhaustive enum. Please refer to [#2584](https://github.com/Azure/autorest.typescript/pull/2584).
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-ts",
"version": "0.30.0",
"version": "0.30.1",
"description": "An experimental TypeSpec emitter for TypeScript RLC",
"main": "dist/src/index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ReservedModelNames
} from "@azure-tools/rlc-common";
import { SdkClient } from "@azure-tools/typespec-client-generator-core";
import { isDefined } from "@azure/core-util";
import * as path from "path";
import { toCamelCase, toPascalCase } from "../../utils/casingUtils.js";
import { SdkContext } from "../../utils/interfaces.js";
Expand All @@ -14,6 +13,7 @@ import {
Operation,
OperationGroup
} from "../modularCodeModel.js";
import { isDefined } from "../serialization/util.js";

export function getClientName(client: Client) {
return client.name.replace(/Client$/, "");
Expand Down
8 changes: 6 additions & 2 deletions packages/typespec-ts/src/modular/serialization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
SdkUnionType,
UsageFlags as TCGCUsageFlags
} from "@azure-tools/typespec-client-generator-core";
import { isDefined } from "@azure/core-util";
import { UsageFlags } from "@typespec/compiler";
import * as path from "path";
import { FunctionDeclarationStructure, OptionalKind } from "ts-morph";
Expand All @@ -26,7 +25,12 @@ import {
serializeType,
serializeUnionInline
} from "./serializers.js";
import { getUsage, SerializeFunctionType, SerializerMap } from "./util.js";
import {
getUsage,
isDefined,
SerializeFunctionType,
SerializerMap
} from "./util.js";

export function buildSerializers(
dpgContext: SdkContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ import {
Type
} from "../modularCodeModel.js";

import { isDefined } from "@azure/core-util";
import { UsageFlags } from "@typespec/compiler";
import _ from "lodash";
import { Parameter } from "../modularCodeModel.js";
import { serializeType } from "../serialization/serializers.js";
import { SerializerMap } from "../serialization/util.js";
import { SerializerMap, isDefined } from "../serialization/util.js";

export function getRLCResponseType(rlcResponse?: OperationResponse) {
if (!rlcResponse?.responses) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
SdkType,
SdkUnionType
} from "@azure-tools/typespec-client-generator-core";
import { isDefined } from "@azure/core-util";
import { getDiscriminator, UsageFlags } from "@typespec/compiler";
import _ from "lodash";
import * as Reify from "../../reify/index.js";
import {
getEncodingFormat,
getParameterTypePropertyName,
getReturnTypePropertyName,
isDefined,
SerializerMap,
SerializerOutput
} from "./util.js";
Expand Down
4 changes: 4 additions & 0 deletions packages/typespec-ts/src/modular/serialization/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,7 @@ function toDpgUsageFlags(usage: TCGCUsageFlags): UsageFlags {
(usage & TCGCUsageFlags.Output ? UsageFlags.Output : 0)
);
}

export function isDefined<T>(thing: T | undefined | null): thing is T {
return typeof thing !== "undefined" && thing !== null;
}
Loading