-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support modern.js data action (#4736)
- Loading branch information
Showing
42 changed files
with
1,097 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 18 additions & 34 deletions
52
packages/cli/plugin-data-loader/src/cli/generateClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 24 additions & 14 deletions
38
packages/cli/plugin-data-loader/tests/__snapshots__/loader.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`data loader basic usage 1`] = ` | ||
"async function loader() { | ||
return 'request profile page'; | ||
} | ||
async function loader2() { | ||
return 'request profile layout'; | ||
} | ||
const loader3 = async () => { | ||
return { | ||
message: 'hello user', | ||
}; | ||
}; | ||
// src/routes/layout.tsx | ||
const loader4 = async () => { | ||
return { | ||
message: 'from server', | ||
}; | ||
}; | ||
export { | ||
loader as loader_0, | ||
loader2 as loader_1, | ||
loader3 as loader_2, | ||
loader4 as loader_3, | ||
}; | ||
" | ||
import { createRequest } from '/packages/cli/plugin-data-loader/src/cli/createRequest'; | ||
const loader_0 = createRequest('main_user/profile/page'); | ||
const loader_1 = createRequest('main_user/profile/layout'); | ||
const loader_2 = createRequest('main_user/layout'); | ||
const loader_3 = createRequest('main_layout'); | ||
export {loader_0,loader_1,loader_2,loader_3,} | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.