Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./models": "./src/models/index.ts",
"./api": "./src/api/index.ts",
"./blob": "./src/blob/index.ts",
"./blob/api": "./src/blob/api/index.ts"
Expand Down Expand Up @@ -90,6 +91,24 @@
"default": "./dist/commonjs/index.js"
}
},
"./models": {
"browser": {
"types": "./dist/browser/models/index.d.ts",
"default": "./dist/browser/models/index.js"
},
"react-native": {
"types": "./dist/react-native/models/index.d.ts",
"default": "./dist/react-native/models/index.js"
},
"import": {
"types": "./dist/esm/models/index.d.ts",
"default": "./dist/esm/models/index.js"
},
"require": {
"types": "./dist/commonjs/models/index.d.ts",
"default": "./dist/commonjs/models/index.js"
}
},
"./api": {
"browser": {
"types": "./dist/browser/api/index.d.ts",
Expand Down
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Don't change the generated code manually! You should run npm run smoke-test under packages/typespec-test to update the smoke tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed in 107b86c - reverted all manual changes and regenerated using npm run smoke-test in packages/typespec-test. The blob/index.ts is now properly generated by the emitter.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { BlobClient } from "./blobClient.js";
export { BlobContext, BlobClientOptionalParams, DownloadOptionalParams as BlobClientDownloadOptionalParams } from "./api/index.js";
1 change: 1 addition & 0 deletions packages/typespec-test/test/nestedClient/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ options:
"@azure-tools/typespec-ts":
generate-metadata: true
azure-sdk-for-js: false
hierarchy-client: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Don't change this file!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed in 107b86c - the tspconfig.yaml has been reverted to its original state (no hierarchy-client line).

emitter-output-dir: "{project-root}/generated/typespec-ts"
package-details:
name: "@msinternal/nestedclient"
10 changes: 8 additions & 2 deletions packages/typespec-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ import { emitLoggerFile } from "./modular/emitLoggerFile.js";
import { emitTypes } from "./modular/emitModels.js";
import { existsSync } from "fs";
import { getModuleExports } from "./modular/buildProjectFiles.js";
import { getClientHierarchyMap, getRLCClients } from "./utils/clientUtils.js";
import {
getClientHierarchyMap,
getRLCClients,
getModularClientOptions
} from "./utils/clientUtils.js";
import { join } from "path";
import { loadStaticHelpers } from "./framework/load-static-helpers.js";
import { packageUsesXmlSerialization } from "./modular/serialization/buildXmlSerializerFunction.js";
Expand Down Expand Up @@ -353,7 +357,9 @@ export async function $onEmit(context: EmitContext) {
exportIndex: true,
interfaceOnly: true
});
if (isMultiClients) {
const { subfolder } = getModularClientOptions(subClient);
// Generate index file for multi-client scenarios or nested clients (non-empty subfolder)
if (isMultiClients || subfolder) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot For multi-client scenarios, is it possible for subfolder to be an empty string? If not, can this conditional be simplified to just if(subfolder)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're correct! In multi-client scenarios, the subfolder will always be non-empty since each top-level client gets its own subfolder. Simplified the condition to just if (subfolder) and removed the unused isMultiClients variable in 107b86c.

buildSubClientIndexFile(dpgContext, subClient, modularEmitterOptions);
}
buildRootIndex(
Expand Down
Loading