0.0.24 • Published 5 months ago

pergeltest v0.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

TODO:

  • pergeltest yazilan her yeri -> @pergel/nuxt cevir

Development

Module

Types

First add types module Modules#Modules

Graphql

contextType: 'pergeltest/dist/runtime/server/modules/graphqlYoga/types#MergeGraphQLContext'
export interface ModuleHooks {
  'my-module:init': any
}
export interface ModulePublicRuntimeConfig {
  NAME: string
}

export interface ModuleRuntimeConfig {
  PRIVATE_NAME: string
}

export interface ModuleHooks {
  'yoga:before'(ctx: any): void
}

declare module '@nuxt/schema' {
  interface NuxtHooks {
    'yoga:before': ModuleHooks['yoga:before']
  }
  interface NuxtConfig {
    onGraphQL?: ModuleOptions
  }
}

declare module '#app' {
  interface NuxtApp {
    $onGraphQL: ModuleOptions
  }
}
// A map from resolved path to component name (used for making duplicate warning message)
const resolvedNames = new Map<string, string>()

try {
  const data = await loadConfig({
    cwd: nuxt.options.rootDir,
    configFile: 'nitrodeploy.config.ts',
    dotenv: true,
    defaultConfig: {
      hello: {
        world: 'hello ddddd',
      },
    },
  })
  console.warn(data.config)
}
catch (error) {
  // logger.error(error)
}

nuxt.options.runtimeConfig.pergel = defu(options.graphql, {
  graphql: true,
})

nuxt.hook('nitro:config', (nitroConfig) => {
  nitroConfig.alias = nitroConfig.alias || {}
  // nitroConfig.alias['#onGraphql'] = resolve('./runtime/server')
})

nuxt.hook('nitro:config', (config) => {
  for (const route in options.graphql) {
    config.handlers ??= []
    config.handlers.push({
      handler: resolve('./runtime/server/modules/graphqlYoga'),
      route,
    })

    if (nuxt.options.ssr) {
      config.prerender ??= {}
      config.prerender.routes ??= []
      config.prerender.routes.push(route)
    }
  }
})

nuxt.hook('prepare:types', ({ references }) => {
  references.push({ path: resolve('./graphqlYoga.d.ts') })
})

// enabled only in development
if (nuxt.options.dev) {

}

// Waiting for https://github.com/nuxt/nuxt/pull/24000/files
addServerImportsDir(resolve('./runtime/server/modules'), { prepend: true })

addPlugin(resolve('./runtime/plugin'))

addServerHandler({
  route: '/health',
  handler: resolver.resolve('./runtime/server/modules/graphqlYoga/health.get'),
  method: 'get',
})
0.0.24

5 months ago

0.0.23

5 months ago

0.0.22

5 months ago

0.0.21

5 months ago

0.0.20

5 months ago

0.0.19

5 months ago

0.0.19-beta.15

5 months ago

0.0.19-beta.14

5 months ago

0.0.19-beta.13

5 months ago

0.0.19-beta.12

5 months ago

0.0.19-beta.11

5 months ago

0.0.19-beta.10

5 months ago

0.0.19-beta.9

5 months ago

0.0.19-beta.8

5 months ago

0.0.19-beta.7

5 months ago

0.0.19-beta.6

5 months ago

0.0.19-beta.5

5 months ago

0.0.19-beta.4

5 months ago

0.0.19-beta.3

5 months ago

0.0.19-beta.2

5 months ago

0.0.19-beta.1

5 months ago

0.0.19-beta.0

5 months ago

0.0.18

5 months ago

0.0.17

6 months ago

0.0.16

6 months ago

0.0.15

6 months ago

0.0.14

6 months ago

0.0.13

6 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago