mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): provide node16-style type exports (#18431)
This commit is contained in:
parent
e6bbf71fd5
commit
b19b35fb67
@ -4,8 +4,14 @@
|
|||||||
"repository": "nuxt/nuxt",
|
"repository": "nuxt/nuxt",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.mjs",
|
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
2
packages/nuxt/app.d.ts
vendored
2
packages/nuxt/app.d.ts
vendored
@ -1 +1 @@
|
|||||||
export * from './dist/app'
|
export * from './dist/app/index.js'
|
||||||
|
@ -7,15 +7,20 @@ export default defineBuildConfig({
|
|||||||
// Core
|
// Core
|
||||||
{ input: 'src/index' },
|
{ input: 'src/index' },
|
||||||
// App
|
// App
|
||||||
{ input: 'src/app/', outDir: 'dist/app/' },
|
{ input: 'src/app/', outDir: 'dist/app/', ext: 'js' },
|
||||||
// Runtime dirs
|
// Runtime dirs
|
||||||
...[
|
...[
|
||||||
'core',
|
'core',
|
||||||
'head',
|
'head',
|
||||||
'components',
|
'components',
|
||||||
'pages'
|
'pages'
|
||||||
].map(name => ({ input: `src/${name}/runtime/`, outDir: `dist/${name}/runtime`, format: 'esm' } as BuildEntry))
|
].map(name => ({ input: `src/${name}/runtime/`, outDir: `dist/${name}/runtime`, format: 'esm', ext: 'js' } as BuildEntry))
|
||||||
],
|
],
|
||||||
|
hooks: {
|
||||||
|
'mkdist:entry:options' (_ctx, _entry, mkdistOptions) {
|
||||||
|
mkdistOptions.addRelativeDeclarationExtensions = true
|
||||||
|
}
|
||||||
|
},
|
||||||
dependencies: [
|
dependencies: [
|
||||||
'nuxi',
|
'nuxi',
|
||||||
'vue-router',
|
'vue-router',
|
||||||
|
@ -4,34 +4,48 @@
|
|||||||
"repository": "nuxt/nuxt",
|
"repository": "nuxt/nuxt",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.mjs",
|
|
||||||
"types": "./types.d.ts",
|
"types": "./types.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"nuxi": "./bin/nuxt.mjs",
|
"nuxi": "./bin/nuxt.mjs",
|
||||||
"nuxt": "./bin/nuxt.mjs"
|
"nuxt": "./bin/nuxt.mjs"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.mjs",
|
".": {
|
||||||
|
"types": "./types.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
},
|
||||||
"./config": {
|
"./config": {
|
||||||
"types": "./config.d.ts",
|
"types": "./config.d.ts",
|
||||||
"import": "./config.mjs",
|
"import": "./config.js",
|
||||||
"require": "./config.cjs"
|
"require": "./config.cjs"
|
||||||
},
|
},
|
||||||
"./schema": {
|
"./schema": {
|
||||||
"types": "./schema.d.ts",
|
"types": "./schema.d.ts",
|
||||||
"import": "./schema.mjs"
|
"import": "./schema.js"
|
||||||
},
|
},
|
||||||
"./kit": {
|
"./kit": {
|
||||||
"types": "./kit.d.ts",
|
"types": "./kit.d.ts",
|
||||||
"import": "./kit.mjs"
|
"import": "./kit.js"
|
||||||
|
},
|
||||||
|
"./app": {
|
||||||
|
"types": "./dist/app/index.d.ts",
|
||||||
|
"import": "./dist/app/index.js"
|
||||||
},
|
},
|
||||||
"./app": "./dist/app/index.mjs",
|
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
"#app": "./dist/app/index.mjs",
|
"#app": {
|
||||||
"#head": "./dist/head/runtime/index.mjs",
|
"types": "./dist/app/index.d.ts",
|
||||||
"#pages": "./dist/pages/runtime/index.mjs"
|
"import": "./dist/app/index.js"
|
||||||
|
},
|
||||||
|
"#head": {
|
||||||
|
"types": "./dist/head/runtime/index.d.ts",
|
||||||
|
"import": "./dist/head/runtime/index.js"
|
||||||
|
},
|
||||||
|
"#pages": {
|
||||||
|
"types": "./dist/pages/runtime/index.d.ts",
|
||||||
|
"import": "./dist/pages/runtime/index.js"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"app.d.ts",
|
"app.d.ts",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useNuxtApp } from './nuxt'
|
|
||||||
import type { AppConfig } from 'nuxt/schema'
|
import type { AppConfig } from 'nuxt/schema'
|
||||||
|
import { useNuxtApp } from './nuxt'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import __appConfig from '#build/app.config.mjs'
|
import __appConfig from '#build/app.config.mjs'
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/// <reference path="types/augments.d.ts" />
|
/// <reference path="types/augments.d.ts" />
|
||||||
|
|
||||||
export * from './nuxt'
|
export * from './nuxt'
|
||||||
export * from './composables'
|
export * from './composables/index'
|
||||||
export * from './components'
|
export * from './components/index'
|
||||||
export * from './config'
|
export * from './config'
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-restricted-paths
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
export type { PageMeta } from '../pages/runtime'
|
export type { PageMeta } from '../pages/runtime/index'
|
||||||
|
|
||||||
export const isVue2 = false
|
export const isVue2 = false
|
||||||
export const isVue3 = true
|
export const isVue3 = true
|
||||||
|
@ -6,9 +6,10 @@ import { createHooks } from 'hookable'
|
|||||||
import { getContext } from 'unctx'
|
import { getContext } from 'unctx'
|
||||||
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
||||||
import type { H3Event } from 'h3'
|
import type { H3Event } from 'h3'
|
||||||
|
import type { RuntimeConfig, AppConfigInput } from 'nuxt/schema'
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-restricted-paths
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
||||||
import type { RuntimeConfig, AppConfigInput } from 'nuxt/schema'
|
|
||||||
|
|
||||||
const nuxtAppCtx = /* #__PURE__ */ getContext<NuxtApp>('nuxt-app')
|
const nuxtAppCtx = /* #__PURE__ */ getContext<NuxtApp>('nuxt-app')
|
||||||
|
|
||||||
|
@ -3,9 +3,10 @@ import { genDynamicImport, genImport } from 'knitwork'
|
|||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import { pascalCase } from 'scule'
|
import { pascalCase } from 'scule'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
|
import type { Component, ComponentsOptions } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { isVueTemplate } from './helpers'
|
import { isVueTemplate } from './helpers'
|
||||||
import type { Component, ComponentsOptions } from 'nuxt/schema'
|
|
||||||
|
|
||||||
interface LoaderOptions {
|
interface LoaderOptions {
|
||||||
getComponents (): Component[]
|
getComponents (): Component[]
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { statSync } from 'node:fs'
|
import { statSync } from 'node:fs'
|
||||||
import { relative, resolve } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import { defineNuxtModule, resolveAlias, addTemplate, addPluginTemplate, updateTemplates } from '@nuxt/kit'
|
import { defineNuxtModule, resolveAlias, addTemplate, addPluginTemplate, updateTemplates } from '@nuxt/kit'
|
||||||
|
import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { clientFallbackAutoIdPlugin } from './client-fallback-auto-id'
|
import { clientFallbackAutoIdPlugin } from './client-fallback-auto-id'
|
||||||
import { componentsPluginTemplate, componentsTemplate, componentsIslandsTemplate, componentsTypeTemplate } from './templates'
|
import { componentsPluginTemplate, componentsTemplate, componentsIslandsTemplate, componentsTypeTemplate } from './templates'
|
||||||
import { scanComponents } from './scan'
|
import { scanComponents } from './scan'
|
||||||
import { loaderPlugin } from './loader'
|
import { loaderPlugin } from './loader'
|
||||||
import { TreeShakeTemplatePlugin } from './tree-shake'
|
import { TreeShakeTemplatePlugin } from './tree-shake'
|
||||||
import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
|
|
||||||
|
|
||||||
const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val === 'object') || typeof val === 'string'
|
const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val === 'object') || typeof val === 'string'
|
||||||
const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch (_e) { return false } }
|
const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch (_e) { return false } }
|
||||||
|
@ -2,10 +2,10 @@ import { promises as fsp } from 'node:fs'
|
|||||||
import { dirname, resolve, join } from 'pathe'
|
import { dirname, resolve, join } from 'pathe'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { findPath, resolveFiles, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils, tryResolveModule, resolvePath, resolveAlias } from '@nuxt/kit'
|
import { findPath, resolveFiles, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils, tryResolveModule, resolvePath, resolveAlias } from '@nuxt/kit'
|
||||||
|
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from 'nuxt/schema'
|
||||||
|
|
||||||
import * as defaultTemplates from './templates'
|
import * as defaultTemplates from './templates'
|
||||||
import { getNameFromPath, hasSuffix, uniqueBy } from './utils'
|
import { getNameFromPath, hasSuffix, uniqueBy } from './utils'
|
||||||
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from 'nuxt/schema'
|
|
||||||
|
|
||||||
export function createApp (nuxt: Nuxt, options: Partial<NuxtApp> = {}): NuxtApp {
|
export function createApp (nuxt: Nuxt, options: Partial<NuxtApp> = {}): NuxtApp {
|
||||||
return defu(options, {
|
return defu(options, {
|
||||||
|
@ -2,9 +2,10 @@ import chokidar from 'chokidar'
|
|||||||
import { importModule, isIgnored } from '@nuxt/kit'
|
import { importModule, isIgnored } from '@nuxt/kit'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import { createApp, generateApp as _generateApp } from './app'
|
|
||||||
import type { Nuxt } from 'nuxt/schema'
|
import type { Nuxt } from 'nuxt/schema'
|
||||||
|
|
||||||
|
import { createApp, generateApp as _generateApp } from './app'
|
||||||
|
|
||||||
export async function build (nuxt: Nuxt) {
|
export async function build (nuxt: Nuxt) {
|
||||||
const app = createApp(nuxt)
|
const app = createApp(nuxt)
|
||||||
const generateApp = debounce(() => _generateApp(nuxt, app), undefined, { leading: true })
|
const generateApp = debounce(() => _generateApp(nuxt, app), undefined, { leading: true })
|
||||||
|
@ -9,9 +9,10 @@ import fsExtra from 'fs-extra'
|
|||||||
import { dynamicEventHandler } from 'h3'
|
import { dynamicEventHandler } from 'h3'
|
||||||
import { createHeadCore } from '@unhead/vue'
|
import { createHeadCore } from '@unhead/vue'
|
||||||
import { renderSSRHead } from '@unhead/ssr'
|
import { renderSSRHead } from '@unhead/ssr'
|
||||||
|
import type { Nuxt } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { ImportProtectionPlugin } from './plugins/import-protection'
|
import { ImportProtectionPlugin } from './plugins/import-protection'
|
||||||
import type { Nuxt } from 'nuxt/schema'
|
|
||||||
|
|
||||||
export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||||
// Resolve config
|
// Resolve config
|
||||||
|
@ -2,6 +2,7 @@ import { join, normalize, relative, resolve } from 'pathe'
|
|||||||
import { createHooks, createDebugger } from 'hookable'
|
import { createHooks, createDebugger } from 'hookable'
|
||||||
import type { LoadNuxtOptions } from '@nuxt/kit'
|
import type { LoadNuxtOptions } from '@nuxt/kit'
|
||||||
import { resolvePath, resolveAlias, resolveFiles, loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
|
import { resolvePath, resolveAlias, resolveFiles, loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
|
||||||
|
import type { Nuxt, NuxtOptions, NuxtHooks } from 'nuxt/schema'
|
||||||
|
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
@ -22,7 +23,6 @@ import { DevOnlyPlugin } from './plugins/dev-only'
|
|||||||
import { addModuleTranspiles } from './modules'
|
import { addModuleTranspiles } from './modules'
|
||||||
import { initNitro } from './nitro'
|
import { initNitro } from './nitro'
|
||||||
import schemaModule from './schema'
|
import schemaModule from './schema'
|
||||||
import type { Nuxt, NuxtOptions, NuxtHooks } from 'nuxt/schema'
|
|
||||||
|
|
||||||
export function createNuxt (options: NuxtOptions): Nuxt {
|
export function createNuxt (options: NuxtOptions): Nuxt {
|
||||||
const hooks = createHooks<NuxtHooks>()
|
const hooks = createHooks<NuxtHooks>()
|
||||||
|
@ -2,9 +2,10 @@ import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolve
|
|||||||
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
|
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
|
||||||
import type { Import, Unimport } from 'unimport'
|
import type { Import, Unimport } from 'unimport'
|
||||||
import { createUnimport, scanDirExports } from 'unimport'
|
import { createUnimport, scanDirExports } from 'unimport'
|
||||||
|
import type { ImportsOptions, ImportPresetWithDeprecation } from 'nuxt/schema'
|
||||||
|
|
||||||
import { TransformPlugin } from './transform'
|
import { TransformPlugin } from './transform'
|
||||||
import { defaultPresets } from './presets'
|
import { defaultPresets } from './presets'
|
||||||
import type { ImportsOptions, ImportPresetWithDeprecation } from 'nuxt/schema'
|
|
||||||
|
|
||||||
export default defineNuxtModule<Partial<ImportsOptions>>({
|
export default defineNuxtModule<Partial<ImportsOptions>>({
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -4,11 +4,12 @@ import { join, relative, resolve } from 'pathe'
|
|||||||
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
|
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
|
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { resolvePagesRoutes, normalizeRoutes } from './utils'
|
import { resolvePagesRoutes, normalizeRoutes } from './utils'
|
||||||
import type { PageMetaPluginOptions } from './page-meta'
|
import type { PageMetaPluginOptions } from './page-meta'
|
||||||
import { PageMetaPlugin } from './page-meta'
|
import { PageMetaPlugin } from './page-meta'
|
||||||
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
|
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -5,9 +5,10 @@ import { genImport, genDynamicImport, genArrayFromRaw, genSafeVariableName } fro
|
|||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { filename } from 'pathe/utils'
|
import { filename } from 'pathe/utils'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { uniqueBy } from '../core/utils'
|
|
||||||
import type { NuxtPage } from 'nuxt/schema'
|
import type { NuxtPage } from 'nuxt/schema'
|
||||||
|
|
||||||
|
import { uniqueBy } from '../core/utils'
|
||||||
|
|
||||||
enum SegmentParserState {
|
enum SegmentParserState {
|
||||||
initial,
|
initial,
|
||||||
static,
|
static,
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { resolve } from 'node:path'
|
import { resolve } from 'node:path'
|
||||||
import { expect, it, vi } from 'vitest'
|
import { expect, it, vi } from 'vitest'
|
||||||
import { scanComponents } from '../src/components/scan'
|
|
||||||
import type { ComponentsDir } from 'nuxt/schema'
|
import type { ComponentsDir } from 'nuxt/schema'
|
||||||
|
|
||||||
|
import { scanComponents } from '../src/components/scan'
|
||||||
|
|
||||||
const fixtureDir = resolve(__dirname, 'fixture')
|
const fixtureDir = resolve(__dirname, 'fixture')
|
||||||
const rFixture = (...p: string[]) => resolve(fixtureDir, ...p)
|
const rFixture = (...p: string[]) => resolve(fixtureDir, ...p)
|
||||||
|
|
||||||
|
@ -4,8 +4,14 @@
|
|||||||
"repository": "nuxt/nuxt",
|
"repository": "nuxt/nuxt",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.mjs",
|
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"schema"
|
"schema"
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
"repository": "nuxt/nuxt",
|
"repository": "nuxt/nuxt",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": "./dist/index.mjs",
|
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
@ -4,6 +4,7 @@ import * as _kit from '@nuxt/kit'
|
|||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-ignore type cast
|
||||||
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
const isNuxtApp = (dir: string) => {
|
const isNuxtApp = (dir: string) => {
|
||||||
|
@ -2,6 +2,7 @@ import * as _kit from '@nuxt/kit'
|
|||||||
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
|
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-ignore type cast
|
||||||
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
const options = JSON.parse(process.env.NUXT_TEST_OPTIONS || '{}')
|
const options = JSON.parse(process.env.NUXT_TEST_OPTIONS || '{}')
|
||||||
|
@ -7,6 +7,7 @@ import * as _kit from '@nuxt/kit'
|
|||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-ignore type cast
|
||||||
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
export async function startServer () {
|
export async function startServer () {
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"exports": "./dist/index.mjs",
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.mjs",
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
},
|
||||||
"./dist/*": "./dist/*"
|
"./dist/*": "./dist/*"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -6265,11 +6265,11 @@ packages:
|
|||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
/mkdist/1.1.1_typescript@4.9.5:
|
/mkdist/1.1.2_typescript@4.9.5:
|
||||||
resolution: {integrity: sha512-9cEzCsBD0qpybR/lJMB0vRIDZiHP7hJHTN2mQtFU2qt0vr7lFnghxersOJbKLshaDsl4GlnY2OBzmRRUTfuaDg==}
|
resolution: {integrity: sha512-s9whPlQsr84iY3XoufsDrVlzGiDdTnMwf2+7QU6ekJPgTIgGwn7EsU8lcefWqLH6no+/4UqjDBwyIkGKfZyH9g==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
sass: ^1.58.0
|
sass: ^1.58.3
|
||||||
typescript: '>=4.9.5'
|
typescript: '>=4.9.5'
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
sass:
|
sass:
|
||||||
@ -6282,6 +6282,7 @@ packages:
|
|||||||
fs-extra: 11.1.0
|
fs-extra: 11.1.0
|
||||||
globby: 13.1.3
|
globby: 13.1.3
|
||||||
jiti: 1.17.2
|
jiti: 1.17.2
|
||||||
|
mlly: 1.2.0
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
pathe: 1.1.0
|
pathe: 1.1.0
|
||||||
typescript: 4.9.5
|
typescript: 4.9.5
|
||||||
@ -8220,7 +8221,7 @@ packages:
|
|||||||
hookable: 5.4.2
|
hookable: 5.4.2
|
||||||
jiti: 1.17.2
|
jiti: 1.17.2
|
||||||
magic-string: 0.30.0
|
magic-string: 0.30.0
|
||||||
mkdist: 1.1.1_typescript@4.9.5
|
mkdist: 1.1.2_typescript@4.9.5
|
||||||
mlly: 1.2.0
|
mlly: 1.2.0
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
pathe: 1.1.0
|
pathe: 1.1.0
|
||||||
|
11
test/fixtures/basic/nuxt.config.ts
vendored
11
test/fixtures/basic/nuxt.config.ts
vendored
@ -11,7 +11,16 @@ declare module 'nitropack' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
typescript: { strict: true },
|
typescript: {
|
||||||
|
strict: true,
|
||||||
|
tsConfig: {
|
||||||
|
compilerOptions: {
|
||||||
|
// TODO: For testing (future) support for Node16-style module resolution.
|
||||||
|
// See https://github.com/nuxt/nuxt/issues/18426 and https://github.com/nuxt/nuxt/pull/18431
|
||||||
|
// moduleResolution: 'Node16'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
app: {
|
app: {
|
||||||
pageTransition: true,
|
pageTransition: true,
|
||||||
layoutTransition: true,
|
layoutTransition: true,
|
||||||
|
8
test/fixtures/basic/types.ts
vendored
8
test/fixtures/basic/types.ts
vendored
@ -2,13 +2,13 @@ import { expectTypeOf } from 'expect-type'
|
|||||||
import { describe, it } from 'vitest'
|
import { describe, it } from 'vitest'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import type { AppConfig, RuntimeValue } from '@nuxt/schema'
|
import type { AppConfig, RuntimeValue } from '@nuxt/schema'
|
||||||
|
|
||||||
import type { FetchError } from 'ofetch'
|
import type { FetchError } from 'ofetch'
|
||||||
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
|
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
|
||||||
|
|
||||||
|
import { defineNuxtConfig } from 'nuxt/config'
|
||||||
import { callWithNuxt, isVue3 } from '#app'
|
import { callWithNuxt, isVue3 } from '#app'
|
||||||
import NuxtPage from '~~/../../../packages/nuxt/src/pages/runtime/page'
|
import type { NavigateToOptions } from '#app/composables/router'
|
||||||
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
|
import { NuxtPage } from '#components'
|
||||||
import { defineNuxtConfig } from '~~/../../../packages/nuxt/config'
|
|
||||||
import { useRouter } from '#imports'
|
import { useRouter } from '#imports'
|
||||||
|
|
||||||
interface TestResponse { message: string }
|
interface TestResponse { message: string }
|
||||||
|
Loading…
Reference in New Issue
Block a user