-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable this to be used as a nuxt module (#13)
Co-authored-by: Kevin Regenrek <hello@regenrek.at>
- Loading branch information
Showing
10 changed files
with
109 additions
and
59 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
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
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,25 +1,41 @@ | ||
import typescript from 'rollup-plugin-typescript2' | ||
import pkg from './package.json' | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
}, | ||
], | ||
external: [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
], | ||
plugins: [ | ||
typescript({ | ||
typescript: require('typescript'), | ||
}), | ||
], | ||
} | ||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
}, | ||
], | ||
external: [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
// 'prop-types', | ||
], | ||
plugins: [ | ||
typescript({ | ||
typescript: require('typescript'), | ||
}), | ||
], | ||
}, | ||
{ | ||
input: 'src/plugin.js', | ||
output: [ | ||
{ | ||
file: 'lib/plugin.js', | ||
format: 'es', | ||
}, | ||
], | ||
external: [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
], | ||
}, | ||
] |
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
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,7 +1,22 @@ | ||
import Vue from 'vue' | ||
import CompositionApi from '@vue/composition-api' | ||
import { resolve, join } from 'path' | ||
import { Module } from '@nuxt/types' | ||
|
||
Vue.use(CompositionApi) | ||
const compositionApiModule: Module<any> = function () { | ||
const libRoot = resolve(__dirname, '..') | ||
const { dst } = this.addTemplate({ | ||
src: resolve(libRoot, 'lib', 'plugin.js'), | ||
fileName: join('composition-api', 'plugin.js'), | ||
options: {}, | ||
}) | ||
this.options.plugins = this.options.plugins || [] | ||
this.options.plugins.push(resolve(this.options.buildDir || '', dst)) | ||
} | ||
|
||
export default compositionApiModule | ||
// eslint-disable-next-line | ||
export const meta = require('../package.json') | ||
|
||
export { useFetch } from './fetch' | ||
export { withContext } from './context' | ||
|
||
export * from '@vue/composition-api' |
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
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
This file was deleted.
Oops, something went wrong.
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