-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63dfb3e
commit 64e1ac5
Showing
7 changed files
with
34 additions
and
8 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
3 changes: 3 additions & 0 deletions
3
packages/applications/turbo-blog/src/build/context/context.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type Context = { | ||
language: "ja" | "en"; | ||
}; |
11 changes: 8 additions & 3 deletions
11
packages/applications/turbo-blog/src/build/handlers/index/generate.tsx
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
8 changes: 8 additions & 0 deletions
8
packages/applications/turbo-blog/src/build/plugin/language.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { Plugin } from "ssg-router"; | ||
import type { Context } from "../context/context"; | ||
|
||
export const registerLanguagePlugin: Plugin<Context> = { | ||
async onRouted(_, context) { | ||
context.language = "ja"; | ||
}, | ||
}; |
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,2 +1,6 @@ | ||
export { Router } from "./router/router"; | ||
export { | ||
Router, | ||
type GenerateHandler, | ||
type OutputHandler, | ||
} from "./router/router"; | ||
export type { Plugin } from "./plugin/basic"; |
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,5 +1,5 @@ | ||
export type Plugin<RoutingContext> = { | ||
onRouted: (path: string, context: RoutingContext) => Promise<void>; | ||
onGenerated: (path: string, content: string) => Promise<void>; | ||
onOutput: (path: string) => Promise<void>; | ||
onRouted?: (path: string, context: RoutingContext) => Promise<void>; | ||
onGenerated?: (path: string, content: string) => Promise<void>; | ||
onOutput?: (path: string) => Promise<void>; | ||
}; |
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