From 70811720be890cd85eb5dbf95fca2dbf960973bd Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Mon, 6 Jan 2025 12:56:23 -0800 Subject: [PATCH] [flow][tests] Repro for broken get-def for esm module ref Summary: It has never really worked 100% of the time, because get-def for module ref depends on reasons, and the reason of namespaced export points to module ref itself. Recent change of `module.system.haste.module_ref_prefix.standard_cjs_esm_interop` under `experimental.module.automatic_require_default=true` has pushed the case of esm module with default export into the non-working case. This diff first documents the behavior that it's not working for esm modules with default exports without `experimental.module.automatic_require_default=true`, with fixes coming later in the stack. Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D67869373 fbshipit-source-id: 4791ddced87b1518a3251b67f999fdccd16c8799 --- tests/get_def2/ParentESM.js | 4 ++++ tests/get_def2/get_def2.exp | 4 ++++ tests/get_def2/module_ref.js | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 tests/get_def2/ParentESM.js diff --git a/tests/get_def2/ParentESM.js b/tests/get_def2/ParentESM.js new file mode 100644 index 00000000000..68169d9b02c --- /dev/null +++ b/tests/get_def2/ParentESM.js @@ -0,0 +1,4 @@ +// @flow + +const ParentFoo = {foo: 'bar'}; +export default {ParentFoo} diff --git a/tests/get_def2/get_def2.exp b/tests/get_def2/get_def2.exp index 90cf18a4638..fcbb89de4a9 100644 --- a/tests/get_def2/get_def2.exp +++ b/tests/get_def2/get_def2.exp @@ -138,6 +138,10 @@ module_ref.js:3:4 Flags: Parent.js:4:18,4:28 +module_ref.js:5:4 +Flags: +module_ref.js:5:1,5:15 + refinements.js:10:4 Flags: refinements.js:4:7,4:9 diff --git a/tests/get_def2/module_ref.js b/tests/get_def2/module_ref.js index 08ee5a06e09..debb1d0790b 100644 --- a/tests/get_def2/module_ref.js +++ b/tests/get_def2/module_ref.js @@ -2,3 +2,5 @@ 'm#./Parent'; // ^ +'m#./ParentESM'; +// ^