mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +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'
|
import { defineBuildConfig } from 'unbuild'
|
||||||
|
|
||||||
export default defineBuildConfig({
|
export default defineBuildConfig({
|
||||||
|
declaration: true,
|
||||||
emitCJS: false,
|
emitCJS: false,
|
||||||
entries: [
|
entries: [
|
||||||
'src/module',
|
'src/module',
|
||||||
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' }
|
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm', declaration: true }
|
||||||
],
|
],
|
||||||
externals: [
|
externals: [
|
||||||
'webpack'
|
'webpack'
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
"repository": "nuxt/framework",
|
"repository": "nuxt/framework",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": "./module.cjs",
|
"main": "./module.cjs",
|
||||||
|
"types": "./dist/module.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"module.cjs",
|
"module.cjs",
|
||||||
"dist"
|
"dist"
|
||||||
|
@ -7,6 +7,19 @@ import { setupBetterResolve } from './resolve'
|
|||||||
import { setupGlobalImports } from './global-imports'
|
import { setupGlobalImports } from './global-imports'
|
||||||
import { setupTypescript } from './typescript'
|
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({
|
export default defineNuxtModule({
|
||||||
name: 'nuxt-bridge',
|
name: 'nuxt-bridge',
|
||||||
configKey: 'bridge',
|
configKey: 'bridge',
|
||||||
@ -21,7 +34,7 @@ export default defineNuxtModule({
|
|||||||
postcss8: true,
|
postcss8: true,
|
||||||
typescript: true,
|
typescript: true,
|
||||||
resolve: true
|
resolve: true
|
||||||
},
|
} as BridgeConfig,
|
||||||
async setup (opts, nuxt) {
|
async setup (opts, nuxt) {
|
||||||
const _require = createRequire(import.meta.url)
|
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