Skip to content

Commit a9eab16

Browse files
committed
fix: refactoring code
1 parent 74c71f4 commit a9eab16

3 files changed

Lines changed: 78 additions & 54 deletions

File tree

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
},
5353
"devDependencies": {
5454
"@babel/core": "^7.9.0",
55-
"@babel/preset-env": "^7.9.0",
56-
"@micro-app/cli": "^0.3.9",
55+
"@babel/preset-env": "^7.9.5",
56+
"@micro-app/cli": "^0.3.15",
5757
"@micro-app/plugin-compatible": "0.0.3",
58-
"@micro-app/plugin-deploy": "^0.0.6",
58+
"@micro-app/plugin-deploy": "^0.0.7",
5959
"@types/jest": "^24.9.1",
6060
"eslint-config-2o3t": "^2.0.1",
6161
"html-webpack-plugin": "^3.2.0",
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"@intervolga/optimize-cssnano-plugin": "^1.0.6",
6969
"@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
70-
"@micro-app/shared-utils": "^0.1.16",
70+
"@micro-app/shared-utils": "^0.1.17",
7171
"@soda/friendly-errors-webpack-plugin": "^1.7.1",
7272
"address": "^1.1.2",
7373
"autoprefixer": "^9.7.4",

src/extends/enhance/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ module.exports = function WebpackAdapter(api, opts) {
1616

1717
api.extendMethod('resolveChainableWebpackConfig', {
1818
description: 'resolve webpack-chain config.',
19-
}, (options = {}) => {
19+
}, (webpackChainConfig = new Config()) => {
2020
if (!initialized) {
2121
logger.throw('please call after "onInitWillDone" !');
2222
}
2323

2424
// 可通过外部初始化一个已存在的 webpackChain 实例
25-
const webpackChainConfig = api.applyPluginHooks('createChainWebpackConfigInstance', new Config(), options);
25+
webpackChainConfig = api.applyPluginHooks('createChainWebpackConfigInstance', webpackChainConfig);
2626

2727
const selfConfig = api.selfConfig || {};
2828
const originalConfig = selfConfig.originalConfig || {};
@@ -36,7 +36,7 @@ module.exports = function WebpackAdapter(api, opts) {
3636
webpackChainConfig.target('web');
3737
}
3838

39-
const finalWebpackChainConfig = api.applyPluginHooks('modifyChainWebpackConfig', webpackChainConfig, options);
39+
const finalWebpackChainConfig = api.applyPluginHooks('modifyChainWebpackConfig', webpackChainConfig);
4040
api.applyPluginHooks('onChainWebpcakConfig', finalWebpackChainConfig);
4141

4242
api.setState('webpackChainConfig', finalWebpackChainConfig);
@@ -45,10 +45,10 @@ module.exports = function WebpackAdapter(api, opts) {
4545

4646
api.extendMethod('resolveWebpackConfig', {
4747
description: 'resolve webpack config.',
48-
}, (options = {}) => {
49-
const finalWebpackChainConfig = api.resolveChainableWebpackConfig(options);
48+
}, webpackChainConfig => {
49+
const finalWebpackChainConfig = api.resolveChainableWebpackConfig(webpackChainConfig);
5050
const webpackConfig = finalWebpackChainConfig.toConfig();
51-
const finalWebpackConfig = api.applyPluginHooks('modifyWebpackConfig', webpackConfig, options);
51+
const finalWebpackConfig = api.applyPluginHooks('modifyWebpackConfig', webpackConfig);
5252

5353
api.setState('webpackConfig', finalWebpackConfig);
5454
return finalWebpackConfig;

yarn.lock

Lines changed: 68 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@
111111
"@babel/template" "^7.8.3"
112112
"@babel/types" "^7.8.3"
113113

114+
"@babel/helper-function-name@^7.9.5":
115+
version "7.9.5"
116+
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz#2b53820d35275120e1874a82e5aabe1376920a5c"
117+
integrity sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==
118+
dependencies:
119+
"@babel/helper-get-function-arity" "^7.8.3"
120+
"@babel/template" "^7.8.3"
121+
"@babel/types" "^7.9.5"
122+
114123
"@babel/helper-get-function-arity@^7.8.3":
115124
version "7.8.3"
116125
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5"
@@ -212,6 +221,11 @@
212221
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz#ad53562a7fc29b3b9a91bbf7d10397fd146346ed"
213222
integrity sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==
214223

224+
"@babel/helper-validator-identifier@^7.9.5":
225+
version "7.9.5"
226+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80"
227+
integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==
228+
215229
"@babel/helper-wrap-function@^7.8.3":
216230
version "7.8.3"
217231
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz#9dbdb2bb55ef14aaa01fe8c99b629bd5352d8610"
@@ -286,13 +300,14 @@
286300
"@babel/helper-plugin-utils" "^7.8.3"
287301
"@babel/plugin-syntax-numeric-separator" "^7.8.3"
288302

289-
"@babel/plugin-proposal-object-rest-spread@^7.9.0":
290-
version "7.9.0"
291-
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.0.tgz#a28993699fc13df165995362693962ba6b061d6f"
292-
integrity sha512-UgqBv6bjq4fDb8uku9f+wcm1J7YxJ5nT7WO/jBr0cl0PLKb7t1O6RNR1kZbjgx2LQtsDI9hwoQVmn0yhXeQyow==
303+
"@babel/plugin-proposal-object-rest-spread@^7.9.5":
304+
version "7.9.5"
305+
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.5.tgz#3fd65911306d8746014ec0d0cf78f0e39a149116"
306+
integrity sha512-VP2oXvAf7KCYTthbUHwBlewbl1Iq059f6seJGsxMizaCdgHIeczOr7FBqELhSqfkIl04Fi8okzWzl63UKbQmmg==
293307
dependencies:
294308
"@babel/helper-plugin-utils" "^7.8.3"
295309
"@babel/plugin-syntax-object-rest-spread" "^7.8.0"
310+
"@babel/plugin-transform-parameters" "^7.9.5"
296311

297312
"@babel/plugin-proposal-optional-catch-binding@^7.8.3":
298313
version "7.8.3"
@@ -412,14 +427,14 @@
412427
"@babel/helper-plugin-utils" "^7.8.3"
413428
lodash "^4.17.13"
414429

415-
"@babel/plugin-transform-classes@^7.9.0":
416-
version "7.9.2"
417-
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.2.tgz#8603fc3cc449e31fdbdbc257f67717536a11af8d"
418-
integrity sha512-TC2p3bPzsfvSsqBZo0kJnuelnoK9O3welkUpqSqBQuBF6R5MN2rysopri8kNvtlGIb2jmUO7i15IooAZJjZuMQ==
430+
"@babel/plugin-transform-classes@^7.9.5":
431+
version "7.9.5"
432+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.5.tgz#800597ddb8aefc2c293ed27459c1fcc935a26c2c"
433+
integrity sha512-x2kZoIuLC//O5iA7PEvecB105o7TLzZo8ofBVhP79N+DO3jaX+KYfww9TQcfBEZD0nikNyYcGB1IKtRq36rdmg==
419434
dependencies:
420435
"@babel/helper-annotate-as-pure" "^7.8.3"
421436
"@babel/helper-define-map" "^7.8.3"
422-
"@babel/helper-function-name" "^7.8.3"
437+
"@babel/helper-function-name" "^7.9.5"
423438
"@babel/helper-optimise-call-expression" "^7.8.3"
424439
"@babel/helper-plugin-utils" "^7.8.3"
425440
"@babel/helper-replace-supers" "^7.8.6"
@@ -433,10 +448,10 @@
433448
dependencies:
434449
"@babel/helper-plugin-utils" "^7.8.3"
435450

436-
"@babel/plugin-transform-destructuring@^7.8.3":
437-
version "7.8.8"
438-
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.8.tgz#fadb2bc8e90ccaf5658de6f8d4d22ff6272a2f4b"
439-
integrity sha512-eRJu4Vs2rmttFCdhPUM3bV0Yo/xPSdPw6ML9KHs/bjB4bLA5HXlbvYXPOD5yASodGod+krjYx21xm1QmL8dCJQ==
451+
"@babel/plugin-transform-destructuring@^7.9.5":
452+
version "7.9.5"
453+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.9.5.tgz#72c97cf5f38604aea3abf3b935b0e17b1db76a50"
454+
integrity sha512-j3OEsGel8nHL/iusv/mRd5fYZ3DrOxWC82x0ogmdN/vHfAP4MYw+AFKYanzWlktNwikKvlzUV//afBW5FTp17Q==
440455
dependencies:
441456
"@babel/helper-plugin-utils" "^7.8.3"
442457

@@ -551,10 +566,10 @@
551566
"@babel/helper-plugin-utils" "^7.8.3"
552567
"@babel/helper-replace-supers" "^7.8.3"
553568

554-
"@babel/plugin-transform-parameters@^7.8.7":
555-
version "7.9.3"
556-
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.3.tgz#3028d0cc20ddc733166c6e9c8534559cee09f54a"
557-
integrity sha512-fzrQFQhp7mIhOzmOtPiKffvCYQSK10NR8t6BBz2yPbeUHb9OLW8RZGtgDRBn8z2hGcwvKDL3vC7ojPTLNxmqEg==
569+
"@babel/plugin-transform-parameters@^7.9.5":
570+
version "7.9.5"
571+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.5.tgz#173b265746f5e15b2afe527eeda65b73623a0795"
572+
integrity sha512-0+1FhHnMfj6lIIhVvS4KGQJeuhe1GI//h5uptK4PvLt+BGBxsoUJbd3/IW002yk//6sZPlFgsG1hY6OHLcy6kA==
558573
dependencies:
559574
"@babel/helper-get-function-arity" "^7.8.3"
560575
"@babel/helper-plugin-utils" "^7.8.3"
@@ -625,10 +640,10 @@
625640
"@babel/helper-create-regexp-features-plugin" "^7.8.3"
626641
"@babel/helper-plugin-utils" "^7.8.3"
627642

628-
"@babel/preset-env@^7.9.0":
629-
version "7.9.0"
630-
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.0.tgz#a5fc42480e950ae8f5d9f8f2bbc03f52722df3a8"
631-
integrity sha512-712DeRXT6dyKAM/FMbQTV/FvRCms2hPCx+3weRjZ8iQVQWZejWWk1wwG6ViWMyqb/ouBbGOl5b6aCk0+j1NmsQ==
643+
"@babel/preset-env@^7.9.5":
644+
version "7.9.5"
645+
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.5.tgz#8ddc76039bc45b774b19e2fc548f6807d8a8919f"
646+
integrity sha512-eWGYeADTlPJH+wq1F0wNfPbVS1w1wtmMJiYk55Td5Yu28AsdR9AsC97sZ0Qq8fHqQuslVSIYSGJMcblr345GfQ==
632647
dependencies:
633648
"@babel/compat-data" "^7.9.0"
634649
"@babel/helper-compilation-targets" "^7.8.7"
@@ -639,7 +654,7 @@
639654
"@babel/plugin-proposal-json-strings" "^7.8.3"
640655
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3"
641656
"@babel/plugin-proposal-numeric-separator" "^7.8.3"
642-
"@babel/plugin-proposal-object-rest-spread" "^7.9.0"
657+
"@babel/plugin-proposal-object-rest-spread" "^7.9.5"
643658
"@babel/plugin-proposal-optional-catch-binding" "^7.8.3"
644659
"@babel/plugin-proposal-optional-chaining" "^7.9.0"
645660
"@babel/plugin-proposal-unicode-property-regex" "^7.8.3"
@@ -656,9 +671,9 @@
656671
"@babel/plugin-transform-async-to-generator" "^7.8.3"
657672
"@babel/plugin-transform-block-scoped-functions" "^7.8.3"
658673
"@babel/plugin-transform-block-scoping" "^7.8.3"
659-
"@babel/plugin-transform-classes" "^7.9.0"
674+
"@babel/plugin-transform-classes" "^7.9.5"
660675
"@babel/plugin-transform-computed-properties" "^7.8.3"
661-
"@babel/plugin-transform-destructuring" "^7.8.3"
676+
"@babel/plugin-transform-destructuring" "^7.9.5"
662677
"@babel/plugin-transform-dotall-regex" "^7.8.3"
663678
"@babel/plugin-transform-duplicate-keys" "^7.8.3"
664679
"@babel/plugin-transform-exponentiation-operator" "^7.8.3"
@@ -673,7 +688,7 @@
673688
"@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3"
674689
"@babel/plugin-transform-new-target" "^7.8.3"
675690
"@babel/plugin-transform-object-super" "^7.8.3"
676-
"@babel/plugin-transform-parameters" "^7.8.7"
691+
"@babel/plugin-transform-parameters" "^7.9.5"
677692
"@babel/plugin-transform-property-literals" "^7.8.3"
678693
"@babel/plugin-transform-regenerator" "^7.8.7"
679694
"@babel/plugin-transform-reserved-words" "^7.8.3"
@@ -684,7 +699,7 @@
684699
"@babel/plugin-transform-typeof-symbol" "^7.8.4"
685700
"@babel/plugin-transform-unicode-regex" "^7.8.3"
686701
"@babel/preset-modules" "^0.1.3"
687-
"@babel/types" "^7.9.0"
702+
"@babel/types" "^7.9.5"
688703
browserslist "^4.9.1"
689704
core-js-compat "^3.6.2"
690705
invariant "^2.2.2"
@@ -750,6 +765,15 @@
750765
lodash "^4.17.13"
751766
to-fast-properties "^2.0.0"
752767

768+
"@babel/types@^7.9.5":
769+
version "7.9.5"
770+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444"
771+
integrity sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg==
772+
dependencies:
773+
"@babel/helper-validator-identifier" "^7.9.5"
774+
lodash "^4.17.13"
775+
to-fast-properties "^2.0.0"
776+
753777
"@cnakazawa/watch@^1.0.3":
754778
version "1.0.4"
755779
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
@@ -927,22 +951,22 @@
927951
dependencies:
928952
sourcemap-codec "^1.4.4"
929953

930-
"@micro-app/cli@^0.3.9":
931-
version "0.3.9"
932-
resolved "https://registry.yarnpkg.com/@micro-app/cli/-/cli-0.3.9.tgz#d8560a4b84f2596bdafdc3c4630177e400529731"
933-
integrity sha512-1f/PwN+bNL41d+AsqUxrlbh1zHbVFu2SRn/FEIHCfWtOqLHa47XOWF56VK9kw+tA+AJOMEHT1W0COAh1mNAwHA==
954+
"@micro-app/cli@^0.3.15":
955+
version "0.3.15"
956+
resolved "https://registry.yarnpkg.com/@micro-app/cli/-/cli-0.3.15.tgz#3cbcb455675deda5bb8dbcae2f42e6c60d71d87b"
957+
integrity sha512-RUvrH5e0KtWZAd2dlR3K5fWmovXLzM01wM9yEm347zwZceeBQgMlSv5GRBTCS5HNjVFsfpsfpVWEWk4E+B3NJA==
934958
dependencies:
935-
"@micro-app/core" "^0.3.18"
959+
"@micro-app/core" "^0.3.23"
936960
"@zkochan/cmd-shim" "^4.3.0"
937961
read-cmd-shim "^2.0.0"
938962
update-notifier "^4.1.0"
939963

940-
"@micro-app/core@^0.3.18":
941-
version "0.3.18"
942-
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.3.18.tgz#9ca602e6c9da51ddfe333283de9c8f6642244206"
943-
integrity sha512-/E/qSiJUOJ7+6gBvbphpepBfeBwZRwpTDOW3K61sbNCu05bdBZpwgUwkyEqi659aa1XZNRj6Eb23sLfU1WkVtA==
964+
"@micro-app/core@^0.3.23":
965+
version "0.3.23"
966+
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.3.23.tgz#7e8d425021875ee27d1a2e30170502ff022c70dc"
967+
integrity sha512-BBLN2dOCCOJDsmCoCzx73C6M2eHB0K3JeEIFmbQSoY/E8EoTRfWNW+IAmFMm8WgSXOtMsb/4V678lBoLq7fLKA==
944968
dependencies:
945-
"@micro-app/shared-utils" "^0.1.16"
969+
"@micro-app/shared-utils" "^0.1.17"
946970
dotenv "^8.2.0"
947971
dotenv-expand "^5.1.0"
948972

@@ -954,18 +978,18 @@
954978
koa "^2.11.0"
955979
koa-convert "^1.2.0"
956980

957-
"@micro-app/plugin-deploy@^0.0.6":
958-
version "0.0.6"
959-
resolved "https://registry.yarnpkg.com/@micro-app/plugin-deploy/-/plugin-deploy-0.0.6.tgz#75a0b435a8f6b12252c7204642383511f66521b7"
960-
integrity sha512-zvCqaKRTxwFx9A+A2p/RxdBJSDhYClpOJyQPmlx16RQwhqpFNUVdbR17qa7uaWCPyC11OM1IWAPiz10UA+XHeQ==
981+
"@micro-app/plugin-deploy@^0.0.7":
982+
version "0.0.7"
983+
resolved "https://registry.yarnpkg.com/@micro-app/plugin-deploy/-/plugin-deploy-0.0.7.tgz#cc413f4a98b700db8e84a8a3137c6ee41ae71642"
984+
integrity sha512-LcVQ3k3RSdsVaVd0HiBZJIF7RAZUAMHESekNt38xW4ZOPs9caU1UUhxVLNFo9ea5nCxqzvF/Ueo5e8iCQKW+WQ==
961985
dependencies:
962986
"@release-it/conventional-changelog" "^1.1.0"
963987
release-it "^13.1.1"
964988

965-
"@micro-app/shared-utils@^0.1.16":
966-
version "0.1.16"
967-
resolved "https://registry.yarnpkg.com/@micro-app/shared-utils/-/shared-utils-0.1.16.tgz#4952238c8caf17156548e33a43990ef42368e363"
968-
integrity sha512-n4/E5gRFAijnMa33slUBF+REKVoPZ3SczY3xim3cRT0xI0vqG1uhyLZjEAwUq9mStGORgcllYN4ygUuJx0ki0Q==
989+
"@micro-app/shared-utils@^0.1.17":
990+
version "0.1.17"
991+
resolved "https://registry.yarnpkg.com/@micro-app/shared-utils/-/shared-utils-0.1.17.tgz#e99b9aa4385cf4eefe5f96f0f553162ab9342743"
992+
integrity sha512-XI1uFnvjPaFZvLLMoARZeUqUya2i2z4aJ1oT23bahQL+5dHgXj2p1o/1agJ7G0K1KStasLRjPXNuHEpBpK1Weg==
969993
dependencies:
970994
ajv "^6.10.2"
971995
ajv-keywords "^3.4.1"

0 commit comments

Comments
 (0)