From 9ceb1aa8ee32d9ca52a50761dc8bd5ed4dbcd49e Mon Sep 17 00:00:00 2001 From: Cyberhan123 Date: Thu, 11 Mar 2021 14:58:26 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat(svg-icon):=20=E5=A2=9E=E5=8A=A0svg-i?= =?UTF-8?q?con?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/CHANGELOG.md | 5 ++ packages/plugin-svg-icon/README.md | 63 +++++++++++++++++++ packages/plugin-svg-icon/package.json | 35 +++++++++++ .../src/fixtures/normal/.umirc.ts | 11 ++++ .../src/fixtures/normal/index.tsx | 9 +++ packages/plugin-svg-icon/src/index.test.ts | 17 +++++ packages/plugin-svg-icon/src/index.ts | 36 +++++++++++ packages/plugin-svg-icon/svgo-config.json | 40 ++++++++++++ 8 files changed, 216 insertions(+) create mode 100644 packages/plugin-svg-icon/CHANGELOG.md create mode 100644 packages/plugin-svg-icon/README.md create mode 100644 packages/plugin-svg-icon/package.json create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/.umirc.ts create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/index.tsx create mode 100644 packages/plugin-svg-icon/src/index.test.ts create mode 100644 packages/plugin-svg-icon/src/index.ts create mode 100644 packages/plugin-svg-icon/svgo-config.json diff --git a/packages/plugin-svg-icon/CHANGELOG.md b/packages/plugin-svg-icon/CHANGELOG.md new file mode 100644 index 000000000..109cfd987 --- /dev/null +++ b/packages/plugin-svg-icon/CHANGELOG.md @@ -0,0 +1,5 @@ +# 1.0.0 (2021-03-09) + +### Features + +- add plugin-svg-icon diff --git a/packages/plugin-svg-icon/README.md b/packages/plugin-svg-icon/README.md new file mode 100644 index 000000000..7608c244f --- /dev/null +++ b/packages/plugin-svg-icon/README.md @@ -0,0 +1,63 @@ +# @umijs/plugin-svg-icon + +> @umijs/plugin-svg-icon. + +See our website [@umijs/plugin-sass](https://umijs.org/plugins/plugin-svg-icon) for more information. + +## 安装 + +使用 npm: + +```bash +$ npm install --save-dev @umijs/plugin-svg-icon +``` + +使用 yarn: + +```bash +$ yarn add @umijs/plugin-svg-icon --dev +``` + +## 功能 + +自动配置 svg-loader 和 svg 雪碧图 + +## 使用方法 + +在.umirc 配置文件中配置开启插件 + +```js + svgIcon: {}, +``` + +实际使用: + +```jsx +const requireAll = (requireContext) => { + requireContext.keys().map(requireContext); +}; +const req = require.context('./assets/svgs', false, /\.svg$/); +requireAll(req); + +export const Icon = forwardRef((props, ref) => { + const { type, className, ...htmlProps } = props; + const iconName = `#icon-${type}`; + const iconClassName = classNames( + 'svg-icon', + `svg-icon-${props.type}`, + className, + ); + const icon = ( + + + + ); + return icon; +}); +``` + +## TODO + +将示例的 jsx 代码整合到插件内部 diff --git a/packages/plugin-svg-icon/package.json b/packages/plugin-svg-icon/package.json new file mode 100644 index 000000000..1b54cc298 --- /dev/null +++ b/packages/plugin-svg-icon/package.json @@ -0,0 +1,35 @@ +{ + "name": "@umijs/plugin-svg-icon", + "version": "1.0.0", + "description": "@umijs/plugin-svg-icon", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "repository": { + "type": "git", + "url": "https://github.com/umijs/plugins" + }, + "keywords": [ + "umi" + ], + "authors": [ + "Cyberhan123 <255542417@qq.com> (https://github.com/Cyberhan123)" + ], + "license": "MIT", + "bugs": "http://github.com/umijs/plugins/issues", + "homepage": "https://github.com/umijs/plugins/tree/master/packages/plugin-svg-icon#readme", + "peerDependencies": { + "umi": "3.x" + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "svg-sprite-loader": "^5.2.1", + "svgo": "^1.3.2", + "svgo-loader": "^2.2.0" + } +} diff --git a/packages/plugin-svg-icon/src/fixtures/normal/.umirc.ts b/packages/plugin-svg-icon/src/fixtures/normal/.umirc.ts new file mode 100644 index 000000000..dc566c616 --- /dev/null +++ b/packages/plugin-svg-icon/src/fixtures/normal/.umirc.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'umi'; + +export default defineConfig({ + history: 'memory', + mountElementId: '', + routes: [{ path: '/', component: './index' }], + svgIcon: {}, + plugins: [ + require.resolve('../../'), + ] +}); diff --git a/packages/plugin-svg-icon/src/fixtures/normal/index.tsx b/packages/plugin-svg-icon/src/fixtures/normal/index.tsx new file mode 100644 index 000000000..be32c82b9 --- /dev/null +++ b/packages/plugin-svg-icon/src/fixtures/normal/index.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +const App = (props: any) => { + return ( +
+ Hello World +
+ ); +}; diff --git a/packages/plugin-svg-icon/src/index.test.ts b/packages/plugin-svg-icon/src/index.test.ts new file mode 100644 index 000000000..1952f4e88 --- /dev/null +++ b/packages/plugin-svg-icon/src/index.test.ts @@ -0,0 +1,17 @@ +import { join } from 'path'; +import { Service } from 'umi'; +import { render } from '@testing-library/react'; + +const fixtures = join(__dirname, './fixtures'); + +test('normal', async () => { + const cwd = join(fixtures, 'normal'); + const service = new Service({ + cwd, + plugins: [require.resolve('./')], + }); + + const reactNode = require(join(cwd, '.umi-test', 'umi.ts')).default; + const { container } = render(reactNode); + expect(container.textContent).toEqual('Hello World'); +}); diff --git a/packages/plugin-svg-icon/src/index.ts b/packages/plugin-svg-icon/src/index.ts new file mode 100644 index 000000000..f2291d770 --- /dev/null +++ b/packages/plugin-svg-icon/src/index.ts @@ -0,0 +1,36 @@ +import { IApi } from 'umi'; +import { join } from 'path'; + +export default (api: IApi) => { + api.describe({ + config: { + schema(Joi) { + return Joi.object({ + svgoConfig: Joi.any(), + }); + }, + }, + }); + const srcDir = api.paths.absSrcPath; + const svgsDir = join(srcDir!, 'assets/svgs'); + const svgoConfigFile = api.utils.winPath(join(srcDir!, 'svgo-config.json')); + api.chainWebpack((config) => { + // 默认的svg的模块规则中不去匹配src/assets/svgs,避免此文件中的内容使用默认的url-loader的加载形式 + config.module.rule('svg').exclude.add(svgsDir).end(); + config.module + .rule('svg-sprite-svgo-loader') + .test(/\.svg$/) + .include.add(svgsDir) //处理svg目录 + .end() + .use('svg-sprite-loader') + .loader('svg-sprite-loader') + .options({ + symbolId: 'icon-[name]', + }) + .end() + .use('svgo-loader') + .loader('svgo-loader') + .options(api.config.svgIcon.svgoConfig || svgoConfigFile); + return config; + }); +}; diff --git a/packages/plugin-svg-icon/svgo-config.json b/packages/plugin-svg-icon/svgo-config.json new file mode 100644 index 000000000..7a42d37a9 --- /dev/null +++ b/packages/plugin-svg-icon/svgo-config.json @@ -0,0 +1,40 @@ +{ + "plugins": [ + { "cleanupAttrs": true }, + { "cleanupEnableBackground": true }, + { "cleanupIDs": true }, + { "cleanupListOfValues": true }, + { "cleanupNumericValues": true }, + { "collapseGroups": true }, + { "convertColors": true }, + { "convertPathData": true }, + { "convertShapeToPath": true }, + { "convertStyleToAttrs": true }, + { "convertTransform": true }, + { "mergePaths": true }, + { "removeComments": true }, + { "removeDesc": true }, + { "removeDimensions": true }, + { "removeDoctype": true }, + { "removeEditorsNSData": true }, + { "removeEmptyAttrs": true }, + { "removeEmptyContainers": true }, + { "removeEmptyText": true }, + { "removeHiddenElems": true }, + { "removeMetadata": true }, + { "removeNonInheritableGroupAttrs": true }, + { "removeRasterImages": true }, + { "removeTitle": true }, + { "removeUnknownsAndDefaults": true }, + { "removeUselessDefs": true }, + { "removeUnusedNS": true }, + { "removeUselessStrokeAndFill": true }, + { + "removeAttrs": { "attrs": "fill" } + }, + { "removeXMLProcInst": true }, + { "removeStyleElement": true }, + { "removeUnknownsAndDefaults": true }, + { "sortAttrs": true } + ] +} From 6e2e61668f1eb7df9dba9afff131646a5a914e90 Mon Sep 17 00:00:00 2001 From: Cyberhan123 Date: Thu, 11 Mar 2021 15:02:04 +0800 Subject: [PATCH 02/11] =?UTF-8?q?feat(svg-icon):=20=E5=A2=9E=E5=8A=A0svgo?= =?UTF-8?q?=20=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=E7=9A=84=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/plugin-svg-icon/src/index.ts b/packages/plugin-svg-icon/src/index.ts index f2291d770..14d643a3e 100644 --- a/packages/plugin-svg-icon/src/index.ts +++ b/packages/plugin-svg-icon/src/index.ts @@ -14,6 +14,7 @@ export default (api: IApi) => { const srcDir = api.paths.absSrcPath; const svgsDir = join(srcDir!, 'assets/svgs'); const svgoConfigFile = api.utils.winPath(join(srcDir!, 'svgo-config.json')); + const svgoDefaultIcon = join(api.cwd!, '../svgo-config.json'); api.chainWebpack((config) => { // 默认的svg的模块规则中不去匹配src/assets/svgs,避免此文件中的内容使用默认的url-loader的加载形式 config.module.rule('svg').exclude.add(svgsDir).end(); @@ -30,7 +31,9 @@ export default (api: IApi) => { .end() .use('svgo-loader') .loader('svgo-loader') - .options(api.config.svgIcon.svgoConfig || svgoConfigFile); + .options( + api.config.svgIcon.svgoConfig || svgoConfigFile || svgoDefaultIcon, + ); return config; }); }; From 8198146209b5754e4c682345ee661b88559e16c8 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 11 Mar 2021 15:07:29 +0800 Subject: [PATCH 03/11] =?UTF-8?q?feat(svg-icon):=20=E5=A2=9E=E5=8A=A0readm?= =?UTF-8?q?e,=E4=BD=BF=E7=94=A8=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugin-svg-icon/README.md b/packages/plugin-svg-icon/README.md index 7608c244f..ea2aa61d3 100644 --- a/packages/plugin-svg-icon/README.md +++ b/packages/plugin-svg-icon/README.md @@ -20,16 +20,19 @@ $ yarn add @umijs/plugin-svg-icon --dev ## 功能 -自动配置 svg-loader 和 svg 雪碧图 +自动配置 svgo 并将 svg 打包为 svg 雪碧图 ## 使用方法 在.umirc 配置文件中配置开启插件 ```js - svgIcon: {}, +svgIcon: { +} ``` +如果想要自己配置 svgo 配置,可以在.umirc 配置文件同级下增加 svgo-config.json + 实际使用: ```jsx From 32390268b243e498fa718c219d702ce9e9cc33df Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 11 Mar 2021 15:33:06 +0800 Subject: [PATCH 04/11] =?UTF-8?q?feat(svg-icon):=20=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=AD=A4=E6=B5=8B=E8=AF=95=E5=B9=B6=E6=B2=A1=E6=9C=89=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E6=84=8F=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/src/index.test.ts | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 packages/plugin-svg-icon/src/index.test.ts diff --git a/packages/plugin-svg-icon/src/index.test.ts b/packages/plugin-svg-icon/src/index.test.ts deleted file mode 100644 index 1952f4e88..000000000 --- a/packages/plugin-svg-icon/src/index.test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { join } from 'path'; -import { Service } from 'umi'; -import { render } from '@testing-library/react'; - -const fixtures = join(__dirname, './fixtures'); - -test('normal', async () => { - const cwd = join(fixtures, 'normal'); - const service = new Service({ - cwd, - plugins: [require.resolve('./')], - }); - - const reactNode = require(join(cwd, '.umi-test', 'umi.ts')).default; - const { container } = render(reactNode); - expect(container.textContent).toEqual('Hello World'); -}); From 568b8728ed3d7e5e4e24ff88df708523d5541457 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 11 Mar 2021 17:20:40 +0800 Subject: [PATCH 05/11] =?UTF-8?q?feat(svg-icon):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=A2=9E=E5=8A=A0readme=E5=AE=B9?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/README.md | 10 ++---- .../src/fixtures/normal/.umirc.ts | 14 +++------ .../fixtures/normal/assets/svgs/alipay.svg | 12 +++++++ .../src/fixtures/normal/assets/svgs/love.svg | 15 +++++++++ .../fixtures/normal/assets/svgs/wechat.svg | 15 +++++++++ .../src/fixtures/normal/index.tsx | 9 ------ .../src/fixtures/normal/pages/index.tsx | 31 +++++++++++++++++++ packages/plugin-svg-icon/src/index.test.ts | 16 ++++++++++ 8 files changed, 97 insertions(+), 25 deletions(-) create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/assets/svgs/alipay.svg create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/assets/svgs/love.svg create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/assets/svgs/wechat.svg delete mode 100644 packages/plugin-svg-icon/src/fixtures/normal/index.tsx create mode 100644 packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx create mode 100644 packages/plugin-svg-icon/src/index.test.ts diff --git a/packages/plugin-svg-icon/README.md b/packages/plugin-svg-icon/README.md index ea2aa61d3..655ee5032 100644 --- a/packages/plugin-svg-icon/README.md +++ b/packages/plugin-svg-icon/README.md @@ -24,12 +24,7 @@ $ yarn add @umijs/plugin-svg-icon --dev ## 使用方法 -在.umirc 配置文件中配置开启插件 - -```js -svgIcon: { -} -``` +安装即可开启 如果想要自己配置 svgo 配置,可以在.umirc 配置文件同级下增加 svgo-config.json @@ -43,13 +38,14 @@ const req = require.context('./assets/svgs', false, /\.svg$/); requireAll(req); export const Icon = forwardRef((props, ref) => { - const { type, className, ...htmlProps } = props; + const { type, className, link, ...htmlProps } = props; const iconName = `#icon-${type}`; const iconClassName = classNames( 'svg-icon', `svg-icon-${props.type}`, className, ); + const Parent = link ? 'a' : 'i'; const icon = (
- Hello World -
- ); -}; diff --git a/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx b/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx new file mode 100644 index 000000000..8f5463d52 --- /dev/null +++ b/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx @@ -0,0 +1,31 @@ +import React, { forwardRef } from 'react'; +//eslint-disable +// @ts-ignore +// const requireAll = (requireContext) => { +// // @ts-ignore +// requireContext.keys().map(requireContext); +// }; +// // @ts-ignore +// const req = require.context('./assets/svgs', false, /\.svg$/); +// requireAll(req); +import '../assets/svgs/love.svg'; +import '../assets/svgs/alipay.svg' + +const Icon = forwardRef((props: any, ref) => { + const { type, className, link, ...htmlProps } = props; + const iconName = `#icon-${type}`; + const Parent = link ? 'a' : 'i'; + return ( + + + + ); +}); +const App = () => { + return ( + + ); +}; +export default App; diff --git a/packages/plugin-svg-icon/src/index.test.ts b/packages/plugin-svg-icon/src/index.test.ts new file mode 100644 index 000000000..1926aac5f --- /dev/null +++ b/packages/plugin-svg-icon/src/index.test.ts @@ -0,0 +1,16 @@ +import { join } from 'path'; +import { generateTmp, render } from '@umijs/test-utils'; +import { cleanup } from '@testing-library/react'; + +const fixtures = join(__dirname, 'fixtures'); + +afterEach(cleanup); + +test('normal', async () => { + const cwd = join(fixtures, 'normal'); + await generateTmp({ cwd }); + const { container } = render({ cwd }); + expect(container.innerHTML).toEqual( + '', + ); +}); From fc84b45adf6a93406d0bd2ba7acd0680abe8d09e Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Tue, 16 Mar 2021 10:13:13 +0800 Subject: [PATCH 06/11] =?UTF-8?q?feat(svg-icon):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=8E=B7=E5=8F=96svgo?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/src/index.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/plugin-svg-icon/src/index.ts b/packages/plugin-svg-icon/src/index.ts index 14d643a3e..f82fa0b4e 100644 --- a/packages/plugin-svg-icon/src/index.ts +++ b/packages/plugin-svg-icon/src/index.ts @@ -6,15 +6,29 @@ export default (api: IApi) => { config: { schema(Joi) { return Joi.object({ - svgoConfig: Joi.any(), + // svgoConfig: Joi.string(), }); }, }, }); const srcDir = api.paths.absSrcPath; const svgsDir = join(srcDir!, 'assets/svgs'); - const svgoConfigFile = api.utils.winPath(join(srcDir!, 'svgo-config.json')); - const svgoDefaultIcon = join(api.cwd!, '../svgo-config.json'); + let svgoConfigDirFile = null; + const svgoConfigDirFilePath = api.utils.winPath( + join(srcDir!, '../svgo-config.json'), + ); + try { + svgoConfigDirFile = require.resolve(svgoConfigDirFilePath); + } catch (e) { + console.log( + api.utils.chalk.yellow( + `[svg-icon]svgo-config.json doesn't find at ${svgoConfigDirFilePath}, svg-icon auto use default config`, + ), + ); + } + const svgoConfigDefaultFile = require.resolve('./svgo-config.json'); + const svgoConfigFile = svgoConfigDirFile ?? svgoConfigDefaultFile; + const svgoConfig = require(svgoConfigFile); api.chainWebpack((config) => { // 默认的svg的模块规则中不去匹配src/assets/svgs,避免此文件中的内容使用默认的url-loader的加载形式 config.module.rule('svg').exclude.add(svgsDir).end(); @@ -31,9 +45,7 @@ export default (api: IApi) => { .end() .use('svgo-loader') .loader('svgo-loader') - .options( - api.config.svgIcon.svgoConfig || svgoConfigFile || svgoDefaultIcon, - ); + .options(svgoConfig); return config; }); }; From d959239061f09507a0554ef3a72d4aa591a0a2b8 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 25 Mar 2021 11:40:20 +0800 Subject: [PATCH 07/11] =?UTF-8?q?fix(svg-icon):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=B5=8B=E8=AF=95=E9=A2=84=E6=9C=9F=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=A0=E4=B8=BA=E8=BF=81=E7=A7=BB=E9=80=A0?= =?UTF-8?q?=E6=88=90=E7=9A=84=E6=8F=92=E4=BB=B6=E5=BC=95=E7=94=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/src/index.ts | 6 +- yarn.lock | 196 ++++++++++++++++++++++++-- 2 files changed, 187 insertions(+), 15 deletions(-) diff --git a/packages/plugin-svg-icon/src/index.ts b/packages/plugin-svg-icon/src/index.ts index f82fa0b4e..ae095425d 100644 --- a/packages/plugin-svg-icon/src/index.ts +++ b/packages/plugin-svg-icon/src/index.ts @@ -14,9 +14,12 @@ export default (api: IApi) => { const srcDir = api.paths.absSrcPath; const svgsDir = join(srcDir!, 'assets/svgs'); let svgoConfigDirFile = null; + //项目根目录位置 const svgoConfigDirFilePath = api.utils.winPath( join(srcDir!, '../svgo-config.json'), ); + //插件根目录位置 + const svgoConfigDefaultFilePath = api.utils.winPath('../svgo-config.json'); try { svgoConfigDirFile = require.resolve(svgoConfigDirFilePath); } catch (e) { @@ -26,8 +29,9 @@ export default (api: IApi) => { ), ); } - const svgoConfigDefaultFile = require.resolve('./svgo-config.json'); + const svgoConfigDefaultFile = require.resolve(svgoConfigDefaultFilePath); const svgoConfigFile = svgoConfigDirFile ?? svgoConfigDefaultFile; + const svgoConfig = require(svgoConfigFile); api.chainWebpack((config) => { // 默认的svg的模块规则中不去匹配src/assets/svgs,避免此文件中的内容使用默认的url-loader的加载形式 diff --git a/yarn.lock b/yarn.lock index 828268d04..e741609cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7016,7 +7016,7 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" -bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: +bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -7074,7 +7074,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^2.3.1, braces@^2.3.2: +braces@^2.2.2, braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== @@ -8995,6 +8995,11 @@ deep-is@^0.1.3, deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= +deepmerge@1.3.2: + version "1.3.2" + resolved "http://mirrors.tencent.com/npm/deepmerge/-/deepmerge-1.3.2.tgz#1663691629d4dbfe364fa12a2a4f0aa86aa3a050" + integrity sha1-FmNpFinU2/42T6EqKk8KqGqjoFA= + deepmerge@4.2.2, deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" @@ -9257,6 +9262,11 @@ dompurify@^2.2.6: resolved "https://registry.npm.taobao.org/dompurify/download/dompurify-2.2.6.tgz#54945dc5c0b45ce5ae228705777e8e59d7b2edc4" integrity sha1-VJRdxcC0XOWuIocFd36OWdey7cQ= +domready@1.0.8: + version "1.0.8" + resolved "http://mirrors.tencent.com/npm/domready/-/domready-1.0.8.tgz#91f252e597b65af77e745ae24dd0185d5e26d58c" + integrity sha1-kfJS5Ze2Wvd+dFriTdAYXV4m1Yw= + domutils@1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" @@ -9679,7 +9689,7 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -10462,7 +10472,7 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extglob@^2.0.4: +extglob@^2.0.2, extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== @@ -11685,6 +11695,11 @@ hastscript@^6.0.0: property-information "^5.0.0" space-separated-tokens "^1.0.0" +he@^1.1.1: + version "1.2.0" + resolved "http://mirrors.tencent.com/npm/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + hex-color-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" @@ -11805,7 +11820,7 @@ html-tags@^3.0.0, html-tags@^3.1.0: resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.1.0.tgz#7b5e6f7e665e9fb41f30007ed9e0d41e97fb2140" integrity sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg== -htmlparser2@^3.10.0, htmlparser2@^3.9.1: +htmlparser2@^3.10.0, htmlparser2@^3.8.3, htmlparser2@^3.9.1: version "3.10.1" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== @@ -12002,7 +12017,7 @@ ignore@^5.0.4, ignore@^5.0.5, ignore@^5.0.6, ignore@^5.1.1, ignore@^5.1.4, ignor resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -image-size@~0.5.0: +image-size@^0.5.1, image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w= @@ -12608,7 +12623,7 @@ is-plain-obj@2.1.0, is-plain-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: +is-plain-obj@^1.0.0, is-plain-obj@^1.1, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= @@ -12798,7 +12813,7 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -isobject@^2.0.0: +isobject@^2.0.0, isobject@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= @@ -13374,6 +13389,11 @@ joi2types@~1.0.7: "@types/json-schema" "^7.0.4" json-schema-to-typescript "^8.2.0" +js-base64@^2.1.9: + version "2.6.4" + resolved "http://mirrors.tencent.com/npm/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" + integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== + js-file-download@^0.4.12: version "0.4.12" resolved "https://registry.npm.taobao.org/js-file-download/download/js-file-download-0.4.12.tgz#10c70ef362559a5b23cdbdc3bd6f399c3d91d821" @@ -13670,7 +13690,7 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" -kind-of@^5.0.0: +kind-of@^5.0.0, kind-of@^5.0.2: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== @@ -13975,7 +13995,7 @@ loader-runner@^3.1.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-3.1.0.tgz#e9440e5875f2ad2f968489cd2c7b59a4f2847fcb" integrity sha512-wE/bOCdTKMR2rm7Xxh+eirDOmN7Vx7hntWgiTayuFPtF8MgsFDo49SP8kkYz8IVlEBTOtR7P+XI7bE1xjo/IkA== -loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: +loader-utils@^1.0.2, loader-utils@^1.0.3, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA== @@ -14665,6 +14685,13 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= +merge-options@1.0.1: + version "1.0.1" + resolved "http://mirrors.tencent.com/npm/merge-options/-/merge-options-1.0.1.tgz#2a64b24457becd4e4dc608283247e94ce589aa32" + integrity sha512-iuPV41VWKWBIOpBsjoxjDZw8/GbSfZ2mk7N1453bwMrfzdrIk7EzBd+8UVR6rkw67th7xnk9Dytl3J+lHPdxvg== + dependencies: + is-plain-obj "^1.1" + merge-stream@2.0.0, merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -14695,6 +14722,25 @@ micromark@~2.11.0: debug "^4.0.0" parse-entities "^2.0.0" +micromatch@3.1.0: + version "3.1.0" + resolved "http://mirrors.tencent.com/npm/micromatch/-/micromatch-3.1.0.tgz#5102d4eaf20b6997d6008e3acfe1c44a3fa815e2" + integrity sha512-3StSelAE+hnRvMs8IdVW7Uhk8CVed5tp+kLLGlBP6WiRAXS21GPGu/Nat4WNPXj2Eoc24B02SaeoyozPMfj0/g== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.2.2" + define-property "^1.0.0" + extend-shallow "^2.0.1" + extglob "^2.0.2" + fragment-cache "^0.2.1" + kind-of "^5.0.2" + nanomatch "^1.2.1" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -14920,6 +14966,11 @@ mississippi@^3.0.0: stream-each "^1.1.0" through2 "^2.0.0" +mitt@1.1.2: + version "1.1.2" + resolved "http://mirrors.tencent.com/npm/mitt/-/mitt-1.1.2.tgz#380e61480d6a615b660f07abb60d51e0a4e4bed6" + integrity sha1-OA5hSA1qYVtmDwertg1R4KTkvtY= + mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -15094,7 +15145,7 @@ nanoid@^3.1.20: resolved "https://registry.npm.taobao.org/nanoid/download/nanoid-3.1.20.tgz?cache=0&sync_timestamp=1606834232543&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnanoid%2Fdownload%2Fnanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" integrity sha1-utwmPGsdzxS3HvqoX2q0wdbPx4g= -nanomatch@^1.2.9: +nanomatch@^1.2.1, nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== @@ -16952,6 +17003,13 @@ postcss-place@^4.0.1: postcss "^7.0.2" postcss-values-parser "^2.0.0" +postcss-prefix-selector@^1.6.0: + version "1.9.0" + resolved "http://mirrors.tencent.com/npm/postcss-prefix-selector/-/postcss-prefix-selector-1.9.0.tgz#db549802b79f9f91f7419c8c1f86d31d974aff5e" + integrity sha512-tTUHUNP+/Qfgg+fvbljUIeLs1ijICWb8+CT3bZM2joE2pkd+EnuBzSfZNHY2RMmozNRp44yEFv+I+6IIiLcoCg== + dependencies: + postcss "^7.0.0" + postcss-preset-env@6.7.0: version "6.7.0" resolved "https://registry.yarnpkg.com/postcss-preset-env/-/postcss-preset-env-6.7.0.tgz#c34ddacf8f902383b35ad1e030f178f4cdf118a5" @@ -17205,6 +17263,16 @@ postcss@7.0.32, postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13, postcss@^7.0.14 source-map "^0.6.1" supports-color "^6.1.0" +postcss@^5.2.17: + version "5.2.18" + resolved "http://mirrors.tencent.com/npm/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" + integrity sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg== + dependencies: + chalk "^1.1.3" + js-base64 "^2.1.9" + source-map "^0.5.6" + supports-color "^3.2.3" + postcss@^6.0.1: version "6.0.23" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" @@ -17232,6 +17300,44 @@ postcss@^8.1.4, postcss@^8.1.6: nanoid "^3.1.20" source-map "^0.6.1" +posthtml-parser@^0.2.0, posthtml-parser@^0.2.1: + version "0.2.1" + resolved "http://mirrors.tencent.com/npm/posthtml-parser/-/posthtml-parser-0.2.1.tgz#35d530de386740c2ba24ff2eb2faf39ccdf271dd" + integrity sha1-NdUw3jhnQMK6JP8usvrznM3ycd0= + dependencies: + htmlparser2 "^3.8.3" + isobject "^2.1.0" + +posthtml-rename-id@^1.0: + version "1.0.12" + resolved "http://mirrors.tencent.com/npm/posthtml-rename-id/-/posthtml-rename-id-1.0.12.tgz#cf7f6eb37146bf1afac31e68f18c6cc19ae61433" + integrity sha512-UKXf9OF/no8WZo9edRzvuMenb6AD5hDLzIepJW+a4oJT+T/Lx7vfMYWT4aWlGNQh0WMhnUx1ipN9OkZ9q+ddEw== + dependencies: + escape-string-regexp "1.0.5" + +posthtml-render@^1.0.5, posthtml-render@^1.0.6: + version "1.4.0" + resolved "http://mirrors.tencent.com/npm/posthtml-render/-/posthtml-render-1.4.0.tgz#40114070c45881cacb93347dae3eff53afbcff13" + integrity sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw== + +posthtml-svg-mode@^1.0.3: + version "1.0.3" + resolved "http://mirrors.tencent.com/npm/posthtml-svg-mode/-/posthtml-svg-mode-1.0.3.tgz#abd554face81223cab0cb367e18e4efd2a4e74b0" + integrity sha512-hEqw9NHZ9YgJ2/0G7CECOeuLQKZi8HjWLkBaSVtOWjygQ9ZD8P7tqeowYs7WrFdKsWEKG7o+IlsPY8jrr0CJpQ== + dependencies: + merge-options "1.0.1" + posthtml "^0.9.2" + posthtml-parser "^0.2.1" + posthtml-render "^1.0.6" + +posthtml@^0.9.2: + version "0.9.2" + resolved "http://mirrors.tencent.com/npm/posthtml/-/posthtml-0.9.2.tgz#f4c06db9f67b61fd17c4e256e7e3d9515bf726fd" + integrity sha1-9MBtufZ7Yf0XxOJW5+PZUVv3Jv0= + dependencies: + posthtml-parser "^0.2.0" + posthtml-render "^1.0.5" + preact@^10.5.7: version "10.5.7" resolved "https://registry.yarnpkg.com/preact/-/preact-10.5.7.tgz#f1d84725539e18f7ccbea937cf3db5895661dbd3" @@ -17543,7 +17649,7 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -query-string@^4.1.0: +query-string@^4.1.0, query-string@^4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= @@ -20809,17 +20915,67 @@ supports-hyperlinks@^2.0.0, supports-hyperlinks@^2.1.0: has-flag "^4.0.0" supports-color "^7.0.0" +svg-baker-runtime@^1.4.7: + version "1.4.7" + resolved "http://mirrors.tencent.com/npm/svg-baker-runtime/-/svg-baker-runtime-1.4.7.tgz#f4720637f5b6202eef6378d81f1fead0815f8a4e" + integrity sha512-Zorfwwj5+lWjk/oxwSMsRdS2sPQQdTmmsvaSpzU+i9ZWi3zugHLt6VckWfnswphQP0LmOel3nggpF5nETbt6xw== + dependencies: + deepmerge "1.3.2" + mitt "1.1.2" + svg-baker "^1.7.0" + +svg-baker@^1.5.0, svg-baker@^1.7.0: + version "1.7.0" + resolved "http://mirrors.tencent.com/npm/svg-baker/-/svg-baker-1.7.0.tgz#8367f78d875550c52fe4756f7303d5c5d7c2e9a7" + integrity sha512-nibslMbkXOIkqKVrfcncwha45f97fGuAOn1G99YwnwTj8kF9YiM6XexPcUso97NxOm6GsP0SIvYVIosBis1xLg== + dependencies: + bluebird "^3.5.0" + clone "^2.1.1" + he "^1.1.1" + image-size "^0.5.1" + loader-utils "^1.1.0" + merge-options "1.0.1" + micromatch "3.1.0" + postcss "^5.2.17" + postcss-prefix-selector "^1.6.0" + posthtml-rename-id "^1.0" + posthtml-svg-mode "^1.0.3" + query-string "^4.3.2" + traverse "^0.6.6" + svg-parser@^2.0.0, svg-parser@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== +svg-sprite-loader@^5.2.1: + version "5.2.1" + resolved "http://mirrors.tencent.com/npm/svg-sprite-loader/-/svg-sprite-loader-5.2.1.tgz#f0c37e76665ddfdf7abc8ff6ebd1da35cdd212d9" + integrity sha512-n2IZc87rpOeXh+PQFksFMGCfMV/BT01YG+Dlbyjoh2Cz8BSTL5Vi/7KDr86Pt/u1NRDCVb3vY74BF5rKCmqbNA== + dependencies: + bluebird "^3.5.0" + deepmerge "1.3.2" + domready "1.0.8" + escape-string-regexp "1.0.5" + loader-utils "^1.1.0" + svg-baker "^1.5.0" + svg-baker-runtime "^1.4.7" + url-slug "2.0.0" + svg-tags@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" integrity sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q= -svgo@^1.0.0, svgo@^1.2.2: +svgo-loader@^2.2.0: + version "2.2.2" + resolved "https://mirrors.tencent.com/npm/svgo-loader/-/svgo-loader-2.2.2.tgz#5f54e3e0d77c36a84c42bcb42e812c4db534bf96" + integrity sha512-UeE/4yZEK96LoYqvxwh8YqCOJCjXwRY9K6YT99vXE+nYhs/W8hAY2hNf5zg/lRsyKshJkR79V+4beV3cbGL40Q== + dependencies: + js-yaml "^3.13.1" + loader-utils "^1.0.3" + +svgo@^1.0.0, svgo@^1.2.2, svgo@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167" integrity sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw== @@ -21377,7 +21533,7 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" -traverse@~0.6.6: +traverse@^0.6.6, traverse@~0.6.6: version "0.6.6" resolved "https://registry.npm.taobao.org/traverse/download/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137" integrity sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc= @@ -21754,6 +21910,11 @@ unicode-property-aliases-ecmascript@^1.0.4: resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4" integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg== +unidecode@0.1.8: + version "0.1.8" + resolved "http://mirrors.tencent.com/npm/unidecode/-/unidecode-0.1.8.tgz#efbb301538bc45246a9ac8c559d72f015305053e" + integrity sha1-77swFTi8RSRqmsjFWdcvAVMFBT4= + unified@^6.1.2: version "6.2.0" resolved "https://registry.yarnpkg.com/unified/-/unified-6.2.0.tgz#7fbd630f719126d67d40c644b7e3f617035f6dba" @@ -22004,6 +22165,13 @@ url-parse@^1.4.3, url-parse@^1.4.7: querystringify "^2.1.1" requires-port "^1.0.0" +url-slug@2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/url-slug/-/url-slug-2.0.0.tgz#a789d5aed4995c0d95af33377ad1d5c68d4d7027" + integrity sha1-p4nVrtSZXA2VrzM3etHVxo1NcCc= + dependencies: + unidecode "0.1.8" + url@0.11.0, url@^0.11.0, url@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" From 0fb482bdbb92799542543ece200a6d486262e3b0 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Mon, 29 Mar 2021 14:43:49 +0800 Subject: [PATCH 08/11] =?UTF-8?q?feat(svg-icon):=20=E8=A1=A5=E5=85=85readm?= =?UTF-8?q?e,=E8=A1=A5=E5=85=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/README.md | 40 ++++++++++++++++++- .../normal/assets/{svgs => svg}/wechat.svg | 0 .../src/fixtures/normal/pages/index.tsx | 11 ++++- packages/plugin-svg-icon/src/index.test.ts | 12 +++++- 4 files changed, 58 insertions(+), 5 deletions(-) rename packages/plugin-svg-icon/src/fixtures/normal/assets/{svgs => svg}/wechat.svg (100%) diff --git a/packages/plugin-svg-icon/README.md b/packages/plugin-svg-icon/README.md index 655ee5032..7dc3e4cec 100644 --- a/packages/plugin-svg-icon/README.md +++ b/packages/plugin-svg-icon/README.md @@ -2,7 +2,7 @@ > @umijs/plugin-svg-icon. -See our website [@umijs/plugin-sass](https://umijs.org/plugins/plugin-svg-icon) for more information. +See our website [@umijs/plugin-svg-icon](https://umijs.org/plugins/plugin-svg-icon) for more information. ## 安装 @@ -24,12 +24,16 @@ $ yarn add @umijs/plugin-svg-icon --dev ## 使用方法 +**注意 svg 文件只有放置在 svgs 的文件夹才会应用此配置!** + 安装即可开启 如果想要自己配置 svgo 配置,可以在.umirc 配置文件同级下增加 svgo-config.json 实际使用: +- 1. 需要声明一个通用组件 ICON + ```jsx const requireAll = (requireContext) => { requireContext.keys().map(requireContext); @@ -57,6 +61,38 @@ export const Icon = forwardRef((props, ref) => { }); ``` +- 2. 使用此组件 + +```jsx + +``` + ## TODO -将示例的 jsx 代码整合到插件内部 +1. 将示例的 jsx 代码整合到插件内部。 + +2. 暴露 svg-sprite-loader 选项入口 + +## 为什么要使用此插件 + +- svg 优点多多,其在移动端有很强的适配能力,在 pc 端也可以防止图片变糊,可以多 svg 图片拼接组合等等,高效易用。 + + 通常我们获得的 svg 图片并不能直接使用,它们可能来自第三方 svg 组件库,或者来自设计师的原稿输出,这些 svg 如果直接使用 svg as component 可能存在以下痛点: + + 1. 我们需要 svg 图标携带 hover 样式,但是 svg 被填充了 fill 属性 + + 2. 内置的样式可能需要我们手动删除 + + 3. 携带一些内部敏感信息需要屏蔽 + + 4. 一个 svg 中的某部分全局中基本都有运用,但由于包裹的 svg 父元素不同可能会被多次请求。 + + 当 icon 变得非常多的时候这将是重复的体力劳动。 + +- 目前推荐对 svg 使用的是本插件的 svg-icon 与 url-loader 结合使用: + + 1. svg 确实需要内联样式的效果需要定制,请使用 svg as component。 + + 2. 有些 svg 不是全局 icon,而是单个引用,并且非常庞大请使用 svg as component。 + +更多可以参考:[svg-sprite-loader](https://github.com/JetBrains/svg-sprite-loader) 与 [svgo](https://github.com/svg/svgo) diff --git a/packages/plugin-svg-icon/src/fixtures/normal/assets/svgs/wechat.svg b/packages/plugin-svg-icon/src/fixtures/normal/assets/svg/wechat.svg similarity index 100% rename from packages/plugin-svg-icon/src/fixtures/normal/assets/svgs/wechat.svg rename to packages/plugin-svg-icon/src/fixtures/normal/assets/svg/wechat.svg diff --git a/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx b/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx index 8f5463d52..03fd360b3 100644 --- a/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx +++ b/packages/plugin-svg-icon/src/fixtures/normal/pages/index.tsx @@ -9,7 +9,9 @@ import React, { forwardRef } from 'react'; // const req = require.context('./assets/svgs', false, /\.svg$/); // requireAll(req); import '../assets/svgs/love.svg'; -import '../assets/svgs/alipay.svg' +import '../assets/svgs/alipay.svg'; +// @ts-ignore +import { ReactComponent as Wechat } from '../assets/svg/wechat.svg'; const Icon = forwardRef((props: any, ref) => { const { type, className, link, ...htmlProps } = props; @@ -25,7 +27,12 @@ const Icon = forwardRef((props: any, ref) => { }); const App = () => { return ( - + <> + + + + + ); }; export default App; diff --git a/packages/plugin-svg-icon/src/index.test.ts b/packages/plugin-svg-icon/src/index.test.ts index 1926aac5f..96efd4ce0 100644 --- a/packages/plugin-svg-icon/src/index.test.ts +++ b/packages/plugin-svg-icon/src/index.test.ts @@ -11,6 +11,16 @@ test('normal', async () => { await generateTmp({ cwd }); const { container } = render({ cwd }); expect(container.innerHTML).toEqual( - '', + '' + + '' + + '' + + '' + + '' + + '' + + 'wechat.svg', ); }); From 67455f9c8ff0e431c26e6de9c91e2367c471fdf8 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 6 May 2021 09:48:35 +0800 Subject: [PATCH 09/11] =?UTF-8?q?feat(svg-icon):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9lock=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugin-svg-icon/src/index.ts | 1 + yarn.lock | 346 ++------------------------ 2 files changed, 28 insertions(+), 319 deletions(-) diff --git a/packages/plugin-svg-icon/src/index.ts b/packages/plugin-svg-icon/src/index.ts index ae095425d..a29a87870 100644 --- a/packages/plugin-svg-icon/src/index.ts +++ b/packages/plugin-svg-icon/src/index.ts @@ -21,6 +21,7 @@ export default (api: IApi) => { //插件根目录位置 const svgoConfigDefaultFilePath = api.utils.winPath('../svgo-config.json'); try { + //如果配置文件不存在使用默认配置 svgoConfigDirFile = require.resolve(svgoConfigDirFilePath); } catch (e) { console.log( diff --git a/yarn.lock b/yarn.lock index e741609cd..e8495081f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5668,15 +5668,6 @@ yargs "15.4.1" yargs-parser "18.1.3" -"@webassemblyjs/ast@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" - integrity sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ== - dependencies: - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" @@ -5686,43 +5677,21 @@ "@webassemblyjs/helper-wasm-bytecode" "1.9.0" "@webassemblyjs/wast-parser" "1.9.0" -"@webassemblyjs/floating-point-hex-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz#1ba926a2923613edce496fd5b02e8ce8a5f49721" - integrity sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ== - "@webassemblyjs/floating-point-hex-parser@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz#3c3d3b271bddfc84deb00f71344438311d52ffb4" integrity sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA== -"@webassemblyjs/helper-api-error@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz#c49dad22f645227c5edb610bdb9697f1aab721f7" - integrity sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA== - "@webassemblyjs/helper-api-error@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz#203f676e333b96c9da2eeab3ccef33c45928b6a2" integrity sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw== -"@webassemblyjs/helper-buffer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz#fea93e429863dd5e4338555f42292385a653f204" - integrity sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q== - "@webassemblyjs/helper-buffer@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz#a1442d269c5feb23fcbc9ef759dac3547f29de00" integrity sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA== -"@webassemblyjs/helper-code-frame@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz#9a740ff48e3faa3022b1dff54423df9aa293c25e" - integrity sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ== - dependencies: - "@webassemblyjs/wast-printer" "1.8.5" - "@webassemblyjs/helper-code-frame@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz#647f8892cd2043a82ac0c8c5e75c36f1d9159f27" @@ -5730,24 +5699,11 @@ dependencies: "@webassemblyjs/wast-printer" "1.9.0" -"@webassemblyjs/helper-fsm@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz#ba0b7d3b3f7e4733da6059c9332275d860702452" - integrity sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow== - "@webassemblyjs/helper-fsm@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz#c05256b71244214671f4b08ec108ad63b70eddb8" integrity sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw== -"@webassemblyjs/helper-module-context@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz#def4b9927b0101dc8cbbd8d1edb5b7b9c82eb245" - integrity sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g== - dependencies: - "@webassemblyjs/ast" "1.8.5" - mamacro "^0.0.3" - "@webassemblyjs/helper-module-context@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz#25d8884b76839871a08a6c6f806c3979ef712f07" @@ -5755,26 +5711,11 @@ dependencies: "@webassemblyjs/ast" "1.9.0" -"@webassemblyjs/helper-wasm-bytecode@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz#537a750eddf5c1e932f3744206551c91c1b93e61" - integrity sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ== - "@webassemblyjs/helper-wasm-bytecode@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz#4fed8beac9b8c14f8c58b70d124d549dd1fe5790" integrity sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw== -"@webassemblyjs/helper-wasm-section@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz#74ca6a6bcbe19e50a3b6b462847e69503e6bfcbf" - integrity sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/helper-wasm-section@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz#5a4138d5a6292ba18b04c5ae49717e4167965346" @@ -5785,13 +5726,6 @@ "@webassemblyjs/helper-wasm-bytecode" "1.9.0" "@webassemblyjs/wasm-gen" "1.9.0" -"@webassemblyjs/ieee754@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz#712329dbef240f36bf57bd2f7b8fb9bf4154421e" - integrity sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g== - dependencies: - "@xtuc/ieee754" "^1.2.0" - "@webassemblyjs/ieee754@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz#15c7a0fbaae83fb26143bbacf6d6df1702ad39e4" @@ -5799,13 +5733,6 @@ dependencies: "@xtuc/ieee754" "^1.2.0" -"@webassemblyjs/leb128@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.8.5.tgz#044edeb34ea679f3e04cd4fd9824d5e35767ae10" - integrity sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A== - dependencies: - "@xtuc/long" "4.2.2" - "@webassemblyjs/leb128@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.9.0.tgz#f19ca0b76a6dc55623a09cffa769e838fa1e1c95" @@ -5813,30 +5740,11 @@ dependencies: "@xtuc/long" "4.2.2" -"@webassemblyjs/utf8@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.8.5.tgz#a8bf3b5d8ffe986c7c1e373ccbdc2a0915f0cedc" - integrity sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw== - "@webassemblyjs/utf8@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.9.0.tgz#04d33b636f78e6a6813227e82402f7637b6229ab" integrity sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w== -"@webassemblyjs/wasm-edit@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz#962da12aa5acc1c131c81c4232991c82ce56e01a" - integrity sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/helper-wasm-section" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-opt" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - "@webassemblyjs/wast-printer" "1.8.5" - "@webassemblyjs/wasm-edit@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz#3fe6d79d3f0f922183aa86002c42dd256cfee9cf" @@ -5851,17 +5759,6 @@ "@webassemblyjs/wasm-parser" "1.9.0" "@webassemblyjs/wast-printer" "1.9.0" -"@webassemblyjs/wasm-gen@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz#54840766c2c1002eb64ed1abe720aded714f98bc" - integrity sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - "@webassemblyjs/wasm-gen@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz#50bc70ec68ded8e2763b01a1418bf43491a7a49c" @@ -5873,16 +5770,6 @@ "@webassemblyjs/leb128" "1.9.0" "@webassemblyjs/utf8" "1.9.0" -"@webassemblyjs/wasm-opt@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz#b24d9f6ba50394af1349f510afa8ffcb8a63d264" - integrity sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - "@webassemblyjs/wasm-opt@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz#2211181e5b31326443cc8112eb9f0b9028721a61" @@ -5893,18 +5780,6 @@ "@webassemblyjs/wasm-gen" "1.9.0" "@webassemblyjs/wasm-parser" "1.9.0" -"@webassemblyjs/wasm-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz#21576f0ec88b91427357b8536383668ef7c66b8d" - integrity sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - "@webassemblyjs/wasm-parser@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz#9d48e44826df4a6598294aa6c87469d642fff65e" @@ -5917,18 +5792,6 @@ "@webassemblyjs/leb128" "1.9.0" "@webassemblyjs/utf8" "1.9.0" -"@webassemblyjs/wast-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz#e10eecd542d0e7bd394f6827c49f3df6d4eefb8c" - integrity sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/floating-point-hex-parser" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-code-frame" "1.8.5" - "@webassemblyjs/helper-fsm" "1.8.5" - "@xtuc/long" "4.2.2" - "@webassemblyjs/wast-parser@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz#3031115d79ac5bd261556cecc3fa90a3ef451914" @@ -5941,15 +5804,6 @@ "@webassemblyjs/helper-fsm" "1.9.0" "@xtuc/long" "4.2.2" -"@webassemblyjs/wast-printer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz#114bbc481fd10ca0e23b3560fa812748b0bae5bc" - integrity sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - "@xtuc/long" "4.2.2" - "@webassemblyjs/wast-printer@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz#4935d54c85fef637b00ce9f52377451d00d47899" @@ -6070,7 +5924,7 @@ acorn@^6.0.1, acorn@^6.0.4, acorn@^6.0.7, acorn@^6.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== -acorn@^7.0.0, acorn@^7.1.0, acorn@^7.1.1: +acorn@^7.1.0, acorn@^7.1.1: version "7.4.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c" integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== @@ -7320,30 +7174,6 @@ cacache@^12.0.0, cacache@^12.0.2, cacache@^12.0.3: unique-filename "^1.1.1" y18n "^4.0.0" -cacache@^13.0.1: - version "13.0.1" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-13.0.1.tgz#a8000c21697089082f85287a1aec6e382024a71c" - integrity sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w== - dependencies: - chownr "^1.1.2" - figgy-pudding "^3.5.1" - fs-minipass "^2.0.0" - glob "^7.1.4" - graceful-fs "^4.2.2" - infer-owner "^1.0.4" - lru-cache "^5.1.1" - minipass "^3.0.0" - minipass-collect "^1.0.2" - minipass-flush "^1.0.5" - minipass-pipeline "^1.2.2" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - p-map "^3.0.0" - promise-inflight "^1.0.1" - rimraf "^2.7.1" - ssri "^7.0.0" - unique-filename "^1.1.1" - cacache@^15.0.5: version "15.0.5" resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.0.5.tgz#69162833da29170d6732334643c60e005f5f17d0" @@ -8997,7 +8827,7 @@ deep-is@^0.1.3, deep-is@~0.1.3: deepmerge@1.3.2: version "1.3.2" - resolved "http://mirrors.tencent.com/npm/deepmerge/-/deepmerge-1.3.2.tgz#1663691629d4dbfe364fa12a2a4f0aa86aa3a050" + resolved "http://registry.yarnpkg.com/deepmerge/-/deepmerge-1.3.2.tgz#1663691629d4dbfe364fa12a2a4f0aa86aa3a050" integrity sha1-FmNpFinU2/42T6EqKk8KqGqjoFA= deepmerge@4.2.2, deepmerge@^4.2.2: @@ -9264,7 +9094,7 @@ dompurify@^2.2.6: domready@1.0.8: version "1.0.8" - resolved "http://mirrors.tencent.com/npm/domready/-/domready-1.0.8.tgz#91f252e597b65af77e745ae24dd0185d5e26d58c" + resolved "http://registry.yarnpkg.com/domready/-/domready-1.0.8.tgz#91f252e597b65af77e745ae24dd0185d5e26d58c" integrity sha1-kfJS5Ze2Wvd+dFriTdAYXV4m1Yw= domutils@1.5.1: @@ -9485,14 +9315,6 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enhanced-resolve@5.0.0-beta.4: - version "5.0.0-beta.4" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.0.0-beta.4.tgz#a14a799c098c2c43ec2cd0b718b14a2eadec7301" - integrity sha512-5/C1ZLbPbiFKM9WnF2LKvwresdLoKb0Py6r9XAt9gojZ6wnJb1ay2OzLY+T0DX5KSrimvTufAGISysArUlRpdQ== - dependencies: - graceful-fs "^4.2.0" - tapable "^2.0.0-beta.8" - enhanced-resolve@^4.0.0, enhanced-resolve@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz#3b806f3bfafc1ec7de69551ef93cca46c1704126" @@ -11311,11 +11133,6 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - glob@7.1.6, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" @@ -11697,7 +11514,7 @@ hastscript@^6.0.0: he@^1.1.1: version "1.2.0" - resolved "http://mirrors.tencent.com/npm/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + resolved "http://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== hex-color-regex@^1.1.0: @@ -13354,7 +13171,7 @@ jest-worker@^24.9.0: merge-stream "^2.0.0" supports-color "^6.1.0" -jest-worker@^25.4.0, jest-worker@^25.5.0: +jest-worker@^25.5.0: version "25.5.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.5.0.tgz#2611d071b79cea0f43ee57a3d118593ac1547db1" integrity sha512-/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw== @@ -13391,7 +13208,7 @@ joi2types@~1.0.7: js-base64@^2.1.9: version "2.6.4" - resolved "http://mirrors.tencent.com/npm/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" + resolved "http://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== js-file-download@^0.4.12: @@ -13990,11 +13807,6 @@ loader-runner@^2.4.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== -loader-runner@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-3.1.0.tgz#e9440e5875f2ad2f968489cd2c7b59a4f2847fcb" - integrity sha512-wE/bOCdTKMR2rm7Xxh+eirDOmN7Vx7hntWgiTayuFPtF8MgsFDo49SP8kkYz8IVlEBTOtR7P+XI7bE1xjo/IkA== - loader-utils@^1.0.2, loader-utils@^1.0.3, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" @@ -14374,11 +14186,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -mamacro@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" - integrity sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA== - map-age-cleaner@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" @@ -14687,7 +14494,7 @@ merge-descriptors@1.0.1: merge-options@1.0.1: version "1.0.1" - resolved "http://mirrors.tencent.com/npm/merge-options/-/merge-options-1.0.1.tgz#2a64b24457becd4e4dc608283247e94ce589aa32" + resolved "http://registry.yarnpkg.com/merge-options/-/merge-options-1.0.1.tgz#2a64b24457becd4e4dc608283247e94ce589aa32" integrity sha512-iuPV41VWKWBIOpBsjoxjDZw8/GbSfZ2mk7N1453bwMrfzdrIk7EzBd+8UVR6rkw67th7xnk9Dytl3J+lHPdxvg== dependencies: is-plain-obj "^1.1" @@ -14724,7 +14531,7 @@ micromark@~2.11.0: micromatch@3.1.0: version "3.1.0" - resolved "http://mirrors.tencent.com/npm/micromatch/-/micromatch-3.1.0.tgz#5102d4eaf20b6997d6008e3acfe1c44a3fa815e2" + resolved "http://registry.yarnpkg.com/micromatch/-/micromatch-3.1.0.tgz#5102d4eaf20b6997d6008e3acfe1c44a3fa815e2" integrity sha512-3StSelAE+hnRvMs8IdVW7Uhk8CVed5tp+kLLGlBP6WiRAXS21GPGu/Nat4WNPXj2Eoc24B02SaeoyozPMfj0/g== dependencies: arr-diff "^4.0.0" @@ -14833,16 +14640,6 @@ mini-create-react-context@^0.4.0: "@babel/runtime" "^7.5.5" tiny-warning "^1.0.3" -mini-css-extract-plugin@0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz#47f2cf07aa165ab35733b1fc97d4c46c0564339e" - integrity sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A== - dependencies: - loader-utils "^1.1.0" - normalize-url "1.9.1" - schema-utils "^1.0.0" - webpack-sources "^1.1.0" - mini-css-extract-plugin@1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-1.3.3.tgz#7802e62b34199aa7d1a62e654395859a836486a0" @@ -14968,7 +14765,7 @@ mississippi@^3.0.0: mitt@1.1.2: version "1.1.2" - resolved "http://mirrors.tencent.com/npm/mitt/-/mitt-1.1.2.tgz#380e61480d6a615b660f07abb60d51e0a4e4bed6" + resolved "http://registry.yarnpkg.com/mitt/-/mitt-1.1.2.tgz#380e61480d6a615b660f07abb60d51e0a4e4bed6" integrity sha1-OA5hSA1qYVtmDwertg1R4KTkvtY= mixin-deep@^1.2.0: @@ -15936,7 +15733,7 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.3.0: +p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== @@ -15983,13 +15780,6 @@ p-map@^2.1.0: resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== -p-map@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" - integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== - dependencies: - aggregate-error "^3.0.0" - p-map@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" @@ -17005,7 +16795,7 @@ postcss-place@^4.0.1: postcss-prefix-selector@^1.6.0: version "1.9.0" - resolved "http://mirrors.tencent.com/npm/postcss-prefix-selector/-/postcss-prefix-selector-1.9.0.tgz#db549802b79f9f91f7419c8c1f86d31d974aff5e" + resolved "http://registry.yarnpkg.com/postcss-prefix-selector/-/postcss-prefix-selector-1.9.0.tgz#db549802b79f9f91f7419c8c1f86d31d974aff5e" integrity sha512-tTUHUNP+/Qfgg+fvbljUIeLs1ijICWb8+CT3bZM2joE2pkd+EnuBzSfZNHY2RMmozNRp44yEFv+I+6IIiLcoCg== dependencies: postcss "^7.0.0" @@ -17265,7 +17055,7 @@ postcss@7.0.32, postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13, postcss@^7.0.14 postcss@^5.2.17: version "5.2.18" - resolved "http://mirrors.tencent.com/npm/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" + resolved "http://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" integrity sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg== dependencies: chalk "^1.1.3" @@ -17302,7 +17092,7 @@ postcss@^8.1.4, postcss@^8.1.6: posthtml-parser@^0.2.0, posthtml-parser@^0.2.1: version "0.2.1" - resolved "http://mirrors.tencent.com/npm/posthtml-parser/-/posthtml-parser-0.2.1.tgz#35d530de386740c2ba24ff2eb2faf39ccdf271dd" + resolved "http://registry.yarnpkg.com/posthtml-parser/-/posthtml-parser-0.2.1.tgz#35d530de386740c2ba24ff2eb2faf39ccdf271dd" integrity sha1-NdUw3jhnQMK6JP8usvrznM3ycd0= dependencies: htmlparser2 "^3.8.3" @@ -17310,19 +17100,19 @@ posthtml-parser@^0.2.0, posthtml-parser@^0.2.1: posthtml-rename-id@^1.0: version "1.0.12" - resolved "http://mirrors.tencent.com/npm/posthtml-rename-id/-/posthtml-rename-id-1.0.12.tgz#cf7f6eb37146bf1afac31e68f18c6cc19ae61433" + resolved "http://registry.yarnpkg.com/posthtml-rename-id/-/posthtml-rename-id-1.0.12.tgz#cf7f6eb37146bf1afac31e68f18c6cc19ae61433" integrity sha512-UKXf9OF/no8WZo9edRzvuMenb6AD5hDLzIepJW+a4oJT+T/Lx7vfMYWT4aWlGNQh0WMhnUx1ipN9OkZ9q+ddEw== dependencies: escape-string-regexp "1.0.5" posthtml-render@^1.0.5, posthtml-render@^1.0.6: version "1.4.0" - resolved "http://mirrors.tencent.com/npm/posthtml-render/-/posthtml-render-1.4.0.tgz#40114070c45881cacb93347dae3eff53afbcff13" + resolved "http://registry.yarnpkg.com/posthtml-render/-/posthtml-render-1.4.0.tgz#40114070c45881cacb93347dae3eff53afbcff13" integrity sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw== posthtml-svg-mode@^1.0.3: version "1.0.3" - resolved "http://mirrors.tencent.com/npm/posthtml-svg-mode/-/posthtml-svg-mode-1.0.3.tgz#abd554face81223cab0cb367e18e4efd2a4e74b0" + resolved "http://registry.yarnpkg.com/posthtml-svg-mode/-/posthtml-svg-mode-1.0.3.tgz#abd554face81223cab0cb367e18e4efd2a4e74b0" integrity sha512-hEqw9NHZ9YgJ2/0G7CECOeuLQKZi8HjWLkBaSVtOWjygQ9ZD8P7tqeowYs7WrFdKsWEKG7o+IlsPY8jrr0CJpQ== dependencies: merge-options "1.0.1" @@ -17332,7 +17122,7 @@ posthtml-svg-mode@^1.0.3: posthtml@^0.9.2: version "0.9.2" - resolved "http://mirrors.tencent.com/npm/posthtml/-/posthtml-0.9.2.tgz#f4c06db9f67b61fd17c4e256e7e3d9515bf726fd" + resolved "http://registry.yarnpkg.com/posthtml/-/posthtml-0.9.2.tgz#f4c06db9f67b61fd17c4e256e7e3d9515bf726fd" integrity sha1-9MBtufZ7Yf0XxOJW5+PZUVv3Jv0= dependencies: posthtml-parser "^0.2.0" @@ -19178,7 +18968,7 @@ rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" -rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@^2.7.1: +rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -19516,7 +19306,7 @@ scheduler@^0.19.1: loose-envify "^1.1.0" object-assign "^4.1.1" -schema-utils@2.7.0, schema-utils@^2.5.0, schema-utils@^2.6.1, schema-utils@^2.6.5, schema-utils@^2.6.6, schema-utils@^2.7.0: +schema-utils@2.7.0, schema-utils@^2.6.1, schema-utils@^2.6.5, schema-utils@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7" integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== @@ -20185,14 +19975,6 @@ ssri@^6.0.0, ssri@^6.0.1: dependencies: figgy-pudding "^3.5.1" -ssri@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-7.1.0.tgz#92c241bf6de82365b5c7fb4bd76e975522e1294d" - integrity sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g== - dependencies: - figgy-pudding "^3.5.1" - minipass "^3.1.1" - ssri@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.0.tgz#79ca74e21f8ceaeddfcb4b90143c458b8d988808" @@ -20917,7 +20699,7 @@ supports-hyperlinks@^2.0.0, supports-hyperlinks@^2.1.0: svg-baker-runtime@^1.4.7: version "1.4.7" - resolved "http://mirrors.tencent.com/npm/svg-baker-runtime/-/svg-baker-runtime-1.4.7.tgz#f4720637f5b6202eef6378d81f1fead0815f8a4e" + resolved "http://registry.yarnpkg.com/svg-baker-runtime/-/svg-baker-runtime-1.4.7.tgz#f4720637f5b6202eef6378d81f1fead0815f8a4e" integrity sha512-Zorfwwj5+lWjk/oxwSMsRdS2sPQQdTmmsvaSpzU+i9ZWi3zugHLt6VckWfnswphQP0LmOel3nggpF5nETbt6xw== dependencies: deepmerge "1.3.2" @@ -20926,7 +20708,7 @@ svg-baker-runtime@^1.4.7: svg-baker@^1.5.0, svg-baker@^1.7.0: version "1.7.0" - resolved "http://mirrors.tencent.com/npm/svg-baker/-/svg-baker-1.7.0.tgz#8367f78d875550c52fe4756f7303d5c5d7c2e9a7" + resolved "http://registry.yarnpkg.com/svg-baker/-/svg-baker-1.7.0.tgz#8367f78d875550c52fe4756f7303d5c5d7c2e9a7" integrity sha512-nibslMbkXOIkqKVrfcncwha45f97fGuAOn1G99YwnwTj8kF9YiM6XexPcUso97NxOm6GsP0SIvYVIosBis1xLg== dependencies: bluebird "^3.5.0" @@ -20950,7 +20732,7 @@ svg-parser@^2.0.0, svg-parser@^2.0.2: svg-sprite-loader@^5.2.1: version "5.2.1" - resolved "http://mirrors.tencent.com/npm/svg-sprite-loader/-/svg-sprite-loader-5.2.1.tgz#f0c37e76665ddfdf7abc8ff6ebd1da35cdd212d9" + resolved "http://registry.yarnpkg.com/svg-sprite-loader/-/svg-sprite-loader-5.2.1.tgz#f0c37e76665ddfdf7abc8ff6ebd1da35cdd212d9" integrity sha512-n2IZc87rpOeXh+PQFksFMGCfMV/BT01YG+Dlbyjoh2Cz8BSTL5Vi/7KDr86Pt/u1NRDCVb3vY74BF5rKCmqbNA== dependencies: bluebird "^3.5.0" @@ -20969,7 +20751,7 @@ svg-tags@^1.0.0: svgo-loader@^2.2.0: version "2.2.2" - resolved "https://mirrors.tencent.com/npm/svgo-loader/-/svgo-loader-2.2.2.tgz#5f54e3e0d77c36a84c42bcb42e812c4db534bf96" + resolved "https://registry.yarnpkg.com/svgo-loader/-/svgo-loader-2.2.2.tgz#5f54e3e0d77c36a84c42bcb42e812c4db534bf96" integrity sha512-UeE/4yZEK96LoYqvxwh8YqCOJCjXwRY9K6YT99vXE+nYhs/W8hAY2hNf5zg/lRsyKshJkR79V+4beV3cbGL40Q== dependencies: js-yaml "^3.13.1" @@ -21123,16 +20905,6 @@ tapable@1.1.3, tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tapable@2.0.0-beta.9: - version "2.0.0-beta.9" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.0.0-beta.9.tgz#638496fb27b53e69c21a0e6a4435afbe805845cb" - integrity sha512-+VBUuZXh+WIHnKOeo+A27SB/1sHTVWozcKweDIAhB/XOGnr8cy6ULZjU+qpGxO/G4xEyWCCaWTX/HPEkGg3Xrg== - -tapable@^2.0.0-beta.8: - version "2.0.0-beta.11" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.0.0-beta.11.tgz#5a6bd5e0353fad4da9e94942206bb596639e8cf7" - integrity sha512-cAhRzCvMdyJsxmdrSXG8/SUlJG4WJUxD/csuYAybUFjKVt74Y6pTyZ/I1ZK+enmCkWZN0JWxh14G69temaGSiA== - tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: version "4.4.13" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" @@ -21243,22 +21015,7 @@ terser-webpack-plugin@^1.4.3: webpack-sources "^1.4.0" worker-farm "^1.7.0" -terser-webpack-plugin@^2.3.1: - version "2.3.8" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz#894764a19b0743f2f704e7c2a848c5283a696724" - integrity sha512-/fKw3R+hWyHfYx7Bv6oPqmk4HGQcrWLtV3X6ggvPuwPNHSnzvVV51z6OaaCOus4YLjutYGOz3pEpbhe6Up2s1w== - dependencies: - cacache "^13.0.1" - find-cache-dir "^3.3.1" - jest-worker "^25.4.0" - p-limit "^2.3.0" - schema-utils "^2.6.6" - serialize-javascript "^4.0.0" - source-map "^0.6.1" - terser "^4.6.12" - webpack-sources "^1.4.3" - -terser@^4.1.2, terser@^4.6.12: +terser@^4.1.2: version "4.8.0" resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== @@ -21631,11 +21388,6 @@ tty-browserify@0.0.0: resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= -tty-browserify@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" - integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -21912,7 +21664,7 @@ unicode-property-aliases-ecmascript@^1.0.4: unidecode@0.1.8: version "0.1.8" - resolved "http://mirrors.tencent.com/npm/unidecode/-/unidecode-0.1.8.tgz#efbb301538bc45246a9ac8c559d72f015305053e" + resolved "http://registry.yarnpkg.com/unidecode/-/unidecode-0.1.8.tgz#efbb301538bc45246a9ac8c559d72f015305053e" integrity sha1-77swFTi8RSRqmsjFWdcvAVMFBT4= unified@^6.1.2: @@ -22167,12 +21919,12 @@ url-parse@^1.4.3, url-parse@^1.4.7: url-slug@2.0.0: version "2.0.0" - resolved "http://mirrors.tencent.com/npm/url-slug/-/url-slug-2.0.0.tgz#a789d5aed4995c0d95af33377ad1d5c68d4d7027" + resolved "http://registry.yarnpkg.com/url-slug/-/url-slug-2.0.0.tgz#a789d5aed4995c0d95af33377ad1d5c68d4d7027" integrity sha1-p4nVrtSZXA2VrzM3etHVxo1NcCc= dependencies: unidecode "0.1.8" -url@0.11.0, url@^0.11.0, url@~0.11.0: +url@^0.11.0, url@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= @@ -22466,14 +22218,6 @@ watchpack-chokidar2@^2.0.0: dependencies: chokidar "^2.1.8" -watchpack@2.0.0-beta.12: - version "2.0.0-beta.12" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.0.0-beta.12.tgz#bed6878b020c8f43f5b88b7031dfb2b2092755f5" - integrity sha512-vUJN6XQCBqrUkyX74WNopUvASMLqgicYGA5nO/FwSfdmLQgrfy44Z+Jl2YHHHXy/gDO6RlbArR26YQGeIWfoAg== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - watchpack@^1.7.4: version "1.7.4" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.4.tgz#6e9da53b3c80bb2d6508188f5b200410866cd30b" @@ -22541,14 +22285,6 @@ webpack-manifest-plugin@2.2.0: object.entries "^1.1.0" tapable "^1.0.0" -webpack-sources@2.0.0-beta.8: - version "2.0.0-beta.8" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.0.0-beta.8.tgz#0fc292239f6767cf4e9b47becfaa340ce6d7ea4f" - integrity sha512-RUaCJu7HYNeuzlY4WYcArcnOzMIj7kHndQ4pBdgP3iiMpG3Ke0BWY5wvb/VEFgsIXp3ZzPGRECwX+4fgpcKFYw== - dependencies: - source-list-map "^2.0.1" - source-map "~0.6.1" - webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" @@ -22594,34 +22330,6 @@ webpack@4.44.1: watchpack "^1.7.4" webpack-sources "^1.4.1" -webpack@5.0.0-beta.12: - version "5.0.0-beta.12" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.0.0-beta.12.tgz#3651a0fa6b9ad973b9608305601c08b84c24b402" - integrity sha512-a6YqL0l1xQ/B2GcIF1jS6AMlCK7VFoy0O+/2uBK6LjrNX8d85snl0nmEWkBzy9Zwm+orrOZs6deBfkSe6UkHnw== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/wasm-edit" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^7.0.0" - chrome-trace-event "^1.0.2" - enhanced-resolve "5.0.0-beta.4" - eslint-scope "^5.0.0" - events "^3.0.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.15" - json-parse-better-errors "^1.0.2" - loader-runner "^3.1.0" - loader-utils "^1.2.3" - mime "^2.4.4" - neo-async "^2.6.1" - pkg-dir "^4.2.0" - schema-utils "^2.5.0" - tapable "2.0.0-beta.9" - terser-webpack-plugin "^2.3.1" - watchpack "2.0.0-beta.12" - webpack-sources "2.0.0-beta.8" - webpackbar@5.0.0-3: version "5.0.0-3" resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-5.0.0-3.tgz#f4f96c8fb13001b2bb1348252db4c980ab93aaac" From 111a716657d82f79f5e348cfd3d839f957c3016c Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Thu, 6 May 2021 10:00:02 +0800 Subject: [PATCH 10/11] chore(merge): Merge branch 'master' of https://github.com/umijs/plugins into umijs-master # Conflicts: # yarn.lock --- .circleci/config.yml | 57 ++++++------ .github/workflows/ci.yml | 5 +- azure-pipelines.yml | 6 +- cypress.json | 4 + cypress/fixtures/example.json | 5 ++ cypress/integration/examples/index.spec.js | 77 ++++++++++++++++ cypress/plugins/index.js | 22 +++++ cypress/support/commands.js | 26 ++++++ cypress/support/index.js | 20 +++++ example/.umirc.ts | 31 +++++-- example/package.json | 5 ++ example/pages/index.tsx | 89 +------------------ example/pages/plugin-access.tsx | 11 +++ example/pages/plugin-initial-state.js | 16 +++- .../pages/{index.css => plugin-locale.css} | 0 example/pages/plugin-locale.tsx | 86 ++++++++++++++++++ example/pages/plugin-model.js | 9 +- example/pages/plugin-no-access.tsx | 10 +++ example/pages/request/index.tsx | 4 +- example/pages/utils/index.tsx | 27 ------ example/tsconfig.json | 1 + jest.config.js | 1 + package.json | 3 + packages/plugin-dva/CHANGELOG.md | 6 ++ packages/plugin-dva/package.json | 2 +- packages/plugin-dva/src/dva.tpl | 26 +++++- packages/plugin-dva/src/index.ts | 4 + packages/plugin-dva/src/runtime.tpl | 5 +- packages/plugin-esbuild/CHANGELOG.md | 16 ++++ packages/plugin-esbuild/package.json | 4 +- .../src/fixtures/no-es5/.umirc.ts | 22 +++++ .../src/fixtures/no-es5/src/pages/index.js | 3 + packages/plugin-esbuild/src/index.test.ts | 31 ++++++- packages/plugin-esbuild/src/index.ts | 4 +- packages/plugin-helmet/CHANGELOG.md | 6 ++ packages/plugin-helmet/package.json | 2 +- .../plugin-helmet/src/templates/runtime.tpl | 4 + packages/plugin-locale/CHANGELOG.md | 12 +++ packages/plugin-locale/package.json | 2 +- packages/plugin-locale/src/index.ts | 7 +- .../src/templates/localeExports.tpl | 13 +-- packages/plugin-model/CHANGELOG.md | 6 ++ packages/plugin-model/package.json | 2 +- .../plugin-model/src/helpers/executor.tsx | 57 +++++++----- packages/preset-react/CHANGELOG.md | 8 ++ packages/preset-react/package.json | 10 +-- 46 files changed, 550 insertions(+), 217 deletions(-) create mode 100644 cypress.json create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/integration/examples/index.spec.js create mode 100644 cypress/plugins/index.js create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/index.js create mode 100644 example/pages/plugin-access.tsx rename example/pages/{index.css => plugin-locale.css} (100%) create mode 100644 example/pages/plugin-locale.tsx create mode 100644 example/pages/plugin-no-access.tsx delete mode 100644 example/pages/utils/index.tsx create mode 100644 packages/plugin-esbuild/src/fixtures/no-es5/.umirc.ts create mode 100644 packages/plugin-esbuild/src/fixtures/no-es5/src/pages/index.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 8eb3f8a1b..2091cfc00 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,36 +1,37 @@ -version: 2 +version: 2.1 +orbs: + cypress: cypress-io/cypress@1.26.0 + node: circleci/node@4.3.0 + jobs: - build: + unit-test: docker: - - image: circleci/node:latest-browsers - - working_directory: ~/repo - + - image: 'cimg/base:stable' steps: - checkout - - - restore_cache: - key: node-modules-{{ checksum "yarn.lock" }} - + - node/install: + install-yarn: true + install-npm: false + - run: yarn install --frozen-lockfile --ignore-engines --silent + - run: yarn build - run: - name: Install Dependencies - command: yarn --frozen-lockfile - - - save_cache: - key: node-modules-{{ checksum "yarn.lock" }} - paths: - - ./node_modules - - ~/.cache/yarn - - - run: - name: Run Build - command: yarn build - - - run: - name: Run Tests + name: Run Test command: yarn test:coverage --forceExit --detectOpenHandles --maxWorkers=2 no_output_timeout: 300m - - run: - name: Generate coverage - command: bash <(curl -s https://codecov.io/bash) + +workflows: + run: + jobs: + - cypress/run: + executor: cypress/base-14 + yarn: true + no-workspace: true + cache-key: yarn-packages-{{ arch }}-{{ checksum "yarn.lock" }} + build: yarn build + start: cd example && npm start + wait-on: 'http://localhost:8000' + unit-test: + jobs: + - unit-test + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89a1b7794..2919c6103 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,11 @@ jobs: with: fetch-depth: '1' - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node_version }} - - run: yarn --ignore-engines --frozen-lockfile + registry-url: 'https://registry.yarnpkg.com' + - run: yarn --ignore-engines --frozen-lockfile --silent - run: yarn build - run: yarn test --forceExit env: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0ed0cd890..8e92571b1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,7 @@ trigger: jobs: - job: windows_test - timeoutInMinutes: 30 + timeoutInMinutes: 60 pool: vmImage: 'vs2017-win2016' strategy: @@ -31,11 +31,11 @@ jobs: yarn | "$(Agent.OS)" path: $(YARN_CACHE_FOLDER) displayName: Cache Yarn packages - - script: yarn install --frozen-lockfile + - script: yarn install --frozen-lockfile --ignore-engines --silent displayName: install - script: yarn build displayName: build - - script: yarn test --forceExit --detectOpenHandles --maxWorkers=2 + - script: yarn test --forceExit --maxWorkers=2 env: PROGRESS: none CI: true diff --git a/cypress.json b/cypress.json new file mode 100644 index 000000000..9fc3f3329 --- /dev/null +++ b/cypress.json @@ -0,0 +1,4 @@ +{ + "projectId": "aprgbp", + "baseUrl": "http://localhost:8000" +} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 000000000..02e425437 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/cypress/integration/examples/index.spec.js b/cypress/integration/examples/index.spec.js new file mode 100644 index 000000000..2c436bb5f --- /dev/null +++ b/cypress/integration/examples/index.spec.js @@ -0,0 +1,77 @@ +/// + +describe('examples', () => { + it('home', () => { + cy.visit('http://localhost:8000/'); + cy.get('#root > div').should('have.text', 'Home'); + }); + + it('plugin-model', () => { + cy.visit('http://localhost:8000/plugin-model'); + cy.get('[data-cy=model-add-btn]').click(); + cy.get('[data-cy=model-add-btn]').click(); + cy.get('[data-cy=model-add-btn]').click(); + + cy.get('[data-cy=model-count]').should('contain.text', '3'); + + // page initial-state + cy.get('[data-cy=go-to-plugin-initial-state]').click(); + cy.get('[data-cy=another-model-count]').should('contain.text', '999'); + cy.get('[data-cy=go-back-plugin-model]').click(); + cy.get('[data-cy=model-count]').should('contain.text', '999'); + }); + + it('plugin-locale', () => { + cy.visit('http://localhost:8000/plugin-locale'); + + cy.get('[data-cy=link-en-US]').click(); + cy.get('[data-cy=locale-text]').should('contain.text', 'Hi'); + + cy.get('[data-cy=link-zh-CN]').click(); + cy.get('[data-cy=locale-text]').should('contain.text', '你好'); + + cy.get('[data-cy=link-zh-TW]').click(); + cy.get('[data-cy=locale-text]').should('contain.text', '妳好'); + }); + + it('plugin-request', () => { + cy.visit('http://localhost:8000/request/?delay=200'); + + cy.intercept('/api/user', { + success: true, + data: { name: 'ycjcl868' }, + result: { name: 'name in result' }, + name: 'name outside', + }).as('getUser'); + + cy.waitUntil(() => + cy.get('[data-cy=data-text]').should('have.text', 'ycjcl868'), + ); + }); + + it('plugin-request', () => { + cy.visit('http://localhost:8000/request/?delay=200'); + + cy.intercept('/api/user', { + success: true, + data: { name: 'ycjcl868' }, + result: { name: 'name in result' }, + name: 'name outside', + }).as('getUser'); + + cy.waitUntil(() => + cy.get('[data-cy=data-text]').should('have.text', 'ycjcl868'), + ); + }); + + it('plugin-access', () => { + cy.visit('http://localhost:8000/plugin-no-access'); + cy.get('[data-cy=no-access-text]').should('have.text', 'no access'); + + cy.visit('http://localhost:8000/plugin-access'); + cy.get('[data-cy=access-text]').should( + 'have.text', + 'you can read the article', + ); + }); +}); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js new file mode 100644 index 000000000..8229063ad --- /dev/null +++ b/cypress/plugins/index.js @@ -0,0 +1,22 @@ +/// +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** + +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +/** + * @type {Cypress.PluginConfig} + */ +// eslint-disable-next-line no-unused-vars +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config +}; diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000..d3fa028a4 --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,26 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) +import 'cypress-wait-until'; diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 000000000..37a498fb5 --- /dev/null +++ b/cypress/support/index.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/example/.umirc.ts b/example/.umirc.ts index ed27b0d06..595b01481 100644 --- a/example/.umirc.ts +++ b/example/.umirc.ts @@ -1,8 +1,11 @@ import { defineConfig } from 'umi'; export default defineConfig({ - presets: [require.resolve('../packages/preset-react/lib')], - // plugins: [require.resolve('../packages/plugin-webpack-5/lib')], + presets: [ + require.resolve('../packages/preset-react/lib'), + // require.resolve('../packages/plugin-esbuild'), + ], + plugins: [require.resolve('../packages/plugin-esbuild/lib')], routes: [ { name: 'model 测试', @@ -16,17 +19,31 @@ export default defineConfig({ component: './plugin-initial-state', icon: 'star', }, - { - name: 'utils 测试', - path: '/utils', - component: './utils', - }, { name: 'request 测试', path: '/request', component: './request', menu: false, }, + { + name: 'access 测试(有权限)', + path: '/plugin-access', + component: './plugin-access', + access: 'readArticle', + menu: false, + }, + { + name: 'access 测试(没有权限)', + path: '/plugin-no-access', + component: './plugin-no-access', + access: 'updateArticle', + menu: false, + }, + { + name: 'locale 测试', + path: '/plugin-locale', + component: './plugin-locale', + }, { name: '首页', path: '/', diff --git a/example/package.json b/example/package.json index 18a1e415e..f10373503 100644 --- a/example/package.json +++ b/example/package.json @@ -1,3 +1,8 @@ { + "scripts": { + "dev": "../node_modules/umi/bin/umi.js dev", + "start": "../node_modules/umi/bin/umi.js dev", + "build": "../node_modules/umi/bin/umi.js build" + }, "dependencies": {} } diff --git a/example/pages/index.tsx b/example/pages/index.tsx index ef654e224..83a68a71e 100644 --- a/example/pages/index.tsx +++ b/example/pages/index.tsx @@ -1,86 +1,5 @@ -import React, { useState, useEffect } from 'react'; -import { connect } from 'dva'; -import { - useIntl, - formatMessage, - addLocale, - getLocale, - getAllLocales, - setLocale, - Access, - useAccess, -} from 'umi'; -import { Table } from 'antd'; -import styles from './index.css'; +import React from 'react'; -export default connect(state => { - return { count: state.count, foo: state.foo }; -})(function(props) { - const intl = useIntl(); - const access = useAccess(); - const [list, setList] = useState(getAllLocales()); - - useEffect(() => { - // 动态增加新语言 - addLocale('zh-TW', { - name: '妳好,{name}', - }); - // 刷新列表 - setList(getAllLocales()); - }, []); - - const locale = getLocale(); - - return ( -
-

当前语言:{locale}

- {list.map(locale => ( - { - setLocale(locale, false); - }} - style={{ - margin: 8, - }} - > - {locale} - - ))} -

- Page index {props.count} {props.foo + 2} -

- {' '} - -
- - - - Cannot Update Article} - > - - -
-
- ); -}); +export default function Index() { + return
Home
; +} diff --git a/example/pages/plugin-access.tsx b/example/pages/plugin-access.tsx new file mode 100644 index 000000000..83ebd22a8 --- /dev/null +++ b/example/pages/plugin-access.tsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { useAccess } from 'umi'; + +export default () => { + const access = useAccess(); + + if (access.readArticle) { + return
you can read the article
; + } + return
no access
; +}; diff --git a/example/pages/plugin-initial-state.js b/example/pages/plugin-initial-state.js index 95065c9bb..0856a2d5b 100644 --- a/example/pages/plugin-initial-state.js +++ b/example/pages/plugin-initial-state.js @@ -1,5 +1,5 @@ import React from 'react'; -import { useModel } from 'umi'; +import { useModel, history } from 'umi'; export default () => { const { initialState, loading, setInitialState } = useModel('@@initialState'); @@ -9,13 +9,25 @@ export default () => {

initial-state: {loading ? 'loading...' : JSON.stringify(initialState)}

-

count from another model: {description}

+

+ count from another model: {description} +

+
+ +
); }; diff --git a/example/pages/index.css b/example/pages/plugin-locale.css similarity index 100% rename from example/pages/index.css rename to example/pages/plugin-locale.css diff --git a/example/pages/plugin-locale.tsx b/example/pages/plugin-locale.tsx new file mode 100644 index 000000000..c32131228 --- /dev/null +++ b/example/pages/plugin-locale.tsx @@ -0,0 +1,86 @@ +import React, { useState, useEffect } from 'react'; +import { connect } from 'dva'; +import { + useIntl, + formatMessage, + addLocale, + getLocale, + getAllLocales, + setLocale, + Access, + useAccess, +} from 'umi'; +import styles from './plugin-locale.css'; + +export default connect((state) => { + return { count: state.count, foo: state.foo }; +})(function (props) { + const intl = useIntl(); + const access = useAccess(); + const [list, setList] = useState(getAllLocales()); + + useEffect(() => { + // 动态增加新语言 + addLocale('zh-TW', { + name: '妳好,{name}', + }); + // 刷新列表 + setList(getAllLocales()); + }, []); + + const locale = getLocale(); + + return ( +
+

当前语言:{locale}

+ {list.map((locale) => ( + { + setLocale(locale, false); + }} + data-cy={`link-${locale}`} + style={{ + margin: 8, + }} + > + {locale} + + ))} +

+ Page index {props.count} {props.foo + 2} +

+ {' '} + +
+ + + + Cannot Update Article} + > + + +
+
+ ); +}); diff --git a/example/pages/plugin-model.js b/example/pages/plugin-model.js index 1e69cc501..8475b7d57 100644 --- a/example/pages/plugin-model.js +++ b/example/pages/plugin-model.js @@ -7,9 +7,14 @@ export default () => { // const setCount = useModel('bar', c => c.setCount); return (
-

Page plugin-model {bar}

- +

+ Page plugin-model {bar} +

+