-
-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create postinstall to adapt vue3
- Loading branch information
1 parent
c89d915
commit 7de0803
Showing
16 changed files
with
231 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# vue-inbrowser-compiler-demi | ||
|
||
Library compiled differently for vue2 and vue3 | ||
|
||
Check postinstall scripts for more info | ||
|
||
## install | ||
|
||
```bash | ||
yarn add vue-inbrowser-compiler-demi | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports.h = () => {} | ||
module.exports.resolveComponent = name => name | ||
module.exports.isVue3 = false |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare const h: () => void | ||
export declare const resolveComponent: (name: object | string) => string | object | ||
export declare const isVue3: boolean |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const h = () => {} | ||
export const resolveComponent = name => name | ||
export const isVue3 = false |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "vue-inbrowser-compiler-demi", | ||
"version": "4.44.17", | ||
"description": "use this with vue-inbrowser-compiler to compile for vue2 or vue3", | ||
"module": "index.esm.js", | ||
"main": "index.cjs.js", | ||
"types": "index.d.ts", | ||
"keywords": [ | ||
"vue", | ||
"compile" | ||
], | ||
"scripts": { | ||
"postinstall": "node ./postinstall.js" | ||
}, | ||
"devDependencies": { | ||
"vue": "2.6.14" | ||
}, | ||
"peerDependencies": { | ||
"vue": ">=2" | ||
}, | ||
"files": [ | ||
"index.cjs.js", | ||
"index.esm.js", | ||
"index.d.ts" | ||
], | ||
"author": "Bart Ledoux <ledouxb@me.com>", | ||
"license": "MIT", | ||
"homepage": "https://vue-styleguidist.github.io", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/vue-styleguidist/vue-styleguidist.git", | ||
"directory": "packages/vue-inbrowser-compiler-utils" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const pkg = require('vue/package.json') | ||
const path = require('path') | ||
const fs = require('fs') | ||
|
||
function updateIndexForVue3() { | ||
// commonjs | ||
const indexPath = path.join(__dirname, './index.cjs.js') | ||
const indexContent = ` | ||
const Vue = require('vue') | ||
module.exports.h = Vue.h | ||
module.exports.resolveComponent = Vue.resolveComponent | ||
module.exports.isVue3 = true | ||
` | ||
fs.writeFile(indexPath, indexContent) | ||
|
||
// esm | ||
const indexPathESM = path.join(__dirname, './index.esm.js') | ||
const indexContentESM = ` | ||
export { h, resolveComponent } from 'vue' | ||
export const isVue3 = true` | ||
fs.writeFile(indexPathESM, indexContentESM) | ||
} | ||
|
||
if (pkg.version.startsWith('3.')) { | ||
updateIndexForVue3() | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"outDir": "lib", | ||
"declaration": true, | ||
"sourceMap": false, | ||
"module": "es2015" | ||
}, | ||
"include": ["src/**/*.ts", "../../@types/**/*"], | ||
"exclude": ["node_modules", "src/**/__tests__/**/*.ts"] | ||
} |
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
5 changes: 3 additions & 2 deletions
5
packages/vue-inbrowser-compiler-utils/src/__tests__/adaptCreateElementVue3.ts
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
13 changes: 1 addition & 12 deletions
13
packages/vue-inbrowser-compiler-utils/src/adaptCreateElement.ts
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
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
Oops, something went wrong.