From 30960a2d7d35ef5b5eab699de51e4f846af9254e Mon Sep 17 00:00:00 2001 From: "ilia.brauer" Date: Thu, 11 Jun 2026 10:51:21 +0200 Subject: [PATCH 1/2] [chore] use resolve aliases instead of unpluginSemcoreResolve --- pnpm-lock.yaml | 2 +- .../docs/examples/inputtags-and-select.tsx | 2 +- vite.config.ts | 44 ++++++++++++++++++- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45e5ee755e..2376011797 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19613,7 +19613,7 @@ snapshots: sirv: 3.0.2 tinyglobby: 0.2.17 tinyrainbow: 2.0.0 - vitest: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(happy-dom@9.20.3)(jsdom@22.1.0)(lightningcss@1.31.1)(sass@1.100.0)(sugarss@5.0.1(postcss@8.5.15))(terser@5.48.0)(yaml@2.8.3) + vitest: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(happy-dom@9.20.3)(jsdom@22.1.0)(lightningcss@1.31.1)(sass@1.100.0)(sugarss@5.0.1(postcss@8.5.14))(terser@5.48.0)(yaml@2.8.3) '@vitest/utils@3.2.4': dependencies: diff --git a/stories/patterns/ux-patterns/form/docs/examples/inputtags-and-select.tsx b/stories/patterns/ux-patterns/form/docs/examples/inputtags-and-select.tsx index 3ef3054a37..593586dcb5 100644 --- a/stories/patterns/ux-patterns/form/docs/examples/inputtags-and-select.tsx +++ b/stories/patterns/ux-patterns/form/docs/examples/inputtags-and-select.tsx @@ -1,7 +1,7 @@ import { Flex } from '@semcore/ui/base-components'; import Button from '@semcore/ui/button'; import Counter from '@semcore/ui/counter'; -import InputTags from '@semcore/ui/input-tags/'; +import InputTags from '@semcore/ui/input-tags'; import Select from '@semcore/ui/select'; import Tooltip from '@semcore/ui/tooltip'; import { Text } from '@semcore/ui/typography'; diff --git a/vite.config.ts b/vite.config.ts index c39139e458..b3287b7adb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -17,10 +17,14 @@ export default defineConfig({ plugins: [ pluginReact({ babel: { - plugins: ['@babel/plugin-syntax-import-assertions'], + presets: [ + ['@babel/preset-react', { throwIfNamespace: false }], + ['@semcore/babel-preset-ui', { cssStyle: { extract: null } }], + ], + plugins: ['babel-plugin-transform-import-meta'], }, }), - unpluginSemcoreResolve.vite({ rootPath: rootDir }), + // unpluginSemcoreResolve.vite({ rootPath: rootDir }), unpluginIcons.vite({ rootPath: rootDir }), unpluginIllustrations.vite({ rootPath: rootDir }), createUnplugin<{}>(() => ({ @@ -32,6 +36,42 @@ export default defineConfig({ }, })).vite({}), ], + resolve: { + alias: [ + { + find: /^@semcore\/core\/lib\/utils\/(.*)/, + replacement: resolvePath(__dirname, 'semcore/core/src/utils/$1'), + }, + { + find: /^@semcore\/ui\/core\/lib\/utils\/(.*)/, + replacement: resolvePath(__dirname, 'semcore/core/src/utils/$1'), + }, + { + find: /^@semcore\/theme\/lib\/(.*)/, + replacement: resolvePath(__dirname, 'tools/theme/lib/$1'), + }, + { + find: /^@semcore\/theme\/(.*)/, + replacement: resolvePath(__dirname, 'tools/theme/lib/$1'), + }, + { + find: /^@semcore\/icon\/(.*)/, + replacement: resolvePath(__dirname, 'semcore/icon/lib/$1'), + }, + { + find: /^@semcore\/illustration\/(.*)/, + replacement: resolvePath(__dirname, 'semcore/illustration/lib/$1'), + }, + { + find: /^@semcore\/ui\/([\w-]*)$/, + replacement: resolvePath(__dirname, 'semcore/$1/src'), + }, + { + find: /^@semcore\/([\w-]*)$/, + replacement: resolvePath(__dirname, 'semcore/$1/src'), + }, + ], + }, build: { rollupOptions: { external: [ From ff80b40126ff4288ecdf3dde3364122bfaaf9eb7 Mon Sep 17 00:00:00 2001 From: "ilia.brauer" Date: Thu, 11 Jun 2026 15:42:47 +0200 Subject: [PATCH 2/2] [chore] speed up styles in storybook --- .storybook/preview.tsx | 11 +- package.json | 2 + pnpm-lock.yaml | 200 +++++++++++++++++++++++++++++++++++ tools/theme/package.json | 4 +- tools/theme/src/processor.ts | 42 ++++---- 5 files changed, 233 insertions(+), 26 deletions(-) diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 48541478e6..6ee8b85e6b 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -2,7 +2,8 @@ import { PortalProvider } from '@semcore/base-components'; import type { Preview } from '@storybook/react-vite'; import React from 'react'; -// import '@semcore/theme/lib/highlights-light.css'; +import '@semcore/theme/lib/light.css'; +import '@semcore/theme/lib/highlights-light.css'; const preview: Preview = { parameters: { @@ -70,8 +71,8 @@ const preview: Preview = { if (params.parameters.layout === 'fullscreen') { return ( <> - - + {/* */} + {/* */}
@@ -83,8 +84,8 @@ const preview: Preview = { return ( <> - - + {/* */} + {/* */}
diff --git a/package.json b/package.json index 39f81c2def..96f63a3f2a 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "i18n:download": "pnpm crowdin download && tsm --require=./.ci/tsm-filter-warnings.js .ci/i18n-csv-2-json.ts", "git:setup": "git config --local attributesfile.name \".gitattributes\" && git config --local rebase.backend \"merge\" && git config --local merge.changelog-merge-driver.name \"changelog-merge-driver\" && git config --local merge.changelog-merge-driver.driver \"pnpm tsm --require=./.ci/tsm-filter-warnings.js ./.ci/changelog-merge-driver.ts %A %B\"", "storybook": "storybook dev -p 6006", + "storybook:dev": "concurrently \"pnpm --filter @semcore/theme watch\" \"pnpm storybook\"", "storybook:build": "tsm --require=./.ci/tsm-filter-warnings.js ./.ci/prebuild-stories.ts && storybook build", "storybook:chromatic:build": "storybook build", "storybook:test": "storybook test" @@ -98,6 +99,7 @@ "allure-vitest": "3.7.1", "babel-plugin-preval": "5.1.0", "babel-plugin-replace-import-extension": "1.1.5", + "concurrently": "10.0.3", "chromatic": "15.1.1", "csv": "6.2.0", "dotenv": "16.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2376011797..272a584346 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -183,6 +183,9 @@ importers: chromatic: specifier: 15.1.1 version: 15.1.1 + concurrently: + specifier: 10.0.3 + version: 10.0.3 csv: specifier: 6.2.0 version: 6.2.0 @@ -2463,6 +2466,9 @@ importers: '@semcore/testing-utils': specifier: workspace:* version: link:../testing-utils + chokidar-cli: + specifier: 3.0.0 + version: 3.0.0 colorjs.io: specifier: 0.6.1 version: 0.6.1 @@ -7338,6 +7344,11 @@ packages: resolution: {integrity: sha512-IkxPpb5rS/d1IiLbHMgfPuS0FgiWTtFIm/Nj+2woXDLTZ7fOT2eqzgYbdMlLweqlHbsZjxEChoVK+7iph7jyQg==} engines: {node: '>=20.18.1'} + chokidar-cli@3.0.0: + resolution: {integrity: sha512-xVW+Qeh7z15uZRxHOkP93Ux8A0xbPzwK4GaqD8dQOYc34TlkqUhVSS59fK36DOp5WdJlrRzlYSy02Ht99FjZqQ==} + engines: {node: '>= 8.10.0'} + hasBin: true + chokidar@3.5.1: resolution: {integrity: sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==} engines: {node: '>= 8.10.0'} @@ -7422,6 +7433,9 @@ packages: cliui@3.2.0: resolution: {integrity: sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==} + cliui@5.0.0: + resolution: {integrity: sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==} + cliui@6.0.0: resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} @@ -7429,6 +7443,10 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + cliui@9.0.1: + resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==} + engines: {node: '>=20'} + clone-response@1.0.2: resolution: {integrity: sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==} @@ -7539,6 +7557,11 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + concurrently@10.0.3: + resolution: {integrity: sha512-hc3LH4UaKWd/bbyDK/IGVa4RB6PtQ3CUYwtrkzqHn+wIG3Hr5fhpRlk0L/gCa8ZE1L/Ufj50Zho69cI5w8SQBA==} + engines: {node: '>=22'} + hasBin: true + confbox@0.2.4: resolution: {integrity: sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==} @@ -8286,6 +8309,12 @@ packages: emoji-regex-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} + emoji-regex@10.6.0: + resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} + + emoji-regex@7.0.3: + resolution: {integrity: sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==} + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -9145,6 +9174,10 @@ packages: find-package-json@1.2.0: resolution: {integrity: sha512-+SOGcLGYDJHtyqHd87ysBhmaeQ95oWspDKnMXBrnQ9Eq4OkLNqejgoaD8xVWu6GPa0B6roa6KinCMEMcVeqONw==} + find-up@3.0.0: + resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} + engines: {node: '>=6'} + find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -9335,6 +9368,10 @@ packages: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} + get-east-asian-width@1.6.0: + resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==} + engines: {node: '>=18'} + get-intrinsic@1.3.0: resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} engines: {node: '>= 0.4'} @@ -10584,6 +10621,10 @@ packages: locate-app@2.5.0: resolution: {integrity: sha512-xIqbzPMBYArJRmPGUZD9CzV9wOqmVtQnaAn3wrj3s6WYW0bQvPI7x+sPYUGmDTYMHefVK//zc6HEYZ1qnxIK+Q==} + locate-path@3.0.0: + resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} + engines: {node: '>=6'} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -11524,6 +11565,10 @@ packages: resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} engines: {node: '>=18'} + p-locate@3.0.0: + resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} + engines: {node: '>=6'} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -11628,6 +11673,10 @@ packages: path-browserify@1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + path-exists@3.0.0: + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} + engines: {node: '>=4'} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -13227,6 +13276,9 @@ packages: resolution: {integrity: sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==} engines: {npm: '>=2.0.0'} + rxjs@7.8.2: + resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==} + sade@1.8.1: resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} engines: {node: '>=6'} @@ -13689,6 +13741,10 @@ packages: resolution: {integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==} engines: {node: '>=4'} + string-width@3.1.0: + resolution: {integrity: sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==} + engines: {node: '>=6'} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -13697,6 +13753,10 @@ packages: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} engines: {node: '>=12'} + string-width@7.2.0: + resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} + engines: {node: '>=18'} + string.prototype.matchall@4.0.12: resolution: {integrity: sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==} engines: {node: '>= 0.4'} @@ -13874,6 +13934,10 @@ packages: resolution: {integrity: sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==} engines: {node: '>=16'} + supports-color@10.2.2: + resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} + engines: {node: '>=18'} + supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} engines: {node: '>=0.8.0'} @@ -14142,6 +14206,10 @@ packages: peerDependencies: tslib: '2' + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -14954,6 +15022,10 @@ packages: resolution: {integrity: sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==} engines: {node: '>=0.10.0'} + wrap-ansi@5.1.0: + resolution: {integrity: sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==} + engines: {node: '>=6'} + wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -14966,6 +15038,10 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} + wrap-ansi@9.0.2: + resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==} + engines: {node: '>=18'} + wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -15075,6 +15151,9 @@ packages: engines: {node: '>= 14.6'} hasBin: true + yargs-parser@13.1.2: + resolution: {integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==} + yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} @@ -15087,6 +15166,13 @@ packages: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs-parser@22.0.0: + resolution: {integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==} + engines: {node: ^20.19.0 || ^22.12.0 || >=23} + + yargs@13.3.2: + resolution: {integrity: sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==} + yargs@15.4.1: resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==} engines: {node: '>=8'} @@ -15099,6 +15185,10 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yargs@18.0.0: + resolution: {integrity: sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==} + engines: {node: ^20.19.0 || ^22.12.0 || >=23} + yargs@3.32.0: resolution: {integrity: sha512-ONJZiimStfZzhKamYvR/xvmgW3uEkAUFSP91y2caTEPhzF6uP2JfPiVZcq66b/YR0C3uitxSV7+T1x8p5bkmMg==} @@ -20865,6 +20955,13 @@ snapshots: undici: 7.27.0 whatwg-mimetype: 4.0.0 + chokidar-cli@3.0.0: + dependencies: + chokidar: 3.6.0 + lodash.debounce: 4.0.8 + lodash.throttle: 4.1.1 + yargs: 13.3.2 + chokidar@3.5.1: dependencies: anymatch: 3.1.3 @@ -20958,6 +21055,12 @@ snapshots: strip-ansi: 3.0.1 wrap-ansi: 2.1.0 + cliui@5.0.0: + dependencies: + string-width: 3.1.0 + strip-ansi: 5.2.0 + wrap-ansi: 5.1.0 + cliui@6.0.0: dependencies: string-width: 4.2.3 @@ -20970,6 +21073,12 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + cliui@9.0.1: + dependencies: + string-width: 7.2.0 + strip-ansi: 7.2.0 + wrap-ansi: 9.0.2 + clone-response@1.0.2: dependencies: mimic-response: 1.0.1 @@ -21073,6 +21182,15 @@ snapshots: concat-map@0.0.1: {} + concurrently@10.0.3: + dependencies: + chalk: 5.6.2 + rxjs: 7.8.2 + shell-quote: 1.8.4 + supports-color: 10.2.2 + tree-kill: 1.2.2 + yargs: 18.0.0 + confbox@0.2.4: {} config-chain@1.1.13: @@ -21889,6 +22007,10 @@ snapshots: emoji-regex-xs@1.0.0: {} + emoji-regex@10.6.0: {} + + emoji-regex@7.0.3: {} + emoji-regex@8.0.0: {} emoji-regex@9.2.2: {} @@ -23012,6 +23134,10 @@ snapshots: find-package-json@1.2.0: {} + find-up@3.0.0: + dependencies: + locate-path: 3.0.0 + find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -23225,6 +23351,8 @@ snapshots: get-caller-file@2.0.5: {} + get-east-asian-width@1.6.0: {} + get-intrinsic@1.3.0: dependencies: call-bind-apply-helpers: 1.0.2 @@ -24657,6 +24785,11 @@ snapshots: type-fest: 4.26.0 userhome: 1.0.1 + locate-path@3.0.0: + dependencies: + p-locate: 3.0.0 + path-exists: 3.0.0 + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -25807,6 +25940,10 @@ snapshots: dependencies: yocto-queue: 1.2.2 + p-locate@3.0.0: + dependencies: + p-limit: 2.3.0 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -25919,6 +26056,8 @@ snapshots: path-browserify@1.0.1: {} + path-exists@3.0.0: {} + path-exists@4.0.0: {} path-is-absolute@1.0.1: {} @@ -27822,6 +27961,10 @@ snapshots: dependencies: tslib: 1.14.1 + rxjs@7.8.2: + dependencies: + tslib: 2.8.1 + sade@1.8.1: dependencies: mri: 1.2.0 @@ -28422,6 +28565,12 @@ snapshots: is-fullwidth-code-point: 2.0.0 strip-ansi: 4.0.0 + string-width@3.1.0: + dependencies: + emoji-regex: 7.0.3 + is-fullwidth-code-point: 2.0.0 + strip-ansi: 5.2.0 + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -28434,6 +28583,12 @@ snapshots: emoji-regex: 9.2.2 strip-ansi: 7.2.0 + string-width@7.2.0: + dependencies: + emoji-regex: 10.6.0 + get-east-asian-width: 1.6.0 + strip-ansi: 7.2.0 + string.prototype.matchall@4.0.12: dependencies: call-bind: 1.0.9 @@ -28716,6 +28871,8 @@ snapshots: dependencies: copy-anything: 4.0.5 + supports-color@10.2.2: {} + supports-color@2.0.0: {} supports-color@3.2.3: @@ -29020,6 +29177,8 @@ snapshots: dependencies: tslib: 2.8.1 + tree-kill@1.2.2: {} + trim-lines@3.0.1: {} trim-newlines@3.0.1: {} @@ -30146,6 +30305,12 @@ snapshots: string-width: 1.0.2 strip-ansi: 3.0.1 + wrap-ansi@5.1.0: + dependencies: + ansi-styles: 3.2.1 + string-width: 3.1.0 + strip-ansi: 5.2.0 + wrap-ansi@6.2.0: dependencies: ansi-styles: 4.3.0 @@ -30164,6 +30329,12 @@ snapshots: string-width: 5.1.2 strip-ansi: 7.2.0 + wrap-ansi@9.0.2: + dependencies: + ansi-styles: 6.2.3 + string-width: 7.2.0 + strip-ansi: 7.2.0 + wrappy@1.0.2: {} write-file-atomic@3.0.3: @@ -30226,6 +30397,11 @@ snapshots: yaml@2.8.3: {} + yargs-parser@13.1.2: + dependencies: + camelcase: 5.3.1 + decamelize: 1.2.0 + yargs-parser@18.1.3: dependencies: camelcase: 5.3.1 @@ -30235,6 +30411,21 @@ snapshots: yargs-parser@21.1.1: {} + yargs-parser@22.0.0: {} + + yargs@13.3.2: + dependencies: + cliui: 5.0.0 + find-up: 3.0.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + require-main-filename: 2.0.0 + set-blocking: 2.0.0 + string-width: 3.1.0 + which-module: 2.0.1 + y18n: 4.0.3 + yargs-parser: 13.1.2 + yargs@15.4.1: dependencies: cliui: 6.0.0 @@ -30269,6 +30460,15 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yargs@18.0.0: + dependencies: + cliui: 9.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + string-width: 7.2.0 + y18n: 5.0.8 + yargs-parser: 22.0.0 + yargs@3.32.0: dependencies: camelcase: 2.1.1 diff --git a/tools/theme/package.json b/tools/theme/package.json index ffe2a69268..1f0e9a1dd5 100644 --- a/tools/theme/package.json +++ b/tools/theme/package.json @@ -7,7 +7,8 @@ "type": "module", "scripts": { "build": "node --experimental-transform-types src/processor.ts && tsc --project tsconfig-theme.json", - "check": "node --experimental-transform-types src/checker.ts" + "check": "node --experimental-transform-types src/checker.ts", + "watch": "chokidar \"src/**/*.ts\" -c \"node --experimental-transform-types src/processor.ts --watch\"" }, "exports": { ".": "./lib/theme.d.ts", @@ -61,6 +62,7 @@ }, "devDependencies": { "colorjs.io": "0.6.1", + "chokidar-cli": "3.0.0", "postcss": "8.5.14", "postcss-value-parser": "4.1.0", "@pandacss/dev": "1.9.0", diff --git a/tools/theme/src/processor.ts b/tools/theme/src/processor.ts index e79c7f90d0..e4976da098 100644 --- a/tools/theme/src/processor.ts +++ b/tools/theme/src/processor.ts @@ -14,16 +14,16 @@ import { logger, processTokens, tokensToCss, tokensToJs } from './utils.ts'; export const writeIfChanged = async (relativePath: string, content: string) => { const pathToFile = resolvePath(packageDirname, relativePath); - try { - const originalContent = await fs.readFile(pathToFile, 'utf-8'); - if (originalContent.replace(/[\s\n]/g, '') === content.replace(/[\s\n]/g, '')) { - return; - } - } catch (err: unknown) { - if (!(err instanceof Error) || !('code' in err) || err.code !== 'ENOENT' || !err.message.startsWith('ENOENT: no such file')) { - throw err; - } - } + // try { + // const originalContent = await fs.readFile(pathToFile, 'utf-8'); + // if (originalContent.replace(/[\s\n]/g, '') === content.replace(/[\s\n]/g, '')) { + // return; + // } + // } catch (err: unknown) { + // if (!(err instanceof Error) || !('code' in err) || err.code !== 'ENOENT' || !err.message.startsWith('ENOENT: no such file')) { + // throw err; + // } + // } const dirName = dirname(pathToFile); await fs.mkdir(dirName, { recursive: true }); await fs.writeFile(pathToFile, content); @@ -60,19 +60,21 @@ for (const theme of themes) { await writeIfChanged(`lib/highlights-${theme}.js`, tokensToJs(highlightsTokens)); } - if (theme === defaultTheme) { - const pandaPreset = toPandaPreset(config); + if (!process.argv.includes('--watch')) { + if (theme === defaultTheme) { + const pandaPreset = toPandaPreset(config); - await writeIfChanged('lib/panda-preset.js', pandaPreset); - await writeIfChanged('lib/panda-preset.ts', pandaPreset); + await writeIfChanged('lib/panda-preset.js', pandaPreset); + await writeIfChanged('lib/panda-preset.ts', pandaPreset); - const usages = await processStyles(); + const usages = await processStyles(); - await processTokensToDocs(usages, { - basic: baseTokens, - semantic: semanticTokens, - highlight: highlightsTokens, - }); + await processTokensToDocs(usages, { + basic: baseTokens, + semantic: semanticTokens, + highlight: highlightsTokens, + }); + } } }