Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-41-29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@typespec/emitter-framework"
---

Add DeclarationProvider, a mechanism to reactively track declarations discovered as they are emitted.
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-43-16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: breaking
packages:
- "@typespec/emitter-framework"
---

TypeScript: Adopt DeclarationProvider, which changes how refkeys to declarations are assigned and referenced. The current provider vends fresh refkeys when needed, so `refkey(type)` is no longer a viable way to refer to declarations created by the emitter framework. Replace all forms of `refkey(type)` with `dp.getRefkey(type)`.
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-43-33.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-js"
---

Adopt EF changes.
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-44-18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-client-js"
---

Don't emit types for built-ins like floats and such (which were unused anyway).
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-45-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-client-js"
---

Emit types for model is `Record<T>`.
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-49-58.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: breaking
packages:
- "@typespec/emitter-framework"
---

TypeScript: remove notion of suffix refkey. Since its purpose is to create a unique refkey based on the suffix, users can just provide such a refkey instead of providing the suffix.
7 changes: 7 additions & 0 deletions .chronus/changes/decl-provider-2026-0-15-15-51-26.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@typespec/emitter-framework"
---

Add `refkey` option to `buildParameterDescriptor`.
5 changes: 5 additions & 0 deletions packages/emitter-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@
},
"exports": {
".": {
"development": "./src/core/index.ts",
"import": "./dist/src/core/index.js"
},
"./csharp": {
"development": "./src/csharp/index.ts",
"import": "./dist/src/csharp/index.js"
},
"./typescript": {
"development": "./src/typescript/index.ts",
"import": "./dist/src/typescript/index.js"
},
"./python": {
"development": "./src/python/index.ts",
"import": "./dist/src/python/index.js"
},
"./testing": {
"development": "./src/testing/index.ts",
"import": "./dist/src/testing/index.js"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DeclarationProvider } from "#core/declaration-provider.js";
import { type ComponentContext, createNamedContext, useContext } from "@alloy-js/core";
import type { Typekit } from "@typespec/compiler/typekit";
import { useTsp } from "./tsp-context.js";

/**
* Provides the declaration provider that is used to get refkeys for
* declarations and determine if a type should be declared or referenced.
*/
export const DeclarationProviderContext: ComponentContext<DeclarationProvider> =
createNamedContext<DeclarationProvider>("DeclarationProviderContext");

export function useDeclarationProvider(): DeclarationProvider {
return useContext(DeclarationProviderContext) ?? getDefaultDeclarationProvider(useTsp().$);
}

const knownDeclarationProviders = new WeakMap<Typekit, DeclarationProvider>();
function getDefaultDeclarationProvider($: Typekit) {
let provider = knownDeclarationProviders.get($);
if (!provider) {
provider = new DeclarationProvider($);
knownDeclarationProviders.set($, provider);
}
return provider;
}
1 change: 1 addition & 0 deletions packages/emitter-framework/src/core/context/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./declaration-provider.js";
export * from "./name-policy-context.js";
export * from "./tsp-context.js";
Loading
Loading