0.0.24 • Published 2 years ago

pergeltest v0.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.19-beta.15

2 years ago

0.0.19-beta.14

2 years ago

0.0.19-beta.13

2 years ago

0.0.19-beta.12

2 years ago

0.0.19-beta.11

2 years ago

0.0.19-beta.10

2 years ago

0.0.19-beta.9

2 years ago

0.0.19-beta.8

2 years ago

0.0.19-beta.7

2 years ago

0.0.19-beta.6

2 years ago

0.0.19-beta.5

2 years ago

0.0.19-beta.4

2 years ago

0.0.19-beta.3

2 years ago

0.0.19-beta.2

2 years ago

0.0.19-beta.1

2 years ago

0.0.19-beta.0

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago