diff --git a/.github/bin/install-and-test-all-packages.sh b/.github/bin/install-and-test-all-packages.sh index 0513d5f70..168815aca 100644 --- a/.github/bin/install-and-test-all-packages.sh +++ b/.github/bin/install-and-test-all-packages.sh @@ -4,27 +4,27 @@ set -e start_dir=$(pwd) -for package in $(ls -d ./packages); do +for package in $(ls -d ./packages/*); do echo "Installing and testing $package" cd $package npm install --ignore-scripts - npm test + npm run test cd $start_dir done -for package in $(ls -d ./plugins); do +for package in $(ls -d ./plugins/*); do echo "Installing and testing $package" cd $package npm install --ignore-scripts - npm test + npm run test cd $start_dir done -for package in $(ls -d ./plugin-packs); do +for package in $(ls -d ./plugin-packs/*); do echo "Installing and testing $package" cd $package npm install --ignore-scripts - npm test + npm run test cd $start_dir done diff --git a/.github/workflows/test-node-without-workspaces.yml b/.github/workflows/test-node-without-workspaces.yml new file mode 100644 index 000000000..5c3c01c02 --- /dev/null +++ b/.github/workflows/test-node-without-workspaces.yml @@ -0,0 +1,22 @@ +name: test node without workspaces +on: + push: + +jobs: + test_without_workspaces_support: + runs-on: ubuntu-latest + strategy: + matrix: + node: [12, 14] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + - run: npm install --ignore-scripts + - run: npm run build --workspaces --if-present + + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - run: bash ./.github/bin/install-and-test-all-packages.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 585539abf..a313184c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,40 +14,36 @@ jobs: with: node-version: ${{ matrix.node }} - - run: exit 0 - # - run: npm install --ignore-scripts - # - run: npm run build --workspaces --if-present - # - run: npm run lint --workspaces --if-present - # - run: npm run test --workspaces --if-present + - run: npm install --ignore-scripts + - run: npm run build --workspaces --if-present + - run: npm run lint --workspaces --if-present + - run: npm run test --workspaces --if-present - test_without_workspaces_support: - runs-on: ubuntu-latest + # Run cross platform test of the basic CLI. + test_cli: + runs-on: ${{ matrix.os }} strategy: matrix: - node: [12, 14] + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: 16 - - run: exit 0 - # - run: npm install --ignore-scripts - # - run: npm run build --workspaces --if-present + - run: npm install --ignore-scripts + - run: npm run build --workspaces --if-present - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} + # running "npm install" places the cli in node_modules/bin + - run: npm install --ignore-scripts - - run: exit 0 - # - run: bash ./.github/bin/install-and-test-all-packages.sh + - run: | + npm run test --workspace="@csstools/base-cli" + npm run test:cli --workspace="@csstools/postcss-base-plugin" - # Run cross platform test of the basic CLI. - test_cli: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + # Run Deno tests one by one + test_deno: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 @@ -55,11 +51,13 @@ jobs: node-version: 16 - run: npm install --ignore-scripts - # - run: npm run build --workspaces --if-present + - run: npm run build --workspaces --if-present + + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.x.x + # Per plugin from here - run: | - npm run build --workspace="@csstools/base-cli" --workspace="@csstools/postcss-base-plugin" - # running install places the cli in node_modules/bin - npm install - npm run test --workspace="@csstools/base-cli" - npm run test:cli --workspace="@csstools/postcss-base-plugin" + cd plugins/postcss-nesting + npm run test:deno diff --git a/plugin-packs/postcss-preset-env/.tape.js b/plugin-packs/postcss-preset-env/.tape.js index 40df4f4b8..145bd340e 100644 --- a/plugin-packs/postcss-preset-env/.tape.js +++ b/plugin-packs/postcss-preset-env/.tape.js @@ -83,7 +83,7 @@ module.exports = { }, insertBefore: { 'color-mod-function': [ - require('postcss-simple-vars') + require('postcss-simple-vars')() ] } } @@ -93,7 +93,7 @@ module.exports = { options: { stage: 1, insertAfter: { - 'color-mod-function': require('postcss-simple-vars') + 'color-mod-function': require('postcss-simple-vars')() } }, }, @@ -113,7 +113,7 @@ module.exports = { stage: 1, insertAfter: { 'color-mod-function': [ - require('postcss-simple-vars') + require('postcss-simple-vars')() ] }, features: { diff --git a/plugin-packs/postcss-preset-env/package.json b/plugin-packs/postcss-preset-env/package.json index fbca8ced0..cb85df663 100644 --- a/plugin-packs/postcss-preset-env/package.json +++ b/plugin-packs/postcss-preset-env/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -65,7 +65,8 @@ }, "devDependencies": { "postcss": "^8.3.6", - "postcss-tape": "^6.0.1" + "postcss-tape": "^6.0.1", + "postcss-simple-vars": "^6.0.3" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css b/plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css index 7b3eaf1a2..ae592c00b 100644 --- a/plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css @@ -9,18 +9,22 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .test-image-set-function { - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } [dir="ltr"] .test-logical-properties-and-values { @@ -97,8 +101,8 @@ } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css b/plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css index 7b3eaf1a2..ae592c00b 100644 --- a/plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css @@ -9,18 +9,22 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .test-image-set-function { - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } [dir="ltr"] .test-logical-properties-and-values { @@ -97,8 +101,8 @@ } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.ch38.expect.css b/plugin-packs/postcss-preset-env/test/basic.ch38.expect.css index 286e8618d..a2e037294 100644 --- a/plugin-packs/postcss-preset-env/test/basic.ch38.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.ch38.expect.css @@ -9,19 +9,23 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (min-resolution: 192dpi) { +@media (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (min-resolution: 192dpi) { + .test-image-set-function { - background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } [dir="ltr"] .test-logical-properties-and-values { @@ -98,8 +102,8 @@ } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.expect.css b/plugin-packs/postcss-preset-env/test/basic.expect.css index f66a86bd7..d8e8d8916 100644 --- a/plugin-packs/postcss-preset-env/test/basic.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.expect.css @@ -9,19 +9,23 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .test-image-set-function { - background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } [dir="ltr"] .test-logical-properties-and-values { @@ -98,8 +102,8 @@ } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.ff49.expect.css b/plugin-packs/postcss-preset-env/test/basic.ff49.expect.css index 416b52c3a..c98fbf83f 100644 --- a/plugin-packs/postcss-preset-env/test/basic.ff49.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.ff49.expect.css @@ -8,18 +8,22 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (min-resolution: 192dpi) { +@media (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (min-resolution: 192dpi) { + .test-image-set-function { - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } .test-logical-properties-and-values { @@ -88,8 +92,8 @@ } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.stage0-ff49.expect.css b/plugin-packs/postcss-preset-env/test/basic.stage0-ff49.expect.css index 79fe510c9..fb13c1998 100644 --- a/plugin-packs/postcss-preset-env/test/basic.stage0-ff49.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.stage0-ff49.expect.css @@ -8,18 +8,22 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (min-resolution: 192dpi) { +@media (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (min-resolution: 192dpi) { + .test-image-set-function { - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } .test-logical-properties-and-values { @@ -92,8 +96,8 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugin-packs/postcss-preset-env/test/basic.stage0.expect.css b/plugin-packs/postcss-preset-env/test/basic.stage0.expect.css index b5262b8aa..af1344c4e 100644 --- a/plugin-packs/postcss-preset-env/test/basic.stage0.expect.css +++ b/plugin-packs/postcss-preset-env/test/basic.stage0.expect.css @@ -9,19 +9,23 @@ .test-image-set-function { background-image: url(img/test.png); + background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); + order: 2; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi) { .test-image-set-function { - background-image: url(img/test-2x.png); + background-image: url(img/test.png); } } +@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .test-image-set-function { - background-image: -webkit-image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - background-image: image-set(url(img/test.png) 1x, url(img/test-2x.png) 2x); - order: 2; + background-image: url(img/test-2x.png); +} } [dir="ltr"] .test-logical-properties-and-values { @@ -102,8 +106,8 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te } .test-lab-function { - background-color: rgb(178, 34, 34); - color: rgba(178, 34, 34, 0.5); + background-color: rgb(179, 35, 35); + color: rgba(179, 34, 35, 0.5); order: 14; } diff --git a/plugins/css-blank-pseudo/package.json b/plugins/css-blank-pseudo/package.json index 7746f3940..cace0b936 100644 --- a/plugins/css-blank-pseudo/package.json +++ b/plugins/css-blank-pseudo/package.json @@ -9,6 +9,11 @@ "main": "dist/index.cjs", "module": "dist/index.mjs", "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + }, "./browser": { "default": "./dist/browser.js" }, @@ -29,7 +34,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default-with-browser.js", "stryker": "stryker run --logLevel error" }, @@ -37,11 +42,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/css-has-pseudo/package.json b/plugins/css-has-pseudo/package.json index 871d927de..9bd97c7f6 100644 --- a/plugins/css-has-pseudo/package.json +++ b/plugins/css-has-pseudo/package.json @@ -9,6 +9,11 @@ "main": "dist/index.cjs", "module": "dist/index.mjs", "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + }, "./browser": { "default": "./dist/browser.js" }, @@ -29,7 +34,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default-with-browser.js", "stryker": "stryker run --logLevel error" }, @@ -37,11 +42,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/css-prefers-color-scheme/package.json b/plugins/css-prefers-color-scheme/package.json index 5d6a7d878..f249ac6f8 100644 --- a/plugins/css-prefers-color-scheme/package.json +++ b/plugins/css-prefers-color-scheme/package.json @@ -9,6 +9,11 @@ "main": "dist/index.cjs", "module": "dist/index.mjs", "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + }, "./browser": { "default": "./dist/browser.js" }, @@ -29,7 +34,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default-with-browser.js", "stryker": "stryker run --logLevel error" }, @@ -37,8 +42,8 @@ "node": "^12 || ^14 || >=16" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-base-plugin/package.json b/plugins/postcss-base-plugin/package.json index c5b8f10f8..ebc97f273 100644 --- a/plugins/postcss-base-plugin/package.json +++ b/plugins/postcss-base-plugin/package.json @@ -24,13 +24,12 @@ "scripts": { "prepublishOnly": "npm run build --if-present && npm run test --if-present", "lint": "eslint src/**/*.ts", - "test": "postcss-tape", + "test": "postcss-tape --ci", "test:cli": "bash ./test/cli/test.sh", "build": "rollup -c ../../rollup/default.ts.js", "stryker": "stryker run --logLevel error" }, "devDependencies": { - "@csstools/base-cli": "^0.1.0", "postcss": "^8.3.6", "postcss-tape": "^6.0.1" }, diff --git a/plugins/postcss-base-plugin/src/index.ts b/plugins/postcss-base-plugin/src/index.ts index 1068ac962..ee1f96bc0 100644 --- a/plugins/postcss-base-plugin/src/index.ts +++ b/plugins/postcss-base-plugin/src/index.ts @@ -5,7 +5,7 @@ const creator: PluginCreator<{ color: string }> = (opts?: { color: string }) => postcssPlugin: 'postcss-base-plugin', Declaration(decl) { if (decl.value === 'red') { - if (opts?.color) { + if (opts && opts.color) { decl.value = opts.color; } else { decl.value = 'blue'; diff --git a/plugins/postcss-color-functional-notation/package.json b/plugins/postcss-color-functional-notation/package.json index 92a455113..0a35e3f8d 100644 --- a/plugins/postcss-color-functional-notation/package.json +++ b/plugins/postcss-color-functional-notation/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, diff --git a/plugins/postcss-dir-pseudo-class/package.json b/plugins/postcss-dir-pseudo-class/package.json index d65a523ae..d927f8b4b 100644 --- a/plugins/postcss-dir-pseudo-class/package.json +++ b/plugins/postcss-dir-pseudo-class/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,11 +29,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-double-position-gradients/package.json b/plugins/postcss-double-position-gradients/package.json index 0c259827f..b08676fb0 100644 --- a/plugins/postcss-double-position-gradients/package.json +++ b/plugins/postcss-double-position-gradients/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -32,8 +32,8 @@ "postcss-values-parser": "^6.0.1" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-env-function/package.json b/plugins/postcss-env-function/package.json index c3207a703..2b1b074f4 100644 --- a/plugins/postcss-env-function/package.json +++ b/plugins/postcss-env-function/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,11 +29,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-values-parser": "6.0.1" + "postcss-values-parser": "^6.0.1" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-focus-visible/package.json b/plugins/postcss-focus-visible/package.json index 3effe76e3..e86233d0a 100644 --- a/plugins/postcss-focus-visible/package.json +++ b/plugins/postcss-focus-visible/package.json @@ -22,7 +22,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.ts", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.ts.js", "stryker": "stryker run --logLevel error" }, @@ -30,11 +30,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-focus-visible/src/index.ts b/plugins/postcss-focus-visible/src/index.ts index 43b196a21..8f18496c3 100644 --- a/plugins/postcss-focus-visible/src/index.ts +++ b/plugins/postcss-focus-visible/src/index.ts @@ -2,7 +2,7 @@ import parser from 'postcss-selector-parser'; import type { PluginCreator } from 'postcss'; -export const selectorRegExp = /(? = (opts?: { preserve?: boolean, replaceWith?: string }) => { opts = Object(opts); diff --git a/plugins/postcss-focus-within/package.json b/plugins/postcss-focus-within/package.json index 77e1f6016..43c922404 100644 --- a/plugins/postcss-focus-within/package.json +++ b/plugins/postcss-focus-within/package.json @@ -22,7 +22,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.ts", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.ts.js", "stryker": "stryker run --logLevel error" }, @@ -30,11 +30,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-gap-properties/package.json b/plugins/postcss-gap-properties/package.json index 3848657ce..75b89cbae 100644 --- a/plugins/postcss-gap-properties/package.json +++ b/plugins/postcss-gap-properties/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,8 +29,8 @@ "node": "^12 || ^14 || >=16" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-image-set-function/package.json b/plugins/postcss-image-set-function/package.json index c18e19e57..a55ccae1e 100644 --- a/plugins/postcss-image-set-function/package.json +++ b/plugins/postcss-image-set-function/package.json @@ -21,8 +21,8 @@ }, "scripts": { "prepublishOnly": "npm run build && npm run test", - "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "lint": "eslint src/**/*.ts", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.ts.js", "stryker": "stryker run --logLevel error" }, @@ -30,11 +30,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-values-parser": "6.0.1" + "postcss-values-parser": "^6.0.1" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-lab-function/package.json b/plugins/postcss-lab-function/package.json index c146026a0..0a847926b 100644 --- a/plugins/postcss-lab-function/package.json +++ b/plugins/postcss-lab-function/package.json @@ -22,7 +22,7 @@ "scripts": { "prepublishOnly": "npm run build --if-present && npm run test --if-present", "lint": "eslint src/**/*.ts", - "test": "node ./test/color/test.mjs && postcss-tape", + "test": "node ./test/color/test.mjs && postcss-tape --ci", "build": "rollup -c ../../rollup/default.ts.js", "stryker": "stryker run --logLevel error", "generate-color-corpus": "python3 ./test/color/generate.py" @@ -34,7 +34,6 @@ "postcss-values-parser": "^6.0.1" }, "devDependencies": { - "@csstools/base-cli": "^0.1.0", "postcss": "^8.3.6", "postcss-tape": "^6.0.1" }, diff --git a/plugins/postcss-lab-function/src/index.ts b/plugins/postcss-lab-function/src/index.ts index f3df7eb3f..c0aa16f5c 100644 --- a/plugins/postcss-lab-function/src/index.ts +++ b/plugins/postcss-lab-function/src/index.ts @@ -6,7 +6,7 @@ import onCSSFunction from './on-css-function'; import type { PluginCreator } from 'postcss'; // NOTE : Used in unit tests. -export { labToSRgb, lchToSRgb } from './color'; +import { labToSRgb, lchToSRgb } from './color'; /** Transform lab() and lch() functions in CSS. */ const postcssPlugin: PluginCreator<{ preserve: boolean }> = (opts?: { preserve: boolean }) => { @@ -86,4 +86,10 @@ const postcssPlugin: PluginCreator<{ preserve: boolean }> = (opts?: { preserve: postcssPlugin.postcss = true; +// Used by unit tests. +// Mixing named and default export causes issues with CJS. +// Attaching these to the default export is the best solution. +postcssPlugin['_labToSRgb'] = labToSRgb; +postcssPlugin['_lchToSRgb'] = lchToSRgb; + export default postcssPlugin; diff --git a/plugins/postcss-lab-function/test/color/test.mjs b/plugins/postcss-lab-function/test/color/test.mjs index 63eb2f8a9..f1b023b88 100644 --- a/plugins/postcss-lab-function/test/color/test.mjs +++ b/plugins/postcss-lab-function/test/color/test.mjs @@ -3,7 +3,9 @@ // ColorAid is a python package that follows the CSS specification. // Comparing our output to the python package gives a relatively good idea of how good we convert. import fs from 'fs'; -import { labToSRgb, lchToSRgb } from '../../dist/index.mjs'; +import plugin from '../../dist/index.mjs'; +const labToSRgb = plugin._labToSRgb; +const lchToSRgb = plugin._lchToSRgb; // LAB to SRGB { diff --git a/plugins/postcss-logical/package.json b/plugins/postcss-logical/package.json index c398cf1c3..14be88440 100644 --- a/plugins/postcss-logical/package.json +++ b/plugins/postcss-logical/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,8 +29,8 @@ "node": "^12 || ^14 || >=16" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-nesting/package.json b/plugins/postcss-nesting/package.json index 67fb80af4..0f4ed46b1 100644 --- a/plugins/postcss-nesting/package.json +++ b/plugins/postcss-nesting/package.json @@ -30,7 +30,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape && npm run test:deno", + "test": "postcss-tape --ci", "test:deno": "deno run --unstable --allow-env --allow-read test/deno/test.js", "build": "rollup -c ../../rollup/default-with-deno.js", "stryker": "stryker run --logLevel error" @@ -39,11 +39,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-selector-parser": "6.0.6" + "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-overflow-shorthand/package.json b/plugins/postcss-overflow-shorthand/package.json index a9ad23a5d..37f5f7e90 100644 --- a/plugins/postcss-overflow-shorthand/package.json +++ b/plugins/postcss-overflow-shorthand/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,8 +29,8 @@ "node": "^12 || ^14 || >=16" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-place/package.json b/plugins/postcss-place/package.json index eede19f40..dfdefcce7 100755 --- a/plugins/postcss-place/package.json +++ b/plugins/postcss-place/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -29,11 +29,11 @@ "node": "^12 || ^14 || >=16" }, "dependencies": { - "postcss-values-parser": "6.0.1" + "postcss-values-parser": "^6.0.1" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/plugins/postcss-pseudo-class-any-link/package.json b/plugins/postcss-pseudo-class-any-link/package.json index 51170863b..89edd5e1d 100644 --- a/plugins/postcss-pseudo-class-any-link/package.json +++ b/plugins/postcss-pseudo-class-any-link/package.json @@ -21,7 +21,7 @@ "scripts": { "prepublishOnly": "npm run build && npm run test", "lint": "eslint src/**/*.js", - "test": "postcss-tape", + "test": "postcss-tape --ci", "build": "rollup -c ../../rollup/default.js", "stryker": "stryker run --logLevel error" }, @@ -32,8 +32,8 @@ "postcss-selector-parser": "^6.0.6" }, "devDependencies": { - "postcss": "8.3.6", - "postcss-tape": "6.0.1" + "postcss": "^8.3.6", + "postcss-tape": "^6.0.1" }, "peerDependencies": { "postcss": "^8.3" diff --git a/rollup/default-with-browser.js b/rollup/default-with-browser.js index 4c983e09c..968f2f4d8 100644 --- a/rollup/default-with-browser.js +++ b/rollup/default-with-browser.js @@ -12,8 +12,10 @@ export default [ { file: 'dist/index.mjs', format: 'esm', sourcemap: true, exports: 'auto' }, ], external: [ - 'postcss-values-parser', + 'fs', + 'path', 'postcss-selector-parser', + 'postcss-values-parser', ], plugins: [ babel({ @@ -37,6 +39,46 @@ export default [ output: [ { file: 'dist/browser.cjs', format: 'cjs', sourcemap: true, exports: 'auto', strict: false }, ], + external: [ + 'fs', + 'path', + + 'autoprefixer', + 'browserslist', + 'caniuse-lite', + 'css-blank-pseudo', + 'css-has-pseudo', + 'css-prefers-color-scheme', + 'cssdb', + 'postcss-attribute-case-insensitive', + 'postcss-color-functional-notation', + 'postcss-color-hex-alpha', + 'postcss-color-rebeccapurple', + 'postcss-custom-media', + 'postcss-custom-properties', + 'postcss-custom-selectors', + 'postcss-dir-pseudo-class', + 'postcss-double-position-gradients', + 'postcss-env-function', + 'postcss-focus-visible', + 'postcss-focus-within', + 'postcss-font-variant', + 'postcss-gap-properties', + 'postcss-image-set-function', + 'postcss-initial', + 'postcss-lab-function', + 'postcss-logical', + 'postcss-media-minmax', + 'postcss-nesting', + 'postcss-overflow-shorthand', + 'postcss-page-break', + 'postcss-place', + 'postcss-pseudo-class-any-link', + 'postcss-replace-overflow-wrap', + 'postcss-selector-not', + 'postcss-selector-parser', + 'postcss-values-parser', + ], plugins: [ babel({ babelHelpers: 'bundled', diff --git a/rollup/default-with-deno.js b/rollup/default-with-deno.js index c062f5b00..01131802c 100644 --- a/rollup/default-with-deno.js +++ b/rollup/default-with-deno.js @@ -37,6 +37,46 @@ export default [ output: [ { file: 'dist/cli.mjs', format: 'esm', sourcemap: false }, ], + external: [ + 'fs', + 'path', + + 'autoprefixer', + 'browserslist', + 'caniuse-lite', + 'css-blank-pseudo', + 'css-has-pseudo', + 'css-prefers-color-scheme', + 'cssdb', + 'postcss-attribute-case-insensitive', + 'postcss-color-functional-notation', + 'postcss-color-hex-alpha', + 'postcss-color-rebeccapurple', + 'postcss-custom-media', + 'postcss-custom-properties', + 'postcss-custom-selectors', + 'postcss-dir-pseudo-class', + 'postcss-double-position-gradients', + 'postcss-env-function', + 'postcss-focus-visible', + 'postcss-focus-within', + 'postcss-font-variant', + 'postcss-gap-properties', + 'postcss-image-set-function', + 'postcss-initial', + 'postcss-lab-function', + 'postcss-logical', + 'postcss-media-minmax', + 'postcss-nesting', + 'postcss-overflow-shorthand', + 'postcss-page-break', + 'postcss-place', + 'postcss-pseudo-class-any-link', + 'postcss-replace-overflow-wrap', + 'postcss-selector-not', + 'postcss-selector-parser', + 'postcss-values-parser', + ], onwarn: (warning) => { // Silence circular dependency warning for postcss-values-parsers package if ( diff --git a/rollup/default.js b/rollup/default.js index 38071c1c1..ff97dc6b2 100644 --- a/rollup/default.js +++ b/rollup/default.js @@ -12,8 +12,10 @@ export default [ { file: 'dist/index.mjs', format: 'esm', sourcemap: true, exports: 'auto' }, ], external: [ - 'postcss-values-parser', + 'fs', + 'path', 'postcss-selector-parser', + 'postcss-values-parser', ], plugins: [ babel({ @@ -37,6 +39,46 @@ export default [ output: [ { file: 'dist/cli.mjs', format: 'esm', sourcemap: false }, ], + external: [ + 'fs', + 'path', + + 'autoprefixer', + 'browserslist', + 'caniuse-lite', + 'css-blank-pseudo', + 'css-has-pseudo', + 'css-prefers-color-scheme', + 'cssdb', + 'postcss-attribute-case-insensitive', + 'postcss-color-functional-notation', + 'postcss-color-hex-alpha', + 'postcss-color-rebeccapurple', + 'postcss-custom-media', + 'postcss-custom-properties', + 'postcss-custom-selectors', + 'postcss-dir-pseudo-class', + 'postcss-double-position-gradients', + 'postcss-env-function', + 'postcss-focus-visible', + 'postcss-focus-within', + 'postcss-font-variant', + 'postcss-gap-properties', + 'postcss-image-set-function', + 'postcss-initial', + 'postcss-lab-function', + 'postcss-logical', + 'postcss-media-minmax', + 'postcss-nesting', + 'postcss-overflow-shorthand', + 'postcss-page-break', + 'postcss-place', + 'postcss-pseudo-class-any-link', + 'postcss-replace-overflow-wrap', + 'postcss-selector-not', + 'postcss-selector-parser', + 'postcss-values-parser', + ], onwarn: (warning) => { // Silence circular dependency warning for postcss-values-parsers package if ( diff --git a/rollup/default.ts.js b/rollup/default.ts.js index 7d0df0606..2dbd49780 100644 --- a/rollup/default.ts.js +++ b/rollup/default.ts.js @@ -13,8 +13,10 @@ export default [ { file: 'dist/index.mjs', format: 'esm', sourcemap: true, exports: 'auto' }, ], external: [ - 'postcss-values-parser', + 'fs', + 'path', 'postcss-selector-parser', + 'postcss-values-parser', ], plugins: [ typescript({ tsconfig: './tsconfig.json' }), @@ -39,6 +41,46 @@ export default [ output: [ { file: 'dist/cli.mjs', format: 'esm', sourcemap: false }, ], + external: [ + 'fs', + 'path', + + 'autoprefixer', + 'browserslist', + 'caniuse-lite', + 'css-blank-pseudo', + 'css-has-pseudo', + 'css-prefers-color-scheme', + 'cssdb', + 'postcss-attribute-case-insensitive', + 'postcss-color-functional-notation', + 'postcss-color-hex-alpha', + 'postcss-color-rebeccapurple', + 'postcss-custom-media', + 'postcss-custom-properties', + 'postcss-custom-selectors', + 'postcss-dir-pseudo-class', + 'postcss-double-position-gradients', + 'postcss-env-function', + 'postcss-focus-visible', + 'postcss-focus-within', + 'postcss-font-variant', + 'postcss-gap-properties', + 'postcss-image-set-function', + 'postcss-initial', + 'postcss-lab-function', + 'postcss-logical', + 'postcss-media-minmax', + 'postcss-nesting', + 'postcss-overflow-shorthand', + 'postcss-page-break', + 'postcss-place', + 'postcss-pseudo-class-any-link', + 'postcss-replace-overflow-wrap', + 'postcss-selector-not', + 'postcss-selector-parser', + 'postcss-values-parser', + ], onwarn: (warning) => { // Silence circular dependency warning for postcss-values-parsers package if (