From 8ea00ae50d90e35a07f2b09a32c82f7895f233ec Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 9 Nov 2024 16:08:51 +0800 Subject: [PATCH] chore(build): switch to Rslib --- package.json | 5 +- pnpm-lock.yaml | 182 ++++++++++++++++++++++++++++++++++++++++++++++++ rslib.config.ts | 11 +++ tsup.config.ts | 10 --- 4 files changed, 196 insertions(+), 12 deletions(-) create mode 100644 rslib.config.ts delete mode 100644 tsup.config.ts diff --git a/package.json b/package.json index 40508c4..1a33c13 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "dist" ], "scripts": { - "build": "tsup", - "dev": "tsup --watch", + "build": "rslib build", + "dev": "rslib build --watch", "lint": "biome check .", "lint:write": "biome check . --write", "prepare": "simple-git-hooks && npm run build", @@ -43,6 +43,7 @@ "@playwright/test": "^1.48.2", "@rsbuild/core": "^1.1.0", "@rsbuild/plugin-less": "1.1.0", + "@rslib/core": "^0.0.16", "@types/node": "^20.17.6", "nano-staged": "^0.8.0", "playwright": "^1.48.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d3755c8..0109fea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,6 +27,9 @@ importers: '@rsbuild/plugin-less': specifier: 1.1.0 version: 1.1.0(@rsbuild/core@1.1.0) + '@rslib/core': + specifier: ^0.0.16 + version: 0.0.16(typescript@5.6.3) '@types/node': specifier: ^20.17.6 version: 20.17.6 @@ -287,6 +290,9 @@ packages: '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} @@ -401,6 +407,11 @@ packages: cpu: [x64] os: [win32] + '@rsbuild/core@1.0.19': + resolution: {integrity: sha512-63DAPvYfRBoUrb51BUPb4Xoqx48MHQ0yLcmnCiqZGpMeKYtTWzD+lyx5va4cr9qvdnIFTAX2BMuYC/j5iSrtTA==} + engines: {node: '>=16.7.0'} + hasBin: true + '@rsbuild/core@1.1.0': resolution: {integrity: sha512-SyQlJjWgR1VwLt4nuiY0g6L9INv2koH232TeDZuopvNgbRytskD3kJ8bbGWBBXsQjZjtqBEh5ishqf8CIfF8dQ==} engines: {node: '>=16.7.0'} @@ -411,54 +422,124 @@ packages: peerDependencies: '@rsbuild/core': 1.x + '@rslib/core@0.0.16': + resolution: {integrity: sha512-g6IFUZW0K7DDKK/27kF7DOKhP5JIqZoIVAU0c9DZffRE3Pw9sWTyEyVN/kaEnp5k3gaeQTBpcV9nSW+41B2slQ==} + engines: {node: '>=16.0.0'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7 + typescript: ^5 + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + typescript: + optional: true + + '@rspack/binding-darwin-arm64@1.0.14': + resolution: {integrity: sha512-dHvlF6T6ctThGDIdvkSdacroA1xlCxfteuppBj8BX/UxzLPr4xsaEtNilfJmFfd2/J02UQyTQauN/9EBuA+YkA==} + cpu: [arm64] + os: [darwin] + '@rspack/binding-darwin-arm64@1.1.0': resolution: {integrity: sha512-02YmzmtKMNHCSMzVT5sgbJuPDn+HunkrtWq0D95Fh9sGKYap9cs0JOpzTfyAL3KXJ9JzVfOAZA3VgVQOBaQNWQ==} cpu: [arm64] os: [darwin] + '@rspack/binding-darwin-x64@1.0.14': + resolution: {integrity: sha512-q4Da1Bn/4xTLhhnOkT+fjP2STsSCfp4z03/J/h8tCVG/UYz56Ud3q1UEOK33c5Fxw1C4GlhEh5yYOlSAdxFQLQ==} + cpu: [x64] + os: [darwin] + '@rspack/binding-darwin-x64@1.1.0': resolution: {integrity: sha512-HtBh8p6hml7BWNtZaqWFtGbOFP/tvFDn1uPWmA3R32WTILUXNRWXIsLDY95U3Z2U1Gt3SL58SOpJjXlFIb6wZg==} cpu: [x64] os: [darwin] + '@rspack/binding-linux-arm64-gnu@1.0.14': + resolution: {integrity: sha512-JogYtL3VQS9wJ3p3FNhDqinm7avrMsdwz4erP7YCjD7idob93GYAE7dPrHUzSNVnCBYXRaHJYZHDQs7lKVcYZw==} + cpu: [arm64] + os: [linux] + '@rspack/binding-linux-arm64-gnu@1.1.0': resolution: {integrity: sha512-Q/i50Pieii3akdv5Q6my6QelV5Dpc8O/Ir4udpjYl0pbSdKamdI8M85fxrMxGAGcoNSD+X52fDvxJujXWMcP0w==} cpu: [arm64] os: [linux] + '@rspack/binding-linux-arm64-musl@1.0.14': + resolution: {integrity: sha512-qgybhxI/nnoa8CUz7zKTC0Oh37NZt9uRxsSV7+ZYrfxqbrVCoNVuutPpY724uUHy1M6W34kVEm1uT1N4Ka5cZg==} + cpu: [arm64] + os: [linux] + '@rspack/binding-linux-arm64-musl@1.1.0': resolution: {integrity: sha512-H7Eu3xC7LWPpxrI47n8X361eEGGpQOjZIWTz8tLdn4oNS2D9kqsBYES7LsuuLTTH4ueHTDuEtDdfZpBsE+qesw==} cpu: [arm64] os: [linux] + '@rspack/binding-linux-x64-gnu@1.0.14': + resolution: {integrity: sha512-5vzaDRw3/sGKo3ax/1cU3/cxqNjajwlt2LU288vXNe1/n8oe/pcDfYcTugpOe/A1DqzadanudJszLpFcKsaFtQ==} + cpu: [x64] + os: [linux] + '@rspack/binding-linux-x64-gnu@1.1.0': resolution: {integrity: sha512-dIZSutPo2z/OaO2f6SVlcYA6lGBH+4TrRtWmMyPshpTNPrkCGGfDhC43fZ4jCiUj2PO/Hcn8jyKhci4leBsVBA==} cpu: [x64] os: [linux] + '@rspack/binding-linux-x64-musl@1.0.14': + resolution: {integrity: sha512-4U6QD9xVS1eGme52DuJr6Fg/KdcUfJ+iKwH49Up460dZ/fLvGylnVGA+V0mzPlKi8gfy7NwFuYXZdu3Pwi1YYg==} + cpu: [x64] + os: [linux] + '@rspack/binding-linux-x64-musl@1.1.0': resolution: {integrity: sha512-f6L2JWgbG9PKWnVw2YNZdntjzia1V2w2Xq458HkCQUDwhnEipWXaZ2zhfD9jcb4UYoMP8/2uD3B96sSFFNTdrQ==} cpu: [x64] os: [linux] + '@rspack/binding-win32-arm64-msvc@1.0.14': + resolution: {integrity: sha512-SjeYw7qqRHYZ5RPClu+ffKZsShQdU3amA1OwC3M0AS6dbfEcji8482St3Y8Z+QSzYRapCEZij9LMM/9ypEhISg==} + cpu: [arm64] + os: [win32] + '@rspack/binding-win32-arm64-msvc@1.1.0': resolution: {integrity: sha512-opo6XR4iXh/QkHiauVQBlU2xR2JyjDmSwgkION27oszu81nr+IajTSXQX96x5I6Bq48GQLU4rItHse/doctQDA==} cpu: [arm64] os: [win32] + '@rspack/binding-win32-ia32-msvc@1.0.14': + resolution: {integrity: sha512-m1gUiVyz3Z3VYIK/Ayo5CVHBjnEeRk9a+KIpKSsq1yhZItnMgjtr4bKabU9vjxalO4UoaSmVzODJI8lJBlnn5Q==} + cpu: [ia32] + os: [win32] + '@rspack/binding-win32-ia32-msvc@1.1.0': resolution: {integrity: sha512-FBcG+OPJokSE3nPi1+ZamLK2V4IWdNC+GMr0z7LUrBiKc5lO70y5VkldfyPV1Z+doSuroVINlhK+lRHdQgGwYg==} cpu: [ia32] os: [win32] + '@rspack/binding-win32-x64-msvc@1.0.14': + resolution: {integrity: sha512-Gbeg+bayMF9VP9xmlxySL/TC2XrS6/LZM/pqcNOTLHx6LMG/VXCcmKB0rOZo8MzLXEt8D/lQmQ/B6g7pSaAw0g==} + cpu: [x64] + os: [win32] + '@rspack/binding-win32-x64-msvc@1.1.0': resolution: {integrity: sha512-H/6Glp1nZvxWAD5+2hRrp1kBs9f+pLb/un2TdFSUNd2tyXq5GyHCe70+N9psbe/jjGxD8e1vPNQtN/VvkuR0Zg==} cpu: [x64] os: [win32] + '@rspack/binding@1.0.14': + resolution: {integrity: sha512-0wWqFvr9hkF4LgNPgWfkTU0hhkZAMvOytoCs2p+wDX1Up1E/SgJ1U1JAsCxsl1XtUKm7mRvdWHzJmHbza3y89Q==} + '@rspack/binding@1.1.0': resolution: {integrity: sha512-zLduWacrw/bBYiFvhjN70f+AJxXnTzevywXp54vso8d0Nz7z4KIycdz/Ua5AGRUkG2ZuQw6waypN5pXf48EBcA==} + '@rspack/core@1.0.14': + resolution: {integrity: sha512-xHl23lxJZNjItGc5YuE9alz3yjb56y7EgJmAcBMPHMqgjtUt8rBu4xd/cSUjbr9/lLF9N4hdyoJiPJOFs9LEjw==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@swc/helpers': '>=0.5.1' + peerDependenciesMeta: + '@swc/helpers': + optional: true + '@rspack/core@1.1.0': resolution: {integrity: sha512-+IYWSe9D3wB97VVBfaojuWLv3wGIBe9pfJkxNObkorN60Nj3UHYzBLuACrHn4hW2mZjAWrv06ReHXJUEGzQqaQ==} engines: {node: '>=16.0.0'} @@ -812,6 +893,9 @@ packages: whiskers: optional: true + core-js@3.38.1: + resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==} + core-js@3.39.0: resolution: {integrity: sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==} @@ -1021,6 +1105,9 @@ packages: lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} + magic-string@0.30.12: + resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + merge-source-map@1.1.0: resolution: {integrity: sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==} @@ -1198,6 +1285,19 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + rsbuild-plugin-dts@0.0.16: + resolution: {integrity: sha512-Yfc7h1cTTp55baLgS6DVa3mlLaFlNfoUVmcX7hCH1BT1fNbMabnngvXDtfqJpP62QyXcfrXNmcW0fznTYKgKmA==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@microsoft/api-extractor': ^7 + '@rsbuild/core': 1.x + typescript: ^5 + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + typescript: + optional: true + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -1591,6 +1691,8 @@ snapshots: '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 @@ -1673,6 +1775,15 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.24.4': optional: true + '@rsbuild/core@1.0.19': + dependencies: + '@rspack/core': 1.0.14(@swc/helpers@0.5.13) + '@rspack/lite-tapable': 1.0.1 + '@swc/helpers': 0.5.13 + core-js: 3.38.1 + optionalDependencies: + fsevents: 2.3.3 + '@rsbuild/core@1.1.0': dependencies: '@rspack/core': 1.1.0(@swc/helpers@0.5.13) @@ -1688,33 +1799,80 @@ snapshots: deepmerge: 4.3.1 reduce-configs: 1.0.0 + '@rslib/core@0.0.16(typescript@5.6.3)': + dependencies: + '@rsbuild/core': 1.0.19 + rsbuild-plugin-dts: 0.0.16(@rsbuild/core@1.0.19)(typescript@5.6.3) + tinyglobby: 0.2.10 + optionalDependencies: + typescript: 5.6.3 + + '@rspack/binding-darwin-arm64@1.0.14': + optional: true + '@rspack/binding-darwin-arm64@1.1.0': optional: true + '@rspack/binding-darwin-x64@1.0.14': + optional: true + '@rspack/binding-darwin-x64@1.1.0': optional: true + '@rspack/binding-linux-arm64-gnu@1.0.14': + optional: true + '@rspack/binding-linux-arm64-gnu@1.1.0': optional: true + '@rspack/binding-linux-arm64-musl@1.0.14': + optional: true + '@rspack/binding-linux-arm64-musl@1.1.0': optional: true + '@rspack/binding-linux-x64-gnu@1.0.14': + optional: true + '@rspack/binding-linux-x64-gnu@1.1.0': optional: true + '@rspack/binding-linux-x64-musl@1.0.14': + optional: true + '@rspack/binding-linux-x64-musl@1.1.0': optional: true + '@rspack/binding-win32-arm64-msvc@1.0.14': + optional: true + '@rspack/binding-win32-arm64-msvc@1.1.0': optional: true + '@rspack/binding-win32-ia32-msvc@1.0.14': + optional: true + '@rspack/binding-win32-ia32-msvc@1.1.0': optional: true + '@rspack/binding-win32-x64-msvc@1.0.14': + optional: true + '@rspack/binding-win32-x64-msvc@1.1.0': optional: true + '@rspack/binding@1.0.14': + optionalDependencies: + '@rspack/binding-darwin-arm64': 1.0.14 + '@rspack/binding-darwin-x64': 1.0.14 + '@rspack/binding-linux-arm64-gnu': 1.0.14 + '@rspack/binding-linux-arm64-musl': 1.0.14 + '@rspack/binding-linux-x64-gnu': 1.0.14 + '@rspack/binding-linux-x64-musl': 1.0.14 + '@rspack/binding-win32-arm64-msvc': 1.0.14 + '@rspack/binding-win32-ia32-msvc': 1.0.14 + '@rspack/binding-win32-x64-msvc': 1.0.14 + '@rspack/binding@1.1.0': optionalDependencies: '@rspack/binding-darwin-arm64': 1.1.0 @@ -1727,6 +1885,15 @@ snapshots: '@rspack/binding-win32-ia32-msvc': 1.1.0 '@rspack/binding-win32-x64-msvc': 1.1.0 + '@rspack/core@1.0.14(@swc/helpers@0.5.13)': + dependencies: + '@module-federation/runtime-tools': 0.5.1 + '@rspack/binding': 1.0.14 + '@rspack/lite-tapable': 1.0.1 + caniuse-lite: 1.0.30001679 + optionalDependencies: + '@swc/helpers': 0.5.13 + '@rspack/core@1.1.0(@swc/helpers@0.5.13)': dependencies: '@module-federation/runtime-tools': 0.5.1 @@ -1999,6 +2166,8 @@ snapshots: dependencies: bluebird: 3.7.2 + core-js@3.38.1: {} + core-js@3.39.0: {} cross-spawn@7.0.3: @@ -2184,6 +2353,10 @@ snapshots: pseudomap: 1.0.2 yallist: 2.1.2 + magic-string@0.30.12: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + merge-source-map@1.1.0: dependencies: source-map: 0.6.1 @@ -2339,6 +2512,15 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.24.4 fsevents: 2.3.3 + rsbuild-plugin-dts@0.0.16(@rsbuild/core@1.0.19)(typescript@5.6.3): + dependencies: + '@rsbuild/core': 1.0.19 + magic-string: 0.30.12 + picocolors: 1.1.1 + tinyglobby: 0.2.10 + optionalDependencies: + typescript: 5.6.3 + safe-buffer@5.2.1: {} schema-utils@3.3.0: diff --git a/rslib.config.ts b/rslib.config.ts new file mode 100644 index 0000000..c451f7e --- /dev/null +++ b/rslib.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from '@rslib/core'; + +export default defineConfig({ + lib: [ + { format: 'esm', syntax: 'es2021', dts: true }, + { format: 'cjs', syntax: 'es2021' }, + ], + output: { + target: 'node', + }, +}); diff --git a/tsup.config.ts b/tsup.config.ts deleted file mode 100644 index 8659eff..0000000 --- a/tsup.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'tsup'; - -export default defineConfig({ - entry: ['./src/index.ts'], - format: ['esm', 'cjs'], - target: 'node18', - dts: true, - clean: true, - shims: true, -});