-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
e8c958d
commit aac42b2
Showing
6 changed files
with
64 additions
and
4 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
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,22 @@ | ||
import { test, expect } from 'vitest' | ||
|
||
import { transform_svelte_test } from '../../tests' | ||
|
||
test('modifies root +layout.svelte to import adapter', async function () { | ||
// run the test | ||
const result = await transform_svelte_test( | ||
'src/routes/+layout.svelte', | ||
` | ||
<script> | ||
export let data | ||
</script> | ||
` | ||
) | ||
|
||
expect(result).toMatchInlineSnapshot(` | ||
import "$houdini/runtime/adapter"; | ||
import __houdini_client__ from "../../../my/client/path"; | ||
export let data; | ||
__houdini_client__.receiveServerSession(data); | ||
`) | ||
}) |
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,15 @@ | ||
import { ensure_imports } from '../../imports' | ||
import { TransformPage } from '../../plugin' | ||
|
||
export default async function kit_init(page: TransformPage) { | ||
// we only care about the root layout file | ||
if (!page.config.isRootLayout(page.filepath)) { | ||
return | ||
} | ||
|
||
// all we need to do is make sure that something imports the adapter | ||
ensure_imports({ | ||
page, | ||
sourceModule: '$houdini/runtime/adapter', | ||
}) | ||
} |
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