@@ -74,8 +74,9 @@ describe("transform", () => {
7474 )
7575 const expected = removeWhitespace ( `
7676 import { withLoaderWrapper as _withLoaderWrapper } from "react-router-devtools/server";
77- export { loader as _loader } from "./loader.js";
77+ import { loader as _loader } from "./loader.js";
7878 export const loader = _withLoaderWrapper(_loader, "test");
79+ export {} from "./loader.js";
7980 ` )
8081 expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
8182 } )
@@ -240,6 +241,24 @@ describe("transform", () => {
240241 ` )
241242 expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
242243 } )
244+
245+ it ( "should transform the client action export when it's re-exported from another file" , ( ) => {
246+ const result = augmentDataFetchingFunctions (
247+ `
248+ export { clientLoader } from "./clientLoader.js";
249+ ` ,
250+ "test" ,
251+ "/file/path"
252+ )
253+ const expected = removeWhitespace ( `
254+ import { withClientLoaderWrapper as _withClientLoaderWrapper } from "react-router-devtools/client";
255+ import { clientLoader as _clientLoader } from "./clientLoader.js";
256+ export const clientLoader = _withClientLoaderWrapper(_clientLoader, "test");
257+ export {} from "./clientLoader.js";
258+ ` )
259+ expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
260+ } )
261+
243262 it ( "should wrap the clientLoader export when it's exported via export { clientLoader } and declared within the file" , ( ) => {
244263 const result = augmentDataFetchingFunctions (
245264 `
@@ -338,8 +357,9 @@ describe("transform", () => {
338357 )
339358 const expected = removeWhitespace ( `
340359 import { withActionWrapper as _withActionWrapper } from "react-router-devtools/server";
341- export { action as _action } from "./action.js";
360+ import { action as _action } from "./action.js";
342361 export const action = _withActionWrapper(_action, "test");
362+ export {} from "./action.js";
343363 ` )
344364 expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
345365 } )
@@ -467,6 +487,23 @@ describe("transform", () => {
467487 expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
468488 } )
469489
490+ it ( "should transform the client action export when it's re-exported from another file" , ( ) => {
491+ const result = augmentDataFetchingFunctions (
492+ `
493+ export { clientAction } from "./clientAction.js";
494+ ` ,
495+ "test" ,
496+ "/file/path"
497+ )
498+ const expected = removeWhitespace ( `
499+ import { withClientActionWrapper as _withClientActionWrapper } from "react-router-devtools/client";
500+ import { clientAction as _clientAction } from "./clientAction.js";
501+ export const clientAction = _withClientActionWrapper(_clientAction, "test");
502+ export {} from "./clientAction.js";
503+ ` )
504+ expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
505+ } )
506+
470507 it ( "should transform the client action export when it's imported from another file and exported" , ( ) => {
471508 const result = augmentDataFetchingFunctions (
472509 `
@@ -512,3 +549,41 @@ describe("transform", () => {
512549 } )
513550 } )
514551} )
552+
553+ it ( "should transform the re-exports when it's re-exported from another file with multiple re-exports" , ( ) => {
554+ const result = augmentDataFetchingFunctions (
555+ `
556+ export { action, loader, default } from "./action.js";
557+ ` ,
558+ "test" ,
559+ "/file/path"
560+ )
561+ const expected = removeWhitespace ( `
562+ import { withActionWrapper as _withActionWrapper, withLoaderWrapper as _withLoaderWrapper } from "react-router-devtools/server";
563+ import { action as _action } from "./action.js";
564+ import { loader as _loader } from "./action.js";
565+ export const action = _withActionWrapper(_action, "test");
566+ export const loader = _withLoaderWrapper(_loader, "test");
567+ export { default } from "./action.js";
568+ ` )
569+ expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
570+ } )
571+
572+ it ( "should transform the re-exports when it's re-exported from another file with multiple re-exports" , ( ) => {
573+ const result = augmentDataFetchingFunctions (
574+ `
575+ export { action, loader, default, blah } from "./action.js";
576+ ` ,
577+ "test" ,
578+ "/file/path"
579+ )
580+ const expected = removeWhitespace ( `
581+ import { withActionWrapper as _withActionWrapper, withLoaderWrapper as _withLoaderWrapper } from "react-router-devtools/server";
582+ import { action as _action } from "./action.js";
583+ import { loader as _loader } from "./action.js";
584+ export const action = _withActionWrapper(_action, "test");
585+ export const loader = _withLoaderWrapper(_loader, "test");
586+ export { default, blah } from "./action.js";
587+ ` )
588+ expect ( removeWhitespace ( result . code ) ) . toStrictEqual ( expected )
589+ } )
0 commit comments