Files
next.js/patches/@[email protected]
T
danandGitHub faa3bdf7f1 Bump @types/node to 20.17.7 to fix findSourceMap type (#96321)
Fixes
https://github.com/vercel/next.js/pull/96198#discussion_r3666434724.

Bumps the pinned `@types/node` version to `20.17.7` to get an upstream
fix for `findSourceMap` type.

Also regenerates the pnpm patch due to a conflict.

I upgraded by just a patch because I'm not sure if we rely on being on
an old version here.

## Test Plan

`findSourceMap` now shows correct types.

<img width="694" height="335" alt="Screenshot 2026-07-29 at 01 02 48"
src="https://github.com/user-attachments/assets/cfe740e0-b8bf-4edc-ac27-698f926feb32"
/>
2026-07-29 01:28:48 +01:00

40 lines
1.3 KiB
Diff

diff --git a/module.d.ts b/module.d.ts
index 73b88af8b53babda5843dc5d4bb3b2a9b14d053b..6ecfa95f38c81421a49bc055bfff87a4f9dcc51c 100644
--- a/module.d.ts
+++ b/module.d.ts
@@ -49,7 +49,25 @@ declare module "module" {
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
*/
function findSourceMap(path: string, error?: Error): SourceMap | undefined;
- interface SourceMapPayload {
+ /**
+ * https://tc39.es/source-map/#index-map
+ */
+ interface IndexSourceMapSection {
+ offset: {
+ line: number
+ column: number
+ }
+ map: BasicSourceMapPayload
+ }
+
+ // TODO(veil): Upstream types
+ /** https://tc39.es/ecma426/#sec-index-source-map */
+ interface IndexSourceMap {
+ version: number
+ file: string
+ sections: IndexSourceMapSection[]
+ }
+ interface BasicSourceMapPayload {
file: string;
version: number;
sources: string[];
@@ -58,6 +76,7 @@ declare module "module" {
mappings: string;
sourceRoot: string;
}
+ type SourceMapPayload = BasicSourceMapPayload | IndexSourceMap;
interface SourceMapping {
generatedLine: number;
generatedColumn: number;