example: add cross-package SharedTree schema consumption example #26522
Open
WillieHabi wants to merge 7 commits intomicrosoft:mainfrom
Open
example: add cross-package SharedTree schema consumption example #26522WillieHabi wants to merge 7 commits intomicrosoft:mainfrom
WillieHabi wants to merge 7 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new examples/utils/cross-package-schema two-package example intended to demonstrate consuming SharedTree objectAlpha() schemas across package boundaries by using TypeScript customConditions: ["source"] and a "source" export condition to bypass problematic .d.ts path normalization under TS 5.9 + moduleResolution: "bundler".
Changes:
- Add a new
schema-providerpackage exporting SharedTree schema classes with a"source"export condition and a TS 5.9 “bundler” build mode to reproduce the.d.tsissue. - Add a new
schema-consumerpackage that imports the provider’s schemas and demonstrates success/failure with and withoutcustomConditions: ["source"]. - Add documentation and lockfile updates to wire the new example packages into the repo.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds new workspace importers for the provider/consumer example packages and updates a dependency resolution entry. |
| examples/utils/cross-package-schema/README.md | Documents the problem, the "source"-condition workaround, and verification steps. |
| examples/utils/cross-package-schema/schema-provider/package.json | Defines the provider package exports (including "source"), build scripts, and dependencies. |
| examples/utils/cross-package-schema/schema-provider/tsconfig.json | Provider baseline TS config for Node16 resolution output to lib. |
| examples/utils/cross-package-schema/schema-provider/tsconfig.bundler.json | Provider TS 5.9+ bundler-resolution config to reproduce .d.ts normalization. |
| examples/utils/cross-package-schema/schema-provider/src/schema.ts | Declares a small set of objectAlpha()-based schema classes to export. |
| examples/utils/cross-package-schema/schema-provider/src/index.ts | Re-exports the provider schema classes as the public entrypoint. |
| examples/utils/cross-package-schema/schema-provider/eslint.config.mts | Adds local ESLint flat-config wiring consistent with other examples. |
| examples/utils/cross-package-schema/schema-consumer/package.json | Defines the consumer package scripts for the “with source condition” pass and “without source condition” failure demonstration. |
| examples/utils/cross-package-schema/schema-consumer/tsconfig.json | Enables customConditions: ["source"] for the success-path typecheck. |
| examples/utils/cross-package-schema/schema-consumer/tsconfig.no-source.json | Consumer TS config variant that omits customConditions to reproduce the failure. |
| examples/utils/cross-package-schema/schema-consumer/src/consume.ts | Imports provider schemas and constructs a TreeViewConfiguration to validate compatibility. |
| examples/utils/cross-package-schema/schema-consumer/src/index.ts | Re-exports the consumer example entrypoint/types. |
| examples/utils/cross-package-schema/schema-consumer/eslint.config.mts | Adds local ESLint flat-config wiring consistent with other examples. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
examples/utils/cross-package-schema/schema-consumer/src/consume.ts
Outdated
Show resolved
Hide resolved
examples/utils/cross-package-schema/schema-provider/package.json
Outdated
Show resolved
Hide resolved
examples/utils/cross-package-schema/schema-consumer/package.json
Outdated
Show resolved
Hide resolved
Contributor
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a minimal two-package example (schema-provider + schema-consumer) demonstrating how to consume SharedTree schemas across package boundaries using a /schema subpath export whose "types" field points directly to .ts source.
When objectAlpha() schemas are compiled with TypeScript 5.9+ and moduleResolution: "bundler", consumers importing through .d.ts see:
The /schema subpath export lets consumers resolve .ts source directly, bypassing the broken .d.ts.
This example serves as proof of viability for SharedTree schema definitions being extracted into separate packages for cross-package consumption.
Reviewer Guidance