@azure-tools/typespec-ts 0.56.0-dev.3 → 0.56.0-dev.4

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 (103) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +31 -21
  3. package/dist/src/context-manager.d.ts +17 -0
  4. package/dist/src/context-manager.d.ts.map +1 -1
  5. package/dist/src/context-manager.js +21 -0
  6. package/dist/src/context-manager.js.map +1 -1
  7. package/dist/src/framework/declaration.d.ts.map +1 -1
  8. package/dist/src/framework/declaration.js +6 -20
  9. package/dist/src/framework/declaration.js.map +1 -1
  10. package/dist/src/framework/hooks/sdk-types.d.ts +9 -0
  11. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
  12. package/dist/src/framework/hooks/sdk-types.js +13 -0
  13. package/dist/src/framework/hooks/sdk-types.js.map +1 -1
  14. package/dist/src/framework/source-file-batch.d.ts +35 -0
  15. package/dist/src/framework/source-file-batch.d.ts.map +1 -0
  16. package/dist/src/framework/source-file-batch.js +128 -0
  17. package/dist/src/framework/source-file-batch.js.map +1 -0
  18. package/dist/src/index.js +12 -12
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/interfaces.d.ts +0 -2
  21. package/dist/src/interfaces.d.ts.map +1 -1
  22. package/dist/src/interfaces.js.map +1 -1
  23. package/dist/src/lib.d.ts +15 -2
  24. package/dist/src/lib.d.ts.map +1 -1
  25. package/dist/src/lib.js +22 -11
  26. package/dist/src/lib.js.map +1 -1
  27. package/dist/src/metadata/build-package-file.d.ts +2 -4
  28. package/dist/src/metadata/build-package-file.d.ts.map +1 -1
  29. package/dist/src/metadata/build-package-file.js +2 -17
  30. package/dist/src/metadata/build-package-file.js.map +1 -1
  31. package/dist/src/metadata/build-readme-file.d.ts.map +1 -1
  32. package/dist/src/metadata/build-readme-file.js +17 -70
  33. package/dist/src/metadata/build-readme-file.js.map +1 -1
  34. package/dist/src/metadata/build-ts-config.d.ts.map +1 -1
  35. package/dist/src/metadata/build-ts-config.js +12 -0
  36. package/dist/src/metadata/build-ts-config.js.map +1 -1
  37. package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts +0 -1
  38. package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
  39. package/dist/src/metadata/package-json/build-azure-monorepo-package.js +0 -14
  40. package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
  41. package/dist/src/metadata/render-template.d.ts +24 -0
  42. package/dist/src/metadata/render-template.d.ts.map +1 -0
  43. package/dist/src/metadata/render-template.js +148 -0
  44. package/dist/src/metadata/render-template.js.map +1 -0
  45. package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -1
  46. package/dist/src/metadata/test/build-recorded-client.js +1 -7
  47. package/dist/src/metadata/test/build-recorded-client.js.map +1 -1
  48. package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -1
  49. package/dist/src/metadata/test/build-sample-test.js +1 -4
  50. package/dist/src/metadata/test/build-sample-test.js.map +1 -1
  51. package/dist/src/metadata/test/build-snippets.d.ts.map +1 -1
  52. package/dist/src/metadata/test/build-snippets.js +2 -4
  53. package/dist/src/metadata/test/build-snippets.js.map +1 -1
  54. package/dist/src/metadata/test/template.d.ts +0 -1
  55. package/dist/src/metadata/test/template.d.ts.map +1 -1
  56. package/dist/src/metadata/test/template.js +0 -127
  57. package/dist/src/metadata/test/template.js.map +1 -1
  58. package/dist/src/modular/build-classical-client.d.ts.map +1 -1
  59. package/dist/src/modular/build-classical-client.js +2 -2
  60. package/dist/src/modular/build-classical-client.js.map +1 -1
  61. package/dist/src/modular/build-root-index.d.ts.map +1 -1
  62. package/dist/src/modular/build-root-index.js +37 -9
  63. package/dist/src/modular/build-root-index.js.map +1 -1
  64. package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
  65. package/dist/src/modular/build-subpath-index.js +15 -2
  66. package/dist/src/modular/build-subpath-index.js.map +1 -1
  67. package/dist/src/modular/emit-models.d.ts.map +1 -1
  68. package/dist/src/modular/emit-models.js +24 -17
  69. package/dist/src/modular/emit-models.js.map +1 -1
  70. package/dist/src/modular/helpers/client-helpers.d.ts +8 -3
  71. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
  72. package/dist/src/modular/helpers/client-helpers.js +37 -17
  73. package/dist/src/modular/helpers/client-helpers.js.map +1 -1
  74. package/dist/src/modular/helpers/operation-helpers.js +8 -9
  75. package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
  76. package/dist/src/transform/transform-client-options.d.ts.map +1 -1
  77. package/dist/src/transform/transform-client-options.js +1 -5
  78. package/dist/src/transform/transform-client-options.js.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +30 -33
  81. package/src/context-manager.ts +23 -0
  82. package/src/framework/declaration.ts +8 -20
  83. package/src/framework/hooks/sdk-types.ts +14 -0
  84. package/src/framework/source-file-batch.ts +140 -0
  85. package/src/index.ts +13 -13
  86. package/src/interfaces.ts +0 -2
  87. package/src/lib.ts +40 -14
  88. package/src/metadata/build-package-file.ts +2 -21
  89. package/src/metadata/build-readme-file.ts +20 -94
  90. package/src/metadata/build-ts-config.ts +12 -0
  91. package/src/metadata/package-json/build-azure-monorepo-package.ts +0 -17
  92. package/src/metadata/render-template.ts +202 -0
  93. package/src/metadata/test/build-recorded-client.ts +1 -7
  94. package/src/metadata/test/build-sample-test.ts +1 -4
  95. package/src/metadata/test/build-snippets.ts +2 -4
  96. package/src/metadata/test/template.ts +0 -128
  97. package/src/modular/build-classical-client.ts +2 -6
  98. package/src/modular/build-root-index.ts +52 -14
  99. package/src/modular/build-subpath-index.ts +24 -3
  100. package/src/modular/emit-models.ts +24 -18
  101. package/src/modular/helpers/client-helpers.ts +43 -25
  102. package/src/modular/helpers/operation-helpers.ts +10 -10
  103. package/src/transform/transform-client-options.ts +1 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log - @azure-tools/typespec-ts
2
2
 
3
+ ## 0.55.1
4
+
5
+ ### Bug Fixes
6
+
7
+ - [#4804](https://github.com/Azure/typespec-azure/pull/4804) Fix return type for operations with optional body response: use `void` instead of `undefined` in union return types (e.g. `Promise<KeyValue | void>` instead of `Promise<KeyValue | undefined>`)
8
+ - [#4817](https://github.com/Azure/typespec-azure/pull/4817) Simplify the generated SDK `User-Agent` telemetry prefix to follow the [Azure Core telemetry policy](https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy). The legacy internal layering tokens `azsdk-js-client` and `azsdk-js-api` are no longer emitted, so the user agent is now `[<application_id> ]azsdk-js-<package>/<version> <platform_info>`. Any caller-supplied application id is still forwarded and prepended.
9
+ - [#4570](https://github.com/Azure/typespec-azure/pull/4570) Use the `catalog:` pnpm workspace specifier for the `tslib` dependency when generating `package.json` for the azure-sdk-for-js monorepo.
10
+
11
+
3
12
  ## 0.55.0
4
13
 
5
14
  ### Breaking Changes
package/README.md CHANGED
@@ -42,6 +42,29 @@ options:
42
42
  Defines the emitter output directory. Defaults to `{output-dir}/@azure-tools/typespec-ts`
43
43
  See [Configuring output directory for more info](https://typespec.io/docs/handbook/configuration/configuration/#configuring-output-directory)
44
44
 
45
+ ### `api-version`
46
+
47
+ **Type:** `string | object`
48
+
49
+ Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`. For multi-service packages, provide a map from each service namespace's full name to its desired version; services not listed default to their latest version.
50
+
51
+ **Options:**
52
+
53
+ - `string`
54
+ - `object`
55
+
56
+ ### `examples-dir`
57
+
58
+ **Type:** `string`
59
+
60
+ Specifies the directory where the emitter will look for example files. If the flag isn't set, the emitter defaults to using an `examples` directory located at the project root.
61
+
62
+ ### `namespace`
63
+
64
+ **Type:** `string`
65
+
66
+ Specifies the namespace you want to override for namespaces set in the spec. With this config, all namespace for the spec types will default to it.
67
+
45
68
  ### `include-headers-in-response`
46
69
 
47
70
  **Type:** `boolean`
@@ -50,20 +73,19 @@ This option is used to indicate whether to include response headers in the gener
50
73
 
51
74
  ### `package-details`
52
75
 
53
- **Type:** `object { name, scopeName, nameWithoutScope, description, version, isVersionUserProvided }`
76
+ **Type:** `object { name, scopeName, nameWithoutScope, description, version }`
54
77
 
55
78
  This is to indicate the package information such as package name, package description etc.
56
79
 
57
80
  **Properties:**
58
81
 
59
- | Name | Type | Default | Description |
60
- | ----------------------- | --------- | ------- | ----------- |
61
- | `name` | `string` | | |
62
- | `scopeName` | `string` | | |
63
- | `nameWithoutScope` | `string` | | |
64
- | `description` | `string` | | |
65
- | `version` | `string` | | |
66
- | `isVersionUserProvided` | `boolean` | | |
82
+ | Name | Type | Default | Description |
83
+ | ------------------ | -------- | ------- | ----------- |
84
+ | `name` | `string` | | |
85
+ | `scopeName` | `string` | | |
86
+ | `nameWithoutScope` | `string` | | |
87
+ | `description` | `string` | | |
88
+ | `version` | `string` | | |
67
89
 
68
90
  ### `add-credentials`
69
91
 
@@ -126,12 +148,6 @@ other cases:
126
148
 
127
149
  Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.
128
150
 
129
- ### `is-typespec-test`
130
-
131
- **Type:** `boolean`
132
-
133
- Internal option for test
134
-
135
151
  ### `azure-arm`
136
152
 
137
153
  **Type:** `boolean`
@@ -205,12 +221,6 @@ typespec-title-map:
205
221
  AnomalyDetectorClient2: AnomalyDetectorRest2
206
222
  ```
207
223
 
208
- ### `should-use-pnpm-dep`
209
-
210
- **Type:** `boolean`
211
-
212
- Internal option for test.
213
-
214
224
  ### `ignore-nullable-on-optional`
215
225
 
216
226
  **Type:** `boolean`
@@ -56,6 +56,16 @@ declare class ContextManager {
56
56
  * @returns {Contexts[K] | undefined} The value of the context if found, otherwise undefined.
57
57
  */
58
58
  getContext<K extends ContextKey>(key: K): Contexts[K] | undefined;
59
+ /**
60
+ * Clears all stored contexts.
61
+ *
62
+ * The manager is a process-wide singleton, so the values provided during an
63
+ * emit (the `EmitContext`/`Program`, the TCGC `SdkContext`, the ts-morph
64
+ * `Project`, etc.) stay reachable from this map until the next emit overwrites
65
+ * them. Clearing at the end of an emit lets the whole previous program graph
66
+ * be collected instead of being retained until the following emit.
67
+ */
68
+ clearContexts(): void;
59
69
  }
60
70
  export declare const contextManager: ContextManager;
61
71
  /**
@@ -71,5 +81,12 @@ export declare function useContext<K extends ContextKey>(key: K): Contexts[K];
71
81
  * @param {Contexts[K]} value - The value to set for the specified context.
72
82
  */
73
83
  export declare function provideContext<K extends ContextKey>(key: K, value: Contexts[K]): void;
84
+ /**
85
+ * Clears all contexts held by the singleton context manager. Call this once an
86
+ * emit has finished writing its output so the retained program graph (compiler
87
+ * `EmitContext`/`Program`, TCGC `SdkContext`, ts-morph `Project`, binder, …) can
88
+ * be garbage collected instead of lingering until the next emit overwrites it.
89
+ */
90
+ export declare function clearContexts(): void;
74
91
  export {};
75
92
  //# sourceMappingURL=context-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../../src/context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,KAAK,QAAQ,GAAG;IACd,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE;QACX,eAAe,EAAE,WAAW,C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AE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
@@ -32,6 +32,18 @@ class ContextManager {
32
32
  getContext(key) {
33
33
  return this.contexts.get(key);
34
34
  }
35
+ /**
36
+ * Clears all stored contexts.
37
+ *
38
+ * The manager is a process-wide singleton, so the values provided during an
39
+ * emit (the `EmitContext`/`Program`, the TCGC `SdkContext`, the ts-morph
40
+ * `Project`, etc.) stay reachable from this map until the next emit overwrites
41
+ * them. Clearing at the end of an emit lets the whole previous program graph
42
+ * be collected instead of being retained until the following emit.
43
+ */
44
+ clearContexts() {
45
+ this.contexts.clear();
46
+ }
35
47
  }
36
48
  // Expose the singleton instance of the context manager.
37
49
  export const contextManager = ContextManager.getInstance();
@@ -56,4 +68,13 @@ export function useContext(key) {
56
68
  export function provideContext(key, value) {
57
69
  contextManager.setContext(key, value);
58
70
  }
71
+ /**
72
+ * Clears all contexts held by the singleton context manager. Call this once an
73
+ * emit has finished writing its output so the retained program graph (compiler
74
+ * `EmitContext`/`Program`, TCGC `SdkContext`, ts-morph `Project`, binder, …) can
75
+ * be garbage collected instead of lingering until the next emit overwrites it.
76
+ */
77
+ export function clearContexts() {
78
+ contextManager.clearContexts();
79
+ }
59
80
  //# sourceMappingURL=context-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/context-manager.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,MAAM,cAAc;IACV,MAAM,CAAC,QAAQ,CAAiB;IAChC,QAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEnD,gBAAuB,CAAC;IAExB;;;OAGG;IACI,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CA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7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,yBAAyB,EACtC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,wBAAwB,EACrC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,4BAA4B,EACzC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AACR,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,EACpB,6BAA6B,EAC7B,UAAU,EAGV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAIlB,MAAM,MAAM,qBAAqB,GAC7B,yBAAyB,GACzB,wBAAwB,GACxB,4BAA4B,GAC5B,6BAA6B,GAC7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,yBAAyB,EACtC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,wBAAwB,EACrC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,4BAA4B,EACzC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AACR,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { StructureKind, } from "ts-morph";
2
2
  import { useBinder } from "./hooks/binder.js";
3
3
  import { refkey as getRefKey } from "./refkey.js";
4
+ import { enqueueStatement } from "./source-file-batch.js";
4
5
  export function addDeclaration(sourceFile, input, refkey) {
5
6
  const binder = useBinder();
6
7
  const declaration = typeof input === "string" ? { name: input, kind: StructureKind.TypeAlias } : input;
@@ -11,26 +12,11 @@ export function addDeclaration(sourceFile, input, refkey) {
11
12
  const trackedDeclarationName = binder.trackDeclaration(stringRefkey, declaration.name, sourceFile);
12
13
  // Update the declaration name to be unique
13
14
  const trackedDeclaration = { ...declaration, name: trackedDeclarationName };
14
- switch (trackedDeclaration.kind) {
15
- case StructureKind.Class:
16
- sourceFile.addClass(trackedDeclaration);
17
- break;
18
- case StructureKind.Enum:
19
- sourceFile.addEnum(trackedDeclaration);
20
- break;
21
- case StructureKind.Function:
22
- sourceFile.addFunction(trackedDeclaration);
23
- break;
24
- case StructureKind.Interface:
25
- sourceFile.addInterface(trackedDeclaration);
26
- break;
27
- case StructureKind.TypeAlias:
28
- if (trackedDeclaration.type) {
29
- sourceFile.addTypeAlias(trackedDeclaration);
30
- }
31
- break;
32
- default:
33
- throw new Error(`Unsupported declaration kind ${trackedDeclaration.kind}`);
15
+ // Skip empty type aliases (they have no body to emit). Done before
16
+ // dispatching so behaviour is identical whether batching or not.
17
+ if (trackedDeclaration.kind === StructureKind.TypeAlias && !trackedDeclaration.type) {
18
+ return;
34
19
  }
20
+ enqueueStatement(sourceFile, trackedDeclaration);
35
21
  }
36
22
  //# sourceMappingURL=declaration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,aAAa,GAGd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AA6ClD,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,KAAqC,EACrC,MAAe;IAEf,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9F,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC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CAC5B,UAAsB,EACtB,KAAqC,EACrC,MAAe;IAEf,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9F,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CACpD,YAAY,EACZ,WAAW,CAAC,IAAI,EAChB,UAAU,CACX,CAAC;IAEF,2CAA2C;IAC3C,MAAM,kBAAkB,GAAG,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAE5E,mEAAmE;IACnE,iEAAiE;IACjE,IAAI,kBAAkB,CAAC,IAAI,KAAK,aAAa,CAAC,SAAS,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QACpF,OAAO;IACT,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,kBAAyC,CAAC,CAAC;AAC1E,CAAC"}
@@ -9,6 +9,15 @@ export declare const flattenPropertyModelMap: Map<SdkModelPropertyType, SdkModel
9
9
  * Precomputed during visitPackageTypes for O(1) lookups in normalizeModelName.
10
10
  */
11
11
  export declare const pagedModelsKeptPublic: Set<SdkType>;
12
+ /**
13
+ * Releases the module-level state that accumulates while visiting a package's
14
+ * types. These collections are cleared at the start of every
15
+ * {@link visitPackageTypes} call, but because they live at module scope they
16
+ * otherwise keep the most recently emitted program's SDK types reachable until
17
+ * the next emit runs. Call this once an emit has fully finished so that state
18
+ * can be garbage collected.
19
+ */
20
+ export declare function resetSdkTypesState(): void;
12
21
  export interface SdkTypeContext {
13
22
  operations: Map<Type, SdkServiceMethod<SdkHttpOperation>>;
14
23
  types: Map<Type, SdkType>;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-types.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,OAAO,EAER,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAwB,MAAM,oBAAoB,CAAC;AAO3E,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,OAAO,CAAsB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,EAAE,GAAG,CAAC,oBAAoB,EAAE,YAAY,CAGzE,CAAC;AACJ;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,cAAqB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1B,iBAAiB,EAAE,GAAG,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;CACjD;AAED,wBAAgB,WAAW;WAIC,SAAS,GAAG,gBAAgB,CAAC,gBAAgB,CAAC;WAC9C,IAAI,GAAG,OAAO;EAwBzC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,QAkElD;AAm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CAAC,wCAYjF"}
@@ -14,6 +14,19 @@ export const flattenPropertyModelMap = new Map();
14
14
  * Precomputed during visitPackageTypes for O(1) lookups in normalizeModelName.
15
15
  */
16
16
  export const pagedModelsKeptPublic = new Set();
17
+ /**
18
+ * Releases the module-level state that accumulates while visiting a package's
19
+ * types. These collections are cleared at the start of every
20
+ * {@link visitPackageTypes} call, but because they live at module scope they
21
+ * otherwise keep the most recently emitted program's SDK types reachable until
22
+ * the next emit runs. Call this once an emit has fully finished so that state
23
+ * can be garbage collected.
24
+ */
25
+ export function resetSdkTypesState() {
26
+ emitQueue.clear();
27
+ flattenPropertyModelMap.clear();
28
+ pagedModelsKeptPublic.clear();
29
+ }
17
30
  export function useSdkTypes() {
18
31
  const sdkTypesContext = useContext("sdkTypes");
19
32
  const { tcgcContext } = useContext("emitContext");
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,GACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,CAAC,MAAM,SAAS,GAAiB,IAAI,GAAG,EAAW,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAA4C,IAAI,GAAG,EAGpF,CAAC;AACJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,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,YAAY,CAAC,CAC9B,CAAC;QACF,KAAK,MAAM,oBAAoB,IAAI,oBAAoB,EAAE,CAAC;YACxD,IAAI,iBAAiB,GAAG,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;YAClF,IAAI,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC9C,iBAAiB,GAAG,aAAa,CAC/B,GAAG,iBAAiB,IAAI,eAAe,CAAC,IAAI,IAAI,iBAAiB,EAAE,EACnE,QAAQ,CAAC,QAAQ,CAClB,CAAC;gBACF,WAAW,CAAC,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;YAC3D,CAAC;YACD,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAAuC;IAChF,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,UAAU,GAAyC,EAAE,CAAC;IAC5D,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAG,CAAC;QAClC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { SourceFile, StatementStructures } from "ts-morph";
2
+ /**
3
+ * Opens a batching scope. Subsequent `enqueueStatement` calls queue rather
4
+ * than mutate the AST until the matching `flushSourceFileBatch` is called.
5
+ */
6
+ export declare function beginSourceFileBatch(): void;
7
+ /**
8
+ * Closes the most recent batching scope. When the outermost scope closes,
9
+ * all pending structures are written to their source files in bulk.
10
+ */
11
+ export declare function flushSourceFileBatch(): void;
12
+ /**
13
+ * Queues a statement structure for bulk-add on flush, or writes it
14
+ * immediately when no batch is open.
15
+ * @param sourceFile - Target source file.
16
+ * @param structure - The statement structure to add.
17
+ */
18
+ export declare function enqueueStatement(sourceFile: SourceFile, structure: StatementStructures): void;
19
+ /**
20
+ * Returns the set of names exported from `sourceFile` considering both the
21
+ * declarations already present in its AST and any export declarations queued
22
+ * by the current batch. Use this in place of reading `getExportDeclarations`
23
+ * directly when callers dedup against existing exports inside a batch.
24
+ * @param sourceFile - The file to inspect.
25
+ */
26
+ export declare function getEffectiveExportedNames(sourceFile: SourceFile): Set<string>;
27
+ /**
28
+ * Returns the set of named exports queued in the current batch for
29
+ * `sourceFile`. Use this to union with any AST-based view of exports
30
+ * (e.g. `getExportedDeclarations`) when deduplicating against still-pending
31
+ * writes inside a batch.
32
+ * @param sourceFile - The file to inspect.
33
+ */
34
+ export declare function getQueuedExportNames(sourceFile: SourceFile): Set<string>;
35
+ //# sourceMappingURL=source-file-batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-batch.d.ts","sourceRoot":"","sources":["../../../src/framework/source-file-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAkBlB;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAkB3C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAW7F;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAiB7E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAaxE"}
@@ -0,0 +1,128 @@
1
+ import { StructureKind, } from "ts-morph";
2
+ /**
3
+ * Generic per-source-file batch for ts-morph `add*` mutations.
4
+ *
5
+ * Each individual `sourceFile.addInterface/addFunction/addExportDeclaration/...`
6
+ * call re-parses the entire source file in ts-morph. Calling them in a loop
7
+ * therefore grows as O(N × file_size). This module collects structures while
8
+ * a batch is open and, on flush, issues a single `addStatements` call per file,
9
+ * collapsing N re-parses into 1.
10
+ *
11
+ * The batch is reference-counted so nested begin/flush pairs compose safely.
12
+ * Statements flush in insertion order and produce byte-identical output.
13
+ */
14
+ let batchDepth = 0;
15
+ const pendingByFile = new Map();
16
+ /**
17
+ * Opens a batching scope. Subsequent `enqueueStatement` calls queue rather
18
+ * than mutate the AST until the matching `flushSourceFileBatch` is called.
19
+ */
20
+ export function beginSourceFileBatch() {
21
+ batchDepth++;
22
+ }
23
+ /**
24
+ * Closes the most recent batching scope. When the outermost scope closes,
25
+ * all pending structures are written to their source files in bulk.
26
+ */
27
+ export function flushSourceFileBatch() {
28
+ if (batchDepth === 0) {
29
+ return;
30
+ }
31
+ batchDepth--;
32
+ if (batchDepth > 0) {
33
+ return;
34
+ }
35
+ try {
36
+ for (const [sourceFile, statements] of pendingByFile) {
37
+ if (statements.length === 0) {
38
+ continue;
39
+ }
40
+ sourceFile.addStatements(statements);
41
+ }
42
+ }
43
+ finally {
44
+ pendingByFile.clear();
45
+ }
46
+ }
47
+ /**
48
+ * Queues a statement structure for bulk-add on flush, or writes it
49
+ * immediately when no batch is open.
50
+ * @param sourceFile - Target source file.
51
+ * @param structure - The statement structure to add.
52
+ */
53
+ export function enqueueStatement(sourceFile, structure) {
54
+ if (batchDepth > 0) {
55
+ let pending = pendingByFile.get(sourceFile);
56
+ if (!pending) {
57
+ pending = [];
58
+ pendingByFile.set(sourceFile, pending);
59
+ }
60
+ pending.push(structure);
61
+ return;
62
+ }
63
+ sourceFile.addStatements([structure]);
64
+ }
65
+ /**
66
+ * Returns the set of names exported from `sourceFile` considering both the
67
+ * declarations already present in its AST and any export declarations queued
68
+ * by the current batch. Use this in place of reading `getExportDeclarations`
69
+ * directly when callers dedup against existing exports inside a batch.
70
+ * @param sourceFile - The file to inspect.
71
+ */
72
+ export function getEffectiveExportedNames(sourceFile) {
73
+ const names = new Set();
74
+ for (const decl of sourceFile.getExportDeclarations()) {
75
+ for (const named of decl.getNamedExports()) {
76
+ names.add(named.getAliasNode()?.getText() ?? named.getName());
77
+ }
78
+ }
79
+ const pending = pendingByFile.get(sourceFile);
80
+ if (pending) {
81
+ for (const structure of pending) {
82
+ if (structure.kind !== StructureKind.ExportDeclaration) {
83
+ continue;
84
+ }
85
+ collectNamedExportNames(structure.namedExports, names);
86
+ }
87
+ }
88
+ return names;
89
+ }
90
+ /**
91
+ * Returns the set of named exports queued in the current batch for
92
+ * `sourceFile`. Use this to union with any AST-based view of exports
93
+ * (e.g. `getExportedDeclarations`) when deduplicating against still-pending
94
+ * writes inside a batch.
95
+ * @param sourceFile - The file to inspect.
96
+ */
97
+ export function getQueuedExportNames(sourceFile) {
98
+ const names = new Set();
99
+ const pending = pendingByFile.get(sourceFile);
100
+ if (!pending) {
101
+ return names;
102
+ }
103
+ for (const structure of pending) {
104
+ if (structure.kind !== StructureKind.ExportDeclaration) {
105
+ continue;
106
+ }
107
+ collectNamedExportNames(structure.namedExports, names);
108
+ }
109
+ return names;
110
+ }
111
+ function collectNamedExportNames(named, into) {
112
+ if (!named || typeof named === "function") {
113
+ // WriterFunction form is opaque to us; callers can't dedup by name.
114
+ return;
115
+ }
116
+ for (const item of named) {
117
+ if (typeof item === "string") {
118
+ into.add(item);
119
+ }
120
+ else if (typeof item === "function") {
121
+ continue;
122
+ }
123
+ else if (item) {
124
+ into.add(item.alias ?? item.name);
125
+ }
126
+ }
127
+ }
128
+ //# sourceMappingURL=source-file-batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-batch.js","sourceRoot":"","sources":["../../../src/framework/source-file-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,GACd,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;GAWG;AAEH,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqC,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,UAAU,EAAE,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,UAAU,EAAE,CAAC;IACb,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,KAAK,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,aAAa,EAAE,CAAC;YACrD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5B,SAAS;YACX,CAAC;YACD,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,aAAa,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAsB,EAAE,SAA8B;IACrF,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,IAAI,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;YACb,aAAa,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,OAAO;IACT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,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAiD,EACjD,IAAiB;IAEjB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAC1C,oEAAoE;QACpE,OAAO;IACT,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;aAAM,IAAI,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { getBaseFileName, getDirectoryPath, joinPaths, resolvePath, } from "@typespec/compiler";
4
- import { provideContext, useContext } from "./context-manager.js";
4
+ import { clearContexts, provideContext, useContext } from "./context-manager.js";
5
5
  import { buildRootIndex, buildSubClientIndexFile } from "./modular/build-root-index.js";
6
6
  import { AzureCoreDependencies, AzureIdentityDependencies, AzurePollingDependencies, AzureTestDependencies, } from "./modular/external-dependencies.js";
7
7
  import { CloudSettingHelpers, CreateRecorderHelpers, MultipartHelpers, PagingHelpers, PlatformTypeHelpers, PollingHelpers, SerializationHelpers, SimplePollerHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers, } from "./modular/static-helpers-metadata.js";
@@ -10,7 +10,7 @@ import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.
10
10
  import { createSdkContext, listAllServiceNamespaces, } from "@azure-tools/typespec-client-generator-core";
11
11
  import { Project } from "ts-morph";
12
12
  import { provideBinder } from "./framework/hooks/binder.js";
13
- import { provideSdkTypes } from "./framework/hooks/sdk-types.js";
13
+ import { provideSdkTypes, resetSdkTypesState } from "./framework/hooks/sdk-types.js";
14
14
  import { loadStaticHelpers } from "./framework/load-static-helpers.js";
15
15
  import { buildApiExtractorConfig } from "./metadata/build-api-extractor-config.js";
16
16
  import { buildChangelogFile } from "./metadata/build-changelog-file.js";
@@ -28,7 +28,7 @@ import { buildSampleTest } from "./metadata/test/build-sample-test.js";
28
28
  import { buildSnippets } from "./metadata/test/build-snippets.js";
29
29
  import { buildClassicalClient } from "./modular/build-classical-client.js";
30
30
  import { buildClassicOperationFiles } from "./modular/build-classical-operation-groups.js";
31
- import { buildClientContext, getClientContextPath } from "./modular/build-client-context.js";
31
+ import { buildClientContext } from "./modular/build-client-context.js";
32
32
  import { transformModularEmitterOptions } from "./modular/build-modular-options.js";
33
33
  import { buildOperationFiles } from "./modular/build-operations.js";
34
34
  import { getModuleExports } from "./modular/build-project-files.js";
@@ -123,6 +123,14 @@ export async function $onEmit(context) {
123
123
  return emitterMetadata?.metadata.version;
124
124
  }
125
125
  await generateMetadataAndTest(dpgContext);
126
+ // Release the emitter's process-wide singleton state now that this emit has
127
+ // finished writing output. Without this, the context manager keeps the whole
128
+ // previous program graph (compiler `EmitContext`/`Program`, TCGC `SdkContext`,
129
+ // ts-morph `Project`, binder, …) reachable until the next emit overwrites it.
130
+ // Clearing here lets it be collected between emits, which matters for hosts
131
+ // that run many emits in one process (test suites, benchmarks, watch mode).
132
+ clearContexts();
133
+ resetSdkTypesState();
126
134
  async function enrichDpgContext() {
127
135
  const generationPathDetail = await calculateGenerationDir();
128
136
  dpgContext.generationPathDetail = generationPathDetail;
@@ -335,7 +343,6 @@ export async function $onEmit(context) {
335
343
  modularPackageInfo = {
336
344
  ...modularPackageInfo,
337
345
  dependencies,
338
- clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
339
346
  };
340
347
  }
341
348
  commonBuilders.push((model) => buildPackageFile(model, modularPackageInfo));
@@ -376,13 +383,12 @@ export async function $onEmit(context) {
376
383
  }
377
384
  const modularPackageInfo = {
378
385
  exports: getModuleExports(context, modularEmitterOptions),
379
- clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
380
386
  ...(Object.keys(additionalDependencies).length > 0 && {
381
387
  dependencies: additionalDependencies,
382
388
  }),
383
389
  };
384
390
  // Always update package.json (adds #platform/* imports) along with
385
- // exports, clientContextPaths and LRO deps.
391
+ // exports and LRO deps.
386
392
  {
387
393
  // Read package.json content via host and pass parsed object
388
394
  const pkgSourceFile = await host.readFile(existingPackageFilePath);
@@ -422,12 +428,6 @@ export async function $onEmit(context) {
422
428
  await emitContentByBuilder(program, [buildRecordedClientFile, buildSampleTest], clientModel, dpgContext.generationPathDetail?.metadataDir);
423
429
  }
424
430
  }
425
- function getRelativeContextPaths(context, options) {
426
- const clientMap = getClientHierarchyMap(context);
427
- return Array.from(clientMap)
428
- .map((subClient) => getClientContextPath(subClient, options))
429
- .map((path) => path.substring(path.indexOf("src")));
430
- }
431
431
  }
432
432
  export async function createContextWithDefaultOptions(context) {
433
433
  const flattenUnionAsEnum = context.options["experimental-extensible-enums"] === undefined