├── .commitlintrc
├── .editorconfig
├── .eslintignore
├── .eslintrc
├── .github
├── FUNDING.yml
└── workflows
│ └── nodejs.yml
├── .gitignore
├── .huskyrc.js
├── .lintstagedrc.js
├── .prettierrc
├── .remarkrc
├── .renovaterc
├── .versionrc
├── CHANGELOG.md
├── LICENSE
├── README.md
├── codechecks.yml
├── docs
└── index.html
├── package.json
├── scripts
└── deploy.sh
├── src
├── dynamic.ts
├── index.ts
└── utils.ts
├── tsconfig.json
├── typings.d.ts
└── yarn.lock
/.commitlintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "@1stg"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | tab_width = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | lib
2 | !/.*.js
3 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@1stg"
3 | }
4 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [JounQin]
2 | open_collective: rxts
3 |
--------------------------------------------------------------------------------
/.github/workflows/nodejs.yml:
--------------------------------------------------------------------------------
1 | name: Node CI
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | default:
7 | strategy:
8 | matrix:
9 | node: [12]
10 | os: [macOS-latest, ubuntu-latest]
11 | runs-on: ${{ matrix.os }}
12 | steps:
13 | - uses: actions/checkout@master
14 |
15 | - uses: actions/setup-node@master
16 | with:
17 | node-version: ${{ matrix.node }}
18 |
19 | - name: Setup yarn
20 | run: |
21 | curl -o- -L https://yarnpkg.com/install.sh | bash
22 | export PATH="$HOME/.yarn/bin:$PATH"
23 |
24 | - name: Get yarn cache
25 | id: yarn-cache
26 | run: echo "::set-output name=dir::$(yarn cache dir)"
27 |
28 | - uses: actions/cache@v1
29 | with:
30 | path: ${{ steps.yarn-cache.outputs.dir }}
31 | key: ${{ matrix.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
32 | restore-keys: |
33 | ${{ matrix.os }}-${{ matrix.node }}-yarn-
34 |
35 | - name: Install Dependencies
36 | run: yarn --frozen-lockfile
37 | env:
38 | CI: 'true'
39 |
40 | - name: Build, Lint and Test
41 | run: |
42 | yarn build
43 | yarn lint
44 | env:
45 | EFF_NO_LINK_RULES: 'true'
46 | PARSER_NO_WATCH: 'true'
47 |
48 | # - name: Codecov
49 | # if: matrix.os == 'macOS-latest'
50 | # run: |
51 | # yarn global add codecov codacy-coverage
52 | # codecov
53 | # cat ./coverage/lcov.info | codacy-coverage -u JounQin -n vue-dynamic
54 | # env:
55 | # CI: 'true'
56 | # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
57 | # CODACY_ACCOUNT_TOKEN: ${{ secrets.CODACY_ACCOUNT_TOKEN }}
58 | # CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
59 |
60 | - name: Code Checks
61 | if: matrix.os == 'macOS-latest' && github.event_name == 'push'
62 | run: |
63 | yarn global add @codechecks/client @codechecks/build-size-watcher
64 | codechecks
65 | env:
66 | CI: 'true'
67 | CC_SECRET: ${{ secrets.CC_SECRET }}
68 |
69 | - name: Publish GitHub Release and npm Package
70 | if: matrix.os == 'macOS-latest' && github.event_name == 'push' && github.ref == 'refs/heads/master'
71 | run: |
72 | git remote set-url origin "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git"
73 | npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
74 | git checkout master
75 | bash scripts/deploy.sh
76 | env:
77 | CI: 'true'
78 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
80 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .*cache
2 | *.log
3 | lib
4 | node_modules
5 |
--------------------------------------------------------------------------------
/.huskyrc.js:
--------------------------------------------------------------------------------
1 | module.exports = require('@1stg/husky-config')
2 |
--------------------------------------------------------------------------------
/.lintstagedrc.js:
--------------------------------------------------------------------------------
1 | module.exports = require('@1stg/lint-staged')
2 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | "@1stg/prettier-config/vue"
2 |
--------------------------------------------------------------------------------
/.remarkrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": [
3 | "@1stg/remark-config"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/.renovaterc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@1stg"
3 | }
4 |
--------------------------------------------------------------------------------
/.versionrc:
--------------------------------------------------------------------------------
1 | {
2 | "skip": {
3 | "bump": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 | ## 0.4.0 (2020-02-08)
6 |
7 | ### Features
8 |
9 | - Custom Events on `dynamic` component is supported, see [#23](https://github.com/JounQin/vue-dynamic/issues/23) for more details ([1450f15](https://github.com/JounQin/vue-dynamic/commit/1450f153dab91c67ecd32e865e21587fc488efcf))
10 | - migrate to TypeScript ([29ad055](https://github.com/JounQin/vue-dynamic/commit/29ad0553c5aef084e70f192ac14106d0daa00db8))
11 |
12 | ### Bug Fixes
13 |
14 | - transform to es5 compatible ES Module files, close [#25](https://github.com/JounQin/vue-dynamic/issues/25) ([3a8d362](https://github.com/JounQin/vue-dynamic/commit/3a8d3626ba80233741cd7157683adb3181f08069))
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016-present JounQin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-dynamic
2 |
3 | [](https://github.com/JounQin/vue-dynamic/actions?query=workflow%3A%22Node+CI%22)
4 | [](https://www.codacy.com/gh/JounQin/vue-dynamic)
5 | [](https://www.npmjs.com/package/vue-dynamic)
6 | [](https://github.com/JounQin/vue-dynamic/releases)
7 |
8 | [](https://david-dm.org/JounQin/vue-dynamic?type=peer)
9 | [](https://david-dm.org/JounQin/vue-dynamic)
10 | [](https://david-dm.org/JounQin/vue-dynamic?type=dev)
11 |
12 | [](https://conventionalcommits.org)
13 | [](https://renovatebot.com)
14 | [](https://standardjs.com)
15 | [](https://github.com/prettier/prettier)
16 | [](https://codechecks.io)
17 |
18 | Load stringified or normal Vue components dynamically!
19 |
20 | ## TOC
21 |
22 | - [Notice](#notice)
23 | - [Usage](#usage)
24 | - [Changelog](#changelog)
25 | - [License](#license)
26 |
27 | ## Notice
28 |
29 | This module is just a simple wrapper of Vue's built-in `component`, and you should only use it to use stringified static components.
30 |
31 | ## Usage
32 |
33 | _1.Global Component_
34 |
35 | ```js
36 | import Vue from 'vue' // make sure to use 'vue/dist/vue.js' because we will use template
37 | import VueDynamic from 'vue-dynamic'
38 |
39 | Vue.use(VueDynamic, { name: 'dynamic' }) // you can custom the global component name and it's default name is 'dynamic'
40 | ```
41 |
42 | Then it will be same with the next case:
43 |
44 | _2.Specific Component_
45 |
46 | ```vue
47 |
48 |