generated from justintaddei/npm-ts-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #593 from justintaddei/feat/nuxt3-support
feat!: support for Nuxt 3
- Loading branch information
Showing
12 changed files
with
1,825 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const { resolve } = require('path') | ||
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit' | ||
import { isNuxt2 } from '@nuxt/kit' | ||
import config from './meta.json' | ||
|
||
module.exports = function nuxtVWave(moduleOptions) { | ||
const options = Object.assign({}, this.options.vWave, moduleOptions) | ||
export default defineNuxtModule({ | ||
meta: config, | ||
setup(options, nuxt) { | ||
const { resolve } = createResolver(import.meta.url) | ||
|
||
this.addPlugin({ | ||
ssr: false, | ||
src: resolve(__dirname, 'plugin.js'), | ||
fileName: 'v-wave-plugin.js', | ||
options | ||
}) | ||
} | ||
nuxt.options.runtimeConfig.public.vWave = options | ||
|
||
module.exports.meta = require('../package.json') | ||
addPlugin(resolve('./runtime/plugin.js')) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "v-wave", | ||
"configKey": "vWave", | ||
"compatibility": { | ||
"nuxt": "^3.0.0", | ||
"bridge": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import VWave from 'v-wave' | ||
import { defineNuxtPlugin, useRuntimeConfig } from '#imports' | ||
|
||
export default defineNuxtPlugin((app) => { | ||
const options = useRuntimeConfig().public.vWave | ||
|
||
const directive = options.directive || 'wave' | ||
|
||
const { vWave, vWaveTrigger } = VWave.createLocalWaveDirective(options, app.vueApp) | ||
|
||
app.vueApp.directive(directive, { | ||
...vWave, | ||
getSSRProps() { | ||
return {} | ||
} | ||
}) | ||
|
||
app.vueApp.directive(`${directive}-trigger`, { | ||
...vWaveTrigger, | ||
getSSRProps() { | ||
return {} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { resolve } = require('path') | ||
|
||
module.exports = function nuxtVWave(moduleOptions) { | ||
const options = Object.assign({}, this.options.vWave, moduleOptions) | ||
|
||
this.addPlugin({ | ||
ssr: false, | ||
src: resolve(__dirname, 'v2-plugin.js'), | ||
fileName: 'v-wave-plugin.js', | ||
options | ||
}) | ||
} | ||
|
||
module.exports.meta = require('../../package.json') |
File renamed without changes.
Oops, something went wrong.