diff --git a/crates/turbopack-ecmascript/js/src/runtime.js b/crates/turbopack-ecmascript/js/src/runtime.js index 69245c71bd00a..63328f82b7193 100644 --- a/crates/turbopack-ecmascript/js/src/runtime.js +++ b/crates/turbopack-ecmascript/js/src/runtime.js @@ -891,6 +891,10 @@ // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-ecmascript/js/types/hot.d.ts b/crates/turbopack-ecmascript/js/types/hot.d.ts index 4eab4fd343e5a..cefa70406da6b 100644 --- a/crates/turbopack-ecmascript/js/types/hot.d.ts +++ b/crates/turbopack-ecmascript/js/types/hot.d.ts @@ -4,6 +4,8 @@ export const enum HotUpdateStatus { idle = "idle", } +export type HotUpdateStatusHandler = (status: HotUpdateStatus) => void; + export interface HotData { prevExports?: Exports; } @@ -37,8 +39,6 @@ export interface Hot { active: boolean; data: HotData; - status: () => keyof typeof HotUpdateStatus; - accept: AcceptFunction; decline: (module?: string | string[]) => void; @@ -50,4 +50,8 @@ export interface Hot { removeDisposeHandler: (callback: (data: object) => void) => void; invalidate: () => void; + + status: () => keyof typeof HotUpdateStatus; + addStatusHandler: (handler: HotUpdateStatusHandler) => void; + removeStatusHandler: (handler: HotUpdateStatusHandler) => void; } diff --git a/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_9be35c.js b/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_9be35c.js index b2f88f0ee4dd5..076041d09aac6 100644 --- a/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_9be35c.js +++ b/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_9be35c.js @@ -913,6 +913,10 @@ __turbopack_export_value__((__turbopack_import__) => { // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_b11d49.js b/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_b11d49.js index 9714bf8521640..f7bbfa3e2863a 100644 --- a/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_b11d49.js +++ b/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_b11d49.js @@ -905,6 +905,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$ // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_907a50.js b/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_907a50.js index 6e1552b638029..bfdb0c04303f4 100644 --- a/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_907a50.js +++ b/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_907a50.js @@ -918,6 +918,10 @@ __turbopack_export_value__({ // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_733269.js b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_733269.js index febbf7e998270..3ba4c83e269aa 100644 --- a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_733269.js +++ b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_733269.js @@ -921,6 +921,10 @@ console.log(StyledButton, ClassNameButton); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_480486.js b/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_480486.js index 3872425a63106..9f9930359da39 100644 --- a/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_480486.js +++ b/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_480486.js @@ -911,6 +911,10 @@ instantiateRuntimeModule("[project]/crates/turbopack-tests/tests/snapshot/env/en // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_50fbca.js b/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_50fbca.js index b1595d9148613..727d6b91a8632 100644 --- a/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_50fbca.js +++ b/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_50fbca.js @@ -902,6 +902,10 @@ console.log("hello world"); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_a7beb7.js b/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_a7beb7.js index 74db6c6baa3c3..77c3feebe00ed 100644 --- a/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_a7beb7.js +++ b/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_a7beb7.js @@ -902,6 +902,10 @@ console.log("hello world"); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_e24981.js b/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_e24981.js index 14a11036f8501..00339ec377cd4 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_e24981.js +++ b/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_e24981.js @@ -916,6 +916,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_e00120.js b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_e00120.js index 4484d61016df2..9f29a70562e96 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_e00120.js +++ b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_e00120.js @@ -907,6 +907,10 @@ console.log(dne); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_1a5dd4.js b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_1a5dd4.js index c65f2fa7b49bc..b984c0729c519 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_1a5dd4.js +++ b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_1a5dd4.js @@ -910,6 +910,10 @@ console.log({}[dne]); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_b8717b.js b/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_b8717b.js index e9c31c4013415..4470b1a50c426 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_b8717b.js +++ b/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_b8717b.js @@ -909,6 +909,10 @@ __turbopack_export_value__("/crates/turbopack-tests/tests/snapshot/imports/stati // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_7b57d9.js b/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_7b57d9.js index b03b26e7c7265..b787aa7a23161 100644 --- a/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_7b57d9.js +++ b/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_7b57d9.js @@ -911,6 +911,10 @@ console.log(MyButton); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_94a35f.js b/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_94a35f.js index a263d6289d381..95541a135b8c4 100644 --- a/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_94a35f.js +++ b/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_94a35f.js @@ -907,6 +907,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_44c34f.js b/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_44c34f.js index 0e39ed2d51c13..4849ff4065ec1 100644 --- a/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_44c34f.js +++ b/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_44c34f.js @@ -909,6 +909,10 @@ console.log(Foo, [].includes("foo")); // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState }; diff --git a/crates/turbopack-tests/tests/snapshot/tsconfig/baseurl/output/crates_turbopack-tests_tests_snapshot_tsconfig_baseurl_input_index_5906e5.js b/crates/turbopack-tests/tests/snapshot/tsconfig/baseurl/output/crates_turbopack-tests_tests_snapshot_tsconfig_baseurl_input_index_5906e5.js index c4d0e9f99f3f1..480cdccebb022 100644 --- a/crates/turbopack-tests/tests/snapshot/tsconfig/baseurl/output/crates_turbopack-tests_tests_snapshot_tsconfig_baseurl_input_index_5906e5.js +++ b/crates/turbopack-tests/tests/snapshot/tsconfig/baseurl/output/crates_turbopack-tests_tests_snapshot_tsconfig_baseurl_input_index_5906e5.js @@ -903,6 +903,10 @@ throw e; // implement, but the Next.js React Refresh runtime uses this to decide // whether to schedule an update. status: () => "idle", + + // NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops. + addStatusHandler: (_handler) => {}, + removeStatusHandler: (_handler) => {}, }; return { hot, hotState };