Skip to content

Commit

Permalink
further sed vite-plugin-ssr -> vike
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 15, 2023
1 parent 04b0042 commit cf59f0e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci/getTestJobs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ describe('getTestJobs()', () => {
"examples/nuxt2/.prod.test.ts",
"examples/prisma/.dev.test.ts",
"examples/prisma/.prod.test.ts",
"examples/vite-plugin-ssr/.dev.test.ts",
"examples/vite-plugin-ssr/.prod.test.ts",
"examples/vike/.dev.test.ts",
"examples/vike/.prod.test.ts",
"examples/vite/.dev.test.ts",
"examples/vite/.preview.test.ts",
],
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cd examples/some-example/ && pnpm exec test-e2e
pnpm exec test-e2e ome-exampl # At the monorepo root
```

> On Debian, [these additional steps](https://github.com/brillout/vite-plugin-ssr/issues/283#issuecomment-1072974554) are required.
> On Debian, [these additional steps](https://github.com/vikejs/vike/issues/283#issuecomment-1072974554) are required.
<br/>

Expand Down
4 changes: 2 additions & 2 deletions examples/vercel/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Examples using [Vercel API Routes](https://vercel.com/docs/concepts/functions/serverless-functions#deploying-serverless-functions) (recommended):
- Telefunc: [github.com/brillout/telefunc-vercel](https://github.com/brillout/telefunc-vercel)
- Telefunc + SSR ([vite-plugin-ssr](https://vite-plugin-ssr.com/)): [github.com/brillout/telefunc-vercel-ssr](https://github.com/brillout/telefunc-vercel-ssr)
- Telefunc + SSR ([Vike](https://vike.dev/)): [github.com/brillout/telefunc-vercel-ssr](https://github.com/brillout/telefunc-vercel-ssr)

Alternative example using the [Vercel File System API](https://vercel.com/docs/file-system-api):
- Telefunc + SSR ([vite-plugin-ssr](https://vite-plugin-ssr.com/)): [github.com/brillout/telefunc-vercel-ssr_filesystem-api](https://github.com/brillout/telefunc-vercel-ssr_filesystem-api)
- Telefunc + SSR ([Vike](https://vike.dev/)): [github.com/brillout/telefunc-vercel-ssr_filesystem-api](https://github.com/brillout/telefunc-vercel-ssr_filesystem-api)
8 changes: 4 additions & 4 deletions telefunc/node/vite/plugins/devConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import path from 'path'
function devConfig(): Plugin[] {
return [
{
name: 'vite-plugin-ssr:devConfig',
name: 'telefunc:devConfig',
apply: apply('dev'),
config: () => ({
optimizeDeps: {
Expand All @@ -29,7 +29,7 @@ function devConfig(): Plugin[] {
}
},
{
name: 'vite-plugin-ssr:devConfig:serverMiddleware',
name: 'telefunc:devConfig:serverMiddleware',
apply: apply('dev', { skipMiddlewareMode: true, onlyViteCli: true }),
// Ensure that SvelteKit's configureServer() has precedence, see https://github.com/brillout/telefunc/pull/54
enforce: 'post',
Expand All @@ -42,7 +42,7 @@ function devConfig(): Plugin[] {
]
}

// - Vite-plugin-ssr adds @brillout/json-serializer to optimizeDeps.exclude
// - Vike adds @brillout/json-serializer to optimizeDeps.exclude
// - We need to remove @brillout/json-serializer from optimizeDeps.exclude to avoid:
// ```
// 10:41:35 AM [vite] Internal server error: Failed to resolve import "@brillout/json-serializer/parse" from "node_modules/.vite/deps/chunk-HMXEIHOJ.js?v=9404be11". Does the file exist?
Expand All @@ -61,7 +61,7 @@ async function determineFsAllowList(config: ResolvedConfig) {

// Current directory: node_modules/telefunc/dist/cjs/node/vite/plugins/devConfig.js
const telefuncRoot = path.join(__dirname, '../../../../../')
// Assert that `telefuncRoot` is indeed pointing to `node_modules/vite-plugin-ssr/`
// Assert that `telefuncRoot` is indeed pointing to `node_modules/vike/`
require.resolve(`${telefuncRoot}/dist/cjs/node/vite/plugins/devConfig.js`)
fsAllow.push(telefuncRoot)
}
4 changes: 2 additions & 2 deletions telefunc/node/vite/plugins/packageJsonFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Otherwise, following error is thrown:
* Must use import to load ES Module: dist/server/pageFiles.js
* require() of ES modules is not supported.
* require() of dist/server/pageFiles.js from node_modules/vite-plugin-ssr/dist/cjs/node/page-files/setup.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
* require() of dist/server/pageFiles.js from node_modules/vike/dist/cjs/node/page-files/setup.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
* Reproduction: https://github.com/brillout/vite-plugin-ssr-server-import-syntax
*/

Expand All @@ -24,7 +24,7 @@ function packageJsonFile(): Plugin {
if (!config.build.ssr) return
const isEsm = rollupIsEsm(options)
const fileName = 'package.json'
if (bundle[fileName]) return // E.g. already generated by Telefunc / vite-plugin-ssr
if (bundle[fileName]) return // E.g. already generated by Telefunc / Vike
this.emitFile({
fileName,
type: 'asset',
Expand Down
2 changes: 1 addition & 1 deletion telefunc/node/vite/plugins/previewConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { apply, addTelefuncMiddleware } from '../helpers'
function previewConfig(): Plugin {
let config: ResolvedConfig
return {
name: 'vite-plugin-ssr:previewConfig',
name: 'telefunc:previewConfig',
apply: apply('preview'),
configResolved(config_) {
config = config_
Expand Down
2 changes: 1 addition & 1 deletion telefunc/utils/getOutDirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function determineOutDir(config: ResolvedConfig): string | null {

// Mechanism to detect whether Telefunc is used with framework.
// When used with a framework then Telefunc should let the framework determine `outDir`.
// E.g. vite-plugin-ssr and SvelteKit already set `config.build.outDir`.
// E.g. Vike and SvelteKit already set `config.build.outDir`.
if (!isOutDirRoot(outDirRoot)) {
assertConfig(config)
return null
Expand Down
2 changes: 1 addition & 1 deletion telefunc/utils/isVitePluginSsr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function isVitePluginSsr(): boolean {
// https://github.com/brillout/vite-plugin-ssr/blob/9d3cc76de9c966a9c38803553ecfcae740a02860/vite-plugin-ssr/node/index.ts#L16-L20
// https://github.com/vikejs/vike/blob/9d3cc76de9c966a9c38803553ecfcae740a02860/vike/node/index.ts#L16-L20
return globalThis._isVitePluginSsr === true
}
declare global {
Expand Down

0 comments on commit cf59f0e

Please sign in to comment.