Skip to content

feat(v27): Async loading TypeScript by Integration#3149

Merged
RobinTail merged 29 commits intomake-v27from
async-load-ts-integration
Dec 28, 2025
Merged

feat(v27): Async loading TypeScript by Integration#3149
RobinTail merged 29 commits intomake-v27from
async-load-ts-integration

Conversation

@RobinTail
Copy link
Copy Markdown
Owner

@RobinTail RobinTail commented Dec 27, 2025

The better implementation of #3139 using the dynamic import() instead of createRequire().

The new implementation requires either:

  • to import and provide the typescript to Integration::constructor()
  • or to use the new async method Integration::create()

This is a breaking change.

typescript becomes an optional peer dependency. Documentation adjusted accordingly.

Summary by CodeRabbit

  • Documentation

    • Updated README installation section to clarify TypeScript handling.
    • Enhanced frontend client generation examples with explicit TypeScript configuration instructions and usage patterns.
  • New Features

    • Added async factory method for integration setup, offering alternative to direct instantiation.
    • Made TypeScript an optional peer dependency instead of required, reducing installation footprint.

✏️ Tip: You can customize this high-level summary in your review settings.

@RobinTail RobinTail added enhancement New feature or request refactoring The better way to achieve the same result breaking Backward incompatible changes labels Dec 27, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 27, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes refactor TypeScript compilation API integration to use constructor-based dependency injection instead of dynamic loading, introduce a string-based identifier system to replace TypeScript Identifier objects throughout the codebase, and add an async factory pattern (Integration.create()) with optional TypeScript peer dependency support.

Changes

Cohort / File(s) Summary
Documentation & Examples
README.md, example/generate-client.ts
Updated installation guidance to clarify TypeScript is optional; enhanced examples to explicitly import and pass TypeScript module to Integration constructor.
Linting Configuration
eslint.config.js
Added ESLint rule for TypeScript AST transformations, suggesting makeId() helper instead of createIdentifier for identifier creation.
Package Configuration
express-zod-api/package.json
Marked TypeScript as an optional peer dependency via peerDependenciesMeta.typescript.
Integration Core API
express-zod-api/src/integration.ts, express-zod-api/src/integration-base.ts
Added typescript parameter to IntegrationParams and constructor; introduced new static Integration.create() async factory for lazy TypeScript loading; updated super calls to pass typescript to base class; converted method references from static identifiers to dynamic makeXxx() calls.
TypeScript API Layer
express-zod-api/src/typescript-api.ts
Changed constructor to accept TypeScript module as argument instead of dynamic require; introduced public makeId(name: string) helper; refactored all public methods to accept and work with string-based names/identifiers instead of ts.Identifier objects (e.g., makePublicMethod, makeDeconstruction, makeParam, makeTernary, makeCall, makeNew, makeAssignment).
Test Suite
express-zod-api/tests/integration.spec.ts, express-zod-api/tests/zts.spec.ts
Updated to use async Integration.create() factory instead of synchronous constructor; modified TypescriptAPI instantiation to pass ts module to constructor.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • v26 is for Lia Smith #2939: Modifies IntegrationParams and Integration constructor signature to add a config parameter and adjust constructor usage patterns in the same core integration files.
  • Memory usage optimization #3139: Addresses TypeScript runtime loading surface within TypescriptAPI and Integration; the referenced PR uses dynamic createRequire while this PR refactors to constructor-injected TypeScript with lazy loading via Integration.create().
  • chores: tsconfig module: node20 and import extensions #2974: Touches the same trio of files (integration.ts, integration-base.ts, typescript-api.ts); the referenced PR normalizes import specifiers while this PR introduces substantive API and runtime-injection changes.

Poem

🐰 String identifiers hop where Identifiers once stood,
Lazy TypeScript loads just when it should,
Dependencies injected, sweet and clean,
The finest refactor this rabbit's seen! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: replacing synchronous TypeScript loading with async loading via the Integration class, which is the core objective of this breaking change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread express-zod-api/src/integration-base.ts Outdated
@coveralls-official
Copy link
Copy Markdown

coveralls-official Bot commented Dec 27, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 0a76baa on async-load-ts-integration
into 3d369bb on make-v27.

@RobinTail RobinTail added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file labels Dec 27, 2025
@RobinTail RobinTail force-pushed the async-load-ts-integration branch from bfe8bc0 to 2be687a Compare December 27, 2025 11:05
@RobinTail RobinTail marked this pull request as ready for review December 27, 2025 11:05
@RobinTail
Copy link
Copy Markdown
Owner Author

@coderabbitai please review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 27, 2025

@RobinTail, I'll review the changes in this PR for you.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Repository owner deleted a comment from pullfrog Bot Dec 27, 2025
Copy link
Copy Markdown
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

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

reviewed, but changelog and migration are requried

@RobinTail RobinTail merged commit c6434fe into make-v27 Dec 28, 2025
13 checks passed
@RobinTail RobinTail deleted the async-load-ts-integration branch December 28, 2025 05:31
@RobinTail RobinTail removed the refactoring The better way to achieve the same result label Dec 28, 2025
@RobinTail RobinTail added this to the v27 milestone Dec 28, 2025
RobinTail added a commit that referenced this pull request Feb 1, 2026
<img width="1200" height="630" alt="image"
src="https://github.com/user-attachments/assets/5af2b247-bd39-4481-98a4-0ab6586afe49"
/>

Nikki Kuhnhausen was 17 years young transgender woman. She was murdered
by David Bogdanov in 2019. Her body was identified from decayed remains
on December 7th, in the Larch Mountain area near Vancouver, Washington.
Authorities were able to identify the body from personal effects;
subsequent examination showed she died from strangulation. Nikki had
previously been missing since June 5th when she left with David
Bogdanov, a 25-year-old male she met in Snapchat, who has since been
charged with second degree murder. Authorities believe that Bogdanov,
looking for a sexual encounter, became enraged upon learning of Nikki's
transgender origins.


https://katu.com/news/local/missing-vancouver-teen-nikki-kuhnhausen-found-dead-in-remote-clark-county-location-suspect-arrested

Transgender women suffer too frequently from transphobic violence and
cruelty, being the less protected social group. I'd like to raise an
awareness of this problem. Humans should be creators — not killers. But
most importantly, I want every transgender girl to have an opportunity
to create applications quickly and, in general, learn to write code
easily in order to receive job offers and leave dangerously transphobic
territories for more favorable and civilized ones, and live happily
there. Protect transgender women.

------------------

Version 27 makes `typescript` an optional peer dependency with explicit
injection of the manually imported module into the `Integration` class
constructor (`new Integration({ typescript, ... })`), or by calling the
new async `Integration.create()` factory method for automatic loading.
The Zod Plugin now leverages Zod 4.3's inheritable metadata feature,
removing the need for `pack()` and `unpack()` helpers while simplifying
brand handling by storing brands in standard metadata under `x-brand`
property.

- #3149 
- #3162 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Async Integration.create() factory and optional TypeScript injection
for client generation
  * Zod metadata is inheritable (requires Zod ^4.3.4)

* **Breaking Changes**
* pack/unpack/setBrand removed; branding exposed as "x-brand" via
schema.meta()
* Integration constructor now accepts a typescript option and usage may
require async create()

* **Documentation**
  * Examples updated for TypeScript injection and async create() usage

* **Chores**
  * Version bumps to v27 beta and updated CI branch targets

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Mar 8, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Backward incompatible changes dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant