@nuxt/docs-nightly 4.3.0-29454772.3822f69b → 4.3.0-29458880.ea26b3c0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ export default defineNuxtModule({
|
|
|
52
52
|
// One-time setup: create database schema, generate config files, etc.
|
|
53
53
|
await generateDatabaseConfig(nuxt.options.rootDir)
|
|
54
54
|
},
|
|
55
|
-
async onUpgrade (
|
|
55
|
+
async onUpgrade (nuxt, options, previousVersion) {
|
|
56
56
|
// Handle version-specific migrations
|
|
57
57
|
if (semver.lt(previousVersion, '1.0.0')) {
|
|
58
58
|
await migrateLegacyData()
|
package/4.api/5.kit/1.modules.md
CHANGED
|
@@ -64,7 +64,7 @@ export function defineNuxtModule<TOptions extends ModuleOptions> (): {
|
|
|
64
64
|
| `hooks` | `Partial<NuxtHooks>`{lang="ts"} | `false` | Hooks to be installed for the module. If provided, the module will install the hooks. |
|
|
65
65
|
| `moduleDependencies` | `Record<string, ModuleDependency> \| ((nuxt: Nuxt) => Record<string, ModuleDependency>)`{lang="ts"} | `false` | Dependencies on other modules with version constraints and configuration. Can be an object or a function that receives the Nuxt instance. See [example](/docs/4.x/api/kit/modules#specifying-module-dependencies). |
|
|
66
66
|
| `onInstall` | `(nuxt: Nuxt) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is first installed. Requires `meta.name` and `meta.version` to be defined. |
|
|
67
|
-
| `onUpgrade` | `(
|
|
67
|
+
| `onUpgrade` | `(nuxt: Nuxt, options: T, previousVersion: string) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is upgraded to a newer version. Requires `meta.name` and `meta.version` to be defined. |
|
|
68
68
|
| `setup` | `(this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void \| false \| ModuleSetupInstallResult>`{lang="ts"} | `false` | Setup function for the module. If provided, the module will call the setup function. |
|
|
69
69
|
|
|
70
70
|
### Examples
|
|
@@ -216,7 +216,7 @@ export default defineNuxtModule({
|
|
|
216
216
|
// - Perform initial data migration
|
|
217
217
|
},
|
|
218
218
|
|
|
219
|
-
onUpgrade (
|
|
219
|
+
onUpgrade (nuxt, options, previousVersion) {
|
|
220
220
|
// This runs when the module is upgraded to a newer version
|
|
221
221
|
console.log(`Upgrading my-awesome-module from ${previousVersion} to 1.2.0`)
|
|
222
222
|
|