From 0fb4920e7b68c530fc489ec4cf43fa77e1775bfe Mon Sep 17 00:00:00 2001
From: Evan You
Date: Tue, 1 Mar 2016 17:38:14 -0500
Subject: [PATCH 1/3] readme
---
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 5c79e60b8..d1f1b84c8 100644
--- a/README.md
+++ b/README.md
@@ -6,10 +6,8 @@
-## NOTE: Vuex is still in development - API may change anytime.
-
- [Documentation](http://vuex.vuejs.org/)
-- [Great introduction and explanation by @skyronic](http://skyronic.com/2016/01/03/vuex-basics-tutorial/)
+- [Great introduction and explanation by @skyronic](http://skyronic.com/2016/01/03/vuex-basics-tutorial/) (using outdated 0.3.0 API, but still worth a read!)
## Examples
From 3c6d085ab82bc2f6f0b533b4808e5f1d35f2c7ce Mon Sep 17 00:00:00 2001
From: Evan You
Date: Tue, 1 Mar 2016 18:16:56 -0500
Subject: [PATCH 2/3] dist build
---
.babelrc | 9 ++++++-
build/build.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
package.json | 13 ++++++----
3 files changed, 86 insertions(+), 6 deletions(-)
create mode 100644 build/build.js
diff --git a/.babelrc b/.babelrc
index 05581748b..01d096c1f 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,10 @@
{
- "presets": ["es2015", "stage-2"]
+ "env": {
+ "development": {
+ "presets": ["es2015", "stage-2"]
+ },
+ "production": {
+ "presets": ["es2015-rollup"]
+ }
+ }
}
diff --git a/build/build.js b/build/build.js
new file mode 100644
index 000000000..861395b37
--- /dev/null
+++ b/build/build.js
@@ -0,0 +1,70 @@
+process.env.BABEL_ENV = 'production'
+
+var fs = require('fs')
+var zlib = require('zlib')
+var rollup = require('rollup')
+var uglify = require('uglify-js')
+var babel = require('rollup-plugin-babel')
+var version = process.env.VERSION || require('../package.json').version
+
+var banner =
+ '/*!\n' +
+ ' * Vuex v' + version + '\n' +
+ ' * (c) ' + new Date().getFullYear() + ' Evan You\n' +
+ ' * Released under the MIT License.\n' +
+ ' */'
+
+rollup.rollup({
+ entry: 'src/index.js',
+ plugins: [babel()]
+})
+.then(function (bundle) {
+ return write('dist/vuex.js', bundle.generate({
+ format: 'umd',
+ banner: banner,
+ moduleName: 'Vuex'
+ }).code)
+})
+.then(function () {
+ // Standalone Production Build
+ return rollup.rollup({
+ entry: 'src/index.js',
+ plugins: [babel()]
+ })
+})
+.then(function (bundle) {
+ var code = bundle.generate({
+ format: 'umd',
+ moduleName: 'Vuex'
+ }).code
+ var minified = banner + '\n' + uglify.minify(code, {
+ fromString: true,
+ output: {
+ ascii_only: true
+ }
+ }).code
+ return write('dist/vuex.min.js', minified)
+})
+.catch(logError)
+
+function write (dest, code) {
+ return new Promise(function (resolve, reject) {
+ fs.writeFile(dest, code, function (err) {
+ if (err) return reject(err)
+ console.log(blue(dest) + ' ' + getSize(code))
+ resolve()
+ })
+ })
+}
+
+function getSize (code) {
+ return (code.length / 1024).toFixed(2) + 'kb'
+}
+
+function logError (e) {
+ console.log(e)
+}
+
+function blue (str) {
+ return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
+}
diff --git a/package.json b/package.json
index cd25dbda5..1a8c2e3d0 100644
--- a/package.json
+++ b/package.json
@@ -2,9 +2,9 @@
"name": "vuex",
"version": "0.4.0",
"description": "state management for Vue.js",
- "main": "lib/index.js",
+ "main": "dist/vuex.js",
"files": [
- "lib",
+ "dist",
"src"
],
"scripts": {
@@ -13,7 +13,7 @@
"todomvc": "cd examples/todomvc && webpack-dev-server --inline --hot --config ../webpack.shared.config.js",
"cart": "cd examples/shopping-cart && webpack-dev-server --inline --hot --config ../webpack.shared.config.js",
"chat": "cd examples/chat && webpack-dev-server --inline --hot --config ../webpack.shared.config.js",
- "prepublish": "babel src --out-dir lib --presets es2015 --plugins add-module-exports",
+ "build": "node build/build.js",
"test": "eslint src && mocha --compilers js:babel-core/register",
"docs": "cd docs && gitbook serve",
"deploy-docs": "cd docs && ./deploy.sh"
@@ -29,13 +29,13 @@
},
"homepage": "https://github.com/vuejs/vuex#readme",
"devDependencies": {
- "babel-cli": "^6.6.0",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-plugin-add-module-exports": "^0.1.1",
"babel-plugin-transform-runtime": "^6.1.18",
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
+ "babel-preset-es2015-rollup": "^1.1.1",
"babel-preset-stage-2": "^6.1.18",
"babel-runtime": "^5.8.0",
"chai": "^3.4.1",
@@ -45,12 +45,15 @@
"eslint-plugin-promise": "^1.0.8",
"eslint-plugin-standard": "^1.3.2",
"mocha": "^2.3.4",
- "style-loader": "^0.13.0",
+ "rollup": "^0.25.4",
+ "rollup-plugin-babel": "^2.4.0",
"todomvc-app-css": "^2.0.3",
+ "uglify-js": "^2.6.2",
"vue": "^1.0.8",
"vue-hot-reload-api": "^1.2.1",
"vue-html-loader": "^1.0.0",
"vue-loader": "^8.2.0",
+ "vue-style-loader": "^1.0.0",
"webpack": "^1.12.8",
"webpack-dev-server": "^1.12.1"
}
From 2c5b08d3d208b97548461516951b347c931e4380 Mon Sep 17 00:00:00 2001
From: Evan You
Date: Tue, 1 Mar 2016 18:18:56 -0500
Subject: [PATCH 3/3] 0.4.1 + dist build
---
bower.json | 2 +-
dist/vuex.js | 506 +++++++++++++++++++++++++++++++++++++++++++++++
dist/vuex.min.js | 6 +
package.json | 2 +-
4 files changed, 514 insertions(+), 2 deletions(-)
create mode 100644 dist/vuex.js
create mode 100644 dist/vuex.min.js
diff --git a/bower.json b/bower.json
index 991d45a14..cc13a359c 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "vuex",
- "main": "lib/index.js",
+ "main": "dist/vuex.js",
"description": "state management for Vue.js",
"authors": "Evan You",
"license": "MIT",
diff --git a/dist/vuex.js b/dist/vuex.js
new file mode 100644
index 000000000..41a2e8904
--- /dev/null
+++ b/dist/vuex.js
@@ -0,0 +1,506 @@
+/*!
+ * Vuex v0.4.1
+ * (c) 2016 Evan You
+ * Released under the MIT License.
+ */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (factory((global.Vuex = global.Vuex || {})));
+}(this, function (exports) { 'use strict';
+
+ var babelHelpers = {};
+ babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+ } : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
+ };
+
+ babelHelpers.classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ };
+
+ babelHelpers.createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+ }();
+
+ babelHelpers;
+
+ /**
+ * Merge an array of objects into one.
+ *
+ * @param {Array