mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(bridge): emit types for module (#660)
This commit is contained in:
parent
ae0dbda2ce
commit
0213adcd20
@ -1,10 +1,11 @@
|
||||
import { defineBuildConfig } from 'unbuild'
|
||||
|
||||
export default defineBuildConfig({
|
||||
declaration: true,
|
||||
emitCJS: false,
|
||||
entries: [
|
||||
'src/module',
|
||||
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' }
|
||||
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm', declaration: true }
|
||||
],
|
||||
externals: [
|
||||
'webpack'
|
||||
|
@ -4,7 +4,8 @@
|
||||
"repository": "nuxt/framework",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"exports": "./module.cjs",
|
||||
"main": "./module.cjs",
|
||||
"types": "./dist/module.d.ts",
|
||||
"files": [
|
||||
"module.cjs",
|
||||
"dist"
|
||||
|
@ -7,6 +7,19 @@ import { setupBetterResolve } from './resolve'
|
||||
import { setupGlobalImports } from './global-imports'
|
||||
import { setupTypescript } from './typescript'
|
||||
|
||||
export interface BridgeConfig {
|
||||
nitro: boolean
|
||||
vite: boolean
|
||||
app: boolean | {}
|
||||
capi: boolean | {}
|
||||
globalImports: boolean
|
||||
constraints: boolean
|
||||
postcss8: boolean
|
||||
swc: boolean
|
||||
resolve: boolean
|
||||
typescript: boolean
|
||||
}
|
||||
|
||||
export default defineNuxtModule({
|
||||
name: 'nuxt-bridge',
|
||||
configKey: 'bridge',
|
||||
@ -21,7 +34,7 @@ export default defineNuxtModule({
|
||||
postcss8: true,
|
||||
typescript: true,
|
||||
resolve: true
|
||||
},
|
||||
} as BridgeConfig,
|
||||
async setup (opts, nuxt) {
|
||||
const _require = createRequire(import.meta.url)
|
||||
|
||||
@ -67,3 +80,16 @@ export default defineNuxtModule({
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
declare module '@nuxt/kit' {
|
||||
interface NuxtConfig {
|
||||
bridge?: Partial<BridgeConfig>
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
declare module '@nuxt/types' {
|
||||
interface NuxtConfig {
|
||||
bridge?: Partial<BridgeConfig>
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user