[PR #586] [MERGED] feat: support next/dist/* internal imports and auto-generate .js shim aliases #689

Closed
opened 2026-05-06 13:09:34 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/586
Author: @james-elicx
Created: 3/19/2026
Status: Merged
Merged: 3/19/2026
Merged by: @james-elicx

Base: mainHead: feat/router-context-bare-alias


📝 Commits (6)

  • d39e06b feat: add bare next/dist/shared/lib/router-context alias and strengthen test
  • 7acbdce feat: add next/dist/shared/lib/router-context to IMPORT_SUPPORT check map
  • 0e705ae fix: remove bare router-context alias, only .shared-runtime exists in Next.js
  • dcc7e28 feat: add all shimmed next/dist/* paths to IMPORT_SUPPORT check map
  • c7fed41 refactor: auto-generate .js alias variants via flatMap in nextShimMap
  • cae78cb limit .js map to next/

📊 Changes

4 files changed (+191 additions, -110 deletions)

View changed files

📝 packages/vinext/src/check.ts (+53 -0)
📝 packages/vinext/src/index.ts (+98 -109)
📝 tests/check.test.ts (+36 -0)
📝 tests/shims.test.ts (+4 -1)

📄 Description

Summary

  • Replaces the manually duplicated "next/link" + "next/link.js" pairs in nextShimMap with a flatMap that auto-generates the .js variant for every entry, removing ~50 lines of repetition and ensuring new shims automatically get their .js alias
  • Adds next/dist/shared/lib/router-context.shared-runtime and all other shimmed next/dist/* internal paths to the IMPORT_SUPPORT map in check.ts, so vinext check reports them as supported rather than "not recognized by vinext":
    • next/dist/shared/lib/router-context.shared-runtime
    • next/dist/shared/lib/app-router-context.shared-runtime
    • next/dist/shared/lib/app-router-context
    • next/dist/shared/lib/utils
    • next/dist/server/api-utils
    • next/dist/server/web/spec-extension/cookies
    • next/dist/compiled/@edge-runtime/cookies
    • next/dist/server/app-render/work-unit-async-storage.external
    • next/dist/client/components/work-unit-async-storage.external
    • next/dist/client/components/request-async-storage.external
    • next/dist/client/components/request-async-storage
    • next/dist/client/components/navigation
    • next/dist/server/config-shared
  • Strengthens the router-context shim test to assert Provider and Consumer are present
  • Adds test coverage in check.test.ts for all new IMPORT_SUPPORT entries

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/586 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/19/2026 **Status:** ✅ Merged **Merged:** 3/19/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `feat/router-context-bare-alias` --- ### 📝 Commits (6) - [`d39e06b`](https://github.com/cloudflare/vinext/commit/d39e06b13ec94eb2638c7bdb627bc5b1140a6958) feat: add bare next/dist/shared/lib/router-context alias and strengthen test - [`7acbdce`](https://github.com/cloudflare/vinext/commit/7acbdce74abf18c106660aea91787f3e90e0f7dc) feat: add next/dist/shared/lib/router-context to IMPORT_SUPPORT check map - [`0e705ae`](https://github.com/cloudflare/vinext/commit/0e705ae55528214683014542e9d4aa714c1aea0a) fix: remove bare router-context alias, only .shared-runtime exists in Next.js - [`dcc7e28`](https://github.com/cloudflare/vinext/commit/dcc7e28508dd6c86f1f2bca5b30cb1c774b13ed7) feat: add all shimmed next/dist/* paths to IMPORT_SUPPORT check map - [`c7fed41`](https://github.com/cloudflare/vinext/commit/c7fed41db759dc3933a67c345d5f48e873d614ea) refactor: auto-generate .js alias variants via flatMap in nextShimMap - [`cae78cb`](https://github.com/cloudflare/vinext/commit/cae78cbc074b50bc932fff44cdae1838f5478de8) limit .js map to next/ ### 📊 Changes **4 files changed** (+191 additions, -110 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/check.ts` (+53 -0) 📝 `packages/vinext/src/index.ts` (+98 -109) 📝 `tests/check.test.ts` (+36 -0) 📝 `tests/shims.test.ts` (+4 -1) </details> ### 📄 Description ## Summary - Replaces the manually duplicated `"next/link"` + `"next/link.js"` pairs in `nextShimMap` with a `flatMap` that auto-generates the `.js` variant for every entry, removing ~50 lines of repetition and ensuring new shims automatically get their `.js` alias - Adds `next/dist/shared/lib/router-context.shared-runtime` and all other shimmed `next/dist/*` internal paths to the `IMPORT_SUPPORT` map in `check.ts`, so `vinext check` reports them as supported rather than "not recognized by vinext": - `next/dist/shared/lib/router-context.shared-runtime` - `next/dist/shared/lib/app-router-context.shared-runtime` - `next/dist/shared/lib/app-router-context` - `next/dist/shared/lib/utils` - `next/dist/server/api-utils` - `next/dist/server/web/spec-extension/cookies` - `next/dist/compiled/@edge-runtime/cookies` - `next/dist/server/app-render/work-unit-async-storage.external` - `next/dist/client/components/work-unit-async-storage.external` - `next/dist/client/components/request-async-storage.external` - `next/dist/client/components/request-async-storage` - `next/dist/client/components/navigation` - `next/dist/server/config-shared` - Strengthens the `router-context` shim test to assert `Provider` and `Consumer` are present - Adds test coverage in `check.test.ts` for all new `IMPORT_SUPPORT` entries --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:34 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#689
No description provided.