diff --git a/.github/test.js b/.github/test.js index 2dfe4e8..304e46a 100644 --- a/.github/test.js +++ b/.github/test.js @@ -22,7 +22,7 @@ function installDeps() { let installCmd = agent === 'yarn' ? `${agent} add` : `${agent} i` - const packages = isVue27 ? 'vue@v2-alpha' : isVue2 ? `vue@2.6 @vue/composition-api` : 'vue@3' + const packages = isVue27 ? 'vue@2.7' : isVue2 ? `vue@2.6 @vue/composition-api` : 'vue@3' execSync(`${installCmd} ${packages}`, { cwd: DIR, stdio: 'inherit' }) execSync(`${installCmd} ${agent === 'yarn' ? `file:${tarball}` : tarball} --force`, { cwd: DIR, stdio: 'inherit' }) } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 169acc6..a38a9f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: node: [14.x, 16.x] os: [ubuntu-latest] vue: [2.6, 2.7, 3] - yarn: [latest, berry] + yarn: [latest] type: [commonjs, module] runs-on: ${{ matrix.os }} diff --git a/lib/index.iife.js b/lib/index.iife.js index 2179268..085d02c 100644 --- a/lib/index.iife.js +++ b/lib/index.iife.js @@ -19,7 +19,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { VueDemi.Vue2 = Vue VueDemi.version = Vue.version VueDemi.warn = Vue.util.warn - VueDemi.hasInjectionContext = () => !!VueDemi.getCurrentInstance() + VueDemi.hasInjectionContext = function() { + return !!VueDemi.getCurrentInstance() + } function createApp(rootComponent, rootProps) { var vm var provide = {} @@ -72,7 +74,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { VueDemi.Vue = Vue VueDemi.Vue2 = Vue VueDemi.version = Vue.version - VueDemi.hasInjectionContext = () => !!VueDemi.getCurrentInstance() + VueDemi.hasInjectionContext = function() { + return !!VueDemi.getCurrentInstance() + } } else { console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.') } diff --git a/lib/v2.7/index.cjs b/lib/v2.7/index.cjs index 1dce010..8fa3b68 100644 --- a/lib/v2.7/index.cjs +++ b/lib/v2.7/index.cjs @@ -55,4 +55,6 @@ Object.keys(VueModule).forEach(function (key) { }) // Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance() -exports.hasInjectionContext = () => !!VueModule.getCurrentInstance() +exports.hasInjectionContext = function() { + return !!VueModule.getCurrentInstance() +} \ No newline at end of file diff --git a/lib/v2/index.cjs b/lib/v2/index.cjs index 5f873d2..c3d298e 100644 --- a/lib/v2/index.cjs +++ b/lib/v2/index.cjs @@ -29,4 +29,6 @@ exports.install = install exports.version = Vue.version // Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance() -exports.hasInjectionContext = () => !!VueCompositionAPI.getCurrentInstance() +exports.hasInjectionContext = function () { + return !!VueCompositionAPI.getCurrentInstance() +} diff --git a/package.json b/package.json index 27e4dfc..e362bbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-demi", - "version": "0.14.6", + "version": "0.14.7", "engines": { "node": ">=12" }, @@ -32,7 +32,7 @@ "scripts" ], "scripts": { - "postinstall": "node ./scripts/postinstall.js", + "postinstall": "node -e \"try{require('./scripts/postinstall.js')}catch(e){}\"", "release": "npx bumpp --tag --commit --push && npm publish" }, "peerDependencies": {