diff --git a/docs/guide/dev.md b/docs/guide/dev.md index ca2cb30e..25729552 100644 --- a/docs/guide/dev.md +++ b/docs/guide/dev.md @@ -9,6 +9,8 @@ ```bash # 执行 dev 命令,开启实时编译 $ father dev +# 跳过初次全量构建,只监听文件变化执行增量构建 +$ father dev --incremental ``` 一旦源码或配置文件发生变化,产物将会实时增量编译到输出目录。 diff --git a/package.json b/package.json index 908df510..31301a42 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dev": "pnpm build --watch", "format": "prettier --write .", "prepare": "husky install", - "release": "esno scripts/release.ts", + "release": "tsx scripts/release.ts", "test": "jest", "test:cov": "jest --collectCoverage" }, @@ -43,12 +43,12 @@ }, "dependencies": { "@microsoft/api-extractor": "7.39.1", - "@umijs/babel-preset-umi": "^4.3.5", - "@umijs/bundler-utils": "^4.3.5", - "@umijs/bundler-webpack": "^4.3.5", + "@umijs/babel-preset-umi": "^4.3.10", + "@umijs/bundler-utils": "^4.3.10", + "@umijs/bundler-webpack": "^4.3.10", "@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1", - "@umijs/core": "^4.3.5", - "@umijs/utils": "^4.3.5", + "@umijs/core": "^4.3.10", + "@umijs/utils": "^4.3.10", "@vercel/ncc": "0.33.3", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-module-resolver": "4.1.0", @@ -74,7 +74,6 @@ "@types/minimatch": "3.0.5", "@types/node": "^18.15.13", "@umijs/test": "^4.0.68", - "esno": "^0.16.3", "git-repo-info": "^2.1.1", "husky": "^8.0.3", "jest": "^27", @@ -85,6 +84,7 @@ "prettier-plugin-packagejson": "^2.4.3", "rimraf": "^3.0.2", "ts-node": "^10.9.1", + "tsx": "^4.16.3", "zx": "^4.3.0" }, "packageManager": "pnpm@8.6.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 059b4149..1ac295df 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,23 +12,23 @@ importers: specifier: 7.39.1 version: 7.39.1(@types/node@18.15.13) '@umijs/babel-preset-umi': - specifier: ^4.3.5 - version: 4.3.5 + specifier: ^4.3.10 + version: 4.3.10 '@umijs/bundler-utils': - specifier: ^4.3.5 - version: 4.3.5 + specifier: ^4.3.10 + version: 4.3.10 '@umijs/bundler-webpack': - specifier: ^4.3.5 - version: 4.3.5(typescript@5.3.3)(webpack@5.80.0) + specifier: ^4.3.10 + version: 4.3.10(typescript@5.3.3)(webpack@5.80.0) '@umijs/case-sensitive-paths-webpack-plugin': specifier: ^1.0.1 version: 1.0.1 '@umijs/core': - specifier: ^4.3.5 - version: 4.3.5 + specifier: ^4.3.10 + version: 4.3.10 '@umijs/utils': - specifier: ^4.3.5 - version: 4.3.5 + specifier: ^4.3.10 + version: 4.3.10 '@vercel/ncc': specifier: 0.33.3 version: 0.33.3 @@ -99,9 +99,6 @@ importers: '@umijs/test': specifier: ^4.0.68 version: 4.0.68(@babel/core@7.21.3) - esno: - specifier: ^0.16.3 - version: 0.16.3 git-repo-info: specifier: ^2.1.1 version: 2.1.1 @@ -132,6 +129,9 @@ importers: ts-node: specifier: ^10.9.1 version: 10.9.1(@swc/core@1.3.53)(@types/node@18.15.13)(typescript@5.3.3) + tsx: + specifier: ^4.16.3 + version: 4.16.3 zx: specifier: ^4.3.0 version: 4.3.0 @@ -2093,27 +2093,6 @@ packages: resolution: {integrity: sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==} dev: false - /@esbuild-kit/cjs-loader@2.2.1: - resolution: {integrity: sha512-pq2Z4DcqTBF7y1wQuIzFVqmHJVnmP6hgHEWN2ubPjeG7OzXMZ9NvozW+YA/MIeMdZWp1jcJ/EvXk2+mfEKoCDQ==} - dependencies: - '@esbuild-kit/core-utils': 2.0.2 - get-tsconfig: 4.1.0 - dev: true - - /@esbuild-kit/core-utils@2.0.2: - resolution: {integrity: sha512-clNYQUsqtc36pzW5EufMsahcbLG45EaW3YDyf0DlaS0eCMkDXpxIlHwPC0rndUwG6Ytk9sMSD5k1qHbwYEC/OQ==} - dependencies: - esbuild: 0.14.51 - source-map-support: 0.5.21 - dev: true - - /@esbuild-kit/esm-loader@2.3.1: - resolution: {integrity: sha512-CC0H91Oa02cczLswEoiLowTzWxvnS3tIBGkQa1BnieFK7HHV4whrBFGRlUD9rMHfyyoO55IuOqNujycXX+gI8A==} - dependencies: - '@esbuild-kit/core-utils': 2.0.2 - get-tsconfig: 4.1.0 - dev: true - /@esbuild/aix-ppc64@0.21.4: resolution: {integrity: sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==} engines: {node: '>=12'} @@ -2123,6 +2102,15 @@ packages: dev: false optional: true + /@esbuild/aix-ppc64@0.21.5: + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.16.17: resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} engines: {node: '>=12'} @@ -2150,6 +2138,15 @@ packages: dev: false optional: true + /@esbuild/android-arm64@0.21.5: + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.16.17: resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} engines: {node: '>=12'} @@ -2177,6 +2174,15 @@ packages: dev: false optional: true + /@esbuild/android-arm@0.21.5: + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.16.17: resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} engines: {node: '>=12'} @@ -2204,6 +2210,15 @@ packages: dev: false optional: true + /@esbuild/android-x64@0.21.5: + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.16.17: resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} engines: {node: '>=12'} @@ -2231,6 +2246,15 @@ packages: dev: false optional: true + /@esbuild/darwin-arm64@0.21.5: + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.16.17: resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} engines: {node: '>=12'} @@ -2258,6 +2282,15 @@ packages: dev: false optional: true + /@esbuild/darwin-x64@0.21.5: + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.16.17: resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} engines: {node: '>=12'} @@ -2285,6 +2318,15 @@ packages: dev: false optional: true + /@esbuild/freebsd-arm64@0.21.5: + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.16.17: resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} engines: {node: '>=12'} @@ -2312,6 +2354,15 @@ packages: dev: false optional: true + /@esbuild/freebsd-x64@0.21.5: + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.16.17: resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} engines: {node: '>=12'} @@ -2339,6 +2390,15 @@ packages: dev: false optional: true + /@esbuild/linux-arm64@0.21.5: + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.16.17: resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} engines: {node: '>=12'} @@ -2366,6 +2426,15 @@ packages: dev: false optional: true + /@esbuild/linux-arm@0.21.5: + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.16.17: resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} engines: {node: '>=12'} @@ -2393,6 +2462,15 @@ packages: dev: false optional: true + /@esbuild/linux-ia32@0.21.5: + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.16.17: resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==} engines: {node: '>=12'} @@ -2420,6 +2498,15 @@ packages: dev: false optional: true + /@esbuild/linux-loong64@0.21.5: + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.16.17: resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} engines: {node: '>=12'} @@ -2447,6 +2534,15 @@ packages: dev: false optional: true + /@esbuild/linux-mips64el@0.21.5: + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.16.17: resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} engines: {node: '>=12'} @@ -2474,6 +2570,15 @@ packages: dev: false optional: true + /@esbuild/linux-ppc64@0.21.5: + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.16.17: resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} engines: {node: '>=12'} @@ -2501,6 +2606,15 @@ packages: dev: false optional: true + /@esbuild/linux-riscv64@0.21.5: + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.16.17: resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} engines: {node: '>=12'} @@ -2528,6 +2642,15 @@ packages: dev: false optional: true + /@esbuild/linux-s390x@0.21.5: + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.16.17: resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} engines: {node: '>=12'} @@ -2555,6 +2678,15 @@ packages: dev: false optional: true + /@esbuild/linux-x64@0.21.5: + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.16.17: resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} engines: {node: '>=12'} @@ -2582,6 +2714,15 @@ packages: dev: false optional: true + /@esbuild/netbsd-x64@0.21.5: + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.16.17: resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} engines: {node: '>=12'} @@ -2609,6 +2750,15 @@ packages: dev: false optional: true + /@esbuild/openbsd-x64@0.21.5: + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.16.17: resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} engines: {node: '>=12'} @@ -2636,6 +2786,15 @@ packages: dev: false optional: true + /@esbuild/sunos-x64@0.21.5: + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.16.17: resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} engines: {node: '>=12'} @@ -2663,6 +2822,15 @@ packages: dev: false optional: true + /@esbuild/win32-arm64@0.21.5: + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.16.17: resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} engines: {node: '>=12'} @@ -2690,6 +2858,15 @@ packages: dev: false optional: true + /@esbuild/win32-ia32@0.21.5: + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.16.17: resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} engines: {node: '>=12'} @@ -2717,6 +2894,15 @@ packages: dev: false optional: true + /@esbuild/win32-x64@0.21.5: + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} engines: {node: '>=8'} @@ -3572,24 +3758,24 @@ packages: dependencies: '@types/yargs-parser': 21.0.0 - /@umijs/babel-preset-umi@4.3.5: - resolution: {integrity: sha512-9T6NpVBOlQ+NIQL4w4T6WF6LCSsrjuhMScydV4jLDhzqGlTUMi6N/oBJYWCv6RYmccFY/wWptkmvhpY/loXx3A==} + /@umijs/babel-preset-umi@4.3.10: + resolution: {integrity: sha512-r+1KFQOZr5Ve6bUS0g757ODQ/AQlpxXpAJ29/PkKbaMzdtvovs4pO+VhI5n0UGeGcXuwq3RTLubmmJYvrwmJcw==} dependencies: '@babel/runtime': 7.23.6 '@bloomberg/record-tuple-polyfill': 0.0.4 - '@umijs/bundler-utils': 4.3.5 - '@umijs/utils': 4.3.5 + '@umijs/bundler-utils': 4.3.10 + '@umijs/utils': 4.3.10 core-js: 3.34.0 transitivePeerDependencies: - supports-color dev: false - /@umijs/bundler-esbuild@4.3.5: - resolution: {integrity: sha512-w+hdLemer5Kl6ZtPD+tXtpK8/nJQZkyH2LOQo2EWIrQVCzSJ7e4GNiFdUi4Mau/ADCx96Jxv5Oyk34dV9AvT8A==} + /@umijs/bundler-esbuild@4.3.10: + resolution: {integrity: sha512-C/KRa+uROYM8O/P6PewedIfnH9PpJS3XkiApolSnAQTiHoW+aOpQxNJaFVRHPQCScJPh8BPer6ayn0DyxvwxZQ==} hasBin: true dependencies: - '@umijs/bundler-utils': 4.3.5 - '@umijs/utils': 4.3.5 + '@umijs/bundler-utils': 4.3.10 + '@umijs/utils': 4.3.10 enhanced-resolve: 5.9.3 postcss: 8.4.31 postcss-flexbugs-fixes: 5.0.2(postcss@8.4.31) @@ -3610,10 +3796,10 @@ packages: - supports-color dev: true - /@umijs/bundler-utils@4.3.5: - resolution: {integrity: sha512-/Uel6YJCeBcLNdlTVgfMz92X+Q0I9qxdi2bfeeac9OCyLwdTJTWBlyvQ8mVAJfGYWVAKQDinWjy6JSVuBYRq2Q==} + /@umijs/bundler-utils@4.3.10: + resolution: {integrity: sha512-vJi3Crww0sJlPqRotDG61fUNIaN2psaHs4wnf2NSwOFrFM8pEGjxdUO5rD3ai7KAoyTQ48wuPq/1+B2MtFAHpA==} dependencies: - '@umijs/utils': 4.3.5 + '@umijs/utils': 4.3.10 esbuild: 0.21.4 regenerate: 1.4.2 regenerate-unicode-properties: 10.1.1 @@ -3622,20 +3808,20 @@ packages: - supports-color dev: false - /@umijs/bundler-webpack@4.3.5(typescript@5.3.3)(webpack@5.80.0): - resolution: {integrity: sha512-5LE9KpsIrJW2Z2R16wP19LMMt3uxLvRU6RUU/J7qQj7Sk3kF6nVswVrpnzO34rPKa1dwXebSWvD8GQcU592W8g==} + /@umijs/bundler-webpack@4.3.10(typescript@5.3.3)(webpack@5.80.0): + resolution: {integrity: sha512-420jiMsaptF4bnUsBQMm8qZ8l5DLPbX4OJZKwjjXA34h/3+MV7XBXPQ95n2npqC3CuwOrA58rCp0x/dl0/XNCA==} hasBin: true dependencies: '@svgr/core': 6.5.1 '@svgr/plugin-jsx': 6.5.1(@svgr/core@6.5.1) '@svgr/plugin-svgo': 6.5.1(@svgr/core@6.5.1) '@types/hapi__joi': 17.1.9 - '@umijs/babel-preset-umi': 4.3.5 - '@umijs/bundler-utils': 4.3.5 + '@umijs/babel-preset-umi': 4.3.10 + '@umijs/bundler-utils': 4.3.10 '@umijs/case-sensitive-paths-webpack-plugin': 1.0.1 - '@umijs/mfsu': 4.3.5 + '@umijs/mfsu': 4.3.10 '@umijs/react-refresh-webpack-plugin': 0.5.11(react-refresh@0.14.0)(webpack@5.80.0) - '@umijs/utils': 4.3.5 + '@umijs/utils': 4.3.10 cors: 2.8.5 css-loader: 6.7.1(webpack@5.80.0) es5-imcompatible-versions: 0.1.80 @@ -3663,21 +3849,21 @@ packages: resolution: {integrity: sha512-kDKJ8yTarxwxGJDInG33hOpaQRZ//XpNuuznQ/1Mscypw6kappzFmrBr2dOYave++K7JHouoANF354UpbEQw0Q==} dev: false - /@umijs/core@4.3.5: - resolution: {integrity: sha512-QAFIqGeW1PRrWT0aIOkp+w6A2EzbiDAKJjGPM2lzg15dOB3/oLv8EGTb+3+13h54vQWIjjCrAWUY+4dJvsiYZA==} + /@umijs/core@4.3.10: + resolution: {integrity: sha512-Z6ExTE305eBZOImww1ivM61xcG2EVRupgtrB9rgwQXq9HdAwERIcUSMNZr+KnawAnFuFLPKds1ghC51oea4jeg==} dependencies: - '@umijs/bundler-utils': 4.3.5 - '@umijs/utils': 4.3.5 + '@umijs/bundler-utils': 4.3.10 + '@umijs/utils': 4.3.10 transitivePeerDependencies: - supports-color dev: false - /@umijs/mfsu@4.3.5: - resolution: {integrity: sha512-ZDmzu+cz2s9ac4NCFx5KC3SwwEd2z35cDd48EmY5fEt3Vb9YD+dQfukVyR7GLP11wNRNCZRVoiA494dt9IGuVQ==} + /@umijs/mfsu@4.3.10: + resolution: {integrity: sha512-+/tKySFy+w3td10afBIvtDsDoSlczdq8949zfXqYLFaWDs9VW8gvGEVyXl1JsQqozMVZtdnjDIF3yrgW/PJfYg==} dependencies: - '@umijs/bundler-esbuild': 4.3.5 - '@umijs/bundler-utils': 4.3.5 - '@umijs/utils': 4.3.5 + '@umijs/bundler-esbuild': 4.3.10 + '@umijs/bundler-utils': 4.3.10 + '@umijs/utils': 4.3.10 enhanced-resolve: 5.9.3 is-equal: 1.6.4 transitivePeerDependencies: @@ -3753,8 +3939,8 @@ packages: pino: 7.11.0 dev: true - /@umijs/utils@4.3.5: - resolution: {integrity: sha512-Q01DjdL2ObiPinTmMaY0wJcR3hCWuakYPj5j2ByxEZfROmbEF9lTmLNdNEdoRPaJKW84+7/zsrZrkg7GmPV85g==} + /@umijs/utils@4.3.10: + resolution: {integrity: sha512-gby6L7gXdOm8otetPCiIUX2vq0erAmfi14I6SHcstKDtd8Ndd33lRGVMMV8djODEBFF9r525Hsp92hopyaWH0Q==} dependencies: chokidar: 3.5.3 pino: 7.11.0 @@ -4518,7 +4704,7 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 /chrome-trace-event@1.0.3: resolution: {integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==} @@ -5267,214 +5453,6 @@ packages: resolution: {integrity: sha512-i3Uc3hzDalYmBMwX3Z5LDPbuoPqFCR7SCo8tXLU1w7UvR8Awr3Hgfdi7L/bsqj2mMCGqkCxu6tx7VdZz7hW5CQ==} dev: false - /esbuild-android-64@0.14.51: - resolution: {integrity: sha512-6FOuKTHnC86dtrKDmdSj2CkcKF8PnqkaIXqvgydqfJmqBazCPdw+relrMlhGjkvVdiiGV70rpdnyFmA65ekBCQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-android-arm64@0.14.51: - resolution: {integrity: sha512-vBtp//5VVkZWmYYvHsqBRCMMi1MzKuMIn5XDScmnykMTu9+TD9v0NMEDqQxvtFToeYmojdo5UCV2vzMQWJcJ4A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-64@0.14.51: - resolution: {integrity: sha512-YFmXPIOvuagDcwCejMRtCDjgPfnDu+bNeh5FU2Ryi68ADDVlWEpbtpAbrtf/lvFTWPexbgyKgzppNgsmLPr8PA==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-arm64@0.14.51: - resolution: {integrity: sha512-juYD0QnSKwAMfzwKdIF6YbueXzS6N7y4GXPDeDkApz/1RzlT42mvX9jgNmyOlWKN7YzQAYbcUEJmZJYQGdf2ow==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-64@0.14.51: - resolution: {integrity: sha512-cLEI/aXjb6vo5O2Y8rvVSQ7smgLldwYY5xMxqh/dQGfWO+R1NJOFsiax3IS4Ng300SVp7Gz3czxT6d6qf2cw0g==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-arm64@0.14.51: - resolution: {integrity: sha512-TcWVw/rCL2F+jUgRkgLa3qltd5gzKjIMGhkVybkjk6PJadYInPtgtUBp1/hG+mxyigaT7ib+od1Xb84b+L+1Mg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-32@0.14.51: - resolution: {integrity: sha512-RFqpyC5ChyWrjx8Xj2K0EC1aN0A37H6OJfmUXIASEqJoHcntuV3j2Efr9RNmUhMfNE6yEj2VpYuDteZLGDMr0w==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-64@0.14.51: - resolution: {integrity: sha512-dxjhrqo5i7Rq6DXwz5v+MEHVs9VNFItJmHBe1CxROWNf4miOGoQhqSG8StStbDkQ1Mtobg6ng+4fwByOhoQoeA==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm64@0.14.51: - resolution: {integrity: sha512-D9rFxGutoqQX3xJPxqd6o+kvYKeIbM0ifW2y0bgKk5HPgQQOo2k9/2Vpto3ybGYaFPCE5qTGtqQta9PoP6ZEzw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm@0.14.51: - resolution: {integrity: sha512-LsJynDxYF6Neg7ZC7748yweCDD+N8ByCv22/7IAZglIEniEkqdF4HCaa49JNDLw1UQGlYuhOB8ZT/MmcSWzcWg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-mips64le@0.14.51: - resolution: {integrity: sha512-vS54wQjy4IinLSlb5EIlLoln8buh1yDgliP4CuEHumrPk4PvvP4kTRIG4SzMXm6t19N0rIfT4bNdAxzJLg2k6A==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-ppc64le@0.14.51: - resolution: {integrity: sha512-xcdd62Y3VfGoyphNP/aIV9LP+RzFw5M5Z7ja+zdpQHHvokJM7d0rlDRMN+iSSwvUymQkqZO+G/xjb4/75du8BQ==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-riscv64@0.14.51: - resolution: {integrity: sha512-syXHGak9wkAnFz0gMmRBoy44JV0rp4kVCEA36P5MCeZcxFq8+fllBC2t6sKI23w3qd8Vwo9pTADCgjTSf3L3rA==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-s390x@0.14.51: - resolution: {integrity: sha512-kFAJY3dv+Wq8o28K/C7xkZk/X34rgTwhknSsElIqoEo8armCOjMJ6NsMxm48KaWY2h2RUYGtQmr+RGuUPKBhyw==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-netbsd-64@0.14.51: - resolution: {integrity: sha512-ZZBI7qrR1FevdPBVHz/1GSk1x5GDL/iy42Zy8+neEm/HA7ma+hH/bwPEjeHXKWUDvM36CZpSL/fn1/y9/Hb+1A==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-openbsd-64@0.14.51: - resolution: {integrity: sha512-7R1/p39M+LSVQVgDVlcY1KKm6kFKjERSX1lipMG51NPcspJD1tmiZSmmBXoY5jhHIu6JL1QkFDTx94gMYK6vfA==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-sunos-64@0.14.51: - resolution: {integrity: sha512-HoHaCswHxLEYN8eBTtyO0bFEWvA3Kdb++hSQ/lLG7TyKF69TeSG0RNoBRAs45x/oCeWaTDntEZlYwAfQlhEtJA==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-32@0.14.51: - resolution: {integrity: sha512-4rtwSAM35A07CBt1/X8RWieDj3ZUHQqUOaEo5ZBs69rt5WAFjP4aqCIobdqOy4FdhYw1yF8Z0xFBTyc9lgPtEg==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-64@0.14.51: - resolution: {integrity: sha512-HoN/5HGRXJpWODprGCgKbdMvrC3A2gqvzewu2eECRw2sYxOUoh2TV1tS+G7bHNapPGI79woQJGV6pFH7GH7qnA==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-arm64@0.14.51: - resolution: {integrity: sha512-JQDqPjuOH7o+BsKMSddMfmVJXrnYZxXDHsoLHc0xgmAZkOOCflRmC43q31pk79F9xuyWY45jDBPolb5ZgGOf9g==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild@0.14.51: - resolution: {integrity: sha512-+CvnDitD7Q5sT7F+FM65sWkF8wJRf+j9fPcprxYV4j+ohmzVj2W7caUqH2s5kCaCJAfcAICjSlKhDCcvDpU7nw==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - esbuild-android-64: 0.14.51 - esbuild-android-arm64: 0.14.51 - esbuild-darwin-64: 0.14.51 - esbuild-darwin-arm64: 0.14.51 - esbuild-freebsd-64: 0.14.51 - esbuild-freebsd-arm64: 0.14.51 - esbuild-linux-32: 0.14.51 - esbuild-linux-64: 0.14.51 - esbuild-linux-arm: 0.14.51 - esbuild-linux-arm64: 0.14.51 - esbuild-linux-mips64le: 0.14.51 - esbuild-linux-ppc64le: 0.14.51 - esbuild-linux-riscv64: 0.14.51 - esbuild-linux-s390x: 0.14.51 - esbuild-netbsd-64: 0.14.51 - esbuild-openbsd-64: 0.14.51 - esbuild-sunos-64: 0.14.51 - esbuild-windows-32: 0.14.51 - esbuild-windows-64: 0.14.51 - esbuild-windows-arm64: 0.14.51 - dev: true - /esbuild@0.16.17: resolution: {integrity: sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==} engines: {node: '>=12'} @@ -5566,6 +5544,37 @@ packages: '@esbuild/win32-x64': 0.21.4 dev: false + /esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -5600,13 +5609,6 @@ packages: estraverse: 4.3.0 dev: false - /esno@0.16.3: - resolution: {integrity: sha512-6slSBEV1lMKcX13DBifvnDFpNno5WXhw4j/ff7RI0y51BZiDqEe5dNhhjhIQ3iCOQuzsm2MbVzmwqbN78BBhPg==} - hasBin: true - dependencies: - tsx: 3.6.0 - dev: true - /esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} @@ -5878,8 +5880,8 @@ packages: /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -5937,8 +5939,10 @@ packages: get-intrinsic: 1.1.2 dev: false - /get-tsconfig@4.1.0: - resolution: {integrity: sha512-bhshxJhpfmeQ8x4fAvDqJV2VfGp5TfHdLpmBpNZZhMoVyfIrOippBW4mayC3DT9Sxuhcyl56Efw61qL28hG4EQ==} + /get-tsconfig@4.7.6: + resolution: {integrity: sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==} + dependencies: + resolve-pkg-maps: 1.0.0 dev: true /git-hooks-list@3.1.0: @@ -6781,7 +6785,7 @@ packages: micromatch: 4.0.5 walker: 1.0.8 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /jest-haste-map@29.5.0: @@ -6800,7 +6804,7 @@ packages: micromatch: 4.0.5 walker: 1.0.8 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /jest-jasmine2@27.5.1: @@ -8859,6 +8863,10 @@ packages: global-dirs: 0.1.1 dev: true + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve.exports@1.1.0: resolution: {integrity: sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==} engines: {node: '>=10'} @@ -9643,19 +9651,19 @@ packages: /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} - /tsx@3.6.0: - resolution: {integrity: sha512-XzqSxPmyJnI7ZtEX/CLE/CSDkqbL7dK4jwtJRIZpV0EhCxWqtb1OqJPlUc4CVS3/MFdpt8ZxLpvPFohWRTHbzw==} + /tsx@4.16.3: + resolution: {integrity: sha512-MP8AEUxVnboD2rCC6kDLxnpDBNWN9k3BSVU/0/nNxgm70bPBnfn+yCKcnOsIVPQwdkbKYoFOlKjjWZWJ2XCXUg==} + engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@esbuild-kit/cjs-loader': 2.2.1 - '@esbuild-kit/core-utils': 2.0.2 - '@esbuild-kit/esm-loader': 2.3.1 + esbuild: 0.21.5 + get-tsconfig: 4.7.6 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /tty-browserify@0.0.0: - resolution: {integrity: sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=} + resolution: {integrity: sha512-JVa5ijo+j/sOoHGjw0sxw734b1LhBkQ3bvUGNdxnVXDCX81Yx7TFgnZygxrIIWn23hbfTaMYLwRmAxFyDuFmIw==} dev: false /type-check@0.3.2: diff --git a/src/builder/bundle/index.ts b/src/builder/bundle/index.ts index 4cd7ed10..548a2d54 100644 --- a/src/builder/bundle/index.ts +++ b/src/builder/bundle/index.ts @@ -28,159 +28,162 @@ interface IBundleOpts { configProvider: BundleConfigProvider; buildDependencies?: string[]; watch?: boolean; + incremental?: boolean; } -function bundle(opts: Omit): Promise; +function bundle(opts: Omit): Promise; function bundle(opts: IBundleOpts): Promise; async function bundle(opts: IBundleOpts): Promise { const enableCache = process.env.FATHER_CACHE !== 'none'; const closeHandlers: webpack.Watching['close'][] = []; - for (let i = 0; i < opts.configProvider.configs.length; i += 1) { - const config = opts.configProvider.configs[i]; - const { plugins: extraPostCSSPlugins, ...postcssLoader } = - config.postcssOptions || {}; - const babelSCOpts = getBabelStyledComponentsOpts(opts.configProvider.pkg); - // workaround for combine continuous onBuildComplete log in watch mode - const logStatus = lodash.debounce( - () => - logger.info( - `Bundle from ${chalk.yellow(config.entry)} to ${chalk.yellow( - path.join(config.output.path, config.output.filename), - )}`, - ), - 100, - { leading: true, trailing: false }, - ); - - // log for normal build - !opts.watch && logStatus(); - await bundler.build({ - cwd: opts.cwd, - watch: opts.watch, - config: { - alias: config.alias, - autoprefixer: config.autoprefixer, - chainWebpack: config.chainWebpack, - define: config.define, - devtool: config.sourcemap && 'source-map', - externals: config.externals, - outputPath: config.output.path, - - // postcss config - extraPostCSSPlugins, - postcssLoader, - - ...(config.extractCSS !== false ? {} : { styleLoader: {} }), - - // less config - theme: config.theme, - - // compatible with IE11 by default - targets: getBundleTargets(config), - jsMinifier: JSMinifier.terser, - cssMinifier: CSSMinifier.cssnano, - extraBabelIncludes: [/node_modules/], - - // set cache parent directory, will join it with `bundler-webpack` - // ref: https://github.com/umijs/umi/blob/8dad8c5af0197cd62db11f4b4c85d6bc1db57db1/packages/bundler-webpack/src/build.ts#L32 - cacheDirectoryPath: getCachePath(), - }, - entry: { - [path.parse(config.output.filename).name]: path.join( - opts.cwd, - config.entry, - ), - }, - babelPreset: [ - require.resolve('@umijs/babel-preset-umi'), - { - presetEnv: { - targets: getBundleTargets(config), - }, - presetReact: getBabelPresetReactOpts( - opts.configProvider.pkg, + if (!opts.incremental) { + for (let i = 0; i < opts.configProvider.configs.length; i += 1) { + const config = opts.configProvider.configs[i]; + const { plugins: extraPostCSSPlugins, ...postcssLoader } = + config.postcssOptions || {}; + const babelSCOpts = getBabelStyledComponentsOpts(opts.configProvider.pkg); + // workaround for combine continuous onBuildComplete log in watch mode + const logStatus = lodash.debounce( + () => + logger.info( + `Bundle from ${chalk.yellow(config.entry)} to ${chalk.yellow( + path.join(config.output.path, config.output.filename), + )}`, + ), + 100, + { leading: true, trailing: false }, + ); + + // log for normal build + !opts.watch && logStatus(); + await bundler.build({ + cwd: opts.cwd, + watch: opts.watch, + config: { + alias: config.alias, + autoprefixer: config.autoprefixer, + chainWebpack: config.chainWebpack, + define: config.define, + devtool: config.sourcemap && 'source-map', + externals: config.externals, + outputPath: config.output.path, + + // postcss config + extraPostCSSPlugins, + postcssLoader, + + ...(config.extractCSS !== false ? {} : { styleLoader: {} }), + + // less config + theme: config.theme, + + // compatible with IE11 by default + targets: getBundleTargets(config), + jsMinifier: JSMinifier.terser, + cssMinifier: CSSMinifier.cssnano, + extraBabelIncludes: [/node_modules/], + + // set cache parent directory, will join it with `bundler-webpack` + // ref: https://github.com/umijs/umi/blob/8dad8c5af0197cd62db11f4b4c85d6bc1db57db1/packages/bundler-webpack/src/build.ts#L32 + cacheDirectoryPath: getCachePath(), + }, + entry: { + [path.parse(config.output.filename).name]: path.join( opts.cwd, + config.entry, ), - presetTypeScript: {}, - pluginTransformRuntime: {}, - pluginLockCoreJS: {}, - pluginDynamicImportNode: false, }, - ], - beforeBabelPlugins: [ - require.resolve('babel-plugin-dynamic-import-node'), - ...(babelSCOpts - ? [[require.resolve('babel-plugin-styled-components'), babelSCOpts]] - : []), - ], - extraBabelPresets: config.extraBabelPresets, - extraBabelPlugins: config.extraBabelPlugins, - - // configure library related options - chainWebpack(memo: any) { - memo.output.libraryTarget('umd'); - - if (config?.name) { - memo.output.library(config.name); - } - - // modify webpack target - if (config.platform === 'node') { - memo.target('node'); - } - - if (enableCache) { - // use father version as cache version - memo.merge({ - cache: { version: require('../../../package.json').version }, - }); - } - - // also bundle svg as asset, because father force disable svgr - const imgRule = memo.module.rule('asset').oneOf('image'); - - imgRule.test( - new RegExp(imgRule.get('test').source.replace(/(\|png)/, '$1|svg')), - ); + babelPreset: [ + require.resolve('@umijs/babel-preset-umi'), + { + presetEnv: { + targets: getBundleTargets(config), + }, + presetReact: getBabelPresetReactOpts( + opts.configProvider.pkg, + opts.cwd, + ), + presetTypeScript: {}, + pluginTransformRuntime: {}, + pluginLockCoreJS: {}, + pluginDynamicImportNode: false, + }, + ], + beforeBabelPlugins: [ + require.resolve('babel-plugin-dynamic-import-node'), + ...(babelSCOpts + ? [[require.resolve('babel-plugin-styled-components'), babelSCOpts]] + : []), + ], + extraBabelPresets: config.extraBabelPresets, + extraBabelPlugins: config.extraBabelPlugins, + + // configure library related options + chainWebpack(memo: any) { + memo.output.libraryTarget('umd'); + + if (config?.name) { + memo.output.library(config.name); + } - // disable progress bar - memo.plugins.delete('progress-plugin'); + // modify webpack target + if (config.platform === 'node') { + memo.target('node'); + } - // auto bump analyze port - /* istanbul ignore if -- @preserve */ - if (process.env.ANALYZE) { - memo.plugin('webpack-bundle-analyzer').tap((args: any) => { - args[0].analyzerPort += i; + if (enableCache) { + // use father version as cache version + memo.merge({ + cache: { version: require('../../../package.json').version }, + }); + } - return args; - }); - } + // also bundle svg as asset, because father force disable svgr + const imgRule = memo.module.rule('asset').oneOf('image'); - return memo; - }, + imgRule.test( + new RegExp(imgRule.get('test').source.replace(/(\|png)/, '$1|svg')), + ); + + // disable progress bar + memo.plugins.delete('progress-plugin'); + + // auto bump analyze port + /* istanbul ignore if -- @preserve */ + if (process.env.ANALYZE) { + memo.plugin('webpack-bundle-analyzer').tap((args: any) => { + args[0].analyzerPort += i; + + return args; + }); + } + + return memo; + }, - // enable webpack persistent cache - ...(enableCache - ? { + // enable webpack persistent cache + ...(enableCache + ? { cache: { buildDependencies: opts.buildDependencies, }, } - : {}), + : {}), - // collect close handlers for watch mode - ...(opts.watch - ? { + // collect close handlers for watch mode + ...(opts.watch + ? { onBuildComplete({ isFirstCompile, close }: any) { if (isFirstCompile) closeHandlers.push(close); // log for watch mode else logStatus(); }, } - : {}), - disableCopy: true, - }); + : {}), + disableCopy: true, + }); + } } // return watching closer for watch mode diff --git a/src/builder/bundless/index.ts b/src/builder/bundless/index.ts index 9f781990..a6b02117 100644 --- a/src/builder/bundless/index.ts +++ b/src/builder/bundless/index.ts @@ -39,6 +39,7 @@ async function transformFiles( cwd: string; configProvider: BundlessConfigProvider; watch?: true; + incremental?: boolean; }, ) { try { @@ -102,8 +103,7 @@ async function transformFiles( } logger.quietExpect.event( - `Bundless ${chalk.gray(item)} to ${chalk.gray(itemDistPath)}${ - result?.options.declaration ? ' (with declaration)' : '' + `Bundless ${chalk.gray(item)} to ${chalk.gray(itemDistPath)}${result?.options.declaration ? ' (with declaration)' : '' }`, ); count += 1; @@ -164,18 +164,20 @@ async function bundless( logger.info(statusText); const startTime = Date.now(); - const matches = glob.sync(`${opts.configProvider.input}/**`, { - cwd: opts.cwd, - ignore: DEFAULT_BUNDLESS_IGNORES, - nodir: true, - }); - const count = await transformFiles(matches, opts); + let count = 0; + if (!opts.incremental) { + const matches = glob.sync(`${opts.configProvider.input}/**`, { + cwd: opts.cwd, + ignore: DEFAULT_BUNDLESS_IGNORES, + nodir: true, + }); + count = await transformFiles(matches, opts); + } if (!opts.watch) { // output result for normal mode logger.quietExpect.event( - `Transformed successfully in ${ - Date.now() - startTime + `Transformed successfully in ${Date.now() - startTime } ms (${count} files)`, ); } else { @@ -227,10 +229,10 @@ async function bundless( // TODO: collect real emit files const relatedFiles = isTsFile ? [ - replacePathExt(fileDistAbsPath, '.js'), - replacePathExt(fileDistAbsPath, '.d.ts'), - replacePathExt(fileDistAbsPath, '.d.ts.map'), - ] + replacePathExt(fileDistAbsPath, '.js'), + replacePathExt(fileDistAbsPath, '.d.ts'), + replacePathExt(fileDistAbsPath, '.d.ts.map'), + ] : [fileDistAbsPath]; const relatedMainFile = relatedFiles.find((item) => fs.existsSync(item), diff --git a/src/builder/index.ts b/src/builder/index.ts index 35a17650..ee912a59 100644 --- a/src/builder/index.ts +++ b/src/builder/index.ts @@ -1,10 +1,10 @@ import { chokidar, rimraf } from '@umijs/utils'; import path from 'path'; import { IApi, IFatherConfig } from '../types'; +import { logger } from '../utils'; import bundle, { type IBundleWatcher } from './bundle'; import bundless from './bundless'; import { createConfigProviders } from './config'; -import { logger } from '../utils'; function getProviderOutputs( providers: ReturnType, @@ -41,11 +41,11 @@ interface IWatchBuilderResult { // overload normal/watch mode function builder(opts: IBuilderOpts): Promise; function builder( - opts: IBuilderOpts & { watch: true }, + opts: IBuilderOpts & { watch: true; incremental?: boolean }, ): Promise; async function builder( - opts: IBuilderOpts & { watch?: true }, + opts: IBuilderOpts & { watch?: true; incremental?: boolean }, ): Promise { const configProviders = createConfigProviders( opts.userConfig, @@ -55,7 +55,7 @@ async function builder( const outputs = getProviderOutputs(configProviders); const watchers: (chokidar.FSWatcher | IBundleWatcher)[] = []; - if (opts.clean !== false) { + if (opts.clean !== false && !opts.incremental) { // clean output directories logger.quietExpect.info('Clean output directories'); outputs.forEach((output) => { @@ -69,6 +69,7 @@ async function builder( configProvider: configProviders.bundle, buildDependencies: opts.buildDependencies, watch: opts.watch, + incremental: opts.incremental, }); opts.watch && watchers.push(watcher); @@ -79,6 +80,7 @@ async function builder( cwd: opts.cwd, configProvider: configProviders.bundless.esm, watch: opts.watch, + incremental: opts.incremental, }); opts.watch && watchers.push(watcher); @@ -89,6 +91,7 @@ async function builder( cwd: opts.cwd, configProvider: configProviders.bundless.cjs, watch: opts.watch, + incremental: opts.incremental, }); opts.watch && watchers.push(watcher); diff --git a/src/commands/dev.ts b/src/commands/dev.ts index bdd680e5..26633828 100644 --- a/src/commands/dev.ts +++ b/src/commands/dev.ts @@ -16,6 +16,7 @@ export default (api: IApi) => { cwd: api.cwd, pkg: api.pkg, watch: true, + incremental: args.incremental, clean: args.clean, });