@azure-tools/typespec-ts 0.55.0-dev.8 → 0.55.0-dev.9

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.
Files changed (173) hide show
  1. package/README.md +1 -77
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +24 -80
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/lib.d.ts +2 -12
  6. package/dist/src/lib.d.ts.map +1 -1
  7. package/dist/src/lib.js +0 -65
  8. package/dist/src/lib.js.map +1 -1
  9. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
  10. package/dist/src/rlc-common/helpers/name-constructors.js +1 -7
  11. package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
  12. package/dist/src/rlc-common/index.d.ts +0 -16
  13. package/dist/src/rlc-common/index.d.ts.map +1 -1
  14. package/dist/src/rlc-common/index.js +0 -16
  15. package/dist/src/rlc-common/index.js.map +1 -1
  16. package/dist/src/rlc-common/interfaces.d.ts +0 -10
  17. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  18. package/dist/src/rlc-common/interfaces.js.map +1 -1
  19. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
  20. package/dist/src/rlc-common/metadata/build-package-file.js +0 -12
  21. package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
  22. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
  23. package/dist/src/rlc-common/metadata/build-readme-file.js +4 -89
  24. package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
  25. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -1
  26. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
  27. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +2 -2
  28. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
  29. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +0 -1
  30. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
  31. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
  32. package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
  33. package/dist/src/rlc-common/test/build-snippets.js +0 -1
  34. package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
  35. package/dist/src/rlc-common/test/template.d.ts +1 -1
  36. package/dist/src/rlc-common/test/template.d.ts.map +1 -1
  37. package/dist/src/rlc-common/test/template.js +0 -4
  38. package/dist/src/rlc-common/test/template.js.map +1 -1
  39. package/dist/src/transform/transform-schemas.js +1 -1
  40. package/dist/src/transform/transform-schemas.js.map +1 -1
  41. package/dist/src/transform/transform.d.ts.map +1 -1
  42. package/dist/src/transform/transform.js +5 -11
  43. package/dist/src/transform/transform.js.map +1 -1
  44. package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
  45. package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
  46. package/dist/src/transform/transfrom-rlc-options.js +19 -39
  47. package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
  48. package/dist/src/utils/client-utils.d.ts +1 -1
  49. package/dist/src/utils/client-utils.d.ts.map +1 -1
  50. package/dist/src/utils/client-utils.js +4 -5
  51. package/dist/src/utils/client-utils.js.map +1 -1
  52. package/dist/src/utils/emit-util.d.ts +0 -1
  53. package/dist/src/utils/emit-util.d.ts.map +1 -1
  54. package/dist/src/utils/emit-util.js +0 -13
  55. package/dist/src/utils/emit-util.js.map +1 -1
  56. package/dist/src/utils/model-utils.d.ts +1 -1
  57. package/dist/src/utils/model-utils.d.ts.map +1 -1
  58. package/dist/src/utils/model-utils.js +4 -11
  59. package/dist/src/utils/model-utils.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +9 -15
  62. package/src/index.ts +27 -105
  63. package/src/lib.ts +1 -77
  64. package/src/rlc-common/helpers/name-constructors.ts +1 -8
  65. package/src/rlc-common/index.ts +0 -16
  66. package/src/rlc-common/interfaces.ts +0 -11
  67. package/src/rlc-common/metadata/build-package-file.ts +0 -13
  68. package/src/rlc-common/metadata/build-readme-file.ts +4 -99
  69. package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +2 -3
  70. package/src/rlc-common/metadata/package-json/package-common.ts +0 -1
  71. package/src/rlc-common/test/build-snippets.ts +0 -1
  72. package/src/rlc-common/test/template.ts +0 -4
  73. package/src/transform/transform-schemas.ts +1 -1
  74. package/src/transform/transform.ts +4 -14
  75. package/src/transform/transfrom-rlc-options.ts +19 -63
  76. package/src/utils/client-utils.ts +4 -5
  77. package/src/utils/emit-util.ts +1 -14
  78. package/src/utils/model-utils.ts +4 -17
  79. package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
  80. package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
  81. package/dist/src/rlc-common/build-client-definitions.js +0 -157
  82. package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
  83. package/dist/src/rlc-common/build-client.d.ts +0 -9
  84. package/dist/src/rlc-common/build-client.d.ts.map +0 -1
  85. package/dist/src/rlc-common/build-client.js +0 -375
  86. package/dist/src/rlc-common/build-client.js.map +0 -1
  87. package/dist/src/rlc-common/build-index-file.d.ts +0 -6
  88. package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
  89. package/dist/src/rlc-common/build-index-file.js +0 -180
  90. package/dist/src/rlc-common/build-index-file.js.map +0 -1
  91. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
  92. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
  93. package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -219
  94. package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
  95. package/dist/src/rlc-common/build-logger.d.ts +0 -6
  96. package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
  97. package/dist/src/rlc-common/build-logger.js +0 -23
  98. package/dist/src/rlc-common/build-logger.js.map +0 -1
  99. package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
  100. package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
  101. package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
  102. package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
  103. package/dist/src/rlc-common/build-object-types.d.ts +0 -29
  104. package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
  105. package/dist/src/rlc-common/build-object-types.js +0 -410
  106. package/dist/src/rlc-common/build-object-types.js.map +0 -1
  107. package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
  108. package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
  109. package/dist/src/rlc-common/build-paginate-helper.js +0 -27
  110. package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
  111. package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
  112. package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
  113. package/dist/src/rlc-common/build-parameter-types.js +0 -338
  114. package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
  115. package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
  116. package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
  117. package/dist/src/rlc-common/build-polling-helper.js +0 -59
  118. package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
  119. package/dist/src/rlc-common/build-response-types.d.ts +0 -6
  120. package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
  121. package/dist/src/rlc-common/build-response-types.js +0 -140
  122. package/dist/src/rlc-common/build-response-types.js.map +0 -1
  123. package/dist/src/rlc-common/build-samples.d.ts +0 -3
  124. package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
  125. package/dist/src/rlc-common/build-samples.js +0 -30
  126. package/dist/src/rlc-common/build-samples.js.map +0 -1
  127. package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
  128. package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
  129. package/dist/src/rlc-common/build-schema-type.js +0 -64
  130. package/dist/src/rlc-common/build-schema-type.js.map +0 -1
  131. package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
  132. package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
  133. package/dist/src/rlc-common/build-serialize-helper.js +0 -36
  134. package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
  135. package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
  136. package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
  137. package/dist/src/rlc-common/build-top-level-index-file.js +0 -44
  138. package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
  139. package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
  140. package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
  141. package/dist/src/rlc-common/helpers/path-utils.js +0 -9
  142. package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
  143. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
  144. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
  145. package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
  146. package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
  147. package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
  148. package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
  149. package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
  150. package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
  151. package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
  152. package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
  153. package/dist/src/rlc-common/transform-sample-groups.js +0 -298
  154. package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
  155. package/src/rlc-common/build-client-definitions.ts +0 -226
  156. package/src/rlc-common/build-client.ts +0 -463
  157. package/src/rlc-common/build-index-file.ts +0 -220
  158. package/src/rlc-common/build-is-unexpected-helper.ts +0 -241
  159. package/src/rlc-common/build-logger.ts +0 -29
  160. package/src/rlc-common/build-method-shortcuts.ts +0 -71
  161. package/src/rlc-common/build-object-types.ts +0 -591
  162. package/src/rlc-common/build-paginate-helper.ts +0 -31
  163. package/src/rlc-common/build-parameter-types.ts +0 -460
  164. package/src/rlc-common/build-polling-helper.ts +0 -80
  165. package/src/rlc-common/build-response-types.ts +0 -170
  166. package/src/rlc-common/build-samples.ts +0 -32
  167. package/src/rlc-common/build-schema-type.ts +0 -79
  168. package/src/rlc-common/build-serialize-helper.ts +0 -49
  169. package/src/rlc-common/build-top-level-index-file.ts +0 -51
  170. package/src/rlc-common/helpers/path-utils.ts +0 -8
  171. package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
  172. package/src/rlc-common/helpers/value-generation-util.ts +0 -234
  173. package/src/rlc-common/transform-sample-groups.ts +0 -383
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-ts",
3
- "version": "0.55.0-dev.8",
4
- "description": "An experimental TypeSpec emitter for TypeScript RLC",
3
+ "version": "0.55.0-dev.9",
4
+ "description": "An experimental TypeSpec emitter for TypeScript",
5
5
  "main": "dist/src/index.js",
6
6
  "type": "module",
7
7
  "exports": {
@@ -90,31 +90,25 @@
90
90
  "clean": "rimraf ./dist ./typespec-output",
91
91
  "build": "tsc -p .",
92
92
  "test": "npm run test-next && npm run unit-test && npm run integration-test-ci",
93
- "test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
93
+ "test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-modular",
94
94
  "lint": "eslint . --ext .ts --max-warnings=0",
95
95
  "lint:fix": "eslint . --fix --ext .ts",
96
96
  "check:tree": "tsx ./test/commands/check-clean-tree.ts",
97
- "test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
98
- "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:azure-rlc integration-test-ci:azure-modular",
99
- "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:azure-modular && npm run integration-test-ci:azure-modular",
100
- "integration-test-ci:azure-rlc": "npm-run-all --silent -p start-test-server:azure-rlc --race generate-and-run:azure-rlc",
97
+ "test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-modular",
98
+ "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:azure-modular",
99
+ "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:azure-modular",
101
100
  "integration-test-ci:azure-modular": "npm-run-all --silent -p start-test-server:azure-modular --race generate-and-run:azure-modular",
102
101
  "start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript.json",
103
- "start-test-server:azure-rlc": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript-rlc-azure.json",
104
102
  "start-test-server:azure-modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-azure.json",
105
103
  "copy:typespec": "rm -rf temp && mkdirp -p temp/specs && mkdirp -p temp/assets && cp -r ./node_modules/@typespec/http-specs/specs/* ./temp/specs && cp -r ./node_modules/@azure-tools/azure-http-specs/specs/* ./temp/specs && cp -r ./test/integration/typespec/* ./temp/specs && cp -r ./node_modules/@typespec/http-specs/assets/* ./temp/assets",
106
- "generate-and-run:azure-rlc": "npm run generate-tsp-only:azure-rlc && npm run integration-test:alone:azure-rlc && npm run stop-test-server -- -p 3000",
107
104
  "generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular && npm run integration-test:alone:azure-modular && npm run stop-test-server -- -p 3002",
108
- "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:azure-modular",
109
- "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-spector.js --tag=azure-rlc",
105
+ "generate-tsp-only": "npm run generate-tsp-only:azure-modular",
110
106
  "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-spector.js --tag=azure-modular",
111
107
  "regen-test-baselines": "npm run generate-tsp-only",
112
- "integration-test:alone": "npm run integration-test:alone:azure-rlc && npm run integration-test:alone:azure-modular",
113
- "integration-test:alone:azure-rlc": "vitest run --project integration-azure-rlc",
108
+ "integration-test:alone": "npm run integration-test:alone:azure-modular",
114
109
  "integration-test:alone:azure-modular": "vitest run --project integration-azure-modular",
115
110
  "stop-test-server": "npx tsp-spector server stop",
116
- "unit-test": "npm-run-all --parallel unit-test:rlc unit-test:modular",
117
- "unit-test:rlc": "vitest run --project unit-rlc",
111
+ "unit-test": "npm run unit-test:modular",
118
112
  "unit-test:modular": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vitest run --project unit-modular",
119
113
  "regen-docs": "npm run build && tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/typespec-ts/reference --skip-js"
120
114
  }
package/src/index.ts CHANGED
@@ -36,28 +36,16 @@ import {
36
36
  RLCOptions,
37
37
  buildApiExtractorConfig,
38
38
  buildChangelogFile,
39
- buildClient,
40
- buildClientDefinitions,
41
39
  buildEsLintConfig,
42
- buildIndexFile,
43
- buildIsUnexpectedHelper,
44
40
  buildLicenseFile,
45
- buildLogger,
46
41
  buildPackageFile,
47
- buildParameterTypes,
48
- buildPollingHelper,
49
- buildPaginateHelper as buildRLCPaginateHelper,
50
42
  buildReadmeFile,
51
43
  buildRecordedClientFile,
52
- buildResponseTypes,
53
44
  buildSampleEnvFile,
54
45
  buildSampleTest,
55
- buildSamples,
56
- buildSerializeHelper,
57
46
  buildSnippets,
58
47
  buildTestBrowserTsConfig,
59
48
  buildTestNodeTsConfig,
60
- buildTopLevelIndex,
61
49
  buildTsConfig,
62
50
  buildTsLintConfig,
63
51
  buildTsSampleConfig,
@@ -74,7 +62,7 @@ import {
74
62
  updatePackageFile,
75
63
  updateReadmeFile,
76
64
  } from "./rlc-common/index.js";
77
- import { emitContentByBuilder, emitModels } from "./utils/emit-util.js";
65
+ import { emitContentByBuilder } from "./utils/emit-util.js";
78
66
  import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
79
67
  import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
80
68
 
@@ -201,11 +189,7 @@ export async function $onEmit(context: EmitContext) {
201
189
  await clearSamplesDevFolder();
202
190
 
203
191
  // 4. Generate sources
204
- if (emitterOptions["is-modular-library"]) {
205
- await generateModularSources();
206
- } else {
207
- await generateRLCSources();
208
- }
192
+ await generateModularSources();
209
193
 
210
194
  // 5. Generate metadata and test files
211
195
  function getTypespecTsVersion(context: EmitContext): string | undefined {
@@ -222,7 +206,6 @@ export async function $onEmit(context: EmitContext) {
222
206
  dpgContext.generationPathDetail = generationPathDetail;
223
207
  dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
224
208
  const options: RLCOptions = transformRLCOptions(emitterOptions, dpgContext);
225
- emitterOptions["is-modular-library"] = options.isModularLibrary;
226
209
  emitterOptions["generate-sample"] = options.generateSample;
227
210
  // clear output folder if needed
228
211
  if (options.clearOutputFolder) {
@@ -290,57 +273,6 @@ export async function $onEmit(context: EmitContext) {
290
273
  }
291
274
  }
292
275
 
293
- async function generateRLCSources() {
294
- for (const rlcModels of rlcCodeModels) {
295
- await emitModels(rlcModels, program);
296
- await emitContentByBuilder(program, buildClientDefinitions, rlcModels);
297
- await emitContentByBuilder(program, buildResponseTypes, rlcModels);
298
- await emitContentByBuilder(program, buildClient, rlcModels);
299
- await emitContentByBuilder(program, buildParameterTypes, rlcModels);
300
- await emitContentByBuilder(program, buildIsUnexpectedHelper, rlcModels);
301
- await emitContentByBuilder(program, buildIndexFile, rlcModels);
302
- await emitContentByBuilder(program, buildLogger, rlcModels);
303
- await emitContentByBuilder(program, buildTopLevelIndex, rlcModels);
304
- await emitContentByBuilder(program, buildRLCPaginateHelper, rlcModels);
305
- await emitContentByBuilder(program, buildPollingHelper, rlcModels);
306
- await emitContentByBuilder(program, buildSerializeHelper, rlcModels);
307
- await emitContentByBuilder(
308
- program,
309
- buildSamples,
310
- rlcModels,
311
- dpgContext.generationPathDetail?.metadataDir,
312
- );
313
- }
314
- // The binder is only resolved in the modular path, so static helper files
315
- // loaded into the outputProject are never written to disk in the RLC path.
316
- // The RLC builders reference the platform-types helper (NodeReadableStream),
317
- // so emit those files here.
318
- await emitRLCStaticHelpers();
319
- }
320
-
321
- async function emitRLCStaticHelpers() {
322
- if (program.compilerOptions.noEmit || program.hasError() || !rlcCodeModels[0]) {
323
- return;
324
- }
325
- const project = useContext("outputProject");
326
- for (const helperFile of project.getSourceFiles()) {
327
- const filePath = helperFile.getFilePath();
328
- // RLC builders (buildParameterTypes / buildSchemaType) only reference
329
- // platform-types (and its browser/react-native variants); emit those
330
- // files directly under src/ (strip the static-helpers/ segment) to match
331
- // the RLC design where all generated output lives in src/.
332
- if (!getBaseFileName(filePath).startsWith("platform-types")) {
333
- continue;
334
- }
335
- const outputPath = filePath.replace(/\/static-helpers\//g, "/");
336
- await emitContentByBuilder(
337
- program,
338
- () => ({ content: helperFile.getFullText(), path: outputPath }),
339
- rlcCodeModels[0],
340
- );
341
- }
342
- }
343
-
344
276
  async function generateModularSources() {
345
277
  const modularSourcesRoot = dpgContext.generationPathDetail?.modularSourcesDir ?? "src";
346
278
  const project = useContext("outputProject");
@@ -441,9 +373,7 @@ export async function $onEmit(context: EmitContext) {
441
373
  if (emitterVersion !== undefined) {
442
374
  content.emitterVersion = emitterVersion;
443
375
  }
444
- if (dpgContext.rlcOptions?.isModularLibrary) {
445
- content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
446
- }
376
+ content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
447
377
  return {
448
378
  path: "metadata.json",
449
379
  content: JSON.stringify(content, null, 2),
@@ -495,10 +425,8 @@ export async function $onEmit(context: EmitContext) {
495
425
  }
496
426
 
497
427
  //TODO Need consider multi-client cases
498
- if (option.isModularLibrary) {
499
- for (const subClient of dpgContext.sdkPackage.clients) {
500
- rlcClient.libraryName = subClient.name;
501
- }
428
+ for (const subClient of dpgContext.sdkPackage.clients) {
429
+ rlcClient.libraryName = subClient.name;
502
430
  }
503
431
 
504
432
  if (shouldGenerateMetadata) {
@@ -524,11 +452,10 @@ export async function $onEmit(context: EmitContext) {
524
452
  ) {
525
453
  await emitTests(dpgContext, host);
526
454
  }
527
- let modularPackageInfo = {};
528
- if (option.isModularLibrary) {
529
- modularPackageInfo = {
530
- exports: getModuleExports(context, modularEmitterOptions),
531
- };
455
+ let modularPackageInfo: Record<string, any> = {
456
+ exports: getModuleExports(context, modularEmitterOptions),
457
+ };
458
+ {
532
459
  // Build dependencies
533
460
  const dependencies: Record<string, string> = {};
534
461
  dependencies["@azure/core-util"] = "^1.9.2";
@@ -573,35 +500,30 @@ export async function $onEmit(context: EmitContext) {
573
500
  dpgContext.generationPathDetail?.metadataDir,
574
501
  );
575
502
 
576
- if (option.isModularLibrary) {
577
- for (const file of project.getSourceFiles()) {
578
- await emitContentByBuilder(
579
- program,
580
- () => ({ content: file.getFullText(), path: file.getFilePath() }),
581
- modularEmitterOptions as any,
582
- );
583
- }
503
+ for (const file of project.getSourceFiles()) {
504
+ await emitContentByBuilder(
505
+ program,
506
+ () => ({ content: file.getFullText(), path: file.getFilePath() }),
507
+ modularEmitterOptions as any,
508
+ );
584
509
  }
585
510
  } else if (hasPackageFile && !hasManualConvenienceLayer) {
586
511
  const updateBuilders = [];
587
- let modularPackageInfo = {};
588
512
 
589
513
  // update existing package.json file with correct dependencies
590
- if (option.isModularLibrary) {
591
- // Additional format-specific dependencies to merge when migrating
592
- // (e.g. fast-xml-parser when XML serialization is used)
593
- const additionalDependencies: Record<string, string> = {};
594
- if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
595
- additionalDependencies["fast-xml-parser"] = "^4.5.0";
596
- }
597
- modularPackageInfo = {
598
- exports: getModuleExports(context, modularEmitterOptions),
599
- clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
600
- ...(Object.keys(additionalDependencies).length > 0 && {
601
- dependencies: additionalDependencies,
602
- }),
603
- };
514
+ // Additional format-specific dependencies to merge when migrating
515
+ // (e.g. fast-xml-parser when XML serialization is used)
516
+ const additionalDependencies: Record<string, string> = {};
517
+ if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
518
+ additionalDependencies["fast-xml-parser"] = "^4.5.0";
604
519
  }
520
+ const modularPackageInfo = {
521
+ exports: getModuleExports(context, modularEmitterOptions),
522
+ clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
523
+ ...(Object.keys(additionalDependencies).length > 0 && {
524
+ dependencies: additionalDependencies,
525
+ }),
526
+ };
605
527
 
606
528
  // Always update package.json (adds #platform/* imports) and, for modular
607
529
  // packages, exports, clientContextPaths and LRO deps.
package/src/lib.ts CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { createTypeSpecLibrary, JSONSchemaType, paramMessage } from "@typespec/compiler";
5
5
  import { Options } from "prettier";
6
- import { DependencyInfo, PackageDetails, ServiceInfo } from "./rlc-common/index.js";
6
+ import { PackageDetails } from "./rlc-common/index.js";
7
7
 
8
8
  export interface EmitterOptions {
9
9
  /**
@@ -13,9 +13,6 @@ export interface EmitterOptions {
13
13
  * currently affected by this option.
14
14
  */
15
15
  "include-headers-in-response"?: boolean;
16
- "include-shortcuts"?: boolean;
17
- "multi-client"?: boolean;
18
- batch?: any[];
19
16
  "package-details"?: PackageDetails;
20
17
  "add-credentials"?: boolean;
21
18
  /** Three possible values:
@@ -42,14 +39,8 @@ export interface EmitterOptions {
42
39
  */
43
40
  "generate-test"?: boolean;
44
41
  "generate-sample"?: boolean;
45
- "azure-output-directory"?: string;
46
42
  "is-typespec-test"?: boolean;
47
- title?: string;
48
- "dependency-info"?: DependencyInfo;
49
- "product-doc-link"?: string;
50
- "service-info"?: ServiceInfo;
51
43
  "azure-arm"?: boolean;
52
- "is-modular-library"?: boolean;
53
44
  "enable-operation-group"?: boolean;
54
45
  "enable-model-namespace"?: boolean;
55
46
  "hierarchy-client"?: boolean;
@@ -61,7 +52,6 @@ export interface EmitterOptions {
61
52
  "compatibility-query-multi-format"?: boolean;
62
53
  "typespec-title-map"?: Record<string, string>;
63
54
  "ignore-enum-member-name-normalize"?: boolean;
64
- "default-value-object"?: boolean;
65
55
  //TODO should remove this after finish the release tool test
66
56
  "should-use-pnpm-dep"?: boolean;
67
57
  "ignore-nullable-on-optional"?: boolean;
@@ -102,24 +92,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
102
92
  description:
103
93
  "This option is used to indicate whether to include response headers in the generated response type. When set to true, the generated response type will include response headers as properties.",
104
94
  },
105
- "include-shortcuts": {
106
- type: "boolean",
107
- nullable: true,
108
- description: "Deprecated option for RLC legacy generation.",
109
- },
110
- "multi-client": {
111
- type: "boolean",
112
- nullable: true,
113
- description: "Deprecated option for RLC legacy generation.",
114
- },
115
- batch: {
116
- type: "array",
117
- nullable: true,
118
- items: {
119
- type: "string",
120
- },
121
- description: "Deprecated option for RLC legacy generation.",
122
- },
123
95
  "package-details": {
124
96
  type: "object",
125
97
  additionalProperties: true,
@@ -199,59 +171,16 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
199
171
  description:
200
172
  "Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.",
201
173
  },
202
- "azure-output-directory": {
203
- type: "string",
204
- nullable: true,
205
- description: "Deprecated option for RLC legacy generation",
206
- },
207
174
  "is-typespec-test": {
208
175
  type: "boolean",
209
176
  nullable: true,
210
177
  description: "Internal option for test",
211
178
  },
212
- title: {
213
- type: "string",
214
- nullable: true,
215
- description: "Deprecated option for RLC legacy generation.",
216
- },
217
- "dependency-info": {
218
- type: "object",
219
- additionalProperties: true,
220
- properties: {
221
- link: { type: "string", nullable: false },
222
- description: { type: "string", nullable: false },
223
- },
224
- required: [],
225
- nullable: true,
226
- description: "Deprecated option for RLC legacy generation.",
227
- },
228
- "product-doc-link": {
229
- type: "string",
230
- nullable: true,
231
- description: "Deprecated option for RLC legacy generation.",
232
- },
233
- "service-info": {
234
- type: "object",
235
- additionalProperties: true,
236
- properties: {
237
- title: { type: "string", nullable: true },
238
- description: { type: "string", nullable: true },
239
- },
240
- nullable: true,
241
- description: "Deprecated option for RLC legacy generation.",
242
- },
243
179
  "azure-arm": {
244
180
  type: "boolean",
245
181
  nullable: true,
246
182
  description: "Whether the package is an arm package.",
247
183
  },
248
- "is-modular-library": {
249
- type: "boolean",
250
- nullable: true,
251
- default: false,
252
- description:
253
- "Whether to generate a Modular library. Defaults to `false`. Arm packages default to `true`.",
254
- },
255
184
  "enable-operation-group": {
256
185
  type: "boolean",
257
186
  nullable: true,
@@ -311,11 +240,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
311
240
  description:
312
241
  "Whether to generate the backward-compatible code for query parameter serialization for array types in RLC. Defaults to `false`",
313
242
  },
314
- "default-value-object": {
315
- type: "boolean",
316
- nullable: true,
317
- description: "Deprecated option for RLC legacy generation.",
318
- },
319
243
  "typespec-title-map": {
320
244
  type: "object",
321
245
  additionalProperties: {
@@ -77,14 +77,7 @@ export function getParameterTypeName(baseNameOrOperationGroup: string, operation
77
77
  }
78
78
 
79
79
  export function getClientName(model: RLCModel) {
80
- const clientName = model.libraryName;
81
- const clientInterfaceName = model.options?.isModularLibrary
82
- ? model.libraryName
83
- : clientName.endsWith("Client")
84
- ? `${clientName}`
85
- : `${clientName}Client`;
86
-
87
- return clientInterfaceName;
80
+ return model.libraryName;
88
81
  }
89
82
 
90
83
  export function getMultipartPartTypeName(schemaName: string, partName: string) {
@@ -1,27 +1,12 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- export * from "./build-client-definitions.js";
5
- export * from "./build-client.js";
6
- export * from "./build-index-file.js";
7
- export * from "./build-is-unexpected-helper.js";
8
- export * from "./build-logger.js";
9
- export * from "./build-paginate-helper.js";
10
- export * from "./build-parameter-types.js";
11
- export * from "./build-polling-helper.js";
12
- export * from "./build-response-types.js";
13
- export * from "./build-samples.js";
14
- export * from "./build-schema-type.js";
15
- export * from "./build-serialize-helper.js";
16
- export * from "./build-top-level-index-file.js";
17
4
  export * from "./helpers/api-version-util.js";
18
5
  export * from "./helpers/imports-util.js";
19
6
  export * from "./helpers/name-constructors.js";
20
7
  export * from "./helpers/name-utils.js";
21
8
  export * from "./helpers/operation-helpers.js";
22
9
  export * from "./helpers/schema-helpers.js";
23
- export * from "./helpers/shortcut-methods.js";
24
- export * from "./helpers/value-generation-util.js";
25
10
  export * from "./interfaces.js";
26
11
  export * from "./metadata/build-api-extractor-config.js";
27
12
  export * from "./metadata/build-changelog-file.js";
@@ -38,4 +23,3 @@ export * from "./test/build-karma-config.js";
38
23
  export * from "./test/build-recorded-client.js";
39
24
  export * from "./test/build-sample-test.js";
40
25
  export * from "./test/build-snippets.js";
41
- export * from "./transform-sample-groups.js";
@@ -195,8 +195,6 @@ export interface RLCOptions {
195
195
  * Whether to include response headers in the generated response types. If true, the generated response types will include headers as properties.
196
196
  */
197
197
  includeHeadersInResponse?: boolean;
198
- includeShortcuts?: boolean;
199
- multiClient?: boolean;
200
198
  batch?: any[];
201
199
  packageDetails?: PackageDetails;
202
200
  addCredentials?: boolean;
@@ -226,12 +224,8 @@ export interface RLCOptions {
226
224
  generateSample?: boolean;
227
225
  azureOutputDirectory?: string;
228
226
  isTypeSpecTest?: boolean;
229
- title?: string;
230
- dependencyInfo?: DependencyInfo;
231
- productDocLink?: string;
232
227
  serviceInfo?: ServiceInfo;
233
228
  azureArm?: boolean;
234
- isModularLibrary?: boolean;
235
229
  enableOperationGroup?: boolean;
236
230
  enableModelNamespace?: boolean;
237
231
  hierarchyClient?: boolean;
@@ -275,11 +269,6 @@ export interface ServiceInfo {
275
269
  description?: string;
276
270
  }
277
271
 
278
- export interface DependencyInfo {
279
- link: string;
280
- description: string;
281
- }
282
-
283
272
  export interface File {
284
273
  path: string;
285
274
  content: string;
@@ -2,9 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import { Project, SourceFile } from "ts-morph";
5
- import { NameType, normalizeName } from "../helpers/name-utils.js";
6
5
  import { hasPollingOperations } from "../helpers/operation-helpers.js";
7
- import { getRelativePartFromSrcPath } from "../helpers/path-utils.js";
8
6
  import { RLCModel } from "../interfaces.js";
9
7
  import { buildAzureMonorepoPackage } from "./package-json/build-azure-monorepo-package.js";
10
8
  import { PackageCommonInfoConfig, resolveWarpExports } from "./package-json/package-common.js";
@@ -29,13 +27,11 @@ export function buildPackageFile(
29
27
  nameWithoutScope: model.options?.packageDetails?.nameWithoutScope,
30
28
  exports,
31
29
  azureArm: model.options?.azureArm,
32
- isModularLibrary: model.options?.isModularLibrary ?? false,
33
30
  generateReactNativeTarget: model.options?.generateReactNativeTarget,
34
31
  };
35
32
 
36
33
  const extendedConfig = {
37
34
  ...config,
38
- clientFilePaths: [getClientFilePath(model)],
39
35
  hasLro: hasPollingOperations(model),
40
36
  monorepoPackageDirectory: model.options?.azureOutputDirectory,
41
37
  dependencies,
@@ -182,12 +178,3 @@ function getDescription(model: RLCModel): string {
182
178
  }
183
179
  return description;
184
180
  }
185
-
186
- function getClientFilePath(model: RLCModel) {
187
- const { srcPath } = model;
188
- const sdkReletivePart = getRelativePartFromSrcPath(srcPath);
189
- const clientFilename = normalizeName(model.libraryName, NameType.File);
190
- return sdkReletivePart
191
- ? `src/${sdkReletivePart}/${clientFilename}.ts`
192
- : `src/${clientFilename}.ts`;
193
- }
@@ -8,80 +8,6 @@ import { getClientName } from "../helpers/name-constructors.js";
8
8
  import { NameType, normalizeName } from "../helpers/name-utils.js";
9
9
  import { RLCModel } from "../interfaces.js";
10
10
 
11
- const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript
12
-
13
- {{ description }}
14
-
15
- {{#if azureArm}}
16
- **If you are not familiar with our REST client, please spend 5 minutes to take a look at {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api
17
- {{else}}
18
- **Please rely heavily on {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
19
- {{/if}}
20
-
21
- Key links:
22
-
23
- {{#if packageSourceURL}}
24
- - [Source code]({{ packageSourceURL }})
25
- {{/if}}
26
- {{#if packageNPMURL}}
27
- - [Package (NPM)]({{ packageNPMURL }})
28
- {{/if}}
29
- {{#if apiRefURL}}
30
- - [API reference documentation]({{ apiRefURL }})
31
- {{/if}}
32
- {{#if serviceDocURL}}
33
- - [Product documentation]({{ serviceDocURL }})
34
- {{/if}}
35
- {{#if samplesURL}}
36
- - [Samples]({{ samplesURL }})
37
- {{/if}}
38
-
39
- ## Getting started
40
-
41
- ### Currently supported environments
42
-
43
- - LTS versions of Node.js
44
-
45
- ### Prerequisites
46
-
47
- - You must have an [Azure subscription](https://azure.microsoft.com/free/){{#if dependencyLink}} and follow [these]({{ dependencyLink }}) instructions{{/if}} to use this package.
48
-
49
- ### Install the \`{{ clientPackageName }}\` package
50
-
51
- Install the {{ clientDescriptiveName }} REST client library for JavaScript with \`npm\`:
52
-
53
- \`\`\`bash
54
- npm install {{ clientPackageName }}
55
- \`\`\`
56
-
57
- ### Create and authenticate a \`{{ clientClassName }}\`
58
-
59
- To use a [Microsoft Entra token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
60
- provide an instance of the desired credential type obtained from the
61
- [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
62
-
63
- To authenticate with Microsoft Entra ID, you must first \`npm\` install [\`@azure/identity\`](https://www.npmjs.com/package/@azure/identity) {{#if dependencyLink}}and
64
- [{{dependencyDescription }}]({{ dependencyLink }}){{/if}}
65
-
66
- After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from \`@azure/identity\` to use.
67
- As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
68
- can be used to authenticate the client.
69
-
70
- ## Troubleshooting
71
-
72
- ### Logging
73
-
74
- Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the \`AZURE_LOG_LEVEL\` environment variable to \`info\`. Alternatively, logging can be enabled at runtime by calling \`setLogLevel\` in the \`@azure/logger\`:
75
-
76
- \`\`\`ts {{#if generateTest}}snippet:SetLogLevel{{/if}}
77
- import { setLogLevel } from "@azure/logger";
78
-
79
- setLogLevel("info");
80
- \`\`\`
81
-
82
- For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
83
- `;
84
-
85
11
  const azureReadmeModularTemplate = `# {{ clientDescriptiveName }} library for JavaScript
86
12
 
87
13
  This package contains an isomorphic SDK (runs both in Node.js and in browsers) for {{ clientDescriptiveName }}.
@@ -346,11 +272,7 @@ interface Metadata {
346
272
  export function buildReadmeFile(model: RLCModel) {
347
273
  const metadata = createMetadata(model) ?? {};
348
274
  const readmeFileContents = hbs.compile(
349
- model.options
350
- ? model.options.isModularLibrary
351
- ? azureReadmeModularTemplate
352
- : azureReadmeRLCTemplate
353
- : nonBrandedReadmeTemplate,
275
+ model.options ? azureReadmeModularTemplate : nonBrandedReadmeTemplate,
354
276
  { noEscape: true },
355
277
  );
356
278
  return {
@@ -407,16 +329,7 @@ function createMetadata(model: RLCModel): Metadata | undefined {
407
329
  return;
408
330
  }
409
331
  // const packageDetails = model.options.packageDetails;
410
- const {
411
- packageDetails,
412
- azureOutputDirectory,
413
- productDocLink,
414
- dependencyInfo,
415
- multiClient,
416
- batch,
417
- serviceInfo,
418
- isTypeSpecTest,
419
- } = model.options;
332
+ const { packageDetails, azureOutputDirectory, serviceInfo, isTypeSpecTest } = model.options;
420
333
 
421
334
  const azureHuh =
422
335
  packageDetails?.scopeName === "azure" || packageDetails?.scopeName === "azure-rest";
@@ -444,11 +357,8 @@ function createMetadata(model: RLCModel): Metadata | undefined {
444
357
  serviceName,
445
358
  clientClassName,
446
359
  clientPackageName: clientPackageName,
447
- clientDescriptiveName: model.options.isModularLibrary
448
- ? `${serviceName} client`
449
- : `${serviceName} REST client`,
360
+ clientDescriptiveName: `${serviceName} client`,
450
361
  description: serviceInfo?.description ?? packageDetails.description,
451
- serviceDocURL: productDocLink,
452
362
  packageSourceURL: packageSourceURL,
453
363
  packageNPMURL: `https://www.npmjs.com/package/${clientPackageName}`,
454
364
  samplesURL:
@@ -456,9 +366,6 @@ function createMetadata(model: RLCModel): Metadata | undefined {
456
366
  apiRefURL: azureHuh
457
367
  ? `https://learn.microsoft.com/javascript/api/${clientPackageName}${apiRefUrlQueryParameter}`
458
368
  : undefined,
459
- dependencyDescription: dependencyInfo?.description,
460
- dependencyLink: dependencyInfo?.link,
461
- hasMultiClients: multiClient && batch && batch.length > 1,
462
369
  azureArm: Boolean(model.options.azureArm),
463
370
  azure: azureHuh,
464
371
  isReleasablePackage: !isTypeSpecTest,
@@ -477,9 +384,7 @@ function getServiceName(model: RLCModel) {
477
384
  model?.options?.packageDetails?.scopeName === "azure" ||
478
385
  model?.options?.packageDetails?.scopeName === "azure-rest";
479
386
  const libraryName = model.libraryName;
480
- const serviceTitle = model.options?.isModularLibrary
481
- ? model.libraryName
482
- : (model.options?.serviceInfo?.title ?? model.libraryName);
387
+ const serviceTitle = model.libraryName;
483
388
  const batch = model?.options?.batch,
484
389
  packageDetails = model?.options?.packageDetails;
485
390
  let simpleServiceName =