-
-
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.
Allow user to specify custom stores (#676)
* custom stores can be specified * update snapshots * changeset * unused import
- Loading branch information
1 parent
8ba4c3e
commit b7a07a3
Showing
11 changed files
with
219 additions
and
98 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'houdini-svelte': patch | ||
--- | ||
|
||
Add config for users to specify custom stores |
22 changes: 22 additions & 0 deletions
22
packages/houdini-svelte/src/plugin/codegen/stores/custom.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,22 @@ | ||
import { Config } from 'houdini' | ||
|
||
import type { HoudiniVitePluginConfig } from '../../' | ||
import { plugin_config } from '../../kit' | ||
|
||
export function store_import( | ||
cfg: Config, | ||
which: keyof Required<HoudiniVitePluginConfig>['customStores'] | ||
): { statement: string; store_class: string } { | ||
// look up the import string for the store | ||
const store_string = plugin_config(cfg).customStores[which]! | ||
|
||
// the last separates the import path from the exported module | ||
const parts = store_string.split('.') | ||
const import_path = parts.slice(0, -1).join('.') | ||
const store_class = parts[parts.length - 1] | ||
|
||
return { | ||
statement: `import { ${store_class} } from '${import_path}'`, | ||
store_class, | ||
} | ||
} |
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
Oops, something went wrong.
b7a07a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./site
docs-houdinigraphql.vercel.app
docs-phi-fawn.vercel.app
houdinigraphql.com
www.houdinigraphql.com
docs-git-main-houdinigraphql.vercel.app
b7a07a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs-next – ./site
docs-next-houdinigraphql.vercel.app
docs-next-kohl.vercel.app
docs-next-git-main-houdinigraphql.vercel.app