Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

add webpack script, dist and src folders #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: dist

dist:
webpack --config build/webpack.build.config.js
39 changes: 39 additions & 0 deletions build/webpack.build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var webpack = require("webpack");
var version = require("../package.json").version;
var banner =
"/**\n" +
" * vue-async-data v" + version + "\n" +
" * https://github.com/vuejs/vue-async-data\n" +
" * Released under the MIT License.\n" +
" */\n";

module.exports = [

{
entry: "./src/vue-async-data",
output: {
path: "./dist",
filename: "vue-async-data.js",
library: "VueAsyncData",
libraryTarget: "umd"
},
plugins: [
new webpack.BannerPlugin(banner, {raw: true})
]
},

{
entry: "./src/vue-async-data",
output: {
path: "./dist",
filename: "vue-async-data.min.js",
library: "VueAsyncData",
libraryTarget: "umd"
},
plugins: [
new webpack.optimize.UglifyJsPlugin,
new webpack.BannerPlugin(banner, {raw: true})
]
}

];
139 changes: 139 additions & 0 deletions dist/vue-async-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/**
* vue-async-data v1.0.2
* https://github.com/vuejs/vue-async-data
* Released under the MIT License.
*/

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["VueAsyncData"] = factory();
else
root["VueAsyncData"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

(function () {
var vue // lazy bind

var asyncData = {
created: function () {
if (!vue) {
console.warn('[vue-async-data] not installed!')
return
}
if (this.$options.asyncData) {
if (this._defineMeta) {
// 0.12 compat
this._defineMeta('$loadingAsyncData', true)
} else {
// ^1.0.0-alpha
vue.util.defineReactive(this, '$loadingAsyncData', true)
}
}
},
compiled: function () {
this.reloadAsyncData()
},
methods: {
reloadAsyncData: function () {
var load = this.$options.asyncData
if (load) {
var self = this
var resolve = function (data) {
if (data) {
for (var key in data) {
self.$set(key, data[key])
}
}
self.$loadingAsyncData = false
self.$emit('async-data')
}
var reject = function (reason) {
var msg = '[vue] async data load failed'
if (reason instanceof Error) {
console.warn(msg)
throw reason
} else {
console.warn(msg + ': ' + reason)
}
}
this.$loadingAsyncData = true
var res = load.call(this, resolve, reject)
if (res && typeof res.then === 'function') {
res.then(resolve, reject)
}
}
}
}
}

var api = {
mixin: asyncData,
install: function (Vue, options) {
vue = Vue
Vue.options = Vue.util.mergeOptions(Vue.options, asyncData)
}
}

if(true) {
module.exports = api
} else if(typeof define === 'function' && define.amd) {
define(function () { return api })
} else if (typeof window !== 'undefined') {
window.VueAsyncData = api
}
})()


/***/ }
/******/ ])
});
;
7 changes: 7 additions & 0 deletions dist/vue-async-data.min.js

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

File renamed without changes.