From da9cbc584ff9c95abb22f5140b04d55f8e49f643 Mon Sep 17 00:00:00 2001 From: Kelly Harrop Date: Wed, 26 Jun 2024 22:47:26 -0500 Subject: [PATCH 1/5] initial v8 dependency updates --- .circleci/config.yml | 2 +- package.json | 7 +++++-- src/index.ts | 27 ++++++++++++++++++++------- yarn.lock | 26 +++++++++++++++++++++++++- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d71505f..a7d45ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 defaults: &defaults working_directory: ~/postcss-themed docker: - - image: circleci/node:10-browsers + - image: circleci/node:12-browsers environment: TZ: '/usr/share/zoneinfo/America/Los_Angeles' diff --git a/package.json b/package.json index 4916941..c13636c 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,11 @@ "dset": "^3.1.0", "flat": "^5.0.2", "loader-utils": "^1.2.3", - "postcss": "^7.0.14", "ts-node": "^8.0.3" }, + "peerDependencies": { + "postcss": "^8.0.0" + }, "devDependencies": { "@auto-it/all-contributors": "^7.2.2", "@babel/core": "^7.6.2", @@ -75,6 +77,7 @@ "husky": "^1.3.1", "jest": "^24.7.1", "lint-staged": "^8.1.5", + "postcss": "^8.0.0", "postcss-nested": "^4.1.2", "prettier": "^2.2.1", "tapable": "^1.1.3", @@ -133,7 +136,7 @@ ] }, "engines": { - "node": ">=7.5.0" + "node": ">=12.0.0" }, "auto": { "plugins": [ diff --git a/src/index.ts b/src/index.ts index 5f5041a..cd6378a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,13 +64,16 @@ export const configForComponent = ( }; /** Generate a theme */ -const themeFile = (options: PostcssThemeOptions = {}) => ( +const themeFile = (options: PostcssThemeOptions = {}) => async ( root: postcss.Root, result: postcss.Result ) => { // Postcss-modules runs twice and we only ever want to process the CSS once - // @ts-ignore - if (root.source.processed) { + if ( + root.source?.input.from.endsWith('.module.css') && + // @ts-ignore + root.source.input.css.trim() === '' + ) { return; } @@ -93,13 +96,13 @@ const themeFile = (options: PostcssThemeOptions = {}) => ( resolveThemeExtension(mergedConfig); if (caniuse.isSupported('css-variables', browserslist())) { - modernTheme(root, mergedConfig, options); + await modernTheme(root, mergedConfig, options); } else { - legacyTheme(root, mergedConfig, options); + await legacyTheme(root, mergedConfig, options); } // @ts-ignore - root.source.processed = true; + root.source.input.css = result.css; if (!resolveTheme && root.source.input.file) { const themeFilename = getThemeFilename(root.source.input.file); @@ -114,5 +117,15 @@ const themeFile = (options: PostcssThemeOptions = {}) => ( } }; +export const postcssThemed = (options: PostcssThemeOptions = {}) => { + return { + postcssPlugin: 'postcss-themed', + Once(root: postcss.Root, { result }: { result: postcss.Result }) { + return themeFile(options)(root, result); + }, + }; +}; + +postcssThemed.postcss = true; + export * from './types'; -export default postcss.plugin('postcss-themed', themeFile); diff --git a/yarn.lock b/yarn.lock index 816c593..160986f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4818,6 +4818,11 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -5339,6 +5344,11 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= +picocolors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + picomatch@^2.0.4: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" @@ -5434,7 +5444,7 @@ postcss-selector-parser@^6.0.2: indexes-of "^1.0.1" uniq "^1.0.1" -postcss@7.x.x, postcss@^7.0.14, postcss@^7.0.21: +postcss@7.x.x, postcss@^7.0.21: version "7.0.21" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17" integrity sha512-uIFtJElxJo29QC753JzhidoAhvp/e/Exezkdhfmt8AymWT6/5B7W1WmponYWkHk2eg6sONyTch0A3nkMPun3SQ== @@ -5443,6 +5453,15 @@ postcss@7.x.x, postcss@^7.0.14, postcss@^7.0.21: source-map "^0.6.1" supports-color "^6.1.0" +postcss@^8.0.0: + version "8.4.38" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" + integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.0" + source-map-js "^1.2.0" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -6067,6 +6086,11 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" +source-map-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" + integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== + source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" From 7c7532a393d4db406d9048dbaeef4c01a562ca43 Mon Sep 17 00:00:00 2001 From: Kelly Harrop Date: Thu, 27 Jun 2024 15:08:00 -0500 Subject: [PATCH 2/5] updating tests to work with new postcss8 api --- .babelrc | 7 +- __tests__/legacy.test.ts | 16 +- __tests__/test-utils.ts | 22 ++- package.json | 3 + src/index.ts | 8 +- src/modern/index.ts | 1 + yarn.lock | 368 ++++++++++++++++++++++++++++++++++++++- 7 files changed, 401 insertions(+), 24 deletions(-) diff --git a/.babelrc b/.babelrc index 23e2548..c9f19dc 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,8 @@ { "presets": ["@babel/preset-typescript", "@babel/preset-env"], - "plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"] + "plugins": [ + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-transform-runtime" + ] } - diff --git a/__tests__/legacy.test.ts b/__tests__/legacy.test.ts index e7e1695..08d839b 100644 --- a/__tests__/legacy.test.ts +++ b/__tests__/legacy.test.ts @@ -1,6 +1,6 @@ import postcss from 'postcss'; -import plugin from '../src/index'; +import { postcssThemed } from '../src/index'; import { run } from './test-utils'; it('Creates theme override', () => { @@ -393,7 +393,7 @@ it('multiple values in one declaration', () => { }); it('Requires a config', () => { - return postcss([plugin()]) + return postcss([postcssThemed()]) .process('', { from: undefined }) .catch((e) => { expect(e).toEqual(new Error('No config provided to postcss-themed')); @@ -415,7 +415,7 @@ it('Finds missing keys', () => { }, }; - return postcss([plugin({ config })]) + return postcss([postcssThemed({ config })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain("Theme 'dark' does not contain key 'color'"); @@ -438,7 +438,7 @@ it('Finds missing default', () => { }; // @ts-ignore - return postcss([plugin({ config })]) + return postcss([postcssThemed({ config })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain( @@ -577,7 +577,7 @@ it('non-existent default theme', () => { `; // @ts-ignore - return postcss([plugin({ config, defaultTheme: 'otherDefaultTheme' })]) + return postcss([postcssThemed({ config, defaultTheme: 'otherDefaultTheme' })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain( @@ -733,7 +733,11 @@ it('overrides themes to single theme', () => { `; return postcss([ - plugin({ config, defaultTheme: 'quickBooks', forceSingleTheme: 'true' }), + postcssThemed({ + config, + defaultTheme: 'quickBooks', + forceSingleTheme: 'true', + }), ]) .process(input, { from: undefined }) .catch((e) => { diff --git a/__tests__/test-utils.ts b/__tests__/test-utils.ts index 6ff6930..a82f119 100644 --- a/__tests__/test-utils.ts +++ b/__tests__/test-utils.ts @@ -1,7 +1,7 @@ -import postcss from 'postcss'; +import postcss, { AcceptedPlugin } from 'postcss'; import nested from 'postcss-nested'; -import plugin from '../src/index'; +import { postcssThemed } from '../src/index'; import { PostcssThemeOptions } from '../src/types'; export function normalizeResult(input: string) { @@ -11,16 +11,20 @@ export function normalizeResult(input: string) { .join(''); } -export function run( +export async function run( input: string, output: string, opts: PostcssThemeOptions, inputPath?: string ) { - return postcss([nested, plugin(opts)]) - .process(input, { from: inputPath }) - .then((result) => { - expect(normalizeResult(result.css)).toEqual(normalizeResult(output)); - expect(result.warnings()).toHaveLength(0); - }); + // Create a PostCSS instance using the postcssThemed plugin with the provided options + const processor = postcss([ + nested as AcceptedPlugin, + postcssThemed(opts), // Use the updated postcssThemed export + ]); + + // Process the input CSS + const result = await processor.process(input, { from: inputPath }); + expect(normalizeResult(result.css)).toEqual(normalizeResult(output)); + expect(result.warnings()).toHaveLength(0); } diff --git a/package.json b/package.json index c13636c..06fa0e5 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ }, "homepage": "https://github.com/intuit/postcss-themed", "dependencies": { + "@babel/runtime": "^7.24.7", "browserslist": "^4.7.0", "caniuse-api": "^3.0.0", "cssesc": "^3.0.0", @@ -41,6 +42,8 @@ "@auto-it/all-contributors": "^7.2.2", "@babel/core": "^7.6.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", + "@babel/plugin-proposal-optional-chaining": "^7.21.0", + "@babel/plugin-transform-runtime": "^7.24.7", "@babel/preset-env": "^7.4.3", "@babel/preset-typescript": "^7.7.7", "@logux/eslint-config": "^34.0.0", diff --git a/src/index.ts b/src/index.ts index cd6378a..461b699 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import postcss from 'postcss'; +import { Root, Result } from 'postcss'; import fs from 'fs'; import debug from 'debug'; import merge from 'deepmerge'; @@ -65,8 +65,8 @@ export const configForComponent = ( /** Generate a theme */ const themeFile = (options: PostcssThemeOptions = {}) => async ( - root: postcss.Root, - result: postcss.Result + root: Root, + result: Result ) => { // Postcss-modules runs twice and we only ever want to process the CSS once if ( @@ -120,7 +120,7 @@ const themeFile = (options: PostcssThemeOptions = {}) => async ( export const postcssThemed = (options: PostcssThemeOptions = {}) => { return { postcssPlugin: 'postcss-themed', - Once(root: postcss.Root, { result }: { result: postcss.Result }) { + Once(root: Root, { result }: { result: Result }) { return themeFile(options)(root, result); }, }; diff --git a/src/modern/index.ts b/src/modern/index.ts index e924940..4998944 100644 --- a/src/modern/index.ts +++ b/src/modern/index.ts @@ -28,6 +28,7 @@ const createModernTheme = ( transform: (value: string) => string ) => { const rule = postcss.rule({ selector }); + // @ts-ignore const decls = Object.entries(flat(theme)).map(([prop, value]) => postcss.decl({ prop: `--${transform(prop)}`, diff --git a/yarn.lock b/yarn.lock index 160986f..5624564 100644 --- a/yarn.lock +++ b/yarn.lock @@ -104,6 +104,14 @@ dependencies: "@babel/highlight" "^7.0.0" +"@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== + dependencies: + "@babel/highlight" "^7.24.7" + picocolors "^1.0.0" + "@babel/code-frame@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.0.tgz#8c98d4ac29d6f80f28127b1bc50970a72086c5ac" @@ -111,6 +119,11 @@ dependencies: "@babel/highlight" "^7.8.0" +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.7.tgz#d23bbea508c3883ba8251fb4164982c36ea577ed" + integrity sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw== + "@babel/core@^7.1.0", "@babel/core@^7.6.2": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.2.tgz#ea5b99693bcfc058116f42fa1dd54da412b29d91" @@ -131,6 +144,16 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/generator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.7.tgz#1654d01de20ad66b4b4d99c135471bc654c55e6d" + integrity sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA== + dependencies: + "@babel/types" "^7.24.7" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^2.5.1" + "@babel/generator@^7.4.0", "@babel/generator@^7.7.2": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.2.tgz#2f4852d04131a5e17ea4f6645488b5da66ebf3af" @@ -175,6 +198,17 @@ "@babel/traverse" "^7.7.0" "@babel/types" "^7.7.0" +"@babel/helper-compilation-targets@^7.22.6": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.7.tgz#4eb6c4a80d6ffeac25ab8cd9a21b5dfa48d503a9" + integrity sha512-ctSdRHBi20qWOfy27RUb4Fhp07KSJ3sXcuSvTrXrc4aG8NSYDo1ici3Vhg9bg69y5bj0Mr1lh0aeEgTvc12rMg== + dependencies: + "@babel/compat-data" "^7.24.7" + "@babel/helper-validator-option" "^7.24.7" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + "@babel/helper-create-class-features-plugin@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.0.tgz#b3ddf557ed4656e0d296c3b0f3fcd381ea8de72c" @@ -204,6 +238,24 @@ "@babel/types" "^7.7.0" lodash "^4.17.13" +"@babel/helper-define-polyfill-provider@^0.6.1", "@babel/helper-define-polyfill-provider@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz#18594f789c3594acb24cfdb4a7f7b7d2e8bd912d" + integrity sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ== + dependencies: + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-plugin-utils" "^7.22.5" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + +"@babel/helper-environment-visitor@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" + integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== + dependencies: + "@babel/types" "^7.24.7" + "@babel/helper-explode-assignable-expression@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.0.tgz#db2a6705555ae1f9f33b4b8212a546bc7f9dc3ef" @@ -212,6 +264,14 @@ "@babel/traverse" "^7.7.0" "@babel/types" "^7.7.0" +"@babel/helper-function-name@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" + integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" + "@babel/helper-function-name@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz#44a5ad151cfff8ed2599c91682dda2ec2c8430a3" @@ -244,6 +304,13 @@ dependencies: "@babel/types" "^7.8.0" +"@babel/helper-hoist-variables@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" + integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== + dependencies: + "@babel/types" "^7.24.7" + "@babel/helper-hoist-variables@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.0.tgz#b4552e4cfe5577d7de7b183e193e84e4ec538c81" @@ -265,6 +332,14 @@ dependencies: "@babel/types" "^7.8.0" +"@babel/helper-module-imports@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" + integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + "@babel/helper-module-imports@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.0.tgz#99c095889466e5f7b6d66d98dffc58baaf42654d" @@ -308,6 +383,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== +"@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz#98c84fe6fe3d0d3ae7bfc3a5e166a46844feb2a0" + integrity sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg== + "@babel/helper-plugin-utils@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.0.tgz#59ec882d43c21c544ccb51decaecb306b34a8231" @@ -359,6 +439,21 @@ "@babel/template" "^7.7.0" "@babel/types" "^7.7.0" +"@babel/helper-skip-transparent-expression-wrappers@^7.20.0": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz#5f8fa83b69ed5c27adc56044f8be2b3ea96669d9" + integrity sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-split-export-declaration@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" + integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== + dependencies: + "@babel/types" "^7.24.7" + "@babel/helper-split-export-declaration@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.0.tgz#1365e74ea6c614deeb56ebffabd71006a0eb2300" @@ -373,6 +468,21 @@ dependencies: "@babel/types" "^7.8.0" +"@babel/helper-string-parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz#4d2d0f14820ede3b9807ea5fc36dfc8cd7da07f2" + integrity sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/helper-validator-option@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz#24c3bb77c7a425d1742eec8fb433b5a1b38e62f6" + integrity sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw== + "@babel/helper-wrap-function@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.0.tgz#15af3d3e98f8417a60554acbb6c14e75e0b33b74" @@ -401,6 +511,16 @@ esutils "^2.0.2" js-tokens "^4.0.0" +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/highlight@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.0.tgz#4cc003dc10359919e2e3a1d9459150942913dd1a" @@ -415,6 +535,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.2.tgz#ea8334dc77416bfd9473eb470fd00d8245b3943b" integrity sha512-DDaR5e0g4ZTb9aP7cpSZLkACEBdoLGwJDWgHtBhrGX7Q1RjhdoMOfexICj5cqTAtpowjGQWfcvfnQG7G2kAB5w== +"@babel/parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.7.tgz#9a5226f92f0c5c8ead550b750f5608e766c8ce85" + integrity sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw== + "@babel/parser@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.0.tgz#54682775f1fb25dd29a93a02315aab29a6a292bb" @@ -469,6 +594,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" +"@babel/plugin-proposal-optional-chaining@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" + integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-proposal-unicode-property-regex@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" @@ -519,6 +653,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + "@babel/plugin-syntax-top-level-await@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" @@ -732,6 +873,18 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-runtime@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.7.tgz#00a5bfaf8c43cf5c8703a8a6e82b59d9c58f38ca" + integrity sha512-YqXjrk4C+a1kZjewqt+Mmu2UuV1s07y8kqcUf4qYLnoqemhR4gRQikhdAhSVJioMjVTu6Mo6pAbaypEA3jY6fw== + dependencies: + "@babel/helper-module-imports" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.7" + babel-plugin-polyfill-corejs2 "^0.4.10" + babel-plugin-polyfill-corejs3 "^0.10.1" + babel-plugin-polyfill-regenerator "^0.6.1" + semver "^6.3.1" + "@babel/plugin-transform-shorthand-properties@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" @@ -858,6 +1011,22 @@ dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12" + integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw== + dependencies: + regenerator-runtime "^0.14.0" + +"@babel/template@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" + integrity sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + "@babel/template@^7.4.0", "@babel/template@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.0.tgz#4fadc1b8e734d97f56de39c77de76f2562e597d0" @@ -891,6 +1060,22 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5" + integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.7" + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-function-name" "^7.24.7" + "@babel/helper-hoist-variables" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + debug "^4.3.1" + globals "^11.1.0" + "@babel/traverse@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.0.tgz#d85266fdcff553c10e57b672604b36383a127c1f" @@ -915,6 +1100,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.7.tgz#6027fe12bc1aa724cd32ab113fb7f1988f1f66f2" + integrity sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q== + dependencies: + "@babel/helper-string-parser" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + to-fast-properties "^2.0.0" + "@babel/types@^7.8.0": version "7.8.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.0.tgz#1a2039a028057a2c888b668d94c98e61ea906e7f" @@ -1080,6 +1274,38 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@logux/eslint-config@^34.0.0": version "34.0.0" resolved "https://registry.yarnpkg.com/@logux/eslint-config/-/eslint-config-34.0.0.tgz#f874210a9b21037ebfdc6a7c400ddc33759f86f5" @@ -1827,6 +2053,30 @@ babel-plugin-jest-hoist@^24.9.0: dependencies: "@types/babel__traverse" "^7.0.6" +babel-plugin-polyfill-corejs2@^0.4.10: + version "0.4.11" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz#30320dfe3ffe1a336c15afdcdafd6fd615b25e33" + integrity sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q== + dependencies: + "@babel/compat-data" "^7.22.6" + "@babel/helper-define-polyfill-provider" "^0.6.2" + semver "^6.3.1" + +babel-plugin-polyfill-corejs3@^0.10.1: + version "0.10.4" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.4.tgz#789ac82405ad664c20476d0233b485281deb9c77" + integrity sha512-25J6I8NGfa5YkCDogHRID3fVCadIR8/pGl1/spvCkzb6lVn6SR3ojpx9nOn9iEBcUsjY24AmdKm5khcfKdylcg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.1" + core-js-compat "^3.36.1" + +babel-plugin-polyfill-regenerator@^0.6.1: + version "0.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz#addc47e240edd1da1058ebda03021f382bba785e" + integrity sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.2" + babel-preset-jest@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" @@ -1920,6 +2170,16 @@ browserslist@^4.0.0, browserslist@^4.6.0, browserslist@^4.7.0, browserslist@^4.7 electron-to-chromium "^1.3.295" node-releases "^1.1.38" +browserslist@^4.22.2, browserslist@^4.23.0: + version "4.23.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.1.tgz#ce4af0534b3d37db5c1a4ca98b9080f985041e96" + integrity sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw== + dependencies: + caniuse-lite "^1.0.30001629" + electron-to-chromium "^1.4.796" + node-releases "^2.0.14" + update-browserslist-db "^1.0.16" + bser@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" @@ -1996,6 +2256,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001004: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001008.tgz#b8841b1df78a9f5ed9702537ef592f1f8772c0d9" integrity sha512-b8DJyb+VVXZGRgJUa30cbk8gKHZ3LOZTBLaUEEVr2P4xpmFigOCc62CO4uzquW641Ouq1Rm9N+rWLWdSYDaDIw== +caniuse-lite@^1.0.30001629: + version "1.0.30001638" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001638.tgz#598e1f0c2ac36f37ebc3f5b8887a32ca558e5d56" + integrity sha512-5SuJUJ7cZnhPpeLHaH0c/HPAnAHZvS6ElWyHK9GSIbVOQABLzowiI2pjmpvZ1WEbkyz46iFd4UXlOHR5SqgfMQ== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -2212,6 +2477,13 @@ core-js-compat@^3.1.1: browserslist "^4.7.2" semver "^6.3.0" +core-js-compat@^3.36.1: + version "3.37.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.37.1.tgz#c844310c7852f4bdf49b8d339730b97e17ff09ee" + integrity sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg== + dependencies: + browserslist "^4.23.0" + core-js@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" @@ -2322,6 +2594,13 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" +debug@^4.3.1: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + dependencies: + ms "2.1.2" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -2495,6 +2774,11 @@ electron-to-chromium@^1.3.295: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.305.tgz#64f38c2986277b15c7b2c81954171ed22bee249b" integrity sha512-jBEhRZ3eeJWf3eAnGYB1vDy09uBQpZWshC5fxiiIRofA9L3vkpa3SxsXleVS2MvuYir15oTVxzWPsOwj7KBzUw== +electron-to-chromium@^1.4.796: + version "1.4.812" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.812.tgz#21b78709c5a13af5d5c688d135a22dcea7617acf" + integrity sha512-7L8fC2Ey/b6SePDFKR2zHAy4mbdp1/38Yk5TsARO66W3hC5KEaeKMMHoxwtuH+jcu2AYLSn9QX04i95t6Fl1Hg== + elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" @@ -2581,6 +2865,11 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" +escalade@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -3136,6 +3425,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" @@ -3369,6 +3663,13 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + hosted-git-info@^2.1.4: version "2.8.5" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" @@ -3605,6 +3906,13 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" +is-core-module@^2.13.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.14.0.tgz#43b8ef9f46a6a08888db67b1ffd4ec9e3dfd59d1" + integrity sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A== + dependencies: + hasown "^2.0.2" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -4546,6 +4854,11 @@ lodash.chunk@^4.2.0: resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" integrity sha1-ZuXOH3btJ7QwPYxlEujRIW6BBrw= +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== + lodash.defaultsdeep@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" @@ -4641,6 +4954,13 @@ loose-envify@^1.0.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + macos-release@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" @@ -4793,7 +5113,7 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@^2.1.1: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -4913,6 +5233,11 @@ node-releases@^1.1.38: dependencies: semver "^6.3.0" +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" @@ -5315,6 +5640,11 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" @@ -5344,7 +5674,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picocolors@^1.0.0: +picocolors@^1.0.0, picocolors@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== @@ -5657,6 +5987,11 @@ regenerator-runtime@^0.13.2: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + regenerator-transform@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" @@ -5839,6 +6174,15 @@ resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.3 dependencies: path-parse "^1.0.6" +resolve@^1.14.2: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -5962,6 +6306,11 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -6346,6 +6695,11 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -6644,6 +6998,14 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +update-browserslist-db@^1.0.16: + version "1.0.16" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz#f6d489ed90fb2f07d67784eb3f53d7891f736356" + integrity sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ== + dependencies: + escalade "^3.1.2" + picocolors "^1.0.1" + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -6868,7 +7230,7 @@ y18n@^4.0.0: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^3.0.0, yallist@^3.0.3: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From 8d40f7fe736630fec4a056a2a6aa558e6bced4d4 Mon Sep 17 00:00:00 2001 From: Kelly Harrop Date: Thu, 27 Jun 2024 15:18:47 -0500 Subject: [PATCH 3/5] reverting unintended updates and changing some names --- __tests__/legacy.test.ts | 16 ++++++---------- __tests__/test-utils.ts | 13 +++++-------- src/index.ts | 12 +++++------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/__tests__/legacy.test.ts b/__tests__/legacy.test.ts index 08d839b..e7e1695 100644 --- a/__tests__/legacy.test.ts +++ b/__tests__/legacy.test.ts @@ -1,6 +1,6 @@ import postcss from 'postcss'; -import { postcssThemed } from '../src/index'; +import plugin from '../src/index'; import { run } from './test-utils'; it('Creates theme override', () => { @@ -393,7 +393,7 @@ it('multiple values in one declaration', () => { }); it('Requires a config', () => { - return postcss([postcssThemed()]) + return postcss([plugin()]) .process('', { from: undefined }) .catch((e) => { expect(e).toEqual(new Error('No config provided to postcss-themed')); @@ -415,7 +415,7 @@ it('Finds missing keys', () => { }, }; - return postcss([postcssThemed({ config })]) + return postcss([plugin({ config })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain("Theme 'dark' does not contain key 'color'"); @@ -438,7 +438,7 @@ it('Finds missing default', () => { }; // @ts-ignore - return postcss([postcssThemed({ config })]) + return postcss([plugin({ config })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain( @@ -577,7 +577,7 @@ it('non-existent default theme', () => { `; // @ts-ignore - return postcss([postcssThemed({ config, defaultTheme: 'otherDefaultTheme' })]) + return postcss([plugin({ config, defaultTheme: 'otherDefaultTheme' })]) .process(input, { from: undefined }) .catch((e) => { expect(e.message).toContain( @@ -733,11 +733,7 @@ it('overrides themes to single theme', () => { `; return postcss([ - postcssThemed({ - config, - defaultTheme: 'quickBooks', - forceSingleTheme: 'true', - }), + plugin({ config, defaultTheme: 'quickBooks', forceSingleTheme: 'true' }), ]) .process(input, { from: undefined }) .catch((e) => { diff --git a/__tests__/test-utils.ts b/__tests__/test-utils.ts index a82f119..d00d19a 100644 --- a/__tests__/test-utils.ts +++ b/__tests__/test-utils.ts @@ -1,7 +1,7 @@ import postcss, { AcceptedPlugin } from 'postcss'; import nested from 'postcss-nested'; -import { postcssThemed } from '../src/index'; +import plugin from '../src/index'; import { PostcssThemeOptions } from '../src/types'; export function normalizeResult(input: string) { @@ -17,14 +17,11 @@ export async function run( opts: PostcssThemeOptions, inputPath?: string ) { - // Create a PostCSS instance using the postcssThemed plugin with the provided options - const processor = postcss([ - nested as AcceptedPlugin, - postcssThemed(opts), // Use the updated postcssThemed export - ]); - // Process the input CSS - const result = await processor.process(input, { from: inputPath }); + const result = await postcss([ + nested as AcceptedPlugin, + plugin(opts), + ]).process(input, { from: inputPath }); expect(normalizeResult(result.css)).toEqual(normalizeResult(output)); expect(result.warnings()).toHaveLength(0); } diff --git a/src/index.ts b/src/index.ts index 461b699..2113b6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,11 +69,8 @@ const themeFile = (options: PostcssThemeOptions = {}) => async ( result: Result ) => { // Postcss-modules runs twice and we only ever want to process the CSS once - if ( - root.source?.input.from.endsWith('.module.css') && - // @ts-ignore - root.source.input.css.trim() === '' - ) { + // @ts-ignore + if (root.source.processed) { return; } @@ -117,7 +114,7 @@ const themeFile = (options: PostcssThemeOptions = {}) => async ( } }; -export const postcssThemed = (options: PostcssThemeOptions = {}) => { +export const plugin = (options: PostcssThemeOptions = {}) => { return { postcssPlugin: 'postcss-themed', Once(root: Root, { result }: { result: Result }) { @@ -126,6 +123,7 @@ export const postcssThemed = (options: PostcssThemeOptions = {}) => { }; }; -postcssThemed.postcss = true; +plugin.postcss = true; +export default plugin; export * from './types'; From 3d0514e878d1a1cac33f35eea6c9402ea69b7c34 Mon Sep 17 00:00:00 2001 From: Kelly Harrop Date: Fri, 28 Jun 2024 09:46:32 -0500 Subject: [PATCH 4/5] removing unnecessary dep --- .babelrc | 1 - package.json | 1 - yarn.lock | 26 +------------------------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/.babelrc b/.babelrc index c9f19dc..0be7fe9 100644 --- a/.babelrc +++ b/.babelrc @@ -2,7 +2,6 @@ "presets": ["@babel/preset-typescript", "@babel/preset-env"], "plugins": [ "@babel/plugin-proposal-nullish-coalescing-operator", - "@babel/plugin-proposal-optional-chaining", "@babel/plugin-transform-runtime" ] } diff --git a/package.json b/package.json index 06fa0e5..ecb3f90 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "@auto-it/all-contributors": "^7.2.2", "@babel/core": "^7.6.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", - "@babel/plugin-proposal-optional-chaining": "^7.21.0", "@babel/plugin-transform-runtime": "^7.24.7", "@babel/preset-env": "^7.4.3", "@babel/preset-typescript": "^7.7.7", diff --git a/yarn.lock b/yarn.lock index 5624564..865049c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -383,7 +383,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== -"@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.7": +"@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz#98c84fe6fe3d0d3ae7bfc3a5e166a46844feb2a0" integrity sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg== @@ -439,14 +439,6 @@ "@babel/template" "^7.7.0" "@babel/types" "^7.7.0" -"@babel/helper-skip-transparent-expression-wrappers@^7.20.0": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz#5f8fa83b69ed5c27adc56044f8be2b3ea96669d9" - integrity sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - "@babel/helper-split-export-declaration@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" @@ -594,15 +586,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" -"@babel/plugin-proposal-optional-chaining@^7.21.0": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" - integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-proposal-unicode-property-regex@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" @@ -653,13 +636,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - "@babel/plugin-syntax-top-level-await@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" From dc85ae7f1f6cec58ee350d1b25efaea3914e8c1e Mon Sep 17 00:00:00 2001 From: Kelly Harrop Date: Mon, 1 Jul 2024 13:01:29 -0500 Subject: [PATCH 5/5] reverting postcss8 updates for testing --- __tests__/test-utils.ts | 17 ++++++++--------- src/index.ts | 28 +++++++++------------------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/__tests__/test-utils.ts b/__tests__/test-utils.ts index d00d19a..6ff6930 100644 --- a/__tests__/test-utils.ts +++ b/__tests__/test-utils.ts @@ -1,4 +1,4 @@ -import postcss, { AcceptedPlugin } from 'postcss'; +import postcss from 'postcss'; import nested from 'postcss-nested'; import plugin from '../src/index'; @@ -11,17 +11,16 @@ export function normalizeResult(input: string) { .join(''); } -export async function run( +export function run( input: string, output: string, opts: PostcssThemeOptions, inputPath?: string ) { - // Process the input CSS - const result = await postcss([ - nested as AcceptedPlugin, - plugin(opts), - ]).process(input, { from: inputPath }); - expect(normalizeResult(result.css)).toEqual(normalizeResult(output)); - expect(result.warnings()).toHaveLength(0); + return postcss([nested, plugin(opts)]) + .process(input, { from: inputPath }) + .then((result) => { + expect(normalizeResult(result.css)).toEqual(normalizeResult(output)); + expect(result.warnings()).toHaveLength(0); + }); } diff --git a/src/index.ts b/src/index.ts index 2113b6a..46b6b62 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Root, Result } from 'postcss'; +import postcss from 'postcss'; import fs from 'fs'; import debug from 'debug'; import merge from 'deepmerge'; @@ -64,9 +64,9 @@ export const configForComponent = ( }; /** Generate a theme */ -const themeFile = (options: PostcssThemeOptions = {}) => async ( - root: Root, - result: Result +const themeFile = (options: PostcssThemeOptions = {}) => ( + root: postcss.Root, + result: postcss.Result ) => { // Postcss-modules runs twice and we only ever want to process the CSS once // @ts-ignore @@ -93,13 +93,13 @@ const themeFile = (options: PostcssThemeOptions = {}) => async ( resolveThemeExtension(mergedConfig); if (caniuse.isSupported('css-variables', browserslist())) { - await modernTheme(root, mergedConfig, options); + modernTheme(root, mergedConfig, options); } else { - await legacyTheme(root, mergedConfig, options); + legacyTheme(root, mergedConfig, options); } // @ts-ignore - root.source.input.css = result.css; + root.source.processed = true; if (!resolveTheme && root.source.input.file) { const themeFilename = getThemeFilename(root.source.input.file); @@ -114,16 +114,6 @@ const themeFile = (options: PostcssThemeOptions = {}) => async ( } }; -export const plugin = (options: PostcssThemeOptions = {}) => { - return { - postcssPlugin: 'postcss-themed', - Once(root: Root, { result }: { result: Result }) { - return themeFile(options)(root, result); - }, - }; -}; - -plugin.postcss = true; - -export default plugin; export * from './types'; +// @ts-ignore +export default postcss.plugin('postcss-themed', themeFile);