提交 13961ec4 编写于 作者: fxy060608's avatar fxy060608

build(deps): bump vite from 2.6.11 to 2.6.13

上级 e25ca33e
......@@ -96,7 +96,7 @@
"semver": "^7.3.4",
"ts-jest": "^27.0.3",
"typescript": "^4.4.3",
"vite": "^2.6.11",
"vite": "^2.6.13",
"vue": "^3.2.20",
"yorkie": "^2.0.0"
},
......
......@@ -32,6 +32,6 @@
"compression": "^1.7.4",
"cypress": "^7.3.0",
"serve-static": "^1.14.1",
"vite": "^2.6.11"
"vite": "^2.6.13"
}
}
......@@ -2,22 +2,22 @@
# yarn lockfile v1
"@babel/helper-validator-identifier@^7.14.9":
"@babel/helper-validator-identifier@^7.15.7":
version "7.15.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389"
integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==
"@babel/parser@^7.15.0":
version "7.15.8"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016"
integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==
version "7.16.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.0.tgz#cf147d7ada0a3655e79bf4b08ee846f00a00a295"
integrity sha512-TEHWXf0xxpi9wKVyBCmRcSSDjbJ/cl6LUdlbYUHEaNQUJGhreJbZrXT6sR4+fZLxVUJqNRB4KyOvjuy/D9009A==
"@babel/types@^7.15.0":
version "7.15.6"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f"
integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==
version "7.16.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.0.tgz#db3b313804f96aadd0b776c4823e127ad67289ba"
integrity sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==
dependencies:
"@babel/helper-validator-identifier" "^7.14.9"
"@babel/helper-validator-identifier" "^7.15.7"
to-fast-properties "^2.0.0"
"@cypress/request@^2.88.5":
......@@ -826,113 +826,113 @@ es-module-lexer@^0.9.3:
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==
esbuild-android-arm64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.13.10.tgz#3545c71bf01e8b36535681078cdb0191c8654452"
integrity sha512-1sCdVAq64yMp2Uhlu+97/enFxpmrj31QHtThz7K+/QGjbHa7JZdBdBsZCzWJuntKHZ+EU178tHYkvjaI9z5sGg==
esbuild-darwin-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.13.10.tgz#143e34d7f5d3860cc681c64c860f531e60496b5b"
integrity sha512-XlL+BYZ2h9cz3opHfFgSHGA+iy/mljBFIRU9q++f9SiBXEZTb4gTW/IENAD1l9oKH0FdO9rUpyAfV+lM4uAxrg==
esbuild-darwin-arm64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.10.tgz#456a044b789d5d256af8d264314da5217ca9fcd1"
integrity sha512-RZMMqMTyActMrXKkW71IQO8B0tyQm0Bm+ZJQWNaHJchL5LlqazJi7rriwSocP+sKLszHhsyTEBBh6qPdw5g5yQ==
esbuild-freebsd-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.10.tgz#dcd829a4a95226716faae8a2f378f08688f921b6"
integrity sha512-pf4BEN9reF3jvZEZdxljVgOv5JS4kuYFCI78xk+2HWustbLvTP0b9XXfWI/OD0ZLWbyLYZYIA+VbVe4tdAklig==
esbuild-freebsd-arm64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.10.tgz#116c254b3eb1b9d1dd6f12e0271967de4512ca09"
integrity sha512-j9PUcuNWmlxr4/ry4dK/s6zKh42Jhh/N5qnAAj7tx3gMbkIHW0JBoVSbbgp97p88X9xgKbXx4lG2sJDhDWmsYQ==
esbuild-linux-32@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.13.10.tgz#131971622c38e5aa014303a494a1b5c3cc90f2be"
integrity sha512-imtdHG5ru0xUUXuc2ofdtyw0fWlHYXV7JjF7oZHgmn0b+B4o4Nr6ZON3xxoo1IP8wIekW+7b9exIf/MYq0QV7w==
esbuild-linux-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.13.10.tgz#48826c388abd5dde3fc098a8ef38d8b548674f93"
integrity sha512-O7fzQIH2e7GC98dvoTH0rad5BVLm9yU3cRWfEmryCEIFTwbNEWCEWOfsePuoGOHRtSwoVY1hPc21CJE4/9rWxQ==
esbuild-linux-arm64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.10.tgz#0be9ffc92e30641869c7fbca0ec5d30fa8cbddd6"
integrity sha512-bkGxN67S2n0PF4zhh87/92kBTsH2xXLuH6T5omReKhpXdJZF5SVDSk5XU/nngARzE+e6QK6isK060Dr5uobzNw==
esbuild-linux-arm@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.13.10.tgz#8c15bcaa41a022c834f049a71a7d1fbade507532"
integrity sha512-R2Jij4A0K8BcmBehvQeUteQEcf24Y2YZ6mizlNFuJOBPxe3vZNmkZ4mCE7Pf1tbcqA65qZx8J3WSHeGJl9EsJA==
esbuild-linux-mips64le@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.10.tgz#5bb33a2bc82e9c78ed724f345a8359610ddc9695"
integrity sha512-UDNO5snJYOLWrA2uOUxM/PVbzzh2TR7Zf2i8zCCuFlYgvAb/81XO+Tasp3YAElDpp4VGqqcpBXLtofa9nrnJGA==
esbuild-linux-ppc64le@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.10.tgz#18703cd0d52447d97486735b8e79fba7d81eac65"
integrity sha512-xu6J9rMWu1TcEGuEmoc8gsTrJCEPsf+QtxK4IiUZNde9r4Q4nlRVah4JVZP3hJapZgZJcxsse0XiKXh1UFdOeA==
esbuild-netbsd-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.10.tgz#3ecb06158aadb5b7396a5b7632069181b1591c56"
integrity sha512-d+Gr0ScMC2J83Bfx/ZvJHK0UAEMncctwgjRth9d4zppYGLk/xMfFKxv5z1ib8yZpQThafq8aPm8AqmFIJrEesw==
esbuild-openbsd-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.10.tgz#3a6950b1d955de921ac52f7af0b4865e89d6e4f1"
integrity sha512-OuCYc+bNKumBvxflga+nFzZvxsgmWQW+z4rMGIjM5XIW0nNbGgRc5p/0PSDv0rTdxAmwCpV69fezal0xjrDaaA==
esbuild-sunos-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.13.10.tgz#ad407f721a8b5727fca31958b5eab1b0232e2d73"
integrity sha512-gUkgivZK11bD56wDoLsnYrsOHD/zHzzLSdqKcIl3wRMulfHpRBpoX8gL0dbWr+8N9c+1HDdbNdvxSRmZ4RCVwg==
esbuild-windows-32@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.13.10.tgz#ddaaa0b6e172df6512edc7a91bd2456615cfa914"
integrity sha512-C1xJ54E56dGWRaYcTnRy7amVZ9n1/D/D2/qVw7e5EtS7p+Fv/yZxxgqyb1hMGKXgtFYX4jMpU5eWBF/AsYrn+A==
esbuild-windows-64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.13.10.tgz#93d861abf36bf71b6e61f5cbd2e42762ce5cb83a"
integrity sha512-6+EXEXopEs3SvPFAHcps2Krp/FvqXXsOQV33cInmyilb0ZBEQew4MIoZtMIyB3YXoV6//dl3i6YbPrFZaWEinQ==
esbuild-windows-arm64@0.13.10:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.10.tgz#85a2d338aaa8b0cd1d8ecbe9150def9a608e8947"
integrity sha512-xTqM/XKhORo6u9S5I0dNJWEdWoemFjogLUTVLkQMVyUV3ZuMChahVA+bCqKHdyX55pCFxD/8v2fm3/sfFMWN+g==
esbuild-android-arm64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.13.12.tgz#e1f199dc05405cdc6670c00fb6c793822bf8ae4c"
integrity sha512-TSVZVrb4EIXz6KaYjXfTzPyyRpXV5zgYIADXtQsIenjZ78myvDGaPi11o4ZSaHIwFHsuwkB6ne5SZRBwAQ7maw==
esbuild-darwin-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.13.12.tgz#f5c59e622955c01f050e5a7ac9c1d41db714b94d"
integrity sha512-c51C+N+UHySoV2lgfWSwwmlnLnL0JWj/LzuZt9Ltk9ub1s2Y8cr6SQV5W3mqVH1egUceew6KZ8GyI4nwu+fhsw==
esbuild-darwin-arm64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.12.tgz#8abae74c2956a8aa568fc52c78829338c4a4b988"
integrity sha512-JvAMtshP45Hd8A8wOzjkY1xAnTKTYuP/QUaKp5eUQGX+76GIie3fCdUUr2ZEKdvpSImNqxiZSIMziEiGB5oUmQ==
esbuild-freebsd-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.12.tgz#6ad2ab8c0364ee7dd2d6e324d876a8e60ae75d12"
integrity sha512-r6On/Skv9f0ZjTu6PW5o7pdXr8aOgtFOEURJZYf1XAJs0IQ+gW+o1DzXjVkIoT+n1cm3N/t1KRJfX71MPg/ZUA==
esbuild-freebsd-arm64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.12.tgz#6f38155f4c300ac4c8adde1fde3cc6a4440a8294"
integrity sha512-F6LmI2Q1gii073kmBE3NOTt/6zLL5zvZsxNLF8PMAwdHc+iBhD1vzfI8uQZMJA1IgXa3ocr3L3DJH9fLGXy6Yw==
esbuild-linux-32@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.13.12.tgz#b1d15e330188a8c21de75c3f0058628a3eefade7"
integrity sha512-U1UZwG3UIwF7/V4tCVAo/nkBV9ag5KJiJTt+gaCmLVWH3bPLX7y+fNlhIWZy8raTMnXhMKfaTvWZ9TtmXzvkuQ==
esbuild-linux-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.13.12.tgz#25bd64b66162b02348e32d8f12e4c9ee61f1d070"
integrity sha512-YpXSwtu2NxN3N4ifJxEdsgd6Q5d8LYqskrAwjmoCT6yQnEHJSF5uWcxv783HWN7lnGpJi9KUtDvYsnMdyGw71Q==
esbuild-linux-arm64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.12.tgz#ba582298457cc5c9ac823a275de117620c06537f"
integrity sha512-sgDNb8kb3BVodtAlcFGgwk+43KFCYjnFOaOfJibXnnIojNWuJHpL6aQJ4mumzNWw8Rt1xEtDQyuGK9f+Y24jGA==
esbuild-linux-arm@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.13.12.tgz#6bc81c957bff22725688cc6359c29a25765be09b"
integrity sha512-SyiT/JKxU6J+DY2qUiSLZJqCAftIt3uoGejZ0HDnUM2MGJqEGSGh7p1ecVL2gna3PxS4P+j6WAehCwgkBPXNIw==
esbuild-linux-mips64le@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.12.tgz#ef3c4aba3e585d847cbade5945a8b4a5c62c7ce2"
integrity sha512-qQJHlZBG+QwVIA8AbTEtbvF084QgDi4DaUsUnA+EolY1bxrG+UyOuGflM2ZritGhfS/k7THFjJbjH2wIeoKA2g==
esbuild-linux-ppc64le@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.12.tgz#a21fb64e80c38bef06122e48283990fc6db578e1"
integrity sha512-2dSnm1ldL7Lppwlo04CGQUpwNn5hGqXI38OzaoPOkRsBRWFBozyGxTFSee/zHFS+Pdh3b28JJbRK3owrrRgWNw==
esbuild-netbsd-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.12.tgz#1ea7fc8cfce88a20a4047b867ef184049a6641ae"
integrity sha512-D4raxr02dcRiQNbxOLzpqBzcJNFAdsDNxjUbKkDMZBkL54Z0vZh4LRndycdZAMcIdizC/l/Yp/ZsBdAFxc5nbA==
esbuild-openbsd-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.12.tgz#adde32f2f1b05dc4bd4fc544d6ea5a4379f9ca4d"
integrity sha512-KuLCmYMb2kh05QuPJ+va60bKIH5wHL8ypDkmpy47lzwmdxNsuySeCMHuTv5o2Af1RUn5KLO5ZxaZeq4GEY7DaQ==
esbuild-sunos-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.13.12.tgz#a7ecaf52b7364fbee76dc8aa707fa3e1cff3342c"
integrity sha512-jBsF+e0woK3miKI8ufGWKG3o3rY9DpHvCVRn5eburMIIE+2c+y3IZ1srsthKyKI6kkXLvV4Cf/E7w56kLipMXw==
esbuild-windows-32@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.13.12.tgz#a8756033dc905c4b7bea19be69f7ee68809f8770"
integrity sha512-L9m4lLFQrFeR7F+eLZXG82SbXZfUhyfu6CexZEil6vm+lc7GDCE0Q8DiNutkpzjv1+RAbIGVva9muItQ7HVTkQ==
esbuild-windows-64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.13.12.tgz#ae694aa66ca078acb8509b2da31197ed1f40f798"
integrity sha512-k4tX4uJlSbSkfs78W5d9+I9gpd+7N95W7H2bgOMFPsYREVJs31+Q2gLLHlsnlY95zBoPQMIzHooUIsixQIBjaQ==
esbuild-windows-arm64@0.13.12:
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.12.tgz#782c5a8bd6d717ea55aaafe648f9926ca36a4a88"
integrity sha512-2tTv/BpYRIvuwHpp2M960nG7uvL+d78LFW/ikPItO+2GfK51CswIKSetSpDii+cjz8e9iSPgs+BU4o8nWICBwQ==
esbuild@^0.13.2:
version "0.13.10"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.13.10.tgz#e3d24d59f1d8b2130d746ca858efcb80e1d99b26"
integrity sha512-0NfCsnAh5XatHIx6Cu93wpR2v6opPoOMxONYhaAoZKzGYqAE+INcDeX2wqMdcndvPQdWCuuCmvlnsh0zmbHcSQ==
version "0.13.12"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.13.12.tgz#9cac641594bf03cf34145258c093d743ebbde7ca"
integrity sha512-vTKKUt+yoz61U/BbrnmlG9XIjwpdIxmHB8DlPR0AAW6OdS+nBQBci6LUHU2q9WbBobMEIQxxDpKbkmOGYvxsow==
optionalDependencies:
esbuild-android-arm64 "0.13.10"
esbuild-darwin-64 "0.13.10"
esbuild-darwin-arm64 "0.13.10"
esbuild-freebsd-64 "0.13.10"
esbuild-freebsd-arm64 "0.13.10"
esbuild-linux-32 "0.13.10"
esbuild-linux-64 "0.13.10"
esbuild-linux-arm "0.13.10"
esbuild-linux-arm64 "0.13.10"
esbuild-linux-mips64le "0.13.10"
esbuild-linux-ppc64le "0.13.10"
esbuild-netbsd-64 "0.13.10"
esbuild-openbsd-64 "0.13.10"
esbuild-sunos-64 "0.13.10"
esbuild-windows-32 "0.13.10"
esbuild-windows-64 "0.13.10"
esbuild-windows-arm64 "0.13.10"
esbuild-android-arm64 "0.13.12"
esbuild-darwin-64 "0.13.12"
esbuild-darwin-arm64 "0.13.12"
esbuild-freebsd-64 "0.13.12"
esbuild-freebsd-arm64 "0.13.12"
esbuild-linux-32 "0.13.12"
esbuild-linux-64 "0.13.12"
esbuild-linux-arm "0.13.12"
esbuild-linux-arm64 "0.13.12"
esbuild-linux-mips64le "0.13.12"
esbuild-linux-ppc64le "0.13.12"
esbuild-netbsd-64 "0.13.12"
esbuild-openbsd-64 "0.13.12"
esbuild-sunos-64 "0.13.12"
esbuild-windows-32 "0.13.12"
esbuild-windows-64 "0.13.12"
esbuild-windows-arm64 "0.13.12"
escape-html@~1.0.3:
version "1.0.3"
......@@ -2243,7 +2243,7 @@ verror@1.10.0:
core-util-is "1.0.2"
extsprintf "^1.2.0"
vite@^2.6.11:
vite@^2.6.13:
version "2.6.13"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.6.13.tgz#16b3ec85a66d5b461ac29a903874d4357f9af432"
integrity sha512-+tGZ1OxozRirTudl4M3N3UTNJOlxdVo/qBl2IlDEy/ZpTFcskp+k5ncNjayR3bRYTCbqSOFz2JWGN1UmuDMScA==
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -7,6 +7,7 @@ import {
isBuiltInComponent,
COMPONENT_SELECTOR_PREFIX,
} from '@dcloudio/uni-shared'
import { parseRpx2UnitOnce } from '../../json/manifest'
interface UniAppCssProcessorOptions {
page?: string
......@@ -15,12 +16,7 @@ interface UniAppCssProcessorOptions {
unitPrecision?: number // 单位精度,默认5
}
const defaultUniAppCssProcessorOptions = extend(
{
page: 'body',
},
defaultRpx2Unit
)
const defaultUniAppCssProcessorOptions = extend({}, defaultRpx2Unit)
const BG_PROPS = [
'background',
......@@ -36,24 +32,18 @@ const BG_PROPS = [
function transform(
selector: selectorParser.Node,
page: string,
state: { bg: boolean }
state: { bg: boolean },
{ rewriteTag }: TransformOptions
) {
if (selector.type !== 'tag') {
return
}
const { value } = selector
if (isBuiltInComponent(value)) {
selector.value = COMPONENT_SELECTOR_PREFIX + value
} else if (value === 'page') {
if (!page) {
return
}
selector.value = page
if (page !== 'body') {
selector.value = rewriteTag(value)
if (value === 'page' && selector.value === 'uni-page-body') {
state.bg = true
}
}
}
function createBodyBackgroundRule(origRule: Rule) {
......@@ -68,11 +58,17 @@ function createBodyBackgroundRule(origRule: Rule) {
}
}
function walkRules(page: string) {
type RewriteTag = (tag: string) => string
interface TransformOptions {
rewriteTag: RewriteTag
}
function walkRules(options: TransformOptions) {
return (rule: Rule) => {
const state = { bg: false }
rule.selector = selectorParser((selectors) =>
selectors.walk((selector) => transform(selector, page, state))
selectors.walk((selector) => transform(selector, state, options))
).processSync(rule.selector)
state.bg && createBodyBackgroundRule(rule)
}
......@@ -88,8 +84,47 @@ function walkDecls(rpx2unit: ReturnType<typeof createRpx2Unit>) {
}
}
const baiduTags: Record<string, string> = {
navigator: 'nav',
}
function rewriteBaiduTags(tag: string) {
return baiduTags[tag] || tag
}
function rewriteUniH5Tags(tag: string) {
if (tag === 'page') {
return 'uni-page-body'
}
if (isBuiltInComponent(tag)) {
return COMPONENT_SELECTOR_PREFIX + tag
}
return tag
}
function rewriteUniAppTags(tag: string) {
if (tag === 'page') {
return 'body'
}
if (isBuiltInComponent(tag)) {
return COMPONENT_SELECTOR_PREFIX + tag
}
return tag
}
const transforms: Record<string, RewriteTag | undefined> = {
h5: rewriteUniH5Tags,
app: rewriteUniAppTags,
'mp-baidu': rewriteBaiduTags,
}
const uniapp = (opts?: UniAppCssProcessorOptions) => {
const { page, unit, unitRatio, unitPrecision } = extend(
const platform = process.env.UNI_PLATFORM
if (!opts) {
const inputDir = process.env.UNI_INPUT_DIR
opts = extend(parseRpx2UnitOnce(inputDir, platform))
}
const { unit, unitRatio, unitPrecision } = extend(
{},
defaultUniAppCssProcessorOptions,
opts || {}
......@@ -101,7 +136,14 @@ const uniapp = (opts?: UniAppCssProcessorOptions) => {
return {
OnceExit(root) {
root.walkDecls(walkDecls(rpx2unit))
page && root.walkRules(walkRules(page))
const rewriteTag = transforms[platform]
if (rewriteTag) {
root.walkRules(
walkRules({
rewriteTag,
})
)
}
},
}
},
......
......@@ -802,7 +802,7 @@ const scss: SassStylePreprocessor = async (
if (resolved) {
rebaseUrls(resolved, options.filename, options.alias).then(done)
} else {
done(null)
done && done(null)
}
})
}
......
......@@ -34,6 +34,15 @@ describe('compiler: transform slot', () => {
`<button><block wx:if="{{$slots.text}}"><slot name="text"></slot></block><block wx:else>Submit</block></button>`,
`(_ctx, _cache) => {
return {}
}`
)
})
test('slot with v-for', () => {
assert(
`<slot v-for="(item,index) in items" :key="index"></slot>`,
`<slot wx:for="{{a}}" wx:for-item="item"></slot>`,
`(_ctx, _cache) => {
return { a: _f(_ctx.items, (item, index, i0) => { return { a: _r(\"default\", { key: index }) }; }) }
}`
)
})
......
......@@ -79,7 +79,7 @@ export function render(_ctx, _cache) {
Foo: { name: '_component_Foo', type: BindingComponentTypes.UNKNOWN },
Bar: { name: '_component_Bar', type: BindingComponentTypes.UNKNOWN },
Example: { name: '$setup["Example"]', type: BindingComponentTypes.SETUP },
Test: { name: '_component_Test', type: BindingComponentTypes.SELF },
Test: { name: '_component_Test', type: BindingComponentTypes.UNKNOWN },
})
expect(code).toContain(
`if (!Math) { Math.max.call(Max, $setup["Example"]) }`
......@@ -91,7 +91,10 @@ export function render(_ctx, _cache) {
filename: `/foo/bar/Example.vue?vue&type=template`,
})
expect((root as CodegenRootNode).bindingComponents).toEqual({
Example: { name: '_component_Example', type: BindingComponentTypes.SELF },
Example: {
name: '_component_Example',
type: BindingComponentTypes.UNKNOWN,
},
})
})
......
import {
NOOP,
EMPTY_OBJ,
extend,
isString,
isArray,
capitalize,
camelize,
hasOwn,
} from '@vue/shared'
import { NOOP, EMPTY_OBJ, extend, isString, isArray, hasOwn } from '@vue/shared'
import {
ConditionalExpression,
......@@ -314,10 +305,11 @@ export function createTransformContext(
const vueIds: string[] = []
const identifiers = Object.create(null)
const scopes: CodegenScope[] = [rootScope]
const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/)
// const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/)
const context: TransformContext = {
// options
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
// 暂不提供根据文件名生成递归组件
selfName: '', //nameMatch && capitalize(camelize(nameMatch[1])),
miniProgram,
isTS,
inline,
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册