"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/vue-server-renderer/client-plugin.js" between
vue-2.6.13.tar.gz and vue-2.6.14.tar.gz

About: Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

client-plugin.js  (vue-2.6.13):client-plugin.js  (vue-2.6.14)
skipping to change at line 12 skipping to change at line 12
/* */ /* */
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); }; var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); }; var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); };
var ref = require('chalk'); var ref = require('chalk');
var red = ref.red; var red = ref.red;
var yellow = ref.yellow; var yellow = ref.yellow;
var webpack = require('webpack');
var prefix = "[vue-server-renderer-webpack-plugin]"; var prefix = "[vue-server-renderer-webpack-plugin]";
var warn = exports.warn = function (msg) { return console.error(red((prefix + " " + msg + "\n"))); }; 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 tip = exports.tip = function (msg) { return console.log(yellow((prefix + " " + msg + "\n"))); };
var onEmit = function (compiler, name, hook) { var isWebpack5 = !!(webpack.version && webpack.version[0] > 4);
if (compiler.hooks) {
var onEmit = function (compiler, name, stageName, hook) {
if (isWebpack5) {
// Webpack >= 5.0.0
compiler.hooks.compilation.tap(name, function (compilation) {
if (compilation.compiler !== compiler) {
// Ignore child compilers
return
}
var stage = webpack.Compilation[stageName];
compilation.hooks.processAssets.tapAsync({ name: name, stage: stage }, fun
ction (assets, cb) {
hook(compilation, cb);
});
});
} else if (compiler.hooks) {
// Webpack >= 4.0.0 // Webpack >= 4.0.0
compiler.hooks.emit.tapAsync(name, hook); compiler.hooks.emit.tapAsync(name, hook);
} else { } else {
// Webpack < 4.0.0 // Webpack < 4.0.0
compiler.plugin('emit', hook); compiler.plugin('emit', hook);
} }
}; };
var stripModuleIdHash = function (id) {
if (isWebpack5) {
// Webpack >= 5.0.0
return id.replace(/\|\w+$/, '')
}
// Webpack < 5.0.0
return id.replace(/\s\w+$/, '')
};
var getAssetName = function (asset) {
if (typeof asset === 'string') {
return asset
}
return asset.name
};
var hash = require('hash-sum'); var hash = require('hash-sum');
var uniq = require('lodash.uniq'); var uniq = require('lodash.uniq');
var VueSSRClientPlugin = function VueSSRClientPlugin (options) { var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
if ( options === void 0 ) options = {}; if ( options === void 0 ) options = {};
this.options = Object.assign({ this.options = Object.assign({
filename: 'vue-ssr-client-manifest.json' filename: 'vue-ssr-client-manifest.json'
}, options); }, options);
}; };
VueSSRClientPlugin.prototype.apply = function apply (compiler) { VueSSRClientPlugin.prototype.apply = function apply (compiler) {
var this$1 = this; var this$1 = this;
onEmit(compiler, 'vue-client-plugin', function (compilation, cb) { var stage = 'PROCESS_ASSETS_STAGE_ADDITIONAL';
onEmit(compiler, 'vue-client-plugin', stage, function (compilation, cb) {
var stats = compilation.getStats().toJson(); var stats = compilation.getStats().toJson();
var allFiles = uniq(stats.assets var allFiles = uniq(stats.assets
.map(function (a) { return a.name; })); .map(function (a) { return a.name; }));
var initialFiles = uniq(Object.keys(stats.entrypoints) var initialFiles = uniq(Object.keys(stats.entrypoints)
.map(function (name) { return stats.entrypoints[name].assets; }) .map(function (name) { return stats.entrypoints[name].assets; })
.reduce(function (assets, all) { return all.concat(assets); }, []) .reduce(function (assets, all) { return all.concat(assets); }, [])
.map(getAssetName)
.filter(function (file) { return isJS(file) || isCSS(file); })); .filter(function (file) { return isJS(file) || isCSS(file); }));
var asyncFiles = allFiles var asyncFiles = allFiles
.filter(function (file) { return isJS(file) || isCSS(file); }) .filter(function (file) { return isJS(file) || isCSS(file); })
.filter(function (file) { return initialFiles.indexOf(file) < 0; }); .filter(function (file) { return initialFiles.indexOf(file) < 0; });
var manifest = { var manifest = {
publicPath: stats.publicPath, publicPath: stats.publicPath,
all: allFiles, all: allFiles,
initial: initialFiles, initial: initialFiles,
async: asyncFiles, async: asyncFiles,
modules: { /* [identifier: string]: Array<index: number> */ } modules: { /* [identifier: string]: Array<index: number> */ }
}; };
var assetModules = stats.modules.filter(function (m) { return m.assets.lengt h; }); var assetModules = stats.modules.filter(function (m) { return m.assets.lengt h; });
var fileToIndex = function (file) { return manifest.all.indexOf(file); }; var fileToIndex = function (asset) { return manifest.all.indexOf(getAssetNam e(asset)); };
stats.modules.forEach(function (m) { stats.modules.forEach(function (m) {
// ignore modules duplicated in multiple chunks // ignore modules duplicated in multiple chunks
if (m.chunks.length === 1) { if (m.chunks.length === 1) {
var cid = m.chunks[0]; var cid = m.chunks[0];
var chunk = stats.chunks.find(function (c) { return c.id === cid; }); var chunk = stats.chunks.find(function (c) { return c.id === cid; });
if (!chunk || !chunk.files) { if (!chunk || !chunk.files) {
return return
} }
var id = m.identifier.replace(/\s\w+$/, ''); // remove appended hash var id = stripModuleIdHash(m.identifier);
var files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex); var files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex);
// find all asset modules associated with the same chunk // find all asset modules associated with the same chunk
assetModules.forEach(function (m) { assetModules.forEach(function (m) {
if (m.chunks.some(function (id) { return id === cid; })) { if (m.chunks.some(function (id) { return id === cid; })) {
files.push.apply(files, m.assets.map(fileToIndex)); files.push.apply(files, m.assets.map(fileToIndex));
} }
}); });
} }
}); });
 End of changes. 7 change blocks. 
5 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)