Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

WIP: Rollup Plugin Vue 3.0 #142

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
version: 2
jobs:
build:
working_directory: ~/rollup-plugin-vue
working_directory: ~/project
docker:
- image: circleci/node:8.5.0
- image: alekzonder/puppeteer # base image: node/8-slim
steps:
- checkout
- run:
name: Install yarn
- run:
name: Install yarn if required
command: curl -o- -s -L https://yarnpkg.com/install.sh | bash
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install package dependencies
command: yarn --no-progress
- run:
name: Rebuild node-sass
command: npm rebuild node-sass
command: yarn --no-progress install --pure-lockfile
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
Expand Down
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
27 changes: 0 additions & 27 deletions .eslintrc.json

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
dist/
/.github/sereno/public
/_cache
test/style.css
output/

test/target/

# Logs
logs/
*.log
Expand Down
9 changes: 0 additions & 9 deletions .npmignore

This file was deleted.

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ As vue-loader is for webpack and vueify is for browserify, similarly its for rol

With rollup you can break your application into reusable modules.

> See [docs](http://vuejs.github.io/rollup-plugin-vue) for installing, using and contributing.

<p align="center">
<a href="https://circleci.com/gh/vuejs/rollup-plugin-vue">
<img src="https://circleci.com/gh/vuejs/rollup-plugin-vue.svg?style=svg" alt="Build Status" />
Expand Down Expand Up @@ -37,6 +35,19 @@ With rollup you can break your application into reusable modules.
</a>
</p>

## Usage

```js
import vue from 'rollup-plugin-vue'

export default {
entry: 'main.js',
plugins: [
vue(/* options */)
]
}
```

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Expand Down
12 changes: 6 additions & 6 deletions config/banner.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use strict";
'use strict'

let pack = require('../package.json');
const pack = require('../package.json')

const VERSION = process.env.VERSION || pack.version;
const YEAR = new Date().getFullYear();
const VERSION = process.env.VERSION || pack.version
const YEAR = new Date().getFullYear()

const BANNER = `/*!
* ${pack.name} v${VERSION}
* (c) ${YEAR} ${pack.author}
* Release under the ${pack.license} License.
*/`;
*/`

module.exports = BANNER;
module.exports = BANNER
88 changes: 35 additions & 53 deletions config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,47 @@

const babel = require('rollup-plugin-babel')
const rollup = require('rollup')
const replace = require('rollup-plugin-replace')
const zlib = require('zlib')
const fs = require('fs')
const pack = require('../package.json')
const banner = require('./banner')

const main = fs
.readFileSync('src/index.js', 'utf-8')
.replace(/plugin\.version = '[\d\.]+'/, `plugin.version = '${pack.version}'`)
const dependencies = Object.keys(pack.dependencies).concat('path')

fs.writeFileSync('src/index.js', main)

rollup.rollup({
rollup
.rollup({
input: 'src/index.js',
external(id) {
return dependencies.some(it => it === id || id.startsWith(it))
},
plugins: [
babel({ runtimeHelpers: true })
],
external (id) {
if (/babel-runtime\/.*/i.test(id)) {
return true
}

return [
'camelcase',
'coffeescript-compiler',
'de-indent',
'debug',
'fs',
'hash-sum',
'html-minifier',
'less',
'magic-string',
'merge-options',
'node-sass',
'parse5',
'path',
'postcss',
'postcss-load-config',
'postcss-modules',
'postcss-selector-parser',
'posthtml',
'posthtml-attrs-parser',
'pug',
'rollup-pluginutils',
'stylus',
'vue-template-es2015-compiler',
'vue-template-validator',
'typescript'
].indexOf(id) > -1
}
}).then(function (bundle) {
babel({
exclude: 'node_modules/**',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
target: { node: 6 }
}
]
],
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-runtime'
],
runtimeHelpers: true
})
]
})
.then(bundle => {
bundle.write({
format: 'cjs',
file: 'dist/' + pack.name + '.common.js'
format: 'cjs',
file: 'dist/' + pack.name + '.common.js',
sourcemap: true
})
bundle.write({
format: 'es',
file: 'dist/' + pack.name + '.js'
format: 'es',
file: 'dist/' + pack.name + '.js',
sourcemap: true
})
}).catch(function logError (e) {
console.log(e)
})
})
.catch(console.error)
79 changes: 43 additions & 36 deletions docs/config.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,58 @@
const languages = {
title: 'Language',
type: 'dropdown',
exact: true,
items: [
{ title: 'English', path: '/en/', matchPath: /\/en\/.*/i }
]
title: 'Language',
type: 'dropdown',
exact: true,
items: [{ title: 'English', path: '/en/', matchPath: /\/en\/.*/i }]
}

const home = { title: 'Home', path: '/' }

const versions = [
{ title: 'Version 2.2', path: '/2.2/', matchPath: /^\/([a-z-]+)\/2.2\/.*/i },
{ title: 'Version 2.3', path: '/2.3/', matchPath: /^\/([a-z-]+)\/2.3\/.*/i },
{ title: 'Version 2.2', path: '/2.2/', matchPath: /^\/([a-z-]+)\/2.2\/.*/i },
{ title: 'Version 2.3', path: '/2.3/', matchPath: /^\/([a-z-]+)\/2.3\/.*/i }
]

function lang_version(lang) {
const version = {
title: 'Version',
type: 'dropdown',
exact: true,
}
version.items = versions.map(function (v) {
const ver = Object.assign({}, v)
ver.path = '/' + lang + ver.path

return ver
})
const version = {
title: 'Version',
type: 'dropdown',
exact: true
}
version.items = versions.map(function(v) {
const ver = Object.assign({}, v)
ver.path = '/' + lang + ver.path

return version
return ver
})

return version
}

docute.init({
repo: 'vuejs/rollup-plugin-vue',
'edit-link': 'https://github.com/vuejs/rollup-plugin-vue/edit/master/docs',

nav: {
default: [home, languages, lang_version('en')],
'en2.3': [{ title: 'Home', path: '/en/2.3/' }, { title: 'Examples', path: '/en/2.3/examples' }, languages, lang_version('en')],
'en2.2': [{ title: 'Home', path: '/en/2.2/' }, { title: 'Examples', path: '/en/2.2/examples' }, languages, lang_version('en')],
},

plugins: [
docsearch({
apiKey: '7792597613e997afeb0b75a206ca0c5a',
indexName: 'rollup-plugin-vue',
url: 'https://vuejs.github.io/rollup-plugin-vue'
})
repo: 'vuejs/rollup-plugin-vue',
'edit-link': 'https://github.com/vuejs/rollup-plugin-vue/edit/master/docs',

nav: {
default: [home, languages, lang_version('en')],
'en2.3': [
{ title: 'Home', path: '/en/2.3/' },
{ title: 'Examples', path: '/en/2.3/examples' },
languages,
lang_version('en')
],
'en2.2': [
{ title: 'Home', path: '/en/2.2/' },
{ title: 'Examples', path: '/en/2.2/examples' },
languages,
lang_version('en')
]

},

plugins: [
docsearch({
apiKey: '7792597613e997afeb0b75a206ca0c5a',
indexName: 'rollup-plugin-vue',
url: 'https://vuejs.github.io/rollup-plugin-vue'
})
]
})
19 changes: 6 additions & 13 deletions example/Hello.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<template>
<div class="hello">
<h1 class="hello__title">{{ msg }}</h1>
</div>
<template functional>
<div class="hello">{{ props.message }}</div>
</template>

<script>
export default {
data () {
return {
msg: 'Hello World!'
}
}
props: ['message']
}
</script>

<style lang="stylus">

<style scoped>
.hello {
&__title {
color: #42b983;
}
color: red;
}
</style>
Loading