Skip to content

Nest 1/4: typed shims for platform-node's dependencies - #6

Draft
puskuruk wants to merge 29 commits into
nest/basefrom
nest/platform-node-shims
Draft

puskuruk wants to merge 29 commits into
nest/basefrom
nest/platform-node-shims

Conversation

@puskuruk

@puskuruk puskuruk commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Typed ports of the 24 npm packages @nestjs/platform-node 12.5.1 pulls in (find-my-way, send, body-parser's parsers, cookie, type-is, mime-types and the rest), under runtime/node/nest/shims, each checked against its pinned npm original by a parity table. scripts/build.mjs resolves the shim packages from there.

Base branch nest/base is main plus #4 (http surface) at its tip 4f6ecdc. Retarget to main once #4 merges.

29 commits: tools/nest pins the originals, the mime-db table is generated, one commit per shim ending with find-my-way and send, and a last one moving the references to what platform-node 12.5.1 installs (find-my-way 9.10.0, on-finished 2.4.2, qs 6.17.1 with its shim, secure-json-parse 4.1.1).

Verification on 4f1d62a, macOS arm64: tools/nest npm run check → 24 shim tables passed, 0 failed (statuses 174 cases, qs 7,670, type-is 16,080, …); node --test scripts/test-package.mjs → 6 pass.

Related

Stack: this PR → #7 (2/4, vendor) → #8 (3/4, AOT) → #9 (4/4, benchmark). Base nest/base carries #4; retarget to main after it merges.

Summary by CodeRabbit

  • New Features
    • Added Node runtime support for HTTP routing and static file serving, including URL handling, path patterns, and request completion events.
    • Added utilities for cookies, content types, MIME types, cache validation, entity tags, HTTP errors and statuses, and response ranges.
    • Added query-string parsing, secure JSON parsing, HTML escaping, URL encoding, regular-expression safety checks, and duration formatting.
  • Chores
    • Added tools to generate and validate MIME and Unicode data, and check compatibility across the new runtime utilities.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

No actionable comments were generated in the recent review.

Walkthrough

This PR adds TypeScript shims for Nest runtime dependencies, including request parsing, routing, HTTP utilities, and file serving. It also adds build-resolution mappings, MIME and Unicode identifier generators, type-checking configuration, and parity tests.

Changes: Nest runtime compatibility

Layer / File(s) Summary
Content, media, and cookie utilities
runtime/node/nest/shims/content-type/*, runtime/node/nest/shims/cookie/*, runtime/node/nest/shims/cookie-signature/*, runtime/node/nest/shims/encodeurl/*, runtime/node/nest/shims/escape-html/*, runtime/node/nest/shims/etag/*, runtime/node/nest/shims/fresh/*, runtime/node/nest/shims/media-typer/*, runtime/node/nest/shims/mime-types/*, runtime/node/nest/shims/type-is/*, tools/nest/generate-mime-db.mjs, tools/nest/parity/*
The shims add content-type and cookie parsing and formatting, media-type parsing, MIME lookup, request content-type matching, and related HTTP utilities. The MIME generator creates records, and parity tests compare shim operations with original implementations.
Query and JSON parsing
runtime/node/nest/shims/fast-querystring/*, runtime/node/nest/shims/qs/*, runtime/node/nest/shims/secure-json-parse/*, tools/nest/parity/fast-querystring.mjs, tools/nest/parity/qs.mjs, tools/nest/parity/secure-json-parse.mjs
The query-string shims add parsing and stringification, including nested values and parser options. The secure JSON shim adds parsing and scans for configured prototype-related properties. Parity tests compare these operations with original implementations.
Route matching and path patterns
runtime/node/nest/shims/find-my-way/*, runtime/node/nest/shims/path-to-regexp/*, runtime/node/nest/shims/ret/*, runtime/node/nest/shims/safe-regex2/*, tools/nest/generate-identifier-ranges.mjs, tools/nest/parity/find-my-way*.mjs, tools/nest/parity/path-to-regexp.mjs, tools/nest/parity/ret.mjs, tools/nest/parity/safe-regex2.mjs
The router adds route registration, constraint handling, lookup, removal, and pretty-printing. Related shims add URL sanitization, path-pattern operations, regex tokenization, and regex safety checks. Parity tests cover these APIs and router behavior.
HTTP validators, status, and lifecycle utilities
runtime/node/nest/shims/ms/*, runtime/node/nest/shims/on-finished/*, runtime/node/nest/shims/range-parser/*, runtime/node/nest/shims/statuses/*, tools/nest/parity/ms.mjs, tools/nest/parity/on-finished.mjs, tools/nest/parity/range-parser.mjs, tools/nest/parity/statuses.mjs
The shims add duration formatting, completion listeners, range parsing, and status helpers. Parity tests compare return values, errors, and completion-event behavior with original implementations.
HTTP file serving
runtime/node/nest/shims/send/*, tools/nest/parity/send.mjs
The send shim adds file lookup and streaming with path policies, directory and extension handling, conditional requests, byte ranges, response headers, and stream events. Its parity tests compare responses and events across file-serving cases.
Build resolution and shim validation
scripts/build.mjs, scripts/builtin-modules.mjs, tools/nest/package.json, tools/nest/test-shims.mjs, tools/nest/tsconfig.shims.json
Build resolution maps Nest platform and shim TypeScript files, and builtin collection skips the Nest directory. The tools package adds scripts and dependencies. The test runner transpiles shims and runs available parity tables, while the TypeScript configuration checks shim files.

Estimated code review effort: 5 (Critical) | ~120 minutes

Change: Feature

Suggested reviewers: dashersw

Merge Risk: Low · previous review 666b6

This PR adds typed ports of the Nest platform-node dependencies and a parity harness. The range-parsing behavior matches the pinned npm packages. Open items are mostly small compatibility gaps, a few performance and robustness issues, and test-tooling weaknesses, which should be tracked before or soon after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Nest 1/4: typed shims for platform-node's dependencies" matches the main change. The PR adds typed TypeScript shims for the 24 npm packages that @nestjs/platform-node depends on, under runt…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Nest 1/4: typed shims for platform-node's dependencies" matches the main change. The PR adds typed TypeScript shims for the 24 npm packages that @nestjs/platform-node depends on, under runtime/node/nest/shims. The changeset also includes parity tests, build script updates, and tooling, which the title does not list. The title names the primary change and uses a stack prefix (1/4) that signals the PR's place in a series.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e3fdc0f-e708-42e2-a248-0fa6e4002249
Commits

Reviewing files that changed from the base of the PR and between f5111f7 and 666b6c1.

Files ignored due to path filters: 3

  • runtime/node/nest/shims/mime-db/db.generated.ts is excluded by !**/*.generated.*
  • runtime/node/nest/shims/path-to-regexp/identifier.generated.ts is excluded by !**/*.generated.*
  • tools/nest/package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 3

  • runtime/node/nest/shims/send/index.ts
  • tools/nest/generate-identifier-ranges.mjs
  • tools/nest/parity/send.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@puskuruk

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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.

@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from d5a4a03 to 042166f Compare October 20, 2026 04:33
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from 042166f to 10329f6 Compare October 23, 2026 01:48
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from 10329f6 to b9b72d5 Compare October 23, 2026 09:17
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from b9b72d5 to 6e0734e Compare November 10, 2026 10:57
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from 6e0734e to ad478fd Compare November 12, 2026 08:50
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from ad478fd to 72811b7 Compare November 12, 2026 09:17
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch 2 times, most recently from 4f1d62a to f9f9e3e Compare November 21, 2026 10:18
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from f9f9e3e to d9b5aa0 Compare November 21, 2026 11:09
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from d9b5aa0 to a646bda Compare November 21, 2026 11:50
@puskuruk

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

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.

…, optional params, backtracking, constraints, off/findRoute/prettyPrint) with its parity table over the package's documented route grammar and options
…eam and on-finished) with its parity table over a fixture tree
…he qs shim to 6.17.1

platform-node 12.5.1 pins find-my-way 9.10.0, on-finished 2.4.2, qs 6.17.1 and secure-json-parse 4.1.1. qs 6.17.1 keeps a value merged into an object within arrayLimit, counts only the present elements of a sparse array, tracks repeated conflicts on one key, decodes astral numeric entities to surrogate pairs and guards a depth-0 key by its bracketed name. The parity table gains inputs where 6.15.3 and 6.17.1 differ.
@puskuruk
puskuruk force-pushed the nest/platform-node-shims branch from 666b6c1 to 633e50d Compare November 21, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant