Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
evio committed Aug 5, 2016
1 parent 89bc222 commit 03ed466
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 11 deletions.
12 changes: 6 additions & 6 deletions miox-vue-engine/build.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions miox-vue-engine/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { EventEmitter } from 'events';
import isClass from 'is-class';
import deepCopy from 'deepcopy';
import Vue from 'vue';
import { Params, Events, Inits } from './params';

export default class Component extends EventEmitter {
constructor(){
super();
this.__objects__ = ['data', 'computed', 'methods', 'watch', 'directives', 'elementDirectives', 'filters', 'components', 'transitions', 'partials', 'events', 'mixins', 'extends', 'props', 'propsData'];
this.__methods__ = ['init', 'created', 'beforeCompile', 'compiled', 'ready', 'attached', 'detached', 'beforeDestroy', 'destroyed'];
this.__objects__ = Params;
this.__methods__ = Events;
this.__dataBase__ = {};
this.__duplicate__ = document.createElement('div');
this.__initData__();
Expand Down Expand Up @@ -72,6 +73,7 @@ export default class Component extends EventEmitter {
}

}
Inits.forEach(init => init(this.__dataBase__));
});

if ( typeof this.template === 'function' ){
Expand Down
20 changes: 20 additions & 0 deletions miox-vue-engine/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import isClass from 'is-class';
import Vue from 'vue';
import { Params, Events, Inits } from './params';

export default class Engine {
constructor(ctx){
Expand Down Expand Up @@ -43,6 +44,25 @@ export default class Engine {
}
});
}

addParam(name){
Params.push(name);
return this;
}

addEvent(name){
Events.push(name);
return this;
}

addInit(fn){
if ( typeof fn === 'function' ){
Inits.push(fn);
}else{
throw new Error('addInit methods need a function object');
}
return this;
}
}

function PatchURL(method, ctx){
Expand Down
2 changes: 1 addition & 1 deletion miox-vue-engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miox-vue-engine",
"version": "0.0.8",
"version": "0.0.9",
"description": "miox vue engine",
"author": "沈赟杰",
"license": "MIT",
Expand Down
35 changes: 35 additions & 0 deletions miox-vue-engine/params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Created by evio on 16/8/5.
*/
'use strict';

export const Params = [
'data',
'computed',
'methods',
'watch',
'directives',
'elementDirectives',
'filters',
'components',
'transitions',
'partials',
'events', 'mixins',
'extends',
'props',
'propsData'
];

export const Events = [
'init',
'created',
'beforeCompile',
'compiled',
'ready',
'attached',
'detached',
'beforeDestroy',
'destroyed'
];

export const Inits = [];
6 changes: 6 additions & 0 deletions miox-vue-vuex/build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions miox-vue-vuex/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Created by evio on 16/8/5.
*/
'use strict';

import vuex from 'vuex';

export const Vuex = vuex;

export const install = function(Engine, Vue){
Engine.addParam('store');
Engine.addParam('vuex');

Engine.addInit(function(database){
if ( database.vuex ){
if ( Object.keys(database.vuex).length === 0 ){
delete database.vuex;
}
}
});

Engine.addInit(function(database){
if ( database.store ){
if ( !database.store._getterCacheId ){
delete database.store;
}
}
});

Vue.use(Vuex);
};
11 changes: 11 additions & 0 deletions miox-vue-vuex/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "miox-vuex",
"version": "0.0.1",
"description": "miox vue vux",
"author": "沈赟杰",
"license": "MIT",
"main": "build.js",
"scripts": {
"pub": "npm publish"
}
}
50 changes: 50 additions & 0 deletions miox-vue-vuex/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Created by evio on 16/7/20.
*/
'use strict';

const path = require('path');
const AutoPrefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const result = {};
result.plugins = [];

result.plugins.push(new ExtractTextPlugin('build.css'));
/**
* 配置启动文件地址
* @type {*|Promise.<*>}
*/
result.entry = path.resolve(__dirname, './index.js');

/**
* 配置输出文件地址和输出文件模式
* @type {{path: (*|Promise.<*>), filename: string, libraryTarget: string}}
*/
result.output = {
path: __dirname,
filename: 'build.js',
library: 'MioxVuex',
libraryTarget: 'umd'
};

result.module = {};

/**
* 配置loaders
* @type {*[]}
*/
result.module.loaders = [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel" },
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style", "css!postcss") },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract("style", "css!postcss!sass") }
];

/**
* autoprefix
* @returns {*[]}
*/
result.postcss = () => {
return [ AutoPrefixer({browsers: ['last 20 versions']}) ];
};

module.exports = result;
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"scripts": {
"dev": "NODE_ENV=development node_modules/.bin/webpack-dev-server --config miox/build/webpack.config.js --host 0.0.0.0 --port 8090 --progress --colors --inline --hot --display-error-details --content-base miox/src/",
"git": "git add . && git commit -am 'update' && git push",
"build-all": "npm run build && npm run build-vue-engine && npm run build-router && npm run build-animate && npm run build-vue-components && npm run build-websql && npm run build-scroller",
"build-all": "npm run build && npm run build-vue-engine && npm run build-router && npm run build-animate && npm run build-vue-components && npm run build-websql && npm run build-scroller && npm run build-vuex",
"build": "rimraf ./miox/release/ && NODE_ENV=production webpack --config miox/build/webpack.config.js -p",
"build-vue-engine": "NODE_ENV=production webpack --config miox-vue-engine/webpack.config.js -p",
"build-router": "NODE_ENV=production webpack --config miox-router/webpack.config.js -p",
"build-animate": "NODE_ENV=production webpack --config miox-animate/webpack.config.js -p",
"build-vue-components": "NODE_ENV=production webpack --config miox-vue-components/webpack.config.js -p",
"build-websql": "NODE_ENV=production webpack --config miox-websql/webpack.config.js -p",
"build-scroller": "NODE_ENV=production webpack --config miox-vue-scroller/webpack.config.js -p"
"build-scroller": "NODE_ENV=production webpack --config miox-vue-scroller/webpack.config.js -p",
"build-vuex": "NODE_ENV=production webpack --config miox-vue-vuex/webpack.config.js -p"
},
"files": [
"moix",
Expand Down Expand Up @@ -57,6 +58,7 @@
"unique-array": "^1.0.1",
"url": "^0.11.0",
"vue": "^1.0.26",
"vuex": "^1.0.0-rc.2",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
}
Expand Down

0 comments on commit 03ed466

Please sign in to comment.