From 394ed9310ceb5cb92f116d58056e2b7521d51922 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 25 Aug 2022 15:27:30 +0800 Subject: [PATCH 1/3] findSourceMap return null since Node.js 18.8.0 --- lib/snapshot-manager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/snapshot-manager.js b/lib/snapshot-manager.js index 3e3b4b89d..09f342324 100644 --- a/lib/snapshot-manager.js +++ b/lib/snapshot-manager.js @@ -391,7 +391,10 @@ class Manager { const resolveSourceFile = mem(file => { const sourceMap = findSourceMap(file); - if (sourceMap === undefined) { + // since Node.js 18.8.0, the return value of `findSourceMap` changed to null if not found + // it was `undefined` in previous version + // https://github.com/nodejs/node/pull/43875 + if (sourceMap == undefined) { return file; } From 38d316f98ac9b84e1db76a28d5972241cc16e68f Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 25 Aug 2022 16:27:10 +0800 Subject: [PATCH 2/3] Apply CR suggestion --- lib/snapshot-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/snapshot-manager.js b/lib/snapshot-manager.js index 09f342324..e9a1a96a5 100644 --- a/lib/snapshot-manager.js +++ b/lib/snapshot-manager.js @@ -394,7 +394,7 @@ const resolveSourceFile = mem(file => { // since Node.js 18.8.0, the return value of `findSourceMap` changed to null if not found // it was `undefined` in previous version // https://github.com/nodejs/node/pull/43875 - if (sourceMap == undefined) { + if (sourceMap === undefined || sourceMap === null) { return file; } From 7fd93117133bf6156377386238a6c36e2f85810a Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Thu, 25 Aug 2022 14:38:53 +0200 Subject: [PATCH 3/3] Amend comment --- lib/snapshot-manager.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/snapshot-manager.js b/lib/snapshot-manager.js index e9a1a96a5..c0a8922ec 100644 --- a/lib/snapshot-manager.js +++ b/lib/snapshot-manager.js @@ -391,9 +391,8 @@ class Manager { const resolveSourceFile = mem(file => { const sourceMap = findSourceMap(file); - // since Node.js 18.8.0, the return value of `findSourceMap` changed to null if not found - // it was `undefined` in previous version - // https://github.com/nodejs/node/pull/43875 + // Prior to Node.js 18.8.0, the value when a source map could not be found was `undefined`. + // This changed to `null` in . Check both. if (sourceMap === undefined || sourceMap === null) { return file; }