From 2384cac6e0b343c4e3b15f2027c6e3baf405c38e Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Sat, 7 Jan 2023 15:27:25 +0100 Subject: [PATCH] chore: upgrade to Linaria v4 --- .../ahead-of-time-compilation/with-babel.md | 4 +- .../ahead-of-time-compilation/with-webpack.md | 4 +- ...-b40a43d0-1b08-4469-8ac1-c1d56a93523d.json | 7 + ...-b20f4e52-7e3f-4efc-ac1d-6157f9fb99ee.json | 7 + ...-0d6fd156-25c5-453b-a0d6-633a6c4adcb8.json | 7 + ...-294e1c0f-f12b-4129-b5dc-27cdebd726d0.json | 7 + e2e/nextjs/project.json | 2 +- e2e/nextjs/src/test.ts | 1 + package.json | 12 +- packages/babel-preset/README.md | 41 +- .../assets-multiple-declarations/output.ts | 10 +- .../assets-reset-styles/output.ts | 16 +- .../__fixtures__/assets-urls/output.ts | 4 +- .../__fixtures__/assets/output.ts | 22 +- .../config-babel-options/output.ts | 12 +- .../config-evaluation-rules/output.ts | 5 +- .../sampleEvaluator.js | 15 +- .../__fixtures__/duplicated-imports/code.ts | 10 +- .../__fixtures__/duplicated-imports/output.ts | 21 +- .../error-argument-count/fixture.js | 4 - .../__fixtures__/function-mixin/output.ts | 5 +- .../__fixtures__/import-alias/output.ts | 4 +- .../__fixtures__/import-custom-module/code.ts | 6 - .../import-custom-module/output.ts | 12 - .../__fixtures__/import-custom-name/code.ts | 6 - .../__fixtures__/import-custom-name/output.ts | 12 - .../__fixtures__/keyframes/output.ts | 4 +- .../multiple-declarations/output.ts | 7 +- .../non-existing-module-call/code.ts | 10 - .../non-existing-module-call/module.ts | 13 - .../non-existing-module-call/output.ts | 13 - .../object-computed-keys/output.ts | 5 +- .../object-imported-keys/output.ts | 5 +- .../__fixtures__/object-mixins/output.ts | 5 +- .../__fixtures__/object-nesting/output.ts | 5 +- .../__fixtures__/object-sequence-expr/code.ts | 3 +- .../object-sequence-expr/output.ts | 7 +- .../__fixtures__/object-variables/output.ts | 6 +- .../__fixtures__/object/output.ts | 4 +- .../require-custom-module/code.ts | 10 - .../require-custom-module/output.ts | 13 - .../__fixtures__/require-reset-styles/code.ts | 7 +- .../require-reset-styles/output.ts | 7 +- .../babel-preset/__fixtures__/require/code.ts | 5 +- .../__fixtures__/require/output.ts | 6 +- .../__fixtures__/reset-styles/output.ts | 4 +- .../rules-with-metadata/output.ts | 4 +- .../__fixtures__/shared-mixins/output.ts | 5 +- .../__fixtures__/tokens/output.ts | 5 +- .../unsupported-css-properties/output.ts | 4 +- packages/babel-preset/package.json | 12 +- .../src/assets/absolutePathToRelative.test.ts | 62 -- .../src/assets/isAssetUrl.test.ts | 24 - .../babel-preset/src/assets/isAssetUrl.ts | 11 - .../src/assets/normalizeStyleRules.test.ts | 151 --- .../src/assets/replaceAssetsWithImports.ts | 90 -- ...{transformPlugin.test.ts => index.test.ts} | 66 +- packages/babel-preset/src/index.ts | 21 +- packages/babel-preset/src/schema.ts | 18 - packages/babel-preset/src/transformPlugin.ts | 373 ------- packages/babel-preset/src/types.ts | 17 +- .../babel-preset/src/utils/evaluatePaths.ts | 34 - .../src/utils/evaluatePathsInVM.test.ts | 16 - .../src/utils/evaluatePathsInVM.ts | 111 -- .../babel-preset/src/validateOptions.test.ts | 21 +- packages/babel-preset/src/validateOptions.ts | 4 +- packages/babel-preset/tsconfig.spec.json | 1 + packages/linaria-processor/.eslintrc.json | 18 + packages/linaria-processor/README.md | 55 + packages/linaria-processor/jest.config.js | 14 + packages/linaria-processor/package.json | 30 + packages/linaria-processor/project.json | 49 + .../src/BaseGriffelProcessor.ts | 46 + .../src/MakeResetStylesProcessor.ts | 48 + .../src/MakeStylesProcessor.ts | 82 ++ .../src/assets/createRuleLiteral.test.ts | 61 ++ .../src/assets/createRuleLiteral.ts | 51 + .../src/assets/normalizeStyleRules.test.ts | 187 ++++ .../src/assets/normalizeStyleRules.ts | 36 +- .../assets/relativePathToImportLike.test.ts | 74 ++ .../src/assets/relativePathToImportLike.ts} | 13 +- packages/linaria-processor/src/index.ts | 1 + packages/linaria-processor/src/types.ts | 4 + packages/linaria-processor/tsconfig.json | 23 + packages/linaria-processor/tsconfig.lib.json | 11 + packages/linaria-processor/tsconfig.spec.json | 20 + packages/react/package.json | 6 + packages/webpack-loader/README.md | 44 +- .../__fixtures__/config-modules/code.ts | 6 - .../__fixtures__/config-modules/output.ts | 12 - .../__fixtures__/error-argument-count/code.ts | 4 - .../error-argument-count/error.ts | 1 - .../__fixtures__/error-config/error.ts | 2 +- .../__fixtures__/error-syntax/code.txt | 6 - .../__fixtures__/error-syntax/error.ts | 1 - .../__fixtures__/function/output.ts | 4 +- .../__fixtures__/object/output.ts | 5 +- .../__fixtures__/react-component/code.ts | 12 + .../__fixtures__/react-component/output.ts | 18 + .../__fixtures__/reset/output.ts | 5 +- .../__fixtures__/webpack-aliases/output.ts | 7 +- .../webpack-resolve-plugins/output.ts | 7 +- packages/webpack-loader/package.json | 7 +- packages/webpack-loader/src/transformSync.ts | 57 -- .../webpack-loader/src/webpackLoader.test.ts | 74 +- packages/webpack-loader/src/webpackLoader.ts | 127 +-- tsconfig.base.json | 3 + workspace.json | 1 + yarn.lock | 946 +++++++++--------- 109 files changed, 1568 insertions(+), 2055 deletions(-) create mode 100644 change/@griffel-babel-preset-b40a43d0-1b08-4469-8ac1-c1d56a93523d.json create mode 100644 change/@griffel-linaria-processor-b20f4e52-7e3f-4efc-ac1d-6157f9fb99ee.json create mode 100644 change/@griffel-react-0d6fd156-25c5-453b-a0d6-633a6c4adcb8.json create mode 100644 change/@griffel-webpack-loader-294e1c0f-f12b-4129-b5dc-27cdebd726d0.json delete mode 100644 packages/babel-preset/__fixtures__/error-argument-count/fixture.js delete mode 100644 packages/babel-preset/__fixtures__/import-custom-module/code.ts delete mode 100644 packages/babel-preset/__fixtures__/import-custom-module/output.ts delete mode 100644 packages/babel-preset/__fixtures__/import-custom-name/code.ts delete mode 100644 packages/babel-preset/__fixtures__/import-custom-name/output.ts delete mode 100644 packages/babel-preset/__fixtures__/non-existing-module-call/code.ts delete mode 100644 packages/babel-preset/__fixtures__/non-existing-module-call/module.ts delete mode 100644 packages/babel-preset/__fixtures__/non-existing-module-call/output.ts delete mode 100644 packages/babel-preset/__fixtures__/require-custom-module/code.ts delete mode 100644 packages/babel-preset/__fixtures__/require-custom-module/output.ts delete mode 100644 packages/babel-preset/src/assets/absolutePathToRelative.test.ts delete mode 100644 packages/babel-preset/src/assets/isAssetUrl.test.ts delete mode 100644 packages/babel-preset/src/assets/isAssetUrl.ts delete mode 100644 packages/babel-preset/src/assets/normalizeStyleRules.test.ts delete mode 100644 packages/babel-preset/src/assets/replaceAssetsWithImports.ts rename packages/babel-preset/src/{transformPlugin.test.ts => index.test.ts} (77%) delete mode 100644 packages/babel-preset/src/transformPlugin.ts delete mode 100644 packages/babel-preset/src/utils/evaluatePaths.ts delete mode 100644 packages/babel-preset/src/utils/evaluatePathsInVM.test.ts delete mode 100644 packages/babel-preset/src/utils/evaluatePathsInVM.ts create mode 100644 packages/linaria-processor/.eslintrc.json create mode 100644 packages/linaria-processor/README.md create mode 100644 packages/linaria-processor/jest.config.js create mode 100644 packages/linaria-processor/package.json create mode 100644 packages/linaria-processor/project.json create mode 100644 packages/linaria-processor/src/BaseGriffelProcessor.ts create mode 100644 packages/linaria-processor/src/MakeResetStylesProcessor.ts create mode 100644 packages/linaria-processor/src/MakeStylesProcessor.ts create mode 100644 packages/linaria-processor/src/assets/createRuleLiteral.test.ts create mode 100644 packages/linaria-processor/src/assets/createRuleLiteral.ts create mode 100644 packages/linaria-processor/src/assets/normalizeStyleRules.test.ts rename packages/{babel-preset => linaria-processor}/src/assets/normalizeStyleRules.ts (63%) create mode 100644 packages/linaria-processor/src/assets/relativePathToImportLike.test.ts rename packages/{babel-preset/src/assets/absolutePathToRelative.ts => linaria-processor/src/assets/relativePathToImportLike.ts} (59%) create mode 100644 packages/linaria-processor/src/index.ts create mode 100644 packages/linaria-processor/src/types.ts create mode 100644 packages/linaria-processor/tsconfig.json create mode 100644 packages/linaria-processor/tsconfig.lib.json create mode 100644 packages/linaria-processor/tsconfig.spec.json delete mode 100644 packages/webpack-loader/__fixtures__/config-modules/code.ts delete mode 100644 packages/webpack-loader/__fixtures__/config-modules/output.ts delete mode 100644 packages/webpack-loader/__fixtures__/error-argument-count/code.ts delete mode 100644 packages/webpack-loader/__fixtures__/error-argument-count/error.ts delete mode 100644 packages/webpack-loader/__fixtures__/error-syntax/code.txt delete mode 100644 packages/webpack-loader/__fixtures__/error-syntax/error.ts create mode 100644 packages/webpack-loader/__fixtures__/react-component/code.ts create mode 100644 packages/webpack-loader/__fixtures__/react-component/output.ts delete mode 100644 packages/webpack-loader/src/transformSync.ts diff --git a/apps/website/docs/react/ahead-of-time-compilation/with-babel.md b/apps/website/docs/react/ahead-of-time-compilation/with-babel.md index bff405335..609cbee47 100644 --- a/apps/website/docs/react/ahead-of-time-compilation/with-babel.md +++ b/apps/website/docs/react/ahead-of-time-compilation/with-babel.md @@ -13,14 +13,14 @@ import TabItem from '@theme/TabItem'; ```shell -yarn add --dev @griffel/babel-preset +yarn add --dev @griffel/babel-preset @griffel/linaria-processor ``` ```shell -npm install --save-dev @griffel/babel-preset +npm install --save-dev @griffel/babel-preset @griffel/linaria-processor ``` diff --git a/apps/website/docs/react/ahead-of-time-compilation/with-webpack.md b/apps/website/docs/react/ahead-of-time-compilation/with-webpack.md index 2c1096553..fe5da823d 100644 --- a/apps/website/docs/react/ahead-of-time-compilation/with-webpack.md +++ b/apps/website/docs/react/ahead-of-time-compilation/with-webpack.md @@ -13,14 +13,14 @@ import TabItem from '@theme/TabItem'; ```shell -yarn add --dev @griffel/webpack-loader +yarn add --dev @griffel/linaria-processor @griffel/webpack-loader ``` ```shell -npm install --save-dev @griffel/webpack-loader +npm install --save-dev @griffel/linaria-processor @griffel/webpack-loader ``` diff --git a/change/@griffel-babel-preset-b40a43d0-1b08-4469-8ac1-c1d56a93523d.json b/change/@griffel-babel-preset-b40a43d0-1b08-4469-8ac1-c1d56a93523d.json new file mode 100644 index 000000000..2e22eca7d --- /dev/null +++ b/change/@griffel-babel-preset-b40a43d0-1b08-4469-8ac1-c1d56a93523d.json @@ -0,0 +1,7 @@ +{ + "type": "major", + "comment": "BREAKING: update to Linaria v4", + "packageName": "@griffel/babel-preset", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@griffel-linaria-processor-b20f4e52-7e3f-4efc-ac1d-6157f9fb99ee.json b/change/@griffel-linaria-processor-b20f4e52-7e3f-4efc-ac1d-6157f9fb99ee.json new file mode 100644 index 000000000..063a1a8ec --- /dev/null +++ b/change/@griffel-linaria-processor-b20f4e52-7e3f-4efc-ac1d-6157f9fb99ee.json @@ -0,0 +1,7 @@ +{ + "type": "major", + "comment": "chore: initial release", + "packageName": "@griffel/linaria-processor", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@griffel-react-0d6fd156-25c5-453b-a0d6-633a6c4adcb8.json b/change/@griffel-react-0d6fd156-25c5-453b-a0d6-633a6c4adcb8.json new file mode 100644 index 000000000..47ec6490e --- /dev/null +++ b/change/@griffel-react-0d6fd156-25c5-453b-a0d6-633a6c4adcb8.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "chore: add meta to package.json for @griffel/processor", + "packageName": "@griffel/react", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@griffel-webpack-loader-294e1c0f-f12b-4129-b5dc-27cdebd726d0.json b/change/@griffel-webpack-loader-294e1c0f-f12b-4129-b5dc-27cdebd726d0.json new file mode 100644 index 000000000..c51c1a388 --- /dev/null +++ b/change/@griffel-webpack-loader-294e1c0f-f12b-4129-b5dc-27cdebd726d0.json @@ -0,0 +1,7 @@ +{ + "type": "major", + "comment": "BREAKING: update to Linaria v4", + "packageName": "@griffel/webpack-loader", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/e2e/nextjs/project.json b/e2e/nextjs/project.json index b0b5ed878..1402959fb 100644 --- a/e2e/nextjs/project.json +++ b/e2e/nextjs/project.json @@ -2,7 +2,7 @@ "root": "e2e/nextjs", "sourceRoot": "e2e/nextjs/src", "projectType": "library", - "implicitDependencies": ["@griffel/webpack-loader"], + "implicitDependencies": ["@griffel/linaria-processor", "@griffel/webpack-loader"], "targets": { "test": { "executor": "@nrwl/workspace:run-commands", diff --git a/e2e/nextjs/src/test.ts b/e2e/nextjs/src/test.ts index 305fe5f60..528e6c6a5 100644 --- a/e2e/nextjs/src/test.ts +++ b/e2e/nextjs/src/test.ts @@ -22,6 +22,7 @@ async function performTest() { const resolutions = await Promise.all([ packLocalPackage(rootDir, tempDir, '@griffel/core'), packLocalPackage(rootDir, tempDir, '@griffel/react'), + packLocalPackage(rootDir, tempDir, '@griffel/linaria-processor'), packLocalPackage(rootDir, tempDir, '@griffel/webpack-extraction-plugin'), packLocalPackage(rootDir, tempDir, '@griffel/webpack-loader'), packLocalPackage(rootDir, tempDir, '@griffel/next-extraction-plugin'), diff --git a/package.json b/package.json index d06575969..e6514e4bf 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "type-check": "nx affected --target=type-check" }, "devDependencies": { + "@babel/generator": "^7.12.13", "@babel/preset-typescript": "7.12.13", "@codesandbox/sandpack-react": "1.18.4", "@codesandbox/sandpack-themes": "1.17.0", @@ -131,20 +132,19 @@ }, "dependencies": { "@babel/core": "^7.12.13", - "@babel/generator": "^7.12.13", "@babel/helper-module-imports": "^7.12.13", "@babel/helper-plugin-utils": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.13", "@emotion/hash": "^0.8.0", - "@linaria/babel-preset": "^3.0.0-beta.23", - "@linaria/shaker": "^3.0.0-beta.22", + "@linaria/babel-preset": "^4.4.0", + "@linaria/shaker": "^4.2.8", + "@linaria/tags": "^4.3.1", + "@linaria/utils": "^4.3.1", + "@linaria/webpack-loader": "^4.1.12", "@swc/core": "^1.3.19", "@typescript-eslint/utils": "^5.20.0", "ajv": "^8.4.0", "browserslist": "^4.19.1", "csstype": "^3.0.10", - "enhanced-resolve": "^5.8.2", "rtl-css-js": "^1.16.1", "source-map-js": "1.0.2", "stylis": "^4.0.13", diff --git a/packages/babel-preset/README.md b/packages/babel-preset/README.md index 46c842373..0c80521b7 100644 --- a/packages/babel-preset/README.md +++ b/packages/babel-preset/README.md @@ -21,9 +21,9 @@ A Babel preset that performs build time transforms for [`@griffel/react`](../rea ## Install ```bash -yarn add --dev @griffel/babel-preset +yarn add --dev @griffel/babel-preset @griffel/linaria-processor # or -npm install --save-dev @griffel/babel-preset +npm install --save-dev @griffel/babel-preset @griffel/linaria-processor ``` ## When to use it? @@ -49,22 +49,27 @@ import { makeStyles } from 'custom-package'; import { createStyles } from 'custom-package'; ``` -By default, preset handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings should be tweaked: +By default, preset handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings you need to include meta information to a matching `package.json`: ```json { - "presets": [ - [ - "@griffel", - { - "modules": [{ "moduleSource": "custom-package", "importName": "makeStyles" }] - } - ] - ] + "name": "custom-package", + "version": "1.0.0", + "linaria": { + "tags": { + "makeStyles": "@griffel/linaria-processor/make-styles", + "makeResetStyles": "@griffel/linaria-processor/make-reset-styles" + } + } } ``` -> **Note**: "custom-package" should re-export `__styles` function from `@griffel/react` +> **Note**: "custom-package" should re-export following functions from `@griffel/react`: +> +> - `__styles` +> - `__css` +> - `__resetStyles` +> - `__resetCSS` ### Configuring Babel settings @@ -156,9 +161,9 @@ const useStyles = makeStyles({ roughly to ```js -import { __styles } from '@griffel/react'; +import { __styles as _styles } from '@griffel/react'; -const useStyles = __styles(/* resolved styles */); +const useStyles = _styles(/* resolved styles */); ``` ## Troubleshooting @@ -168,7 +173,7 @@ However, the concepts are not coupled to the repo setup. ### Module evaluation -The preset uses tools from [linaria](https://github.com/callstack/linaria) to evaluate runtime calls of `makeStyles`. +The preset reuses `@linaria/babel-preset` from [linaria](https://github.com/callstack/linaria) to evaluate runtime calls of `makeStyles` and `makeResetStyles`. [Linaria's debugging documentation can help here](https://github.com/callstack/linaria/blob/master/CONTRIBUTING.md#debugging-and-deep-dive-into-babel-plugin). Debugging output can be activated with following environment variables: @@ -182,9 +187,3 @@ On Windows it's required to set environment variables via [`set`](https://docs.m ```sh $ cross-env DEBUG=linaria\* LINARIA_LOG=debug yarn build ``` - -The debug output will include: - -- Prepared code -- Evaluated code -- AST that indicates what code has been shaken with `@linaria/shaker` diff --git a/packages/babel-preset/__fixtures__/assets-multiple-declarations/output.ts b/packages/babel-preset/__fixtures__/assets-multiple-declarations/output.ts index 56fa34f7a..32aed5e39 100644 --- a/packages/babel-preset/__fixtures__/assets-multiple-declarations/output.ts +++ b/packages/babel-preset/__fixtures__/assets-multiple-declarations/output.ts @@ -1,15 +1,13 @@ +import { __styles as _styles } from '@griffel/react'; import _asset2 from './empty.jpg'; import _asset from './blank.jpg'; -import { __styles } from '@griffel/react'; -import blank from './blank.jpg'; -import empty from './empty.jpg'; -export const useStyles = __styles( +export const useStyles = /*#__PURE__*/ _styles( { root: { - Bcmaq0h: 'fp00rh9', + Bcmaq0h: 'f1surbjy', }, }, { - d: [`.fp00rh9{background-image:url(${_asset}),url(${_asset2});}`], + d: [`.f1surbjy{background-image:url(${_asset}),url(${_asset2});}`], }, ); diff --git a/packages/babel-preset/__fixtures__/assets-reset-styles/output.ts b/packages/babel-preset/__fixtures__/assets-reset-styles/output.ts index f582824f6..611acf347 100644 --- a/packages/babel-preset/__fixtures__/assets-reset-styles/output.ts +++ b/packages/babel-preset/__fixtures__/assets-reset-styles/output.ts @@ -1,11 +1,9 @@ -import _asset2 from './empty.jpg'; +import { __resetStyles as _resetStyles } from '@griffel/react'; +import _asset3 from './empty.jpg'; +import _asset2 from './blank.jpg'; import _asset from './blank.jpg'; -import { __resetStyles } from '@griffel/react'; -import blank from './blank.jpg'; -import blankDuplicate from './blank.jpg'; -import empty from './empty.jpg'; -export const useStyles = __resetStyles('ra9m047', null, [ - `.ra9m047{background-image:url(${_asset});}`, - `.ra9m047:hover{background-image:url(${_asset});}`, - `.ra9m047:focus{background-image:url(${_asset2});}`, +export const useStyles = /*#__PURE__*/ _resetStyles('rzkd6zb', null, [ + `.rzkd6zb{background-image:url(${_asset});}`, + `.rzkd6zb:hover{background-image:url(${_asset2});}`, + `.rzkd6zb:focus{background-image:url(${_asset3});}`, ]); diff --git a/packages/babel-preset/__fixtures__/assets-urls/output.ts b/packages/babel-preset/__fixtures__/assets-urls/output.ts index 488b43a34..7e304ab83 100644 --- a/packages/babel-preset/__fixtures__/assets-urls/output.ts +++ b/packages/babel-preset/__fixtures__/assets-urls/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { httpUrl: { Bcmaq0h: 'f405sdg', diff --git a/packages/babel-preset/__fixtures__/assets/output.ts b/packages/babel-preset/__fixtures__/assets/output.ts index c7ec05164..a364529bb 100644 --- a/packages/babel-preset/__fixtures__/assets/output.ts +++ b/packages/babel-preset/__fixtures__/assets/output.ts @@ -1,30 +1,26 @@ -import _asset3 from './a.svg'; +import { __styles as _styles } from '@griffel/react'; import _asset2 from './empty.jpg'; import _asset from './blank.jpg'; -import { __styles } from '@griffel/react'; -import blank from './blank.jpg'; -import blankDuplicate from './blank.jpg'; -import empty from './empty.jpg'; -export const useStyles = __styles( +export const useStyles = /*#__PURE__*/ _styles( { rootA: { - Bcmaq0h: 'fnwsaxv', + Bcmaq0h: 'f1lg9ji5', }, rootB: { - Bcmaq0h: 'fnwsaxv', + Bcmaq0h: 'f1lg9ji5', }, rootC: { - Bcmaq0h: 'f1ryfumh', + Bcmaq0h: 'feire57', }, assetWithHash: { - Bhu2qc9: 'fv04sme', + Bhu2qc9: 'f12vvth1', }, }, { d: [ - `.fnwsaxv{background-image:url(${_asset});}`, - `.f1ryfumh{background-image:url(${_asset2});}`, - `.fv04sme{-webkit-filter:url(${_asset3}#a);filter:url(${_asset3}#a);}`, + `.f1lg9ji5{background-image:url(${_asset});}`, + `.feire57{background-image:url(${_asset2});}`, + `.f12vvth1{-webkit-filter:url(./a.svg#a);filter:url(./a.svg#a);}`, ], }, ); diff --git a/packages/babel-preset/__fixtures__/config-babel-options/output.ts b/packages/babel-preset/__fixtures__/config-babel-options/output.ts index 658f15b66..2b7acf8df 100644 --- a/packages/babel-preset/__fixtures__/config-babel-options/output.ts +++ b/packages/babel-preset/__fixtures__/config-babel-options/output.ts @@ -1,13 +1,5 @@ -import { __styles } from '@griffel/react'; -const func = () => { - // This assignment has no sense, but it will prevent us from evaluation in AST - // This fixture uses "colorRenamePlugin.js" in transformPlugin's config so input we should get a different color - const color = 'red'; - return { - color, - }; -}; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'f163i14w', diff --git a/packages/babel-preset/__fixtures__/config-evaluation-rules/output.ts b/packages/babel-preset/__fixtures__/config-evaluation-rules/output.ts index 303604072..2b7acf8df 100644 --- a/packages/babel-preset/__fixtures__/config-evaluation-rules/output.ts +++ b/packages/babel-preset/__fixtures__/config-evaluation-rules/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { colorRed } from './consts'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'f163i14w', diff --git a/packages/babel-preset/__fixtures__/config-evaluation-rules/sampleEvaluator.js b/packages/babel-preset/__fixtures__/config-evaluation-rules/sampleEvaluator.js index 8871cf21f..7db5200bf 100644 --- a/packages/babel-preset/__fixtures__/config-evaluation-rules/sampleEvaluator.js +++ b/packages/babel-preset/__fixtures__/config-evaluation-rules/sampleEvaluator.js @@ -1,10 +1,17 @@ // @ts-check -/** @type {import("@linaria/babel-preset").Evaluator} */ +/** @type {import("@linaria/utils").Evaluator} */ const sampleEvaluator = () => { - // Evaluators transform input code to something that will be evaluated by Node later. In evaluatePathsInVM() we expect - // that results will be available as "exports.__mkPreval", this evaluator mocks it - const result = `exports.__mkPreval = [{ root: { color: 'blue' } }]`; + // Evaluators transform input code to something that will be evaluated by Node + // later. Linaria expects that results will be available as + // "exports.__linariaPreval", this evaluator mocks it + const result = ` + exports.__linariaPreval = { + _exp: () => ({ + root: { color: 'blue' } + }) + }; + `; return [result, null]; }; diff --git a/packages/babel-preset/__fixtures__/duplicated-imports/code.ts b/packages/babel-preset/__fixtures__/duplicated-imports/code.ts index 8c4eb21f0..968db4043 100644 --- a/packages/babel-preset/__fixtures__/duplicated-imports/code.ts +++ b/packages/babel-preset/__fixtures__/duplicated-imports/code.ts @@ -1,12 +1,10 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { createStylesA } from 'custom-package'; -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { createStylesB } from 'custom-package'; +import { makeStyles as makeStylesA } from '@griffel/react'; +import { makeStyles as makeStylesB } from '@griffel/react'; -export const useClassesA = createStylesA({ +export const useClassesA = makeStylesA({ root: { color: 'red' }, }); -export const useClassesB = createStylesB({ +export const useClassesB = makeStylesB({ root: { color: 'yellow' }, }); diff --git a/packages/babel-preset/__fixtures__/duplicated-imports/output.ts b/packages/babel-preset/__fixtures__/duplicated-imports/output.ts index cd944f8b2..ff0abe6d0 100644 --- a/packages/babel-preset/__fixtures__/duplicated-imports/output.ts +++ b/packages/babel-preset/__fixtures__/duplicated-imports/output.ts @@ -1,8 +1,6 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { __styles } from 'custom-package'; -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { createStylesB } from 'custom-package'; -export const useClassesA = __styles( +import { __styles as _styles2 } from '@griffel/react'; +import { __styles as _styles } from '@griffel/react'; +export const useClassesA = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', @@ -12,8 +10,13 @@ export const useClassesA = __styles( d: ['.fe3e8s9{color:red;}'], }, ); -export const useClassesB = createStylesB({ - root: { - color: 'yellow', +export const useClassesB = /*#__PURE__*/ _styles2( + { + root: { + sj55zd: 'f1aqe04n', + }, }, -}); + { + d: ['.f1aqe04n{color:yellow;}'], + }, +); diff --git a/packages/babel-preset/__fixtures__/error-argument-count/fixture.js b/packages/babel-preset/__fixtures__/error-argument-count/fixture.js deleted file mode 100644 index 1f0d00fd9..000000000 --- a/packages/babel-preset/__fixtures__/error-argument-count/fixture.js +++ /dev/null @@ -1,4 +0,0 @@ -import { makeStyles } from '@griffel/react'; - -// This file is .js intentionally to avoid TS compiler errors -export const useStyles = makeStyles({ root: { color: 'red' } }, 'foo'); diff --git a/packages/babel-preset/__fixtures__/function-mixin/output.ts b/packages/babel-preset/__fixtures__/function-mixin/output.ts index 51ced1db5..f48f0faf6 100644 --- a/packages/babel-preset/__fixtures__/function-mixin/output.ts +++ b/packages/babel-preset/__fixtures__/function-mixin/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { createMixin } from './mixins'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { avatar: { sj55zd: 'f1817uup', diff --git a/packages/babel-preset/__fixtures__/import-alias/output.ts b/packages/babel-preset/__fixtures__/import-alias/output.ts index 27d3dfbc6..44ef1b6c7 100644 --- a/packages/babel-preset/__fixtures__/import-alias/output.ts +++ b/packages/babel-preset/__fixtures__/import-alias/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', diff --git a/packages/babel-preset/__fixtures__/import-custom-module/code.ts b/packages/babel-preset/__fixtures__/import-custom-module/code.ts deleted file mode 100644 index 05a61939e..000000000 --- a/packages/babel-preset/__fixtures__/import-custom-module/code.ts +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { makeStyles } from 'custom-package'; - -export const useStyles = makeStyles({ - root: { color: 'red' }, -}); diff --git a/packages/babel-preset/__fixtures__/import-custom-module/output.ts b/packages/babel-preset/__fixtures__/import-custom-module/output.ts deleted file mode 100644 index e53499e0b..000000000 --- a/packages/babel-preset/__fixtures__/import-custom-module/output.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { __styles } from 'custom-package'; -export const useStyles = __styles( - { - root: { - sj55zd: 'fe3e8s9', - }, - }, - { - d: ['.fe3e8s9{color:red;}'], - }, -); diff --git a/packages/babel-preset/__fixtures__/import-custom-name/code.ts b/packages/babel-preset/__fixtures__/import-custom-name/code.ts deleted file mode 100644 index fe1f8436b..000000000 --- a/packages/babel-preset/__fixtures__/import-custom-name/code.ts +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { createStyles } from 'custom-package'; - -export const useStyles = createStyles({ - root: { color: 'red' }, -}); diff --git a/packages/babel-preset/__fixtures__/import-custom-name/output.ts b/packages/babel-preset/__fixtures__/import-custom-name/output.ts deleted file mode 100644 index e53499e0b..000000000 --- a/packages/babel-preset/__fixtures__/import-custom-name/output.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-expect-error This module does not exist, but will be resolved via aliases -import { __styles } from 'custom-package'; -export const useStyles = __styles( - { - root: { - sj55zd: 'fe3e8s9', - }, - }, - { - d: ['.fe3e8s9{color:red;}'], - }, -); diff --git a/packages/babel-preset/__fixtures__/keyframes/output.ts b/packages/babel-preset/__fixtures__/keyframes/output.ts index d05166e6d..e65d534d3 100644 --- a/packages/babel-preset/__fixtures__/keyframes/output.ts +++ b/packages/babel-preset/__fixtures__/keyframes/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { single: { Bv12yb3: ['f1g6ul6r', 'f1fp4ujf'], diff --git a/packages/babel-preset/__fixtures__/multiple-declarations/output.ts b/packages/babel-preset/__fixtures__/multiple-declarations/output.ts index 7a796c441..990a3a308 100644 --- a/packages/babel-preset/__fixtures__/multiple-declarations/output.ts +++ b/packages/babel-preset/__fixtures__/multiple-declarations/output.ts @@ -1,5 +1,6 @@ -import { __styles } from '@griffel/react'; -export const useStyles1 = __styles( +import { __styles as _styles2 } from '@griffel/react'; +import { __styles as _styles } from '@griffel/react'; +export const useStyles1 = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', @@ -9,7 +10,7 @@ export const useStyles1 = __styles( d: ['.fe3e8s9{color:red;}'], }, ); -export const useStyles2 = __styles( +export const useStyles2 = /*#__PURE__*/ _styles2( { root: { sj55zd: 'fka9v86', diff --git a/packages/babel-preset/__fixtures__/non-existing-module-call/code.ts b/packages/babel-preset/__fixtures__/non-existing-module-call/code.ts deleted file mode 100644 index 82a5a97f7..000000000 --- a/packages/babel-preset/__fixtures__/non-existing-module-call/code.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { makeStyles } from '@griffel/react'; -import { createModule } from './module'; - -export const useStyles = makeStyles({ - container: { - color: 'red', - }, -}); - -createModule().baz(); diff --git a/packages/babel-preset/__fixtures__/non-existing-module-call/module.ts b/packages/babel-preset/__fixtures__/non-existing-module-call/module.ts deleted file mode 100644 index 3158365a5..000000000 --- a/packages/babel-preset/__fixtures__/non-existing-module-call/module.ts +++ /dev/null @@ -1,13 +0,0 @@ -type FakeModule = { - foo: () => void; - bar: () => void; - baz: () => void; -}; - -export function createModule(): FakeModule { - return { - foo: () => {}, - bar: () => {}, - // this implementation intentionally missing "baz" property to throw on calls in runtime - } as unknown as FakeModule; -} diff --git a/packages/babel-preset/__fixtures__/non-existing-module-call/output.ts b/packages/babel-preset/__fixtures__/non-existing-module-call/output.ts deleted file mode 100644 index f735a9172..000000000 --- a/packages/babel-preset/__fixtures__/non-existing-module-call/output.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { __styles } from '@griffel/react'; -import { createModule } from './module'; -export const useStyles = __styles( - { - container: { - sj55zd: 'fe3e8s9', - }, - }, - { - d: ['.fe3e8s9{color:red;}'], - }, -); -createModule().baz(); diff --git a/packages/babel-preset/__fixtures__/object-computed-keys/output.ts b/packages/babel-preset/__fixtures__/object-computed-keys/output.ts index 9e8cd4cff..7a7340c6f 100644 --- a/packages/babel-preset/__fixtures__/object-computed-keys/output.ts +++ b/packages/babel-preset/__fixtures__/object-computed-keys/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -const rootSlot = 'root'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', diff --git a/packages/babel-preset/__fixtures__/object-imported-keys/output.ts b/packages/babel-preset/__fixtures__/object-imported-keys/output.ts index 3640bc8c4..98d4b5708 100644 --- a/packages/babel-preset/__fixtures__/object-imported-keys/output.ts +++ b/packages/babel-preset/__fixtures__/object-imported-keys/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { className, selector } from './consts'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { B0egftl: 'f1wgwx3x', diff --git a/packages/babel-preset/__fixtures__/object-mixins/output.ts b/packages/babel-preset/__fixtures__/object-mixins/output.ts index 93e7ac297..635de2c38 100644 --- a/packages/babel-preset/__fixtures__/object-mixins/output.ts +++ b/packages/babel-preset/__fixtures__/object-mixins/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { flexStyles, gridStyles, typography } from './mixins'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { mc9l5x: 'f22iagw', diff --git a/packages/babel-preset/__fixtures__/object-nesting/output.ts b/packages/babel-preset/__fixtures__/object-nesting/output.ts index dd155267e..97a1caaac 100644 --- a/packages/babel-preset/__fixtures__/object-nesting/output.ts +++ b/packages/babel-preset/__fixtures__/object-nesting/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { colorBlue } from './consts'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { mc9l5x: 'f22iagw', diff --git a/packages/babel-preset/__fixtures__/object-sequence-expr/code.ts b/packages/babel-preset/__fixtures__/object-sequence-expr/code.ts index dab6d2abf..27f2cf785 100644 --- a/packages/babel-preset/__fixtures__/object-sequence-expr/code.ts +++ b/packages/babel-preset/__fixtures__/object-sequence-expr/code.ts @@ -1,4 +1,5 @@ -import { makeStyles, GriffelStyle } from '@griffel/react'; +import { makeStyles } from '@griffel/react'; +import type { GriffelStyle } from '@griffel/react'; const switchClassName = 'fui-Switch'; let _a: Record; diff --git a/packages/babel-preset/__fixtures__/object-sequence-expr/output.ts b/packages/babel-preset/__fixtures__/object-sequence-expr/output.ts index 4da492c9c..95a506bf6 100644 --- a/packages/babel-preset/__fixtures__/object-sequence-expr/output.ts +++ b/packages/babel-preset/__fixtures__/object-sequence-expr/output.ts @@ -1,7 +1,6 @@ -import { __styles, GriffelStyle } from '@griffel/react'; -const switchClassName = 'fui-Switch'; -let _a: Record; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +import type { GriffelStyle } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { ozcac4: 'f1cm6cy7', diff --git a/packages/babel-preset/__fixtures__/object-variables/output.ts b/packages/babel-preset/__fixtures__/object-variables/output.ts index 4d0f53c0c..703a35dcd 100644 --- a/packages/babel-preset/__fixtures__/object-variables/output.ts +++ b/packages/babel-preset/__fixtures__/object-variables/output.ts @@ -1,7 +1,5 @@ -import { __styles } from '@griffel/react'; -import { colorGreen, theme } from './vars'; -const colorRed = 'red'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', diff --git a/packages/babel-preset/__fixtures__/object/output.ts b/packages/babel-preset/__fixtures__/object/output.ts index 3fbb29473..5297e9d31 100644 --- a/packages/babel-preset/__fixtures__/object/output.ts +++ b/packages/babel-preset/__fixtures__/object/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', diff --git a/packages/babel-preset/__fixtures__/require-custom-module/code.ts b/packages/babel-preset/__fixtures__/require-custom-module/code.ts deleted file mode 100644 index 21ca02b1d..000000000 --- a/packages/babel-preset/__fixtures__/require-custom-module/code.ts +++ /dev/null @@ -1,10 +0,0 @@ -const react_make_styles_1 = require('custom-package'); - -export const useStyles = react_make_styles_1.makeStyles({ - root: { - fontSize: '14px', - lineHeight: 1, - }, -}); - -console.log(useStyles); diff --git a/packages/babel-preset/__fixtures__/require-custom-module/output.ts b/packages/babel-preset/__fixtures__/require-custom-module/output.ts deleted file mode 100644 index 6fd3af32f..000000000 --- a/packages/babel-preset/__fixtures__/require-custom-module/output.ts +++ /dev/null @@ -1,13 +0,0 @@ -const react_make_styles_1 = require('custom-package'); -export const useStyles = react_make_styles_1.__styles( - { - root: { - Be2twd7: 'fses1vf', - Bg96gwp: 'fp6vxd', - }, - }, - { - d: ['.fses1vf{font-size:14px;}', '.fp6vxd{line-height:1;}'], - }, -); -console.log(useStyles); diff --git a/packages/babel-preset/__fixtures__/require-reset-styles/code.ts b/packages/babel-preset/__fixtures__/require-reset-styles/code.ts index 2194b3342..9aa8f0ae0 100644 --- a/packages/babel-preset/__fixtures__/require-reset-styles/code.ts +++ b/packages/babel-preset/__fixtures__/require-reset-styles/code.ts @@ -1,6 +1,7 @@ -const react_make_styles_1 = require('@griffel/react'); - -export const useStyles = react_make_styles_1.makeResetStyles({ +const react_make_styles_2 = require('@griffel/react'); +const useResetStyles = react_make_styles_2.makeResetStyles({ fontSize: '14px', lineHeight: 1, }); + +exports.useResetStyles = useResetStyles; diff --git a/packages/babel-preset/__fixtures__/require-reset-styles/output.ts b/packages/babel-preset/__fixtures__/require-reset-styles/output.ts index 99637e266..2bf1728df 100644 --- a/packages/babel-preset/__fixtures__/require-reset-styles/output.ts +++ b/packages/babel-preset/__fixtures__/require-reset-styles/output.ts @@ -1,4 +1,3 @@ -const react_make_styles_1 = require('@griffel/react'); -export const useStyles = react_make_styles_1.__resetStyles('r1qlvv59', null, [ - '.r1qlvv59{font-size:14px;line-height:1;}', -]); +var _resetStyles = require('@griffel/react').__resetStyles; +const useResetStyles = /*#__PURE__*/ _resetStyles('r1qlvv59', null, ['.r1qlvv59{font-size:14px;line-height:1;}']); +exports.useResetStyles = useResetStyles; diff --git a/packages/babel-preset/__fixtures__/require/code.ts b/packages/babel-preset/__fixtures__/require/code.ts index 6d560d7ea..689b5b7e7 100644 --- a/packages/babel-preset/__fixtures__/require/code.ts +++ b/packages/babel-preset/__fixtures__/require/code.ts @@ -1,10 +1,9 @@ const react_make_styles_1 = require('@griffel/react'); - -export const useStyles = react_make_styles_1.makeStyles({ +const useStyles = react_make_styles_1.makeStyles({ root: { fontSize: '14px', lineHeight: 1, }, }); -console.log(useStyles); +exports.useStyles = useStyles; diff --git a/packages/babel-preset/__fixtures__/require/output.ts b/packages/babel-preset/__fixtures__/require/output.ts index e217c3f33..c3b4f1ad6 100644 --- a/packages/babel-preset/__fixtures__/require/output.ts +++ b/packages/babel-preset/__fixtures__/require/output.ts @@ -1,5 +1,5 @@ -const react_make_styles_1 = require('@griffel/react'); -export const useStyles = react_make_styles_1.__styles( +var _styles = require('@griffel/react').__styles; +const useStyles = /*#__PURE__*/ _styles( { root: { Be2twd7: 'fses1vf', @@ -10,4 +10,4 @@ export const useStyles = react_make_styles_1.__styles( d: ['.fses1vf{font-size:14px;}', '.fp6vxd{line-height:1;}'], }, ); -console.log(useStyles); +exports.useStyles = useStyles; diff --git a/packages/babel-preset/__fixtures__/reset-styles/output.ts b/packages/babel-preset/__fixtures__/reset-styles/output.ts index 4101e2fc9..74d412f80 100644 --- a/packages/babel-preset/__fixtures__/reset-styles/output.ts +++ b/packages/babel-preset/__fixtures__/reset-styles/output.ts @@ -1,5 +1,5 @@ -import { __resetStyles } from '@griffel/react'; -export const useStyles = __resetStyles('rjefjbm', 'r7z97ji', [ +import { __resetStyles as _resetStyles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _resetStyles('rjefjbm', 'r7z97ji', [ '.rjefjbm{color:red;padding-left:4px;}', '.r7z97ji{color:red;padding-right:4px;}', ]); diff --git a/packages/babel-preset/__fixtures__/rules-with-metadata/output.ts b/packages/babel-preset/__fixtures__/rules-with-metadata/output.ts index f4541c5d5..66b27a1af 100644 --- a/packages/babel-preset/__fixtures__/rules-with-metadata/output.ts +++ b/packages/babel-preset/__fixtures__/rules-with-metadata/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { media: { Bulngiv: 'fr5o61b', diff --git a/packages/babel-preset/__fixtures__/shared-mixins/output.ts b/packages/babel-preset/__fixtures__/shared-mixins/output.ts index f31761598..2f9f0f672 100644 --- a/packages/babel-preset/__fixtures__/shared-mixins/output.ts +++ b/packages/babel-preset/__fixtures__/shared-mixins/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { sharedStyles } from './mixins'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { mc9l5x: 'f22iagw', diff --git a/packages/babel-preset/__fixtures__/tokens/output.ts b/packages/babel-preset/__fixtures__/tokens/output.ts index d45d476c7..25b540a39 100644 --- a/packages/babel-preset/__fixtures__/tokens/output.ts +++ b/packages/babel-preset/__fixtures__/tokens/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { tokens } from './tokens'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: { De3pzq: 'f1734hy', diff --git a/packages/babel-preset/__fixtures__/unsupported-css-properties/output.ts b/packages/babel-preset/__fixtures__/unsupported-css-properties/output.ts index f7330031a..f5930e731 100644 --- a/packages/babel-preset/__fixtures__/unsupported-css-properties/output.ts +++ b/packages/babel-preset/__fixtures__/unsupported-css-properties/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const useStyles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _styles( { root: {}, }, diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 7f7e41857..c5a252722 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -9,17 +9,13 @@ }, "dependencies": { "@babel/core": "^7.12.13", - "@babel/generator": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.13", - "@linaria/babel-preset": "^3.0.0-beta.23", - "@linaria/shaker": "^3.0.0-beta.22", + "@linaria/babel-preset": "^4.3.3", + "@linaria/shaker": "^4.2.7", + "@linaria/utils": "^4.3.0", "ajv": "^8.4.0", - "stylis": "^4.0.13", "tslib": "^2.1.0" }, "peerDependencies": { - "@griffel/core": "^1.9.1" + "@griffel/linaria-processor": "^0.0.1" } } diff --git a/packages/babel-preset/src/assets/absolutePathToRelative.test.ts b/packages/babel-preset/src/assets/absolutePathToRelative.test.ts deleted file mode 100644 index 1cd41fda4..000000000 --- a/packages/babel-preset/src/assets/absolutePathToRelative.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as path from 'path'; -import { absolutePathToRelative } from './absolutePathToRelative'; - -describe('absolutePathToRelative', () => { - it('handles POSIX paths', () => { - expect( - absolutePathToRelative( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - 'assets/image.png', - ), - ).toBe('../../assets/image.png'); - - expect( - absolutePathToRelative( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - 'src/styles/Component.png', - ), - ).toBe('./Component.png'); - - expect( - absolutePathToRelative( - path.posix, - '/home/projects/foo', - '/home/projects/foo/packages/components/src/index.styles.ts', - 'packages/components/src/images/Component.png', - ), - ).toBe('./images/Component.png'); - }); - - it('handles Windows paths', () => { - expect( - absolutePathToRelative( - path.win32, - 'C:\\Users\\Foo\\projects', - 'C:\\Users\\Foo\\projects\\src\\styles\\Component.styles.ts', - 'assets/image.png', - ), - ).toBe('../../assets/image.png'); - - expect( - absolutePathToRelative( - path.win32, - 'C:\\Users\\Foo\\projects', - 'C:\\Users\\Foo\\projects\\src\\styles\\Component.styles.ts', - 'src/styles/Component.png', - ), - ).toBe('./Component.png'); - - expect( - absolutePathToRelative( - path.win32, - 'C:\\Users\\Foo\\projects', - 'C:\\Users\\Foo\\projects\\packages\\components\\src\\index.styles.ts', - 'packages/components/src/images/Component.png', - ), - ).toBe('./images/Component.png'); - }); -}); diff --git a/packages/babel-preset/src/assets/isAssetUrl.test.ts b/packages/babel-preset/src/assets/isAssetUrl.test.ts deleted file mode 100644 index 4747dedc5..000000000 --- a/packages/babel-preset/src/assets/isAssetUrl.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { isAssetUrl } from './isAssetUrl'; - -describe('isAssetUrl', () => { - it('handles remote URLs', () => { - expect(isAssetUrl('data://example.com')).toBe(false); - expect(isAssetUrl('http://example.com')).toBe(false); - expect(isAssetUrl('https://example.com')).toBe(false); - expect(isAssetUrl('//example.com')).toBe(false); - expect(isAssetUrl('#svg-part')).toBe(false); - }); - - it('handles assets URLs', () => { - expect(isAssetUrl('../file.jpg')).toBe(true); - expect(isAssetUrl('./file.jpg')).toBe(true); - }); - - it('handles quotes around URLs', () => { - expect(isAssetUrl('"//example.com"')).toBe(false); - expect(isAssetUrl("'//example.com'")).toBe(false); - - expect(isAssetUrl('"./file.jpg"')).toBe(true); - expect(isAssetUrl("'./file.jpg'")).toBe(true); - }); -}); diff --git a/packages/babel-preset/src/assets/isAssetUrl.ts b/packages/babel-preset/src/assets/isAssetUrl.ts deleted file mode 100644 index 165ab36ae..000000000 --- a/packages/babel-preset/src/assets/isAssetUrl.ts +++ /dev/null @@ -1,11 +0,0 @@ -export function isAssetUrl(value: string): boolean { - const url = value.replace(/^['|"]/, ''); - const isRemoteUrl = - url.startsWith('data:') || - url.startsWith('http:') || - url.startsWith('https:') || - url.startsWith('//') /* Urls without protocol (use the same protocol as current page) */ || - url.startsWith('#'); - - return !isRemoteUrl; -} diff --git a/packages/babel-preset/src/assets/normalizeStyleRules.test.ts b/packages/babel-preset/src/assets/normalizeStyleRules.test.ts deleted file mode 100644 index 6076f617e..000000000 --- a/packages/babel-preset/src/assets/normalizeStyleRules.test.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as path from 'path'; -import { normalizeStyleRule, normalizeStyleRules } from './normalizeStyleRules'; - -describe('normalizeStyleRule', () => { - it('handles rules without quotes', () => { - expect( - normalizeStyleRule( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - 'url(../../assets/image.png)', - ), - ).toBe('url(assets/image.png)'); - }); - - it('handles rules with quotes', () => { - expect( - normalizeStyleRule( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - "url('../../assets/image.png')", - ), - ).toBe('url(assets/image.png)'); - expect( - normalizeStyleRule( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - 'url("../../assets/image.png")', - ), - ).toBe('url(assets/image.png)'); - }); - - it('keeps data-url', () => { - expect( - normalizeStyleRule( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - 'url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2Q==)', - ), - ).toBe('url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2Q==)'); - }); - - it('handles Windows paths', () => { - expect( - normalizeStyleRule( - path.win32, - 'C:\\Users\\Foo\\projects\\bar', - 'C:\\Users\\Foo\\projects\\bar\\src\\styles\\Component.styles.ts', - 'url(../../assets/image.png)', - ), - ).toBe('url(assets/image.png)'); - }); -}); - -describe('normalizeStyleRules', () => { - it('handles rules without metadata', () => { - expect( - normalizeStyleRules( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - - { - root: { - color: 'red', - backgroundImage: 'url(../../assets/image.jpg)', - overflowY: ['hidden', 'scroll'], - - ':hover': { - backgroundImage: 'url(../../assets/hoverImage.jpg)', - }, - - '@media screen and (max-width: 100px)': { - '& .foo': { - backgroundImage: 'url(../../assets/mediaImage.jpg)', - }, - }, - }, - }, - ), - ).toEqual({ - root: { - color: 'red', - backgroundImage: 'url(assets/image.jpg)', - overflowY: ['hidden', 'scroll'], - - ':hover': { - backgroundImage: 'url(assets/hoverImage.jpg)', - }, - - '@media screen and (max-width: 100px)': { - '& .foo': { - backgroundImage: 'url(assets/mediaImage.jpg)', - }, - }, - }, - }); - }); - - it('handles multiple URLs', () => { - expect( - normalizeStyleRules( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - - { - root: { - // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds - backgroundImage: [ - 'url(../../assets/firefox.png),', - 'url(../../assets/bubbles.png),', - 'linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0))', - ].join(' '), - }, - }, - ), - ).toEqual({ - root: { - backgroundImage: [ - 'url(assets/firefox.png),', - 'url(assets/bubbles.png),', - 'linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0))', - ].join(' '), - }, - }); - }); - - it('handles keyframe arrays', () => { - expect( - normalizeStyleRules( - path.posix, - '/home/projects/foo', - '/home/projects/foo/src/styles/Component.styles.ts', - - { - root: { - animationName: [{ from: { height: '20px' }, to: { height: '10px' } }], - }, - }, - ), - ).toEqual({ - root: { - animationName: [{ from: { height: '20px' }, to: { height: '10px' } }], - }, - }); - }); -}); diff --git a/packages/babel-preset/src/assets/replaceAssetsWithImports.ts b/packages/babel-preset/src/assets/replaceAssetsWithImports.ts deleted file mode 100644 index fb64fa2df..000000000 --- a/packages/babel-preset/src/assets/replaceAssetsWithImports.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { NodePath, traverse, types as t } from '@babel/core'; -import * as path from 'path'; -import { tokenize } from 'stylis'; - -import { absolutePathToRelative } from './absolutePathToRelative'; -import { isAssetUrl } from './isAssetUrl'; - -/** - * Replaces assets used in styles with imports and template literals. - * - * @example - * "['.foo { background-image: url(image.png) }" - * // to - * import _asset from 'image.png' - * `['.foo { background-image: url(${_asset}) }` - */ -export function replaceAssetsWithImports( - projectRoot: string, - filename: string, - programPath: NodePath, - pathToUpdate: NodePath, -) { - const assetIdentifiers = new Map(); - - function getAssetIdentifier(assetPath: string): t.Identifier { - if (!assetIdentifiers.has(assetPath)) { - assetIdentifiers.set(assetPath, programPath.scope.generateUidIdentifier('asset')); - } - - return assetIdentifiers.get(assetPath) as t.Identifier; - } - - function buildTemplateLiteralFromValue(value: string): t.TemplateLiteral { - const tokens = tokenize(value); - - const quasis: t.TemplateElement[] = []; - const expressions: t.Identifier[] = []; - - let acc = ''; - - for (let i = 0, l = tokens.length; i < l; i++) { - acc += tokens[i]; - - if (tokens[i] === 'url') { - const url = tokens[i + 1].slice(1, -1); - - if (isAssetUrl(url)) { - // Handle `filter: url(./a.svg#id)` - const [pathname, hash] = url.split('#'); - - quasis.push(t.templateElement({ raw: acc + '(' }, false)); - expressions.push(getAssetIdentifier(pathname)); - - acc = `${hash ? `#${hash}` : ''})`; - i++; - } - } - } - - quasis.push(t.templateElement({ raw: acc }, true)); - - return t.templateLiteral(quasis, expressions); - } - - traverse( - pathToUpdate.node, - { - StringLiteral(literalPath) { - const value = literalPath.node.value; - - if (value.indexOf('url(') === -1) { - return; - } - - literalPath.replaceWith(buildTemplateLiteralFromValue(value)); - }, - }, - programPath.scope, - programPath, - ); - - for (const [importPath, identifier] of assetIdentifiers.entries()) { - const relativePath = absolutePathToRelative(path, projectRoot, filename, importPath); - - programPath.unshiftContainer( - 'body', - t.importDeclaration([t.importDefaultSpecifier(identifier)], t.stringLiteral(relativePath)), - ); - } -} diff --git a/packages/babel-preset/src/transformPlugin.test.ts b/packages/babel-preset/src/index.test.ts similarity index 77% rename from packages/babel-preset/src/transformPlugin.test.ts rename to packages/babel-preset/src/index.test.ts index c99708bef..29d908f59 100644 --- a/packages/babel-preset/src/transformPlugin.test.ts +++ b/packages/babel-preset/src/index.test.ts @@ -2,7 +2,7 @@ import pluginTester, { prettierFormatter } from 'babel-plugin-tester'; import * as fs from 'fs'; import * as path from 'path'; -import { transformPlugin } from './transformPlugin'; +import griffelPreset from './index'; const prettierConfig = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), { encoding: 'utf-8' }), @@ -13,11 +13,7 @@ pluginTester({ babelOptions: { parserOpts: { plugins: ['typescript'], - }, - }, - pluginOptions: { - babelOptions: { - presets: ['@babel/typescript'], + sourceType: 'unambiguous', }, }, formatResult: code => @@ -39,20 +35,12 @@ pluginTester({ title: 'duplicated imports', fixture: path.resolve(fixturesDir, 'duplicated-imports', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'duplicated-imports', 'output.ts'), - pluginOptions: { - modules: [{ moduleSource: 'custom-package', importName: 'createStylesA' }], - }, }, { title: 'multiple declarations', fixture: path.resolve(fixturesDir, 'multiple-declarations', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'multiple-declarations', 'output.ts'), }, - { - title: 'call of non existing module', - fixture: path.resolve(fixturesDir, 'non-existing-module-call', 'code.ts'), - outputFixture: path.resolve(fixturesDir, 'non-existing-module-call', 'output.ts'), - }, { title: 'syntax: animationName', fixture: path.resolve(fixturesDir, 'keyframes', 'code.ts'), @@ -144,7 +132,7 @@ pluginTester({ title: 'config: babelOptions', fixture: path.resolve(fixturesDir, 'config-babel-options', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'config-babel-options', 'output.ts'), - pluginOptions: { + presetOptions: { babelOptions: { plugins: ['./packages/babel-preset/__fixtures__/config-babel-options/colorRenamePlugin'], }, @@ -154,12 +142,8 @@ pluginTester({ title: 'config: evaluationRules', fixture: path.resolve(fixturesDir, 'config-evaluation-rules', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'config-evaluation-rules', 'output.ts'), - pluginOptions: { - evaluationRules: [ - { - action: 'sampleEvaluator', - }, - ], + presetOptions: { + evaluationRules: [{ action: 'sampleEvaluator' }], }, }, @@ -185,36 +169,11 @@ pluginTester({ fixture: path.resolve(fixturesDir, 'import-alias', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'import-alias', 'output.ts'), }, - { - title: 'imports: custom module', - fixture: path.resolve(fixturesDir, 'import-custom-module', 'code.ts'), - outputFixture: path.resolve(fixturesDir, 'import-custom-module', 'output.ts'), - pluginOptions: { - modules: [{ moduleSource: 'custom-package', importName: 'makeStyles' }], - }, - }, - { - title: 'imports: custom module name', - fixture: path.resolve(fixturesDir, 'import-custom-name', 'code.ts'), - outputFixture: path.resolve(fixturesDir, 'import-custom-name', 'output.ts'), - pluginOptions: { - modules: [{ moduleSource: 'custom-package', importName: 'createStyles' }], - }, - }, { title: 'imports: require()', fixture: path.resolve(fixturesDir, 'require', 'code.ts'), outputFixture: path.resolve(fixturesDir, 'require', 'output.ts'), }, - { - title: 'imports: require() with custom module', - fixture: path.resolve(fixturesDir, 'require-custom-module', 'code.ts'), - outputFixture: path.resolve(fixturesDir, 'require-custom-module', 'output.ts'), - pluginOptions: { - modules: [{ moduleSource: 'custom-package', importName: 'makeStyles' }], - }, - }, - { title: 'imports: require() for makeResetStyles', fixture: path.resolve(fixturesDir, 'require-reset-styles', 'code.ts'), @@ -228,6 +187,7 @@ pluginTester({ title: 'errors: unsupported shorthand CSS properties', fixture: path.resolve(fixturesDir, 'unsupported-css-properties', 'fixture.ts'), outputFixture: path.resolve(fixturesDir, 'unsupported-css-properties', 'output.ts'), + setup() { const consoleSpy = jest.spyOn(console, 'error').mockImplementation(); @@ -236,15 +196,10 @@ pluginTester({ }; }, }, - { - title: 'errors: throws on invalid argument count', - fixture: path.resolve(fixturesDir, 'error-argument-count', 'fixture.js'), - error: /function accepts only a single param/, - }, { title: 'errors: throws on invalid config', fixture: path.resolve(fixturesDir, 'error-config-babel-options', 'fixture.ts'), - pluginOptions: { + presetOptions: { babelOptions: { plugins: {}, }, @@ -253,6 +208,9 @@ pluginTester({ }, ], - plugin: transformPlugin, - pluginName: '@griffel/babel-plugin-transform', + preset: griffelPreset, + presetName: '@griffel/babel-preset', + presetOptions: { + babelOptions: { presets: ['@babel/preset-typescript'] }, + }, }); diff --git a/packages/babel-preset/src/index.ts b/packages/babel-preset/src/index.ts index d6f2dd964..cf29345c2 100644 --- a/packages/babel-preset/src/index.ts +++ b/packages/babel-preset/src/index.ts @@ -1,17 +1,22 @@ -import { transformPlugin } from './transformPlugin'; - import type { ConfigAPI } from '@babel/core'; +import linariaPreset, { PluginOptions } from '@linaria/babel-preset'; + +import { validateOptions } from './validateOptions'; import type { BabelPluginOptions } from './types'; export { default as shakerEvaluator } from '@linaria/shaker'; -export { EvalCache, Module } from '@linaria/babel-preset'; export { configSchema } from './schema'; -export type { Evaluator, EvalRule } from '@linaria/babel-preset'; +export type { Evaluator, EvalRule } from '@linaria/utils'; export type { BabelPluginOptions }; -export default function griffelPreset(babel: ConfigAPI, options: BabelPluginOptions) { - return { - plugins: [[transformPlugin, options]], - }; +export default function griffelPreset(babel: ConfigAPI, options: BabelPluginOptions = {}) { + const { babelOptions, evaluationRules } = validateOptions(options); + + return linariaPreset(babel, { + babelOptions, + rules: evaluationRules, + // TODO: remove once is fixed https://github.com/callstack/linaria/issues/1177 + extensions: ['.cjs', '.json', '.js', '.jsx', '.mjs', '.ts', '.tsx'], + } as PluginOptions); } diff --git a/packages/babel-preset/src/schema.ts b/packages/babel-preset/src/schema.ts index 4f316419e..e07111756 100644 --- a/packages/babel-preset/src/schema.ts +++ b/packages/babel-preset/src/schema.ts @@ -6,21 +6,6 @@ export const configSchema: JSONSchema7 = { type: 'object', properties: { - modules: { - type: 'array', - items: { - type: 'object', - required: ['moduleSource', 'importName'], - properties: { - moduleSource: { - type: 'string', - }, - importName: { - type: 'string', - }, - }, - }, - }, babelOptions: { type: 'object', properties: { @@ -45,9 +30,6 @@ export const configSchema: JSONSchema7 = { }, }, }, - projectRoot: { - type: 'string', - }, }, additionalProperties: false, }; diff --git a/packages/babel-preset/src/transformPlugin.ts b/packages/babel-preset/src/transformPlugin.ts deleted file mode 100644 index c5b6d5bbc..000000000 --- a/packages/babel-preset/src/transformPlugin.ts +++ /dev/null @@ -1,373 +0,0 @@ -import { NodePath, PluginObj, PluginPass, types as t } from '@babel/core'; -import { declare } from '@babel/helper-plugin-utils'; -import { Module } from '@linaria/babel-preset'; -import shakerEvaluator from '@linaria/shaker'; -import { - resolveStyleRulesForSlots, - CSSRulesByBucket, - StyleBucketName, - GriffelStyle, - resolveResetStyleRules, -} from '@griffel/core'; -import * as path from 'path'; - -import { normalizeStyleRules } from './assets/normalizeStyleRules'; -import { replaceAssetsWithImports } from './assets/replaceAssetsWithImports'; -import { evaluatePaths } from './utils/evaluatePaths'; -import { BabelPluginOptions } from './types'; -import { validateOptions } from './validateOptions'; - -type FunctionKinds = 'makeStyles' | 'makeResetStyles'; - -type BabelPluginState = PluginPass & { - importDeclarationPaths?: NodePath[]; - requireDeclarationPath?: NodePath; - - definitionPaths?: { functionKind: FunctionKinds; path: NodePath }[]; - calleePaths?: NodePath[]; -}; - -function getDefinitionPathFromCallExpression( - functionKind: FunctionKinds, - callExpression: NodePath, -): NodePath { - const argumentPaths = callExpression.get('arguments'); - const hasValidArguments = Array.isArray(argumentPaths) && argumentPaths.length === 1; - - if (!hasValidArguments) { - throw callExpression.buildCodeFrameError(`${functionKind}() function accepts only a single param`); - } - - const definitionsPath = argumentPaths[0]; - - if (definitionsPath.isExpression() || definitionsPath.isSpreadElement()) { - return definitionsPath; - } - - throw definitionsPath.buildCodeFrameError(`${functionKind}() function accepts only expressions and spreads`); -} - -/** - * Gets a kind of passed callee. - */ -function getCalleeFunctionKind( - path: NodePath, - modules: NonNullable, -): FunctionKinds | null { - for (const module of modules) { - if (path.referencesImport(module.moduleSource, module.importName)) { - return 'makeStyles'; - } - - if (path.referencesImport(module.moduleSource, module.resetImportName || 'makeResetStyles')) { - return 'makeResetStyles'; - } - } - - return null; -} - -/** - * Checks if import statement import makeStyles(). - */ -function hasMakeStylesImport( - path: NodePath, - modules: NonNullable, -): boolean { - return Boolean(modules.find(module => path.node.source.value === module.moduleSource)); -} - -/** - * Checks that passed declarator imports makesStyles(). - * - * @example react_make_styles_1 = require('@griffel/react') - */ -function isRequireDeclarator( - path: NodePath, - modules: NonNullable, -): boolean { - const initPath = path.get('init'); - - if (!initPath.isCallExpression()) { - return false; - } - - if (initPath.get('callee').isIdentifier({ name: 'require' })) { - const args = initPath.get('arguments'); - - if (Array.isArray(args) && args.length === 1) { - const moduleNamePath = args[0]; - - if (moduleNamePath.isStringLiteral()) { - return Boolean(modules.find(module => moduleNamePath.node.value === module.moduleSource)); - } - } - } - - return false; -} - -/** - * Rules that are returned by `resolveStyles()` are not deduplicated. - * It's critical to filter out duplicates for build-time transform to avoid duplicated rules in a bundle. - */ -function dedupeCSSRules(cssRules: CSSRulesByBucket): CSSRulesByBucket { - (Object.keys(cssRules) as StyleBucketName[]).forEach(styleBucketName => { - cssRules[styleBucketName] = cssRules[styleBucketName]!.filter( - (rule, index, rules) => rules.indexOf(rule) === index, - ); - }); - - return cssRules; -} - -export const transformPlugin = declare, PluginObj>((api, options) => { - api.assertVersion(7); - - const pluginOptions: Required = { - babelOptions: {}, - modules: [ - { moduleSource: '@griffel/react', importName: 'makeStyles' }, - { moduleSource: '@fluentui/react-components', importName: 'makeStyles' }, - ], - evaluationRules: [ - { action: shakerEvaluator }, - { - test: /[/\\]node_modules[/\\]/, - action: 'ignore', - }, - ], - projectRoot: process.cwd(), - - ...options, - }; - - validateOptions(pluginOptions); - - return { - name: '@griffel/babel-plugin-transform', - - pre() { - this.importDeclarationPaths = []; - this.definitionPaths = []; - this.calleePaths = []; - }, - - visitor: { - Program: { - enter(programPath, state) { - if (typeof state.filename === 'undefined') { - throw new Error( - [ - '@griffel/babel-preset: This preset requires "filename" option to be specified by Babel. ', - "It's automatically done by Babel and our loaders/plugins. ", - "If you're facing this issue, please check your setup.\n\n", - 'See: https://babeljs.io/docs/en/options#filename', - ].join(''), - ); - } - - // Invalidate cache for module evaluation to get fresh modules - Module.invalidate(); - }, - - exit(programPath, state) { - if (state.importDeclarationPaths!.length === 0 && !state.requireDeclarationPath) { - return; - } - - if (state.definitionPaths) { - // Runs Babel AST processing or module evaluation for Node once for all arguments of makeStyles() calls once - evaluatePaths( - programPath, - state.file.opts.filename!, - state.definitionPaths.map(p => p.path), - pluginOptions, - ); - - state.definitionPaths.forEach(definitionPath => { - const callExpressionPath = definitionPath.path.findParent(parentPath => - parentPath.isCallExpression(), - ) as NodePath; - const evaluationResult = definitionPath.path.evaluate(); - - if (!evaluationResult.confident) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const deoptPath = (evaluationResult as any).deopt as NodePath | undefined; - throw (deoptPath || definitionPath.path).buildCodeFrameError( - 'Evaluation of a code fragment failed, this is a bug, please report it', - ); - } - - if (definitionPath.functionKind === 'makeStyles') { - const stylesBySlots: Record = evaluationResult.value; - const [classnamesMapping, cssRulesByBucket] = resolveStyleRulesForSlots( - // Heads up! - // Style rules should be normalized *before* they will be resolved to CSS rules to have deterministic - // results across different build targets. - normalizeStyleRules( - path, - pluginOptions.projectRoot, - // Presence of "state.filename" is validated on `Program.enter()` - state.filename as string, - stylesBySlots, - ), - ); - const uniqueCSSRules = dedupeCSSRules(cssRulesByBucket); - - (callExpressionPath.get('arguments.0') as NodePath).remove(); - callExpressionPath.pushContainer('arguments', [ - t.valueToNode(classnamesMapping), - t.valueToNode(uniqueCSSRules), - ]); - } - - if (definitionPath.functionKind === 'makeResetStyles') { - const styles: GriffelStyle = evaluationResult.value; - const [ltrClassName, rtlClassName, cssRules] = resolveResetStyleRules( - // Heads up! - // Style rules should be normalized *before* they will be resolved to CSS rules to have deterministic - // results across different build targets. - normalizeStyleRules( - path, - pluginOptions.projectRoot, - // Presence of "state.filename" is validated on `Program.enter()` - state.filename as string, - styles, - ), - ); - - (callExpressionPath.get('arguments.0') as NodePath).remove(); - callExpressionPath.pushContainer('arguments', [ - t.valueToNode(ltrClassName), - t.valueToNode(rtlClassName), - t.valueToNode(cssRules), - ]); - } - - replaceAssetsWithImports(pluginOptions.projectRoot, state.filename!, programPath, callExpressionPath); - }); - } - - state.importDeclarationPaths!.forEach(importDeclarationPath => { - const specifiers = importDeclarationPath.get('specifiers'); - const source = importDeclarationPath.get('source'); - - specifiers.forEach(specifier => { - if (specifier.isImportSpecifier()) { - const importedPath = specifier.get('imported'); - - for (const module of pluginOptions.modules) { - if (module.moduleSource !== source.node.value) { - // 👆 "moduleSource" should match "importDeclarationPath.source" to skip unrelated ".importName" - continue; - } - - if (importedPath.isIdentifier({ name: module.importName })) { - specifier.replaceWith(t.identifier('__styles')); - } else if (importedPath.isIdentifier({ name: module.resetImportName || 'makeResetStyles' })) { - specifier.replaceWith(t.identifier('__resetStyles')); - } - } - } - }); - }); - - if (state.calleePaths) { - state.calleePaths.forEach(calleePath => { - if (calleePath.node.name === 'makeResetStyles') { - calleePath.replaceWith(t.identifier('__resetStyles')); - return; - } - - calleePath.replaceWith(t.identifier('__styles')); - }); - } - }, - }, - - // eslint-disable-next-line @typescript-eslint/naming-convention - ImportDeclaration(path, state) { - if (hasMakeStylesImport(path, pluginOptions.modules)) { - state.importDeclarationPaths!.push(path); - } - }, - - // eslint-disable-next-line @typescript-eslint/naming-convention - VariableDeclarator(path, state) { - if (isRequireDeclarator(path, pluginOptions.modules)) { - state.requireDeclarationPath = path; - } - }, - - // eslint-disable-next-line @typescript-eslint/naming-convention - CallExpression(path, state) { - /** - * Handles case when `makeStyles()` is `CallExpression`. - * - * @example makeStyles({}) - */ - if (state.importDeclarationPaths!.length === 0) { - return; - } - - const calleePath = path.get('callee'); - - if (calleePath.isIdentifier()) { - const functionKind = getCalleeFunctionKind(calleePath, pluginOptions.modules); - - if (functionKind) { - state.definitionPaths!.push({ - functionKind, - path: getDefinitionPathFromCallExpression(functionKind, path), - }); - state.calleePaths!.push(calleePath); - } - } - }, - - // eslint-disable-next-line @typescript-eslint/naming-convention - MemberExpression(expressionPath, state) { - /** - * Handles case when `makeStyles()` is inside `MemberExpression`. - * - * @example module.makeStyles({}) - */ - if (!state.requireDeclarationPath) { - return; - } - - const objectPath = expressionPath.get('object'); - const propertyPath = expressionPath.get('property'); - - if (!objectPath.isIdentifier({ name: (state.requireDeclarationPath.node.id as t.Identifier).name })) { - return; - } - - let functionKind: FunctionKinds | null = null; - - if (propertyPath.isIdentifier({ name: 'makeStyles' })) { - functionKind = 'makeStyles'; - } else if (propertyPath.isIdentifier({ name: 'makeResetStyles' })) { - functionKind = 'makeResetStyles'; - } - - if (!functionKind) { - return; - } - - const parentPath = expressionPath.parentPath; - - if (!parentPath.isCallExpression()) { - return; - } - - state.definitionPaths!.push({ - functionKind, - path: getDefinitionPathFromCallExpression(functionKind, parentPath), - }); - state.calleePaths!.push(propertyPath as NodePath); - }, - }, - }; -}); diff --git a/packages/babel-preset/src/types.ts b/packages/babel-preset/src/types.ts index 5ac91d61f..729c95aac 100644 --- a/packages/babel-preset/src/types.ts +++ b/packages/babel-preset/src/types.ts @@ -1,14 +1,7 @@ import type { TransformOptions } from '@babel/core'; -import type { EvalRule } from '@linaria/babel-preset'; +import type { EvalRule } from '@linaria/utils'; export type BabelPluginOptions = { - /** Defines set of modules and imports handled by a transformPlugin. */ - modules?: { - moduleSource: string; - importName: string; - resetImportName?: string; - }[]; - /** * If you need to specify custom Babel configuration, you can pass them here. These options will be used by the * transformPlugin when parsing and evaluating modules. @@ -17,12 +10,4 @@ export type BabelPluginOptions = { /** The set of rules that defines how the matched files will be transformed during the evaluation. */ evaluationRules?: EvalRule[]; - - /** - * Defined the of the project. Is used to have a deterministic path for asset paths, usually should be equal to Git - * root. - * - * @default process.cwd() - */ - projectRoot?: string; }; diff --git a/packages/babel-preset/src/utils/evaluatePaths.ts b/packages/babel-preset/src/utils/evaluatePaths.ts deleted file mode 100644 index 0ace2eca3..000000000 --- a/packages/babel-preset/src/utils/evaluatePaths.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { NodePath, types as t } from '@babel/core'; - -import type { BabelPluginOptions } from '../types'; -import { evaluatePathsInVM } from './evaluatePathsInVM'; - -/** - * Checks if passed paths can be evaluated by Babel, if no - fallbacks to Node evaluation. - * The goal there is to ensure that all paths are pure and can be safely evaluated later by Babel. - */ -export function evaluatePaths( - program: NodePath, - filename: string, - paths: NodePath[], - pluginOptions: Required, -): void { - const pathsToBeEvaluatedInVM: NodePath[] = []; - - for (let i = 0; i < paths.length; i++) { - const result = paths[i].evaluate(); - - // Optimistic case, we were able to resolve a path without evaluation in Node environment 🎉 - if (result.confident) { - // Heads up! - // We don't need to do any replacements there as after resolving all style objects will be evaluated again - continue; - } - - pathsToBeEvaluatedInVM.push(paths[i]); - } - - if (pathsToBeEvaluatedInVM.length > 0) { - evaluatePathsInVM(program, filename, pathsToBeEvaluatedInVM, pluginOptions); - } -} diff --git a/packages/babel-preset/src/utils/evaluatePathsInVM.test.ts b/packages/babel-preset/src/utils/evaluatePathsInVM.test.ts deleted file mode 100644 index cba10532b..000000000 --- a/packages/babel-preset/src/utils/evaluatePathsInVM.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as Babel from '@babel/core'; -import generator from '@babel/generator'; - -import { expressionTpl } from './evaluatePathsInVM'; - -describe('expressionTpl', () => { - it('returns an expression based on a template', () => { - const expression = Babel.types.identifier('foo'); - - const result = expressionTpl({ expression, wrapName: 'wrap' }); - const resultCode = generator(result).code; - - expect(Babel.types.isCallExpression(result)).toBe(true); - expect(resultCode).toMatchInlineSnapshot(`"wrap(() => foo)"`); - }); -}); diff --git a/packages/babel-preset/src/utils/evaluatePathsInVM.ts b/packages/babel-preset/src/utils/evaluatePathsInVM.ts deleted file mode 100644 index e9fed30ff..000000000 --- a/packages/babel-preset/src/utils/evaluatePathsInVM.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { NodePath, types as t } from '@babel/core'; -import { Scope } from '@babel/traverse'; -import * as template from '@babel/template'; -import generator from '@babel/generator'; -import { Module, StrictOptions } from '@linaria/babel-preset'; - -import type { BabelPluginOptions } from '../types'; - -const EVAL_EXPORT_NAME = '__mkPreval'; - -function evaluate(code: string, filename: string, pluginOptions: Required) { - const options: StrictOptions = { - displayName: false, - evaluate: true, - - rules: pluginOptions.evaluationRules, - babelOptions: { - ...pluginOptions.babelOptions, - - // This instance of Babel should ignore all user's configs and apply only our transformPlugin - configFile: false, - babelrc: false, - }, - }; - const mod = new Module(filename, options); - - mod.evaluate(code, [EVAL_EXPORT_NAME]); - - return (mod.exports as { [EVAL_EXPORT_NAME]: unknown[] })[EVAL_EXPORT_NAME]; -} - -function findFreeName(scope: Scope, name: string): string { - // By default `name` is used as a name of the function … - let nextName = name; - let idx = 0; - while (scope.hasBinding(nextName, false)) { - // … but if there is an already defined variable with this name … - // … we are trying to use a name like wrap_N - idx += 1; - nextName = `wrap_${idx}`; - } - - return nextName; -} - -const expressionWrapperTpl = template.statement(` - const %%wrapName%% = (fn) => { - try { - return fn(); - } catch (e) { - return e; - } - }; -`); - -export const expressionTpl = template.expression(`%%wrapName%%(() => %%expression%%)`); -const exportsPrevalTpl = template.statement(`exports.${EVAL_EXPORT_NAME} = %%expressions%%`); - -/** - * Creates a new program that includes required imports and wrappers to return resolved values. - */ -function addPreval(path: NodePath, lazyDeps: Array): t.Program { - // Constant for "__mkPreval" with all dependencies - const wrapName = findFreeName(path.scope, '_wrap'); - const programNode = path.node; - - return t.program( - [ - ...programNode.body, - - expressionWrapperTpl({ wrapName }), - exportsPrevalTpl({ - expressions: t.arrayExpression(lazyDeps.map(expression => expressionTpl({ expression, wrapName }))), - }), - ], - programNode.directives, - programNode.sourceType, - programNode.interpreter, - ); -} - -/** - * Evaluates passed paths in Node environment to resolve all lazy values. - */ -export function evaluatePathsInVM( - program: NodePath, - filename: string, - nodePaths: NodePath[], - pluginOptions: Required, -): void { - const pathsToEvaluate = nodePaths.map(nodePath => { - // spreads ("...fooBar") can't be executed directly, so they are wrapped with an object ("{...fooBar}") - if (nodePath.isSpreadElement()) { - return t.objectExpression([nodePath.node as t.SpreadElement]); - } - - return nodePath.node; - }); - - // Linaria also performs hoisting of identifiers, we don't need this as all makeStyles() calls should be top level - const modifiedProgram = addPreval(program, pathsToEvaluate); - - const { code } = generator(modifiedProgram); - const results = evaluate(code, filename, pluginOptions); - - for (let i = 0; i < nodePaths.length; i++) { - const nodePath = nodePaths[i]; - - nodePath.replaceWith(t.valueToNode(results[i])); - } -} diff --git a/packages/babel-preset/src/validateOptions.test.ts b/packages/babel-preset/src/validateOptions.test.ts index e3769c034..7373b768b 100644 --- a/packages/babel-preset/src/validateOptions.test.ts +++ b/packages/babel-preset/src/validateOptions.test.ts @@ -1,28 +1,9 @@ -import type { Evaluator } from '@linaria/babel-preset'; +import type { Evaluator } from '@linaria/utils'; import { validateOptions } from './validateOptions'; import { BabelPluginOptions } from './types'; describe('validateOptions', () => { - describe('modules', () => { - it('passes on valid options', () => { - const pluginOptions: BabelPluginOptions = { - modules: [{ moduleSource: 'react-make-styles', importName: 'makeStyles' }], - }; - - expect(() => validateOptions(pluginOptions)).not.toThrow(); - }); - - it('throws on wrong options', () => { - const pluginOptions = { modules: {} }; - - // @ts-expect-error Invalid options are passed for testing purposes - expect(() => validateOptions(pluginOptions)).toThrowErrorMatchingInlineSnapshot( - `"Validation failed for passed config: data/modules must be array"`, - ); - }); - }); - describe('babelOptions', () => { it('passes on valid options', () => { const pluginOptions: BabelPluginOptions = { diff --git a/packages/babel-preset/src/validateOptions.ts b/packages/babel-preset/src/validateOptions.ts index 1d92bb8b2..461872fec 100644 --- a/packages/babel-preset/src/validateOptions.ts +++ b/packages/babel-preset/src/validateOptions.ts @@ -8,10 +8,12 @@ const ajv = new Ajv(); /** * Validates options for transformPlugin with a schema. */ -export function validateOptions(pluginOptions: BabelPluginOptions): void { +export function validateOptions(pluginOptions: BabelPluginOptions): BabelPluginOptions { const valid = ajv.validate(configSchema, pluginOptions); if (!valid) { throw new Error(`Validation failed for passed config: ${ajv.errorsText(ajv.errors)}`); } + + return pluginOptions; } diff --git a/packages/babel-preset/tsconfig.spec.json b/packages/babel-preset/tsconfig.spec.json index 93e96752c..fc10738dd 100644 --- a/packages/babel-preset/tsconfig.spec.json +++ b/packages/babel-preset/tsconfig.spec.json @@ -9,6 +9,7 @@ "include": [ "__fixtures__/**/code.ts", "__fixtures__/**/fixture.ts", + "__fixtures__/config-evaluation-rules/sampleEvaluator.js", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", diff --git a/packages/linaria-processor/.eslintrc.json b/packages/linaria-processor/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/packages/linaria-processor/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/packages/linaria-processor/README.md b/packages/linaria-processor/README.md new file mode 100644 index 000000000..b80683556 --- /dev/null +++ b/packages/linaria-processor/README.md @@ -0,0 +1,55 @@ +# Griffel processor for Linaria + +A processor for [Linaria](https://github.com/callstack/linaria) for that performs build time transforms for `makeStyles` & `makeResetStyles` [`@griffel/react`](../react). + + + + +- [Install](#install) +- [How to use it?](#how-to-use-it) + - [Handling Griffel re-exports](#handling-griffel-re-exports) + + + +## Install + +```bash +yarn add --dev @griffel/linaria-processor +# or +npm install --save-dev @griffel/linaria-processor +``` + +## How to use it? + +This package cannot be used solely, it should be paired with `@griffel/babel-preset` or `@griffel/webpack-loader` + +- For library developers, please use [`@griffel/babel-preset`](../babel-preset) +- For application developers, please use [`@griffel/webpack-loader`](../webpack-loader) + +### Handling Griffel re-exports + +```js +import { makeStyles, makeResetStyles } from 'custom-package'; +``` + +By default, the processor handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings you need to include meta information to a matching `package.json`: + +```json +{ + "name": "custom-package", + "version": "1.0.0", + "linaria": { + "tags": { + "makeStyles": "@griffel/linaria-processor/make-styles", + "makeResetStyles": "@griffel/linaria-processor/make-reset-styles" + } + } +} +``` + +> **Note**: "custom-package" should re-export following functions from `@griffel/react`: +> +> - `__styles` +> - `__css` +> - `__resetStyles` +> - `__resetCSS` diff --git a/packages/linaria-processor/jest.config.js b/packages/linaria-processor/jest.config.js new file mode 100644 index 000000000..bf28fa7c5 --- /dev/null +++ b/packages/linaria-processor/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + displayName: 'linaria-processor', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/packages/linaria-processor', +}; diff --git a/packages/linaria-processor/package.json b/packages/linaria-processor/package.json new file mode 100644 index 000000000..3322a12c2 --- /dev/null +++ b/packages/linaria-processor/package.json @@ -0,0 +1,30 @@ +{ + "name": "@griffel/linaria-processor", + "version": "0.0.1", + "description": "Linaria processor for Griffel", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/griffel" + }, + "dependencies": { + "@griffel/core": "^1.9.0", + "@linaria/tags": "^4.3.0", + "stylis": "^4.0.13", + "tslib": "^2.1.0" + }, + "exports": { + ".": { + "types": "./src/index.d.ts", + "default": "./src/index.js" + }, + "./make-styles": { + "types": "./src/MakeStylesProcessor.d.ts", + "default": "./src/MakeStylesProcessor.js" + }, + "./make-reset-styles": { + "types": "./src/MakeResetStylesProcessor.d.ts", + "default": "./src/MakeResetStylesProcessor.js" + } + } +} diff --git a/packages/linaria-processor/project.json b/packages/linaria-processor/project.json new file mode 100644 index 000000000..d5ccdd0c7 --- /dev/null +++ b/packages/linaria-processor/project.json @@ -0,0 +1,49 @@ +{ + "root": "packages/linaria-processor", + "sourceRoot": "packages/linaria-processor/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/linaria-processor/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/packages/linaria-processor"], + "options": { + "jestConfig": "packages/linaria-processor/jest.config.js", + "passWithNoTests": true + } + }, + "build": { + "executor": "@nrwl/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/packages/linaria-processor", + "tsConfig": "packages/linaria-processor/tsconfig.lib.json", + "packageJson": "packages/linaria-processor/package.json", + "main": "packages/linaria-processor/src/index.ts", + "assets": [ + "packages/linaria-processor/README.md", + { + "glob": "LICENSE.md", + "input": ".", + "output": "." + } + ] + } + }, + "type-check": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "cwd": "packages/linaria-processor", + "commands": [{ "command": "tsc -b --pretty" }], + "outputPath": [] + } + } + }, + "tags": [] +} diff --git a/packages/linaria-processor/src/BaseGriffelProcessor.ts b/packages/linaria-processor/src/BaseGriffelProcessor.ts new file mode 100644 index 000000000..a29e7e7fd --- /dev/null +++ b/packages/linaria-processor/src/BaseGriffelProcessor.ts @@ -0,0 +1,46 @@ +import type { Expression } from '@babel/types'; +import type { Params, TailProcessorParams } from '@linaria/tags'; +import { BaseProcessor, validateParams } from '@linaria/tags'; +import * as path from 'path'; + +export default abstract class BaseGriffelProcessor extends BaseProcessor { + readonly expressionName: string | number | null = null; + + public constructor([tag, callParam]: Params, ...args: TailProcessorParams) { + super([tag], ...args); + + validateParams([tag, callParam], ['tag', 'call'], 'Invalid usage of `makeStyles` tag'); + + if (callParam[0] === 'call') { + const { ex } = callParam[1]; + + if (ex.type === 'Identifier') { + this.expressionName = ex.name; + } else if (ex.type === 'NullLiteral' || ex.type === 'BooleanLiteral') { + this.expressionName = null; + } else { + this.expressionName = ex.value; + } + } + } + + public get path() { + return process.platform === 'win32' ? path.win32 : path.posix; + } + + public override get asSelector(): string { + throw new Error('The result of makeStyles cannot be used as a selector.'); + } + + public override doEvaltimeReplacement(): void { + this.replacer(this.value, false); + } + + public override get value(): Expression { + return this.astService.nullLiteral(); + } + + public override toString(): string { + return `${super.toString()}(…)`; + } +} diff --git a/packages/linaria-processor/src/MakeResetStylesProcessor.ts b/packages/linaria-processor/src/MakeResetStylesProcessor.ts new file mode 100644 index 000000000..f7f1094b3 --- /dev/null +++ b/packages/linaria-processor/src/MakeResetStylesProcessor.ts @@ -0,0 +1,48 @@ +import { GriffelStyle, resolveResetStyleRules } from '@griffel/core'; +import type { ValueCache } from '@linaria/tags'; + +import { createRuleLiteral } from './assets/createRuleLiteral'; +import { normalizeStyleRules } from './assets/normalizeStyleRules'; +import BaseGriffelProcessor from './BaseGriffelProcessor'; +import { FileContext } from './types'; + +export default class MakeResetStylesProcessor extends BaseGriffelProcessor { + #ltrClassName: string | null = null; + #rtlClassName: string | null = null; + #cssRules: string[] | null = null; + + public override build(valueCache: ValueCache) { + const styles = valueCache.get(this.expressionName) as GriffelStyle; + + [this.#ltrClassName, this.#rtlClassName, this.#cssRules] = resolveResetStyleRules( + // Heads up! + // Style rules should be normalized *before* they will be resolved to CSS rules to have deterministic + // results across different build targets. + normalizeStyleRules(this.path, this.context as FileContext, styles), + ); + } + + public override doRuntimeReplacement(): void { + if (!this.#cssRules || !this.#ltrClassName) { + throw new Error('Styles are not extracted yet. Please call `build` first.'); + } + + const t = this.astService; + const addAssetImport = (path: string) => t.addDefaultImport(path, 'asset'); + + const rulesArrayExpression = t.arrayExpression( + this.#cssRules.map(rule => { + return createRuleLiteral(this.path, t, this.context as FileContext, rule, addAssetImport); + }), + ); + + const stylesImportIdentifier = t.addNamedImport('__resetStyles', this.tagSource.source); + const stylesCallExpression = t.callExpression(stylesImportIdentifier, [ + t.stringLiteral(this.#ltrClassName), + this.#rtlClassName ? t.stringLiteral(this.#rtlClassName) : t.nullLiteral(), + rulesArrayExpression, + ]); + + this.replacer(stylesCallExpression, true); + } +} diff --git a/packages/linaria-processor/src/MakeStylesProcessor.ts b/packages/linaria-processor/src/MakeStylesProcessor.ts new file mode 100644 index 000000000..6b7905d64 --- /dev/null +++ b/packages/linaria-processor/src/MakeStylesProcessor.ts @@ -0,0 +1,82 @@ +import { GriffelStyle, resolveStyleRulesForSlots, StyleBucketName } from '@griffel/core'; +import type { CSSClassesMapBySlot, CSSRulesByBucket } from '@griffel/core'; +import type { ValueCache } from '@linaria/tags'; + +import { createRuleLiteral } from './assets/createRuleLiteral'; +import { normalizeStyleRules } from './assets/normalizeStyleRules'; +import BaseGriffelProcessor from './BaseGriffelProcessor'; +import type { FileContext } from './types'; + +/** + * Rules that are returned by `resolveStyles()` are not deduplicated. + * It's critical to filter out duplicates for build-time transform to avoid duplicated rules in a bundle. + */ +function dedupeCSSRules(cssRules: CSSRulesByBucket): CSSRulesByBucket { + (Object.keys(cssRules) as StyleBucketName[]).forEach(styleBucketName => { + cssRules[styleBucketName] = cssRules[styleBucketName]!.filter( + (rule, index, rules) => rules.indexOf(rule) === index, + ); + }); + + return cssRules; +} + +export default class MakeStylesProcessor extends BaseGriffelProcessor { + #cssClassMap: CSSClassesMapBySlot | undefined; + #cssRulesByBucket: CSSRulesByBucket | undefined; + + public override build(valueCache: ValueCache) { + const stylesBySlots = valueCache.get(this.expressionName) as Record; + + [this.#cssClassMap, this.#cssRulesByBucket] = resolveStyleRulesForSlots( + // Heads up! + // Style rules should be normalized *before* they will be resolved to CSS rules to have deterministic + // results across different build targets. + normalizeStyleRules(this.path, this.context as FileContext, stylesBySlots), + ); + } + + public override doRuntimeReplacement(): void { + if (!this.#cssClassMap || !this.#cssRulesByBucket) { + throw new Error('Styles are not extracted yet. Please call `build` first.'); + } + + const t = this.astService; + const addAssetImport = (path: string) => t.addDefaultImport(path, 'asset'); + + const uniqueRules = dedupeCSSRules(this.#cssRulesByBucket); + const rulesObjectExpression = t.objectExpression( + Object.entries(uniqueRules).map(([bucketName, cssRules]) => + t.objectProperty( + t.identifier(bucketName), + t.arrayExpression( + cssRules.map(rule => { + if (typeof rule === 'string') { + return createRuleLiteral(this.path, t, this.context as FileContext, rule, addAssetImport); + } + + const [cssRule, metadata] = rule; + + return t.arrayExpression([ + createRuleLiteral(this.path, t, this.context as FileContext, cssRule, addAssetImport), + t.objectExpression( + Object.entries(metadata).map(([key, value]) => + t.objectProperty(t.identifier(key), t.stringLiteral(value as string)), + ), + ), + ]); + }), + ), + ), + ), + ); + + const stylesImportIdentifier = t.addNamedImport('__styles', this.tagSource.source); + const stylesCallExpression = t.callExpression(stylesImportIdentifier, [ + t.valueToNode(this.#cssClassMap), + rulesObjectExpression, + ]); + + this.replacer(stylesCallExpression, true); + } +} diff --git a/packages/linaria-processor/src/assets/createRuleLiteral.test.ts b/packages/linaria-processor/src/assets/createRuleLiteral.test.ts new file mode 100644 index 000000000..27c6cb1b0 --- /dev/null +++ b/packages/linaria-processor/src/assets/createRuleLiteral.test.ts @@ -0,0 +1,61 @@ +import { types as t } from '@babel/core'; +import generate from '@babel/generator'; +import * as path from 'path'; + +import type { FileContext } from '../types'; +import { createRuleLiteral } from './createRuleLiteral'; + +const fileContextPosix: FileContext = { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', +}; +const fileContextWin32: FileContext = { + root: 'C:\\Users\\Foo\\projects', + filename: 'C:\\Users\\Foo\\projects\\src\\styles\\Component.styles.ts', +}; + +describe('createRuleLiteral', () => { + it('creates strings for rules', () => { + const addAssetImport = jest.fn(); + + const node = createRuleLiteral(path.posix, t, fileContextPosix, '.foo { color: red }', addAssetImport); + const { code } = generate(node); + + expect(code).toMatchInlineSnapshot(`"\\".foo { color: red }\\""`); + expect(addAssetImport).not.toHaveBeenCalled(); + }); + + describe('updates URLs that start with "griffel"', () => { + it('posix', () => { + const addAssetImport = jest.fn().mockImplementation(() => t.identifier('foo')); + + const node = createRuleLiteral( + path.posix, + t, + fileContextPosix, + '.foo { url(griffel:assets/foo.png) }', + addAssetImport, + ); + const { code } = generate(node); + + expect(code).toMatchInlineSnapshot(`"\`.foo { url(\${foo}) }\`"`); + expect(addAssetImport).toHaveBeenCalledWith('../../assets/foo.png'); + }); + + it('win32', () => { + const addAssetImport = jest.fn().mockImplementation(() => t.identifier('foo')); + + const node = createRuleLiteral( + path.win32, + t, + fileContextWin32, + '.foo { url(griffel:assets/foo.png) }', + addAssetImport, + ); + const { code } = generate(node); + + expect(code).toMatchInlineSnapshot(`"\`.foo { url(\${foo}) }\`"`); + expect(addAssetImport).toHaveBeenCalledWith('../../assets/foo.png'); + }); + }); +}); diff --git a/packages/linaria-processor/src/assets/createRuleLiteral.ts b/packages/linaria-processor/src/assets/createRuleLiteral.ts new file mode 100644 index 000000000..fbe7252c9 --- /dev/null +++ b/packages/linaria-processor/src/assets/createRuleLiteral.ts @@ -0,0 +1,51 @@ +import type { types as t } from '@babel/core'; +import { tokenize } from 'stylis'; + +import { relativePathToImportLike } from './relativePathToImportLike'; +import type { FileContext } from '../types'; + +export function createRuleLiteral( + path: typeof import('path'), + astService: typeof t, + fileContext: FileContext, + rule: string, + addAssetImport: (path: string) => t.Identifier, +): t.StringLiteral | t.TemplateLiteral { + if (rule.indexOf('url(') === -1) { + return astService.stringLiteral(rule); + } + + const tokens = tokenize(rule); + + const quasis: t.TemplateElement[] = []; + const expressions: t.Identifier[] = []; + + let acc = ''; + + for (let i = 0, l = tokens.length; i < l; i++) { + acc += tokens[i]; + + if (tokens[i] === 'url') { + const url = tokens[i + 1].slice(1, -1); + + if (url.startsWith('griffel:')) { + // Handle `filter: url(./a.svg#id)` + const [pathname, hash] = url.slice(8).split('#'); + + quasis.push(astService.templateElement({ raw: acc + '(' }, false)); + + const importPath = relativePathToImportLike(path, fileContext, pathname); + const importName = addAssetImport(importPath); + + expressions.push(importName); + + acc = `${hash ? `#${hash}` : ''})`; + i++; + } + } + } + + quasis.push(astService.templateElement({ raw: acc }, true)); + + return astService.templateLiteral(quasis, expressions); +} diff --git a/packages/linaria-processor/src/assets/normalizeStyleRules.test.ts b/packages/linaria-processor/src/assets/normalizeStyleRules.test.ts new file mode 100644 index 000000000..4b881269c --- /dev/null +++ b/packages/linaria-processor/src/assets/normalizeStyleRules.test.ts @@ -0,0 +1,187 @@ +import * as path from 'path'; +import { normalizeStyleRule, normalizeStyleRules } from './normalizeStyleRules'; + +describe('normalizeStyleRule', () => { + it('handles rules without quotes', () => { + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'url(/home/projects/foo/assets/image.png)', + ), + ).toBe('url(griffel:assets/image.png)'); + }); + + it('handles rules with quotes', () => { + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + "url('/home/projects/foo/assets/image.png')", + ), + ).toBe('url(griffel:assets/image.png)'); + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'url("/home/projects/foo/assets/image.png")', + ), + ).toBe('url(griffel:assets/image.png)'); + }); + + it('keeps relative URLs', () => { + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'url(./foo.img)', + ), + ).toBe('url(./foo.img)'); + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'url(../foo.img)', + ), + ).toBe('url(../foo.img)'); + }); + + it('keeps data-url', () => { + expect( + normalizeStyleRule( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2Q==)', + ), + ).toBe('url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2Q==)'); + }); + + it('handles Windows paths', () => { + expect( + normalizeStyleRule( + path.win32, + { + root: 'C:\\Users\\Foo\\projects\\bar', + filename: 'C:\\Users\\Foo\\projects\\bar\\src\\styles\\Component.styles.ts', + }, + 'url(C:\\Users\\Foo\\projects\\bar\\assets\\image.png)', + ), + ).toBe('url(griffel:assets/image.png)'); + }); +}); + +describe('normalizeStyleRules', () => { + it('handles rules without metadata', () => { + expect( + normalizeStyleRules( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + { + root: { + color: 'red', + backgroundImage: 'url(/home/projects/foo/assets/image.jpg)', + overflowY: ['hidden', 'scroll'], + + ':hover': { + backgroundImage: 'url(/home/projects/foo/assets/hoverImage.jpg)', + }, + + '@media screen and (max-width: 100px)': { + '& .foo': { + backgroundImage: 'url(/home/projects/foo/assets/mediaImage.jpg)', + }, + }, + }, + }, + ), + ).toEqual({ + root: { + color: 'red', + backgroundImage: 'url(griffel:assets/image.jpg)', + overflowY: ['hidden', 'scroll'], + + ':hover': { + backgroundImage: 'url(griffel:assets/hoverImage.jpg)', + }, + + '@media screen and (max-width: 100px)': { + '& .foo': { + backgroundImage: 'url(griffel:assets/mediaImage.jpg)', + }, + }, + }, + }); + }); + + it('handles multiple URLs', () => { + expect( + normalizeStyleRules( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + { + root: { + // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds + backgroundImage: [ + 'url(/home/projects/foo/assets/firefox.png),', + 'url(/home/projects/foo/assets/bubbles.png),', + 'linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0))', + ].join(' '), + }, + }, + ), + ).toEqual({ + root: { + backgroundImage: [ + 'url(griffel:assets/firefox.png),', + 'url(griffel:assets/bubbles.png),', + 'linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0))', + ].join(' '), + }, + }); + }); + + it('handles keyframe arrays', () => { + expect( + normalizeStyleRules( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + { + root: { + animationName: [{ from: { height: '20px' }, to: { height: '10px' } }], + }, + }, + ), + ).toEqual({ + root: { + animationName: [{ from: { height: '20px' }, to: { height: '10px' } }], + }, + }); + }); +}); diff --git a/packages/babel-preset/src/assets/normalizeStyleRules.ts b/packages/linaria-processor/src/assets/normalizeStyleRules.ts similarity index 63% rename from packages/babel-preset/src/assets/normalizeStyleRules.ts rename to packages/linaria-processor/src/assets/normalizeStyleRules.ts index c56fd8dd2..dfb8142d8 100644 --- a/packages/babel-preset/src/assets/normalizeStyleRules.ts +++ b/packages/linaria-processor/src/assets/normalizeStyleRules.ts @@ -1,25 +1,18 @@ import { GriffelAnimation, GriffelStyle } from '@griffel/core'; import { tokenize } from 'stylis'; -import { isAssetUrl } from './isAssetUrl'; +import { FileContext } from '../types'; /** - * Linaria v3 emits relative paths for assets, we normalize these paths to be relative from the project root to be the + * Linaria v4 emits absolute paths for assets, we normalize these paths to be relative from the project root to be the * same if an assets was used in different files. */ -export function normalizeAssetPath(path: typeof import('path'), projectRoot: string, filename: string, asset: string) { - const absoluteAssetPath = path.resolve(path.dirname(filename), asset); - +export function normalizeAssetPath(path: typeof import('path'), fileContext: FileContext, absoluteAssetPath: string) { // Normalize paths to be POSIX-like to be independent of an execution environment - return path.relative(projectRoot, absoluteAssetPath).split(path.sep).join(path.posix.sep); + return path.relative(fileContext.root, absoluteAssetPath).split(path.sep).join(path.posix.sep); } -export function normalizeStyleRule( - path: typeof import('path'), - projectRoot: string, - filename: string, - ruleValue: string | number, -) { +export function normalizeStyleRule(path: typeof import('path'), fileContext: FileContext, ruleValue: string | number) { if (typeof ruleValue === 'number' || ruleValue.indexOf('url(') === -1) { return ruleValue; } @@ -27,12 +20,12 @@ export function normalizeStyleRule( return tokenize(ruleValue).reduce((result, token, index, array) => { if (token === 'url') { const url = array[index + 1].slice(1, -1); + const isFilePath = url.replace(/^['|"]/, '').startsWith(fileContext.root); - if (isAssetUrl(url)) { - array[index + 1] = `(${normalizeAssetPath( + if (isFilePath) { + array[index + 1] = `(griffel:${normalizeAssetPath( path, - projectRoot, - filename, + fileContext, // Quotes in URL are optional, so we can also normalize them as we know that it's a file path // https://www.w3.org/TR/CSS2/syndata.html#value-def-uri url.replace(/^['|"](.+)['|"]$/, '$1'), @@ -49,8 +42,7 @@ export function normalizeStyleRule( export function normalizeStyleRules( path: typeof import('path'), - projectRoot: string, - filename: string, + fileContext: FileContext, stylesBySlots: Record | GriffelStyle, ): Record { return Object.fromEntries( @@ -65,20 +57,20 @@ export function normalizeStyleRules( key, value.map(rule => { if (typeof rule === 'object') { - return normalizeStyleRules(path, projectRoot, filename, rule as GriffelAnimation); + return normalizeStyleRules(path, fileContext, rule as GriffelAnimation); } - return normalizeStyleRule(path, projectRoot, filename, rule); + return normalizeStyleRule(path, fileContext, rule); }), ]; } // Nested objects if (typeof value === 'object') { - return [key, normalizeStyleRules(path, projectRoot, filename, value as unknown as GriffelStyle)]; + return [key, normalizeStyleRules(path, fileContext, value as unknown as GriffelStyle)]; } - return [key, normalizeStyleRule(path, projectRoot, filename, value)]; + return [key, normalizeStyleRule(path, fileContext, value)]; }), ); } diff --git a/packages/linaria-processor/src/assets/relativePathToImportLike.test.ts b/packages/linaria-processor/src/assets/relativePathToImportLike.test.ts new file mode 100644 index 000000000..95f28d9c6 --- /dev/null +++ b/packages/linaria-processor/src/assets/relativePathToImportLike.test.ts @@ -0,0 +1,74 @@ +import * as path from 'path'; +import { relativePathToImportLike } from './relativePathToImportLike'; + +describe('relativePathToImportLike', () => { + it('handles POSIX paths', () => { + expect( + relativePathToImportLike( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'assets/image.png', + ), + ).toBe('../../assets/image.png'); + + expect( + relativePathToImportLike( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/src/styles/Component.styles.ts', + }, + 'src/styles/Component.png', + ), + ).toBe('./Component.png'); + + expect( + relativePathToImportLike( + path.posix, + { + root: '/home/projects/foo', + filename: '/home/projects/foo/packages/components/src/index.styles.ts', + }, + 'packages/components/src/images/Component.png', + ), + ).toBe('./images/Component.png'); + }); + + it('handles Windows paths', () => { + expect( + relativePathToImportLike( + path.win32, + { + root: 'C:\\Users\\Foo\\projects', + filename: 'C:\\Users\\Foo\\projects\\src\\styles\\Component.styles.ts', + }, + 'assets/image.png', + ), + ).toBe('../../assets/image.png'); + + expect( + relativePathToImportLike( + path.win32, + { + root: 'C:\\Users\\Foo\\projects', + filename: 'C:\\Users\\Foo\\projects\\src\\styles\\Component.styles.ts', + }, + 'src/styles/Component.png', + ), + ).toBe('./Component.png'); + + expect( + relativePathToImportLike( + path.win32, + { + root: 'C:\\Users\\Foo\\projects', + filename: 'C:\\Users\\Foo\\projects\\packages\\components\\src\\index.styles.ts', + }, + 'packages/components/src/images/Component.png', + ), + ).toBe('./images/Component.png'); + }); +}); diff --git a/packages/babel-preset/src/assets/absolutePathToRelative.ts b/packages/linaria-processor/src/assets/relativePathToImportLike.ts similarity index 59% rename from packages/babel-preset/src/assets/absolutePathToRelative.ts rename to packages/linaria-processor/src/assets/relativePathToImportLike.ts index db7c23073..f8a946c76 100644 --- a/packages/babel-preset/src/assets/absolutePathToRelative.ts +++ b/packages/linaria-processor/src/assets/relativePathToImportLike.ts @@ -1,11 +1,8 @@ -export function absolutePathToRelative( - path: typeof import('path'), - projectRoot: string, - filename: string, - assetPath: string, -) { - const fileDirectory = path.dirname(filename); - const absoluteAssetPath = path.resolve(projectRoot, assetPath); +import type { FileContext } from '../types'; + +export function relativePathToImportLike(path: typeof import('path'), fileContext: FileContext, assetPath: string) { + const fileDirectory = path.dirname(fileContext.filename); + const absoluteAssetPath = path.resolve(fileContext.root, assetPath); let relativeAssetPath = path.relative(fileDirectory, absoluteAssetPath); diff --git a/packages/linaria-processor/src/index.ts b/packages/linaria-processor/src/index.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/linaria-processor/src/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/linaria-processor/src/types.ts b/packages/linaria-processor/src/types.ts new file mode 100644 index 000000000..8d40090ad --- /dev/null +++ b/packages/linaria-processor/src/types.ts @@ -0,0 +1,4 @@ +export type FileContext = { + root: string; + filename: string; +}; diff --git a/packages/linaria-processor/tsconfig.json b/packages/linaria-processor/tsconfig.json new file mode 100644 index 000000000..42707b2da --- /dev/null +++ b/packages/linaria-processor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "allowJs": true, + "forceConsistentCasingInFileNames": true, + "lib": ["ES2019", "dom", "DOM.Iterable"], + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/linaria-processor/tsconfig.lib.json b/packages/linaria-processor/tsconfig.lib.json new file mode 100644 index 000000000..8d27d94f9 --- /dev/null +++ b/packages/linaria-processor/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node", "environment"] + }, + "exclude": ["**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/packages/linaria-processor/tsconfig.spec.json b/packages/linaria-processor/tsconfig.spec.json new file mode 100644 index 000000000..e75e7becd --- /dev/null +++ b/packages/linaria-processor/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "jsx": "react", + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node", "environment", "@testing-library/jest-dom"] + }, + "include": [ + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/packages/react/package.json b/packages/react/package.json index f6de1f053..bb156e79c 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -8,6 +8,12 @@ "url": "https://github.com/microsoft/griffel" }, "sideEffects": false, + "linaria": { + "tags": { + "makeStyles": "@griffel/linaria-processor/make-styles", + "makeResetStyles": "@griffel/linaria-processor/make-reset-styles" + } + }, "dependencies": { "@griffel/core": "^1.9.1", "tslib": "^2.1.0" diff --git a/packages/webpack-loader/README.md b/packages/webpack-loader/README.md index a34666255..e51226405 100644 --- a/packages/webpack-loader/README.md +++ b/packages/webpack-loader/README.md @@ -18,9 +18,9 @@ A loader for Webpack 5 that performs build time transforms for [`@griffel/react` ## Install ```bash -yarn add --dev @griffel/webpack-loader +yarn add --dev @griffel/linaria-processor @griffel/webpack-loader # or -npm install --save-dev @griffel/webpack-loader +npm install --save-dev @griffel/linaria-processor @griffel/webpack-loader ``` ## When to use it? @@ -91,35 +91,21 @@ module.exports = { ```js import { makeStyles, makeResetStyles } from 'custom-package'; -// 👇 custom import names are also supported -import { createStyles } from 'custom-package'; ``` -By default, the Webpack loader handles imports from `@griffel/react`. The webpack loader can be re-configured to handle re-exports of Griffel from custom packages. The `makeStyles` function itself can also be renamed in this case. - -```js -module.exports = { - module: { - rules: [ - { - test: /\.(js|jsx)$/, - exclude: /node_modules/, - use: { - loader: '@griffel/webpack-loader', - options: { - modules: [ - { - moduleSource: 'custom-package', - importName: 'makeStyles', - resetImportName: 'makeResetStyles', - }, - ], - }, - }, - }, - ], - }, -}; +By default, the Webpack loader handles imports from `@griffel/react` & `@fluentui/react-components`, to handle imports from custom packages settings you need to include meta information to a matching `package.json`: + +```json +{ + "name": "custom-package", + "version": "1.0.0", + "linaria": { + "tags": { + "makeStyles": "@griffel/linaria-processor/make-styles", + "makeResetStyles": "@griffel/linaria-processor/make-reset-styles" + } + } +} ``` > **Note**: "custom-package" should re-export following functions from `@griffel/react`: diff --git a/packages/webpack-loader/__fixtures__/config-modules/code.ts b/packages/webpack-loader/__fixtures__/config-modules/code.ts deleted file mode 100644 index 8357320ae..000000000 --- a/packages/webpack-loader/__fixtures__/config-modules/code.ts +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-expect-error This is a fake module, will be resolved by Webpack aliases -import { makeStyles } from 'react-make-styles'; - -export const styles = makeStyles({ - root: { backgroundColor: 'red' }, -}); diff --git a/packages/webpack-loader/__fixtures__/config-modules/output.ts b/packages/webpack-loader/__fixtures__/config-modules/output.ts deleted file mode 100644 index fdd5b2392..000000000 --- a/packages/webpack-loader/__fixtures__/config-modules/output.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-expect-error This is a fake module, will be resolved by Webpack aliases -import { __styles } from 'react-make-styles'; -export const styles = __styles( - { - root: { - De3pzq: 'f3xbvq9', - }, - }, - { - d: ['.f3xbvq9{background-color:red;}'], - }, -); diff --git a/packages/webpack-loader/__fixtures__/error-argument-count/code.ts b/packages/webpack-loader/__fixtures__/error-argument-count/code.ts deleted file mode 100644 index b04fbcd97..000000000 --- a/packages/webpack-loader/__fixtures__/error-argument-count/code.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { makeStyles } from '@griffel/react'; - -// @ts-expect-error Invalid arguments for "makeStyles" function -export const useStyles = makeStyles({ root: { color: 'red' } }, 'foo'); diff --git a/packages/webpack-loader/__fixtures__/error-argument-count/error.ts b/packages/webpack-loader/__fixtures__/error-argument-count/error.ts deleted file mode 100644 index f687a24a7..000000000 --- a/packages/webpack-loader/__fixtures__/error-argument-count/error.ts +++ /dev/null @@ -1 +0,0 @@ -export default /makeStyles\(\) function accepts only a single param/; diff --git a/packages/webpack-loader/__fixtures__/error-config/error.ts b/packages/webpack-loader/__fixtures__/error-config/error.ts index 77b57681f..fd9e634c3 100644 --- a/packages/webpack-loader/__fixtures__/error-config/error.ts +++ b/packages/webpack-loader/__fixtures__/error-config/error.ts @@ -1 +1 @@ -export default /Loader has been initialized using an options object that does not match the API schema/; +export default /\.plugins must be an array, or undefined/; diff --git a/packages/webpack-loader/__fixtures__/error-syntax/code.txt b/packages/webpack-loader/__fixtures__/error-syntax/code.txt deleted file mode 100644 index c71bbc16e..000000000 --- a/packages/webpack-loader/__fixtures__/error-syntax/code.txt +++ /dev/null @@ -1,6 +0,0 @@ -// This file is .txt intentionally to avoid Prettier formatting -import { makeStyles } from '@griffel/react'; - -const styles = makeStyles({ - root: { color: 'red' }, -} diff --git a/packages/webpack-loader/__fixtures__/error-syntax/error.ts b/packages/webpack-loader/__fixtures__/error-syntax/error.ts deleted file mode 100644 index 14647cf21..000000000 --- a/packages/webpack-loader/__fixtures__/error-syntax/error.ts +++ /dev/null @@ -1 +0,0 @@ -export default /Module build failed/; diff --git a/packages/webpack-loader/__fixtures__/function/output.ts b/packages/webpack-loader/__fixtures__/function/output.ts index f227f4c15..e38a3bc7c 100644 --- a/packages/webpack-loader/__fixtures__/function/output.ts +++ b/packages/webpack-loader/__fixtures__/function/output.ts @@ -1,5 +1,5 @@ -import { __styles } from '@griffel/react'; -export const styles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const styles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fe3e8s9', diff --git a/packages/webpack-loader/__fixtures__/object/output.ts b/packages/webpack-loader/__fixtures__/object/output.ts index 3f3ef2479..acf11e401 100644 --- a/packages/webpack-loader/__fixtures__/object/output.ts +++ b/packages/webpack-loader/__fixtures__/object/output.ts @@ -1,6 +1,5 @@ -import { __styles } from '@griffel/react'; -import { tokens } from './tokens'; -export const styles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const styles = /*#__PURE__*/ _styles( { root: { sj55zd: 'fl9q5hc', diff --git a/packages/webpack-loader/__fixtures__/react-component/code.ts b/packages/webpack-loader/__fixtures__/react-component/code.ts new file mode 100644 index 000000000..24d1a07ad --- /dev/null +++ b/packages/webpack-loader/__fixtures__/react-component/code.ts @@ -0,0 +1,12 @@ +import { makeStyles } from '@griffel/react'; +import * as React from 'react'; + +const useStyles = makeStyles({ + root: { color: 'red' }, +}); + +export default function Component() { + const classes = useStyles(); + + return React.createElement('div', { className: classes.root }); +} diff --git a/packages/webpack-loader/__fixtures__/react-component/output.ts b/packages/webpack-loader/__fixtures__/react-component/output.ts new file mode 100644 index 000000000..deecd1848 --- /dev/null +++ b/packages/webpack-loader/__fixtures__/react-component/output.ts @@ -0,0 +1,18 @@ +import { __styles as _styles } from '@griffel/react'; +import * as React from 'react'; +const useStyles = /*#__PURE__*/ _styles( + { + root: { + sj55zd: 'fe3e8s9', + }, + }, + { + d: ['.fe3e8s9{color:red;}'], + }, +); +export default function Component() { + const classes = useStyles(); + return React.createElement('div', { + className: classes.root, + }); +} diff --git a/packages/webpack-loader/__fixtures__/reset/output.ts b/packages/webpack-loader/__fixtures__/reset/output.ts index 908b64601..a176e7560 100644 --- a/packages/webpack-loader/__fixtures__/reset/output.ts +++ b/packages/webpack-loader/__fixtures__/reset/output.ts @@ -1,6 +1,5 @@ -import { __resetStyles } from '@griffel/react'; -import { tokens } from './tokens'; -export const useStyles = __resetStyles('rgwtdav', 'r133dp1', [ +import { __resetStyles as _resetStyles } from '@griffel/react'; +export const useStyles = /*#__PURE__*/ _resetStyles('rgwtdav', 'r133dp1', [ '.rgwtdav{color:var(--colorBrandStroke1);padding-left:4px;}', '.r133dp1{color:var(--colorBrandStroke1);padding-right:4px;}', ]); diff --git a/packages/webpack-loader/__fixtures__/webpack-aliases/output.ts b/packages/webpack-loader/__fixtures__/webpack-aliases/output.ts index 06a3744a4..004c0a31b 100644 --- a/packages/webpack-loader/__fixtures__/webpack-aliases/output.ts +++ b/packages/webpack-loader/__fixtures__/webpack-aliases/output.ts @@ -1,8 +1,5 @@ -import { __styles } from '@griffel/react'; -// @ts-expect-error This module will be resolved via aliases -import color from 'non-existing-color-module'; -import { tokens } from './tokens'; -export const styles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const styles = /*#__PURE__*/ _styles( { root: { De3pzq: 'f1bh81bl', diff --git a/packages/webpack-loader/__fixtures__/webpack-resolve-plugins/output.ts b/packages/webpack-loader/__fixtures__/webpack-resolve-plugins/output.ts index 22cb5aea9..004c0a31b 100644 --- a/packages/webpack-loader/__fixtures__/webpack-resolve-plugins/output.ts +++ b/packages/webpack-loader/__fixtures__/webpack-resolve-plugins/output.ts @@ -1,8 +1,5 @@ -import { __styles } from '@griffel/react'; -import { tokens } from './tokens'; -// @ts-expect-error This module will be resolved via aliases -import color from 'non-existing-color-module'; -export const styles = __styles( +import { __styles as _styles } from '@griffel/react'; +export const styles = /*#__PURE__*/ _styles( { root: { De3pzq: 'f1bh81bl', diff --git a/packages/webpack-loader/package.json b/packages/webpack-loader/package.json index bd06fc03b..040f6a1eb 100644 --- a/packages/webpack-loader/package.json +++ b/packages/webpack-loader/package.json @@ -8,13 +8,10 @@ "url": "https://github.com/microsoft/griffel" }, "dependencies": { - "@babel/core": "^7.12.13", - "@griffel/babel-preset": "^1.4.9", - "enhanced-resolve": "^5.8.2", + "@linaria/webpack-loader": "^4.1.11", "tslib": "^2.1.0" }, "peerDependencies": { - "@griffel/react": "^1.5.3", - "webpack": "^5" + "@griffel/linaria-processor": "^0.0.1" } } diff --git a/packages/webpack-loader/src/transformSync.ts b/packages/webpack-loader/src/transformSync.ts deleted file mode 100644 index 4709d1748..000000000 --- a/packages/webpack-loader/src/transformSync.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as Babel from '@babel/core'; -import griffelPreset, { BabelPluginOptions } from '@griffel/babel-preset'; - -export type TransformOptions = { - filename: string; - - inputSourceMap: Babel.TransformOptions['inputSourceMap']; - enableSourceMaps: boolean; - - pluginOptions: BabelPluginOptions; -}; - -export type TransformResult = { - code: string; - sourceMap: NonNullable | undefined; -}; - -/** - * Transforms passed source code with Babel, uses user's config for parsing, but ignores it for transforms. - */ -export function transformSync(sourceCode: string, options: TransformOptions): TransformResult { - // Parse the code first so Babel will use user's babel config for parsing - // During transforms we don't want to use user's config - const babelAST = Babel.parseSync(sourceCode, { - caller: { name: 'griffel' }, - - filename: options.filename, - inputSourceMap: options.inputSourceMap, - sourceMaps: options.enableSourceMaps, - }); - - if (babelAST === null) { - throw new Error(`Failed to create AST for "${options.filename}" due unknown Babel error...`); - } - - const babelFileResult = Babel.transformFromAstSync(babelAST, sourceCode, { - // Ignore all user's configs and apply only our plugin - babelrc: false, - configFile: false, - presets: [[griffelPreset, options.pluginOptions]], - - filename: options.filename, - - sourceMaps: options.enableSourceMaps, - sourceFileName: options.filename, - inputSourceMap: options.inputSourceMap, - }); - - if (babelFileResult === null) { - throw new Error(`Failed to transform "${options.filename}" due unknown Babel error...`); - } - - return { - code: babelFileResult.code as string, - sourceMap: babelFileResult.map === null ? undefined : babelFileResult.map, - }; -} diff --git a/packages/webpack-loader/src/webpackLoader.test.ts b/packages/webpack-loader/src/webpackLoader.test.ts index 5c24d1680..e593f6f91 100644 --- a/packages/webpack-loader/src/webpackLoader.test.ts +++ b/packages/webpack-loader/src/webpackLoader.test.ts @@ -5,11 +5,10 @@ import * as prettier from 'prettier'; import * as webpack from 'webpack'; import { merge } from 'webpack-merge'; -import type { WebpackLoaderOptions } from './webpackLoader'; import { shouldTransformSourceCode } from './webpackLoader'; type CompileOptions = { - loaderOptions?: WebpackLoaderOptions; + loaderOptions?: Record; webpackConfig?: webpack.Configuration; }; @@ -35,7 +34,7 @@ async function compileSourceWithWebpack(entryPath: string, options: CompileOptio module: { rules: [ { - test: /\.(ts|tsx|txt)$/, + test: /\.ts$/, include: path.dirname(entryPath), use: { loader: path.resolve(__dirname, './index.ts'), @@ -174,76 +173,28 @@ function testFixture(fixtureName: string, options: CompileOptions = {}) { } describe('shouldTransformSourceCode', () => { - describe('handles defaults', () => { + describe('handles functions', () => { it('makeStyles', () => { - expect(shouldTransformSourceCode(`import { makeStyles } from "@griffel/react"`, undefined)).toBe(true); - expect(shouldTransformSourceCode(`import { Button } from "@fluentui/react"`, undefined)).toBe(false); + expect(shouldTransformSourceCode(`import { makeStyles } from "@griffel/react"`)).toBe(true); + expect(shouldTransformSourceCode(`import { Button } from "@fluentui/react"`)).toBe(false); }); it('makeResetStyles', () => { - expect(shouldTransformSourceCode(`import { makeResetStyles } from "@griffel/react"`, undefined)).toBe(true); - expect(shouldTransformSourceCode(`import { Button } from "@fluentui/react"`, undefined)).toBe(false); - }); - }); - - describe('handles options', () => { - it('makeStyles', () => { - expect( - shouldTransformSourceCode(`import { makeStyles } from "@griffel/react"`, [ - { moduleSource: '@griffel/react', importName: 'makeStyles' }, - ]), - ).toBe(true); - expect( - shouldTransformSourceCode(`import { createStyles } from "make-styles"`, [ - { moduleSource: 'make-styles', importName: 'createStyles' }, - ]), - ).toBe(true); - - expect( - shouldTransformSourceCode(`import { Button } from "@fluentui/react"`, [ - { moduleSource: '@griffel/react', importName: 'makeStyles' }, - ]), - ).toBe(false); - }); - - it('makeResetStyles', () => { - expect( - shouldTransformSourceCode(`import { makeResetStyles } from "@griffel/react"`, [ - { moduleSource: '@griffel/react', importName: 'makeStyles', resetImportName: 'makeResetStyles' }, - ]), - ).toBe(true); - expect( - shouldTransformSourceCode(`import { createResetStyles } from "make-styles"`, [ - { moduleSource: 'make-styles', importName: 'makeStyles', resetImportName: 'createResetStyles' }, - ]), - ).toBe(true); - - expect( - shouldTransformSourceCode(`import { Button } from "@fluentui/react"`, [ - { moduleSource: '@griffel/react', importName: 'makeStyles', resetImportName: 'makeResetStyles' }, - ]), - ).toBe(false); + expect(shouldTransformSourceCode(`import { makeResetStyles } from "@griffel/react"`)).toBe(true); + expect(shouldTransformSourceCode(`import { Button } from "@fluentui/react"`)).toBe(false); }); }); }); describe('webpackLoader', () => { + jest.setTimeout(15000); + // Integration fixtures for base functionality, all scenarios are tested in "@griffel/babel-preset" testFixture('object'); testFixture('function'); testFixture('reset'); - // Integration fixtures for config functionality - testFixture('config-modules', { - loaderOptions: { - modules: [{ moduleSource: 'react-make-styles', importName: 'makeStyles' }], - }, - webpackConfig: { - externals: { - 'react-make-styles': 'Griffel', - }, - }, - }); + testFixture('react-component'); // Asserts that aliases are resolved properly in Babel plugin testFixture('webpack-aliases', { @@ -287,17 +238,12 @@ describe('webpackLoader', () => { }, }); - // Asserts handling errors from Babel plugin - testFixture('error-argument-count'); // Asserts errors in loader's config testFixture('error-config', { loaderOptions: { babelOptions: { - // @ts-expect-error "plugins" should be an array, an object is passed to test schema plugins: {}, }, }, }); - // Asserts errors in loader functionality - testFixture('error-syntax'); }); diff --git a/packages/webpack-loader/src/webpackLoader.ts b/packages/webpack-loader/src/webpackLoader.ts index 798ff7bca..e1174710b 100644 --- a/packages/webpack-loader/src/webpackLoader.ts +++ b/packages/webpack-loader/src/webpackLoader.ts @@ -1,119 +1,36 @@ -import { configSchema, BabelPluginOptions, EvalCache, Module } from '@griffel/babel-preset'; -import * as enhancedResolve from 'enhanced-resolve'; -import * as path from 'path'; -import * as webpack from 'webpack'; +import linariaLoader from '@linaria/webpack-loader'; -import { transformSync, TransformResult, TransformOptions } from './transformSync'; +export function shouldTransformSourceCode(source: string | Buffer): boolean { + const code = Buffer.isBuffer(source) ? source.toString('utf8') : source; -export type WebpackLoaderOptions = BabelPluginOptions; - -type WebpackLoaderParams = Parameters>; - -export function shouldTransformSourceCode( - sourceCode: string, - modules: WebpackLoaderOptions['modules'] | undefined, -): boolean { - // Fallback to "makeStyles" if options were not provided - const imports = modules - ? modules.flatMap(module => [module.importName, module.resetImportName || 'makeResetStyles']).join('|') - : 'makeStyles|makeResetStyles'; - - return new RegExp(`\\b(${imports}|makeResetStyles)`).test(sourceCode); -} - -/** - * Webpack can also pass sourcemaps as a string, Babel accepts only objects. - * See https://github.com/babel/babel-loader/pull/889. - */ -function parseSourceMap(inputSourceMap: WebpackLoaderParams[1]): TransformOptions['inputSourceMap'] { - try { - if (typeof inputSourceMap === 'string') { - return JSON.parse(inputSourceMap) as TransformOptions['inputSourceMap']; - } - - return inputSourceMap as TransformOptions['inputSourceMap']; - } catch (err) { - return undefined; - } + return new RegExp(`\\b(makeStyles|makeResetStyles)`).test(code); } export function webpackLoader( - this: webpack.LoaderContext, - sourceCode: WebpackLoaderParams[0], - inputSourceMap: WebpackLoaderParams[1], -) { + this: ThisParameterType, + ...args: Parameters +): void { // Loaders are cacheable by default, but there are edge cases/bugs when caching does not work until it's specified: // https://github.com/webpack/webpack/issues/14946 this.cacheable(); - const options = this.getOptions(configSchema); - // Early return to handle cases when makeStyles() calls are not present, allows to avoid expensive invocation of Babel - if (!shouldTransformSourceCode(sourceCode, options.modules)) { - this.callback(null, sourceCode, inputSourceMap); - return; - } - - EvalCache.clearForFile(this.resourcePath); - - const resolveOptionsDefaults: webpack.ResolveOptions = { - conditionNames: ['require'], - extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], - }; - // ⚠ "this._compilation" limits loaders compatibility, however there seems to be no other way to access Webpack's - // resolver. - // There is this.resolve(), but it's asynchronous. Another option is to read the webpack.config.js, but it won't work - // for programmatic usage. This API is used by many loaders/plugins, so hope we're safe for a while - const resolveOptionsFromWebpackConfig: webpack.ResolveOptions = this._compilation?.options.resolve || {}; - - const resolveSync = enhancedResolve.create.sync({ - ...resolveOptionsDefaults, - alias: resolveOptionsFromWebpackConfig.alias, - modules: resolveOptionsFromWebpackConfig.modules, - plugins: resolveOptionsFromWebpackConfig.plugins, - }); - - const originalResolveFilename = Module._resolveFilename; - - let result: TransformResult | null = null; - let error: Error | null = null; - - try { - // We are evaluating modules in Babel plugin to resolve expressions (function calls, imported constants, etc.) in - // makeStyles() calls, see evaluatePathsInVM.ts. - // Webpack's config can define own module resolution, Babel plugin should use Webpack's resolution to properly - // resolve paths. - Module._resolveFilename = (id, { filename }) => { - const resolvedPath = resolveSync(path.dirname(filename), id); - - if (!resolvedPath) { - throw new Error(`enhanced-resolve: Failed to resolve module "${id}"`); - } - - this.addDependency(resolvedPath); - - return resolvedPath; - }; - - result = transformSync(sourceCode, { - filename: path.relative(process.cwd(), this.resourcePath), - - enableSourceMaps: this.sourceMap || false, - inputSourceMap: parseSourceMap(inputSourceMap), - - pluginOptions: options, - }); - } catch (err) { - error = err as Error; - } finally { - // Restore original behaviour - Module._resolveFilename = originalResolveFilename; - } - - if (result) { - this.callback(null, result.code, result.sourceMap); + if (!shouldTransformSourceCode(args[0])) { + this.callback(null, args[0], args[1]); return; } - this.callback(error); + // TODO: remove once is fixed https://github.com/callstack/linaria/issues/1177 + this.loaders[this.loaderIndex].options = this.loaders[this.loaderIndex].options || {}; + (this.loaders[this.loaderIndex].options as { extensions: string[] }).extensions = [ + '.cjs', + '.json', + '.js', + '.jsx', + '.mjs', + '.ts', + '.tsx', + ]; + + return linariaLoader.apply(this, args); } diff --git a/tsconfig.base.json b/tsconfig.base.json index 12d84015c..4873d304e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -21,6 +21,9 @@ "@griffel/e2e-utils": ["e2e/utils/src/index.ts"], "@griffel/eslint-plugin": ["packages/eslint-plugin/src/index.ts"], "@griffel/jest-serializer": ["packages/jest-serializer/src/index.ts"], + "@griffel/linaria-processor": ["packages/linaria-processor/src/index.ts"], + "@griffel/linaria-processor/make-styles": ["packages/linaria-processor/src/MakeStylesProcessor.ts"], + "@griffel/linaria-processor/make-reset-styles": ["packages/linaria-processor/src/MakeResetStylesProcessor.ts"], "@griffel/next-extraction-plugin": ["packages/next-extraction-plugin/src/index.ts"], "@griffel/react": ["packages/react/src/index.ts"], "@griffel/webpack-extraction-plugin": ["packages/webpack-extraction-plugin/src/index.ts"], diff --git a/workspace.json b/workspace.json index 9a8b089d6..7e3515aba 100644 --- a/workspace.json +++ b/workspace.json @@ -10,6 +10,7 @@ "@griffel/e2e-utils": "e2e/utils", "@griffel/eslint-plugin": "packages/eslint-plugin", "@griffel/jest-serializer": "packages/jest-serializer", + "@griffel/linaria-processor": "packages/linaria-processor", "@griffel/next-extraction-plugin": "packages/next-extraction-plugin", "@griffel/react": "packages/react", "@griffel/webpack-extraction-plugin": "packages/webpack-extraction-plugin", diff --git a/yarn.lock b/yarn.lock index 0e0183f92..3d767fee8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -190,10 +190,10 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.13.11, @babel/compat-data@npm:^7.18.6, @babel/compat-data@npm:^7.20.0": - version: 7.20.1 - resolution: "@babel/compat-data@npm:7.20.1" - checksum: 989b9b7a6fe43c547bb8329241bd0ba6983488b83d29cc59de35536272ee6bb4cc7487ba6c8a4bceebb3a57f8c5fea1434f80bbbe75202bc79bc1110f955ff25 +"@babel/compat-data@npm:^7.17.7, @babel/compat-data@npm:^7.20.1, @babel/compat-data@npm:^7.20.5": + version: 7.20.14 + resolution: "@babel/compat-data@npm:7.20.14" + checksum: 6c9efe36232094e4ad0b70d165587f21ca718e5d011f7a52a77a18502a7524e90e2855aa5a2e086395bcfd21bd2c7c99128dcd8d9fdffe94316b72acf5c66f2c languageName: node linkType: hard @@ -221,7 +221,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.13, @babel/core@npm:^7.12.3, @babel/core@npm:^7.15.0, @babel/core@npm:^7.15.5, @babel/core@npm:^7.18.2, @babel/core@npm:^7.18.6, @babel/core@npm:^7.20.2, @babel/core@npm:^7.7.2, @babel/core@npm:^7.7.5, @babel/core@npm:^7.8.0": +"@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.13, @babel/core@npm:^7.12.3, @babel/core@npm:^7.15.0, @babel/core@npm:^7.15.5, @babel/core@npm:^7.18.6, @babel/core@npm:^7.20.2, @babel/core@npm:^7.7.2, @babel/core@npm:^7.7.5, @babel/core@npm:^7.8.0": version: 7.20.2 resolution: "@babel/core@npm:7.20.2" dependencies: @@ -244,7 +244,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:>=7, @babel/generator@npm:^7.12.11, @babel/generator@npm:^7.12.13, @babel/generator@npm:^7.12.5, @babel/generator@npm:^7.18.7, @babel/generator@npm:^7.20.2, @babel/generator@npm:^7.20.7, @babel/generator@npm:^7.7.2": +"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.12.13, @babel/generator@npm:^7.12.5, @babel/generator@npm:^7.18.7, @babel/generator@npm:^7.20.2, @babel/generator@npm:^7.20.4, @babel/generator@npm:^7.20.7, @babel/generator@npm:^7.7.2": version: 7.20.14 resolution: "@babel/generator@npm:7.20.14" dependencies: @@ -274,17 +274,18 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.13.0, @babel/helper-compilation-targets@npm:^7.18.6, @babel/helper-compilation-targets@npm:^7.20.0": - version: 7.20.0 - resolution: "@babel/helper-compilation-targets@npm:7.20.0" +"@babel/helper-compilation-targets@npm:^7.13.0, @babel/helper-compilation-targets@npm:^7.17.7, @babel/helper-compilation-targets@npm:^7.18.9, @babel/helper-compilation-targets@npm:^7.20.0, @babel/helper-compilation-targets@npm:^7.20.7": + version: 7.20.7 + resolution: "@babel/helper-compilation-targets@npm:7.20.7" dependencies: - "@babel/compat-data": ^7.20.0 + "@babel/compat-data": ^7.20.5 "@babel/helper-validator-option": ^7.18.6 browserslist: ^4.21.3 + lru-cache: ^5.1.1 semver: ^6.3.0 peerDependencies: "@babel/core": ^7.0.0 - checksum: bc183f2109648849c8fde0b3c5cf08adf2f7ad6dc617b546fd20f34c8ef574ee5ee293c8d1bd0ed0221212e8f5907cdc2c42097870f1dcc769a654107d82c95b + checksum: 8c32c873ba86e2e1805b30e0807abd07188acbe00ebb97576f0b09061cc65007f1312b589eccb4349c5a8c7f8bb9f2ab199d41da7030bf103d9f347dcd3a3cf4 languageName: node linkType: hard @@ -305,15 +306,15 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-regexp-features-plugin@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-create-regexp-features-plugin@npm:7.18.6" +"@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.20.5": + version: 7.20.5 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.20.5" dependencies: "@babel/helper-annotate-as-pure": ^7.18.6 - regexpu-core: ^5.1.0 + regexpu-core: ^5.2.1 peerDependencies: "@babel/core": ^7.0.0 - checksum: 2d76e660cbfd0bfcb01ca9f177f0e9091c871a6b99f68ece6bcf4ab4a9df073485bdc2d87ecdfbde44b7f3723b26d13085d0f92082adb3ae80d31b246099f10a + checksum: 7f29c3cb7447cca047b0d394f8ab98e4923d00e86a7afa56e5df9770c48ec107891505d2d1f06b720ecc94ed24bf58d90986cc35fe4a43b549eb7b7a5077b693 languageName: node linkType: hard @@ -335,21 +336,19 @@ __metadata: languageName: node linkType: hard -"@babel/helper-define-polyfill-provider@npm:^0.3.1": - version: 0.3.1 - resolution: "@babel/helper-define-polyfill-provider@npm:0.3.1" +"@babel/helper-define-polyfill-provider@npm:^0.3.3": + version: 0.3.3 + resolution: "@babel/helper-define-polyfill-provider@npm:0.3.3" dependencies: - "@babel/helper-compilation-targets": ^7.13.0 - "@babel/helper-module-imports": ^7.12.13 - "@babel/helper-plugin-utils": ^7.13.0 - "@babel/traverse": ^7.13.0 + "@babel/helper-compilation-targets": ^7.17.7 + "@babel/helper-plugin-utils": ^7.16.7 debug: ^4.1.1 lodash.debounce: ^4.0.8 resolve: ^1.14.2 semver: ^6.1.2 peerDependencies: "@babel/core": ^7.4.0-0 - checksum: e3e93cb22febfc0449a210cdafb278e5e1a038af2ca2b02f5dee71c7a49e8ba26e469d631ee11a4243885961a62bb2e5b0a4deb3ec1d7918a33c953d05c3e584 + checksum: 8e3fe75513302e34f6d92bd67b53890e8545e6c5bca8fe757b9979f09d68d7e259f6daea90dc9e01e332c4f8781bda31c5fe551c82a277f9bc0bec007aed497c languageName: node linkType: hard @@ -369,7 +368,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-function-name@npm:^7.18.6, @babel/helper-function-name@npm:^7.19.0": +"@babel/helper-function-name@npm:^7.18.6, @babel/helper-function-name@npm:^7.18.9, @babel/helper-function-name@npm:^7.19.0": version: 7.19.0 resolution: "@babel/helper-function-name@npm:7.19.0" dependencies: @@ -388,12 +387,12 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-member-expression-to-functions@npm:7.18.6" +"@babel/helper-member-expression-to-functions@npm:^7.18.6, @babel/helper-member-expression-to-functions@npm:^7.20.7": + version: 7.20.7 + resolution: "@babel/helper-member-expression-to-functions@npm:7.20.7" dependencies: - "@babel/types": ^7.18.6 - checksum: 20c8e82d2375534dfe4d4adeb01d94906e5e616143bb2775e9f1d858039d87a0f79220e0a5c2ed410c54ccdeda47a4c09609b396db1f98fe8ce9e420894ac2f3 + "@babel/types": ^7.20.7 + checksum: cec17aab7e964830b0146e575bd141127032319f26ed864a65b35abd75ad618d264d3e11449b9b4e29cfd95bb1a7e774afddd4884fdcc29c36ac9cbd2b66359f languageName: node linkType: hard @@ -406,19 +405,19 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.20.2": - version: 7.20.2 - resolution: "@babel/helper-module-transforms@npm:7.20.2" +"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.20.11, @babel/helper-module-transforms@npm:^7.20.2": + version: 7.20.11 + resolution: "@babel/helper-module-transforms@npm:7.20.11" dependencies: "@babel/helper-environment-visitor": ^7.18.9 "@babel/helper-module-imports": ^7.18.6 "@babel/helper-simple-access": ^7.20.2 "@babel/helper-split-export-declaration": ^7.18.6 "@babel/helper-validator-identifier": ^7.19.1 - "@babel/template": ^7.18.10 - "@babel/traverse": ^7.20.1 - "@babel/types": ^7.20.2 - checksum: 33a60ca115f6fce2c9d98e2a2e5649498aa7b23e2ae3c18745d7a021487708fc311458c33542f299387a0da168afccba94116e077f2cce49ae9e5ab83399e8a2 + "@babel/template": ^7.20.7 + "@babel/traverse": ^7.20.10 + "@babel/types": ^7.20.7 + checksum: 29319ebafa693d48756c6ba0d871677bb0037e0da084fbe221a17c38d57093fc8aa38543c07d76e788266a937976e37ab4901971ca7f237c5ab45f524b9ecca0 languageName: node linkType: hard @@ -438,41 +437,42 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.18.6 - resolution: "@babel/helper-plugin-utils@npm:7.18.6" - checksum: 3dbfceb6c10fdf6c78a0e57f24e991ff8967b8a0bd45fe0314fb4a8ccf7c8ad4c3778c319a32286e7b1f63d507173df56b4e69fb31b71e1b447a73efa1ca723e +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": + version: 7.20.2 + resolution: "@babel/helper-plugin-utils@npm:7.20.2" + checksum: f6cae53b7fdb1bf3abd50fa61b10b4470985b400cc794d92635da1e7077bb19729f626adc0741b69403d9b6e411cddddb9c0157a709cc7c4eeb41e663be5d74b languageName: node linkType: hard -"@babel/helper-remap-async-to-generator@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-remap-async-to-generator@npm:7.18.6" +"@babel/helper-remap-async-to-generator@npm:^7.18.6, @babel/helper-remap-async-to-generator@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/helper-remap-async-to-generator@npm:7.18.9" dependencies: "@babel/helper-annotate-as-pure": ^7.18.6 - "@babel/helper-environment-visitor": ^7.18.6 - "@babel/helper-wrap-function": ^7.18.6 - "@babel/types": ^7.18.6 + "@babel/helper-environment-visitor": ^7.18.9 + "@babel/helper-wrap-function": ^7.18.9 + "@babel/types": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0 - checksum: 83e890624da9413c74a8084f6b5f7bfe93abad8a6e1a33464f3086e2a1336751672e6ac6d74dddd35b641d19584cc0f93d02c52a4f33385b3be5b40942fe30da + checksum: 4be6076192308671b046245899b703ba090dbe7ad03e0bea897bb2944ae5b88e5e85853c9d1f83f643474b54c578d8ac0800b80341a86e8538264a725fbbefec languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.16.7, @babel/helper-replace-supers@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-replace-supers@npm:7.18.6" +"@babel/helper-replace-supers@npm:^7.16.7, @babel/helper-replace-supers@npm:^7.18.6, @babel/helper-replace-supers@npm:^7.20.7": + version: 7.20.7 + resolution: "@babel/helper-replace-supers@npm:7.20.7" dependencies: - "@babel/helper-environment-visitor": ^7.18.6 - "@babel/helper-member-expression-to-functions": ^7.18.6 + "@babel/helper-environment-visitor": ^7.18.9 + "@babel/helper-member-expression-to-functions": ^7.20.7 "@babel/helper-optimise-call-expression": ^7.18.6 - "@babel/traverse": ^7.18.6 - "@babel/types": ^7.18.6 - checksum: 48e869dc8d3569136d239cd6354687e49c3225b114cb2141ed3a5f31cff5278f463eb25913df3345489061f377ad5d6e49778bddedd098fa8ee3adcec07cc1d3 + "@babel/template": ^7.20.7 + "@babel/traverse": ^7.20.7 + "@babel/types": ^7.20.7 + checksum: b8e0087c9b0c1446e3c6f3f72b73b7e03559c6b570e2cfbe62c738676d9ebd8c369a708cf1a564ef88113b4330750a50232ee1131d303d478b7a5e65e46fbc7c languageName: node linkType: hard -"@babel/helper-simple-access@npm:^7.18.6, @babel/helper-simple-access@npm:^7.20.2": +"@babel/helper-simple-access@npm:^7.20.2": version: 7.20.2 resolution: "@babel/helper-simple-access@npm:7.20.2" dependencies: @@ -481,12 +481,12 @@ __metadata: languageName: node linkType: hard -"@babel/helper-skip-transparent-expression-wrappers@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.18.6" +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.20.0": + version: 7.20.0 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.20.0" dependencies: - "@babel/types": ^7.18.6 - checksum: 069750f9690b2995617c42be4b7848a4490cd30f1edc72401d9d2ae362bc186d395b7d8c1e171c1b6c09751642ab1bba578cccf8c0dfc82b4541f8627965aea7 + "@babel/types": ^7.20.0 + checksum: 34da8c832d1c8a546e45d5c1d59755459ffe43629436707079989599b91e8c19e50e73af7a4bd09c95402d389266731b0d9c5f69e372d8ebd3a709c05c80d7dd languageName: node linkType: hard @@ -520,15 +520,15 @@ __metadata: languageName: node linkType: hard -"@babel/helper-wrap-function@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-wrap-function@npm:7.18.6" +"@babel/helper-wrap-function@npm:^7.18.9": + version: 7.20.5 + resolution: "@babel/helper-wrap-function@npm:7.20.5" dependencies: - "@babel/helper-function-name": ^7.18.6 - "@babel/template": ^7.18.6 - "@babel/traverse": ^7.18.6 - "@babel/types": ^7.18.6 - checksum: b7a4f59b302ed77407e5c2005d8677ebdeabbfa69230e15f80b5e06cc532369c1e48399ec3e67dd3341e7ab9b3f84f17a255e2c1ec4e0d42bb571a4dac5472d6 + "@babel/helper-function-name": ^7.19.0 + "@babel/template": ^7.18.10 + "@babel/traverse": ^7.20.5 + "@babel/types": ^7.20.5 + checksum: 11a6fc28334368a193a9cb3ad16f29cd7603bab958433efc82ebe59fa6556c227faa24f07ce43983f7a85df826f71d441638442c4315e90a554fe0a70ca5005b languageName: node linkType: hard @@ -554,7 +554,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.12.11, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.18.10, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.20.13, @babel/parser@npm:^7.20.2": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.12.11, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.20.13, @babel/parser@npm:^7.20.2, @babel/parser@npm:^7.20.7": version: 7.20.15 resolution: "@babel/parser@npm:7.20.15" bin: @@ -574,30 +574,30 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.18.6" +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.18.9": + version: 7.20.7 + resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-skip-transparent-expression-wrappers": ^7.18.6 - "@babel/plugin-proposal-optional-chaining": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-skip-transparent-expression-wrappers": ^7.20.0 + "@babel/plugin-proposal-optional-chaining": ^7.20.7 peerDependencies: "@babel/core": ^7.13.0 - checksum: 0f0057cd12e98e297fd952c9cfdbffe5e34813f1b302e941fc212ca2a7b183ec2a227a1c49e104bbda528a4da6be03dbfb6e0d275d9572fb16b6ac5cda09fcd7 + checksum: d610f532210bee5342f5b44a12395ccc6d904e675a297189bc1e401cc185beec09873da523466d7fec34ae1574f7a384235cba1ccc9fe7b89ba094167897c845 languageName: node linkType: hard -"@babel/plugin-proposal-async-generator-functions@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-async-generator-functions@npm:7.18.6" +"@babel/plugin-proposal-async-generator-functions@npm:^7.20.1": + version: 7.20.7 + resolution: "@babel/plugin-proposal-async-generator-functions@npm:7.20.7" dependencies: - "@babel/helper-environment-visitor": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-remap-async-to-generator": ^7.18.6 + "@babel/helper-environment-visitor": ^7.18.9 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-remap-async-to-generator": ^7.18.9 "@babel/plugin-syntax-async-generators": ^7.8.4 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 3f708808ba6f8a9bd18805b1b22ab90ec0b362d949111a776e0bade5391f143f55479dcc444b2cec25fc89ac21035ee92e9a5ec37c02c610639197a0c2f7dcb0 + checksum: 111109ee118c9e69982f08d5e119eab04190b36a0f40e22e873802d941956eee66d2aa5a15f5321e51e3f9aa70a91136451b987fe15185ef8cc547ac88937723 languageName: node linkType: hard @@ -665,15 +665,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-export-namespace-from@npm:>=7, @babel/plugin-proposal-export-namespace-from@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-export-namespace-from@npm:7.18.6" +"@babel/plugin-proposal-export-namespace-from@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-proposal-export-namespace-from@npm:7.18.9" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 "@babel/plugin-syntax-export-namespace-from": ^7.8.3 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 3227307e1155e8434825c02fb2e4e91e590aeb629ce6ce23e4fe869d0018a144c4674bf98863e1bb6d4e4a6f831e686ae43f46a87894e4286e31e6492a5571eb + checksum: 84ff22bacc5d30918a849bfb7e0e90ae4c5b8d8b65f2ac881803d1cf9068dffbe53bd657b0e4bc4c20b4db301b1c85f1e74183cf29a0dd31e964bd4e97c363ef languageName: node linkType: hard @@ -689,15 +689,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-logical-assignment-operators@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-logical-assignment-operators@npm:7.18.6" +"@babel/plugin-proposal-logical-assignment-operators@npm:^7.18.9": + version: 7.20.7 + resolution: "@babel/plugin-proposal-logical-assignment-operators@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 4fe0a0d6739da6b1929f5015846e1de3b72d7dd07c665975ca795850ad7d048f8a0756c057a4cd1d71080384ad6283c30fcc239393da6848eabc38e38d3206c5 + checksum: cdd7b8136cc4db3f47714d5266f9e7b592a2ac5a94a5878787ce08890e97c8ab1ca8e94b27bfeba7b0f2b1549a026d9fc414ca2196de603df36fb32633bbdc19 languageName: node linkType: hard @@ -738,18 +738,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-object-rest-spread@npm:^7.12.1, @babel/plugin-proposal-object-rest-spread@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.18.6" +"@babel/plugin-proposal-object-rest-spread@npm:^7.12.1, @babel/plugin-proposal-object-rest-spread@npm:^7.20.2": + version: 7.20.7 + resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.20.7" dependencies: - "@babel/compat-data": ^7.18.6 - "@babel/helper-compilation-targets": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/compat-data": ^7.20.5 + "@babel/helper-compilation-targets": ^7.20.7 + "@babel/helper-plugin-utils": ^7.20.2 "@babel/plugin-syntax-object-rest-spread": ^7.8.3 - "@babel/plugin-transform-parameters": ^7.18.6 + "@babel/plugin-transform-parameters": ^7.20.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 9b7516bad285a8706beb5e619cf505364bfbe79e219ae86d2139b32010d238d146301c1424488926a57f6d729556e21cfccab29f28c26ecd0dda05e53d7160b1 + checksum: 1329db17009964bc644484c660eab717cb3ca63ac0ab0f67c651a028d1bc2ead51dc4064caea283e46994f1b7221670a35cbc0b4beb6273f55e915494b5aa0b2 languageName: node linkType: hard @@ -765,16 +765,16 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-optional-chaining@npm:^7.12.7, @babel/plugin-proposal-optional-chaining@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-optional-chaining@npm:7.18.6" +"@babel/plugin-proposal-optional-chaining@npm:^7.12.7, @babel/plugin-proposal-optional-chaining@npm:^7.18.9, @babel/plugin-proposal-optional-chaining@npm:^7.20.7": + version: 7.20.7 + resolution: "@babel/plugin-proposal-optional-chaining@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-skip-transparent-expression-wrappers": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-skip-transparent-expression-wrappers": ^7.20.0 "@babel/plugin-syntax-optional-chaining": ^7.8.3 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 9c3bf80cfb41ee53a2a5d0f316ef5d125bb0d400ede1ee1a68a9b7dfc998036cca20c3901cb5c9e24fdd9f08c0056030e042f4637bc9bbc36b682384b38e2d96 + checksum: 274b8932335bd064ca24cf1a4da2b2c20c92726d4bfa8b0cb5023857479b8481feef33505c16650c7b9239334e5c6959babc924816324c4cf223dd91c7ca79bc languageName: node linkType: hard @@ -871,7 +871,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-dynamic-import@npm:>=7, @babel/plugin-syntax-dynamic-import@npm:^7.8.3": +"@babel/plugin-syntax-dynamic-import@npm:^7.8.3": version: 7.8.3 resolution: "@babel/plugin-syntax-dynamic-import@npm:7.8.3" dependencies: @@ -915,14 +915,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-import-assertions@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-syntax-import-assertions@npm:7.18.6" +"@babel/plugin-syntax-import-assertions@npm:^7.20.0": + version: 7.20.0 + resolution: "@babel/plugin-syntax-import-assertions@npm:7.20.0" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.19.0 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 54918a05375325ba0c60bc81abfb261e6f118bed2de94e4c17dca9a2006fc25e13b1a8b5504b9a881238ea394fd2f098f60b2eb3a392585d6348874565445e7b + checksum: 6a86220e0aae40164cd3ffaf80e7c076a1be02a8f3480455dddbae05fda8140f429290027604df7a11b3f3f124866e8a6d69dbfa1dda61ee7377b920ad144d5b languageName: node linkType: hard @@ -1104,54 +1104,56 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-block-scoping@npm:^7.12.12, @babel/plugin-transform-block-scoping@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-block-scoping@npm:7.18.6" +"@babel/plugin-transform-block-scoping@npm:^7.12.12, @babel/plugin-transform-block-scoping@npm:^7.20.2": + version: 7.20.15 + resolution: "@babel/plugin-transform-block-scoping@npm:7.20.15" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: b117a005a9d5aedacc4a899a4d504b7f46e4c1e852b62d34a7f1cb06caecb1f69507b6a07d0ba6c6241ddd8f470bc6f483513d87637e49f6c508aadf23cf391a + checksum: 1dddf7be578306837074cb5059f8408af0b1c0bfcf922ed920d4aa65d08fb7c6e6129ca254e9879c4c6d2a6be4937111551f51922e8b0e071ed16eb6564a4dbb languageName: node linkType: hard -"@babel/plugin-transform-classes@npm:^7.12.1, @babel/plugin-transform-classes@npm:^7.18.6": - version: 7.18.8 - resolution: "@babel/plugin-transform-classes@npm:7.18.8" +"@babel/plugin-transform-classes@npm:^7.12.1, @babel/plugin-transform-classes@npm:^7.20.2": + version: 7.20.7 + resolution: "@babel/plugin-transform-classes@npm:7.20.7" dependencies: "@babel/helper-annotate-as-pure": ^7.18.6 - "@babel/helper-environment-visitor": ^7.18.6 - "@babel/helper-function-name": ^7.18.6 + "@babel/helper-compilation-targets": ^7.20.7 + "@babel/helper-environment-visitor": ^7.18.9 + "@babel/helper-function-name": ^7.19.0 "@babel/helper-optimise-call-expression": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-replace-supers": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-replace-supers": ^7.20.7 "@babel/helper-split-export-declaration": ^7.18.6 globals: ^11.1.0 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 7248a430bb2e43bf5a063da37400875f2ed2c5eac1036c43e6634ad0ef8346a0fc99a910261832db0cd88e6d61dfcc3d9be36714eb87c8c467eed9588adb3143 + checksum: 4cf55ad88e52c7c66a991add4c8e1c3324384bd52df7085962d396879561456a44352e5ab1725cc80f4e83737a2931e847c4a96c7aa4a549357f23631ff31799 languageName: node linkType: hard -"@babel/plugin-transform-computed-properties@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-computed-properties@npm:7.18.6" +"@babel/plugin-transform-computed-properties@npm:^7.18.9": + version: 7.20.7 + resolution: "@babel/plugin-transform-computed-properties@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/template": ^7.20.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 686d7b9d03192959684de11ddf9c616ecfb314b199e9191f2ebbbfe0e0c9d6a3a5245668cde620e949e5891ca9a9d90a224fbf605dfb94d05b81aff127c5ae60 + checksum: be70e54bda8b469146459f429e5f2bd415023b87b2d5af8b10e48f465ffb02847a3ed162ca60378c004b82db848e4d62e90010d41ded7e7176b6d8d1c2911139 languageName: node linkType: hard -"@babel/plugin-transform-destructuring@npm:^7.12.1, @babel/plugin-transform-destructuring@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-destructuring@npm:7.18.6" +"@babel/plugin-transform-destructuring@npm:^7.12.1, @babel/plugin-transform-destructuring@npm:^7.20.2": + version: 7.20.7 + resolution: "@babel/plugin-transform-destructuring@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 256573bd2712e292784befb82fcb88b070c16b4d129469ea886885d8fbafdbb072c9fcf7f82039d2c61b05f2005db34e5068b2a6e813941c41ce709249f357c1 + checksum: bd8affdb142c77662037215e37128b2110a786c92a67e1f00b38223c438c1610bd84cbc0386e9cd3479245ea811c5ca6c9838f49be4729b592159a30ce79add2 languageName: node linkType: hard @@ -1167,14 +1169,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-duplicate-keys@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-duplicate-keys@npm:7.18.6" +"@babel/plugin-transform-duplicate-keys@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-transform-duplicate-keys@npm:7.18.9" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: c21797ae06e84e3d1502b1214279215e4dcb2e181198bfb9b1644e65ca0288441d3d70a9ea745f687095e9226b9a4a62b9e53fb944c8924b9591ce4e0039b042 + checksum: 220bf4a9fec5c4d4a7b1de38810350260e8ea08481bf78332a464a21256a95f0df8cd56025f346238f09b04f8e86d4158fafc9f4af57abaef31637e3b58bd4fe languageName: node linkType: hard @@ -1202,7 +1204,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-for-of@npm:^7.12.1, @babel/plugin-transform-for-of@npm:^7.18.6": +"@babel/plugin-transform-for-of@npm:^7.12.1, @babel/plugin-transform-for-of@npm:^7.18.8": version: 7.18.8 resolution: "@babel/plugin-transform-for-of@npm:7.18.8" dependencies: @@ -1213,27 +1215,27 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-function-name@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-function-name@npm:7.18.6" +"@babel/plugin-transform-function-name@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-transform-function-name@npm:7.18.9" dependencies: - "@babel/helper-compilation-targets": ^7.18.6 - "@babel/helper-function-name": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-compilation-targets": ^7.18.9 + "@babel/helper-function-name": ^7.18.9 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: d15d36f52d11a1b6dde3cfc0975eb9c030d66207875a722860bc0637f7515f94107b35320306967faaaa896523097e8f5c3dd6982d926f52016525ceaa9e3e42 + checksum: 62dd9c6cdc9714704efe15545e782ee52d74dc73916bf954b4d3bee088fb0ec9e3c8f52e751252433656c09f744b27b757fc06ed99bcde28e8a21600a1d8e597 languageName: node linkType: hard -"@babel/plugin-transform-literals@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-literals@npm:7.18.6" +"@babel/plugin-transform-literals@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-transform-literals@npm:7.18.9" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 859e2405d51931c8c0ea39890c0bcf6c7c01793fe99409844fe122e4c342528f87cd13b8210dd2873ecf5c643149b310c4bc5eb9a4c45928de142063ab04b2b8 + checksum: 3458dd2f1a47ac51d9d607aa18f3d321cbfa8560a985199185bed5a906bb0c61ba85575d386460bac9aed43fdd98940041fae5a67dff286f6f967707cff489f8 languageName: node linkType: hard @@ -1248,45 +1250,42 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-modules-amd@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-modules-amd@npm:7.18.6" +"@babel/plugin-transform-modules-amd@npm:^7.19.6": + version: 7.20.11 + resolution: "@babel/plugin-transform-modules-amd@npm:7.20.11" dependencies: - "@babel/helper-module-transforms": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - babel-plugin-dynamic-import-node: ^2.3.3 + "@babel/helper-module-transforms": ^7.20.11 + "@babel/helper-plugin-utils": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: f60c4c4e0eaec41e42c003cbab44305da7a8e05b2c9bdfc2b3fe0f9e1d7441c959ff5248aa03e350abe530e354028cbf3aa20bf07067b11510997dad8dd39be0 + checksum: 23665c1c20c8f11c89382b588fb9651c0756d130737a7625baeaadbd3b973bc5bfba1303bedffa8fb99db1e6d848afb01016e1df2b69b18303e946890c790001 languageName: node linkType: hard -"@babel/plugin-transform-modules-commonjs@npm:^7.18.2, @babel/plugin-transform-modules-commonjs@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-modules-commonjs@npm:7.18.6" +"@babel/plugin-transform-modules-commonjs@npm:^7.19.6": + version: 7.20.11 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.20.11" dependencies: - "@babel/helper-module-transforms": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-simple-access": ^7.18.6 - babel-plugin-dynamic-import-node: ^2.3.3 + "@babel/helper-module-transforms": ^7.20.11 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-simple-access": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 7e356e3df8a6a8542cced7491ec5b1cc1093a88d216a59e63a5d2b9fe9d193cbea864f680a41429e41a4f9ecec930aa5b0b8f57e2b17b3b4d27923bb12ba5d14 + checksum: ddd0623e2ad4b5c0faaa0ae30d3407a3fa484d911c968ed33cfb1b339ac3691321c959db60b66dc136dbd67770fff586f7e48a7ce0d7d357f92d6ef6fb7ed1a7 languageName: node linkType: hard -"@babel/plugin-transform-modules-systemjs@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-modules-systemjs@npm:7.18.6" +"@babel/plugin-transform-modules-systemjs@npm:^7.19.6": + version: 7.20.11 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.20.11" dependencies: "@babel/helper-hoist-variables": ^7.18.6 - "@babel/helper-module-transforms": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-validator-identifier": ^7.18.6 - babel-plugin-dynamic-import-node: ^2.3.3 + "@babel/helper-module-transforms": ^7.20.11 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-validator-identifier": ^7.19.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 69e476477fe4c18a5975aa683684b2db76c76013d2387110ffc7b221071ec611cd3961b68631bdae7a57cb5cc0decdbb07119ef168e9dcdae9ba803a7b352ab0 + checksum: 4546c47587f88156d66c7eb7808e903cf4bb3f6ba6ac9bc8e3af2e29e92eb9f0b3f44d52043bfd24eb25fa7827fd7b6c8bfeac0cac7584e019b87e1ecbd0e673 languageName: node linkType: hard @@ -1302,15 +1301,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.18.6" +"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.19.1": + version: 7.20.5 + resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.20.5" dependencies: - "@babel/helper-create-regexp-features-plugin": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-create-regexp-features-plugin": ^7.20.5 + "@babel/helper-plugin-utils": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0 - checksum: 6ef64aa3dad68df139eeaa7b6e9bb626be8f738ed5ed4db765d516944b1456d513b6bad3bb60fff22babe73de26436fd814a4228705b2d3d2fdb272c31da35e2 + checksum: 528c95fb1087e212f17e1c6456df041b28a83c772b9c93d2e407c9d03b72182b0d9d126770c1d6e0b23aab052599ceaf25ed6a2c0627f4249be34a83f6fae853 languageName: node linkType: hard @@ -1337,14 +1336,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.18.6": - version: 7.18.8 - resolution: "@babel/plugin-transform-parameters@npm:7.18.8" +"@babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.20.1, @babel/plugin-transform-parameters@npm:^7.20.7": + version: 7.20.7 + resolution: "@babel/plugin-transform-parameters@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 2b5863300da60face8a250d91da16294333bd5626e9721b13a3ba2078bd2a5a190e32c6e7a1323d5f547f579aeb2804ff49a62a55fcad2b1d099e55a55b788ea + checksum: 6ffe0dd9afb2d2b9bc247381aa2e95dd9997ff5568a0a11900528919a4e073ac68f46409431455badb8809644d47cff180045bc2b9700e3f36e3b23554978947 languageName: node linkType: hard @@ -1442,19 +1441,19 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-runtime@npm:>=7, @babel/plugin-transform-runtime@npm:^7.15.0, @babel/plugin-transform-runtime@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-runtime@npm:7.18.6" +"@babel/plugin-transform-runtime@npm:^7.15.0, @babel/plugin-transform-runtime@npm:^7.18.6, @babel/plugin-transform-runtime@npm:^7.19.6": + version: 7.19.6 + resolution: "@babel/plugin-transform-runtime@npm:7.19.6" dependencies: "@babel/helper-module-imports": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - babel-plugin-polyfill-corejs2: ^0.3.1 - babel-plugin-polyfill-corejs3: ^0.5.2 - babel-plugin-polyfill-regenerator: ^0.3.1 + "@babel/helper-plugin-utils": ^7.19.0 + babel-plugin-polyfill-corejs2: ^0.3.3 + babel-plugin-polyfill-corejs3: ^0.6.0 + babel-plugin-polyfill-regenerator: ^0.4.1 semver: ^6.3.0 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: ed1ee31d02c86b4cad3d38678fd9593a50478588c1ad15b0128135dfbfb463555d49335a55d1486c3a15c5791e6ef9e21a3cc124c555b250fadfd83861ac61d2 + checksum: ef93efbcbb00dcf4da6dcc55bda698a2a57fca3fb05a6a13e932ecfdb7c1c5d2f0b5b245c1c4faca0318853937caba0d82442f58b7653249f64275d08052fbd8 languageName: node linkType: hard @@ -1469,15 +1468,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-spread@npm:^7.12.1, @babel/plugin-transform-spread@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-spread@npm:7.18.6" +"@babel/plugin-transform-spread@npm:^7.12.1, @babel/plugin-transform-spread@npm:^7.19.0": + version: 7.20.7 + resolution: "@babel/plugin-transform-spread@npm:7.20.7" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 - "@babel/helper-skip-transparent-expression-wrappers": ^7.18.6 + "@babel/helper-plugin-utils": ^7.20.2 + "@babel/helper-skip-transparent-expression-wrappers": ^7.20.0 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 996b139ed68503700184f709dc996f285be285282d1780227185b622d9642f5bd60996fcfe910ed0495834f1935df805e7abb36b4b587222264c61020ba4485b + checksum: 8ea698a12da15718aac7489d4cde10beb8a3eea1f66167d11ab1e625033641e8b328157fd1a0b55dd6531933a160c01fc2e2e61132a385cece05f26429fd0cc2 languageName: node linkType: hard @@ -1492,25 +1491,25 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-template-literals@npm:>=7, @babel/plugin-transform-template-literals@npm:^7.12.1, @babel/plugin-transform-template-literals@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-template-literals@npm:7.18.6" +"@babel/plugin-transform-template-literals@npm:^7.12.1, @babel/plugin-transform-template-literals@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-transform-template-literals@npm:7.18.9" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 6ec354415f92850c927dd3ad90e337df8ee1aeb4cdb2c643208bc8652be91f647c137846586b14bc2b2d7ec408c2b74af2d154ba0972a4fe8b559f8c3e07a3aa + checksum: 3d2fcd79b7c345917f69b92a85bdc3ddd68ce2c87dc70c7d61a8373546ccd1f5cb8adc8540b49dfba08e1b82bb7b3bbe23a19efdb2b9c994db2db42906ca9fb2 languageName: node linkType: hard -"@babel/plugin-transform-typeof-symbol@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-typeof-symbol@npm:7.18.6" +"@babel/plugin-transform-typeof-symbol@npm:^7.18.9": + version: 7.18.9 + resolution: "@babel/plugin-transform-typeof-symbol@npm:7.18.9" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: b018ac3275958ed74caa2fdb900873bc61907e0cb8b70197ecd2f0e98611119d7a5831761bd14710882c94903e220e6338dd2e7346eca678c788b30457080a7e + checksum: e754e0d8b8a028c52e10c148088606e3f7a9942c57bd648fc0438e5b4868db73c386a5ed47ab6d6f0594aae29ee5ffc2ffc0f7ebee7fae560a066d6dea811cd4 languageName: node linkType: hard @@ -1527,14 +1526,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-unicode-escapes@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-unicode-escapes@npm:7.18.6" +"@babel/plugin-transform-unicode-escapes@npm:^7.18.10": + version: 7.18.10 + resolution: "@babel/plugin-transform-unicode-escapes@npm:7.18.10" dependencies: - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.9 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 297a03706723164a777263f76a8d89bccfb1d3fbc5e1075079dfd84372a5416d579da7d44c650abf935a1150a995bfce0e61966447b657f958e51c4ea45b72dc + checksum: f5baca55cb3c11bc08ec589f5f522d85c1ab509b4d11492437e45027d64ae0b22f0907bd1381e8d7f2a436384bb1f9ad89d19277314242c5c2671a0f91d0f9cd languageName: node linkType: hard @@ -1550,28 +1549,28 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:>=7, @babel/preset-env@npm:^7.12.1, @babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.15.0, @babel/preset-env@npm:^7.15.6, @babel/preset-env@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/preset-env@npm:7.18.6" +"@babel/preset-env@npm:^7.12.1, @babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.15.0, @babel/preset-env@npm:^7.15.6, @babel/preset-env@npm:^7.18.6, @babel/preset-env@npm:^7.20.2": + version: 7.20.2 + resolution: "@babel/preset-env@npm:7.20.2" dependencies: - "@babel/compat-data": ^7.18.6 - "@babel/helper-compilation-targets": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 + "@babel/compat-data": ^7.20.1 + "@babel/helper-compilation-targets": ^7.20.0 + "@babel/helper-plugin-utils": ^7.20.2 "@babel/helper-validator-option": ^7.18.6 "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.18.6 - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.18.6 - "@babel/plugin-proposal-async-generator-functions": ^7.18.6 + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.18.9 + "@babel/plugin-proposal-async-generator-functions": ^7.20.1 "@babel/plugin-proposal-class-properties": ^7.18.6 "@babel/plugin-proposal-class-static-block": ^7.18.6 "@babel/plugin-proposal-dynamic-import": ^7.18.6 - "@babel/plugin-proposal-export-namespace-from": ^7.18.6 + "@babel/plugin-proposal-export-namespace-from": ^7.18.9 "@babel/plugin-proposal-json-strings": ^7.18.6 - "@babel/plugin-proposal-logical-assignment-operators": ^7.18.6 + "@babel/plugin-proposal-logical-assignment-operators": ^7.18.9 "@babel/plugin-proposal-nullish-coalescing-operator": ^7.18.6 "@babel/plugin-proposal-numeric-separator": ^7.18.6 - "@babel/plugin-proposal-object-rest-spread": ^7.18.6 + "@babel/plugin-proposal-object-rest-spread": ^7.20.2 "@babel/plugin-proposal-optional-catch-binding": ^7.18.6 - "@babel/plugin-proposal-optional-chaining": ^7.18.6 + "@babel/plugin-proposal-optional-chaining": ^7.18.9 "@babel/plugin-proposal-private-methods": ^7.18.6 "@babel/plugin-proposal-private-property-in-object": ^7.18.6 "@babel/plugin-proposal-unicode-property-regex": ^7.18.6 @@ -1580,7 +1579,7 @@ __metadata: "@babel/plugin-syntax-class-static-block": ^7.14.5 "@babel/plugin-syntax-dynamic-import": ^7.8.3 "@babel/plugin-syntax-export-namespace-from": ^7.8.3 - "@babel/plugin-syntax-import-assertions": ^7.18.6 + "@babel/plugin-syntax-import-assertions": ^7.20.0 "@babel/plugin-syntax-json-strings": ^7.8.3 "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 @@ -1593,45 +1592,45 @@ __metadata: "@babel/plugin-transform-arrow-functions": ^7.18.6 "@babel/plugin-transform-async-to-generator": ^7.18.6 "@babel/plugin-transform-block-scoped-functions": ^7.18.6 - "@babel/plugin-transform-block-scoping": ^7.18.6 - "@babel/plugin-transform-classes": ^7.18.6 - "@babel/plugin-transform-computed-properties": ^7.18.6 - "@babel/plugin-transform-destructuring": ^7.18.6 + "@babel/plugin-transform-block-scoping": ^7.20.2 + "@babel/plugin-transform-classes": ^7.20.2 + "@babel/plugin-transform-computed-properties": ^7.18.9 + "@babel/plugin-transform-destructuring": ^7.20.2 "@babel/plugin-transform-dotall-regex": ^7.18.6 - "@babel/plugin-transform-duplicate-keys": ^7.18.6 + "@babel/plugin-transform-duplicate-keys": ^7.18.9 "@babel/plugin-transform-exponentiation-operator": ^7.18.6 - "@babel/plugin-transform-for-of": ^7.18.6 - "@babel/plugin-transform-function-name": ^7.18.6 - "@babel/plugin-transform-literals": ^7.18.6 + "@babel/plugin-transform-for-of": ^7.18.8 + "@babel/plugin-transform-function-name": ^7.18.9 + "@babel/plugin-transform-literals": ^7.18.9 "@babel/plugin-transform-member-expression-literals": ^7.18.6 - "@babel/plugin-transform-modules-amd": ^7.18.6 - "@babel/plugin-transform-modules-commonjs": ^7.18.6 - "@babel/plugin-transform-modules-systemjs": ^7.18.6 + "@babel/plugin-transform-modules-amd": ^7.19.6 + "@babel/plugin-transform-modules-commonjs": ^7.19.6 + "@babel/plugin-transform-modules-systemjs": ^7.19.6 "@babel/plugin-transform-modules-umd": ^7.18.6 - "@babel/plugin-transform-named-capturing-groups-regex": ^7.18.6 + "@babel/plugin-transform-named-capturing-groups-regex": ^7.19.1 "@babel/plugin-transform-new-target": ^7.18.6 "@babel/plugin-transform-object-super": ^7.18.6 - "@babel/plugin-transform-parameters": ^7.18.6 + "@babel/plugin-transform-parameters": ^7.20.1 "@babel/plugin-transform-property-literals": ^7.18.6 "@babel/plugin-transform-regenerator": ^7.18.6 "@babel/plugin-transform-reserved-words": ^7.18.6 "@babel/plugin-transform-shorthand-properties": ^7.18.6 - "@babel/plugin-transform-spread": ^7.18.6 + "@babel/plugin-transform-spread": ^7.19.0 "@babel/plugin-transform-sticky-regex": ^7.18.6 - "@babel/plugin-transform-template-literals": ^7.18.6 - "@babel/plugin-transform-typeof-symbol": ^7.18.6 - "@babel/plugin-transform-unicode-escapes": ^7.18.6 + "@babel/plugin-transform-template-literals": ^7.18.9 + "@babel/plugin-transform-typeof-symbol": ^7.18.9 + "@babel/plugin-transform-unicode-escapes": ^7.18.10 "@babel/plugin-transform-unicode-regex": ^7.18.6 "@babel/preset-modules": ^0.1.5 - "@babel/types": ^7.18.6 - babel-plugin-polyfill-corejs2: ^0.3.1 - babel-plugin-polyfill-corejs3: ^0.5.2 - babel-plugin-polyfill-regenerator: ^0.3.1 - core-js-compat: ^3.22.1 + "@babel/types": ^7.20.2 + babel-plugin-polyfill-corejs2: ^0.3.3 + babel-plugin-polyfill-corejs3: ^0.6.0 + babel-plugin-polyfill-regenerator: ^0.4.1 + core-js-compat: ^3.25.1 semver: ^6.3.0 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 0598ff98b69116e289174d89d976f27eff54d9d7f9f95a1feadf743c18021cd9785ddf2439de9af360f5625450816e4bc3b76ddd0c20ecc64e8802f943f07302 + checksum: ece2d7e9c7789db6116e962b8e1a55eb55c110c44c217f0c8f6ffea4ca234954e66557f7bd019b7affadf7fbb3a53ccc807e93fc935aacd48146234b73b6947e languageName: node linkType: hard @@ -1739,18 +1738,18 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:>=7, @babel/template@npm:^7.12.13, @babel/template@npm:^7.12.7, @babel/template@npm:^7.18.10, @babel/template@npm:^7.18.6, @babel/template@npm:^7.3.3": - version: 7.18.10 - resolution: "@babel/template@npm:7.18.10" +"@babel/template@npm:^7.12.7, @babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7, @babel/template@npm:^7.3.3": + version: 7.20.7 + resolution: "@babel/template@npm:7.20.7" dependencies: "@babel/code-frame": ^7.18.6 - "@babel/parser": ^7.18.10 - "@babel/types": ^7.18.10 - checksum: 93a6aa094af5f355a72bd55f67fa1828a046c70e46f01b1606e6118fa1802b6df535ca06be83cc5a5e834022be95c7b714f0a268b5f20af984465a71e28f1473 + "@babel/parser": ^7.20.7 + "@babel/types": ^7.20.7 + checksum: 2eb1a0ab8d415078776bceb3473d07ab746e6bb4c2f6ca46ee70efb284d75c4a32bb0cd6f4f4946dec9711f9c0780e8e5d64b743208deac6f8e9858afadc349e languageName: node linkType: hard -"@babel/traverse@npm:>=7, @babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.13, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.18.6, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.2": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.20.10, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.2": version: 7.20.13 resolution: "@babel/traverse@npm:7.20.13" dependencies: @@ -1768,7 +1767,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.6, @babel/types@npm:^7.12.7, @babel/types@npm:^7.15.6, @babel/types@npm:^7.18.10, @babel/types@npm:^7.18.6, @babel/types@npm:^7.19.0, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.7, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.6, @babel/types@npm:^7.12.7, @babel/types@npm:^7.15.6, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.5, @babel/types@npm:^7.20.7, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.20.7 resolution: "@babel/types@npm:7.20.7" dependencies: @@ -3386,79 +3385,131 @@ __metadata: languageName: node linkType: hard -"@linaria/babel-preset@npm:^3.0.0-beta.22, @linaria/babel-preset@npm:^3.0.0-beta.23": - version: 3.0.0-beta.23 - resolution: "@linaria/babel-preset@npm:3.0.0-beta.23" +"@linaria/babel-preset@npm:^4.4.0": + version: 4.4.0 + resolution: "@linaria/babel-preset@npm:4.4.0" dependencies: - "@babel/core": ^7.18.2 - "@babel/generator": ">=7" - "@babel/plugin-proposal-export-namespace-from": ">=7" - "@babel/plugin-syntax-dynamic-import": ">=7" - "@babel/plugin-transform-modules-commonjs": ^7.18.2 - "@babel/template": ">=7" - "@babel/traverse": ">=7" - "@linaria/core": ^3.0.0-beta.22 - "@linaria/logger": ^3.0.0-beta.20 - "@linaria/utils": ^3.0.0-beta.20 - cosmiconfig: ^5.1.0 + "@babel/core": ^7.20.2 + "@babel/generator": ^7.20.4 + "@babel/helper-module-imports": ^7.18.6 + "@babel/template": ^7.18.10 + "@babel/traverse": ^7.20.1 + "@babel/types": ^7.20.2 + "@linaria/core": ^4.2.6 + "@linaria/logger": ^4.0.0 + "@linaria/shaker": ^4.2.8 + "@linaria/tags": ^4.3.1 + "@linaria/utils": ^4.3.1 + cosmiconfig: ^8.0.0 find-up: ^5.0.0 source-map: ^0.7.3 stylis: ^3.5.4 - checksum: 5e1b7d077272ca93105631b0f9e1d78632769c63fd06d14994ae2b20519e470c2b7170cf50d8a32945e2298afb30f406284a6b46d8abf91b1d9772a55b761385 + checksum: 039b8bd07d78b4b4d850447a0537f3394348181c6c0d58d531fdc566ed847353a9998d18da979adc6681125ca403176f29a3c1d931cf0ad96749fbb92909e66e languageName: node linkType: hard -"@linaria/core@npm:^3.0.0-beta.22": - version: 3.0.0-beta.22 - resolution: "@linaria/core@npm:3.0.0-beta.22" +"@linaria/core@npm:^4.2.6": + version: 4.2.6 + resolution: "@linaria/core@npm:4.2.6" dependencies: - "@linaria/logger": ^3.0.0-beta.20 - "@linaria/utils": ^3.0.0-beta.20 - checksum: 67f57811c78821eb4866e3f307078e3c1cf375ca84f23b4a25cf7f4c34b48b76eaef70a4320436a51145a73b4d0fbac54db7459ab5a23049e7c347fee3644abb + "@linaria/logger": ^4.0.0 + "@linaria/tags": ^4.3.1 + "@linaria/utils": ^4.3.1 + checksum: 9d0c037840f8351f140aed13cdd1d477bd631b86f4d1d1a3b4dafffe4d1106c820bba2ddebd0281dd60ec58bff3ca9b423a09317f3cfe3ffea8a1782b2065be3 languageName: node linkType: hard -"@linaria/logger@npm:^3.0.0-beta.20": - version: 3.0.0-beta.20 - resolution: "@linaria/logger@npm:3.0.0-beta.20" +"@linaria/logger@npm:^4.0.0": + version: 4.0.0 + resolution: "@linaria/logger@npm:4.0.0" dependencies: debug: ^4.1.1 picocolors: ^1.0.0 - checksum: c5c1fbe593d9110fcbf7309517530fbda419c42c4258e0854f05619f917641724718919693a0a12eb50250bace9857435f29f4de8b056e1dc5f40c01eb074a7a + checksum: 261b955d5cb53a3eaf8b9c7890b761ba72bd16d6f81096659f31a75c84b4df3004d4a5598a2261b2d810828eb84e7e8067f38b58492544db42dc4ee56726f2d1 languageName: node linkType: hard -"@linaria/preeval@npm:^3.0.0-beta.22": - version: 3.0.0-beta.22 - resolution: "@linaria/preeval@npm:3.0.0-beta.22" +"@linaria/shaker@npm:^4.2.8": + version: 4.2.8 + resolution: "@linaria/shaker@npm:4.2.8" dependencies: - "@linaria/babel-preset": ^3.0.0-beta.22 - checksum: 3f1cf0c27cbcfd3ebd6e82346ee3ad00f146a8dd2e41b440a677707893e03a82937be5aee3f33fabba2c537b0639d1280cafa139558123548f1473eee08bb446 + "@babel/core": ^7.20.2 + "@babel/generator": ^7.20.4 + "@babel/plugin-transform-modules-commonjs": ^7.19.6 + "@babel/plugin-transform-runtime": ^7.19.6 + "@babel/plugin-transform-template-literals": ^7.18.9 + "@babel/preset-env": ^7.20.2 + "@linaria/logger": ^4.0.0 + "@linaria/utils": ^4.3.1 + babel-plugin-transform-react-remove-prop-types: ^0.4.24 + ts-invariant: ^0.10.3 + checksum: 1dab2aaf2676861b58ba655f9f72946b59bbace65a4177285ea34e6d4d0e95ac98fbb363e3e167d258e7b7dd26fa6996f92aa5533d2633e6ade81a6da66b4b4d languageName: node linkType: hard -"@linaria/shaker@npm:^3.0.0-beta.22": - version: 3.0.0-beta.22 - resolution: "@linaria/shaker@npm:3.0.0-beta.22" +"@linaria/tags@npm:^4.3.1": + version: 4.3.1 + resolution: "@linaria/tags@npm:4.3.1" dependencies: - "@babel/core": ^7.18.2 - "@babel/generator": ">=7" - "@babel/plugin-transform-runtime": ">=7" - "@babel/plugin-transform-template-literals": ">=7" - "@babel/preset-env": ">=7" - "@linaria/babel-preset": ^3.0.0-beta.22 - "@linaria/logger": ^3.0.0-beta.20 - "@linaria/preeval": ^3.0.0-beta.22 - babel-plugin-transform-react-remove-prop-types: ^0.4.24 - ts-invariant: ^0.10.3 - checksum: 4b9d3d5112f82317fddbe9369e3b96f5023a4c212aa220e51c32165fe33ba9487683a61263cacb6ad2e202c13e9f1bdba80f0264d3e0074a97a2bcb15af22e9b + "@babel/generator": ^7.20.4 + "@linaria/logger": ^4.0.0 + "@linaria/utils": ^4.3.1 + checksum: 03ce0a3292711cf9c075c15fd7666970c35952877fa7629caf40daa5af7faa2c09fb9fdc0be708d84034f734874bdfc6659189b37cca17119ed30d5dcdbc8221 + languageName: node + linkType: hard + +"@linaria/utils@npm:^4.3.1": + version: 4.3.1 + resolution: "@linaria/utils@npm:4.3.1" + dependencies: + "@babel/core": ^7.20.2 + "@babel/plugin-proposal-export-namespace-from": ^7.18.9 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-transform-modules-commonjs": ^7.19.6 + "@babel/traverse": ^7.20.1 + "@babel/types": ^7.20.2 + "@linaria/logger": ^4.0.0 + babel-merge: ^3.0.0 + checksum: e97ae4e97202eb51f0804f2dd042b720c496e23de675ec4e52cc05940093a7559a5bdc93ac9830e40134f43408d576780da31bfba96f39b0033cc5208c1b7fdd + languageName: node + linkType: hard + +"@linaria/webpack-loader@npm:^4.1.12": + version: 4.1.12 + resolution: "@linaria/webpack-loader@npm:4.1.12" + dependencies: + "@linaria/webpack4-loader": ^4.1.12 + "@linaria/webpack5-loader": ^4.1.12 + checksum: 9a61ef3ee68e8b1c852baf9ed734165cfaa013d15c0d12097a29d8f9ea5456cee1fd1e044170a567b9728ba558da7f95715e5f7917ae99d6b110e174c47c4e71 languageName: node linkType: hard -"@linaria/utils@npm:^3.0.0-beta.20": - version: 3.0.0-beta.20 - resolution: "@linaria/utils@npm:3.0.0-beta.20" - checksum: dbf2170bf89a06fd7158b979069ca0a445a56baeebe258109a2490d4709dacc5c4b1a3628cd179ba991478809907847e0460c0c32ac92f3d427f9056e2b8c152 +"@linaria/webpack4-loader@npm:^4.1.12": + version: 4.1.12 + resolution: "@linaria/webpack4-loader@npm:4.1.12" + dependencies: + "@linaria/babel-preset": ^4.4.0 + "@linaria/logger": ^4.0.0 + enhanced-resolve: ^4.1.0 + loader-utils: ^1.2.3 + mkdirp: ^0.5.1 + peerDependencies: + webpack: ">=4.0.0 <5.0.0" + checksum: 09781c05080c2c5ebc2f00481d197c1580b4981a86d3d0818b6e60957e9104de697b948bb518d0cda8751a72b5b72bf0ad3c807432ad01700c8c1cbc053826d8 + languageName: node + linkType: hard + +"@linaria/webpack5-loader@npm:^4.1.12": + version: 4.1.12 + resolution: "@linaria/webpack5-loader@npm:4.1.12" + dependencies: + "@linaria/babel-preset": ^4.4.0 + "@linaria/logger": ^4.0.0 + enhanced-resolve: ^5.3.1 + mkdirp: ^0.5.1 + peerDependencies: + webpack: ^5.0.0 + checksum: 3d15621ed34d613d757cd61c715886148592cadb4f055b046e7b9e78fb44359607838f278bf76147d6a870c82553f433970e83c0c09982934f3740dd2ae29c4f languageName: node linkType: hard @@ -9144,6 +9195,18 @@ __metadata: languageName: node linkType: hard +"babel-merge@npm:^3.0.0": + version: 3.0.0 + resolution: "babel-merge@npm:3.0.0" + dependencies: + deepmerge: ^2.2.1 + object.omit: ^3.0.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 8613efb6edcacaac628f9f86056bb110bc4f78dcc35c38787aaa4b8cfe92481ebedf56d558a1e74fcb8cdb4242d0bea2c1ab00e150e243548934157d0c9db06b + languageName: node + linkType: hard + "babel-plugin-add-react-displayname@npm:^0.0.5": version: 0.0.5 resolution: "babel-plugin-add-react-displayname@npm:0.0.5" @@ -9277,16 +9340,16 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs2@npm:^0.3.1": - version: 0.3.1 - resolution: "babel-plugin-polyfill-corejs2@npm:0.3.1" +"babel-plugin-polyfill-corejs2@npm:^0.3.3": + version: 0.3.3 + resolution: "babel-plugin-polyfill-corejs2@npm:0.3.3" dependencies: - "@babel/compat-data": ^7.13.11 - "@babel/helper-define-polyfill-provider": ^0.3.1 + "@babel/compat-data": ^7.17.7 + "@babel/helper-define-polyfill-provider": ^0.3.3 semver: ^6.1.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: ca873f14ccd6d2942013345a956de8165d0913556ec29756a748157140f5312f79eed487674e0ca562285880f05829b3712d72e1e4b412c2ce46bd6a50b4b975 + checksum: 7db3044993f3dddb3cc3d407bc82e640964a3bfe22de05d90e1f8f7a5cb71460011ab136d3c03c6c1ba428359ebf635688cd6205e28d0469bba221985f5c6179 languageName: node linkType: hard @@ -9302,26 +9365,26 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs3@npm:^0.5.2": - version: 0.5.2 - resolution: "babel-plugin-polyfill-corejs3@npm:0.5.2" +"babel-plugin-polyfill-corejs3@npm:^0.6.0": + version: 0.6.0 + resolution: "babel-plugin-polyfill-corejs3@npm:0.6.0" dependencies: - "@babel/helper-define-polyfill-provider": ^0.3.1 - core-js-compat: ^3.21.0 + "@babel/helper-define-polyfill-provider": ^0.3.3 + core-js-compat: ^3.25.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 2f3184c73f80f00ac876a5ebcad945fd8d2ae70e5f85b7ab6cc3bc69bc74025f4f7070de7abbb2a7274c78e130bd34fc13f4c85342da28205930364a1ef0aa21 + checksum: 470bb8c59f7c0912bd77fe1b5a2e72f349b3f65bbdee1d60d6eb7e1f4a085c6f24b2dd5ab4ac6c2df6444a96b070ef6790eccc9edb6a2668c60d33133bfb62c6 languageName: node linkType: hard -"babel-plugin-polyfill-regenerator@npm:^0.3.1": - version: 0.3.1 - resolution: "babel-plugin-polyfill-regenerator@npm:0.3.1" +"babel-plugin-polyfill-regenerator@npm:^0.4.1": + version: 0.4.1 + resolution: "babel-plugin-polyfill-regenerator@npm:0.4.1" dependencies: - "@babel/helper-define-polyfill-provider": ^0.3.1 + "@babel/helper-define-polyfill-provider": ^0.3.3 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: f1473df7b700d6795ca41301b1e65a0aff15ce6c1463fc0ce2cf0c821114b0330920f59d4cebf52976363ee817ba29ad2758544a4661a724b08191080b9fe1da + checksum: ab0355efbad17d29492503230387679dfb780b63b25408990d2e4cf421012dae61d6199ddc309f4d2409ce4e9d3002d187702700dd8f4f8770ebbba651ed066c languageName: node linkType: hard @@ -9843,17 +9906,17 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.0.0, browserslist@npm:^4.12.0, browserslist@npm:^4.14.5, browserslist@npm:^4.16.6, browserslist@npm:^4.18.1, browserslist@npm:^4.19.1, browserslist@npm:^4.20.3, browserslist@npm:^4.21.2, browserslist@npm:^4.21.3": - version: 4.21.4 - resolution: "browserslist@npm:4.21.4" +"browserslist@npm:^4.0.0, browserslist@npm:^4.12.0, browserslist@npm:^4.14.5, browserslist@npm:^4.16.6, browserslist@npm:^4.18.1, browserslist@npm:^4.19.1, browserslist@npm:^4.20.3, browserslist@npm:^4.21.3, browserslist@npm:^4.21.4": + version: 4.21.5 + resolution: "browserslist@npm:4.21.5" dependencies: - caniuse-lite: ^1.0.30001400 - electron-to-chromium: ^1.4.251 - node-releases: ^2.0.6 - update-browserslist-db: ^1.0.9 + caniuse-lite: ^1.0.30001449 + electron-to-chromium: ^1.4.284 + node-releases: ^2.0.8 + update-browserslist-db: ^1.0.10 bin: browserslist: cli.js - checksum: 4af3793704dbb4615bcd29059ab472344dc7961c8680aa6c4bb84f05340e14038d06a5aead58724eae69455b8fade8b8c69f1638016e87e5578969d74c078b79 + checksum: 9755986b22e73a6a1497fd8797aedd88e04270be33ce66ed5d85a1c8a798292a65e222b0f251bafa1c2522261e237d73b08b58689d4920a607e5a53d56dc4706 languageName: node linkType: hard @@ -10065,31 +10128,6 @@ __metadata: languageName: node linkType: hard -"caller-callsite@npm:^2.0.0": - version: 2.0.0 - resolution: "caller-callsite@npm:2.0.0" - dependencies: - callsites: ^2.0.0 - checksum: b685e9d126d9247b320cfdfeb3bc8da0c4be28d8fb98c471a96bc51aab3130099898a2fe3bf0308f0fe048d64c37d6d09f563958b9afce1a1e5e63d879c128a2 - languageName: node - linkType: hard - -"caller-path@npm:^2.0.0": - version: 2.0.0 - resolution: "caller-path@npm:2.0.0" - dependencies: - caller-callsite: ^2.0.0 - checksum: 3e12ccd0c71ec10a057aac69e3ec175b721ca858c640df021ef0d25999e22f7c1d864934b596b7d47038e9b56b7ec315add042abbd15caac882998b50102fb12 - languageName: node - linkType: hard - -"callsites@npm:^2.0.0": - version: 2.0.0 - resolution: "callsites@npm:2.0.0" - checksum: be2f67b247df913732b7dec1ec0bbfcdbaea263e5a95968b19ec7965affae9496b970e3024317e6d4baa8e28dc6ba0cec03f46fdddc2fdcc51396600e53c2623 - languageName: node - linkType: hard - "callsites@npm:^3.0.0": version: 3.1.0 resolution: "callsites@npm:3.1.0" @@ -10147,10 +10185,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001251, caniuse-lite@npm:^1.0.30001332, caniuse-lite@npm:^1.0.30001335, caniuse-lite@npm:^1.0.30001400": - version: 1.0.30001434 - resolution: "caniuse-lite@npm:1.0.30001434" - checksum: 7c9d2641e8e8f3ddf9af14c4ce47266a9d8fd1fc0243626049ff1b2eca4bf02938ff440813cc3feae3fa8d851ec8d1b9718044340c8d09bb4372d92d4f6b519c +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001251, caniuse-lite@npm:^1.0.30001332, caniuse-lite@npm:^1.0.30001335, caniuse-lite@npm:^1.0.30001449": + version: 1.0.30001450 + resolution: "caniuse-lite@npm:1.0.30001450" + checksum: 511b360bfc907b2e437699364cf96b83507bc45043926450056642332bcd6f65a1e72540c828534ae15e0ac906e3e9af46cb2bb84458dd580bc31478e9dce282 languageName: node linkType: hard @@ -11002,13 +11040,12 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.21.0, core-js-compat@npm:^3.22.1, core-js-compat@npm:^3.8.1": - version: 3.23.5 - resolution: "core-js-compat@npm:3.23.5" +"core-js-compat@npm:^3.25.1, core-js-compat@npm:^3.8.1": + version: 3.27.2 + resolution: "core-js-compat@npm:3.27.2" dependencies: - browserslist: ^4.21.2 - semver: 7.0.0 - checksum: c2398a39239a782ba1b9531a80b25f8d9fb8d98de8bf980f32140e9be3d2852afb797517afdf3a15f9319bcd25d594b3d3d2a500dce7c338532532565c9e83cb + browserslist: ^4.21.4 + checksum: 4574d4507de8cba9a75e37401b3ca6e5908ab066ec717e3b34866d25f623e1aa614fb886e10973be64a6250f325dcba6809e4fae4ed43375cc3e4276c5514c13 languageName: node linkType: hard @@ -11053,18 +11090,6 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^5.1.0": - version: 5.2.1 - resolution: "cosmiconfig@npm:5.2.1" - dependencies: - import-fresh: ^2.0.0 - is-directory: ^0.3.1 - js-yaml: ^3.13.1 - parse-json: ^4.0.0 - checksum: 8b6f1d3c8a5ffdf663a952f17af0761adf210b7a5933d0fe8988f3ca3a1f0e1e5cbbb74d5b419c15933dd2fdcaec31dbc5cc85cb8259a822342b93b529eff89c - languageName: node - linkType: hard - "cosmiconfig@npm:^6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -11078,6 +11103,18 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:^8.0.0": + version: 8.0.0 + resolution: "cosmiconfig@npm:8.0.0" + dependencies: + import-fresh: ^3.2.1 + js-yaml: ^4.1.0 + parse-json: ^5.0.0 + path-type: ^4.0.0 + checksum: ff4cdf89ac1ae52e7520816622c21a9e04380d04b82d653f5139ec581aa4f7f29e096d46770bc76c4a63c225367e88a1dfa233ea791669a35101f5f9b972c7d1 + languageName: node + linkType: hard + "cp-file@npm:^7.0.0": version: 7.0.0 resolution: "cp-file@npm:7.0.0" @@ -12406,6 +12443,13 @@ __metadata: languageName: node linkType: hard +"deepmerge@npm:^2.2.1": + version: 2.2.1 + resolution: "deepmerge@npm:2.2.1" + checksum: 284b71065079e66096229f735a9a0222463c9ca9ee9dda7d5e9a0545bf254906dbc7377e3499ca3b2212073672b1a430d80587993b43b87d8de17edc6af649a8 + languageName: node + linkType: hard + "deepmerge@npm:^4.2.2": version: 4.2.2 resolution: "deepmerge@npm:4.2.2" @@ -12970,10 +13014,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.4.251": - version: 1.4.284 - resolution: "electron-to-chromium@npm:1.4.284" - checksum: be496e9dca6509dbdbb54dc32146fc99f8eb716d28a7ee8ccd3eba0066561df36fc51418d8bd7cf5a5891810bf56c0def3418e74248f51ea4a843d423603d10a +"electron-to-chromium@npm:^1.4.284": + version: 1.4.286 + resolution: "electron-to-chromium@npm:1.4.286" + checksum: 6b53e2aea63892cb4af85ea4ee5ed2b6d848713519987efcf4c1177a32e2fe6d04a7f591f5bcd1feab0b3c88890c6eaf65b6feb16c0e0319bf07e31de31930af languageName: node linkType: hard @@ -13100,7 +13144,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^4.5.0": +"enhanced-resolve@npm:^4.1.0, enhanced-resolve@npm:^4.5.0": version: 4.5.0 resolution: "enhanced-resolve@npm:4.5.0" dependencies: @@ -13111,7 +13155,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.7.0, enhanced-resolve@npm:^5.8.2, enhanced-resolve@npm:^5.8.3": +"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.3.1, enhanced-resolve@npm:^5.7.0, enhanced-resolve@npm:^5.8.3": version: 5.12.0 resolution: "enhanced-resolve@npm:5.12.0" dependencies: @@ -15481,8 +15525,6 @@ __metadata: "@babel/helper-module-imports": ^7.12.13 "@babel/helper-plugin-utils": ^7.12.13 "@babel/preset-typescript": 7.12.13 - "@babel/template": ^7.12.13 - "@babel/traverse": ^7.12.13 "@codesandbox/sandpack-react": 1.18.4 "@codesandbox/sandpack-themes": 1.17.0 "@docusaurus/core": 2.1.0 @@ -15490,8 +15532,11 @@ __metadata: "@docusaurus/preset-classic": 2.1.0 "@emotion/css": ^11.9.0 "@emotion/hash": ^0.8.0 - "@linaria/babel-preset": ^3.0.0-beta.23 - "@linaria/shaker": ^3.0.0-beta.22 + "@linaria/babel-preset": ^4.4.0 + "@linaria/shaker": ^4.2.8 + "@linaria/tags": ^4.3.1 + "@linaria/utils": ^4.3.1 + "@linaria/webpack-loader": ^4.1.12 "@nrwl/cli": 13.10.6 "@nrwl/eslint-plugin-nx": 13.10.6 "@nrwl/jest": 13.10.6 @@ -15546,7 +15591,6 @@ __metadata: csstype: ^3.0.10 d3-scale-chromatic: ^3.0.0 doctoc: 2.2.1 - enhanced-resolve: ^5.8.2 esbuild: ^0.14.43 esbuild-plugin-alias: ^0.2.1 esbuild-plugin-import-glob: ^0.1.1 @@ -16375,16 +16419,6 @@ __metadata: languageName: node linkType: hard -"import-fresh@npm:^2.0.0": - version: 2.0.0 - resolution: "import-fresh@npm:2.0.0" - dependencies: - caller-path: ^2.0.0 - resolve-from: ^3.0.0 - checksum: 610255f9753cc6775df00be08e9f43691aa39f7703e3636c45afe22346b8b545e600ccfe100c554607546fc8e861fa149a0d1da078c8adedeea30fff326eef79 - languageName: node - linkType: hard - "import-fresh@npm:^3.0.0, import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" @@ -16790,13 +16824,6 @@ __metadata: languageName: node linkType: hard -"is-directory@npm:^0.3.1": - version: 0.3.1 - resolution: "is-directory@npm:0.3.1" - checksum: dce9a9d3981e38f2ded2a80848734824c50ee8680cd09aa477bef617949715cfc987197a2ca0176c58a9fb192a1a0d69b535c397140d241996a609d5906ae524 - languageName: node - linkType: hard - "is-docker@npm:^2.0.0, is-docker@npm:^2.1.1": version: 2.2.1 resolution: "is-docker@npm:2.2.1" @@ -16823,7 +16850,7 @@ __metadata: languageName: node linkType: hard -"is-extendable@npm:^1.0.1": +"is-extendable@npm:^1.0.0, is-extendable@npm:^1.0.1": version: 1.0.1 resolution: "is-extendable@npm:1.0.1" dependencies: @@ -18156,7 +18183,7 @@ __metadata: languageName: node linkType: hard -"json-parse-better-errors@npm:^1.0.1, json-parse-better-errors@npm:^1.0.2": +"json-parse-better-errors@npm:^1.0.2": version: 1.0.2 resolution: "json-parse-better-errors@npm:1.0.2" checksum: ff2b5ba2a70e88fd97a3cb28c1840144c5ce8fae9cbeeddba15afa333a5c407cf0e42300cd0a2885dbb055227fe68d405070faad941beeffbfde9cf3b2c78c5d @@ -20064,10 +20091,10 @@ __metadata: languageName: node linkType: hard -"node-releases@npm:^2.0.6": - version: 2.0.6 - resolution: "node-releases@npm:2.0.6" - checksum: e86a926dc9fbb3b41b4c4a89d998afdf140e20a4e8dbe6c0a807f7b2948b42ea97d7fd3ad4868041487b6e9ee98409829c6e4d84a734a4215dff060a7fbeb4bf +"node-releases@npm:^2.0.8": + version: 2.0.10 + resolution: "node-releases@npm:2.0.10" + checksum: d784ecde25696a15d449c4433077f5cce620ed30a1656c4abf31282bfc691a70d9618bae6868d247a67914d1be5cc4fde22f65a05f4398cdfb92e0fc83cadfbc languageName: node linkType: hard @@ -20368,6 +20395,15 @@ __metadata: languageName: node linkType: hard +"object.omit@npm:^3.0.0": + version: 3.0.0 + resolution: "object.omit@npm:3.0.0" + dependencies: + is-extendable: ^1.0.0 + checksum: 7444bcbd5e240bb933956b02450e61fe3c64670f6a99dd4b9fc26f4261afd629dd4f707770b2e8c399688358f90886d9ce9c31700486f58f1635aaf233d32931 + languageName: node + linkType: hard + "object.pick@npm:^1.3.0": version: 1.3.0 resolution: "object.pick@npm:1.3.0" @@ -20765,16 +20801,6 @@ __metadata: languageName: node linkType: hard -"parse-json@npm:^4.0.0": - version: 4.0.0 - resolution: "parse-json@npm:4.0.0" - dependencies: - error-ex: ^1.3.1 - json-parse-better-errors: ^1.0.1 - checksum: 0fe227d410a61090c247e34fa210552b834613c006c2c64d9a05cfe9e89cf8b4246d1246b1a99524b53b313e9ac024438d0680f67e33eaed7e6f38db64cfe7b5 - languageName: node - linkType: hard - "parse-json@npm:^5.0.0": version: 5.2.0 resolution: "parse-json@npm:5.2.0" @@ -22842,12 +22868,12 @@ __metadata: languageName: node linkType: hard -"regenerate-unicode-properties@npm:^10.0.1": - version: 10.0.1 - resolution: "regenerate-unicode-properties@npm:10.0.1" +"regenerate-unicode-properties@npm:^10.1.0": + version: 10.1.0 + resolution: "regenerate-unicode-properties@npm:10.1.0" dependencies: regenerate: ^1.4.2 - checksum: 1b638b7087d8143e5be3e20e2cda197ea0440fa0bc2cc49646b2f50c5a2b1acdc54b21e4215805a5a2dd487c686b2291accd5ad00619534098d2667e76247754 + checksum: b1a8929588433ab8b9dc1a34cf3665b3b472f79f2af6ceae00d905fc496b332b9af09c6718fb28c730918f19a00dc1d7310adbaa9b72a2ec7ad2f435da8ace17 languageName: node linkType: hard @@ -22901,17 +22927,17 @@ __metadata: languageName: node linkType: hard -"regexpu-core@npm:^5.1.0": - version: 5.1.0 - resolution: "regexpu-core@npm:5.1.0" +"regexpu-core@npm:^5.2.1": + version: 5.2.2 + resolution: "regexpu-core@npm:5.2.2" dependencies: regenerate: ^1.4.2 - regenerate-unicode-properties: ^10.0.1 - regjsgen: ^0.6.0 - regjsparser: ^0.8.2 + regenerate-unicode-properties: ^10.1.0 + regjsgen: ^0.7.1 + regjsparser: ^0.9.1 unicode-match-property-ecmascript: ^2.0.0 - unicode-match-property-value-ecmascript: ^2.0.0 - checksum: 7b4eb8d182d9d10537a220a93138df5bc7eaf4ed53e36b95e8427d33ed8a2b081468f1a15d3e5fcee66517e1df7f5ca180b999e046d060badd97150f2ffe87b2 + unicode-match-property-value-ecmascript: ^2.1.0 + checksum: 87c56815e20d213848d38f6b047ba52f0d632f36e791b777f59327e8d350c0743b27cc25feab64c0eadc9fe9959dde6b1261af71108a9371b72c8c26beda05ef languageName: node linkType: hard @@ -22933,21 +22959,21 @@ __metadata: languageName: node linkType: hard -"regjsgen@npm:^0.6.0": - version: 0.6.0 - resolution: "regjsgen@npm:0.6.0" - checksum: c5158ebd735e75074e41292ade1ff05d85566d205426cc61501e360c450a63baced8512ee3ae238e5c0a0e42969563c7875b08fa69d6f0402daf36bcb3e4d348 +"regjsgen@npm:^0.7.1": + version: 0.7.1 + resolution: "regjsgen@npm:0.7.1" + checksum: 7cac399921c58db8e16454869283ff66871531180218064fa938ac05c11c2976792a00706c3c78bbc625e1d793ca373065ea90564e06189a751a7b4ae33acadc languageName: node linkType: hard -"regjsparser@npm:^0.8.2": - version: 0.8.4 - resolution: "regjsparser@npm:0.8.4" +"regjsparser@npm:^0.9.1": + version: 0.9.1 + resolution: "regjsparser@npm:0.9.1" dependencies: jsesc: ~0.5.0 bin: regjsparser: bin/parser - checksum: d069b932491761cda127ce11f6bd2729c3b1b394a35200ec33f1199e937423db28ceb86cf33f0a97c76ecd7c0f8db996476579eaf0d80a1f74c1934f4ca8b27a + checksum: 5e1b76afe8f1d03c3beaf9e0d935dd467589c3625f6d65fb8ffa14f224d783a0fed4bf49c2c1b8211043ef92b6117313419edf055a098ed8342e340586741afc languageName: node linkType: hard @@ -23172,13 +23198,6 @@ __metadata: languageName: node linkType: hard -"resolve-from@npm:^3.0.0": - version: 3.0.0 - resolution: "resolve-from@npm:3.0.0" - checksum: fff9819254d2d62b57f74e5c2ca9c0bdd425ca47287c4d801bc15f947533148d858229ded7793b0f59e61e49e782fffd6722048add12996e1bd4333c29669062 - languageName: node - linkType: hard - "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0" @@ -23780,15 +23799,6 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.0.0": - version: 7.0.0 - resolution: "semver@npm:7.0.0" - bin: - semver: bin/semver.js - checksum: 272c11bf8d083274ef79fe40a81c55c184dff84dd58e3c325299d0927ba48cece1f020793d138382b85f89bab5002a35a5ba59a3a68a7eebbb597eb733838778 - languageName: node - linkType: hard - "semver@npm:7.3.4": version: 7.3.4 resolution: "semver@npm:7.3.4" @@ -25849,10 +25859,10 @@ __metadata: languageName: node linkType: hard -"unicode-match-property-value-ecmascript@npm:^2.0.0": - version: 2.0.0 - resolution: "unicode-match-property-value-ecmascript@npm:2.0.0" - checksum: 8fe6a09d9085a625cabcead5d95bdbc1a2d5d481712856092ce0347231e81a60b93a68f1b69e82b3076a07e415a72c708044efa2aa40ae23e2e7b5c99ed4a9ea +"unicode-match-property-value-ecmascript@npm:^2.1.0": + version: 2.1.0 + resolution: "unicode-match-property-value-ecmascript@npm:2.1.0" + checksum: 8d6f5f586b9ce1ed0e84a37df6b42fdba1317a05b5df0c249962bd5da89528771e2d149837cad11aa26bcb84c35355cb9f58a10c3d41fa3b899181ece6c85220 languageName: node linkType: hard @@ -26073,7 +26083,7 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.0.9": +"update-browserslist-db@npm:^1.0.10": version: 1.0.10 resolution: "update-browserslist-db@npm:1.0.10" dependencies: