refactor: migrate to hookable package (#24426)

This commit is contained in:
Andrey Yolkin 2023-11-24 17:10:27 +03:00 committed by GitHub
parent 9d6584ba3b
commit 21776e5fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 10 deletions

View File

@ -29,7 +29,7 @@
"exit": "^0.1.2", "exit": "^0.1.2",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"globby": "^11.0.4", "globby": "^11.0.4",
"hable": "^3.0.0", "hookable": "^4.4.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"opener": "1.5.2", "opener": "1.5.2",

View File

@ -2,7 +2,7 @@
import path from 'path' import path from 'path'
import consola from 'consola' import consola from 'consola'
import minimist from 'minimist' import minimist from 'minimist'
import Hookable from 'hable' import Hookable from 'hookable'
import { name, version } from '../package.json' import { name, version } from '../package.json'
import { forceExit } from './utils' import { forceExit } from './utils'
import { loadNuxtConfig } from './utils/config' import { loadNuxtConfig } from './utils/config'

View File

@ -16,7 +16,7 @@
"@nuxt/utils": "2.17.2", "@nuxt/utils": "2.17.2",
"consola": "^3.2.3", "consola": "^3.2.3",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"hable": "^3.0.0", "hookable": "^4.4.1",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },

View File

@ -1,7 +1,7 @@
import { isPlainObject } from 'lodash' import { isPlainObject } from 'lodash'
import consola from 'consola' import consola from 'consola'
import Hookable from 'hable' import Hookable from 'hookable'
import { defineAlias } from '@nuxt/utils' import { defineAlias } from '@nuxt/utils'
import { getNuxtConfig } from '@nuxt/config' import { getNuxtConfig } from '@nuxt/config'
@ -23,6 +23,10 @@ export default class Nuxt extends Hookable {
this.resolver = new Resolver(this) this.resolver = new Resolver(this)
this.moduleContainer = new ModuleContainer(this) this.moduleContainer = new ModuleContainer(this)
// Add legacy methods for backwards compatibility
this.clearHooks = this.removeHooks.bind(this)
this.clearHook = this.removeHook.bind(this)
// Deprecated hooks // Deprecated hooks
this.deprecateHooks({ this.deprecateHooks({
// #3294 - 7514db73b25c23b8c14ebdafbb4e129ac282aabd // #3294 - 7514db73b25c23b8c14ebdafbb4e129ac282aabd

View File

@ -1,7 +1,7 @@
import { defineAlias } from '@nuxt/utils' import { defineAlias } from '@nuxt/utils'
import { getNuxtConfig } from '@nuxt/config' import { getNuxtConfig } from '@nuxt/config'
import { Server } from '@nuxt/server' import { Server } from '@nuxt/server'
import Hookable from 'hable' import Hookable from 'hookable'
import Nuxt from '../src/nuxt' import Nuxt from '../src/nuxt'
import ModuleContainer from '../src/module' import ModuleContainer from '../src/module'

View File

@ -7588,11 +7588,6 @@ gzip-size@^6.0.0:
dependencies: dependencies:
duplexer "^0.1.2" duplexer "^0.1.2"
hable@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/hable/-/hable-3.0.0.tgz#6de089b2df946635cf8134b9e4859f1b62de255f"
integrity sha512-7+G0/2/COR8pwteYFqHIVYfQpuEiO2HXwJrhCBJVgrNrl9O5eaUoJVDGXUJX+0RpGncNVTuestexjk1afj01wQ==
handlebars@^4.7.7: handlebars@^4.7.7:
version "4.7.7" version "4.7.7"
resolved "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" resolved "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
@ -7770,6 +7765,11 @@ hmac-drbg@^1.0.1:
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1" minimalistic-crypto-utils "^1.0.1"
hookable@^4.4.1:
version "4.4.1"
resolved "https://registry.npmjs.org/hookable/-/hookable-4.4.1.tgz#3d7154ac7e1f6f147e50fef583832f2645b9f04f"
integrity sha512-KWjZM8C7IVT2qne5HTXjM6R6VnRfjfRlf/oCnHd+yFxoHO1DzOl6B9LzV/VqGQK/IrFewq+EG+ePVrE9Tpc3fg==
hosted-git-info@^2.1.4: hosted-git-info@^2.1.4:
version "2.8.9" version "2.8.9"
resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"