Преглед на файлове

update deps and other code -- still need to fix some issues with testing - basically dependencies issues

Carlos Rodrigues преди 4 години
родител
ревизия
8e047df75a
променени са 37 файла, в които са добавени 5916 реда и са изтрити 8507 реда
  1. 279 267
      dist/vue.common.dev.js
  2. 4 4
      dist/vue.common.prod.js
  3. 328 159
      dist/vue.esm.browser.js
  4. 4 4
      dist/vue.esm.browser.min.js
  5. 279 267
      dist/vue.esm.js
  6. 280 268
      dist/vue.js
  7. 4 4
      dist/vue.min.js
  8. 278 266
      dist/vue.runtime.common.dev.js
  9. 4 4
      dist/vue.runtime.common.prod.js
  10. 278 266
      dist/vue.runtime.esm.js
  11. 279 267
      dist/vue.runtime.js
  12. 4 4
      dist/vue.runtime.min.js
  13. 64 64
      package.json
  14. 981 1202
      packages/vue-server-renderer/basic.js
  15. 970 1188
      packages/vue-server-renderer/build.dev.js
  16. 0 0
      packages/vue-server-renderer/build.prod.js
  17. 107 118
      packages/vue-server-renderer/client-plugin.js
  18. 107 131
      packages/vue-server-renderer/server-plugin.js
  19. 4 2
      packages/vue-server-renderer/types/plugin.d.ts
  20. 0 2270
      packages/vue-template-compiler/browser.js
  21. 1046 1268
      packages/vue-template-compiler/build.js
  22. 3 3
      scripts/config.js
  23. 2 2
      src/compiler/error-detector.ts
  24. 1 1
      src/compiler/to-function.ts
  25. 2 2
      src/core/instance/render.ts
  26. 1 0
      src/core/observer/watcher.ts
  27. 2 4
      src/core/util/env.ts
  28. 2 1
      src/core/util/error.ts
  29. 1 0
      src/core/util/next-tick.ts
  30. 1 1
      src/core/vdom/helpers/normalize-scoped-slots.ts
  31. 1 0
      src/core/vdom/modules/directives.ts
  32. 0 2
      src/platforms/web/runtime/transition-util.ts
  33. 1 0
      src/platforms/web/util/class.ts
  34. 1 0
      src/platforms/web/util/style.ts
  35. 1 1
      src/platforms/weex/entry-framework.ts
  36. 1 1
      src/platforms/weex/runtime/recycle-list/render-component-template.ts
  37. 596 466
      yarn.lock

Файловите разлики са ограничени, защото са твърде много
+ 279 - 267
dist/vue.common.dev.js


Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
dist/vue.common.prod.js


Файловите разлики са ограничени, защото са твърде много
+ 328 - 159
dist/vue.esm.browser.js


Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
dist/vue.esm.browser.min.js


Файловите разлики са ограничени, защото са твърде много
+ 279 - 267
dist/vue.esm.js


Файловите разлики са ограничени, защото са твърде много
+ 280 - 268
dist/vue.js


Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
dist/vue.min.js


Файловите разлики са ограничени, защото са твърде много
+ 278 - 266
dist/vue.runtime.common.dev.js


Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
dist/vue.runtime.common.prod.js


Файловите разлики са ограничени, защото са твърде много
+ 278 - 266
dist/vue.runtime.esm.js


Файловите разлики са ограничени, защото са твърде много
+ 279 - 267
dist/vue.runtime.js


Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
dist/vue.runtime.min.js


+ 64 - 64
package.json

@@ -68,84 +68,84 @@
   },
   "homepage": "https://github.com/vuejs/vue#readme",
   "devDependencies": {
-    "@babel/core": "^7.13.14",
-    "@babel/plugin-proposal-class-properties": "^7.13.0",
+    "@babel/core": "^7.17.10",
+    "@babel/plugin-proposal-class-properties": "^7.16.7",
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
-    "@babel/plugin-syntax-jsx": "^7.12.13",
-    "@babel/plugin-transform-flow-strip-types": "^7.13.0",
-    "@babel/preset-env": "^7.13.12",
-    "@babel/register": "^7.13.14",
-    "@rollup/plugin-alias": "^3.1.2",
+    "@babel/plugin-syntax-jsx": "^7.16.7",
+    "@babel/plugin-transform-flow-strip-types": "^7.16.7",
+    "@babel/preset-env": "^7.17.10",
+    "@babel/register": "^7.17.7",
+    "@rollup/plugin-alias": "^3.1.9",
     "@rollup/plugin-buble": "^0.21.3",
-    "@rollup/plugin-commonjs": "^18.0.0",
-    "@rollup/plugin-node-resolve": "^11.2.1",
-    "@rollup/plugin-replace": "^2.4.2",
-    "@types/node": "^12.12.0",
-    "@types/webpack": "^4.4.22",
-    "@typescript-eslint/eslint-plugin": "^4.21.0",
-    "@typescript-eslint/parser": "^4.21.0",
-    "acorn": "^8.1.0",
-    "acorn-walk": "^8.0.2",
-    "babel-eslint": "^10.0.1",
+    "@rollup/plugin-commonjs": "^22.0.0",
+    "@rollup/plugin-node-resolve": "^13.2.1",
+    "@rollup/plugin-replace": "^4.0.0",
+    "@types/node": "^17.0.30",
+    "@types/webpack": "^5.28.0",
+    "@typescript-eslint/eslint-plugin": "^5.21.0",
+    "@typescript-eslint/parser": "^5.21.0",
+    "acorn": "^8.7.1",
+    "acorn-walk": "^8.2.0",
+    "babel-eslint": "^10.1.0",
     "babel-helper-vue-jsx-merge-props": "^2.0.3",
-    "babel-loader": "^8.0.4",
-    "babel-plugin-istanbul": "^5.1.0",
+    "babel-loader": "^8.2.5",
+    "babel-plugin-istanbul": "^6.1.1",
     "babel-plugin-transform-vue-jsx": "^4.0.1",
     "babel-preset-flow-vue": "^1.0.0",
     "buble": "^0.20.0",
-    "chalk": "^2.3.0",
-    "chromedriver": "^2.45.0",
-    "codecov": "^3.0.0",
-    "commitizen": "^2.9.6",
-    "conventional-changelog": "^1.1.3",
-    "cross-spawn": "^6.0.5",
-    "cz-conventional-changelog": "^2.0.0",
+    "chalk": "^5.0.1",
+    "chromedriver": "^100.0.0",
+    "codecov": "^3.8.3",
+    "commitizen": "^4.2.4",
+    "conventional-changelog": "^3.1.25",
+    "cross-spawn": "^7.0.3",
+    "cz-conventional-changelog": "^3.3.0",
     "de-indent": "^1.0.2",
-    "es6-promise": "^4.1.0",
-    "escodegen": "^1.8.1",
-    "eslint": "^7.23.0",
-    "eslint-plugin-flowtype": "^2.34.0",
-    "eslint-plugin-jasmine": "^2.8.4",
-    "file-loader": "^3.0.1",
-    "flow-bin": "^0.61.0",
-    "hash-sum": "^1.0.2",
+    "es6-promise": "^4.2.8",
+    "escodegen": "^2.0.0",
+    "eslint": "^8.14.0",
+    "eslint-plugin-flowtype": "^8.0.3",
+    "eslint-plugin-jasmine": "^4.1.3",
+    "file-loader": "^6.2.0",
+    "flow-bin": "^0.176.3",
+    "hash-sum": "^2.0.0",
     "he": "^1.1.1",
-    "http-server": "^0.12.3",
-    "jasmine": "^2.99.0",
-    "jasmine-core": "^2.99.0",
-    "jasmine-ts": "^0.3.2",
-    "karma": "^3.1.1",
-    "karma-chrome-launcher": "^2.1.1",
-    "karma-coverage": "^1.1.1",
-    "karma-firefox-launcher": "^1.0.1",
-    "karma-jasmine": "^1.1.0",
+    "http-server": "^14.1.0",
+    "jasmine": "^4.1.0",
+    "jasmine-core": "^4.1.0",
+    "jasmine-ts": "^0.4.0",
+    "karma": "^6.3.19",
+    "karma-chrome-launcher": "^3.1.1",
+    "karma-coverage": "^2.2.0",
+    "karma-firefox-launcher": "^2.1.2",
+    "karma-jasmine": "^5.0.0",
     "karma-mocha-reporter": "^2.2.3",
     "karma-phantomjs-launcher": "^1.0.4",
     "karma-safari-launcher": "^1.0.0",
-    "karma-sauce-launcher": "^2.0.2",
-    "karma-sourcemap-loader": "^0.3.7",
-    "karma-webpack": "^4.0.0-rc.2",
-    "lint-staged": "^8.0.0",
-    "lodash": "^4.17.4",
+    "karma-sauce-launcher": "^4.3.6",
+    "karma-sourcemap-loader": "^0.3.8",
+    "karma-webpack": "^5.0.0",
+    "lint-staged": "^12.4.1",
+    "lodash": "^4.17.21",
     "lodash.template": "^4.4.0",
     "lodash.uniq": "^4.5.0",
-    "lru-cache": "^5.1.1",
-    "nightwatch": "^0.9.16",
+    "lru-cache": "^7.8.1",
+    "nightwatch": "^2.1.3",
     "nightwatch-helpers": "^1.2.0",
     "phantomjs-prebuilt": "^2.1.14",
-    "puppeteer": "^1.11.0",
-    "resolve": "^1.3.3",
-    "rollup": "^2.44.0",
-    "rollup-plugin-typescript2": "^0.30.0",
-    "selenium-server": "^2.53.1",
-    "serialize-javascript": "^3.1.0",
-    "shelljs": "^0.8.1",
-    "terser": "^5.6.1",
-    "ts-loader": "^8.1.0",
-    "ts-node": "^9.1.1",
-    "tslib": "^2.2.0",
-    "typescript": "^4.2.2",
-    "webpack": "~4.28.4",
+    "puppeteer": "^13.7.0",
+    "resolve": "^1.22.0",
+    "rollup": "^2.70.2",
+    "rollup-plugin-typescript2": "^0.31.2",
+    "selenium-server": "^3.141.59",
+    "serialize-javascript": "^6.0.0",
+    "shelljs": "^0.8.5",
+    "terser": "^5.13.1",
+    "ts-loader": "^9.2.9",
+    "ts-node": "^10.7.0",
+    "tslib": "^2.4.0",
+    "typescript": "^4.6.4",
+    "webpack": "~5.72.0",
     "weex-js-runtime": "^0.23.6",
     "weex-styler": "^0.3.0",
     "yorkie": "^2.0.0"
@@ -156,6 +156,6 @@
     }
   },
   "dependencies": {
-    "@types/he": "^1.1.1"
+    "@types/he": "^1.1.2"
   }
 }

Файловите разлики са ограничени, защото са твърде много
+ 981 - 1202
packages/vue-server-renderer/basic.js


Файловите разлики са ограничени, защото са твърде много
+ 970 - 1188
packages/vue-server-renderer/build.dev.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
packages/vue-server-renderer/build.prod.js


+ 107 - 118
packages/vue-server-renderer/client-plugin.js

@@ -1,124 +1,113 @@
-
-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;
-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 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 {
-    // Webpack < 4.0.0
-    compiler.plugin('emit', hook);
-  }
+'use strict';
+
+const isJS = (file) => /\.js(\?[^.]+)?$/.test(file);
+const isCSS = (file) => /\.css(\?[^.]+)?$/.test(file);
+
+const { red, yellow } = require('chalk');
+const webpack = require('webpack');
+const prefix = `[vue-server-renderer-webpack-plugin]`;
+exports.warn = msg => console.error(red(`${prefix} ${msg}\n`));
+exports.tip = msg => console.log(yellow(`${prefix} ${msg}\n`));
+const isWebpack5 = !!(webpack.version && webpack.version[0] > 4);
+const onEmit = (compiler, name, stageName, hook) => {
+    if (isWebpack5) {
+        // Webpack >= 5.0.0
+        compiler.hooks.compilation.tap(name, compilation => {
+            if (compilation.compiler !== compiler) {
+                // Ignore child compilers
+                return;
+            }
+            const stage = webpack.Compilation[stageName];
+            compilation.hooks.processAssets.tapAsync({ name, stage }, (assets, cb) => {
+                hook(compilation, cb);
+            });
+        });
+    }
+    else if (compiler.hooks) {
+        // Webpack >= 4.0.0
+        compiler.hooks.emit.tapAsync(name, hook);
+    }
+    else {
+        // Webpack < 4.0.0
+        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+$/, '')
+const stripModuleIdHash = 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
+const getAssetName = asset => {
+    if (typeof asset === 'string') {
+        return asset;
+    }
+    return asset.name;
 };
 
-var hash = require('hash-sum');
-var uniq = require('lodash.uniq');
-
-var VueSSRClientPlugin = function VueSSRClientPlugin (options) {
-  if ( options === void 0 ) options = {};
-
-  this.options = Object.assign({
-    filename: 'vue-ssr-client-manifest.json'
-  }, options);
-};
-
-VueSSRClientPlugin.prototype.apply = function apply (compiler) {
-    var this$1 = this;
-
-  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
-      .map(function (a) { return a.name; }));
-
-    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
-      .filter(function (file) { return isJS(file) || isCSS(file); })
-      .filter(function (file) { return initialFiles.indexOf(file) < 0; });
-
-    var manifest = {
-      publicPath: stats.publicPath,
-      all: allFiles,
-      initial: initialFiles,
-      async: asyncFiles,
-      modules: { /* [identifier: string]: Array<index: number> */ }
-    };
-
-    var assetModules = stats.modules.filter(function (m) { return m.assets.length; });
-    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) {
-        var cid = m.chunks[0];
-        var chunk = stats.chunks.find(function (c) { return c.id === cid; });
-        if (!chunk || !chunk.files) {
-          return
-        }
-        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) {
-          if (m.chunks.some(function (id) { return id === cid; })) {
-            files.push.apply(files, m.assets.map(fileToIndex));
-          }
+const hash = require("hash-sum");
+const uniq = require("lodash.uniq");
+class VueSSRClientPlugin {
+    constructor(options = {}) {
+        //@ts-expect-error no type on options
+        this.options = Object.assign({
+            filename: "vue-ssr-client-manifest.json",
+        }, options);
+    }
+    apply(compiler) {
+        const stage = "PROCESS_ASSETS_STAGE_ADDITIONAL";
+        onEmit(compiler, "vue-client-plugin", stage, (compilation, cb) => {
+            const stats = compilation.getStats().toJson();
+            const allFiles = uniq(stats.assets.map((a) => a.name));
+            const initialFiles = uniq(Object.keys(stats.entrypoints)
+                .map((name) => stats.entrypoints[name].assets)
+                .reduce((assets, all) => all.concat(assets), [])
+                .map(getAssetName)
+                .filter((file) => isJS(file) || isCSS(file)));
+            const asyncFiles = allFiles
+                .filter((file) => isJS(file) || isCSS(file))
+                .filter((file) => initialFiles.indexOf(file) < 0);
+            const manifest = {
+                publicPath: stats.publicPath,
+                all: allFiles,
+                initial: initialFiles,
+                async: asyncFiles,
+                modules: {
+                /* [identifier: string]: Array<index: number> */
+                },
+            };
+            const assetModules = stats.modules.filter((m) => m.assets.length);
+            const fileToIndex = (asset) => manifest.all.indexOf(getAssetName(asset));
+            stats.modules.forEach((m) => {
+                // ignore modules duplicated in multiple chunks
+                if (m.chunks.length === 1) {
+                    const cid = m.chunks[0];
+                    const chunk = stats.chunks.find((c) => c.id === cid);
+                    if (!chunk || !chunk.files) {
+                        return;
+                    }
+                    const id = stripModuleIdHash(m.identifier);
+                    const files = (manifest.modules[hash(id)] =
+                        chunk.files.map(fileToIndex));
+                    // find all asset modules associated with the same chunk
+                    assetModules.forEach((m) => {
+                        if (m.chunks.some((id) => id === cid)) {
+                            files.push.apply(files, m.assets.map(fileToIndex));
+                        }
+                    });
+                }
+            });
+            const json = JSON.stringify(manifest, null, 2);
+            //@ts-expect-error no type on options
+            compilation.assets[this.options.filename] = {
+                source: () => json,
+                size: () => json.length,
+            };
+            cb();
         });
-      }
-    });
-
-    var json = JSON.stringify(manifest, null, 2);
-    compilation.assets[this$1.options.filename] = {
-      source: function () { return json; },
-      size: function () { return json.length; }
-    };
-    cb();
-  });
-};
+    }
+}
 
-module.exports = VueSSRClientPlugin;
+module.exports = VueSSRClientPlugin;

+ 107 - 131
packages/vue-server-renderer/server-plugin.js

@@ -1,142 +1,118 @@
 'use strict';
 
-/*  */
-
-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) {
-    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".');
+const isJS = (file) => /\.js(\?[^.]+)?$/.test(file);
+
+const { red, yellow } = require('chalk');
+const webpack = require('webpack');
+const prefix = `[vue-server-renderer-webpack-plugin]`;
+const warn = exports.warn = msg => console.error(red(`${prefix} ${msg}\n`));
+const tip = exports.tip = msg => console.log(yellow(`${prefix} ${msg}\n`));
+const isWebpack5 = !!(webpack.version && webpack.version[0] > 4);
+const validate = compiler => {
+    if (compiler.options.target !== 'node') {
+        warn('webpack config `target` should be "node".');
+    }
+    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) {
+        tip('It is recommended to externalize dependencies in the server build for ' +
+            'better build performance.');
     }
-  }
-
-  if (!compiler.options.externals) {
-    tip(
-      'It is recommended to externalize dependencies in the server build for ' +
-      'better build performance.'
-    );
-  }
-};
-
-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 {
-    // Webpack < 4.0.0
-    compiler.plugin('emit', hook);
-  }
-};
-
-var getAssetName = function (asset) {
-  if (typeof asset === 'string') {
-    return asset
-  }
-  return asset.name
 };
-
-var VueSSRServerPlugin = function VueSSRServerPlugin (options) {
-  if ( options === void 0 ) options = {};
-
-  this.options = Object.assign({
-    filename: 'vue-ssr-server-bundle.json'
-  }, options);
+const onEmit = (compiler, name, stageName, hook) => {
+    if (isWebpack5) {
+        // Webpack >= 5.0.0
+        compiler.hooks.compilation.tap(name, compilation => {
+            if (compilation.compiler !== compiler) {
+                // Ignore child compilers
+                return;
+            }
+            const stage = webpack.Compilation[stageName];
+            compilation.hooks.processAssets.tapAsync({ name, stage }, (assets, cb) => {
+                hook(compilation, cb);
+            });
+        });
+    }
+    else if (compiler.hooks) {
+        // Webpack >= 4.0.0
+        compiler.hooks.emit.tapAsync(name, hook);
+    }
+    else {
+        // Webpack < 4.0.0
+        compiler.plugin('emit', hook);
+    }
 };
-
-VueSSRServerPlugin.prototype.apply = function apply (compiler) {
-    var this$1 = this;
-
-  validate(compiler);
-
-  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];
-
-    if (!entryInfo) {
-      // #5553
-      return cb()
+const getAssetName = asset => {
+    if (typeof asset === 'string') {
+        return asset;
     }
+    return asset.name;
+};
 
-    var entryAssets = entryInfo.assets
-      .map(getAssetName)
-      .filter(isJS);
-
-    if (entryAssets.length > 1) {
-      throw new Error(
-        "Server-side bundle should have one single entry file. " +
-        "Avoid using CommonsChunkPlugin in the server config."
-      )
+class VueSSRServerPlugin {
+    constructor(options = {}) {
+        //@ts-expect-error
+        this.options = Object.assign({
+            filename: 'vue-ssr-server-bundle.json',
+        }, options);
     }
-
-    var entry = entryAssets[0];
-    if (!entry || typeof entry !== 'string') {
-      throw new Error(
-        ("Entry \"" + entryName + "\" not found. Did you specify the correct entry option?")
-      )
+    apply(compiler) {
+        validate(compiler);
+        const stage = 'PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER';
+        onEmit(compiler, 'vue-server-plugin', stage, (compilation, cb) => {
+            const stats = compilation.getStats().toJson();
+            const entryName = Object.keys(stats.entrypoints)[0];
+            const entryInfo = stats.entrypoints[entryName];
+            if (!entryInfo) {
+                // #5553
+                return cb();
+            }
+            const entryAssets = entryInfo.assets
+                .map(getAssetName)
+                .filter(isJS);
+            if (entryAssets.length > 1) {
+                throw new Error(`Server-side bundle should have one single entry file. ` +
+                    `Avoid using CommonsChunkPlugin in the server config.`);
+            }
+            const entry = entryAssets[0];
+            if (!entry || typeof entry !== 'string') {
+                throw new Error(`Entry "${entryName}" not found. Did you specify the correct entry option?`);
+            }
+            const bundle = {
+                entry,
+                files: {},
+                maps: {},
+            };
+            Object.keys(compilation.assets).forEach(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[name];
+            });
+            const json = JSON.stringify(bundle, null, 2);
+            //@ts-expect-error
+            const filename = this.options.filename;
+            compilation.assets[filename] = {
+                source: () => json,
+                size: () => json.length,
+            };
+            cb();
+        });
     }
-
-    var bundle = {
-      entry: entry,
-      files: {},
-      maps: {}
-    };
-
-    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[name];
-    });
-
-    var json = JSON.stringify(bundle, null, 2);
-    var filename = this$1.options.filename;
-
-    compilation.assets[filename] = {
-      source: function () { return json; },
-      size: function () { return json.length; }
-    };
-
-    cb();
-  });
-};
+}
 
 module.exports = VueSSRServerPlugin;

+ 4 - 2
packages/vue-server-renderer/types/plugin.d.ts

@@ -1,9 +1,11 @@
-import { Plugin } from 'webpack';
+import { DefinePlugin } from 'webpack';
 
 interface WebpackPluginOptions {
   filename?: string;
 }
 
 export interface WebpackPlugin {
-  new (options?: WebpackPluginOptions): Plugin;
+  // NOTE NOT SURE ABOUT THIS
+  // TODO DOUBLE CHECK HERE
+  new (options?: WebpackPluginOptions): DefinePlugin;
 }

Файловите разлики са ограничени, защото са твърде много
+ 0 - 2270
packages/vue-template-compiler/browser.js


Файловите разлики са ограничени, защото са твърде много
+ 1046 - 1268
packages/vue-template-compiler/build.js


+ 3 - 3
scripts/config.js

@@ -267,9 +267,9 @@ function genConfig (name) {
   vars.preventAssignment = true
   config.plugins.push(replace(vars))
 
-  if (opts.transpile !== false) {
-    config.plugins.push(buble())
-  }
+  // if (opts.transpile !== false) {
+  //   config.plugins.push(buble())
+  // }
 
   Object.defineProperty(config, '_name', {
     enumerable: false,

+ 2 - 2
src/compiler/error-detector.ts

@@ -117,7 +117,7 @@ function checkExpression(
 ) {
   try {
     new Function(`return ${exp}`)
-  } catch (e) {
+  } catch (e:any) {
     const keywordMatch = exp
       .replace(stripStringRE, '')
       .match(prohibitedKeywordRE)
@@ -146,7 +146,7 @@ function checkFunctionParameterExpression(
 ) {
   try {
     new Function(exp, '')
-  } catch (e) {
+  } catch (e:any) {
     warn(
       `invalid function parameter expression: ${e.message} in\n\n` +
         `    ${exp}\n\n` +

+ 1 - 1
src/compiler/to-function.ts

@@ -35,7 +35,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
       // detect possible CSP restriction
       try {
         new Function('return 1')
-      } catch (e) {
+      } catch (e:any) {
         if (e.toString().match(/unsafe-eval|CSP/)) {
           warn(
             'It seems you are using the standalone build of Vue.js in an ' +

+ 2 - 2
src/core/instance/render.ts

@@ -115,7 +115,7 @@ export function renderMixin(Vue: Component) {
       // when parent component is patched.
       currentRenderingInstance = vm
       vnode = render.call(vm._renderProxy, vm.$createElement)
-    } catch (e) {
+    } catch (e: any) {
       handleError(e, vm, `render`)
       // return error render result,
       // or previous vnode to prevent render error causing blank component
@@ -127,7 +127,7 @@ export function renderMixin(Vue: Component) {
             vm.$createElement,
             e
           )
-        } catch (e) {
+        } catch (e:any) {
           handleError(e, vm, `renderError`)
           vnode = vm._vnode
         }

+ 1 - 0
src/core/observer/watcher.ts

@@ -113,6 +113,7 @@ export default class Watcher {
       value = this.getter.call(vm, vm)
     } catch (e) {
       if (this.user) {
+        // @ts-expect-error e is unknown, should we cast or any?
         handleError(e, vm, `getter for watcher "${this.expression}"`)
       } else {
         throw e

+ 2 - 4
src/core/util/env.ts

@@ -75,10 +75,8 @@ let _Set // $flow-disable-line
 } else {
   // a non-standard Set polyfill that only works with primitive keys.
   _Set = class Set implements SimpleSet {
-    set: Object
-    constructor() {
-      this.set = Object.create(null)
-    }
+    set: Record<string, boolean> = Object.create(null)
+
     has(key: string | number) {
       return this.set[key] === true
     }

+ 2 - 1
src/core/util/error.ts

@@ -48,6 +48,7 @@ export function invokeWithErrorHandling(
       res._handled = true
     }
   } catch (e) {
+    // @ts-expect-error should it be any?
     handleError(e, vm, info)
   }
   return res
@@ -57,7 +58,7 @@ function globalHandleError(err, vm, info) {
   if (config.errorHandler) {
     try {
       return config.errorHandler.call(null, err, vm, info)
-    } catch (e) {
+    } catch (e: any) {
       // if the user intentionally throws the original error in the handler,
       // do not log it twice
       if (e !== err) {

+ 1 - 0
src/core/util/next-tick.ts

@@ -92,6 +92,7 @@ export function nextTick(cb?: Function, ctx?: Object) {
       try {
         cb.call(ctx)
       } catch (e) {
+        // @ts-expect-error should it be any?
         handleError(e, ctx, 'nextTick')
       }
     } else if (_resolve) {

+ 1 - 1
src/core/vdom/helpers/normalize-scoped-slots.ts

@@ -61,7 +61,7 @@ function normalizeScopedSlot(normalSlots, key, fn) {
       res && typeof res === "object" && !Array.isArray(res)
         ? [res] // single vnode
         : normalizeChildren(res);
-    let vnode: VNode | null = res && res[0];
+    const vnode: VNode | null = res && res[0];
     return res &&
       (!vnode ||
         (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391

+ 1 - 0
src/core/vdom/modules/directives.ts

@@ -121,6 +121,7 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy?: any) {
     try {
       fn(vnode.elm, dir, vnode, oldVnode, isDestroy)
     } catch (e) {
+     // @ts-expect-error should it be any?
       handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`)
     }
   }

+ 0 - 2
src/platforms/web/runtime/transition-util.ts

@@ -45,7 +45,6 @@ if (hasTransition) {
   /* istanbul ignore if */
   if (
     window.ontransitionend === undefined &&
-    // @ts-expect-error
     window.onwebkittransitionend !== undefined
   ) {
     transitionProp = 'WebkitTransition'
@@ -53,7 +52,6 @@ if (hasTransition) {
   }
   if (
     window.onanimationend === undefined &&
-    // @ts-expect-error
     window.onwebkitanimationend !== undefined
   ) {
     animationProp = 'WebkitAnimation'

+ 1 - 0
src/platforms/web/util/class.ts

@@ -13,6 +13,7 @@ export function genClassForVnode(vnode: VNodeWithData): string {
       data = mergeClassData(childNode.data, data)
     }
   }
+  // @ts-expect-error parentNode.parent not VNodeWithData
   while (isDef((parentNode = parentNode.parent))) {
     if (parentNode && parentNode.data) {
       data = mergeClassData(data, parentNode.data)

+ 1 - 0
src/platforms/web/util/style.ts

@@ -62,6 +62,7 @@ export function getStyle(vnode: VNodeWithData, checkChild: boolean): Object {
   }
 
   let parentNode: VNodeWithData | VNode | undefined = vnode
+  // @ts-expect-error parentNode.parent not VNodeWithData
   while ((parentNode = parentNode.parent)) {
     if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
       extend(res, styleData)

+ 1 - 1
src/platforms/weex/entry-framework.ts

@@ -26,7 +26,7 @@ export function createInstanceContext(
     config: weex.config,
     document: weex.document,
     data
-  }
+  })
 
   // Each instance has an independent `Vue` module instance
   const Vue = instance.Vue = createVueModuleInstance(instanceId, weex)

+ 1 - 1
src/platforms/weex/runtime/recycle-list/render-component-template.ts

@@ -22,7 +22,7 @@ export function renderRecyclableComponentTemplate(
   if (render) {
     try {
       return render.call(vm)
-    } catch (err) {
+    } catch (err:any) {
       handleError(err, vm, `@render`)
     }
   } else {

Файловите разлики са ограничени, защото са твърде много
+ 596 - 466
yarn.lock


Някои файлове не бяха показани, защото твърде много файлове са промени