-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor from exports strategy to vite-env-only
Signed-off-by: Marc MacLeod <[email protected]>
- Loading branch information
Showing
50 changed files
with
429 additions
and
199 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"vitest.disableWorkspaceWarning": true | ||
} |
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
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
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
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import { type ClientHandlerOpts, type RenderPlugin, type SetOptional } from '@ssrx/renderer'; | ||
import { createApp as baseCreateApp } from '@ssrx/renderer/client'; | ||
import { clientOnly$ } from 'vite-env-only/macros'; | ||
|
||
import { RootLayout } from './default-root.tsx'; | ||
|
||
export const createAppClient = clientOnly$(_createAppClient); | ||
|
||
function _createAppClient<P extends RenderPlugin<any>[]>(opts: SetOptional<ClientHandlerOpts<P>, 'RootLayout'>) { | ||
return baseCreateApp({ | ||
RootLayout, | ||
...opts, | ||
}); | ||
} |
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,20 @@ | ||
import { type RenderPlugin, type ServerHandlerOpts, type SetOptional } from '@ssrx/renderer'; | ||
import { createApp as baseCreateApp } from '@ssrx/renderer/server'; | ||
import { serverOnly$ } from 'vite-env-only/macros'; | ||
|
||
import { RootLayout } from './default-root.tsx'; | ||
import { renderToStreamServer } from './server/stream.ts'; | ||
|
||
export const createAppServer = serverOnly$(_createAppServer); | ||
|
||
function _createAppServer<P extends RenderPlugin<any>[]>( | ||
opts: SetOptional<ServerHandlerOpts<P>, 'renderer' | 'RootLayout'>, | ||
) { | ||
return baseCreateApp({ | ||
RootLayout, | ||
renderer: { | ||
renderToStream: renderToStreamServer!, | ||
}, | ||
...opts, | ||
}); | ||
} |
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,7 @@ | ||
import './namespace.ts'; | ||
|
||
import { createAppClient } from './handler-client.ts'; | ||
import { createAppServer } from './handler-server.ts'; | ||
export { renderAssets } from './assets.tsx'; | ||
|
||
export const createApp = (import.meta.env.SSR ? createAppServer : createAppClient)!; |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
import '../namespace.ts'; | ||
|
||
export { renderAssets } from '../assets.tsx'; | ||
export { createApp } from './handler.ts'; | ||
export { renderToStream } from './stream.ts'; | ||
export { renderToStreamServer as renderToStream } from './stream.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
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
import type { RemixServerProps } from '@remix-run/react'; | ||
import { RemixBrowser } from '@remix-run/react'; | ||
import { type ClientHandlerOpts, type RenderPlugin, type SetOptional } from '@ssrx/renderer'; | ||
import { createApp as baseCreateApp } from '@ssrx/renderer/client'; | ||
import { clientOnly$ } from 'vite-env-only/macros'; | ||
|
||
export const createAppClient = clientOnly$(_createAppClient); | ||
|
||
function _createAppClient<P extends RenderPlugin<any>[]>( | ||
opts: SetOptional<ClientHandlerOpts<P>, 'appRenderer'> & Pick<RemixServerProps, 'abortDelay'>, | ||
) { | ||
return baseCreateApp({ | ||
appRenderer: () => () => <RemixBrowser />, | ||
...opts, | ||
}); | ||
} |
14 changes: 4 additions & 10 deletions
14
packages/remix/src/server.tsx → packages/remix/src/handler-server.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
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,6 @@ | ||
import './namespace.ts'; | ||
|
||
import { createAppClient } from './handler-client.tsx'; | ||
import { createAppServer } from './handler-server.tsx'; | ||
|
||
export const createApp = (import.meta.env.SSR ? createAppServer : createAppClient)!; |
Oops, something went wrong.