mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
refactor: typos (#4922)
This commit is contained in:
parent
1fb9af33a3
commit
569b6aab9c
@ -198,7 +198,7 @@ export default class Builder {
|
||||
validateTemplate() {
|
||||
// Validate template dependencies
|
||||
const templateDependencies = this.template.dependencies
|
||||
const dpendencyFixes = []
|
||||
const dependencyFixes = []
|
||||
for (const depName in templateDependencies) {
|
||||
const depVersion = templateDependencies[depName]
|
||||
const requiredVersion = `${depName}@${depVersion}`
|
||||
@ -209,24 +209,24 @@ export default class Builder {
|
||||
const validVersion = semver.satisfies(pkg.version, depVersion)
|
||||
if (!validVersion) {
|
||||
consola.warn(`${requiredVersion} is required but ${depName}@${pkg.version} is installed!`)
|
||||
dpendencyFixes.push(requiredVersion)
|
||||
dependencyFixes.push(requiredVersion)
|
||||
}
|
||||
} else {
|
||||
consola.warn(`${depName}@${depVersion} is required but not installed!`)
|
||||
dpendencyFixes.push(requiredVersion)
|
||||
dependencyFixes.push(requiredVersion)
|
||||
}
|
||||
}
|
||||
|
||||
// Suggest dependency fixes (TODO: automate me)
|
||||
if (dpendencyFixes.length) {
|
||||
if (dependencyFixes.length) {
|
||||
consola.error(
|
||||
'Please install missing dependencies:\n',
|
||||
'\n',
|
||||
'Using yarn:\n',
|
||||
`yarn add ${dpendencyFixes.join(' ')}\n`,
|
||||
`yarn add ${dependencyFixes.join(' ')}\n`,
|
||||
'\n',
|
||||
'Using npm:\n',
|
||||
`npm i ${dpendencyFixes.join(' ')}\n`
|
||||
`npm i ${dependencyFixes.join(' ')}\n`
|
||||
)
|
||||
throw new Error('Missing Template Dependencies')
|
||||
}
|
||||
|
@ -111,11 +111,14 @@ export default class Resolver {
|
||||
throw new Error(`Cannot resolve "${path}" from "${resolvedPath}"`)
|
||||
}
|
||||
|
||||
requireModule(path, { esm, useESM = esm, alias, isAlias = alias, intropDefault } = {}) {
|
||||
requireModule(path, { esm, useESM = esm, alias, isAlias = alias, intropDefault, interopDefault = intropDefault } = {}) {
|
||||
let resolvedPath = path
|
||||
let requiredModule
|
||||
|
||||
// TODO: Remove in Nuxt 3
|
||||
if (intropDefault) {
|
||||
consola.warn('Using intropDefault is deprecated and will be removed in Nuxt 3. Use `interopDefault` instead.')
|
||||
}
|
||||
if (alias) {
|
||||
consola.warn('Using alias is deprecated and will be removed in Nuxt 3. Use `isAlias` instead.')
|
||||
}
|
||||
@ -148,8 +151,8 @@ export default class Resolver {
|
||||
lastError = e
|
||||
}
|
||||
|
||||
// Introp default
|
||||
if (intropDefault !== false && requiredModule && requiredModule.default) {
|
||||
// Interop default
|
||||
if (interopDefault !== false && requiredModule && requiredModule.default) {
|
||||
requiredModule = requiredModule.default
|
||||
}
|
||||
|
||||
|
@ -384,14 +384,14 @@ describe('core: resolver', () => {
|
||||
expect(resolvedModule).toEqual('resolved module')
|
||||
})
|
||||
|
||||
test('should require es modules without default export when intropDefault is disabled', () => {
|
||||
test('should require es modules without default export when interopDefault is disabled', () => {
|
||||
const resolver = new Resolver({
|
||||
options: {}
|
||||
})
|
||||
resolver.resolvePath = jest.fn()
|
||||
resolver.esm = jest.fn(() => ({ default: 'resolved module' }))
|
||||
|
||||
const resolvedModule = resolver.requireModule('/var/nuxt/resolver/module', { intropDefault: false })
|
||||
const resolvedModule = resolver.requireModule('/var/nuxt/resolver/module', { interopDefault: false })
|
||||
|
||||
expect(resolvedModule).toEqual({ default: 'resolved module' })
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user