Skip to content

Commit

Permalink
Drop optional-chaining use, change to module type
Browse files Browse the repository at this point in the history
  • Loading branch information
pearofducks committed May 15, 2021
1 parent 0b878f1 commit 85d8525
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 283 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Get node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm i -g yarn
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const mount = (component, { props, children, element, app } = {}) => {
let el = element

let vNode = createVNode(component, props, children)
if (app?._context) vNode.appContext = app._context
if (app && app._context) vNode.appContext = app._context
if (el) render(vNode, el)
else if (typeof document !== 'undefined' ) render(vNode, el = document.createElement('div'))

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "mount-vue-component",
"version": "0.9.5",
"description": "a tiny utility to programatically create and mount Vue 3 components - e.g. a Vue.extend replacement",
"type": "module",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"scripts": {
"build": "rollup -c",
"preversion": "npm run build",
"version": "npm publish --access public",
"postversion": "git push --follow-tags",
"test": "node -r esm-with-syntax-fixes -r browser-env/register test/mount.test.js"
"test": "node test/mount.test.js"
},
"repository": {
"type": "git",
Expand All @@ -28,11 +29,10 @@
},
"homepage": "https://github.com/pearofducks/mount-vue-component#readme",
"devDependencies": {
"browser-env": "^3.3.0",
"esm": "^3.2.25",
"esm-with-syntax-fixes": "^0.0.1",
"rollup": "^2.27.1",
"uvu": "^0.3.3",
"vue": "^3.0.0"
"abdomen": "^1.0.0",
"jsdom": "^16.5.3",
"rollup": "^2.48.0",
"uvu": "^0.5.1",
"vue": "^3.0.11"
}
}
3 changes: 2 additions & 1 deletion test/mount.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'abdomen/setup'
import { test } from 'uvu'
import * as assert from 'uvu/assert'
import { isVNode, h, createApp } from 'vue'
import { mount as createComponentInstance } from '../index'
import { mount as createComponentInstance } from '../index.js'

const createComponent = (options) => ({
template: '<h1 class="my-class">Hello {{ name }}<slot /></h1>',
Expand Down
Loading

0 comments on commit 85d8525

Please sign in to comment.