mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-26 09:50:31 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
977a9e1465 | ||
|
|
2620379e02 | ||
|
|
e4f42d5322 | ||
|
|
ad28a9124e |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "trpc-nuxt",
|
"name": "trpc-nuxt",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.1.23",
|
"version": "0.1.24",
|
||||||
"packageManager": "pnpm@7.1.1",
|
"packageManager": "pnpm@7.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/module.cjs",
|
"main": "./dist/module.cjs",
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
"@trpc/server": "^9.23.2",
|
"@trpc/server": "^9.23.2",
|
||||||
"@vueuse/core": "^8.5.0",
|
"@vueuse/core": "^8.5.0",
|
||||||
"@vueuse/nuxt": "^8.5.0",
|
"@vueuse/nuxt": "^8.5.0",
|
||||||
|
"dedent": "^0.7.0",
|
||||||
"defu": "^6.0.0",
|
"defu": "^6.0.0",
|
||||||
"h3": "^0.7.8",
|
"h3": "^0.7.8",
|
||||||
"pathe": "^0.3.0",
|
"pathe": "^0.3.0",
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -13,6 +13,7 @@ importers:
|
|||||||
'@vueuse/core': ^8.5.0
|
'@vueuse/core': ^8.5.0
|
||||||
'@vueuse/nuxt': ^8.5.0
|
'@vueuse/nuxt': ^8.5.0
|
||||||
bumpp: ^7.1.1
|
bumpp: ^7.1.1
|
||||||
|
dedent: ^0.7.0
|
||||||
defu: ^6.0.0
|
defu: ^6.0.0
|
||||||
eslint: ^8.14.0
|
eslint: ^8.14.0
|
||||||
h3: ^0.7.8
|
h3: ^0.7.8
|
||||||
@@ -30,6 +31,7 @@ importers:
|
|||||||
'@trpc/server': 9.23.4
|
'@trpc/server': 9.23.4
|
||||||
'@vueuse/core': 8.5.0
|
'@vueuse/core': 8.5.0
|
||||||
'@vueuse/nuxt': 8.5.0
|
'@vueuse/nuxt': 8.5.0
|
||||||
|
dedent: 0.7.0
|
||||||
defu: 6.0.0
|
defu: 6.0.0
|
||||||
h3: 0.7.8
|
h3: 0.7.8
|
||||||
pathe: 0.3.0
|
pathe: 0.3.0
|
||||||
@@ -2077,6 +2079,10 @@ packages:
|
|||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/dedent/0.7.0:
|
||||||
|
resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/deep-extend/0.6.0:
|
/deep-extend/0.6.0:
|
||||||
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
|
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
|
||||||
engines: {node: '>=4.0.0'}
|
engines: {node: '>=4.0.0'}
|
||||||
@@ -3794,7 +3800,7 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/is-module/1.0.0:
|
/is-module/1.0.0:
|
||||||
resolution: {integrity: sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=}
|
resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/is-negative-zero/2.0.2:
|
/is-negative-zero/2.0.2:
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import { join, resolve } from 'pathe'
|
import { join, resolve } from 'pathe'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
|
// @ts-expect-error: No types
|
||||||
|
import dedent from 'dedent'
|
||||||
|
|
||||||
import { addPlugin, addServerHandler, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
import { addPlugin, addServerHandler, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
nuxt.options.build.transpile.push(runtimeDir, '#build/trpc-handler')
|
nuxt.options.build.transpile.push(runtimeDir, '#build/trpc-handler')
|
||||||
|
|
||||||
const handlerPath = join(nuxt.options.buildDir, 'trpc-handler.ts')
|
const handlerPath = join(nuxt.options.buildDir, 'trpc-handler.ts')
|
||||||
const trpcOptionsPath = join(nuxt.options.rootDir, 'server/trpc')
|
const trpcOptionsPath = join(nuxt.options.srcDir, 'server/trpc')
|
||||||
|
|
||||||
// Add vueuse
|
// Add vueuse
|
||||||
nuxt.options.modules.push('@vueuse/nuxt')
|
nuxt.options.modules.push('@vueuse/nuxt')
|
||||||
@@ -53,7 +55,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
filename: 'trpc-handler.ts',
|
filename: 'trpc-handler.ts',
|
||||||
write: true,
|
write: true,
|
||||||
getContents() {
|
getContents() {
|
||||||
return `
|
return dedent`
|
||||||
import { createTRPCHandler } from 'trpc-nuxt/api'
|
import { createTRPCHandler } from 'trpc-nuxt/api'
|
||||||
import * as functions from '${trpcOptionsPath}'
|
import * as functions from '${trpcOptionsPath}'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user