diff --git a/.chronus/changes/fix-examples-encoded-name-2024-8-26-12-52-20.md b/.chronus/changes/fix-examples-encoded-name-2024-8-26-12-52-20.md new file mode 100644 index 0000000000..fb1dd64ee3 --- /dev/null +++ b/.chronus/changes/fix-examples-encoded-name-2024-8-26-12-52-20.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/compiler" +--- + +Json serialization of example respect `@encodedName` \ No newline at end of file diff --git a/.chronus/changes/fix-playground-blank-screen-and-formatter-2024-8-26-12-35-15.md b/.chronus/changes/fix-playground-blank-screen-and-formatter-2024-8-26-12-35-15.md new file mode 100644 index 0000000000..f1073d0f71 --- /dev/null +++ b/.chronus/changes/fix-playground-blank-screen-and-formatter-2024-8-26-12-35-15.md @@ -0,0 +1,6 @@ +--- +changeKind: internal +packages: + - "@typespec/playground" +--- + diff --git a/.gitignore b/.gitignore index cf03065ba0..7975cde491 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ coverage.xml .hypothesis/ .pytest_cache/ test-results.xml +test-results/ # Translations *.mo diff --git a/packages/compiler/src/lib/examples.ts b/packages/compiler/src/lib/examples.ts index 7c0c31076a..58810d9b9a 100644 --- a/packages/compiler/src/lib/examples.ts +++ b/packages/compiler/src/lib/examples.ts @@ -10,7 +10,7 @@ import { type Type, type Value, } from "../core/types.js"; -import { getEncode, type EncodeData } from "./decorators.js"; +import { getEncode, resolveEncodedName, type EncodeData } from "./decorators.js"; /** * Serialize the given TypeSpec value as a JSON object using the given type and its encoding annotations. @@ -99,7 +99,11 @@ function serializeObjectValueAsJson( for (const propValue of value.properties.values()) { const definition = getPropertyOfType(type, propValue.name); if (definition) { - obj[propValue.name] = serializeValueAsJson(program, propValue.value, definition); + const name = + definition.kind === "ModelProperty" + ? resolveEncodedName(program, definition, "application/json") + : propValue.name; + obj[name] = serializeValueAsJson(program, propValue.value, definition); } } return obj; diff --git a/packages/compiler/test/decorators/examples.test.ts b/packages/compiler/test/decorators/examples.test.ts index dd2c0daa3d..4187243381 100644 --- a/packages/compiler/test/decorators/examples.test.ts +++ b/packages/compiler/test/decorators/examples.test.ts @@ -255,6 +255,20 @@ describe("json serialization of examples", () => { return serializeValueAsJson(program, examples[0].value, target); } + it("respect json encodedName", async () => { + const result = await getJsonValueOfExample(` + @example(#{ + expireIn: 1 + }) + @test model test { + @encodedName("application/json", "exp") + expireIn: int32 + } + `); + + expect(result).toEqual({ exp: 1 }); + }); + describe("scalar encoding", () => { const allCases: [ string, diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Statements/AttributeStatement.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Statements/AttributeStatement.cs index 802cac0010..8e02ad3c3f 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Statements/AttributeStatement.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Statements/AttributeStatement.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Collections.Generic; -using System.Linq; using Microsoft.Generator.CSharp.Expressions; using Microsoft.Generator.CSharp.Primitives; @@ -12,30 +11,56 @@ public sealed class AttributeStatement : MethodBodyStatement { public CSharpType Type { get; } public IReadOnlyList Arguments { get; } + public IReadOnlyList> PositionalArguments { get; } - public AttributeStatement(CSharpType type, IReadOnlyList arguments) + public AttributeStatement(CSharpType type, IReadOnlyList arguments, IReadOnlyList> positionalArguments) { Type = type; Arguments = arguments; + PositionalArguments = positionalArguments; } - public AttributeStatement(CSharpType type, params ValueExpression[] arguments) : this(type, (IReadOnlyList)arguments) { } + public AttributeStatement(CSharpType type, IReadOnlyList arguments) : this(type, arguments, []) { } + + public AttributeStatement(CSharpType type, IReadOnlyList> positionalArguments) : this(type, [], positionalArguments) { } + + public AttributeStatement(CSharpType type, params ValueExpression[] arguments) : this(type, arguments, []) { } internal override void Write(CodeWriter writer) { - if (Arguments.Any()) + writer.Append($"[{Type}"); + var hasArguments = Arguments.Count > 0 || PositionalArguments.Count > 0; + if (hasArguments) + { + writer.AppendRaw("("); + } + for (int i = 0; i < Arguments.Count; i++) + { + Arguments[i].Write(writer); + if (i != Arguments.Count - 1) + { + writer.AppendRaw(", "); + } + } + if (Arguments.Count > 0 && PositionalArguments.Count > 0) + { + writer.AppendRaw(", "); + } + for (int i = 0; i < PositionalArguments.Count; i++) { - writer.Append($"[{Type}("); - foreach (var argument in Arguments) + var (key, value) = PositionalArguments[i]; + writer.Append($"{key} = "); + value.Write(writer); + if (i != PositionalArguments.Count - 1) { - argument.Write(writer); + writer.AppendRaw(", "); } - writer.WriteRawLine(")]"); } - else + if (hasArguments) { - writer.WriteLine($"[{Type}]"); + writer.AppendRaw(")"); } + writer.WriteRawLine("]"); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ParameterProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ParameterProviderTests.cs index 9db2b88bc7..ed3100c239 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ParameterProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ParameterProviderTests.cs @@ -78,8 +78,8 @@ private static IEnumerable NotEqualsTestCases() new ParameterProvider("name1", $"Description", new CSharpType(typeof(string))), false); yield return new TestCaseData( - new ParameterProvider("name", $"Description", new CSharpType(typeof(string)), attributes: [new(new CSharpType(typeof(int)), [])]), - new ParameterProvider("name1", $"Description", new CSharpType(typeof(string)), attributes: [new(new CSharpType(typeof(string)), [])]), + new ParameterProvider("name", $"Description", new CSharpType(typeof(string)), attributes: [new(new CSharpType(typeof(int)))]), + new ParameterProvider("name1", $"Description", new CSharpType(typeof(string)), attributes: [new(new CSharpType(typeof(string)))]), false); } diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ProviderWithAttributesTests.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ProviderWithAttributesTests.cs new file mode 100644 index 0000000000..346c894790 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/ProviderWithAttributesTests.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using Microsoft.Generator.CSharp.Expressions; +using Microsoft.Generator.CSharp.Providers; +using Microsoft.Generator.CSharp.Statements; +using Microsoft.Generator.CSharp.Tests.Common; +using NUnit.Framework; +using static Microsoft.Generator.CSharp.Snippets.Snippet; + +namespace Microsoft.Generator.CSharp.Tests.Providers +{ + public class ProviderWithAttributesTests + { + public ProviderWithAttributesTests() + { + MockHelpers.LoadMockPlugin(); + } + + private class ProviderWithAttribute : TypeProvider + { + public ProviderWithAttribute() + { + } + + protected override string BuildName() => "ProviderWithAttributes"; + + protected override string BuildRelativeFilePath() => "."; + + protected override IReadOnlyList BuildAttributes() + { + return [ + new(typeof(ObsoleteAttribute)), + new(typeof(ObsoleteAttribute), Literal("This is obsolete")), + new(typeof(ObsoleteAttribute), Literal("This is obsolete"), Literal(true)), + new(typeof(ObsoleteAttribute), [new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001"))]), + new(typeof(ObsoleteAttribute), [new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001")), new KeyValuePair("UrlFormat", Literal("my-format"))]), + new(typeof(ObsoleteAttribute), [Literal("This is obsolete"), Literal(true)], + [new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001")), new KeyValuePair("UrlFormat", Literal("my-format"))]), + ]; + } + } + + [Test] + public void ValidateAttributes() + { + var provider = new ProviderWithAttribute(); + var writer = CodeModelPlugin.Instance.GetWriter(provider); + var content = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), content.Content); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/TestData/ProviderWithAttributesTests/ValidateAttributes.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/TestData/ProviderWithAttributesTests/ValidateAttributes.cs new file mode 100644 index 0000000000..cc3de8061f --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Providers/TestData/ProviderWithAttributesTests/ValidateAttributes.cs @@ -0,0 +1,19 @@ +// + +#nullable disable + +using System; + +namespace Sample +{ + /// + [global::System.ObsoleteAttribute] + [global::System.ObsoleteAttribute("This is obsolete")] + [global::System.ObsoleteAttribute("This is obsolete", true)] + [global::System.ObsoleteAttribute(DiagnosticId = "TypeSpecGenerator001")] + [global::System.ObsoleteAttribute(DiagnosticId = "TypeSpecGenerator001", UrlFormat = "my-format")] + [global::System.ObsoleteAttribute("This is obsolete", true, DiagnosticId = "TypeSpecGenerator001", UrlFormat = "my-format")] + public partial class ProviderWithAttributes + { + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/AttributeStatementTests.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/AttributeStatementTests.cs new file mode 100644 index 0000000000..14212c9be3 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/AttributeStatementTests.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using Microsoft.Generator.CSharp.Expressions; +using Microsoft.Generator.CSharp.Statements; +using Microsoft.Generator.CSharp.Tests.Common; +using NUnit.Framework; +using static Microsoft.Generator.CSharp.Snippets.Snippet; + +namespace Microsoft.Generator.CSharp.Tests.Statements +{ + public class AttributeStatementTests + { + public AttributeStatementTests() + { + MockHelpers.LoadMockPlugin(); + } + + [Test] + public void AttributeStatementWithNoArgument() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute)); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + + [Test] + public void AttributeStatementWithOneArgument() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute), Literal("This is obsolete")); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + + [Test] + public void AttributeStatementWithMultipleArguments() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute), Literal("This is obsolete"), Literal(true)); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + + [Test] + public void AttributeStatementWithOneNamedArgument() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute), + [ + new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001")) + ]); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + + [Test] + public void AttributeStatementWithNamedArguments() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute), + [ + new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001")), + new KeyValuePair("UrlFormat", Literal("my-format")) + ]); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + + [Test] + public void AttributeStatementWithArgumentsAndNamedArguments() + { + var attributeStatement = new AttributeStatement(typeof(ObsoleteAttribute), [Literal("This is obsolete"), Literal(true)], + [ + new KeyValuePair("DiagnosticId", Literal("TypeSpecGenerator001")), + new KeyValuePair("UrlFormat", Literal("my-format")) + ]); + + using var writer = new CodeWriter(); + attributeStatement.Write(writer); + + Assert.AreEqual(Helpers.GetExpectedFromFile(), writer.ToString(false)); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithArgumentsAndNamedArguments.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithArgumentsAndNamedArguments.cs new file mode 100644 index 0000000000..c4e2cf3662 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithArgumentsAndNamedArguments.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute("This is obsolete", true, DiagnosticId = "TypeSpecGenerator001", UrlFormat = "my-format")] diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithMultipleArguments.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithMultipleArguments.cs new file mode 100644 index 0000000000..f87ea72482 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithMultipleArguments.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute("This is obsolete", true)] diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNamedArguments.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNamedArguments.cs new file mode 100644 index 0000000000..7b1eae3f22 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNamedArguments.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute(DiagnosticId = "TypeSpecGenerator001", UrlFormat = "my-format")] diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNoArgument.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNoArgument.cs new file mode 100644 index 0000000000..4e6ed56660 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithNoArgument.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute] diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneArgument.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneArgument.cs new file mode 100644 index 0000000000..cb664d2ea3 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneArgument.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute("This is obsolete")] diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneNamedArgument.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneNamedArgument.cs new file mode 100644 index 0000000000..bf9b3e39a4 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/test/Statements/TestData/AttributeStatementTests/AttributeStatementWithOneNamedArgument.cs @@ -0,0 +1 @@ +[global::System.ObsoleteAttribute(DiagnosticId = "TypeSpecGenerator001")] diff --git a/packages/http-client-java/emitter/src/code-model-builder.ts b/packages/http-client-java/emitter/src/code-model-builder.ts index 5375778e08..05a1ec1751 100644 --- a/packages/http-client-java/emitter/src/code-model-builder.ts +++ b/packages/http-client-java/emitter/src/code-model-builder.ts @@ -280,7 +280,7 @@ export class CodeModelBuilder { this.trackSchemaUsage(schema, { usage: [SchemaContext.Input, SchemaContext.Output /*SchemaContext.Public*/], }); - parameter = new Parameter(arg.name, arg.description ?? "", schema, { + parameter = new Parameter(arg.name, arg.doc ?? "", schema, { implementation: ImplementationLocation.Client, origin: "modelerfour:synthesized/host", required: true, @@ -496,8 +496,8 @@ export class CodeModelBuilder { javaNamespace = this.getJavaNamespace(this.namespace + "." + clientSubNamespace); } - const codeModelClient = new CodeModelClient(clientName, client.details ?? "", { - summary: client.description, + const codeModelClient = new CodeModelClient(clientName, client.doc ?? "", { + summary: client.summary, language: { default: { namespace: this.namespace, @@ -759,9 +759,9 @@ export class CodeModelBuilder { const operationExamples = this.getOperationExample(sdkMethod); - const codeModelOperation = new CodeModelOperation(operationName, sdkMethod.details ?? "", { + const codeModelOperation = new CodeModelOperation(operationName, sdkMethod.doc ?? "", { operationId: operationId, - summary: sdkMethod.description, + summary: sdkMethod.summary, extensions: { "x-ms-examples": operationExamples, }, @@ -1166,8 +1166,8 @@ export class CodeModelBuilder { param.correspondingMethodParams[0].onClient; const nullable = param.type.kind === "nullable"; - const parameter = new Parameter(param.name, param.details ?? "", schema, { - summary: param.description, + const parameter = new Parameter(param.name, param.doc ?? "", schema, { + summary: param.summary, implementation: parameterOnClient ? ImplementationLocation.Client : ImplementationLocation.Method, @@ -1365,8 +1365,8 @@ export class CodeModelBuilder { } const parameterName = sdkBody.name; - const parameter = new Parameter(parameterName, sdkBody.description ?? "", schema, { - summary: sdkBody.details, + const parameter = new Parameter(parameterName, sdkBody.doc ?? "", schema, { + summary: sdkBody.summary, implementation: ImplementationLocation.Method, required: !sdkBody.optional, protocol: { @@ -1625,7 +1625,7 @@ export class CodeModelBuilder { language: { default: { name: header.serializedName, - description: header.description ?? header.details, + description: header.summary ?? header.doc, }, }, }), @@ -1831,8 +1831,8 @@ export class CodeModelBuilder { private processStringSchema(type: SdkBuiltInType, name: string): StringSchema { return this.codeModel.schemas.add( - new StringSchema(name, type.details ?? "", { - summary: type.description, + new StringSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } @@ -1840,8 +1840,8 @@ export class CodeModelBuilder { private processByteArraySchema(type: SdkBuiltInType, name: string): ByteArraySchema { const base64Encoded: boolean = type.encode === "base64url"; return this.codeModel.schemas.add( - new ByteArraySchema(name, type.details ?? "", { - summary: type.description, + new ByteArraySchema(name, type.doc ?? "", { + summary: type.summary, format: base64Encoded ? "base64url" : "byte", }), ); @@ -1852,8 +1852,8 @@ export class CodeModelBuilder { name: string, precision: number, ): NumberSchema { - const schema = new NumberSchema(name, type.details ?? "", SchemaType.Integer, precision, { - summary: type.description, + const schema = new NumberSchema(name, type.doc ?? "", SchemaType.Integer, precision, { + summary: type.summary, }); if (type.encode === "string") { (schema as EncodedSchema).encode = type.encode; @@ -1863,8 +1863,8 @@ export class CodeModelBuilder { private processNumberSchema(type: SdkBuiltInType, name: string): NumberSchema { return this.codeModel.schemas.add( - new NumberSchema(name, type.details ?? "", SchemaType.Number, 64, { - summary: type.description, + new NumberSchema(name, type.doc ?? "", SchemaType.Number, 64, { + summary: type.summary, }), ); } @@ -1872,16 +1872,16 @@ export class CodeModelBuilder { private processDecimalSchema(type: SdkBuiltInType, name: string): NumberSchema { // "Infinity" maps to "BigDecimal" in Java return this.codeModel.schemas.add( - new NumberSchema(name, type.details ?? "", SchemaType.Number, Infinity, { - summary: type.description, + new NumberSchema(name, type.doc ?? "", SchemaType.Number, Infinity, { + summary: type.summary, }), ); } private processBooleanSchema(type: SdkBuiltInType, name: string): BooleanSchema { return this.codeModel.schemas.add( - new BooleanSchema(name, type.details ?? "", { - summary: type.description, + new BooleanSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } @@ -1896,16 +1896,16 @@ export class CodeModelBuilder { const elementSchema = this.processSchema(elementType, name); return this.codeModel.schemas.add( - new ArraySchema(name, type.details ?? "", elementSchema, { - summary: type.description, + new ArraySchema(name, type.doc ?? "", elementSchema, { + summary: type.summary, nullableItems: nullableItems, }), ); } private processDictionarySchema(type: SdkDictionaryType, name: string): DictionarySchema { - const dictSchema = new DictionarySchema(name, type.details ?? "", null, { - summary: type.description, + const dictSchema = new DictionarySchema(name, type.doc ?? "", null, { + summary: type.summary, }); // cache this now before we accidentally recurse on this type. @@ -1937,13 +1937,13 @@ export class CodeModelBuilder { const choices: ChoiceValue[] = []; type.values.forEach((it: SdkEnumValueType) => - choices.push(new ChoiceValue(it.name, it.description ?? "", it.value ?? it.name)), + choices.push(new ChoiceValue(it.name, it.doc ?? "", it.value ?? it.name)), ); const schemaType = type.isFixed ? SealedChoiceSchema : ChoiceSchema; - const schema = new schemaType(type.name ?? name, type.details ?? "", { - summary: type.description, + const schema = new schemaType(type.name ?? name, type.doc ?? "", { + summary: type.summary, choiceType: valueType as any, choices: choices, language: { @@ -1963,8 +1963,8 @@ export class CodeModelBuilder { const valueType = this.processSchema(type.valueType, type.valueType.kind); return this.codeModel.schemas.add( - new ConstantSchema(type.name ?? name, type.details ?? "", { - summary: type.description, + new ConstantSchema(type.name ?? name, type.doc ?? "", { + summary: type.summary, valueType: valueType, value: new ConstantValue(type.value), }), @@ -1975,8 +1975,8 @@ export class CodeModelBuilder { const valueType = this.processSchema(type.enumType, type.enumType.name); return this.codeModel.schemas.add( - new ConstantSchema(type.name ?? name, type.details ?? "", { - summary: type.description, + new ConstantSchema(type.name ?? name, type.doc ?? "", { + summary: type.summary, valueType: valueType, value: new ConstantValue(type.value ?? type.name), }), @@ -1985,8 +1985,8 @@ export class CodeModelBuilder { private processUnixTimeSchema(type: SdkDateTimeType, name: string): UnixTimeSchema { return this.codeModel.schemas.add( - new UnixTimeSchema(name, type.details ?? "", { - summary: type.description, + new UnixTimeSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } @@ -1997,8 +1997,8 @@ export class CodeModelBuilder { rfc1123: boolean, ): DateTimeSchema { return this.codeModel.schemas.add( - new DateTimeSchema(name, type.details ?? "", { - summary: type.description, + new DateTimeSchema(name, type.doc ?? "", { + summary: type.summary, format: rfc1123 ? "date-time-rfc1123" : "date-time", }), ); @@ -2006,16 +2006,16 @@ export class CodeModelBuilder { private processDateSchema(type: SdkBuiltInType, name: string): DateSchema { return this.codeModel.schemas.add( - new DateSchema(name, type.details ?? "", { - summary: type.description, + new DateSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } private processTimeSchema(type: SdkBuiltInType, name: string): TimeSchema { return this.codeModel.schemas.add( - new TimeSchema(name, type.details ?? "", { - summary: type.description, + new TimeSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } @@ -2026,8 +2026,8 @@ export class CodeModelBuilder { format: DurationSchema["format"] = "duration-rfc3339", ): DurationSchema { return this.codeModel.schemas.add( - new DurationSchema(name, type.details ?? "", { - summary: type.description, + new DurationSchema(name, type.doc ?? "", { + summary: type.summary, format: format, }), ); @@ -2035,8 +2035,8 @@ export class CodeModelBuilder { private processUrlSchema(type: SdkBuiltInType, name: string): UriSchema { return this.codeModel.schemas.add( - new UriSchema(name, type.details ?? "", { - summary: type.description, + new UriSchema(name, type.doc ?? "", { + summary: type.summary, }), ); } @@ -2044,8 +2044,8 @@ export class CodeModelBuilder { private processObjectSchema(type: SdkModelType, name: string): ObjectSchema { const rawModelType = type.__raw; const namespace = getNamespace(rawModelType); - const objectSchema = new ObjectSchema(name, type.details ?? "", { - summary: type.description, + const objectSchema = new ObjectSchema(name, type.doc ?? "", { + summary: type.summary, language: { default: { namespace: namespace, @@ -2111,7 +2111,7 @@ export class CodeModelBuilder { name: "string", crossLanguageDefinitionId: type.crossLanguageDefinitionId, }, - description: type.description, + description: type.doc, valueType: type.additionalProperties, decorators: [], }; @@ -2196,8 +2196,8 @@ export class CodeModelBuilder { schema = this.processSchema(nonNullType, ""); } - return new Property(prop.name, prop.details ?? "", schema, { - summary: prop.description, + return new Property(prop.name, prop.doc ?? "", schema, { + summary: prop.summary, required: !prop.optional, nullable: nullable, readOnly: this.isReadOnly(prop), @@ -2216,8 +2216,8 @@ export class CodeModelBuilder { this.logWarning( `Convert TypeSpec Union '${getUnionDescription(rawUnionType, this.typeNameOptions)}' to Class '${baseName}'`, ); - const unionSchema = new OrSchema(baseName + "Base", type.details ?? "", { - summary: type.description, + const unionSchema = new OrSchema(baseName + "Base", type.doc ?? "", { + summary: type.summary, }); unionSchema.anyOf = []; type.variantTypes.forEach((it) => { @@ -2226,8 +2226,8 @@ export class CodeModelBuilder { const propertyName = "value"; // these ObjectSchema is not added to codeModel.schemas - const objectSchema = new ObjectSchema(modelName, it.details ?? "", { - summary: it.description, + const objectSchema = new ObjectSchema(modelName, it.doc ?? "", { + summary: it.summary, language: { default: { namespace: namespace, @@ -2240,8 +2240,8 @@ export class CodeModelBuilder { const variantSchema = this.processSchema(it, variantName); objectSchema.addProperty( - new Property(propertyName, type.details ?? "", variantSchema, { - summary: type.description, + new Property(propertyName, type.doc ?? "", variantSchema, { + summary: type.summary, required: true, readOnly: false, }), @@ -2253,8 +2253,8 @@ export class CodeModelBuilder { private processBinarySchema(type: SdkBuiltInType): BinarySchema { return this.codeModel.schemas.add( - new BinarySchema(type.description ?? "", { - summary: type.details, + new BinarySchema(type.doc ?? "", { + summary: type.summary, }), ); } @@ -2352,7 +2352,7 @@ export class CodeModelBuilder { processSchemaFunc, ), { - summary: property.description, + summary: property.summary, }, ); } else { @@ -2589,7 +2589,7 @@ export class CodeModelBuilder { private subscriptionIdParameter(parameter: SdkPathParameter): Parameter { if (!this._subscriptionParameter) { - const description = parameter.description; + const description = parameter.doc; this._subscriptionParameter = new Parameter( "subscriptionId", description ? description : "The ID of the target subscription.", diff --git a/packages/http-client-java/eng/scripts/Build-Packages.ps1 b/packages/http-client-java/eng/scripts/Build-Packages.ps1 index cec857da8c..51398bfee3 100644 --- a/packages/http-client-java/eng/scripts/Build-Packages.ps1 +++ b/packages/http-client-java/eng/scripts/Build-Packages.ps1 @@ -74,6 +74,9 @@ try { Invoke-LoggedCommand "npm run build" -GroupOutput + # linting + Invoke-LoggedCommand "npm run build" -GroupOutput + #pack the emitter $file = Invoke-LoggedCommand "npm pack -q" Copy-Item $file -Destination "$outputPath/packages" diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/PageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/PageClientImpl.java index 1c666e8156..f0381d29d3 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/PageClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/PageClientImpl.java @@ -814,8 +814,6 @@ public PagedIterable listWithCustomPageModel(RequestOptions requestO } /** - * List with Azure.Core.Page<>. - * * Get the next page of items. *

Response Body Schema

* @@ -856,8 +854,6 @@ private Mono> listWithPageNextSinglePageAsync(String n } /** - * List with Azure.Core.Page<>. - * * Get the next page of items. *

Response Body Schema

* @@ -896,8 +892,6 @@ private PagedResponse listWithPageNextSinglePage(String nextLink, Re } /** - * List with extensible enum parameter Azure.Core.Page<>. - * * Get the next page of items. *

Response Body Schema

* @@ -937,8 +931,6 @@ private Mono> listWithParametersNextSinglePageAsync(St } /** - * List with extensible enum parameter Azure.Core.Page<>. - * * Get the next page of items. *

Response Body Schema

* @@ -977,8 +969,6 @@ private PagedResponse listWithParametersNextSinglePage(String nextLi } /** - * List with custom page model. - * * Get the next page of items. *

Response Body Schema

* @@ -1019,8 +1009,6 @@ private Mono> listWithCustomPageModelNextSinglePageAsy } /** - * List with custom page model. - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java index 82ded72c5e..3ae1ac4f69 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/_specs_/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java @@ -394,9 +394,6 @@ public PagedIterable listSecondItem(RequestOptions requestOptions) { } /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - * * Get the next page of items. *

Response Body Schema

* @@ -428,9 +425,6 @@ private Mono> listFirstItemNextSinglePageAsync(String } /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - * * Get the next page of items. *

Response Body Schema

* @@ -460,9 +454,6 @@ private PagedResponse listFirstItemNextSinglePage(String nextLink, R } /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - * * Get the next page of items. *

Response Body Schema

* @@ -494,9 +485,6 @@ private Mono> listSecondItemNextSinglePageAsync(String } /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/NestedProxyResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/NestedProxyResourcesClientImpl.java index 2ec2e1afe4..703c3cc8bf 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/NestedProxyResourcesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/NestedProxyResourcesClientImpl.java @@ -1198,8 +1198,6 @@ public PagedIterable listByTopLevelTrackedResource(Str } /** - * List NestedProxyResource resources by TopLevelTrackedResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1228,8 +1226,6 @@ public PagedIterable listByTopLevelTrackedResource(Str } /** - * List NestedProxyResource resources by TopLevelTrackedResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/SingletonTrackedResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/SingletonTrackedResourcesClientImpl.java index 5bb1785271..f0a6d176b6 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/SingletonTrackedResourcesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/SingletonTrackedResourcesClientImpl.java @@ -707,8 +707,6 @@ public PagedIterable listByResourceGroup(String r } /** - * List SingletonTrackedResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -737,8 +735,6 @@ private Mono> listByResourceGroupNe } /** - * List SingletonTrackedResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/TopLevelTrackedResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/TopLevelTrackedResourcesClientImpl.java index 4ce32888f2..8a6a1ebba4 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/TopLevelTrackedResourcesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/azure/resourcemanager/models/resources/implementation/TopLevelTrackedResourcesClientImpl.java @@ -1369,8 +1369,6 @@ public void actionSync(String resourceGroupName, String topLevelTrackedResourceN } /** - * List TopLevelTrackedResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1399,8 +1397,6 @@ private Mono> listByResourceGroupNex } /** - * List TopLevelTrackedResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1429,8 +1425,6 @@ private Mono> listByResourceGroupNex } /** - * List TopLevelTrackedResource resources by subscription ID - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1459,8 +1453,6 @@ private Mono> listBySubscriptionNext } /** - * List TopLevelTrackedResource resources by subscription ID - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java index 98b06f648e..9742d44abe 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java @@ -1025,8 +1025,6 @@ public PagedIterable listByTopLevelArmResource(Stri } /** - * List ChildExtensionResource resources by TopLevelArmResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1056,8 +1054,6 @@ public PagedIterable listByTopLevelArmResource(Stri } /** - * List ChildExtensionResource resources by TopLevelArmResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java index ec02ebc5f6..1b49860249 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java @@ -1315,8 +1315,6 @@ public void actionWithoutBody(String resourceGroupName, String topLevelArmResour } /** - * List ChildResource resources by TopLevelArmResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1345,8 +1343,6 @@ private Mono> listByTopLevelArmResourceNextSin } /** - * List ChildResource resources by TopLevelArmResource - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java index 0c2de7e03f..9adce53064 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java @@ -181,8 +181,6 @@ public PagedIterable list(Context context) { } /** - * List the operations for the provider - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -209,8 +207,6 @@ private Mono> listNextSinglePageAsync(String nextL } /** - * List the operations for the provider - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java index 7b5b9ce130..075f57e91d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java @@ -1322,8 +1322,6 @@ public ResultInner action(String resourceGroupName, String topLevelArmResourceNa } /** - * List TopLevelArmResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1352,8 +1350,6 @@ private Mono> listByResourceGroupNextSin } /** - * List TopLevelArmResource resources by resource group - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1382,8 +1378,6 @@ private Mono> listByResourceGroupNextSin } /** - * List TopLevelArmResource resources by subscription ID - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1412,8 +1406,6 @@ private Mono> listBySubscriptionNextSing } /** - * List TopLevelArmResource resources by subscription ID - * * Get the next page of items. * * @param nextLink The URL to get the next list of items. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java index ca6bdb1e6d..98d123e960 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java @@ -1033,8 +1033,6 @@ public PagedIterable list(RequestOptions requestOptions) { } /** - * Paging operation - * * Get the next page of items. *

Response Body Schema

* @@ -1068,8 +1066,6 @@ private Mono> listNextSinglePageAsync(String nextLink, } /** - * Paging operation - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/specialheaders/implementation/EtagHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/specialheaders/implementation/EtagHeadersImpl.java index 5cc2907d34..954ca21e81 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/specialheaders/implementation/EtagHeadersImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/specialheaders/implementation/EtagHeadersImpl.java @@ -529,8 +529,6 @@ public PagedIterable listWithEtag(RequestOptions requestOptions) { } /** - * Resource list operation template. - * * Get the next page of items. *

Response Body Schema

* @@ -565,8 +563,6 @@ private Mono> listWithEtagNextSinglePageAsync(String n } /** - * Resource list operation template. - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/versioning/implementation/VersioningOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/versioning/implementation/VersioningOpsImpl.java index f16aa47aeb..9bfa9b70d5 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/versioning/implementation/VersioningOpsImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/cadl/versioning/implementation/VersioningOpsImpl.java @@ -933,8 +933,6 @@ public SyncPoller beginCreateLongRunningWithMode } /** - * Resource list operation template. - * * Get the next page of items. *

Response Body Schema

* @@ -968,8 +966,6 @@ private Mono> listNextSinglePageAsync(String nextLink, } /** - * Resource list operation template. - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/payload/pageable/implementation/PageableClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/payload/pageable/implementation/PageableClientImpl.java index 53cb892b38..5c5acffd02 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/payload/pageable/implementation/PageableClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/com/payload/pageable/implementation/PageableClientImpl.java @@ -349,8 +349,6 @@ public PagedIterable list(RequestOptions requestOptions) { } /** - * List users - * * Get the next page of items. *

Response Body Schema

* @@ -380,8 +378,6 @@ private Mono> listNextSinglePageAsync(String nextLink, } /** - * List users - * * Get the next page of items. *

Response Body Schema

* diff --git a/packages/playground-website/e2e/playwright.config.ts b/packages/playground-website/e2e/playwright.config.ts index 2f2d7f229a..f56696ba66 100644 --- a/packages/playground-website/e2e/playwright.config.ts +++ b/packages/playground-website/e2e/playwright.config.ts @@ -19,11 +19,10 @@ const config: PlaywrightTestConfig = { trace: "retain-on-failure", }, projects: [ - // TODO: investigate - // { - // name: "chromium", - // use: { browserName: "chromium" }, - // }, + { + name: "chromium", + use: { browserName: "chromium" }, + }, { name: "firefox", use: { browserName: "firefox" }, diff --git a/packages/playground/src/services.ts b/packages/playground/src/services.ts index d8d27ba53f..a903ca051b 100644 --- a/packages/playground/src/services.ts +++ b/packages/playground/src/services.ts @@ -45,12 +45,14 @@ function getTypeSpecLanguageConfiguration(): monaco.languages.LanguageConfigurat } export async function registerMonacoLanguage(host: BrowserHost) { - if (monaco.languages.getLanguages().some((x) => x.id === "typespec")) { - return; - } monaco.languages.register({ id: "typespec", extensions: [".tsp"] }); monaco.languages.setLanguageConfiguration("typespec", getTypeSpecLanguageConfiguration()); + if ((window as any).registeredServices) { + return; + } + + (window as any).registeredServices = true; const serverHost: ServerHost = { compilerHost: host, getOpenDocumentByURL(url: string) { diff --git a/packages/playground/vite.config.ts b/packages/playground/vite.config.ts index 5640c049b8..10e96cdcf8 100644 --- a/packages/playground/vite.config.ts +++ b/packages/playground/vite.config.ts @@ -39,7 +39,7 @@ export default defineConfig({ }, rollupOptions: { - external: externals, + external: (id) => externals.some((x) => id.startsWith(x)), }, }, esbuild: {