diff --git a/package.json b/package.json index 9fc05ecf..4ea08991 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "typecheck": "tsc", "release": "bumpp", "test": "vitest", + "test:debug:glob": "DEBUG=unplugin-vue-components:glob vitest -t sort", "test:update": "vitest -u" }, "peerDependencies": { @@ -103,7 +104,7 @@ "local-pkg": "^1.1.2", "magic-string": "^0.30.19", "mlly": "^1.8.0", - "tinyglobby": "^0.2.15", + "tinyglobby": "https://pkg.pr.new/tinyglobby@bc64566", "unplugin": "^2.3.10", "unplugin-utils": "^0.3.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b50cef1..701b90d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^1.8.0 version: 1.8.0 tinyglobby: - specifier: ^0.2.15 - version: 0.2.15 + specifier: https://pkg.pr.new/tinyglobby@bc64566 + version: https://pkg.pr.new/tinyglobby@bc64566 unplugin: specifier: ^2.3.10 version: 2.3.10 @@ -1310,8 +1310,8 @@ packages: '@oxc-project/types@0.71.0': resolution: {integrity: sha512-5CwQ4MI+P4MQbjLWXgNurA+igGwu/opNetIE13LBs9+V93R64MLvDKOOLZIXSzEfovU3Zef3q3GjPnMTgJTn2w==} - '@oxc-project/types@0.89.0': - resolution: {integrity: sha512-yuo+ECPIW5Q9mSeNmCDC2im33bfKuwW18mwkaHMQh8KakHYDzj4ci/q7wxf2qS3dMlVVCIyrs3kFtH5LmnlYnw==} + '@oxc-project/types@0.92.0': + resolution: {integrity: sha512-PDLfCbwgXjGdTBxzcuDOUxJYNBl6P8dOp3eDKWw54dYvqONan9rwGDRQU0zrkdEMiItfXQQUOI17uOcMX5Zm7A==} '@pkgr/core@0.1.1': resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} @@ -1324,14 +1324,14 @@ packages: resolution: {integrity: sha512-G0OnZbMWEs5LhDyqy2UL17vGhSVHkQIfVojMtEWVenvj0V5S84VBgy86kJIuNsGDp2p7sTKlpSIpBUWdC35OKg==} engines: {node: '>=20.0.0'} - '@rolldown/binding-android-arm64@1.0.0-beta.38': - resolution: {integrity: sha512-AE3HFQrjWCKLFZD1Vpiy+qsqTRwwoil1oM5WsKPSmfQ5fif/A+ZtOZetF32erZdsR7qyvns6qHEteEsF6g6rsQ==} + '@rolldown/binding-android-arm64@1.0.0-beta.40': + resolution: {integrity: sha512-9Ii9phC7QU6Lb+ncMfG1Xlosq0NBB1N/4sw+EGZ3y0BBWGy02TOb5ghWZalphAKv9rn1goqo5WkBjyd2YvsLmA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@rolldown/binding-darwin-arm64@1.0.0-beta.38': - resolution: {integrity: sha512-RaoWOKc0rrFsVmKOjQpebMY6c6/I7GR1FBc25v7L/R7NlM0166mUotwGEv7vxu7ruXH4SJcFeVrfADFUUXUmmQ==} + '@rolldown/binding-darwin-arm64@1.0.0-beta.40': + resolution: {integrity: sha512-5O6d0y2tBQTL+ecQY3qXIwSnF1/Zik8q7LZMKeyF+VJ9l194d0IdMhl2zUF0cqWbYHuF4Pnxplk4OhurPQ/Z9Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] @@ -1341,8 +1341,8 @@ packages: cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0-beta.38': - resolution: {integrity: sha512-Ymojqc2U35iUc8NFU2XX1WQPfBRRHN6xHcrxAf9WS8BFFBn8pDrH5QPvH1tYs3lDkw6UGGbanr1RGzARqdUp1g==} + '@rolldown/binding-darwin-x64@1.0.0-beta.40': + resolution: {integrity: sha512-izB9jygt3miPQbOTZfSu5K51isUplqa8ysByOKQqcJHgrBWmbTU8TM9eouv6tRmBR0kjcEcID9xhmA1CeZ1VIg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] @@ -1352,8 +1352,8 @@ packages: cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@1.0.0-beta.38': - resolution: {integrity: sha512-0ermTQ//WzSI0nOL3z/LUWMNiE9xeM5cLGxjewPFEexqxV/0uM8/lNp9QageQ8jfc/VO1OURsGw34HYO5PaL8w==} + '@rolldown/binding-freebsd-x64@1.0.0-beta.40': + resolution: {integrity: sha512-2fdpEpKT+wwP0vig9dqxu+toTeWmVSjo3psJQVDeLJ51rO+GXcCJ1IkCXjhMKVEevNtZS7B8T8Z2vvmRV9MAdA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] @@ -1363,8 +1363,8 @@ packages: cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.38': - resolution: {integrity: sha512-GADxzVUTCTp6EWI52831A29Tt7PukFe94nhg/SUsfkI33oTiNQtPxyLIT/3oRegizGuPSZSlrdBurkjDwxyEUQ==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.40': + resolution: {integrity: sha512-HP2lo78OWULN+8TewpLbS9PS00jh0CaF04tA2u8z2I+6QgVgrYOYKvX+T0hlO5smgso4+qb3YchzumWJl3yCPQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] @@ -1374,8 +1374,8 @@ packages: cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.38': - resolution: {integrity: sha512-SKO7Exl5Yem/OSNoA5uLHzyrptUQ8Hg70kHDxuwEaH0+GUg+SQe9/7PWmc4hFKBMrJGdQtii8WZ0uIz9Dofg5Q==} + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.40': + resolution: {integrity: sha512-ng00gfr9BhA2NPAOU5RWAlTiL+JcwAD+L+4yUD1sbBy6tgHdLiNBOvKtHISIF9RM9/eQeS0tAiWOYZGIH9JMew==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] @@ -1385,8 +1385,8 @@ packages: cpu: [arm64] os: [linux] - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.38': - resolution: {integrity: sha512-SOo6+WqhXPBaShLxLT0eCgH17d3Yu1lMAe4mFP0M9Bvr/kfMSOPQXuLxBcbBU9IFM9w3N6qP9xWOHO+oUJvi8Q==} + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.40': + resolution: {integrity: sha512-mF0R1l9kLcaag/9cLEiYYdNZ4v1uuX4jklSDZ1s6vJE4RB3LirUney0FavdVRwCJ5sDvfvsPgXgtBXWYr2M2tQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] @@ -1396,8 +1396,8 @@ packages: cpu: [arm64] os: [linux] - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.38': - resolution: {integrity: sha512-yvsQ3CyrodOX+lcoi+lejZGCOvJZa9xTsNB8OzpMDmHeZq3QzJfpYjXSAS6vie70fOkLVJb77UqYO193Cl8XBQ==} + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.40': + resolution: {integrity: sha512-+wi08S7wT5iLPHRZb0USrS6n+T6m+yY++dePYedE5uvKIpWCJJioFTaRtWjpm0V6dVNLcq2OukrvfdlGtH9Wgg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] @@ -1407,8 +1407,8 @@ packages: cpu: [x64] os: [linux] - '@rolldown/binding-linux-x64-musl@1.0.0-beta.38': - resolution: {integrity: sha512-84qzKMwUwikfYeOuJ4Kxm/3z15rt0nFGGQArHYIQQNSTiQdxGHxOkqXtzPFqrVfBJUdxBAf+jYzR1pttFJuWyg==} + '@rolldown/binding-linux-x64-musl@1.0.0-beta.40': + resolution: {integrity: sha512-W5qBGAemUocIBKCcOsDjlV9GUt28qhl/+M6etWBeLS5gQK0J6XDg0YVzfOQdvq57ZGjYNP0NvhYzqhOOnEx+4g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] @@ -1418,14 +1418,14 @@ packages: cpu: [x64] os: [linux] - '@rolldown/binding-openharmony-arm64@1.0.0-beta.38': - resolution: {integrity: sha512-QrNiWlce01DYH0rL8K3yUBu+lNzY+B0DyCbIc2Atan6/S6flxOL0ow5DLQvMamOI/oKhrJ4xG+9MkMb9dDHbLQ==} + '@rolldown/binding-openharmony-arm64@1.0.0-beta.40': + resolution: {integrity: sha512-vJwoDehtt+yqj2zacq1AqNc2uE/oh7mnRGqAUbuldV6pgvU01OSQUJ7Zu+35hTopnjFoDNN6mIezkYlGAv5RFA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@rolldown/binding-wasm32-wasi@1.0.0-beta.38': - resolution: {integrity: sha512-fnLtHyjwEsG4/aNV3Uv3Qd1ZbdH+CopwJNoV0RgBqrcQB8V6/Qdikd5JKvnO23kb3QvIpP+dAMGZMv1c2PJMzw==} + '@rolldown/binding-wasm32-wasi@1.0.0-beta.40': + resolution: {integrity: sha512-Oj3YyqVUPurr1FlMpEE/bJmMC+VWAWPM/SGUfklO5KUX97bk5Q/733nPg4RykK8q8/TluJoQYvRc05vL/B74dw==} engines: {node: '>=14.0.0'} cpu: [wasm32] @@ -1434,8 +1434,8 @@ packages: engines: {node: '>=14.21.3'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.38': - resolution: {integrity: sha512-19cTfnGedem+RY+znA9J6ARBOCEFD4YSjnx0p5jiTm9tR6pHafRfFIfKlTXhun+NL0WWM/M0eb2IfPPYUa8+wg==} + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.40': + resolution: {integrity: sha512-0ZtO6yN8XjVoFfN4HDWQj4nDu3ndMybr7jIM00DJqOmc+yFhly7rdOy7fNR9Sky3leCpBtsXfepVqRmVpYKPVA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] @@ -1445,8 +1445,8 @@ packages: cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.38': - resolution: {integrity: sha512-HcICm4YzFJZV+fI0O0bFLVVlsWvRNo/AB9EfUXvNYbtAxakCnQZ15oq22deFdz6sfi9Y4/SagH2kPU723dhCFA==} + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.40': + resolution: {integrity: sha512-BPl1inoJXPpIe38Ja46E4y11vXlJyuleo+9Rmu//pYL5fIDYJkXUj/oAXqjSuwLcssrcwnuPgzvzvlz9++cr3w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] @@ -1456,8 +1456,8 @@ packages: cpu: [ia32] os: [win32] - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.38': - resolution: {integrity: sha512-4Qx6cgEPXLb0XsCyLoQcUgYBpfL0sjugftob+zhUH0EOk/NVCAIT+h0NJhY+jn7pFpeKxhNMqhvTNx3AesxIAQ==} + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.40': + resolution: {integrity: sha512-UguA4ltbAk+nbwHRxqaUP/etpTbR0HjyNlsu4Zjbh/ytNbFsbw8CA4tEBkwDyjgI5NIPea6xY11zpl7R2/ddVA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -1470,8 +1470,8 @@ packages: '@rolldown/pluginutils@1.0.0-beta.29': resolution: {integrity: sha512-NIJgOsMjbxAXvoGq/X0gD7VPMQ8j9g0BiDaNjVNVjvl+iKXxL3Jre0v31RmBYeLEmkbj2s02v8vFTbUXi5XS2Q==} - '@rolldown/pluginutils@1.0.0-beta.38': - resolution: {integrity: sha512-N/ICGKleNhA5nc9XXQG/kkKHJ7S55u0x0XUJbbkmdCnFuoRkM1Il12q9q0eX19+M7KKUEPw/daUPIRnxhcxAIw==} + '@rolldown/pluginutils@1.0.0-beta.40': + resolution: {integrity: sha512-s3GeJKSQOwBlzdUrj4ISjJj5SfSh+aqn0wjOar4Bx95iV1ETI7F6S/5hLcfAxZ9kXDcyrAkxPlqmd1ZITttf+w==} '@rolldown/pluginutils@1.0.0-beta.9-commit.d91dfb5': resolution: {integrity: sha512-8sExkWRK+zVybw3+2/kBkYBFeLnEUWz1fT7BLHplpzmtqkOfTbAQ9gkt4pzwGIIZmg4Qn5US5ACjUBenrhezwQ==} @@ -5194,8 +5194,8 @@ packages: vue-tsc: optional: true - rolldown@1.0.0-beta.38: - resolution: {integrity: sha512-58frPNX55Je1YsyrtPJv9rOSR3G5efUZpRqok94Efsj0EUa8dnqJV3BldShyI7A+bVPleucOtzXHwVpJRcR0kQ==} + rolldown@1.0.0-beta.40: + resolution: {integrity: sha512-VqEHbKpOgTPmQrZ4fVn4eshDQS/6g/fRpNE7cFSJY+eQLDZn4B9X61J6L+hnlt1u2uRI+pF7r1USs6S5fuWCvw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -5552,6 +5552,11 @@ packages: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} + tinyglobby@https://pkg.pr.new/tinyglobby@bc64566: + resolution: {tarball: https://pkg.pr.new/tinyglobby@bc64566} + version: 0.2.15 + engines: {node: '>=12.0.0'} + tinypool@1.1.1: resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} engines: {node: ^18.0.0 || >=20.0.0} @@ -7472,7 +7477,7 @@ snapshots: '@oxc-project/types@0.71.0': {} - '@oxc-project/types@0.89.0': {} + '@oxc-project/types@0.92.0': {} '@pkgr/core@0.1.1': {} @@ -7482,61 +7487,61 @@ snapshots: dependencies: quansync: 0.2.10 - '@rolldown/binding-android-arm64@1.0.0-beta.38': + '@rolldown/binding-android-arm64@1.0.0-beta.40': optional: true - '@rolldown/binding-darwin-arm64@1.0.0-beta.38': + '@rolldown/binding-darwin-arm64@1.0.0-beta.40': optional: true '@rolldown/binding-darwin-arm64@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-darwin-x64@1.0.0-beta.38': + '@rolldown/binding-darwin-x64@1.0.0-beta.40': optional: true '@rolldown/binding-darwin-x64@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-freebsd-x64@1.0.0-beta.38': + '@rolldown/binding-freebsd-x64@1.0.0-beta.40': optional: true '@rolldown/binding-freebsd-x64@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.38': + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.40': optional: true '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.38': + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.40': optional: true '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.38': + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.40': optional: true '@rolldown/binding-linux-arm64-musl@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.38': + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.40': optional: true '@rolldown/binding-linux-x64-gnu@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0-beta.38': + '@rolldown/binding-linux-x64-musl@1.0.0-beta.40': optional: true '@rolldown/binding-linux-x64-musl@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0-beta.38': + '@rolldown/binding-openharmony-arm64@1.0.0-beta.40': optional: true - '@rolldown/binding-wasm32-wasi@1.0.0-beta.38': + '@rolldown/binding-wasm32-wasi@1.0.0-beta.40': dependencies: '@napi-rs/wasm-runtime': 1.0.5 optional: true @@ -7546,19 +7551,19 @@ snapshots: '@napi-rs/wasm-runtime': 0.2.10 optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.38': + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.40': optional: true '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.38': + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.40': optional: true '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.9-commit.d91dfb5': optional: true - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.38': + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.40': optional: true '@rolldown/binding-win32-x64-msvc@1.0.0-beta.9-commit.d91dfb5': @@ -7566,7 +7571,7 @@ snapshots: '@rolldown/pluginutils@1.0.0-beta.29': {} - '@rolldown/pluginutils@1.0.0-beta.38': {} + '@rolldown/pluginutils@1.0.0-beta.40': {} '@rolldown/pluginutils@1.0.0-beta.9-commit.d91dfb5': {} @@ -7574,7 +7579,7 @@ snapshots: dependencies: '@types/estree': 1.0.8 estree-walker: 2.0.2 - picomatch: 4.0.2 + picomatch: 4.0.3 optionalDependencies: rollup: 4.52.0 @@ -11786,7 +11791,7 @@ snapshots: dependencies: glob: 7.2.0 - rolldown-plugin-dts@0.15.10(rolldown@1.0.0-beta.38)(typescript@5.9.2)(vue-tsc@3.0.7(typescript@5.9.2)): + rolldown-plugin-dts@0.15.10(rolldown@1.0.0-beta.40)(typescript@5.9.2)(vue-tsc@3.0.7(typescript@5.9.2)): dependencies: '@babel/generator': 7.28.3 '@babel/parser': 7.28.4 @@ -11796,7 +11801,7 @@ snapshots: debug: 4.4.3 dts-resolver: 2.1.2 get-tsconfig: 4.10.1 - rolldown: 1.0.0-beta.38 + rolldown: 1.0.0-beta.40 optionalDependencies: typescript: 5.9.2 vue-tsc: 3.0.7(typescript@5.9.2) @@ -11804,26 +11809,26 @@ snapshots: - oxc-resolver - supports-color - rolldown@1.0.0-beta.38: + rolldown@1.0.0-beta.40: dependencies: - '@oxc-project/types': 0.89.0 - '@rolldown/pluginutils': 1.0.0-beta.38 + '@oxc-project/types': 0.92.0 + '@rolldown/pluginutils': 1.0.0-beta.40 ansis: 4.1.0 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-beta.38 - '@rolldown/binding-darwin-arm64': 1.0.0-beta.38 - '@rolldown/binding-darwin-x64': 1.0.0-beta.38 - '@rolldown/binding-freebsd-x64': 1.0.0-beta.38 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.38 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.38 - '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.38 - '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.38 - '@rolldown/binding-linux-x64-musl': 1.0.0-beta.38 - '@rolldown/binding-openharmony-arm64': 1.0.0-beta.38 - '@rolldown/binding-wasm32-wasi': 1.0.0-beta.38 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.38 - '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.38 - '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.38 + '@rolldown/binding-android-arm64': 1.0.0-beta.40 + '@rolldown/binding-darwin-arm64': 1.0.0-beta.40 + '@rolldown/binding-darwin-x64': 1.0.0-beta.40 + '@rolldown/binding-freebsd-x64': 1.0.0-beta.40 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.40 + '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.40 + '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.40 + '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.40 + '@rolldown/binding-linux-x64-musl': 1.0.0-beta.40 + '@rolldown/binding-openharmony-arm64': 1.0.0-beta.40 + '@rolldown/binding-wasm32-wasi': 1.0.0-beta.40 + '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.40 + '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.40 + '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.40 rolldown@1.0.0-beta.9-commit.d91dfb5: dependencies: @@ -12235,6 +12240,11 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 + tinyglobby@https://pkg.pr.new/tinyglobby@bc64566: + dependencies: + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + tinypool@1.1.1: {} tinyrainbow@2.0.0: {} @@ -12286,8 +12296,8 @@ snapshots: diff: 8.0.2 empathic: 2.0.0 hookable: 5.5.3 - rolldown: 1.0.0-beta.38 - rolldown-plugin-dts: 0.15.10(rolldown@1.0.0-beta.38)(typescript@5.9.2)(vue-tsc@3.0.7(typescript@5.9.2)) + rolldown: 1.0.0-beta.40 + rolldown-plugin-dts: 0.15.10(rolldown@1.0.0-beta.40)(typescript@5.9.2)(vue-tsc@3.0.7(typescript@5.9.2)) semver: 7.7.2 tinyexec: 1.0.1 tinyglobby: 0.2.15 @@ -12414,7 +12424,7 @@ snapshots: unplugin-utils@0.2.4: dependencies: pathe: 2.0.3 - picomatch: 4.0.2 + picomatch: 4.0.3 unplugin-utils@0.3.0: dependencies: @@ -12470,7 +12480,7 @@ snapshots: unplugin@2.3.5: dependencies: acorn: 8.15.0 - picomatch: 4.0.2 + picomatch: 4.0.3 webpack-virtual-modules: 0.6.2 untyped@2.0.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e03962a3..663c94f4 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,6 +3,7 @@ packages: ignoreWorkspaceRootCheck: true shamefullyHoist: true +shellEmulator: true strictPeerDependencies: false onlyBuiltDependencies: diff --git a/src/core/context.ts b/src/core/context.ts index 3cc91bbf..11402b93 100644 --- a/src/core/context.ts +++ b/src/core/context.ts @@ -7,7 +7,7 @@ import { slash, throttle, toArray } from '@antfu/utils' import Debug from 'debug' import { DIRECTIVE_IMPORT_PREFIX } from './constants' import { writeComponentsJson, writeDeclaration } from './declaration' -import { searchComponents } from './fs/glob' +import { searchComponents, sortFilesByGlobPrecedence } from './fs/glob' import { resolveOptions } from './options' import transformer from './transformer' import { getNameFromFilePath, isExclude, matchGlobs, normalizeComponentInfo, parseId, pascalCase, resolveAlias } from './utils' @@ -212,30 +212,48 @@ export class Context { this._server.ws.send(payload) } + private* preparePaths(): Generator { + if (this.options.sortByGlob) { + yield* sortFilesByGlobPrecedence(this, this._componentPaths) + } + else { + yield* this._componentPaths + } + } + + private* applyPathsSorting(files: Iterable): Generator { + const generator = this.options.sort + if (generator) { + yield* generator(this.options.root, Array.from(files)) + } + else { + yield* files + } + } + private updateComponentNameMap() { this._componentNameMap = {} - Array - .from(this._componentPaths) - .forEach((path) => { - const fileName = getNameFromFilePath(path, this.options) - const name = this.options.prefix - ? `${pascalCase(this.options.prefix)}${pascalCase(fileName)}` - : pascalCase(fileName) - if (isExclude(name, this.options.excludeNames)) { - debug.components('exclude', name) - return - } - if (this._componentNameMap[name] && !this.options.allowOverrides) { - console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`) - return - } + const { prefix, excludeNames, allowOverrides } = this.options + for (const path of this.applyPathsSorting(this.preparePaths())) { + const fileName = getNameFromFilePath(path, this.options) + const name = prefix + ? `${pascalCase(prefix)}${pascalCase(fileName)}` + : pascalCase(fileName) + if (isExclude(name, excludeNames)) { + debug.components('exclude', name) + continue + } + if (this._componentNameMap[name] && !allowOverrides) { + console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`) + continue + } - this._componentNameMap[name] = { - as: name, - from: path, - } - }) + this._componentNameMap[name] = { + as: name, + from: path, + } + } } async findComponent(name: string, type: 'component' | 'directive', excludePaths: string[] = []): Promise { diff --git a/src/core/fs/glob.ts b/src/core/fs/glob.ts index 912d326b..4f6238c7 100644 --- a/src/core/fs/glob.ts +++ b/src/core/fs/glob.ts @@ -1,6 +1,6 @@ import type { Context } from '../context' import Debug from 'debug' -import { globSync } from 'tinyglobby' +import { compileGlobs, globSync } from 'tinyglobby' const debug = Debug('unplugin-vue-components:glob') @@ -15,11 +15,36 @@ export function searchComponents(ctx: Context) { expandDirectories: false, }) - if (!files.length && !ctx.options.resolvers?.length) - + if (!files.length && !ctx.options.resolvers?.length) { console.warn('[unplugin-vue-components] no components found') + } debug(`${files.length} components found.`) ctx.addComponents(files) } + +export function* sortFilesByGlobPrecedence( + ctx: Context, + files: Iterable, +): Generator { + const processedFiles = new Set() + const allFiles = Array.from(files) + + const generator = compileGlobs(ctx.options.globs, { + ignore: ctx.options.globsExclude, + onlyFiles: true, + cwd: ctx.root, + absolute: true, + expandDirectories: false, + }) + + for (const [, isMatch] of generator) { + for (const file of allFiles) { + if (!processedFiles.has(file) && isMatch(file)) { + processedFiles.add(file) + yield file + } + } + } +} diff --git a/src/core/options.ts b/src/core/options.ts index b55c06a8..7154a03e 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -5,7 +5,7 @@ import { getPackageInfoSync, isPackageExists } from 'local-pkg' import { detectTypeImports } from './type-imports/detect' import { escapeSpecialChars } from './utils' -export const defaultOptions: Omit, 'include' | 'exclude' | 'excludeNames' | 'transformer' | 'globs' | 'globsExclude' | 'directives' | 'types' | 'version'> = { +export const defaultOptions: Omit, 'include' | 'exclude' | 'excludeNames' | 'transformer' | 'globs' | 'globsExclude' | 'directives' | 'types' | 'version' | 'sortByGlob' | 'sort'> = { dirs: 'src/components', extensions: 'vue', deep: true, diff --git a/src/types.ts b/src/types.ts index 3f1cb578..7a2cb618 100644 --- a/src/types.ts +++ b/src/types.ts @@ -230,6 +230,28 @@ export interface Options { * @default 'default' */ syncMode?: 'default' | 'append' | 'overwrite' + + /** + * Enable `globs` sort for scanned files. + * + * `unplugin-vue-components` using `tinyglobby` to scan files, which is non-deterministic. + */ + sortByGlob?: true + + /** + * Generator to provide files before preparing the components. + * + * For example, you can sort the files in descending order providing the following sort option: + * ```ts + * sort: function* (_root, files): Generator { + * yield* files.sort((a, b) => b.localeCompare(a)) + * }, + * ``` + * + * @param root The root folder of the project. + * @param files The scanned files (it is a new array). + */ + sort?: (root: string, files: string[]) => Generator } export type ResolvedOptions = Omit< diff --git a/test/__snapshots__/sort.test.ts.snap b/test/__snapshots__/sort.test.ts.snap new file mode 100644 index 00000000..db7beeb5 --- /dev/null +++ b/test/__snapshots__/sort.test.ts.snap @@ -0,0 +1,91 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`sort > sort ascending works > initial 1`] = ` +[ + { + "as": "Button", + "from": "src/components/ui/button.vue", + }, + { + "as": "Checkbox", + "from": "src/components/ui/nested/checkbox.vue", + }, +] +`; + +exports[`sort > sort ascending works > updated 1`] = ` +[ + { + "as": "Book", + "from": "src/components/book/index.vue", + }, + { + "as": "Button", + "from": "src/components/ui/button.vue", + }, + { + "as": "Checkbox", + "from": "src/components/ui/nested/checkbox.vue", + }, +] +`; + +exports[`sort > sort compileGlobs disabled works 1`] = ` +[ + { + "as": "Book", + "from": "src/components/book/index.vue", + }, + { + "as": "Button", + "from": "src/components/ui/button.vue", + }, + { + "as": "Checkbox", + "from": "src/components/ui/nested/checkbox.vue", + }, +] +`; + +exports[`sort > sort compileGlobs enabled works 1`] = ` +[ + { + "as": "Button", + "from": "src/components/ui/button.vue", + }, + { + "as": "Checkbox", + "from": "src/components/ui/nested/checkbox.vue", + }, + { + "as": "Book", + "from": "src/components/book/index.vue", + }, +] +`; + +exports[`sort > sort descending works > initial 1`] = ` +[ + { + "as": "Book", + "from": "src/components/book/index.vue", + }, +] +`; + +exports[`sort > sort descending works > updated 1`] = ` +[ + { + "as": "Checkbox", + "from": "src/components/ui/nested/checkbox.vue", + }, + { + "as": "Button", + "from": "src/components/ui/button.vue", + }, + { + "as": "Book", + "from": "src/components/book/index.vue", + }, +] +`; diff --git a/test/sort.test.ts b/test/sort.test.ts new file mode 100644 index 00000000..6e4860b7 --- /dev/null +++ b/test/sort.test.ts @@ -0,0 +1,90 @@ +import { relative, resolve } from 'pathe' +import { describe, expect, it } from 'vitest' +import { Context } from '../src/core/context' + +const root = resolve(__dirname, '../examples/vite-vue3') + +function cleanup(data: any) { + return Object.values(data).map((e: any) => { + delete e.absolute + e.from = relative(root, e.from).replace(/\\/g, '/') + return e + }) +} + +describe('sort', () => { + const cases = [ + { + name: 'ascending', + sortByGlob: undefined, + sortFn: (a: string, b: string) => a.localeCompare(b), + initialDirs: ['src/components/ui'], + filesToAdd: ['src/components/book/index.vue'], + withSort: true, + }, + { + name: 'descending', + sortByGlob: undefined, + sortFn: (a: string, b: string) => b.localeCompare(a), + initialDirs: ['src/components/book'], + filesToAdd: [ + 'src/components/ui/button.vue', + 'src/components/ui/nested/checkbox.vue', + ], + withSort: true, + }, + { + name: 'compileGlobs disabled', + sortByGlob: undefined, + sortFn: () => -1, + initialDirs: ['src/components/ui', 'src/components/book'], + filesToAdd: [], + withSort: false, + }, + { + name: 'compileGlobs enabled', + sortByGlob: true, + sortFn: () => -1, + initialDirs: ['src/components/ui', 'src/components/book'], + filesToAdd: [], + withSort: false, + }, + ] + + cases.forEach(({ + name, + sortFn, + initialDirs, + filesToAdd, + withSort, + sortByGlob, + }) => { + it(`sort ${name} works`, async () => { + const ctx = new Context({ + dirs: withSort ? initialDirs : undefined, + globs: withSort ? undefined : initialDirs.map(i => `${i}/**/*.vue`), + sortByGlob: sortByGlob === true ? true : undefined, + * sort(_options, files): Generator { + if (withSort) { + yield* files.sort(sortFn) + } + else { + yield* files + } + }, + }) + ctx.setRoot(root) + ctx.searchGlob() + + expect(cleanup(ctx.componentNameMap)).toMatchSnapshot(filesToAdd.length > 0 ? 'initial' : undefined) + + if (filesToAdd.length > 0) { + for (const file of filesToAdd) { + ctx.addComponents(resolve(root, file).replace(/\\/g, '/')) + } + + expect(cleanup(ctx.componentNameMap)).toMatchSnapshot('updated') + } + }) + }) +})