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.
- Loading branch information
justintaddei
committed
Dec 5, 2023
1 parent
8ed51bd
commit ee3ea2a
Showing
9 changed files
with
6,085 additions
and
13,262 deletions.
There are no files selected for viewing
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,27 @@ | ||
const { resolve } = require('path') | ||
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit' | ||
import pkg from '../package.json' | ||
import { isNuxt2 } from '@nuxt/kit' | ||
|
||
module.exports = function nuxtVWave(moduleOptions) { | ||
const options = Object.assign({}, this.options.vWave, moduleOptions) | ||
export default defineNuxtModule({ | ||
meta: { | ||
name: 'v-wave', | ||
version: pkg.version, | ||
configKey: 'vWave', | ||
compatibility: { | ||
nuxt: '^3.0.0 || ^2.16.0', | ||
bridge: true | ||
} | ||
}, | ||
setup(options, nuxt) { | ||
const { resolve } = createResolver(import.meta.url) | ||
|
||
this.addPlugin({ | ||
ssr: false, | ||
src: resolve(__dirname, 'plugin.js'), | ||
fileName: 'v-wave-plugin.js', | ||
options | ||
}) | ||
} | ||
if (isNuxt2()) { | ||
nuxt.options.publicRuntimeConfig.vWave = options | ||
} else { | ||
|
||
module.exports.meta = require('../package.json') | ||
nuxt.options.runtimeConfig.public.vWave = options | ||
} | ||
|
||
addPlugin(resolve('./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 |
---|---|---|
@@ -1,4 +1,24 @@ | ||
import Vue from 'vue' | ||
import VWave from 'v-wave' | ||
import { defineNuxtPlugin, useRuntimeConfig } from '#imports' | ||
|
||
Vue.use(VWave, <%= serialize(options) %>) | ||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.