Eduardo San Martin Morote 4 роки тому
батько
коміт
8f6c4c3dbd

+ 3 - 3
dist/vue.common.dev.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2612,7 +2612,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     var vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };
@@ -5483,7 +5483,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
   value: FunctionalRenderContext
 });
 
-Vue.version = '2.6.13';
+Vue.version = '2.6.14';
 
 /*  */
 

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/vue.common.prod.js


+ 3 - 3
dist/vue.esm.browser.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2640,7 +2640,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     let vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };
@@ -5508,7 +5508,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
   value: FunctionalRenderContext
 });
 
-Vue.version = '2.6.13';
+Vue.version = '2.6.14';
 
 /*  */
 

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/vue.esm.browser.min.js


+ 3 - 3
dist/vue.esm.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2618,7 +2618,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     var vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };
@@ -5503,7 +5503,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
   value: FunctionalRenderContext
 });
 
-Vue.version = '2.6.13';
+Vue.version = '2.6.14';
 
 /*  */
 

+ 3 - 3
dist/vue.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2616,7 +2616,7 @@
       var vnode = res && res[0];
       return res && (
         !vnode ||
-        (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+        (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
       ) ? undefined
         : res
     };
@@ -5487,7 +5487,7 @@
     value: FunctionalRenderContext
   });
 
-  Vue.version = '2.6.13';
+  Vue.version = '2.6.14';
 
   /*  */
 

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/vue.min.js


+ 3 - 3
dist/vue.runtime.common.dev.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2603,7 +2603,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     var vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };
@@ -5474,7 +5474,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
   value: FunctionalRenderContext
 });
 
-Vue.version = '2.6.13';
+Vue.version = '2.6.14';
 
 /*  */
 

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/vue.runtime.common.prod.js


+ 3 - 3
dist/vue.runtime.esm.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2609,7 +2609,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     var vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };
@@ -5494,7 +5494,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
   value: FunctionalRenderContext
 });
 
-Vue.version = '2.6.13';
+Vue.version = '2.6.14';
 
 /*  */
 

+ 3 - 3
dist/vue.runtime.js

@@ -1,5 +1,5 @@
 /*!
- * Vue.js v2.6.13
+ * Vue.js v2.6.14
  * (c) 2014-2021 Evan You
  * Released under the MIT License.
  */
@@ -2607,7 +2607,7 @@
       var vnode = res && res[0];
       return res && (
         !vnode ||
-        (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+        (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
       ) ? undefined
         : res
     };
@@ -5478,7 +5478,7 @@
     value: FunctionalRenderContext
   });
 
-  Vue.version = '2.6.13';
+  Vue.version = '2.6.14';
 
   /*  */
 

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/vue.runtime.min.js


+ 1 - 1
packages/vue-server-renderer/basic.js

@@ -7666,7 +7666,7 @@
       var vnode = res && res[0];
       return res && (
         !vnode ||
-        (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+        (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
       ) ? undefined
         : res
     };

+ 1 - 1
packages/vue-server-renderer/build.dev.js

@@ -7416,7 +7416,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
     var vnode = res && res[0];
     return res && (
       !vnode ||
-      (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+      (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
     ) ? undefined
       : res
   };

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
packages/vue-server-renderer/build.prod.js


+ 38 - 5
packages/vue-server-renderer/client-plugin.js

@@ -9,13 +9,28 @@ var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); };
 var ref = require('chalk');
 var red = ref.red;
 var yellow = ref.yellow;
+var webpack = require('webpack');
 
 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) {
+var isWebpack5 = !!(webpack.version && webpack.version[0] > 4);
+
+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 }, function (assets, cb) {
+        hook(compilation, cb);
+      });
+    });
+  } else if (compiler.hooks) {
     // Webpack >= 4.0.0
     compiler.hooks.emit.tapAsync(name, hook);
   } else {
@@ -24,6 +39,22 @@ var onEmit = function (compiler, name, 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 uniq = require('lodash.uniq');
 
@@ -38,7 +69,8 @@ var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
 VueSSRClientPlugin.prototype.apply = function apply (compiler) {
     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 allFiles = uniq(stats.assets
@@ -47,6 +79,7 @@ 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); }, [])
+      .map(getAssetName)
       .filter(function (file) { return isJS(file) || isCSS(file); }));
 
     var asyncFiles = allFiles
@@ -62,7 +95,7 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
     };
 
     var assetModules = stats.modules.filter(function (m) { return m.assets.length; });
-    var fileToIndex = function (file) { return manifest.all.indexOf(file); };
+    var fileToIndex = function (asset) { return manifest.all.indexOf(getAssetName(asset)); };
     stats.modules.forEach(function (m) {
       // ignore modules duplicated in multiple chunks
       if (m.chunks.length === 1) {
@@ -71,7 +104,7 @@ VueSSRClientPlugin.prototype.apply = function apply (compiler) {
         if (!chunk || !chunk.files) {
           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);
         // find all asset modules associated with the same chunk
         assetModules.forEach(function (m) {

+ 1 - 1
packages/vue-server-renderer/package.json

@@ -1,6 +1,6 @@
 {
   "name": "vue-server-renderer",
-  "version": "2.6.13",
+  "version": "2.6.14",
   "description": "server renderer for Vue 2.0",
   "main": "index.js",
   "types": "types/index.d.ts",

+ 45 - 12
packages/vue-server-renderer/server-plugin.js

@@ -7,18 +7,29 @@ var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
 var ref = require('chalk');
 var red = ref.red;
 var yellow = ref.yellow;
+var webpack = require('webpack');
 
 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 isWebpack5 = !!(webpack.version && webpack.version[0] > 4);
+
 var validate = function (compiler) {
   if (compiler.options.target !== 'node') {
     warn('webpack config `target` should be "node".');
   }
 
-  if (compiler.options.output && compiler.options.output.libraryTarget !== 'commonjs2') {
-    warn('webpack config `output.libraryTarget` should be "commonjs2".');
+  if (compiler.options.output) {
+    if (compiler.options.output.library) {
+      // Webpack >= 5.0.0
+      if (compiler.options.output.library.type !== 'commonjs2') {
+        warn('webpack config `output.library.type` should be "commonjs2".');
+      }
+    } else if (compiler.options.output.libraryTarget !== 'commonjs2') {
+      // Webpack < 5.0.0
+      warn('webpack config `output.libraryTarget` should be "commonjs2".');
+    }
   }
 
   if (!compiler.options.externals) {
@@ -29,8 +40,20 @@ var validate = function (compiler) {
   }
 };
 
-var onEmit = function (compiler, name, hook) {
-  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 }, function (assets, cb) {
+        hook(compilation, cb);
+      });
+    });
+  } else if (compiler.hooks) {
     // Webpack >= 4.0.0
     compiler.hooks.emit.tapAsync(name, hook);
   } else {
@@ -39,6 +62,13 @@ var onEmit = function (compiler, name, hook) {
   }
 };
 
+var getAssetName = function (asset) {
+  if (typeof asset === 'string') {
+    return asset
+  }
+  return asset.name
+};
+
 var VueSSRServerPlugin = function VueSSRServerPlugin (options) {
   if ( options === void 0 ) options = {};
 
@@ -52,7 +82,8 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
 
   validate(compiler);
 
-  onEmit(compiler, 'vue-server-plugin', function (compilation, cb) {
+  var stage = 'PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER';
+  onEmit(compiler, 'vue-server-plugin', stage, function (compilation, cb) {
     var stats = compilation.getStats().toJson();
     var entryName = Object.keys(stats.entrypoints)[0];
     var entryInfo = stats.entrypoints[entryName];
@@ -62,7 +93,9 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
       return cb()
     }
 
-    var entryAssets = entryInfo.assets.filter(isJS);
+    var entryAssets = entryInfo.assets
+      .map(getAssetName)
+      .filter(isJS);
 
     if (entryAssets.length > 1) {
       throw new Error(
@@ -84,14 +117,14 @@ VueSSRServerPlugin.prototype.apply = function apply (compiler) {
       maps: {}
     };
 
-    stats.assets.forEach(function (asset) {
-      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());
+    Object.keys(compilation.assets).forEach(function (name) {
+      if (isJS(name)) {
+        bundle.files[name] = compilation.assets[name].source();
+      } else if (name.match(/\.js\.map$/)) {
+        bundle.maps[name.replace(/\.map$/, '')] = JSON.parse(compilation.assets[name].source());
       }
       // do not emit anything else for server
-      delete compilation.assets[asset.name];
+      delete compilation.assets[name];
     });
 
     var json = JSON.stringify(bundle, null, 2);

+ 1 - 1
packages/vue-template-compiler/package.json

@@ -1,6 +1,6 @@
 {
   "name": "vue-template-compiler",
-  "version": "2.6.13",
+  "version": "2.6.14",
   "description": "template compiler for Vue 2.0",
   "main": "index.js",
   "unpkg": "browser.js",

Деякі файли не було показано, через те що забагато файлів було змінено