Skip to content

Commit 56b6f8a

Browse files
committed
[build] 2.3.0-beta.1
1 parent cb0531c commit 56b6f8a

File tree

14 files changed

+11964
-14065
lines changed

14 files changed

+11964
-14065
lines changed

dist/vue.common.js

Lines changed: 883 additions & 589 deletions
Large diffs are not rendered by default.

dist/vue.esm.js

Lines changed: 883 additions & 589 deletions
Large diffs are not rendered by default.

dist/vue.js

Lines changed: 860 additions & 568 deletions
Large diffs are not rendered by default.

dist/vue.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue.runtime.common.js

Lines changed: 846 additions & 593 deletions
Large diffs are not rendered by default.

dist/vue.runtime.esm.js

Lines changed: 846 additions & 593 deletions
Large diffs are not rendered by default.

dist/vue.runtime.js

Lines changed: 843 additions & 592 deletions
Large diffs are not rendered by default.

dist/vue.runtime.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue-server-renderer/build.js

Lines changed: 4331 additions & 5629 deletions
Large diffs are not rendered by default.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
'use strict';
2+
3+
/* */
4+
5+
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
6+
7+
var ref = require('chalk');
8+
var red = ref.red;
9+
var yellow = ref.yellow;
10+
11+
var prefix = "[vue-server-renderer-webpack-plugin]";
12+
var warn = exports.warn = function (msg) { return console.error(red((prefix + " " + msg + "\n"))); };
13+
var tip = exports.tip = function (msg) { return console.log(yellow((prefix + " " + msg + "\n"))); };
14+
15+
var hash = require('hash-sum');
16+
var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
17+
if ( options === void 0 ) options = {};
18+
19+
this.options = Object.assign({
20+
filename: 'vue-ssr-client-manifest.json'
21+
}, options);
22+
};
23+
24+
VueSSRClientPlugin.prototype.apply = function apply (compiler) {
25+
var this$1 = this;
26+
27+
compiler.plugin('emit', function (compilation, cb) {
28+
var stats = compilation.getStats().toJson();
29+
30+
var allFiles = stats.assets
31+
.map(function (a) { return a.name; });
32+
33+
var initialFiles = Object.keys(stats.entrypoints)
34+
.map(function (name) { return stats.entrypoints[name].assets; })
35+
.reduce(function (assets, all) { return all.concat(assets); }, [])
36+
.filter(isJS);
37+
38+
var asyncFiles = allFiles
39+
.filter(isJS)
40+
.filter(function (file) { return initialFiles.indexOf(file) < 0; });
41+
42+
var manifest = {
43+
publicPath: stats.publicPath,
44+
all: allFiles,
45+
initial: initialFiles,
46+
async: asyncFiles,
47+
modules: { /* [identifier: string]: Array<index: number> */ }
48+
};
49+
50+
var assetModules = stats.modules.filter(function (m) { return m.assets.length; });
51+
var fileToIndex = function (file) { return manifest.all.indexOf(file); };
52+
stats.modules.forEach(function (m) {
53+
// ignore modules duplicated in multiple chunks
54+
if (m.chunks.length === 1) {
55+
var cid = m.chunks[0];
56+
var chunk = stats.chunks.find(function (c) { return c.id === cid; });
57+
var files = manifest.modules[hash(m.identifier)] = chunk.files.map(fileToIndex);
58+
// find all asset modules associated with the same chunk
59+
assetModules.forEach(function (m) {
60+
if (m.chunks.some(function (id) { return id === cid; })) {
61+
files.push.apply(files, m.assets.map(fileToIndex));
62+
}
63+
});
64+
}
65+
});
66+
67+
// const debug = (file, obj) => {
68+
// require('fs').writeFileSync(__dirname + '/' + file, JSON.stringify(obj, null, 2))
69+
// }
70+
// debug('stats.json', stats)
71+
// debug('client-manifest.json', manifest)
72+
73+
var json = JSON.stringify(manifest, null, 2);
74+
compilation.assets[this$1.options.filename] = {
75+
source: function () { return json; },
76+
size: function () { return json.length; }
77+
};
78+
cb();
79+
});
80+
};
81+
82+
module.exports = VueSSRClientPlugin;

0 commit comments

Comments
 (0)