Socket
Socket
Sign inDemoInstall

vue-demi

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-demi - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

29

lib/index.cjs.js

@@ -1,1 +0,28 @@

module.exports = require('./v3/index.cjs')
var Vue = require('vue')
Object.keys(Vue).forEach(function(key) {
exports[key] = Vue[key]
})
exports.set = function(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
exports.del = function(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
exports.Vue = Vue
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

@@ -1,1 +0,15 @@

export * from './v3/index'
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const install: (vue?: any) => void
export function set<T>(target: any, key: any, val: T): T
export function del(target: any, key: any)
export * from 'vue'
export {
Vue,
isVue2,
isVue3,
install,
}

@@ -1,1 +0,32 @@

export * from './v3/index.esm'
import * as Vue from 'vue'
var isVue2 = false
var isVue3 = true
function install() {}
export function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
export function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
export * from 'vue'
export {
Vue,
isVue2,
isVue3,
install,
}

@@ -18,2 +18,3 @@ ;(function (window) {

VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version

@@ -33,2 +34,3 @@ } else {

VueDemi.Vue = Vue
VueDemi.Vue2 = undefined
VueDemi.version = Vue.version

@@ -35,0 +37,0 @@ VueDemi.set = function(target, key, val) {

@@ -21,2 +21,3 @@ var Vue = require('vue')

exports.Vue = Vue
exports.Vue2 = Vue
exports.isVue2 = true

@@ -23,0 +24,0 @@ exports.isVue3 = false

import Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: Vue | undefined
declare const version: string
declare const install: (vue?: 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: Vue
export * from '@vue/composition-api'
export {
Vue,
V as Vue,
Vue2,
isVue2,

@@ -11,0 +18,0 @@ isVue3,

@@ -14,2 +14,3 @@ import Vue from 'vue'

var isVue3 = false
var Vue2 = Vue
var version = Vue.version

@@ -23,2 +24,3 @@

Vue,
Vue2,
isVue2,

@@ -25,0 +27,0 @@ isVue3,

@@ -26,4 +26,5 @@ var Vue = require('vue')

exports.Vue = Vue
exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: any
declare const install: (vue?: any) => 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: Vue

@@ -11,3 +17,4 @@ export function set<T>(target: any, key: any, val: T): T

export {
Vue,
V as Vue,
Vue2,
isVue2,

@@ -14,0 +21,0 @@ isVue3,

@@ -5,2 +5,3 @@ import * as Vue from 'vue'

var isVue3 = true
var Vue2 = undefined

@@ -30,2 +31,3 @@ function install() {}

Vue,
Vue2,
isVue2,

@@ -32,0 +34,0 @@ isVue3,

43

package.json
{
"name": "vue-demi",
"version": "0.6.2",
"version": "0.7.0",
"repository": "https://github.com/antfu/vue-demi.git",
"funding": "https://github.com/sponsors/antfu",
"license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"main": "lib/index.cjs.js",
"jsdelivr": "lib/index.iife.js",
"unpkg": "lib/index.iife.js",
"module": "lib/index.esm.js",
"typings": "lib/index.d.ts",
"module": "lib/index.esm.js",
"unpkg": "lib/index.iife.js",
"jsdelivr": "lib/index.iife.js",
"funding": "https://github.com/sponsors/antfu",
"repository": "https://github.com/antfu/vue-demi.git",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"files": [
"lib",
"bin",
"scripts"
],
"scripts": {

@@ -18,18 +27,10 @@ "postinstall": "node ./scripts/postinstall.js",

"peerDependencies": {
"@vue/composition-api": "^1.0.0-beta.1",
"vue": "^2.6.0 || >=3.0.0-rc.1"
},
"files": [
"lib",
"bin",
"scripts"
],
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"devDependencies": {
"@vue/composition-api": "^1.0.0-beta.25",
"vue2": "^2.6.12",
"vue": "^3.0.5"
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
}

@@ -28,3 +28,3 @@ <p align="center">

```json
```jsonc
{

@@ -37,3 +37,11 @@ "dependencies": {

"vue": "^2.0.0 || >=3.0.0-rc.0"
}
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
},
"devDependencies": {
"vue": "^3.0.0" // or "^2.6.0" base on your preferred working environment
},
}

@@ -66,2 +74,14 @@ ```

### `Vue2`
To avoid bringing in all the tree-shakable modules, we provide a `Vue2` export to support access to Vue 2's global API. (See [#41](https://github.com/vueuse/vue-demi/issues/41).)
```ts
import { Vue2 } from 'vue-demi'
if (Vue2) {
Vue2.config.ignoredElements.push('x-foo')
}
```
### `install()`

@@ -72,6 +92,5 @@

```ts
import Vue from 'vue'
import { install } from 'vue-demi'
install(Vue)
install()
```

@@ -108,2 +127,3 @@

var isVue3 = true
var Vue2 = undefined

@@ -113,2 +133,3 @@ export * from 'vue3'

Vue,
Vue2,
isVue2,

@@ -127,2 +148,34 @@ isVue3,

### Isomorphic Testings
You can support testing for both versions by adding npm alias in your dev dependencies. For example:
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 vue2 && jest",
"test:3": "vue-demi-switch 3 && jest",
},
"devDependencies": {
"vue": "^3.0.0",
"vue2": "npm:vue@2"
},
}
```
or
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 && jest",
"test:3": "vue-demi-switch 3 vue3 && jest",
},
"devDependencies": {
"vue": "^2.6.0",
"vue3": "npm:vue@3"
},
}
```
## Examples

@@ -129,0 +182,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc