Skip to content

Commit

Permalink
build: build v2.5.18-beta.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 2, 2018
1 parent 3078352 commit fe194dd
Show file tree
Hide file tree
Showing 16 changed files with 31,255 additions and 31,025 deletions.
889 changes: 492 additions & 397 deletions dist/vue.common.js

Large diffs are not rendered by default.

889 changes: 492 additions & 397 deletions dist/vue.esm.js

Large diffs are not rendered by default.

19,573 changes: 9,826 additions & 9,747 deletions dist/vue.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vue.min.js

Large diffs are not rendered by default.

757 changes: 403 additions & 354 deletions dist/vue.runtime.common.js

Large diffs are not rendered by default.

757 changes: 403 additions & 354 deletions dist/vue.runtime.esm.js

Large diffs are not rendered by default.

13,947 changes: 6,993 additions & 6,954 deletions dist/vue.runtime.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vue.runtime.min.js

Large diffs are not rendered by default.

14,621 changes: 7,293 additions & 7,328 deletions packages/vue-server-renderer/basic.js

Large diffs are not rendered by default.

793 changes: 408 additions & 385 deletions packages/vue-server-renderer/build.js

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions packages/vue-server-renderer/client-plugin.js
Expand Up @@ -4,6 +4,8 @@

var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };

var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); };

var ref = require('chalk');
var red = ref.red;
var yellow = ref.yellow;
Expand All @@ -12,8 +14,19 @@ var prefix = "[vue-server-renderer-webpack-plugin]";
var warn = exports.warn = function (msg) { return console.error(red((prefix + " " + msg + "\n"))); };
var tip = exports.tip = function (msg) { return console.log(yellow((prefix + " " + msg + "\n"))); };

var onEmit = function (compiler, name, hook) {
if (compiler.hooks) {
// Webpack >= 4.0.0
compiler.hooks.emit.tapAsync(name, hook);
} else {
// Webpack < 4.0.0
compiler.plugin('emit', hook);
}
};

var hash = require('hash-sum');
var uniq = require('lodash.uniq');

var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
if ( options === void 0 ) options = {};

Expand All @@ -25,7 +38,7 @@ var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
VueSSRClientPlugin.prototype.apply = function apply (compiler) {
var this$1 = this;

compiler.plugin('emit', function (compilation, cb) {
onEmit(compiler, 'vue-client-plugin', function (compilation, cb) {
var stats = compilation.getStats().toJson();

var allFiles = uniq(stats.assets
Expand All @@ -34,10 +47,10 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
var initialFiles = uniq(Object.keys(stats.entrypoints)
.map(function (name) { return stats.entrypoints[name].assets; })
.reduce(function (assets, all) { return all.concat(assets); }, [])
.filter(isJS));
.filter(function (file) { return isJS(file) || isCSS(file); }));

var asyncFiles = allFiles
.filter(isJS)
.filter(function (file) { return isJS(file) || isCSS(file); })
.filter(function (file) { return initialFiles.indexOf(file) < 0; });

var manifest = {
Expand All @@ -58,7 +71,8 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
if (!chunk || !chunk.files) {
return
}
var files = manifest.modules[hash(m.identifier)] = chunk.files.map(fileToIndex);
var id = m.identifier.replace(/\s\w+$/, ''); // remove appended hash
var files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex);
// find all asset modules associated with the same chunk
assetModules.forEach(function (m) {
if (m.chunks.some(function (id) { return id === cid; })) {
Expand All @@ -68,12 +82,6 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
}
});

// const debug = (file, obj) => {
// require('fs').writeFileSync(__dirname + '/' + file, JSON.stringify(obj, null, 2))
// }
// debug('stats.json', stats)
// debug('client-manifest.json', manifest)

var json = JSON.stringify(manifest, null, 2);
compilation.assets[this$1.options.filename] = {
source: function () { return json; },
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-server-renderer/package.json
@@ -1,6 +1,6 @@
{
"name": "vue-server-renderer",
"version": "2.5.17-beta.0",
"version": "2.5.18-beta.0",
"description": "server renderer for Vue 2.0",
"main": "index.js",
"types": "types/index.d.ts",
Expand Down
14 changes: 12 additions & 2 deletions packages/vue-server-renderer/server-plugin.js
Expand Up @@ -29,6 +29,16 @@ var validate = function (compiler) {
}
};

var onEmit = function (compiler, name, hook) {
if (compiler.hooks) {
// Webpack >= 4.0.0
compiler.hooks.emit.tapAsync(name, hook);
} else {
// Webpack < 4.0.0
compiler.plugin('emit', hook);
}
};

var VueSSRServerPlugin = function VueSSRServerPlugin (options) {
if ( options === void 0 ) options = {};

Expand All @@ -42,7 +52,7 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {

validate(compiler);

compiler.plugin('emit', function (compilation, cb) {
onEmit(compiler, 'vue-server-plugin', function (compilation, cb) {
var stats = compilation.getStats().toJson();
var entryName = Object.keys(stats.entrypoints)[0];
var entryInfo = stats.entrypoints[entryName];
Expand Down Expand Up @@ -75,7 +85,7 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
};

stats.assets.forEach(function (asset) {
if (asset.name.match(/\.js$/)) {
if (isJS(asset.name)) {
bundle.files[asset.name] = compilation.assets[asset.name].source();
} else if (asset.name.match(/\.js\.map$/)) {
bundle.maps[asset.name.replace(/\.map$/, '')] = JSON.parse(compilation.assets[asset.name].source());
Expand Down

0 comments on commit fe194dd

Please sign in to comment.