From 076c4c3954a93830f1e081b109bb057fec4a091b Mon Sep 17 00:00:00 2001 From: Brijesh Bittu Date: Wed, 6 Sep 2023 12:55:02 +0530 Subject: [PATCH] [zero][vite] Create a package for vite plugin (#38685) --- apps/zero-runtime-vite-app/package.json | 12 +- apps/zero-runtime-vite-app/vite.config.ts | 82 +----- apps/zero-runtime-vite-app/yarn.lock | 126 ++++----- .../zero-tag-processor/src/generateCss.ts | 2 +- packages/zero-tag-processor/src/styled.ts | 2 +- .../src/utils/cssFnValueToVariable.ts | 7 +- .../src/utils/cssFunctionTransformerPlugin.ts | 3 +- packages/zero-vite-plugin/.eslintrc.json | 5 + packages/zero-vite-plugin/README.md | 3 + packages/zero-vite-plugin/package.json | 60 +++++ packages/zero-vite-plugin/src/index.ts | 97 +++++++ packages/zero-vite-plugin/tsconfig.build.json | 21 ++ packages/zero-vite-plugin/tsconfig.json | 9 + tsconfig.json | 3 + yarn.lock | 241 +++++++++++++++++- 15 files changed, 506 insertions(+), 167 deletions(-) create mode 100644 packages/zero-vite-plugin/.eslintrc.json create mode 100644 packages/zero-vite-plugin/README.md create mode 100644 packages/zero-vite-plugin/package.json create mode 100644 packages/zero-vite-plugin/src/index.ts create mode 100644 packages/zero-vite-plugin/tsconfig.build.json create mode 100644 packages/zero-vite-plugin/tsconfig.json diff --git a/apps/zero-runtime-vite-app/package.json b/apps/zero-runtime-vite-app/package.json index d9d37527f78bde..786102223aff7e 100644 --- a/apps/zero-runtime-vite-app/package.json +++ b/apps/zero-runtime-vite-app/package.json @@ -13,13 +13,13 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@babel/core": "^7.22.10", - "@linaria/vite": "^4.5.4", - "@mui/utils": "^5.14.6", - "@mui/material": "^5.14.6", - "@mui/zero-tag-processor": "file:../../packages/zero-tag-processor/build", - "@types/babel__core": "^7.20.1", + "@mui/utils": "^5.14.8", + "@mui/material": "^5.14.8", + "@mui/zero-vite-plugin": "file:../../packages/zero-vite-plugin/build", "@vitejs/plugin-react": "^4.0.4", "vite": "4.4.9" + }, + "resolutions": { + "@mui/zero-tag-processor": "file:../../packages/zero-tag-processor/build" } } diff --git a/apps/zero-runtime-vite-app/vite.config.ts b/apps/zero-runtime-vite-app/vite.config.ts index b6b96230ddb8ea..4f0c09d7c5ebad 100644 --- a/apps/zero-runtime-vite-app/vite.config.ts +++ b/apps/zero-runtime-vite-app/vite.config.ts @@ -1,9 +1,7 @@ -import { defineConfig, splitVendorChunkPlugin, type PluginOption } from 'vite'; +import { defineConfig, splitVendorChunkPlugin } from 'vite'; import reactPlugin from '@vitejs/plugin-react'; -import linaria from '@linaria/vite'; +import { zeroVitePlugin } from '@mui/zero-vite-plugin'; import { createTheme } from '@mui/material/styles'; -import { generateCss } from '@mui/zero-tag-processor/generateCss'; -import { transformAsync } from '@babel/core'; const theme = createTheme(); // @TODO - Make this part of the main package @@ -18,73 +16,13 @@ theme.applyDarkStyles = function applyDarkStyles(obj) { const varPrefix = 'app'; -function muiZeroVitePlugin(): PluginOption { - function injectMUITokensPlugin(): PluginOption { - return { - name: 'vite-mui-theme-injection-plugin', - load(id) { - if (id.endsWith('@mui/zero-runtime/styles.css')) { - return { - code: generateCss( - { - cssVariablesPrefix: varPrefix, - themeArgs: { - theme, - }, - }, - {}, - ), - map: null, - }; - } - return null; - }, - }; - } - const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs', '.cts', '.cjs', '.mtsx']; - - function intermediateBabelPlugin(): PluginOption { - return { - name: 'vite-intermediate-plugin', - async transform(code, id) { - const [filename] = id.split('?'); - if ( - !filename.includes('zero-runtime-vite-app/src') || - !extensions.some((ext) => filename.endsWith(ext)) - ) { - return null; - } - const result = await transformAsync(code, { - filename, - babelrc: false, - configFile: false, - plugins: [['@mui/zero-tag-processor/pre-linaria-plugin']], - }); - return { - code: result?.code ?? code, - map: result?.map, - }; - }, - }; - } - - // @TODO - Expect most of these from users of the plugin. - const linariaPlugin = linaria({ - displayName: false, - sourceMap: true, - // @ts-ignore - cssVariablesPrefix: varPrefix, - themeArgs: { - theme, - }, - babelOptions: { - plugins: ['@babel/plugin-syntax-jsx'], - }, - }); - - return [injectMUITokensPlugin(), intermediateBabelPlugin(), linariaPlugin]; -} - export default defineConfig({ - plugins: [muiZeroVitePlugin(), reactPlugin(), splitVendorChunkPlugin()], + plugins: [ + zeroVitePlugin({ + cssVariablesPrefix: varPrefix, + theme, + }), + reactPlugin(), + splitVendorChunkPlugin(), + ], }); diff --git a/apps/zero-runtime-vite-app/yarn.lock b/apps/zero-runtime-vite-app/yarn.lock index a6fa2d579e1734..8b11f9f9212e04 100644 --- a/apps/zero-runtime-vite-app/yarn.lock +++ b/apps/zero-runtime-vite-app/yarn.lock @@ -252,7 +252,7 @@ chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.22.10", "@babel/parser@^7.22.5": +"@babel/parser@^7.22.10", "@babel/parser@^7.22.5": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.10.tgz#e37634f9a12a1716136c44624ef54283cabd3f55" integrity sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ== @@ -966,7 +966,7 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.5", "@babel/types@^7.4.4": +"@babel/types@^7.22.10", "@babel/types@^7.22.5", "@babel/types@^7.4.4": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.10.tgz#4a9e76446048f2c66982d1a989dd12b8a2d2dc03" integrity sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg== @@ -1321,37 +1321,37 @@ "@linaria/utils" "^4.5.3" "@rollup/pluginutils" "^4.1.0" -"@mui/base@5.0.0-beta.12": - version "5.0.0-beta.12" - resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.12.tgz#131882930bdbe236dd835867bf6222a993b8d219" - integrity sha512-tZjjXNAyUpwSDT1uRliZMhRQkWYzELJ8Qi61EuOMRpi36HIwnK2T7Nr4RI423Sv8G2EEikDAZj7je33eNd73NQ== +"@mui/base@5.0.0-beta.14": + version "5.0.0-beta.14" + resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.14.tgz#315b67b0fd231cbd47e8d54f8f92be23122e4d66" + integrity sha512-Je/9JzzYObsuLCIClgE8XvXNFb55IEz8n2NtStUfASfNiVrwiR8t6VVFFuhofehkyTIN34tq1qbBaOjCnOovBw== dependencies: "@babel/runtime" "^7.22.10" "@emotion/is-prop-valid" "^1.2.1" "@floating-ui/react-dom" "^2.0.1" "@mui/types" "^7.2.4" - "@mui/utils" "^5.14.6" + "@mui/utils" "^5.14.8" "@popperjs/core" "^2.11.8" clsx "^2.0.0" prop-types "^15.8.1" react-is "^18.2.0" -"@mui/core-downloads-tracker@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.6.tgz#8cbc3441a630e1810a945e408e5025bdc99ea2f7" - integrity sha512-QZEU3pyGWLuaHbxvOlShol7U1FVgzWBR0OH9H8D7L8w4/vto5N5jJVvlqFQS3T0zbR6YGHxFaiL6Ky87jQg7aw== +"@mui/core-downloads-tracker@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.8.tgz#9117bd29e94e96dc376f93a28e024666a2456696" + integrity sha512-8V7ZOC/lKkM03TRHqaThQFIq6bWPnj7L/ZWPh0ymldYFFyh8XdF0ywTgafsofDNYT4StlNknbaTjVHBma3SNjQ== -"@mui/material@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.14.6.tgz#12cbb716a7f70859764be310bb9b2f5ffc0da818" - integrity sha512-C3UgGrmtvcGkQkm0ONBU7bTdapTjQc2Se3b2354xMmU7lgSgW7VM6EP9wIH5XqqoJ60m9l/s9kbTWX0Y+EaWvA== +"@mui/material@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.14.8.tgz#1cad40f106f7c983639376589c3f21485fb1d166" + integrity sha512-fqvDGGF1pXwOOL/f0Gw+KHo/67hasRpf2ApTIJkbuONOk9AUb2jnYMEqCWmL2sUcbbE3ShMbHl8N7HPSsRv1/A== dependencies: "@babel/runtime" "^7.22.10" - "@mui/base" "5.0.0-beta.12" - "@mui/core-downloads-tracker" "^5.14.6" - "@mui/system" "^5.14.6" + "@mui/base" "5.0.0-beta.14" + "@mui/core-downloads-tracker" "^5.14.8" + "@mui/system" "^5.14.8" "@mui/types" "^7.2.4" - "@mui/utils" "^5.14.6" + "@mui/utils" "^5.14.8" "@types/react-transition-group" "^4.4.6" clsx "^2.0.0" csstype "^3.1.2" @@ -1359,35 +1359,35 @@ react-is "^18.2.0" react-transition-group "^4.4.5" -"@mui/private-theming@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.14.6.tgz#bd80c91bea94b6e54a74764f8d3fb0d4ec418acb" - integrity sha512-3VBLFGizBXfofyk33bwRg6t9L648aKnLmOKPfY1wFuiXq3AEYwobK65iDci/tHKxm/VKbZ6A7PFjLejvB3EvRQ== +"@mui/private-theming@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.14.8.tgz#8e224cd10c531d12b871dc59b1f9376028dd13bb" + integrity sha512-iBzpcl3Mh92XaYpYPdgzzRxNGkjpoDz8rf8/q5m+EBPowFEHV+CCS9hC0Q2pOKLW3VFFikA7w/GHt7n++40JGQ== dependencies: "@babel/runtime" "^7.22.10" - "@mui/utils" "^5.14.6" + "@mui/utils" "^5.14.8" prop-types "^15.8.1" -"@mui/styled-engine@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.14.6.tgz#a4034ab51981ecf673275b2c1d1da71deb94317f" - integrity sha512-I6zeu/OP1Hk4NsX1Oj85TiYl1dER0JMsLJVn76J1Ihl24A5EbiZQKJp3Mn+ufA79ypkdAvM9aQCAQyiVBFcUHg== +"@mui/styled-engine@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.14.8.tgz#b7a4d5dc6cbe3ecaa5af5189eb5ad90a62a255eb" + integrity sha512-LGwOav/Y40PZWZ2yDk4beUoRlc57Vg+Vpxi9V9BBtT2ESAucCgFobkt+T8eVLMWF9huUou5pwKgLSU5pF90hBg== dependencies: "@babel/runtime" "^7.22.10" "@emotion/cache" "^11.11.0" csstype "^3.1.2" prop-types "^15.8.1" -"@mui/system@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.14.6.tgz#621eae10c4dde0a2ab566ac09c26f7becfb7ba80" - integrity sha512-/n0ae1MegWjiV1BpRU8jgg4E0zBjeB2VYsT/68ag/xaDuq3/TaDKJeT9REIvyBvwlG3CI3S2O+tRELktxCD1kg== +"@mui/system@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.14.8.tgz#1ca201b948310083e670352bae2d7963ad6f971e" + integrity sha512-Dxnasv7Pj5hYe4ZZFKJZu4ufKm6cxpitWt3A+qMPps22YhqyeEqgDBq/HsAB3GOjqDP40fTAvQvS/Hguf4SJuw== dependencies: "@babel/runtime" "^7.22.10" - "@mui/private-theming" "^5.14.6" - "@mui/styled-engine" "^5.14.6" + "@mui/private-theming" "^5.14.8" + "@mui/styled-engine" "^5.14.8" "@mui/types" "^7.2.4" - "@mui/utils" "^5.14.6" + "@mui/utils" "^5.14.8" clsx "^2.0.0" csstype "^3.1.2" prop-types "^15.8.1" @@ -1397,10 +1397,10 @@ resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.4.tgz#b6fade19323b754c5c6de679a38f068fd50b9328" integrity sha512-LBcwa8rN84bKF+f5sDyku42w1NTxaPgPyYKODsh01U1fVstTClbUoSA96oyRBnSNyEiAVjKm6Gwx9vjR+xyqHA== -"@mui/utils@^5.14.6": - version "5.14.6" - resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.14.6.tgz#614338f781faf21535fbf1094b6691aaee1ff472" - integrity sha512-AznpqLu6hrFnpHgcvsSSMCG+cDbkcCYfo+daUwBVReNYv4l+NQ8+wvBAF4aUMi155N7xWbbgh0cyKs6Wdsm3aA== +"@mui/utils@^5.14.8": + version "5.14.8" + resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.14.8.tgz#e1737d5fcd54aa413d6b1aaea3ea670af2919402" + integrity sha512-1Ls2FfyY2yVSz9NEqedh3J8JAbbZAnUWkOWLE2f4/Hc4T5UWHMfzBLLrCqExfqyfyU+uXYJPGeNIsky6f8Gh5Q== dependencies: "@babel/runtime" "^7.22.10" "@types/prop-types" "^15.7.5" @@ -1409,12 +1409,12 @@ react-is "^18.2.0" "@mui/zero-runtime@file:../../packages/zero-runtime/build": - version "0.0.1-alpha.0" + version "0.0.1-alpha.1" dependencies: clsx "^2.0.0" -"@mui/zero-tag-processor@file:../../packages/zero-tag-processor/build": - version "0.0.1-alpha.0" +"@mui/zero-tag-processor@0.0.1-alpha.2", "@mui/zero-tag-processor@file:../../packages/zero-tag-processor/build": + version "0.0.1-alpha.2" dependencies: "@babel/core" "^7.22.10" "@babel/helper-module-imports" "^7.22.5" @@ -1423,9 +1423,16 @@ "@emotion/css" "^11.11.2" "@linaria/tags" "^4.5.4" "@linaria/utils" "^4.5.3" - "@mui/system" "^5.14.6" + "@mui/system" "^5.14.8" lodash.get "^4.4.2" +"@mui/zero-vite-plugin@file:../../packages/zero-vite-plugin/build": + version "0.0.1-alpha.0" + dependencies: + "@babel/core" "^7.22.10" + "@linaria/vite" "^4.5.4" + "@mui/zero-tag-processor" "0.0.1-alpha.2" + "@popperjs/core@^2.11.8": version "2.11.8" resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" @@ -1439,39 +1446,6 @@ estree-walker "^2.0.1" picomatch "^2.2.2" -"@types/babel__core@^7.20.1": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" - integrity sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw== - dependencies: - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.1.tgz#dd6f1d2411ae677dcb2db008c962598be31d6acf" - integrity sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg== - dependencies: - "@babel/types" "^7.20.7" - "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" diff --git a/packages/zero-tag-processor/src/generateCss.ts b/packages/zero-tag-processor/src/generateCss.ts index 76caa5fa34aa40..5f7ec194c26607 100644 --- a/packages/zero-tag-processor/src/generateCss.ts +++ b/packages/zero-tag-processor/src/generateCss.ts @@ -67,7 +67,7 @@ export function generateCss( } let cssStr = ''; Object.entries(themeArgs).forEach(([themeKey, theme]) => { - const cssVarsObject = generateCssForTheme(theme, [cssVariablesPrefix]); + const cssVarsObject = generateCssForTheme(theme as Theme, [cssVariablesPrefix]); const cssThemeObject: Record = {}; if (themeKey === defaultThemeKey && injectInRoot) { cssThemeObject[':root'] = cssVarsObject; diff --git a/packages/zero-tag-processor/src/styled.ts b/packages/zero-tag-processor/src/styled.ts index 6d0d264991fc3e..aa0a0adecac3f2 100644 --- a/packages/zero-tag-processor/src/styled.ts +++ b/packages/zero-tag-processor/src/styled.ts @@ -369,7 +369,7 @@ export default class StyledProcessor extends BaseProcessor { if (!value.name || !theme) { return; } - const componentData = theme.components?.[value.name]; + const componentData = (theme as Theme).components?.[value.name]; if (!componentData) { return; } diff --git a/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts b/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts index 687e43996983cc..761f74e4040cb8 100644 --- a/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts +++ b/packages/zero-tag-processor/src/utils/cssFnValueToVariable.ts @@ -19,9 +19,7 @@ export type PluginCustomOptions = { /** * Object to pass as parameter to the styled css callback functions. */ - themeArgs?: { - theme: Theme; - }; + themeArgs?: Record; }; type CssFnValueToVariableParams = { @@ -39,7 +37,8 @@ function transformThemeKeysInFn( filename?: string, ) { const { themeArgs: { theme } = {} } = options; - const config = theme?.unstable_sxConfig ?? defaultSxConfig; + const userTheme = theme as Theme; + const config = userTheme?.unstable_sxConfig ?? defaultSxConfig; const cssPropOptions = config[styleKey]; const { themeKey } = cssPropOptions; diff --git a/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts b/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts index 0ca3c4a2d36bc4..562cb8cd9ef8b2 100644 --- a/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts +++ b/packages/zero-tag-processor/src/utils/cssFunctionTransformerPlugin.ts @@ -1,6 +1,7 @@ import { declare } from '@babel/helper-plugin-utils'; import defaultSxConfig from '@mui/system/styleFunctionSx/defaultSxConfig'; import get from 'lodash.get'; +import type { Theme } from '@mui/material/styles'; import type { PluginCustomOptions } from './cssFnValueToVariable'; type BabelPluginOptions = { @@ -25,7 +26,7 @@ const cssFunctionTransformerPlugin = declare((api, pluginOpt options: { cssVariablesPrefix = 'mui', themeArgs: { theme } = {} }, styleKey, } = pluginOptions; - const config = theme?.unstable_sxConfig ?? defaultSxConfig; + const config = (theme as Theme)?.unstable_sxConfig ?? defaultSxConfig; const cssPropOptions = config[styleKey]; const { themeKey } = cssPropOptions; if (!theme || !config || !cssPropOptions || !themeKey) { diff --git a/packages/zero-vite-plugin/.eslintrc.json b/packages/zero-vite-plugin/.eslintrc.json new file mode 100644 index 00000000000000..54a33fd127fb66 --- /dev/null +++ b/packages/zero-vite-plugin/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@typescript-eslint/consistent-type-imports": "error" + } +} diff --git a/packages/zero-vite-plugin/README.md b/packages/zero-vite-plugin/README.md new file mode 100644 index 00000000000000..cec32be4e491c7 --- /dev/null +++ b/packages/zero-vite-plugin/README.md @@ -0,0 +1,3 @@ +# @mui/zero-vite-plugin + +Vite plugin to support MUI's `styled` processor. diff --git a/packages/zero-vite-plugin/package.json b/packages/zero-vite-plugin/package.json new file mode 100644 index 00000000000000..281b99799530bc --- /dev/null +++ b/packages/zero-vite-plugin/package.json @@ -0,0 +1,60 @@ +{ + "name": "@mui/zero-vite-plugin", + "version": "0.0.1-alpha.0", + "private": true, + "author": "MUI Team", + "description": "Vite plugin for MUI zero styled implementation.", + "main": "./src/index.ts", + "keywords": [ + "zero runtime", + "css-in-js", + "mui" + ], + "repository": { + "type": "git", + "url": "https://github.com/mui/material-ui.git", + "directory": "packages/zero-vite-plugin" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/mui/material-ui/issues" + }, + "homepage": "@TODO", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui" + }, + "scripts": { + "build": "yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:types && yarn build:copy-files", + "build:legacy": "node ../../scripts/build.mjs legacy", + "build:modern": "node ../../scripts/build.mjs modern", + "build:node": "node ../../scripts/build.mjs node", + "build:stable": "node ../../scripts/build.mjs stable", + "build:copy-files": "node ../../scripts/copyFiles.mjs", + "build:types": "node ../../scripts/buildTypes.mjs", + "prebuild": "rimraf build tsconfig.build.tsbuildinfo", + "release": "yarn build && npm publish build", + "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-babel-plugin/**/*.test.{js,ts,tsx}'", + "typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{spec,d}.{ts,tsx}\" && tsc -p tsconfig.json", + "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" + }, + "dependencies": { + "@babel/core": "^7.22.10", + "@linaria/vite": "^4.5.4", + "@mui/zero-tag-processor": "0.0.1-alpha.2" + }, + "devDependencies": { + "@types/babel__core": "^7.20.1", + "vite": "^4.4.9" + }, + "peerDependencies": { + "vite": "^4.0.0" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=12.0.0" + } +} diff --git a/packages/zero-vite-plugin/src/index.ts b/packages/zero-vite-plugin/src/index.ts new file mode 100644 index 00000000000000..109dd77514e19f --- /dev/null +++ b/packages/zero-vite-plugin/src/index.ts @@ -0,0 +1,97 @@ +import type { Plugin, PluginOption } from 'vite'; +import { generateCss } from '@mui/zero-tag-processor/generateCss'; +import { transformAsync } from '@babel/core'; +import baseLinaria from '@linaria/vite'; + +type LinariaOptions = Exclude[0], undefined>; + +export interface ZeroVitePluginOptions extends LinariaOptions { + /** + * The theme object that you want to be passed to the `styled` function + */ + theme: unknown; + /** + * Prefix string to use in the generated css variables. + */ + cssVariablesPrefix?: string; + /** + * Whether the css variables for the default theme should target the :root selector or not. + * @default true + */ + injectDefaultThemeInRoot?: boolean; +} + +type LinariaWrapperOptions = Exclude & { + themeArgs: Record; +}; + +const linaria = (options: LinariaWrapperOptions): Plugin => { + return baseLinaria(options); +}; + +export function zeroVitePlugin(options: ZeroVitePluginOptions): PluginOption { + const { cssVariablesPrefix = 'mui', injectDefaultThemeInRoot = true, theme } = options ?? {}; + + function injectMUITokensPlugin(): PluginOption { + return { + name: 'vite-mui-theme-injection-plugin', + load(id) { + if (id.endsWith('@mui/zero-runtime/styles.css')) { + return { + code: generateCss( + { + cssVariablesPrefix, + themeArgs: { + theme, + }, + }, + { + defaultThemeKey: 'theme', + injectInRoot: injectDefaultThemeInRoot, + }, + ), + map: null, + }; + } + return null; + }, + }; + } + const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs', '.cts', '.cjs', '.mtsx']; + + function intermediateBabelPlugin(): PluginOption { + return { + name: 'vite-intermediate-plugin', + async transform(code, id) { + const [filename] = id.split('?'); + if (!extensions.some((ext) => filename.endsWith(ext))) { + return null; + } + const result = await transformAsync(code, { + filename, + babelrc: false, + configFile: false, + plugins: [['@mui/zero-tag-processor/pre-linaria-plugin']], + }); + return { + code: result?.code ?? code, + map: result?.map, + }; + }, + }; + } + + const linariaPlugin = linaria({ + cssVariablesPrefix, + themeArgs: { + theme, + }, + ...options, + babelOptions: { + ...options?.babelOptions, + plugins: ['@babel/plugin-syntax-jsx'], + }, + }); + + return [injectMUITokensPlugin(), intermediateBabelPlugin(), linariaPlugin]; +} diff --git a/packages/zero-vite-plugin/tsconfig.build.json b/packages/zero-vite-plugin/tsconfig.build.json new file mode 100644 index 00000000000000..2f20623e244163 --- /dev/null +++ b/packages/zero-vite-plugin/tsconfig.build.json @@ -0,0 +1,21 @@ +{ + // This config is for emitting declarations (.d.ts) only + // Actual .ts source files are transpiled via babel + "extends": "./tsconfig", + "compilerOptions": { + "target": "ES2015", + "composite": true, + "declaration": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "build", + "rootDir": "./src" + }, + "include": ["./src/**/*.ts*"], + "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], + "references": [ + { "path": "../mui-system/tsconfig.build.json" }, + { "path": "../mui-material/tsconfig.build.json" }, + { "path": "../zero-tag-processor/tsconfig.build.json" } + ] +} diff --git a/packages/zero-vite-plugin/tsconfig.json b/packages/zero-vite-plugin/tsconfig.json new file mode 100644 index 00000000000000..79f9a30c3552bd --- /dev/null +++ b/packages/zero-vite-plugin/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig", + "include": ["src/**/*", "test/**/*"], + "compilerOptions": { + "lib": ["ES2022", "DOM"], + "target": "ES2015", + "types": ["mocha", "node", "chai"] + } +} diff --git a/tsconfig.json b/tsconfig.json index 7caf992444606a..607b998b6a5e77 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -39,6 +39,9 @@ "@mui/material-next/*": ["./packages/mui-material-next/src/*"], "@mui/joy": ["./packages/mui-joy/src"], "@mui/joy/*": ["./packages/mui-joy/src/*"], + "@mui/zero-runtime/*": ["./packages/zero-runtime/src/*"], + "@mui/zero-tag-processor/*": ["./packages/zero-tag-processor/src/*"], + "@mui/zero-vite-plugin/*": ["./packages/zero-vite-plugin/src/*"], "test/*": ["./test/*"], "typescript-to-proptypes": ["./packages/typescript-to-proptypes/src"] }, diff --git a/yarn.lock b/yarn.lock index ba6f6245a28c01..6ee2e13b24b426 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1062,7 +1062,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-runtime@^7.22.10": +"@babel/plugin-transform-runtime@^7.22.10", "@babel/plugin-transform-runtime@^7.22.9": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.22.10.tgz#89eda6daf1d3af6f36fb368766553054c8d7cd46" integrity sha512-RchI7HePu1eu0CYNKHHHQdfenZcM4nz8rew5B1VWqeRKdcwW5aQ5HeG9eTUbWiAS1UrmHVLmoxTWHt3iLD/NhA== @@ -1151,7 +1151,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/preset-env@^7.22.10": +"@babel/preset-env@^7.22.10", "@babel/preset-env@^7.22.9": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.10.tgz#3263b9fe2c8823d191d28e61eac60a79f9ce8a0f" integrity sha512-riHpLb1drNkpLlocmSyEg4oYJIQFeXAK/d7rI6mbD0XsvoTOOweXDmQPG/ErxsEhWk3rl3Q/3F6RFQlVFS8m0A== @@ -1697,6 +1697,116 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz#d0fce5d07b0620caa282b5131c297bb60f9d87e6" integrity sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww== +"@esbuild/android-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" + integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ== + +"@esbuild/android-arm@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682" + integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw== + +"@esbuild/android-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2" + integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg== + +"@esbuild/darwin-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz#08172cbeccf95fbc383399a7f39cfbddaeb0d7c1" + integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== + +"@esbuild/darwin-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d" + integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ== + +"@esbuild/freebsd-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54" + integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw== + +"@esbuild/freebsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e" + integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ== + +"@esbuild/linux-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0" + integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA== + +"@esbuild/linux-arm@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0" + integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg== + +"@esbuild/linux-ia32@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7" + integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA== + +"@esbuild/linux-loong64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d" + integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg== + +"@esbuild/linux-mips64el@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231" + integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ== + +"@esbuild/linux-ppc64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb" + integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA== + +"@esbuild/linux-riscv64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6" + integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A== + +"@esbuild/linux-s390x@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" + integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== + +"@esbuild/linux-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338" + integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== + +"@esbuild/netbsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1" + integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A== + +"@esbuild/openbsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae" + integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg== + +"@esbuild/sunos-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d" + integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ== + +"@esbuild/win32-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9" + integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg== + +"@esbuild/win32-ia32@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102" + integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g== + +"@esbuild/win32-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" + integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -2043,6 +2153,35 @@ yargs "16.2.0" yargs-parser "20.2.4" +"@linaria/babel-preset@^4.5.4": + version "4.5.4" + resolved "https://registry.yarnpkg.com/@linaria/babel-preset/-/babel-preset-4.5.4.tgz#2b449cd518c9bb3b26a934ea98f5288fb9d5d675" + integrity sha512-AbOTqCb7XbQGAUNQkt8YxysXsek3qTEfXwj46bYLyFu/ADZ+ypmAUcmNJRJSjI0qAoS+ZFuK2dEpuwFVYeiveQ== + dependencies: + "@babel/core" "^7.22.9" + "@babel/generator" "^7.22.9" + "@babel/helper-module-imports" "^7.22.5" + "@babel/template" "^7.22.5" + "@babel/traverse" "^7.22.8" + "@babel/types" "^7.22.5" + "@linaria/core" "^4.5.4" + "@linaria/logger" "^4.5.0" + "@linaria/shaker" "^4.5.3" + "@linaria/tags" "^4.5.4" + "@linaria/utils" "^4.5.3" + cosmiconfig "^8.0.0" + source-map "^0.7.3" + stylis "^3.5.4" + +"@linaria/core@^4.5.4": + version "4.5.4" + resolved "https://registry.yarnpkg.com/@linaria/core/-/core-4.5.4.tgz#1bc989199e786da9cf21b0d26e1213687f886c96" + integrity sha512-vMs/5iU0stxjfbBCxobIgY+wSQx4G8ukNwrhjPVD+6bF9QrTwi5rl0mKaCMxaGMjnfsLRiiM3i+hnWLIEYLdSg== + dependencies: + "@linaria/logger" "^4.5.0" + "@linaria/tags" "^4.5.4" + "@linaria/utils" "^4.5.3" + "@linaria/logger@^4.5.0": version "4.5.0" resolved "https://registry.yarnpkg.com/@linaria/logger/-/logger-4.5.0.tgz#e5de815ffe7806822f47a559a512b98f66acea13" @@ -2051,6 +2190,22 @@ debug "^4.1.1" picocolors "^1.0.0" +"@linaria/shaker@^4.5.3": + version "4.5.3" + resolved "https://registry.yarnpkg.com/@linaria/shaker/-/shaker-4.5.3.tgz#0f6b588f61f2f3d425287a939256acbb64269a95" + integrity sha512-UeNw8HtY43pm+D0B+kq8BrW9GsRxm11zT7Lq3Qry8sX2mapvFqXaQ7VpTFHWEdkcbv7JOxBAMial2fu+ce/zqA== + dependencies: + "@babel/core" "^7.22.9" + "@babel/generator" "^7.22.9" + "@babel/plugin-transform-modules-commonjs" "^7.22.5" + "@babel/plugin-transform-runtime" "^7.22.9" + "@babel/plugin-transform-template-literals" "^7.22.5" + "@babel/preset-env" "^7.22.9" + "@linaria/logger" "^4.5.0" + "@linaria/utils" "^4.5.3" + babel-plugin-transform-react-remove-prop-types "^0.4.24" + ts-invariant "^0.10.3" + "@linaria/tags@^4.5.4": version "4.5.4" resolved "https://registry.yarnpkg.com/@linaria/tags/-/tags-4.5.4.tgz#071ab024227433f783ea2d948904fc164731a912" @@ -2078,6 +2233,16 @@ find-up "^5.0.0" minimatch "^9.0.3" +"@linaria/vite@^4.5.4": + version "4.5.4" + resolved "https://registry.yarnpkg.com/@linaria/vite/-/vite-4.5.4.tgz#bbccbd3de67715a8b6759a578c086c1ab31ec8d2" + integrity sha512-YhaLgTAfE7xzRLJwxWjo0Ak/YOJ+kPWuOm3lrkziclsvf1bbTUHlecmvth+2KuJG8HEPReekuyDErnwIQoD6sA== + dependencies: + "@linaria/babel-preset" "^4.5.4" + "@linaria/logger" "^4.5.0" + "@linaria/utils" "^4.5.3" + "@rollup/pluginutils" "^4.1.0" + "@material-ui/types@^4.0.0": version "4.1.1" resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-4.1.1.tgz#b65e002d926089970a3271213a3ad7a21b17f02b" @@ -2859,6 +3024,14 @@ "@rollup/pluginutils" "^5.0.1" magic-string "^0.27.0" +"@rollup/pluginutils@^4.1.0": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz#e6c6c3aba0744edce3fb2074922d3776c0af2a6d" + integrity sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ== + dependencies: + estree-walker "^2.0.1" + picomatch "^2.2.2" + "@rollup/pluginutils@^5.0.1": version "5.0.2" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" @@ -6272,7 +6445,7 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -cosmiconfig@^8.2.0: +cosmiconfig@^8.0.0, cosmiconfig@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.2.0.tgz#f7d17c56a590856cd1e7cee98734dca272b0d8fd" integrity sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ== @@ -7492,6 +7665,34 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" +esbuild@^0.18.10: + version "0.18.20" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" + integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA== + optionalDependencies: + "@esbuild/android-arm" "0.18.20" + "@esbuild/android-arm64" "0.18.20" + "@esbuild/android-x64" "0.18.20" + "@esbuild/darwin-arm64" "0.18.20" + "@esbuild/darwin-x64" "0.18.20" + "@esbuild/freebsd-arm64" "0.18.20" + "@esbuild/freebsd-x64" "0.18.20" + "@esbuild/linux-arm" "0.18.20" + "@esbuild/linux-arm64" "0.18.20" + "@esbuild/linux-ia32" "0.18.20" + "@esbuild/linux-loong64" "0.18.20" + "@esbuild/linux-mips64el" "0.18.20" + "@esbuild/linux-ppc64" "0.18.20" + "@esbuild/linux-riscv64" "0.18.20" + "@esbuild/linux-s390x" "0.18.20" + "@esbuild/linux-x64" "0.18.20" + "@esbuild/netbsd-x64" "0.18.20" + "@esbuild/openbsd-x64" "0.18.20" + "@esbuild/sunos-x64" "0.18.20" + "@esbuild/win32-arm64" "0.18.20" + "@esbuild/win32-ia32" "0.18.20" + "@esbuild/win32-x64" "0.18.20" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -7815,7 +8016,7 @@ estree-walker@^0.6.1: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== -estree-walker@^2.0.2: +estree-walker@^2.0.1, estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== @@ -13170,7 +13371,7 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.0, picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.0, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -14644,7 +14845,7 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.8.1: dependencies: estree-walker "^0.6.1" -rollup@^3.28.1: +rollup@^3.27.1, rollup@^3.28.1: version "3.28.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.28.1.tgz#fb44aa6d5e65c7e13fd5bcfff266d0c4ea9ba433" integrity sha512-R9OMQmIHJm9znrU3m3cpE8uhN0fGdXiawME7aZIpQqvpS/85+Vt1Hq1/yVIcYfOmaQiHjvXkQAoJukvLpau6Yw== @@ -15209,6 +15410,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@^0.7.3: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + sourcemap-codec@^1.4.8: version "1.4.8" resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" @@ -15687,6 +15893,11 @@ stylis@4.2.0, stylis@^4.2.0: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.2.0.tgz#79daee0208964c8fe695a42fcffcac633a211a51" integrity sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw== +stylis@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe" + integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q== + sucrase@^3.21.0, sucrase@^3.32.0: version "3.32.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.32.0.tgz#c4a95e0f1e18b6847127258a75cf360bc568d4a7" @@ -16113,6 +16324,13 @@ ts-interface-checker@^0.1.9: resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== +ts-invariant@^0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" + integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== + dependencies: + tslib "^2.1.0" + ts-node@^10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -16743,6 +16961,17 @@ victory-vendor@^36.6.8: d3-time "^3.0.0" d3-timer "^3.0.1" +vite@^4.4.9: + version "4.4.9" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d" + integrity sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA== + dependencies: + esbuild "^0.18.10" + postcss "^8.4.27" + rollup "^3.27.1" + optionalDependencies: + fsevents "~2.3.2" + vlq@^0.2.2: version "0.2.3" resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"