浏览代码

chore: migrate to @gera2ld/plaid

Gerald 6 年之前
父节点
当前提交
d2f830ddc3
共有 73 个文件被更改,包括 747 次插入1050 次删除
  1. 3 24
      .babelrc.js
  2. 5 27
      .eslintrc.js
  3. 0 6
      .postcssrc.js
  4. 0 10
      .svgo.yml
  5. 1 1
      README.md
  6. 6 14
      gulpfile.js
  7. 18 52
      package.json
  8. 0 5
      scripts/eslint/vue.js
  9. 62 0
      scripts/plaid.conf.js
  10. 0 51
      scripts/util.js
  11. 0 34
      scripts/webpack.base.conf.js
  12. 38 126
      scripts/webpack.conf.js
  13. 0 8
      scripts/webpack/analyze.js
  14. 0 72
      scripts/webpack/common.js
  15. 0 15
      scripts/webpack/raw.js
  16. 0 26
      scripts/webpack/svg.js
  17. 0 20
      scripts/webpack/url.js
  18. 0 15
      scripts/webpack/vue.js
  19. 14 14
      src/background/index.js
  20. 19 19
      src/background/sync/base.js
  21. 1 1
      src/background/sync/dropbox.js
  22. 5 5
      src/background/sync/googledrive.js
  23. 3 3
      src/background/sync/onedrive.js
  24. 3 3
      src/background/sync/webdav.js
  25. 29 29
      src/background/utils/db.js
  26. 1 1
      src/background/utils/events.js
  27. 1 1
      src/background/utils/init.js
  28. 2 2
      src/background/utils/message.js
  29. 3 3
      src/background/utils/notifications.js
  30. 1 1
      src/background/utils/options.js
  31. 8 8
      src/background/utils/patch-db.js
  32. 10 10
      src/background/utils/requests.js
  33. 2 2
      src/background/utils/tabs.js
  34. 7 7
      src/background/utils/tester.js
  35. 2 2
      src/background/utils/update.js
  36. 8 8
      src/background/utils/values.js
  37. 8 8
      src/common/browser.js
  38. 1 1
      src/common/events.js
  39. 2 2
      src/common/hook-setting.js
  40. 5 5
      src/common/index.js
  41. 3 3
      src/common/object.js
  42. 2 2
      src/common/options.js
  43. 10 10
      src/common/polyfills.js
  44. 4 4
      src/common/ui/code.vue
  45. 1 1
      src/common/ui/setting-check.vue
  46. 1 1
      src/common/ui/setting-text.vue
  47. 1 1
      src/common/ui/style/index.js
  48. 13 13
      src/confirm/views/app.vue
  49. 8 8
      src/injected/content/index.js
  50. 1 1
      src/injected/content/notifications.js
  51. 1 1
      src/injected/content/requests.js
  52. 3 3
      src/injected/utils/helpers.js
  53. 2 2
      src/injected/utils/index.js
  54. 12 12
      src/injected/web/index.js
  55. 1 1
      src/injected/web/requests.js
  56. 4 4
      src/options/index.js
  57. 3 3
      src/options/views/edit/index.vue
  58. 1 1
      src/options/views/edit/values.vue
  59. 1 1
      src/options/views/feature.vue
  60. 1 1
      src/options/views/message.vue
  61. 4 4
      src/options/views/script-item.vue
  62. 4 4
      src/options/views/tab-installed.vue
  63. 3 3
      src/options/views/tab-settings/index.vue
  64. 7 7
      src/options/views/tab-settings/vm-export.vue
  65. 10 10
      src/options/views/tab-settings/vm-import.vue
  66. 1 1
      src/options/views/tab-settings/vm-sync.vue
  67. 2 2
      src/popup/index.js
  68. 3 3
      src/popup/views/app.vue
  69. 2 2
      test/background/script.test.js
  70. 29 29
      test/background/tester.test.js
  71. 1 1
      test/common/index.test.js
  72. 1 1
      test/injected/helpers.test.js
  73. 339 269
      yarn.lock

+ 3 - 24
.babelrc.js

@@ -1,32 +1,11 @@
 module.exports = {
-  'presets': [
+  extends: require.resolve('@gera2ld/plaid/config/babelrc'),
+  presets: [
     ['@babel/preset-env', {
       ...process.env.BABEL_ENV !== 'test' && {
         modules: false,
       },
-    }],
-  ],
-  plugins: [
-    '@babel/plugin-transform-runtime',
-
-    // stage-2
-    ['@babel/plugin-proposal-decorators', { legacy: true }],
-    '@babel/plugin-proposal-function-sent',
-    '@babel/plugin-proposal-export-namespace-from',
-    '@babel/plugin-proposal-numeric-separator',
-    '@babel/plugin-proposal-throw-expressions',
-
-    // stage-3
-    '@babel/plugin-syntax-dynamic-import',
-    '@babel/plugin-syntax-import-meta',
-    ['@babel/plugin-proposal-class-properties', { loose: true }],
-    '@babel/plugin-proposal-json-strings',
-
-    ['module-resolver', {
-      alias: {
-        '#': './src',
-      },
-      extensions: [ '.js', '.vue' ],
+      useBuiltIns: false,
     }],
   ],
 };

+ 5 - 27
.eslintrc.js

@@ -1,37 +1,15 @@
 module.exports = {
   root: true,
-  parserOptions: {
-    parser: 'babel-eslint',
-  },
   extends: [
-    'airbnb-base',
-    require.resolve('./scripts/eslint/vue'),
+    require.resolve('@gera2ld/plaid/eslint'),
+    require.resolve('@gera2ld/plaid-vue/eslint/vue'),
   ],
-  env: {
-    browser: true,
-  },
-  settings: {
-    'import/resolver': {
-      'babel-module': {},
+  parserOptions: {
+    ecmaFeatures: {
+      legacyDecorators: true,
     },
   },
   rules: {
-    'no-param-reassign': 'off',
-    'consistent-return': 'off',
-    'no-use-before-define': ['error', 'nofunc'],
-    'no-mixed-operators': 'off',
-    'no-bitwise': ['error', { int32Hint: true }],
-    'arrow-parens': ['error', 'as-needed'],
-    'prefer-promise-reject-errors': 'off',
-    'prefer-destructuring': ['error', { array: false }],
-    'no-console': ['warn', {
-      allow: ['error', 'warn', 'info'],
-    }],
-    indent: ['error', 2, { MemberExpression: 0 }],
-    'object-shorthand': ['error', 'always'],
-    'no-restricted-syntax': 'off',
-    'class-methods-use-this': 'off',
-    'import/prefer-default-export': 'off',
   },
   globals: {
     browser: true,

+ 0 - 6
.postcssrc.js

@@ -1,6 +0,0 @@
-module.exports = {
-  parser: require('postcss-scss'),
-  plugins: [
-    require('precss'),
-  ],
-};

+ 0 - 10
.svgo.yml

@@ -1,10 +0,0 @@
-plugins:
-  - removeTitle: true
-  - removeStyleElement: true
-  - removeDimensions: true
-  - removeAttrs:
-      attrs:
-        - class
-        - fill
-        - fill-rule
-        - stroke

+ 1 - 1
README.md

@@ -18,7 +18,7 @@ Related projects
 
 Development
 ---
-Make sure [Node.js](https://nodejs.org/) greater than v8.0 is installed.
+Make sure [Node.js](https://nodejs.org/) greater than v10.0 is installed.
 ``` sh
 # Install dependencies
 $ yarn

+ 6 - 14
gulpfile.js

@@ -6,10 +6,10 @@ const uglify = require('gulp-uglify');
 const plumber = require('gulp-plumber');
 const yaml = require('js-yaml');
 const webpack = require('webpack');
+const { isProd } = require('@gera2ld/plaid/util');
 const webpackConfig = require('./scripts/webpack.conf');
 const i18n = require('./scripts/i18n');
 const string = require('./scripts/string');
-const { isProd } = require('./scripts/util');
 const pkg = require('./package.json');
 
 const DIST = 'dist';
@@ -57,21 +57,13 @@ function watch() {
   gulp.watch(paths.locales.concat(paths.templates), copyI18n);
 }
 
-function jsDev(done) {
-  let firstRun = true;
-  webpack(webpackConfig).watch({}, (...args) => {
-    webpackCallback(...args);
-    if (firstRun) {
-      firstRun = false;
-      done();
-    }
-  });
+async function jsDev() {
+  require('@gera2ld/plaid-webpack/bin/develop')();
 }
 
-function jsProd(done) {
-  webpack(webpackConfig, (...args) => {
-    webpackCallback(...args);
-    done();
+async function jsProd() {
+  return require('@gera2ld/plaid-webpack/bin/build')({
+    api: true,
   });
 }
 

+ 18 - 52
package.json

@@ -11,63 +11,29 @@
     "lint": "yarn lint:js && yarn lint:yml",
     "lint:js": "eslint --ext .js,.vue .",
     "lint:yml": "gulp check",
-    "svgo": "svgo --config .svgo.yml src/resources/svg",
+    "svgo": "plaid svgo",
     "test": "cross-env BABEL_ENV=test tape -r ./test/mock/register 'test/**/*.test.js'",
     "transform": "node scripts/transform-lock"
   },
   "description": "Violentmonkey",
   "devDependencies": {
-    "@babel/core": "^7.3.4",
-    "@babel/plugin-proposal-class-properties": "^7.3.4",
-    "@babel/plugin-proposal-decorators": "^7.3.0",
-    "@babel/plugin-proposal-export-namespace-from": "^7.2.0",
-    "@babel/plugin-proposal-function-sent": "^7.2.0",
-    "@babel/plugin-proposal-json-strings": "^7.2.0",
-    "@babel/plugin-proposal-numeric-separator": "^7.2.0",
-    "@babel/plugin-proposal-throw-expressions": "^7.2.0",
-    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
-    "@babel/plugin-syntax-import-meta": "^7.2.0",
-    "@babel/plugin-transform-runtime": "^7.3.4",
-    "@babel/preset-env": "^7.3.4",
-    "@babel/register": "^7.0.0",
-    "babel-eslint": "^10.0.1",
-    "babel-loader": "^8.0.5",
-    "babel-minify-webpack-plugin": "^0.3.0",
-    "babel-plugin-module-resolver": "^3.2.0",
+    "@babel/register": "^7.4.4",
+    "@gera2ld/plaid": "~1.4.7",
+    "@gera2ld/plaid-vue": "~1.4.0",
+    "@gera2ld/plaid-webpack": "~1.4.8",
     "cross-env": "^5.0.5",
-    "css-loader": "^2.1.0",
-    "del": "^3.0.0",
-    "eslint": "^5.14.1",
-    "eslint-config-airbnb-base": "^13.1.0",
-    "eslint-import-resolver-babel-module": "^5.0.1",
-    "eslint-import-resolver-webpack": "^0.11.0",
-    "eslint-plugin-import": "^2.16.0",
-    "eslint-plugin-vue": "^5.2.2",
+    "del": "^4.1.1",
     "fancy-log": "^1.3.2",
-    "gulp": "^4.0.0",
-    "gulp-filter": "^5.0.1",
+    "gulp": "^4.0.2",
+    "gulp-filter": "^6.0.0",
     "gulp-plumber": "^1.1.0",
-    "gulp-uglify": "^3.0.0",
-    "html-webpack-plugin": "^4.0.0-beta.5",
-    "husky": "^1.3.1",
-    "js-yaml": "^3.12.2",
-    "mini-css-extract-plugin": "^0.5.0",
-    "optimize-css-assets-webpack-plugin": "^5.0.1",
+    "gulp-uglify": "^3.0.2",
+    "husky": "^2.4.0",
+    "js-yaml": "^3.13.1",
     "plugin-error": "^1.0.0",
-    "postcss-loader": "^3.0.0",
-    "postcss-scss": "2.0.0",
-    "precss": "^4.0.0",
-    "svg-sprite-loader": "^4.1.2",
-    "svgo": "^1.2.0",
-    "tape": "^4.10.1",
+    "tape": "^4.10.2",
     "through2": "^3.0.1",
-    "url-loader": "^1.1.2",
     "vinyl": "^2.1.0",
-    "vue-loader": "^15.7.0",
-    "vue-style-loader": "^4.1.2",
-    "vue-template-compiler": "^2.6.7",
-    "webpack": "^4.29.6",
-    "webpack-bundle-analyzer": "^3.0.4",
     "wrapper-webpack-plugin": "2.1.0"
   },
   "author": "Gerald <[email protected]>",
@@ -81,15 +47,15 @@
   "homepage": "https://github.com/violentmonkey/violentmonkey",
   "license": "MIT",
   "dependencies": {
-    "@babel/runtime": "^7.3.4",
-    "codemirror": "^5.44.0",
-    "core-js": "^2.6.5",
+    "@babel/runtime": "^7.4.5",
+    "codemirror": "^5.47.0",
+    "core-js": "^3.1.3",
     "tldjs": "^2.3.1",
-    "vue": "^2.6.7",
-    "vueleton": "^0.7.1"
+    "vue": "^2.6.10",
+    "vueleton": "^1.0.1"
   },
   "engines": {
-    "node": ">=8"
+    "node": ">=10"
   },
   "husky": {
     "hooks": {

+ 0 - 5
scripts/eslint/vue.js

@@ -1,5 +0,0 @@
-module.exports = {
-  extends: [
-    'plugin:vue/essential',
-  ],
-};

+ 62 - 0
scripts/plaid.conf.js

@@ -0,0 +1,62 @@
+const { isProd } = require('@gera2ld/plaid/util');
+
+/**
+ * For each entry, `key` is the chunk name, `value` has following properties:
+ * - value.entry: webpack entry.
+ * - value.html: options object passed to HtmlWebpackPlugin.
+ * - value.html.inlineSource: if true, JS and CSS files will be inlined in HTML.
+ */
+const htmlFactory = extra => options => ({
+  ...options,
+  title: 'Violentmonkey',
+  ...extra,
+  chunks: ['browser', ...options.chunks],
+});
+exports.pages = {
+  'browser': {
+    entry: './src/common/browser',
+  },
+  'background/index': {
+    entry: './src/background',
+    html: htmlFactory(),
+  },
+  'options/index': {
+    entry: './src/options',
+    html: htmlFactory({
+      js: [
+        '/public/lib/zip.js/zip.js',
+      ],
+    }),
+  },
+  'confirm/index': {
+    entry: './src/confirm',
+    html: htmlFactory(),
+  },
+  'popup/index': {
+    entry: './src/popup',
+    html: htmlFactory(),
+  },
+  injected: {
+    entry: './src/injected',
+  },
+};
+
+exports.devServer = false;
+exports.devtool = isProd ? false : 'inline-source-map';
+exports.optimization = {
+  runtimeChunk: false,
+  splitChunks: {
+    cacheGroups: {
+      common: {
+        name: 'common',
+        minChunks: 2,
+        chunks(chunk) {
+          return ![
+            'browser',
+            'injected',
+          ].includes(chunk.name);
+        },
+      },
+    },
+  },
+};

+ 0 - 51
scripts/util.js

@@ -1,51 +0,0 @@
-const path = require('path');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-process.env.NODE_ENV = process.env.NODE_ENV || 'development';
-const isDev = process.env.NODE_ENV === 'development';
-const isProd = process.env.NODE_ENV === 'production';
-const isTest = process.env.NODE_ENV === 'test';
-const DIST = 'dist';
-const INIT_FUNC_NAME = 'VMInitInjection';
-
-function styleLoader(options) {
-  const {
-    loaders = [],
-    extract = isProd,
-    fallback = 'style-loader',
-    modules = false,
-  } = options || {};
-  const cssLoader = {
-    loader: 'css-loader',
-    options: {
-      modules,
-      importLoaders: 1,
-      sourceMap: false,
-    },
-  };
-  return [
-    extract ? MiniCssExtractPlugin.loader : fallback,
-    cssLoader,
-    ...loaders,
-  ];
-}
-
-function styleRule(options, rule) {
-  return {
-    test: /\.css$/,
-    use: styleLoader(options),
-    ...rule,
-  };
-}
-
-function resolve(dir) {
-  return path.join(__dirname, '..', dir);
-}
-
-exports.DIST = DIST;
-exports.INIT_FUNC_NAME = INIT_FUNC_NAME;
-exports.isDev = isDev;
-exports.isProd = isProd;
-exports.isTest = isTest;
-exports.styleLoader = styleLoader;
-exports.styleRule = styleRule;
-exports.resolve = resolve;

+ 0 - 34
scripts/webpack.base.conf.js

@@ -1,34 +0,0 @@
-const webpack = require('webpack');
-const { resolve, INIT_FUNC_NAME } = require('./util');
-
-const baseConfig = [
-  require('./webpack/common')({
-    style: {
-      fallback: 'vue-style-loader',
-    },
-  }),
-  require('./webpack/url')(),
-  require('./webpack/raw')(),
-  require('./webpack/svg')(),
-  process.env.RUN_ENV === 'analyze' && require('./webpack/analyze')(),
-  require('./webpack/vue')(),
-]
-.filter(Boolean)
-.reduce(
-  (config, apply) => (apply && apply(config) || config),
-  {
-    resolve: {
-      alias: {
-        '#': resolve('src'),
-      },
-    },
-    plugins: [
-      new webpack.DefinePlugin({
-        'process.env.INIT_FUNC_NAME': JSON.stringify(INIT_FUNC_NAME),
-        'process.env.DEBUG': JSON.stringify(process.env.DEBUG || false),
-      }),
-    ],
-  },
-);
-
-module.exports = baseConfig;

+ 38 - 126
scripts/webpack.conf.js

@@ -1,135 +1,47 @@
-const HtmlWebpackPlugin = require('html-webpack-plugin');
+const { modifyWebpackConfig, shallowMerge, defaultOptions } = require('@gera2ld/plaid');
+const webpack = require('webpack');
 const WrapperWebpackPlugin = require('wrapper-webpack-plugin');
-const base = require('./webpack.base.conf');
-const { isProd, INIT_FUNC_NAME } = require('./util');
-const MINIFY = isProd && {
-  collapseWhitespace: true,
-  removeAttributeQuotes: true,
-  removeComments: true,
-  removeOptionalTags: true,
-  removeRedundantAttributes: true,
-  removeScriptTypeAttributes: true,
-  removeStyleLinkTypeAttributes: true,
-};
-const defaultTemplateOptions = {
-  minify: MINIFY,
-  template: 'scripts/template.html',
-  meta: {
-    viewport: 'width=device-width,initial-scale=1.0,user-scalable=no',
-  },
-  css: [],
-  js: [],
-};
+const projectConfig = require('./plaid.conf');
 
-const targets = module.exports = [];
+const INIT_FUNC_NAME = 'VMInitInjection';
 
-const pages = {
-  'browser': {
-    entry: './src/common/browser',
-  },
-  'background/index': {
-    entry: './src/background',
-    html: {
-      title: 'Violentmonkey',
-    },
-  },
-  'options/index': {
-    entry: './src/options',
-    html: {
-      title: 'Violentmonkey',
-      js: [
-        '/public/lib/zip.js/zip.js',
-      ],
-    },
-  },
-  'confirm/index': {
-    entry: './src/confirm',
-    html: {
-      title: 'Violentmonkey',
-    },
-  },
-  'popup/index': {
-    entry: './src/popup',
-    html: {
-      title: 'Violentmonkey',
-    },
-  },
-  injected: {
-    entry: './src/injected',
-  },
-};
-const entries = Object.entries(pages)
-.reduce((res, [key, { entry }]) => Object.assign(res, { [key]: entry }), {});
-const htmlPlugins = Object.entries(pages)
-.map(([key, { html }]) => {
-  let options;
-  if (html) {
-    options = {
-      filename: `${key}.html`,
-      chunks: ['browser', key],
-      ...defaultTemplateOptions,
-    };
-    if (typeof html === 'function') {
-      options = html(options);
-    } else {
-      options = {
-        ...options,
-        ...html,
-      };
-    }
-  }
-  if (options) {
-    return new HtmlWebpackPlugin(options);
-  }
-})
-.filter(Boolean);
-
-targets.push({
-  ...base,
-  entry: entries,
-  optimization: {
-    ...base.optimization,
-    splitChunks: {
-      cacheGroups: {
-        common: {
-          name: 'common',
-          minChunks: 2,
-          chunks(chunk) {
-            return ![
-              'browser',
-              'injected',
-            ].includes(chunk.name);
-          },
-        },
-      },
-    },
-  },
-  plugins: [
-    ...base.plugins,
-    ...htmlPlugins,
-  ],
-});
-
-targets.push({
-  ...base,
-  entry: {
-    'injected-web': './src/injected/web',
-  },
-  output: {
-    ...base.output,
-    libraryTarget: 'commonjs2',
-  },
-  plugins: [
-    ...base.plugins,
-    new WrapperWebpackPlugin({
-      header: `\
+module.exports = Promise.all([
+  modifyWebpackConfig(async (config) => {
+    config.plugins.push(
+      new webpack.DefinePlugin({
+        'process.env.INIT_FUNC_NAME': JSON.stringify(INIT_FUNC_NAME),
+        'process.env.DEBUG': JSON.stringify(process.env.DEBUG || false),
+      }),
+    );
+    return config;
+  }),
+  modifyWebpackConfig(async (config) => {
+    config.output.libraryTarget = 'commonjs2';
+    config.plugins.push(
+      new WrapperWebpackPlugin({
+        header: `\
 window.${INIT_FUNC_NAME} = function () {
   var module = { exports: {} };
 `,
-      footer: `
+        footer: `
   var exports = module.exports;
   return exports.__esModule ? exports['default'] : exports;
 };0;`,
-    }),
-  ],
-});
+      }),
+    );
+    return config;
+  }, {
+    projectConfig: {
+      ...shallowMerge(defaultOptions, projectConfig),
+      optimization: {
+        runtimeChunk: false,
+        splitChunks: false,
+      },
+      pages: {
+        'injected-web': {
+          entry: './src/injected/web',
+        },
+      },
+    },
+  }),
+]);

+ 0 - 8
scripts/webpack/analyze.js

@@ -1,8 +0,0 @@
-const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
-
-module.exports = () => config => {
-  config.plugins = [
-    ...config.plugins || [],
-    new BundleAnalyzerPlugin(),
-  ];
-};

+ 0 - 72
scripts/webpack/common.js

@@ -1,72 +0,0 @@
-const TerserPlugin = require('terser-webpack-plugin');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
-const { isProd, styleRule, resolve, DIST } = require('../util');
-
-module.exports = options => config => {
-  const { style } = options;
-  const defaultStyleOptions = {
-    loaders: ['postcss-loader'],
-  };
-  config.mode = isProd ? 'production' : 'development';
-  if (!isProd) config.devtool = 'inline-source-map';
-  config.output = {
-    path: resolve(DIST),
-    publicPath: '/',
-    filename: '[name].js',
-    ...config.output,
-  };
-  config.resolve = {
-    // Tell webpack to look for peer dependencies in `node_modules`
-    // when packages are linked from outside directories
-    modules: [resolve('node_modules')],
-    extensions: ['.js'],
-    ...config.resolve,
-  },
-  config.module = {
-    ...config.module,
-  };
-  config.module.rules = [
-    ...config.module.rules || [],
-    {
-      test: /\.js$/,
-      use: 'babel-loader',
-      include: [resolve('src'), resolve('test')],
-    },
-    // CSS modules: src/**/*.module.css
-    styleRule({
-      ...defaultStyleOptions,
-      ...style,
-      modules: true,
-    }, {
-      test: /\.module\.css$/,
-      exclude: [resolve('node_modules')],
-    }),
-    // normal CSS files: src/**/*.css
-    styleRule({ ...defaultStyleOptions, ...style }, {
-      exclude: [
-        /\.module\.css$/,
-        resolve('node_modules'),
-      ],
-    }),
-    // library CSS files: node_modules/**/*.css
-    styleRule(style, {
-      include: [resolve('node_modules')],
-    }),
-  ];
-  config.optimization = {
-    ...config.optimization,
-  };
-  config.optimization.minimizer = (config.optimization.minimizer || [
-    isProd && new TerserPlugin({
-      cache: true,
-      parallel: true,
-      sourceMap: true // set to true if you want JS source maps
-    }),
-    isProd && new OptimizeCSSAssetsPlugin(),
-  ]).filter(Boolean);
-  config.plugins = [
-    ...config.plugins || [],
-    isProd && new MiniCssExtractPlugin(),
-  ].filter(Boolean);
-};

+ 0 - 15
scripts/webpack/raw.js

@@ -1,15 +0,0 @@
-const { resolve } = require('../util');
-
-module.exports = () => config => {
-  config.module = {
-    ...config.module,
-  };
-  config.module.rules = [
-    ...config.module.rules || [],
-    {
-      test: /\.(html|vert|frag)$/,
-      use: 'raw-loader',
-      include: [resolve('src')],
-    },
-  ];
-};

+ 0 - 26
scripts/webpack/svg.js

@@ -1,26 +0,0 @@
-// const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
-const { resolve, isProd } = require('../util');
-// const extractSVG = isProd;
-
-module.exports = () => config => {
-  config.module = {
-    ...config.module,
-  };
-  config.module.rules = [
-    ...config.module.rules || [],
-    {
-      test: /\.svg$/,
-      use: [{
-        loader: 'svg-sprite-loader',
-        options: {
-          // extract: extractSVG,
-        },
-      }],
-      include: [resolve('src/resources/svg')],
-    },
-  ];
-  config.plugins = [
-    ...config.plugins || [],
-    // extractSVG && new SpriteLoaderPlugin(),
-  ].filter(Boolean);
-};

+ 0 - 20
scripts/webpack/url.js

@@ -1,20 +0,0 @@
-const { resolve } = require('../util');
-
-module.exports = () => config => {
-  config.module = {
-    ...config.module,
-  };
-  config.module.rules = [
-    ...config.module.rules || [],
-    {
-      test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
-      use: [{
-        loader: 'url-loader',
-        options: {
-          limit: 10000,
-        },
-      }],
-      exclude: [resolve('src/resources/svg')],
-    },
-  ];
-};

+ 0 - 15
scripts/webpack/vue.js

@@ -1,15 +0,0 @@
-const VueLoaderPlugin = require('vue-loader/lib/plugin');
-
-module.exports = () => config => {
-  config.resolve.extensions.push('.vue');
-  config.module.rules.unshift({
-    test: /\.vue$/,
-    loader: 'vue-loader',
-    options: {
-      compilerOptions: {
-        preserveWhitespace: false,
-      },
-    },
-  });
-  config.plugins.push(new VueLoaderPlugin());
-};

+ 14 - 14
src/background/index.js

@@ -35,7 +35,7 @@ const browserAction = [
   return actions;
 }, {});
 
-hookOptions(changes => {
+hookOptions((changes) => {
   if ('isApplied' in changes) setIcon(changes.isApplied);
   if ('autoUpdate' in changes) autoUpdate();
   if ('showBadge' in changes) updateBadges();
@@ -52,11 +52,11 @@ hookOptions(changes => {
 function checkUpdateAll() {
   setOption('lastUpdate', Date.now());
   getScripts()
-  .then(scripts => {
+  .then((scripts) => {
     const toUpdate = scripts.filter(item => objectGet(item, 'config.shouldUpdate'));
     return Promise.all(toUpdate.map(checkUpdate));
   })
-  .then(updatedList => {
+  .then((updatedList) => {
     if (updatedList.some(Boolean)) sync.sync();
   });
 }
@@ -91,7 +91,7 @@ const commands = {
   GetData(clear) {
     return (clear ? checkRemove() : Promise.resolve())
     .then(getData)
-    .then(data => {
+    .then((data) => {
       data.sync = sync.getStates();
       data.version = VM_VER;
       return data;
@@ -107,7 +107,7 @@ const commands = {
     };
     if (!data.isApplied) return data;
     return getScriptsByURL(url)
-    .then(res => {
+    .then((res) => {
       addValueOpener(srcTab.id, Object.keys(res.values));
       return Object.assign(data, res);
     });
@@ -158,14 +158,14 @@ const commands = {
   },
   Vacuum: vacuum,
   ParseScript(data) {
-    return parseScript(data).then(res => {
+    return parseScript(data).then((res) => {
       sync.sync();
       return res.data;
     });
   },
   CheckUpdate(id) {
     getScript({ id }).then(checkUpdate)
-    .then(updated => {
+    .then((updated) => {
       if (updated) sync.sync();
     });
   },
@@ -175,7 +175,7 @@ const commands = {
   },
   GetRequestId: getRequestId,
   HttpRequest(details, src) {
-    httpRequest(details, res => {
+    httpRequest(details, (res) => {
       browser.tabs.sendMessage(src.tab.id, {
         cmd: 'HttpRequested',
         data: res,
@@ -208,7 +208,7 @@ const commands = {
   },
   SetOptions(data) {
     const items = Array.isArray(data) ? data : [data];
-    items.forEach(item => { setOption(item.key, item.value); });
+    items.forEach((item) => { setOption(item.key, item.value); });
   },
   ConfirmInstall: confirmInstall,
   CheckScript({ name, namespace }) {
@@ -236,7 +236,7 @@ initialize()
       if (typeof res !== 'undefined') {
         // If res is not instance of native Promise, browser APIs will not wait for it.
         res = Promise.resolve(res)
-        .then(data => ({ data }), error => {
+        .then(data => ({ data }), (error) => {
           if (process.env.DEBUG) console.error(error);
           return { error };
         });
@@ -267,7 +267,7 @@ function setBadge({ ids, reset }, src) {
   }
   data.number += ids.length;
   if (ids) {
-    ids.forEach(id => {
+    ids.forEach((id) => {
       data.idMap[id] = 1;
     });
     data.unique = Object.keys(data.idMap).length;
@@ -293,13 +293,13 @@ function updateBadge(tabId) {
 }
 function updateBadges() {
   browser.tabs.query({})
-  .then(tabs => {
-    tabs.forEach(tab => {
+  .then((tabs) => {
+    tabs.forEach((tab) => {
       updateBadge(tab.id);
     });
   });
 }
-browser.tabs.onRemoved.addListener(id => {
+browser.tabs.onRemoved.addListener((id) => {
   delete badges[id];
 });
 

+ 19 - 19
src/background/sync/base.js

@@ -80,7 +80,7 @@ function serviceConfig(name) {
   function set(key, val) {
     if (typeof key === 'object') {
       const data = key;
-      Object.keys(data).forEach(k => {
+      Object.keys(data).forEach((k) => {
         syncConfig.set(getKeys(k), data[k]);
       });
     } else {
@@ -113,7 +113,7 @@ function serviceState(validStates, initialState, onChange) {
   return { get, set, is };
 }
 export function getStates() {
-  return serviceNames.map(name => {
+  return serviceNames.map((name) => {
     const service = services[name];
     return {
       name: service.name,
@@ -231,7 +231,7 @@ export const BaseService = serviceFactory({
     this.startSync = this.syncFactory();
     const events = getEventEmitter();
     ['on', 'off', 'fire']
-    .forEach(key => {
+    .forEach((key) => {
       this[key] = (...args) => { events[key](...args); };
     });
   },
@@ -246,7 +246,7 @@ export const BaseService = serviceFactory({
       if (!shouldSync()) return Promise.resolve();
       this.log('Ready to sync:', this.displayName);
       this.syncState.set('ready');
-      working = working.then(() => new Promise(resolve => {
+      working = working.then(() => new Promise((resolve) => {
         debouncedResolve = debounce(resolve, 10 * 1000);
         debouncedResolve();
       }))
@@ -254,7 +254,7 @@ export const BaseService = serviceFactory({
         if (shouldSync()) return this.sync();
         this.syncState.set('idle');
       })
-      .catch(err => { console.error(err); })
+      .catch((err) => { console.error(err); })
       .then(() => {
         promise = null;
         debouncedResolve = null;
@@ -278,7 +278,7 @@ export const BaseService = serviceFactory({
     }))
     .then(() => {
       this.authState.set('authorized');
-    }, err => {
+    }, (err) => {
       if (err && err.type === 'unauthorized') {
         this.authState.set('unauthorized');
       } else {
@@ -320,7 +320,7 @@ export const BaseService = serviceFactory({
     let lastFetch = Promise.resolve();
     if (delay) {
       lastFetch = this.lastFetch
-      .then(ts => new Promise(resolve => {
+      .then(ts => new Promise((resolve) => {
         const delta = delay - (Date.now() - ts);
         if (delta > 0) {
           setTimeout(resolve, delta);
@@ -408,7 +408,7 @@ export const BaseService = serviceFactory({
         }
         return info;
       }, {});
-      localData.forEach(item => {
+      localData.forEach((item) => {
         const { props: { uri, position, lastModified } } = item;
         const remoteInfo = remoteMetaData.info[uri];
         if (remoteInfo) {
@@ -437,7 +437,7 @@ export const BaseService = serviceFactory({
           delLocal.push({ local: item });
         }
       });
-      Object.keys(remoteItemMap).forEach(uri => {
+      Object.keys(remoteItemMap).forEach((uri) => {
         const item = remoteItemMap[uri];
         const info = remoteMetaData.info[uri];
         if (outdated) {
@@ -450,7 +450,7 @@ export const BaseService = serviceFactory({
         ...putLocal.map(({ remote, info }) => {
           this.log('Download script:', getFilename(remote.uri));
           return this.get(remote)
-          .then(raw => {
+          .then((raw) => {
             const data = parseScriptData(raw);
             // Invalid data
             if (!data.code) return;
@@ -466,7 +466,7 @@ export const BaseService = serviceFactory({
         ...putRemote.map(({ local, remote }) => {
           this.log('Upload script:', getFilename(local.props.uri));
           return pluginScript.get(local.props.id)
-          .then(code => {
+          .then((code) => {
             // XXX use version 1 to be compatible with Violentmonkey on other platforms
             const data = getScriptData(local, 1, { code });
             remoteMetaData.info[local.props.uri] = {
@@ -501,12 +501,12 @@ export const BaseService = serviceFactory({
           return updateScriptInfo(local.props.id, updates);
         }),
       ];
-      promiseQueue.push(Promise.all(promiseQueue).then(() => sortScripts()).then(changed => {
+      promiseQueue.push(Promise.all(promiseQueue).then(() => sortScripts()).then((changed) => {
         if (!changed) return;
         remoteChanged = true;
         return pluginScript.list()
-        .then(scripts => {
-          scripts.forEach(script => {
+        .then((scripts) => {
+          scripts.forEach((script) => {
             const remoteInfo = remoteMetaData.info[script.props.uri];
             if (remoteInfo) remoteInfo.position = script.props.position;
           });
@@ -526,12 +526,12 @@ export const BaseService = serviceFactory({
       // ignore errors to ensure all promises are fulfilled
       return Promise.all(promiseQueue.map(promise => promise.then(noop, err => err || true)))
       .then(errors => errors.filter(Boolean))
-      .then(errors => { if (errors.length) throw errors; });
+      .then((errors) => { if (errors.length) throw errors; });
     })
     .then(() => {
       this.syncState.set('idle');
       this.log('Sync finished:', this.displayName);
-    }, err => {
+    }, (err) => {
       this.syncState.set('error');
       this.log('Failed syncing:', this.displayName);
       this.log(err);
@@ -552,7 +552,7 @@ function getService(name) {
 export function initialize() {
   if (!syncConfig) {
     syncConfig = initConfig();
-    serviceClasses.forEach(Factory => {
+    serviceClasses.forEach((Factory) => {
       const service = new Factory();
       const { name } = service;
       serviceNames.push(name);
@@ -574,7 +574,7 @@ export function sync() {
 }
 
 export function checkAuthUrl(url) {
-  return serviceNames.some(name => {
+  return serviceNames.some((name) => {
     const service = services[name];
     const authorized = service.checkAuth && service.checkAuth(url);
     return authorized;
@@ -598,7 +598,7 @@ export function setConfig(config) {
   }
 }
 
-hookOptions(data => {
+hookOptions((data) => {
   const value = objectGet(data, 'sync.current');
   if (value) initialize();
 });

+ 1 - 1
src/background/sync/dropbox.js

@@ -16,7 +16,7 @@ const Dropbox = BaseService.extend({
       method: 'POST',
       url: 'https://api.dropboxapi.com/2/users/get_current_account',
     })
-    .catch(err => {
+    .catch((err) => {
       if (err.status === 401) {
         return Promise.reject({
           type: 'unauthorized',

+ 5 - 5
src/background/sync/googledrive.js

@@ -37,7 +37,7 @@ const GoogleDrive = BaseService.extend({
       responseType: 'json',
     });
     return requestUser()
-    .then(info => {
+    .then((info) => {
       // If access was granted with access_type=online, revoke it.
       if (info.access_type === 'online') {
         return this.loadData({
@@ -58,7 +58,7 @@ const GoogleDrive = BaseService.extend({
       }
       if (info.scope !== config.scope) return Promise.reject(UNAUTHORIZED);
     })
-    .catch(res => {
+    .catch((res) => {
       if (res === UNAUTHORIZED || res.status === 400 && objectGet(res, 'data.error_description') === 'Invalid Value') {
         return this.refreshToken().then(requestUser);
       }
@@ -79,7 +79,7 @@ const GoogleDrive = BaseService.extend({
     })
     .then(({ files }) => {
       let metaFile;
-      const remoteData = files.filter(item => {
+      const remoteData = files.filter((item) => {
         if (isScriptFile(item.name)) return true;
         if (!metaFile && item.name === this.metaFile) {
           metaFile = item;
@@ -89,7 +89,7 @@ const GoogleDrive = BaseService.extend({
         return false;
       })
       .map(normalize)
-      .filter(item => {
+      .filter((item) => {
         if (!item.size) {
           this.remove(item);
           return false;
@@ -154,7 +154,7 @@ const GoogleDrive = BaseService.extend({
       }, params)),
       responseType: 'json',
     })
-    .then(data => {
+    .then((data) => {
       if (data.access_token) {
         const update = {
           token: data.access_token,

+ 3 - 3
src/background/sync/onedrive.js

@@ -30,13 +30,13 @@ const OneDrive = BaseService.extend({
       responseType: 'json',
     });
     return requestUser()
-    .catch(res => {
+    .catch((res) => {
       if (res.status === 401) {
         return this.refreshToken().then(requestUser);
       }
       throw res;
     })
-    .catch(res => {
+    .catch((res) => {
       if (res.status === 400 && objectGet(res, 'data.error') === 'invalid_grant') {
         return Promise.reject({
           type: 'unauthorized',
@@ -143,7 +143,7 @@ const OneDrive = BaseService.extend({
       }, params)),
       responseType: 'json',
     })
-    .then(data => {
+    .then((data) => {
       if (data.access_token) {
         this.config.set({
           uid: data.user_id,

+ 3 - 3
src/background/sync/webdav.js

@@ -228,10 +228,10 @@ const WebDAV = BaseService.extend({
         depth: '1',
       },
     })
-    .then(xml => {
+    .then((xml) => {
       const doc = XNode.fromXML(xml);
       const items = doc.children()[0]
-      .map(node => {
+      .map((node) => {
         const prop = node.find('DAV:propstat').find('DAV:prop');
         const type = prop.find('DAV:resourcetype').find('DAV:collection') ? 'directory' : 'file';
         const displayName = prop.find('DAV:displayname').text();
@@ -248,7 +248,7 @@ const WebDAV = BaseService.extend({
       return items;
     });
     return readdir()
-    .catch(err => {
+    .catch((err) => {
       if (err.status === 404) {
         return mkdir().then(readdir);
       }

+ 29 - 29
src/background/utils/db.js

@@ -18,7 +18,7 @@ function cacheOrFetch(handle) {
     let promise = requests[url];
     if (!promise) {
       promise = handle.call(this, url, ...args)
-      .catch(err => {
+      .catch((err) => {
         console.error(`Error fetching: ${url}`, err);
       })
       .then(() => {
@@ -51,9 +51,9 @@ const storage = {
     },
     getMulti(ids, def) {
       return browser.storage.local.get(ids.map(id => this.getKey(id)))
-      .then(data => {
+      .then((data) => {
         const result = {};
-        ids.forEach(id => { result[id] = data[this.getKey(id)] || def; });
+        ids.forEach((id) => { result[id] = data[this.getKey(id)] || def; });
         return result;
       });
     },
@@ -76,7 +76,7 @@ storage.script = Object.assign({}, storage.base, {
   prefix: 'scr:',
   dump: ensureListArgs(function dump(items) {
     const updates = {};
-    items.forEach(item => {
+    items.forEach((item) => {
       updates[this.getKey(item.props.id)] = item;
       store.scriptMap[item.props.id] = item;
     });
@@ -92,7 +92,7 @@ storage.value = Object.assign({}, storage.base, {
   dump(dict) {
     const updates = {};
     Object.keys(dict)
-    .forEach(id => {
+    .forEach((id) => {
       const value = dict[id];
       updates[this.getKey(id)] = value;
     });
@@ -136,13 +136,13 @@ function initialize() {
     });
   })
   .then(() => browser.storage.local.get())
-  .then(data => {
+  .then((data) => {
     const scripts = [];
     const storeInfo = {
       id: 0,
       position: 0,
     };
-    Object.keys(data).forEach(key => {
+    Object.keys(data).forEach((key) => {
       const value = data[key];
       if (key.startsWith('scr:')) {
         // {
@@ -156,7 +156,7 @@ function initialize() {
         storeInfo.position = Math.max(storeInfo.position, getInt(objectGet(value, 'props.position')));
       }
     });
-    scripts.forEach(script => {
+    scripts.forEach((script) => {
       script.custom = {
         ...getDefaultCustom(),
         ...script.custom,
@@ -211,7 +211,7 @@ export function sortScripts() {
     return pos1 - pos2;
   });
   return normalizePosition()
-  .then(changed => {
+  .then((changed) => {
     sendMessageOrIgnore({ cmd: 'ScriptsUpdated' });
     return changed;
   });
@@ -266,7 +266,7 @@ export function dumpValueStore(where, valueStore) {
   return (where.id
     ? Promise.resolve(where.id)
     : getScript(where).then(script => objectGet(script, 'props.id')))
-  .then(id => {
+  .then((id) => {
     if (id) return dumpValueStores({ [id]: valueStore });
   });
 }
@@ -280,14 +280,14 @@ export function getScriptsByURL(url) {
     : store.scripts.filter(script => !script.config.removed && testScript(url, script));
   const reqKeys = {};
   const cacheKeys = {};
-  scripts.forEach(script => {
+  scripts.forEach((script) => {
     if (script.config.enabled) {
       if (!script.custom.pathMap) buildPathMap(script);
       const { pathMap } = script.custom;
-      script.meta.require.forEach(key => {
+      script.meta.require.forEach((key) => {
         reqKeys[pathMap[key] || key] = 1;
       });
-      Object.values(script.meta.resources).forEach(key => {
+      Object.values(script.meta.resources).forEach((key) => {
         cacheKeys[pathMap[key] || key] = 1;
       });
     }
@@ -301,7 +301,7 @@ export function getScriptsByURL(url) {
     GM_deleteValue: 1,
   };
   const scriptsWithValue = enabledScripts
-  .filter(script => {
+  .filter((script) => {
     const grant = objectGet(script, 'meta.grant');
     return grant && grant.some(gm => gmValues[gm]);
   });
@@ -326,7 +326,7 @@ export function getScriptsByURL(url) {
 export function getData() {
   const cacheKeys = {};
   const { scripts } = store;
-  scripts.forEach(script => {
+  scripts.forEach((script) => {
     const icon = objectGet(script, 'meta.icon');
     if (isRemote(icon)) {
       const pathMap = objectGet(script, 'custom.pathMap') || {};
@@ -406,7 +406,7 @@ function saveScript(script, code) {
   props.uri = getNameURI(script);
   props.uuid = props.uuid || getUUID(props.id);
   // Do not allow script with same name and namespace
-  if (store.scripts.some(item => {
+  if (store.scripts.some((item) => {
     const itemProps = item.props || {};
     return props.id !== itemProps.id && props.uri === itemProps.uri;
   })) {
@@ -445,15 +445,15 @@ export function updateScriptInfo(id, data) {
 
 export function getExportData(withValues) {
   return getScripts()
-  .then(scripts => {
+  .then((scripts) => {
     const ids = scripts.map(({ props: { id } }) => id);
     return storage.code.getMulti(ids)
-    .then(codeMap => {
+    .then((codeMap) => {
       const data = {};
       data.items = scripts.map(script => ({ script, code: codeMap[script.props.id] }));
       if (withValues) {
         return storage.value.getMulti(ids)
-        .then(values => {
+        .then((values) => {
           data.values = values;
           return data;
         });
@@ -480,7 +480,7 @@ export function parseScript(data) {
     },
   };
   return getScript({ id, meta })
-  .then(oldScript => {
+  .then((oldScript) => {
     let script;
     if (oldScript) {
       if (isNew) throw i18n('msgNamespaceConflict');
@@ -509,7 +509,7 @@ export function parseScript(data) {
     buildPathMap(script, data.url);
     return saveScript(script, code).then(() => script);
   })
-  .then(script => {
+  .then((script) => {
     fetchScriptResources(script, data);
     Object.assign(result.data.update, script, update);
     result.data.where = { id: script.props.id };
@@ -540,7 +540,7 @@ function buildPathMap(script, base) {
 function fetchScriptResources(script, cache) {
   const { meta, custom: { pathMap } } = script;
   // @require
-  meta.require.forEach(key => {
+  meta.require.forEach((key) => {
     const fullUrl = pathMap[key] || key;
     const cached = objectGet(cache, ['require', fullUrl]);
     if (cached) {
@@ -550,7 +550,7 @@ function fetchScriptResources(script, cache) {
     }
   });
   // @resource
-  Object.values(meta.resources).forEach(url => {
+  Object.values(meta.resources).forEach((url) => {
     const fullUrl = pathMap[url] || url;
     const cached = objectGet(cache, ['resources', fullUrl]);
     if (cached) {
@@ -592,8 +592,8 @@ export function vacuum() {
     [storage.code, codeKeys],
   ];
   return browser.storage.local.get()
-  .then(data => {
-    Object.keys(data).forEach(key => {
+  .then((data) => {
+    Object.keys(data).forEach((key) => {
       mappings.some(([substore, map]) => {
         const { prefix } = substore;
         if (key.startsWith(prefix)) {
@@ -608,16 +608,16 @@ export function vacuum() {
       if (obj[key] < 0) obj[key] = 1;
       else if (!obj[key]) obj[key] = 2;
     };
-    store.scripts.forEach(script => {
+    store.scripts.forEach((script) => {
       const { id } = script.props;
       touch(codeKeys, id);
       touch(valueKeys, id);
       if (!script.custom.pathMap) buildPathMap(script);
       const { pathMap } = script.custom;
-      script.meta.require.forEach(url => {
+      script.meta.require.forEach((url) => {
         touch(requireKeys, pathMap[url] || url);
       });
-      Object.values(script.meta.resources).forEach(url => {
+      Object.values(script.meta.resources).forEach((url) => {
         touch(cacheKeys, pathMap[url] || url);
       });
       const { icon } = script.meta;
@@ -627,7 +627,7 @@ export function vacuum() {
       }
     });
     mappings.forEach(([substore, map]) => {
-      Object.keys(map).forEach(key => {
+      Object.keys(map).forEach((key) => {
         const value = map[key];
         if (value < 0) {
           // redundant value

+ 1 - 1
src/background/utils/events.js

@@ -20,7 +20,7 @@ export default function getEventEmitter() {
   function fire(type, data) {
     const list = events[type];
     if (list) {
-      list.forEach(func => {
+      list.forEach((func) => {
         func(data, type);
       });
     }

+ 1 - 1
src/background/utils/init.js

@@ -5,7 +5,7 @@ export function register(init) {
 }
 
 export function initialize() {
-  return Promise.all(initializers.map(init => {
+  return Promise.all(initializers.map((init) => {
     if (typeof init === 'function') return init();
     return init;
   }))

+ 2 - 2
src/background/utils/message.js

@@ -12,8 +12,8 @@ export function notify(options) {
 
 export function broadcast(data) {
   browser.tabs.query({})
-  .then(tabs => {
-    tabs.forEach(tab => {
+  .then((tabs) => {
+    tabs.forEach((tab) => {
       browser.tabs.sendMessage(tab.id, data)
       .catch(noop);
     });

+ 3 - 3
src/background/utils/notifications.js

@@ -2,7 +2,7 @@ import { i18n, defaultImage, noop } from '#/common';
 
 const openers = {};
 
-browser.notifications.onClicked.addListener(id => {
+browser.notifications.onClicked.addListener((id) => {
   const openerId = openers[id];
   if (openerId) {
     browser.tabs.sendMessage(openerId, {
@@ -13,7 +13,7 @@ browser.notifications.onClicked.addListener(id => {
   }
 });
 
-browser.notifications.onClosed.addListener(id => {
+browser.notifications.onClosed.addListener((id) => {
   const openerId = openers[id];
   if (openerId) {
     browser.tabs.sendMessage(openerId, {
@@ -33,7 +33,7 @@ export default function createNotification(data, src) {
     message: data.text,
     iconUrl: data.image || defaultImage,
   })
-  .then(notificationId => {
+  .then((notificationId) => {
     openers[notificationId] = srcTab.id;
     return notificationId;
   });

+ 1 - 1
src/background/utils/options.js

@@ -59,7 +59,7 @@ const init = browser.storage.local.get('options')
     try {
       if (localStorage.length) {
         Object.keys(defaults)
-        .forEach(key => {
+        .forEach((key) => {
           let value = localStorage.getItem(key);
           if (value) {
             try {

+ 8 - 8
src/background/utils/patch-db.js

@@ -27,27 +27,27 @@ export default () => new Promise((resolve, reject) => {
       processing -= 1;
       if (!processing) resolve(browser.storage.local.set(updates));
     };
-    getAllScripts(tx, items => {
+    getAllScripts(tx, (items) => {
       const uriMap = {};
       items.forEach(({ script, code }) => {
         updates[`scr:${script.props.id}`] = script;
         updates[`code:${script.props.id}`] = code;
         uriMap[script.props.uri] = script.props.id;
       });
-      getAllValues(tx, data => {
+      getAllValues(tx, (data) => {
         data.forEach(({ id, values }) => {
           updates[`val:${id}`] = values;
         });
         onCallback();
       }, uriMap);
     });
-    getAllCache(tx, cache => {
+    getAllCache(tx, (cache) => {
       cache.forEach(({ uri, data }) => {
         updates[`cac:${uri}`] = data;
       });
       onCallback();
     });
-    getAllRequire(tx, data => {
+    getAllRequire(tx, (data) => {
       data.forEach(({ uri, code }) => {
         updates[`req:${uri}`] = code;
       });
@@ -58,7 +58,7 @@ export default () => new Promise((resolve, reject) => {
     const os = tx.objectStore('scripts');
     const list = [];
     const req = os.openCursor();
-    req.onsuccess = e => {
+    req.onsuccess = (e) => {
       const cursor = e.target.result;
       if (cursor) {
         const { value } = cursor;
@@ -74,7 +74,7 @@ export default () => new Promise((resolve, reject) => {
     const os = tx.objectStore('cache');
     const list = [];
     const req = os.openCursor();
-    req.onsuccess = e => {
+    req.onsuccess = (e) => {
       const cursor = e.target.result;
       if (cursor) {
         const { value: { uri, data } } = cursor;
@@ -90,7 +90,7 @@ export default () => new Promise((resolve, reject) => {
     const os = tx.objectStore('require');
     const list = [];
     const req = os.openCursor();
-    req.onsuccess = e => {
+    req.onsuccess = (e) => {
       const cursor = e.target.result;
       if (cursor) {
         const { value: { uri, code } } = cursor;
@@ -106,7 +106,7 @@ export default () => new Promise((resolve, reject) => {
     const os = tx.objectStore('values');
     const list = [];
     const req = os.openCursor();
-    req.onsuccess = e => {
+    req.onsuccess = (e) => {
       const cursor = e.target.result;
       if (cursor) {
         const { value: { uri, values } } = cursor;

+ 10 - 10
src/background/utils/requests.js

@@ -27,7 +27,7 @@ export function getRequestId() {
 function xhrCallbackWrapper(req) {
   let lastPromise = Promise.resolve();
   const { xhr } = req;
-  return evt => {
+  return (evt) => {
     const res = {
       id: req.id,
       type: evt.type,
@@ -47,7 +47,7 @@ function xhrCallbackWrapper(req) {
       // ignore if responseText is unreachable
     }
     if (evt.type === 'progress') {
-      ['lengthComputable', 'loaded', 'total'].forEach(key => {
+      ['lengthComputable', 'loaded', 'total'].forEach((key) => {
         data[key] = evt[key];
       });
     }
@@ -83,7 +83,7 @@ export function httpRequest(details, cb) {
     xhr.open(details.method, details.url, true, details.user || '', details.password || '');
     xhr.setRequestHeader('VM-Verify', details.id);
     if (details.headers) {
-      Object.keys(details.headers).forEach(key => {
+      Object.keys(details.headers).forEach((key) => {
         const lowerKey = key.toLowerCase();
         // `VM-` headers are reserved
         if (lowerKey.startsWith('vm-')) return;
@@ -106,7 +106,7 @@ export function httpRequest(details, cb) {
       'readystatechange',
       'timeout',
     ]
-    .forEach(evt => { xhr[`on${evt}`] = callback; });
+    .forEach((evt) => { xhr[`on${evt}`] = callback; });
     // req.finalUrl = details.url;
     const { data } = details;
     const body = data ? decodeBody(data) : null;
@@ -134,8 +134,8 @@ function decodeBody(obj) {
   if (cls === 'formdata') {
     const result = new FormData();
     if (value) {
-      Object.keys(value).forEach(key => {
-        value[key].forEach(item => {
+      Object.keys(value).forEach((key) => {
+        value[key].forEach((item) => {
           result.append(key, decodeBody(item));
         });
       });
@@ -171,7 +171,7 @@ function decodeBody(obj) {
     const headers = details.requestHeaders;
     let newHeaders = [];
     const vmHeaders = {};
-    headers.forEach(header => {
+    headers.forEach((header) => {
       // if (header.name === 'VM-Task') {
       //   tasks[details.requestId] = header.value;
       // } else
@@ -188,7 +188,7 @@ function decodeBody(obj) {
         delete vmHeaders.Verify;
         verify[details.requestId] = reqId;
         req.coreId = details.requestId;
-        Object.keys(vmHeaders).forEach(name => {
+        Object.keys(vmHeaders).forEach((name) => {
           if (isSpecialHeader(name.toLowerCase())) {
             newHeaders.push({ name, value: vmHeaders[name] });
           }
@@ -261,7 +261,7 @@ export function confirmInstall(info) {
       return data;
     })
   )
-  .then(code => {
+  .then((code) => {
     cache.put(info.url, code, 3000);
     const confirmKey = getUniqId();
     cache.put(`confirm-${confirmKey}`, {
@@ -285,7 +285,7 @@ const blacklist = [
 ].map(re => new RegExp(re));
 const bypass = {};
 
-browser.webRequest.onBeforeRequest.addListener(req => {
+browser.webRequest.onBeforeRequest.addListener((req) => {
   // onBeforeRequest fired for `file:`
   // - works on Chrome
   // - does not work on Firefox

+ 2 - 2
src/background/utils/tabs.js

@@ -3,7 +3,7 @@ import { isFirefox, isAndroid } from '#/common/ua';
 
 const openers = {};
 
-browser.tabs.onRemoved.addListener(id => {
+browser.tabs.onRemoved.addListener((id) => {
   const openerId = openers[id];
   if (openerId) {
     browser.tabs.sendMessage(openerId, {
@@ -29,7 +29,7 @@ export function tabOpen(data, src) {
     options.openerTabId = srcTab.id;
   }
   return browser.tabs.create(options)
-  .then(tab => {
+  .then((tab) => {
     const { id } = tab;
     openers[id] = srcTab.id;
     return { id };

+ 7 - 7
src/background/utils/tester.js

@@ -6,7 +6,7 @@ tld.initTLD(true);
 
 const RE_MATCH_PARTS = /(.*?):\/\/([^/]*)\/(.*)/;
 let blacklistRules = [];
-hookOptions(changes => {
+hookOptions((changes) => {
   if ('blacklist' in changes) resetBlacklist(changes.blacklist || '');
 });
 const RE_HTTP_OR_HTTPS = /^https?$/i;
@@ -16,7 +16,7 @@ const RE_HTTP_OR_HTTPS = /^https?$/i;
  */
 export function testGlob(url, rules) {
   const lifetime = 60 * 1000;
-  return rules.some(rule => {
+  return rules.some((rule) => {
     const key = `re:${rule}`;
     let re = cache.get(key);
     if (re) {
@@ -34,7 +34,7 @@ export function testGlob(url, rules) {
  */
 export function testMatch(url, rules) {
   const lifetime = 60 * 1000;
-  return rules.some(rule => {
+  return rules.some((rule) => {
     const key = `match:${rule}`;
     let matcher = cache.get(key);
     if (matcher) {
@@ -83,7 +83,7 @@ function autoReg(str) {
   if (tld.isReady() && str.includes('.tld/')) {
     const reTldStr = reStr.replace('\\.tld/', '((?:\\.\\w+)+)/');
     return {
-      test: tstr => {
+      test: (tstr) => {
         const matches = tstr.match(reTldStr);
         if (matches) {
           const suffix = matches[1].slice(1);
@@ -127,7 +127,7 @@ function hostMatcher(rule) {
     suffix = RE_STR_TLD;
   }
   const re = new RegExp(`^${prefix}${str2RE(base)}${suffix}$`);
-  return data => {
+  return (data) => {
     // * matches all
     if (rule === '*') return 1;
     // exact match
@@ -164,7 +164,7 @@ function matchTester(rule) {
     if (ruleParts) {
       const matchHost = hostMatcher(ruleParts[2]);
       const matchPath = pathMatcher(ruleParts[3]);
-      test = url => {
+      test = (url) => {
         const parts = url.match(RE_MATCH_PARTS);
         return !!ruleParts && !!parts
           && matchScheme(ruleParts[1], parts[1])
@@ -198,7 +198,7 @@ export function resetBlacklist(list) {
   }
   // XXX compatible with {Array} list in v2.6.1-
   blacklistRules = (Array.isArray(rules) ? rules : (rules || '').split('\n'))
-  .map(line => {
+  .map((line) => {
     const item = line.trim();
     if (!item || item.startsWith('#')) return null;
 

+ 2 - 2
src/background/utils/update.js

@@ -80,7 +80,7 @@ export default function checkUpdate(script) {
         checking: false,
       },
     }))
-    .then(res => {
+    .then((res) => {
       const { data: { update } } = res;
       updated = true;
       if (getOption('notifyUpdates')) {
@@ -90,7 +90,7 @@ export default function checkUpdate(script) {
         });
       }
     })
-    .catch(err => {
+    .catch((err) => {
       if (process.env.DEBUG) console.error(err);
     })
     .then(() => {

+ 8 - 8
src/background/utils/values.js

@@ -6,7 +6,7 @@ const tabScripts = {}; // openerId: { scriptId: 1, ... }
 let cache;
 let timer;
 
-browser.tabs.onRemoved.addListener(id => {
+browser.tabs.onRemoved.addListener((id) => {
   resetValueOpener(id);
 });
 
@@ -30,7 +30,7 @@ export function setValueStore(where, value) {
 export function resetValueOpener(openerId) {
   const scriptMap = tabScripts[openerId];
   if (scriptMap) {
-    Object.keys(scriptMap).forEach(scriptId => {
+    Object.keys(scriptMap).forEach((scriptId) => {
       const map = openers[scriptId];
       if (map) delete map[openerId];
     });
@@ -44,7 +44,7 @@ export function addValueOpener(openerId, scriptIds) {
     scriptMap = {};
     tabScripts[openerId] = scriptMap;
   }
-  scriptIds.forEach(scriptId => {
+  scriptIds.forEach((scriptId) => {
     scriptMap[scriptId] = 1;
     let openerMap = openers[scriptId];
     if (!openerMap) {
@@ -67,12 +67,12 @@ function doUpdate() {
   cache = null;
   const ids = Object.keys(currentCache);
   getValueStoresByIds(ids)
-  .then(valueStores => {
-    ids.forEach(id => {
+  .then((valueStores) => {
+    ids.forEach((id) => {
       const valueStore = valueStores[id] || {};
       valueStores[id] = valueStore;
       const updates = currentCache[id] || {};
-      Object.keys(updates).forEach(key => {
+      Object.keys(updates).forEach((key) => {
         const value = updates[key];
         if (!value) delete valueStore[key];
         else valueStore[key] = value;
@@ -81,7 +81,7 @@ function doUpdate() {
     return dumpValueStores(valueStores);
   })
   .then(broadcastUpdates)
-  .catch(err => {
+  .catch((err) => {
     console.error('Values error:', err);
   })
   .then(() => {
@@ -94,7 +94,7 @@ function broadcastUpdates(updates) {
   if (updates) {
     const updatedOpeners = Object.keys(updates)
     .reduce((map, scriptId) => Object.assign(map, openers[scriptId]), {});
-    Object.keys(updatedOpeners).forEach(openerId => {
+    Object.keys(updatedOpeners).forEach((openerId) => {
       browser.tabs.sendMessage(+openerId, {
         cmd: 'UpdatedValues',
         data: updates,

+ 8 - 8
src/common/browser.js

@@ -5,7 +5,7 @@ import '#/common/polyfills';
 function wrapAsync(func, thisObj) {
   return (...args) => {
     const promise = new Promise((resolve, reject) => {
-      args.push(res => {
+      args.push((res) => {
         const err = chrome.runtime.lastError;
         if (err) {
           reject(err);
@@ -15,7 +15,7 @@ function wrapAsync(func, thisObj) {
       });
       func.apply(thisObj, args);
     });
-    promise.catch(err => {
+    promise.catch((err) => {
       if (process.env.DEBUG) console.warn(args, err);
     });
     return promise;
@@ -23,7 +23,7 @@ function wrapAsync(func, thisObj) {
 }
 function wrapAPIs(source, meta) {
   const target = {};
-  Object.keys(source).forEach(key => {
+  Object.keys(source).forEach((key) => {
     const metaVal = meta && meta[key];
     if (metaVal) {
       const value = source[key];
@@ -58,12 +58,12 @@ const meta = {
           }
           const result = listener(message, sender);
           if (result && typeof result.then === 'function') {
-            result.then(data => {
+            result.then((data) => {
               if (process.env.DEBUG) {
                 console.info('send', data);
               }
               sendResponse({ data });
-            }, error => {
+            }, (error) => {
               if (process.env.DEBUG) console.warn(error);
               sendResponse({ error });
             })
@@ -88,13 +88,13 @@ const meta = {
     },
     sendMessage(sendMessage) {
       const promisifiedSendMessage = wrapAsync(sendMessage);
-      return data => {
+      return (data) => {
         const promise = promisifiedSendMessage(data)
-        .then(res => {
+        .then((res) => {
           if (res && res.error) throw res.error;
           return res && res.data;
         });
-        promise.catch(err => {
+        promise.catch((err) => {
           if (process.env.DEBUG) console.warn(err);
         });
         return promise;

+ 1 - 1
src/common/events.js

@@ -42,7 +42,7 @@ export default class EventEmitter {
           evt.defaultPrevented = true;
         },
       };
-      handlers.some(handle => {
+      handlers.some((handle) => {
         handle(evt);
         return evt.defaultPrevented;
       });

+ 2 - 2
src/common/hook-setting.js

@@ -3,8 +3,8 @@ import { objectGet } from './object';
 
 const hooks = {};
 
-options.hook(data => {
-  Object.keys(hooks).forEach(key => {
+options.hook((data) => {
+  Object.keys(hooks).forEach((key) => {
     const list = hooks[key];
     if (list) {
       const value = objectGet(data, key);

+ 5 - 5
src/common/index.js

@@ -13,7 +13,7 @@ export function initHooks() {
   const hooks = [];
 
   function fire(data) {
-    hooks.slice().forEach(cb => {
+    hooks.slice().forEach((cb) => {
       cb(data);
     });
   }
@@ -31,12 +31,12 @@ export function initHooks() {
 
 export function sendMessage(payload) {
   const promise = browser.runtime.sendMessage(payload)
-  .then(res => {
+  .then((res) => {
     const { data, error } = res || {};
     if (error) return Promise.reject(error);
     return data;
   });
-  promise.catch(err => {
+  promise.catch((err) => {
     if (process.env.DEBUG) console.warn(err);
   });
   return promise;
@@ -117,7 +117,7 @@ export function request(url, options = {}) {
       headers['Content-Type'] = 'application/json';
       body = JSON.stringify(body);
     }
-    Object.keys(headers).forEach(key => {
+    Object.keys(headers).forEach((key) => {
       xhr.setRequestHeader(key, headers[key]);
     });
     xhr.onload = () => {
@@ -203,7 +203,7 @@ export function cache2blobUrl(raw, { defaultType, type: overrideType } = {}) {
 
 export function encodeFilename(name) {
   // `escape` generated URI has % in it
-  return name.replace(/[-\\/:*?"<>|%\s]/g, m => {
+  return name.replace(/[-\\/:*?"<>|%\s]/g, (m) => {
     let code = m.charCodeAt(0).toString(16);
     if (code.length < 2) code = `0${code}`;
     return `-x${code}`;

+ 3 - 3
src/common/object.js

@@ -3,7 +3,7 @@ import { normalizeKeys } from '.';
 export function objectGet(obj, rawKey, def) {
   const keys = normalizeKeys(rawKey);
   let res = obj;
-  keys.every(key => {
+  keys.every((key) => {
     if (res && typeof res === 'object' && (key in res)) {
       res = res[key];
       return true;
@@ -20,7 +20,7 @@ export function objectSet(obj, rawKey, val) {
   const root = obj || {};
   let sub = root;
   const lastKey = keys.pop();
-  keys.forEach(key => {
+  keys.forEach((key) => {
     let child = sub[key];
     if (!child) {
       child = {};
@@ -41,7 +41,7 @@ export function objectPurify(obj) {
   if (Array.isArray(obj)) {
     obj.forEach(objectPurify);
   } else if (obj && typeof obj === 'object') {
-    Object.keys(obj).forEach(key => {
+    Object.keys(obj).forEach((key) => {
       const type = typeof obj[key];
       if (type === 'undefined') delete obj[key];
       else objectPurify(obj[key]);

+ 2 - 2
src/common/options.js

@@ -4,7 +4,7 @@ import { objectGet, objectSet } from './object';
 let options = {};
 const hooks = initHooks();
 const ready = sendMessage({ cmd: 'GetAllOptions' })
-.then(data => {
+.then((data) => {
   options = data;
   if (data) hooks.fire(data);
 });
@@ -22,7 +22,7 @@ function setOption(key, value) {
 }
 
 function updateOptions(data) {
-  Object.keys(data).forEach(key => {
+  Object.keys(data).forEach((key) => {
     objectSet(options, key, data[key]);
   });
   hooks.fire(data);

+ 10 - 10
src/common/polyfills.js

@@ -1,15 +1,15 @@
-import 'core-js/fn/object/assign';
-import 'core-js/fn/object/values';
-import 'core-js/fn/array/includes';
-import 'core-js/fn/array/find';
-import 'core-js/fn/array/find-index';
-import 'core-js/fn/string/includes';
-import 'core-js/fn/string/starts-with';
-import 'core-js/fn/string/ends-with';
-import 'core-js/fn/string/repeat';
+import 'core-js/features/object/assign';
+import 'core-js/features/object/values';
+import 'core-js/features/array/includes';
+import 'core-js/features/array/find';
+import 'core-js/features/array/find-index';
+import 'core-js/features/string/includes';
+import 'core-js/features/string/starts-with';
+import 'core-js/features/string/ends-with';
+import 'core-js/features/string/repeat';
 
 // Must use native Promise for Firefox to work
-// import 'core-js/fn/promise';
+// import 'core-js/features/promise';
 
 // function polyfill(obj, name, value) {
 //   if (!obj[name]) {

+ 4 - 4
src/common/ui/code.vue

@@ -74,7 +74,7 @@ const CTRL_OPEN = '\x02'.repeat(256);
 const CTRL_CLOSE = '\x03'.repeat(256);
 
 function getHandler(key) {
-  return cm => {
+  return (cm) => {
     const { commands } = cm.state;
     const handle = commands && commands[key];
     return handle && handle();
@@ -84,7 +84,7 @@ function getHandler(key) {
 [
   'save', 'cancel', 'close',
   'find', 'findNext', 'findPrev', 'replace', 'replaceAll',
-].forEach(key => {
+].forEach((key) => {
   CodeMirror.commands[key] = getHandler(key);
 });
 Object.assign(CodeMirror.keyMap.default, {
@@ -314,10 +314,10 @@ export default {
       [
         cm.options.extraKeys,
         cm.options.keyMap,
-      ].some(keyMap => {
+      ].some((keyMap) => {
         let stop = false;
         if (keyMap) {
-          CodeMirror.lookupKey(name, keyMap, b => {
+          CodeMirror.lookupKey(name, keyMap, (b) => {
             if (cm.state.commands[b]) {
               e.preventDefault();
               e.stopPropagation();

+ 1 - 1
src/common/ui/setting-check.vue

@@ -37,7 +37,7 @@ export default {
   created() {
     options.ready(() => {
       this.value = options.get(this.name);
-      this.revoke = hookSetting(this.name, value => {
+      this.revoke = hookSetting(this.name, (value) => {
         this.value = value;
       });
       this.$watch('value', this.onChange);

+ 1 - 1
src/common/ui/setting-text.vue

@@ -24,7 +24,7 @@ export default {
     // XXX compatible with old data format
     const handle = value => (Array.isArray(value) ? value.join('\n') : (value || ''));
     this.value = handle(options.get(this.name));
-    this.revoke = hookSetting(this.name, value => {
+    this.revoke = hookSetting(this.name, (value) => {
       this.value = handle(value);
     });
   },

+ 1 - 1
src/common/ui/style/index.js

@@ -2,7 +2,7 @@ import options from '../../options';
 import './style.css';
 
 let style;
-options.hook(changes => {
+options.hook((changes) => {
   if ('customCSS' in changes) {
     const { customCSS } = changes;
     if (customCSS && !style) {

+ 13 - 13
src/confirm/views/app.vue

@@ -104,7 +104,7 @@ export default {
         cmd: 'CacheLoad',
         data: `confirm-${id}`,
       })
-      .then(info => {
+      .then((info) => {
         if (!info) return Promise.reject();
         this.info = info;
       });
@@ -113,7 +113,7 @@ export default {
       this.installable = false;
       const { code: oldCode } = this;
       return this.getScript(this.info.url)
-      .then(code => {
+      .then((code) => {
         if (changedOnly && oldCode === code) return Promise.reject();
         this.code = code;
       });
@@ -123,7 +123,7 @@ export default {
         cmd: 'ParseMeta',
         data: this.code,
       })
-      .then(script => {
+      .then((script) => {
         const urls = Object.keys(script.resources)
         .map(key => script.resources[key]);
         const length = script.require.length + urls.length;
@@ -136,23 +136,23 @@ export default {
         updateStatus();
         this.require = {};
         this.resources = {};
-        const promises = script.require.map(url => {
+        const promises = script.require.map((url) => {
           const fullUrl = getFullUrl(url, this.info.url);
-          return this.getFile(fullUrl, { useCache: true }).then(res => {
+          return this.getFile(fullUrl, { useCache: true }).then((res) => {
             this.require[fullUrl] = res;
           });
         })
-        .concat(urls.map(url => {
+        .concat(urls.map((url) => {
           const fullUrl = getFullUrl(url, this.info.url);
           return this.getFile(fullUrl, { isBlob: true, useCache: true })
-          .then(res => {
+          .then((res) => {
             this.resources[fullUrl] = res;
           });
         }))
         .map(promise => promise.then(() => {
           finished += 1;
           updateStatus();
-        }, url => {
+        }, (url) => {
           error.push(url);
         }));
         return Promise.all(promises).then(() => {
@@ -163,7 +163,7 @@ export default {
       .then(() => {
         this.message = this.i18n('msgLoadedData');
         this.installable = true;
-      }, err => {
+      }, (err) => {
         this.message = this.i18n('msgErrorLoadingDependency', [err]);
         return Promise.reject();
       });
@@ -180,7 +180,7 @@ export default {
         responseType: isBlob ? 'arraybuffer' : null,
       })
       .then(({ data }) => (isBlob ? window.btoa(buffer2string(data)) : data))
-      .then(data => {
+      .then((data) => {
         if (useCache) cache.put(cacheKey, data);
         return data;
       });
@@ -213,17 +213,17 @@ export default {
           resources: this.resources,
         },
       })
-      .then(result => {
+      .then((result) => {
         this.message = `${result.update.message}[${this.getTimeString()}]`;
         if (this.closeAfterInstall) this.close();
         else if (this.isLocal && options.get('trackLocalFile')) this.trackLocalFile();
-      }, err => {
+      }, (err) => {
         this.message = `${err}`;
         this.installable = true;
       });
     },
     trackLocalFile() {
-      new Promise(resolve => {
+      new Promise((resolve) => {
         setTimeout(resolve, 2000);
       })
       .then(() => this.loadData(true))

+ 8 - 8
src/injected/content/index.js

@@ -63,13 +63,13 @@ export default function initialize(contentId, webId) {
       reset: IS_TOP,
     },
   })
-  .then(data => {
+  .then((data) => {
     const scriptLists = {
       [INJECT_PAGE]: [],
       [INJECT_CONTENT]: [],
     };
     if (data.scripts) {
-      data.scripts = data.scripts.filter(script => {
+      data.scripts = data.scripts.filter((script) => {
         ids.push(script.props.id);
         if ((IS_TOP || !script.meta.noframes) && script.config.enabled) {
           enabledIds.push(script.props.id);
@@ -78,7 +78,7 @@ export default function initialize(contentId, webId) {
         return false;
       });
       let support;
-      data.scripts.forEach(script => {
+      data.scripts.forEach((script) => {
         let injectInto = script.custom.injectInto || script.meta.injectInto || data.injectInto;
         if (injectInto === INJECT_AUTO) {
           if (!support) support = { injectable: checkInjectable() };
@@ -98,7 +98,7 @@ export default function initialize(contentId, webId) {
 
 function checkInjectable() {
   const id = getUniqId('VM-');
-  const detect = domId => {
+  const detect = (domId) => {
     const span = document.createElement('span');
     span.id = domId;
     document.documentElement.appendChild(span);
@@ -115,8 +115,8 @@ function injectScripts(contentId, webId, data, scriptLists) {
   [
     Object.getOwnPropertyNames(window),
     Object.getOwnPropertyNames(global),
-  ].forEach(keys => {
-    keys.forEach(key => { props[key] = 1; });
+  ].forEach((keys) => {
+    keys.forEach((key) => { props[key] = 1; });
   });
   const args = [
     webId,
@@ -206,13 +206,13 @@ const handlers = {
   },
   CheckScript({ name, namespace, callback }) {
     sendMessage({ cmd: 'CheckScript', data: { name, namespace } })
-    .then(result => {
+    .then((result) => {
       bridge.post({ cmd: 'ScriptChecked', data: { callback, result } });
     });
   },
 };
 
-bridge.ready = new Promise(resolve => {
+bridge.ready = new Promise((resolve) => {
   handlers.Ready = resolve;
 });
 

+ 1 - 1
src/injected/content/notifications.js

@@ -5,7 +5,7 @@ const notifications = {};
 
 export function onNotificationCreate(options) {
   sendMessage({ cmd: 'Notification', data: options })
-  .then(nid => { notifications[nid] = options.id; });
+  .then((nid) => { notifications[nid] = options.id; });
 }
 
 export function onNotificationClick(nid) {

+ 1 - 1
src/injected/content/requests.js

@@ -5,7 +5,7 @@ const requests = {};
 
 export function getRequestId() {
   sendMessage({ cmd: 'GetRequestId' })
-  .then(id => {
+  .then((id) => {
     requests[id] = 1;
     bridge.post({ cmd: 'GotRequestId', data: id });
   });

+ 3 - 3
src/injected/utils/helpers.js

@@ -30,9 +30,9 @@ const { fromCharCode } = String;
 
 export const { keys } = Object;
 export const assign = Object.assign || ((obj, ...args) => {
-  forEach(args, arg => {
+  forEach(args, (arg) => {
     if (arg) {
-      forEach(keys(arg), key => {
+      forEach(keys(arg), (key) => {
         obj[key] = arg[key];
       });
     }
@@ -71,7 +71,7 @@ export function encodeBody(body) {
     }, {}))
     .then(value => ({ cls, value }));
   } else if (includes(['blob', 'file'], cls)) {
-    result = new Promise(resolve => {
+    result = new Promise((resolve) => {
       const reader = new FileReader();
       reader.onload = () => {
         // In Firefox, Uint8Array cannot be sliced if its data is read by FileReader

+ 2 - 2
src/injected/utils/index.js

@@ -31,11 +31,11 @@ export function inject(code) {
 }
 
 export function bindEvents(srcId, destId, handle) {
-  document.addEventListener(srcId, e => {
+  document.addEventListener(srcId, (e) => {
     const data = jsonLoad(e.detail);
     handle(data);
   }, false);
-  return data => { postData(destId, data); };
+  return (data) => { postData(destId, data); };
 }
 
 export function attachFunction(id, cb) {

+ 12 - 12
src/injected/web/index.js

@@ -56,7 +56,7 @@ const handlers = {
   TabClosed: onTabClosed,
   UpdatedValues(updates) {
     Object.keys(updates)
-    .forEach(id => {
+    .forEach((id) => {
       if (store.values[id]) store.values[id] = updates[id];
     });
   },
@@ -69,7 +69,7 @@ const handlers = {
 
 function registerCallback(callback) {
   const callbackId = getUniqId('VMcb');
-  store.callbacks[callbackId] = payload => {
+  store.callbacks[callbackId] = (payload) => {
     callback(payload);
     delete store.callbacks[callbackId];
   };
@@ -103,7 +103,7 @@ function onLoadScripts(data) {
     'document-end': end,
   };
   if (data.scripts) {
-    forEach(data.scripts, script => {
+    forEach(data.scripts, (script) => {
       const runAt = script.custom.runAt || script.meta.runAt;
       const list = listMap[runAt] || end;
       push(list, script);
@@ -128,7 +128,7 @@ function onLoadScripts(data) {
     const codeSlices = [
       `${wrapperInit};with(this)!function(define,module,exports){`,
     ];
-    forEach(requireKeys, key => {
+    forEach(requireKeys, (key) => {
       const requireCode = data.require[pathMap[key] || key];
       if (requireCode) {
         push(
@@ -284,7 +284,7 @@ function wrapGM(script, code, cache, unsafeWindow) {
       value(css) {
         const callbacks = [];
         let el = false;
-        const callbackId = registerCallback(styleId => {
+        const callbackId = registerCallback((styleId) => {
           el = document.getElementById(styleId);
           callbacks.splice().forEach(callback => callback(el));
         });
@@ -358,7 +358,7 @@ function wrapGM(script, code, cache, unsafeWindow) {
     },
   };
   const keys = [];
-  forEach(grant, name => {
+  forEach(grant, (name) => {
     const prop = gmFunctions[name];
     if (prop) {
       push(keys, name);
@@ -399,13 +399,13 @@ function getWrapper(unsafeWindow) {
   // Block special objects
   forEach([
     'browser',
-  ], name => {
+  ], (name) => {
     wrapper[name] = undefined;
   });
   forEach([
     // `eval` should be called directly so that it is run in current scope
     'eval',
-  ], name => {
+  ], (name) => {
     wrapper[name] = unsafeWindow[name];
   });
   forEach([
@@ -455,7 +455,7 @@ function getWrapper(unsafeWindow) {
     'setInterval',
     'setTimeout',
     'stop',
-  ], name => {
+  ], (name) => {
     const method = unsafeWindow[name];
     if (method) {
       wrapper[name] = (...args) => method.apply(unsafeWindow, args);
@@ -487,7 +487,7 @@ function getWrapper(unsafeWindow) {
     });
   }
   // Wrap properties
-  forEach(bridge.props, name => {
+  forEach(bridge.props, (name) => {
     if (name in wrapper) return;
     if (name.slice(0, 2) === 'on') defineReactedProperty(name);
     else defineProtectedProperty(name);
@@ -524,7 +524,7 @@ function runCode(name, func, args, thisObj, code) {
       }
     }
   };
-  const addStartInfo = err => {
+  const addStartInfo = (err) => {
     const info = parseError(err, 0);
     if (info) push(startInfo, info);
   };
@@ -571,7 +571,7 @@ function exposeVM() {
     }),
   });
   Object.defineProperty(Violentmonkey, 'isInstalled', {
-    value: (name, namespace) => new Promise(resolve => {
+    value: (name, namespace) => new Promise((resolve) => {
       key += 1;
       const callback = key;
       checking[callback] = resolve;

+ 1 - 1
src/injected/web/requests.js

@@ -100,7 +100,7 @@ function start(req, id) {
     }
   }
   encodeBody(details.data)
-  .then(body => {
+  .then((body) => {
     payload.data = body;
     bridge.post({
       cmd: 'HttpRequest',

+ 4 - 4
src/options/index.js

@@ -51,21 +51,21 @@ function initScript(script) {
 
 function loadData(clear) {
   sendMessage({ cmd: 'GetData', data: clear })
-  .then(data => {
+  .then((data) => {
     const oldCache = store.cache || {};
     store.cache = null;
     [
       'cache',
       'scripts',
       'sync',
-    ].forEach(key => {
+    ].forEach((key) => {
       Vue.set(store, key, data[key]);
     });
     if (store.scripts) {
       store.scripts.forEach(initScript);
     }
     if (store.cache) {
-      Object.keys(store.cache).forEach(url => {
+      Object.keys(store.cache).forEach((url) => {
         const raw = store.cache[url];
         if (oldCache[url]) {
           store.cache[url] = oldCache[url];
@@ -75,7 +75,7 @@ function loadData(clear) {
         }
       });
     }
-    Object.values(oldCache).forEach(blobUrl => {
+    Object.values(oldCache).forEach((blobUrl) => {
       URL.revokeObjectURL(blobUrl);
     });
     store.loading = false;

+ 3 - 3
src/options/views/edit/index.vue

@@ -136,7 +136,7 @@ export default {
         return code;
       })
     )
-    .then(code => {
+    .then((code) => {
       this.code = code;
       const settings = {};
       const { custom, config } = this.script;
@@ -205,10 +205,10 @@ export default {
           message: '',
         },
       })
-      .then(res => {
+      .then((res) => {
         this.canSave = false;
         if (objectGet(res, 'where.id')) this.script = res.update;
-      }, err => {
+      }, (err) => {
         showMessage({ text: err });
       });
     },

+ 1 - 1
src/options/views/edit/values.vue

@@ -101,7 +101,7 @@ export default {
     },
     refresh() {
       sendMessage({ cmd: 'GetValueStore', data: this.script.props.id })
-      .then(values => {
+      .then((values) => {
         this.values = values;
         this.keys = Object.keys(values).sort();
         this.page = 1;

+ 1 - 1
src/options/views/feature.vue

@@ -12,7 +12,7 @@ import { store } from '../utils';
 
 const FEATURES_KEY = 'features';
 store.features = options.get(FEATURES_KEY);
-options.hook(data => {
+options.hook((data) => {
   const features = data[FEATURES_KEY];
   if (features) {
     Vue.set(store, 'features', features);

+ 1 - 1
src/options/views/message.vue

@@ -20,7 +20,7 @@
 <script>
 const dismissers = [];
 
-window.addEventListener('keydown', e => {
+window.addEventListener('keydown', (e) => {
   if (e.keyCode === 27 && dismissers.length) {
     e.stopImmediatePropagation();
     dismissers.pop()();

+ 4 - 4
src/options/views/script-item.vue

@@ -172,7 +172,7 @@ export default {
           ['d', 1000, 365],
           ['y'],
         ];
-        const unitInfo = units.find(item => {
+        const unitInfo = units.find((item) => {
           const max = item[1];
           if (!max || delta < max) return true;
           const step = item[2] || max;
@@ -192,7 +192,7 @@ export default {
       const pathMap = objectGet(this.script, 'custom.pathMap') || {};
       const fullUrl = pathMap[icon] || icon;
       loadImage(fullUrl)
-      .then(url => {
+      .then((url) => {
         this.safeIcon = url;
       }, () => {
         this.safeIcon = DEFAULT_ICON;
@@ -265,7 +265,7 @@ export default {
       } = dragging;
       dragged.style.left = `${e.clientX - offset.x}px`;
       dragged.style.top = `${e.clientY - offset.y}px`;
-      let hoveredIndex = elements.findIndex(item => {
+      let hoveredIndex = elements.findIndex((item) => {
         if (!item || item.classList.contains('dragging-moving')) return false;
         const rect = item.getBoundingClientRect();
         return (
@@ -307,7 +307,7 @@ export default {
       });
     },
     onDragAnimate(elements, delta) {
-      elements.forEach(el => {
+      elements.forEach((el) => {
         if (!el) return;
         el.classList.add('dragging-moving');
         el.style.transition = 'none';

+ 4 - 4
src/options/views/tab-installed.vue

@@ -115,7 +115,7 @@ const filters = {
     },
   },
 };
-hookSetting('filters.sort', value => {
+hookSetting('filters.sort', (value) => {
   filters.sort.set(value);
 });
 options.ready(() => {
@@ -176,7 +176,7 @@ export default {
         : scripts.slice();
       if (sort.value === SORT_ALPHA.value) {
         const showEnabledFirst = options.get('filters.showEnabledFirst');
-        const getSortKey = item => {
+        const getSortKey = (item) => {
           const keys = [];
           if (showEnabledFirst) {
             keys.push(item.config.enabled ? 0 : 1);
@@ -221,10 +221,10 @@ export default {
           ],
         });
       })
-      .then(url => {
+      .then((url) => {
         if (url && url.includes('://')) return sendMessage({ cmd: 'ConfirmInstall', data: { url } });
       }, noop)
-      .catch(err => {
+      .catch((err) => {
         if (err) showMessage({ text: err });
       });
     },

+ 3 - 3
src/options/views/tab-settings/index.vue

@@ -140,10 +140,10 @@ export default {
   created() {
     this.revokers = [];
     options.ready(() => {
-      items.forEach(item => {
+      items.forEach((item) => {
         const { name, key, normalize } = item;
         settings[name] = normalize(options.get(key || name));
-        this.revokers.push(hookSetting(key, value => {
+        this.revokers.push(hookSetting(key, (value) => {
           settings[name] = value;
         }));
         this.$watch(name, debounce(this.getUpdater(item), 300));
@@ -151,7 +151,7 @@ export default {
     });
   },
   beforeDestroy() {
-    this.revokers.forEach(revoke => { revoke(); });
+    this.revokers.forEach((revoke) => { revoke(); });
   },
 };
 </script>

+ 7 - 7
src/options/views/tab-settings/vm-export.vue

@@ -55,7 +55,7 @@ export default {
       this.exporting = true;
       Promise.resolve(exportData())
       .then(download)
-      .catch(err => {
+      .catch((err) => {
         console.error(err);
       })
       .then(() => {
@@ -69,15 +69,15 @@ export default {
 };
 
 function getWriter() {
-  return new Promise(resolve => {
-    zip.createWriter(new zip.BlobWriter(), writer => {
+  return new Promise((resolve) => {
+    zip.createWriter(new zip.BlobWriter(), (writer) => {
       resolve(writer);
     });
   });
 }
 
 function addFile(writer, file) {
-  return new Promise(resolve => {
+  return new Promise((resolve) => {
     writer.add(file.name, new zip.TextReader(file.content), () => {
       resolve(writer);
     });
@@ -140,7 +140,7 @@ function exportData() {
       values: withValues,
     },
   })
-  .then(data => {
+  .then((data) => {
     const names = {};
     const vm = {
       scripts: {},
@@ -180,8 +180,8 @@ function exportData() {
   .then(files => files.reduce((result, file) => (
     result.then(writer => addFile(writer, file))
   ), getWriter()))
-  .then(writer => new Promise(resolve => {
-    writer.close(blob => {
+  .then(writer => new Promise((resolve) => {
+    writer.close((blob) => {
       resolve(blob);
     });
   }));

+ 10 - 10
src/options/views/tab-settings/vm-import.vue

@@ -57,7 +57,7 @@ export default {
 
 function forEachItem(obj, cb) {
   if (obj) {
-    Object.keys(obj).forEach(key => {
+    Object.keys(obj).forEach((key) => {
       cb(obj[key], key);
     });
   }
@@ -76,9 +76,9 @@ function getVMConfig(text) {
 function getVMFile(entry, vmFile) {
   if (!entry.filename.endsWith('.user.js')) return;
   const vm = vmFile || {};
-  return new Promise(resolve => {
+  return new Promise((resolve) => {
     const writer = new zip.TextWriter();
-    entry.getData(writer, text => {
+    entry.getData(writer, (text) => {
       const data = { code: text };
       if (vm.scripts) {
         const more = vm.scripts[entry.filename.slice(0, -8)];
@@ -101,7 +101,7 @@ function getVMFile(entry, vmFile) {
 }
 
 function getVMFiles(entries) {
-  return new Promise(resolve => {
+  return new Promise((resolve) => {
     const data = { entries };
     const i = entries.findIndex(entry => entry.filename && entry.filename.toLowerCase() === 'violentmonkey');
     if (i < 0) {
@@ -109,7 +109,7 @@ function getVMFiles(entries) {
       return resolve(data);
     }
     const writer = new zip.TextWriter();
-    entries[i].getData(writer, text => {
+    entries[i].getData(writer, (text) => {
       entries.splice(i, 1);
       data.vm = getVMConfig(text);
       resolve(data);
@@ -119,18 +119,18 @@ function getVMFiles(entries) {
 
 function readZip(file) {
   return new Promise((resolve, reject) => {
-    zip.createReader(new zip.BlobReader(file), res => {
-      res.getEntries(entries => {
+    zip.createReader(new zip.BlobReader(file), (res) => {
+      res.getEntries((entries) => {
         resolve(entries);
       });
-    }, err => { reject(err); });
+    }, (err) => { reject(err); });
   });
 }
 
 function importData(file) {
   readZip(file)
   .then(getVMFiles)
-  .then(data => {
+  .then((data) => {
     const { vm, entries } = data;
     if (options.get('importSettings')) {
       const ignoreKeys = ['sync'];
@@ -141,7 +141,7 @@ function importData(file) {
     }
     return Promise.all(entries.map(entry => getVMFile(entry, vm)))
     .then(res => res.filter(Boolean).length)
-    .then(count => {
+    .then((count) => {
       forEachItem(vm.values, (valueStore, key) => {
         if (valueStore) {
           sendMessage({

+ 1 - 1
src/options/views/tab-settings/vm-sync.vue

@@ -82,7 +82,7 @@ const SYNC_CURRENT = 'sync.current';
 const syncConfig = {
   current: '',
 };
-hookSetting(SYNC_CURRENT, value => {
+hookSetting(SYNC_CURRENT, (value) => {
   syncConfig.current = value || '';
 });
 

+ 2 - 2
src/popup/index.js

@@ -25,14 +25,14 @@ Object.assign(handlers, {
       cmd: 'GetMetas',
       data: data.ids,
     })
-    .then(scripts => {
+    .then((scripts) => {
       store.scripts = scripts;
     });
   },
 });
 
 browser.tabs.query({ currentWindow: true, active: true })
-.then(tabs => {
+.then((tabs) => {
   const currentTab = {
     id: tabs[0].id,
     url: tabs[0].url,

+ 3 - 3
src/popup/views/app.vue

@@ -107,7 +107,7 @@ import { store } from '../utils';
 const optionsData = {
   isApplied: options.get('isApplied'),
 };
-options.hook(changes => {
+options.hook((changes) => {
   if ('isApplied' in changes) {
     optionsData.isApplied = changes.isApplied;
   }
@@ -128,7 +128,7 @@ export default {
   },
   computed: {
     commands() {
-      return this.store.commands.map(item => {
+      return this.store.commands.map((item) => {
         const [key, name] = item;
         return {
           name,
@@ -209,7 +209,7 @@ export default {
           },
         })
       ) : Promise.resolve())
-      .then(id => {
+      .then((id) => {
         const path = ['scripts', '_new', id].filter(Boolean).join('/');
         browser.tabs.create({
           url: browser.runtime.getURL(`/options/index.html#${path}`),

+ 2 - 2
test/background/script.test.js

@@ -1,7 +1,7 @@
 import test from 'tape';
 import { compareVersion, parseMeta } from '#/background/utils/script';
 
-test('compareVersion', t => {
+test('compareVersion', (t) => {
   t.equal(compareVersion('1.2.3', '1.2.3'), 0);
   t.equal(compareVersion('1.2.3', '1.2.0'), 1);
   t.equal(compareVersion('1.2.3', '1.2.4'), -1);
@@ -23,7 +23,7 @@ const baseMeta = {
   noframes: false,
 };
 
-test('parseMeta', t => {
+test('parseMeta', (t) => {
   t.deepEqual(parseMeta(`\
 // ==UserScript==
 // @name New Script

+ 29 - 29
test/background/tester.test.js

@@ -16,8 +16,8 @@ function buildScript(props) {
   }, props);
 }
 
-test('scheme', t => {
-  t.test('should match all', q => {
+test('scheme', (t) => {
+  t.test('should match all', (q) => {
     {
       const script = buildScript({
         meta: {
@@ -45,7 +45,7 @@ test('scheme', t => {
     q.end();
   });
 
-  t.test('should match exact', q => {
+  t.test('should match exact', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -65,8 +65,8 @@ test('scheme', t => {
   t.end();
 });
 
-test('host', t => {
-  t.test('should match domain', q => {
+test('host', (t) => {
+  t.test('should match domain', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -80,7 +80,7 @@ test('host', t => {
     q.end();
   });
 
-  t.test('should match wildcard', q => {
+  t.test('should match wildcard', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -99,7 +99,7 @@ test('host', t => {
     q.end();
   });
 
-  t.test('should match tld', q => {
+  t.test('should match tld', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -117,8 +117,8 @@ test('host', t => {
   t.end();
 });
 
-test('path', t => {
-  t.test('should match any', q => {
+test('path', (t) => {
+  t.test('should match any', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -131,7 +131,7 @@ test('path', t => {
     q.end();
   });
 
-  t.test('should match exact', q => {
+  t.test('should match exact', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -144,7 +144,7 @@ test('path', t => {
     q.end();
   });
 
-  t.test('should ignore query string and hash', q => {
+  t.test('should ignore query string and hash', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -159,7 +159,7 @@ test('path', t => {
     q.end();
   });
 
-  t.test('should match query string and hash if existed in rules', q => {
+  t.test('should match query string and hash if existed in rules', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -182,8 +182,8 @@ test('path', t => {
   t.end();
 });
 
-test('include', t => {
-  t.test('should include any', q => {
+test('include', (t) => {
+  t.test('should include any', (q) => {
     const script = buildScript({
       meta: {
         include: [
@@ -196,7 +196,7 @@ test('include', t => {
     q.end();
   });
 
-  t.test('should include by regexp', q => {
+  t.test('should include by regexp', (q) => {
     const script = buildScript({
       meta: {
         include: [
@@ -211,7 +211,7 @@ test('include', t => {
     q.end();
   });
 
-  t.test('should support magic TLD', q => {
+  t.test('should support magic TLD', (q) => {
     const script = buildScript({
       meta: {
         include: [
@@ -226,8 +226,8 @@ test('include', t => {
   });
 });
 
-test('exclude', t => {
-  t.test('should exclude any', q => {
+test('exclude', (t) => {
+  t.test('should exclude any', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -242,7 +242,7 @@ test('exclude', t => {
     q.end();
   });
 
-  t.test('should include by regexp', q => {
+  t.test('should include by regexp', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -260,7 +260,7 @@ test('exclude', t => {
     q.end();
   });
 
-  t.test('should support magic TLD', q => {
+  t.test('should support magic TLD', (q) => {
     const script = buildScript({
       meta: {
         exclude: [
@@ -275,8 +275,8 @@ test('exclude', t => {
   });
 });
 
-test('exclude-match', t => {
-  t.test('should exclude any', q => {
+test('exclude-match', (t) => {
+  t.test('should exclude any', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -291,7 +291,7 @@ test('exclude-match', t => {
     q.end();
   });
 
-  t.test('should include by regexp', q => {
+  t.test('should include by regexp', (q) => {
     const script = buildScript({
       meta: {
         match: [
@@ -310,8 +310,8 @@ test('exclude-match', t => {
   });
 });
 
-test('custom', t => {
-  t.test('should ignore original rules', q => {
+test('custom', (t) => {
+  t.test('should ignore original rules', (q) => {
     const script = buildScript({
       custom: {
         match: [
@@ -330,8 +330,8 @@ test('custom', t => {
   });
 });
 
-test('blacklist', t => {
-  t.test('should exclude match rules', q => {
+test('blacklist', (t) => {
+  t.test('should exclude match rules', (q) => {
     resetBlacklist(`\
 # match rules
 *://www.google.com/*
@@ -342,7 +342,7 @@ test('blacklist', t => {
     q.end();
   });
 
-  t.test('should exclude domains', q => {
+  t.test('should exclude domains', (q) => {
     resetBlacklist(`\
 # domains
 www.google.com
@@ -353,7 +353,7 @@ www.google.com
     q.end();
   });
 
-  t.test('should support @exclude rules', q => {
+  t.test('should support @exclude rules', (q) => {
     resetBlacklist(`\
 # @exclude rules
 @exclude https://www.google.com/*

+ 1 - 1
test/common/index.test.js

@@ -1,7 +1,7 @@
 import test from 'tape';
 import { isRemote } from '#/common';
 
-test('isRemote', t => {
+test('isRemote', (t) => {
   t.notOk(isRemote());
   t.notOk(isRemote('file:///tmp/file'));
   t.notOk(isRemote('data:text/plain,hello,world'));

+ 1 - 1
test/injected/helpers.test.js

@@ -1,7 +1,7 @@
 import test from 'tape';
 import { jsonDump } from '#/injected/utils/helpers';
 
-test('jsonDump', t => {
+test('jsonDump', (t) => {
   // eslint-disable-next-line no-restricted-syntax
   for (const obj of [
     1,

文件差异内容过多而无法显示
+ 339 - 269
yarn.lock


部分文件因为文件数量过多而无法显示