init
This commit is contained in:
32
node_modules/vue-demi/lib/v2/index.cjs
generated
vendored
Normal file
32
node_modules/vue-demi/lib/v2/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var Vue = require('vue')
|
||||
var VueCompositionAPI = require('@vue/composition-api')
|
||||
|
||||
function install(_vue) {
|
||||
var vueLib = _vue || Vue
|
||||
if (vueLib && 'default' in vueLib) {
|
||||
vueLib = vueLib.default
|
||||
}
|
||||
|
||||
if (vueLib && !vueLib['__composition_api_installed__']) {
|
||||
if (VueCompositionAPI && 'default' in VueCompositionAPI)
|
||||
vueLib.use(VueCompositionAPI.default)
|
||||
else if (VueCompositionAPI)
|
||||
vueLib.use(VueCompositionAPI)
|
||||
}
|
||||
}
|
||||
|
||||
install(Vue)
|
||||
|
||||
Object.keys(VueCompositionAPI).forEach(function(key) {
|
||||
exports[key] = VueCompositionAPI[key]
|
||||
})
|
||||
|
||||
exports.Vue = Vue
|
||||
exports.Vue2 = Vue
|
||||
exports.isVue2 = true
|
||||
exports.isVue3 = false
|
||||
exports.install = install
|
||||
exports.version = Vue.version
|
||||
|
||||
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
|
||||
exports.hasInjectionContext = () => !!VueCompositionAPI.getCurrentInstance()
|
33
node_modules/vue-demi/lib/v2/index.d.ts
generated
vendored
Normal file
33
node_modules/vue-demi/lib/v2/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import Vue from 'vue'
|
||||
import type { PluginFunction, PluginObject } from 'vue'
|
||||
declare const isVue2: boolean
|
||||
declare const isVue3: boolean
|
||||
declare const Vue2: typeof Vue | undefined
|
||||
declare const version: string
|
||||
declare const install: (vue?: typeof Vue) => void
|
||||
/**
|
||||
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
|
||||
* Refer to https://github.com/vueuse/vue-demi/issues/41
|
||||
*/
|
||||
declare const V: typeof Vue
|
||||
|
||||
/**
|
||||
* DebuggerEvent is a Vue 3 development only feature. This type cannot exist in Vue 2.
|
||||
*/
|
||||
export declare type DebuggerEvent = never
|
||||
|
||||
// accept no generic because Vue 3 doesn't accept any
|
||||
// https://github.com/vuejs/vue-next/pull/2758/
|
||||
export declare type Plugin = PluginObject<any> | PluginFunction<any>
|
||||
export type { VNode } from 'vue'
|
||||
export * from '@vue/composition-api'
|
||||
export {
|
||||
V as Vue,
|
||||
Vue2,
|
||||
isVue2,
|
||||
isVue3,
|
||||
version,
|
||||
install,
|
||||
}
|
||||
|
||||
export declare function hasInjectionContext(): boolean
|
49
node_modules/vue-demi/lib/v2/index.mjs
generated
vendored
Normal file
49
node_modules/vue-demi/lib/v2/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import Vue from 'vue'
|
||||
import VueCompositionAPI, { getCurrentInstance } from '@vue/composition-api/dist/vue-composition-api.mjs'
|
||||
|
||||
function install(_vue) {
|
||||
_vue = _vue || Vue
|
||||
if (_vue && !_vue['__composition_api_installed__'])
|
||||
_vue.use(VueCompositionAPI)
|
||||
}
|
||||
|
||||
install(Vue)
|
||||
|
||||
var isVue2 = true
|
||||
var isVue3 = false
|
||||
var Vue2 = Vue
|
||||
var version = Vue.version
|
||||
|
||||
/**VCA-EXPORTS**/
|
||||
export * from '@vue/composition-api/dist/vue-composition-api.mjs'
|
||||
/**VCA-EXPORTS**/
|
||||
|
||||
export {
|
||||
Vue,
|
||||
Vue2,
|
||||
isVue2,
|
||||
isVue3,
|
||||
version,
|
||||
install,
|
||||
}
|
||||
|
||||
|
||||
// Vue 3 components mock
|
||||
function createMockComponent(name) {
|
||||
return {
|
||||
setup() {
|
||||
throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.')
|
||||
}
|
||||
}
|
||||
}
|
||||
export var Fragment = /*#__PURE__*/ createMockComponent('Fragment')
|
||||
export var Transition = /*#__PURE__*/ createMockComponent('Transition')
|
||||
export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')
|
||||
export var Teleport = /*#__PURE__*/ createMockComponent('Teleport')
|
||||
export var Suspense = /*#__PURE__*/ createMockComponent('Suspense')
|
||||
export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')
|
||||
|
||||
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
|
||||
export function hasInjectionContext() {
|
||||
return !!getCurrentInstance()
|
||||
}
|
Reference in New Issue
Block a user