Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby): graphql engine #33030

Merged
merged 8 commits into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/gatsby-plugin-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export interface IPluginRefObject {
resolve: string
options?: IPluginRefOptions
parentDir?: string

subPluginPaths?: Array<string>
module?: any
modulePath?: string
}

export type PluginRef = string | IPluginRefObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ interface Context {

interface State {
key?: string
path?: string
path: Array<string | number>
wardpeet marked this conversation as resolved.
Show resolved Hide resolved
parent?: any
reference?: any
ancestors?: any
Expand Down
31 changes: 31 additions & 0 deletions packages/gatsby/cache-dir/query-engine/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// IGatsbyPage, SystemPath and copied/inlined from redux/types so this file is self contained
type SystemPath = string
type Identifier = string

export interface IGatsbyPage {
internalComponentName: string
path: string
matchPath: undefined | string
component: SystemPath
componentChunkName: string
isCreatedByStatefulCreatePages: boolean
context: Record<string, unknown>
updatedAt: number
// eslint-disable-next-line @typescript-eslint/naming-convention
pluginCreator___NODE: Identifier
pluginCreatorId: Identifier
componentPath: SystemPath
ownerNodeId: Identifier
}
wardpeet marked this conversation as resolved.
Show resolved Hide resolved

// also inlined
export interface IQueryResult {
errors?: Array<Error>
data?: any
}

export class GraphQLEngine {
constructor({ dbPath }: { dbPath: string })
runQuery(query: string, context: Record<string, any>): Promise<IQueryResult>
findPageByPath(pathName: string): IGatsbyPage | undefined
}
1 change: 1 addition & 0 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/http-proxy": "^1.17.4",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"@vercel/webpack-asset-relocator-loader": "^1.6.0",
"address": "1.1.2",
"anser": "^2.0.1",
"autoprefixer": "^10.2.4",
Expand Down
Loading