Conversation
Collaborator
|
Amazing!! <3 |
Collaborator
Author
|
@jrit I will release a beta v12 first to test it for a while in real projects and hopefully get feedback from users too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Juice 12
Modernizes the entire stack: ESM-only, PostCSS-based parsers, CSS Nesting + spec-correct selector specificity, Node 22.12+ floor, Vitest 4 with 100% line coverage.
Installation
Juice 12 is currently available in beta on the
nexttag, check it out:Breaking changes
require(esm)interop. Older Node versions need to upgrade.client.jsis ESM. Modern bundlers (Vite, webpack 5, esbuild, Rollup, Parcel 2+) handle it via the"browser"condition in theexportsmap. Browserify is no longer supported — it cannot parse ESM. README updated to point at modern bundlers.mensch→postcss+postcss-safe-parser. Selector parser swapped:slick→postcss-selector-parser. Both old libs were unmaintained since 2022. Inlining semantics unchanged; preserved-CSS output inside<style>blocks is now canonically formatted (mensch had quirks like;}squashed onto one line). 4 fixture.outfiles refreshed to match.:is(),:where(),:has(),:not()per CSS Selectors Level 4::where(...)contributes 0, the others contributemax(spec(args)). Previously juice treated all four as a generic:pseudoand:notused "first arg only" (a slick legacy). Any cascade resolution that depended on the old quirks will produce different inlined styles.commanderupgraded to v14,entitiesupgraded to v8 (ESM-only),cheeriopinned to1.2.0.juice.d.ts → index.d.tsand restructured for ESM default-export resolution. Import asimport juice from 'juice'.New features
.card { &:hover { ... } }), nested at-rules (.card { @media (...) { ... } }), the&parent selector, and bare nested selectors (per the 2023 CSSWG resolution) are flattened viapostcss-nestingbefore inlining. Previously these were silently dropped. No behavior change for already-flat CSS.@containerand@layerat-rules are preserved through inlining (mirrors how@media/@font-face/@keyframesalready worked). New optionspreserveContainerQueriesandpreserveLayersdefault totrue.:not(a, b, …)are gone as a side effect of the parser swap — the underlying causes of [BUG] It stuck in an infinite loop when parsing specific css. #390, Infinite loop when parsing certain CSS rules #471, and Crash on unexpected properties #398 were quirks in mensch/slick that don't exist in postcss.typescondition inexportsand resolve correctly undernodenextmodule resolution.Tooling
@vitest/coverage-v8. New scripts:npm test,npm run test:watch,npm run coverage. The previously brokentestcoverscript is gone.bin/juice's logic moved intolib/cli.jsas a testablecli.run(argv, deps)with dependency injection. The bin itself is now a 3-line ESM shim.cli.js → cli.test.js,test.js → integration.test.js,run.js → cases.test.js. TypeScript test now uses a dedicatedtest/typescript/tsconfig.jsonwithnodenextresolution.assertto Vitest'sexpect— better failure diffs, more matchers, idiomatic.'use strict';directives across the codebase — no-ops in ESM modules.mocha,should,batch,browserify. Added:vitest,@vitest/coverage-v8,postcss,postcss-safe-parser,postcss-selector-parser,postcss-nesting.Migration notes (for downstream consumers)
const juice = require('juice')on Node ≥22.12require(esm)handles itconst juice = require('juice')on older Nodeimport juice from 'juice'import juice = require('juice')import juice from 'juice'juice/clientvia Browserify:is/:where/:hasin email CSS@containeror@layerFixes #390, fixes #392, fixes #398, fixes #403, fixes #471, fixes #557, fixes #587, fixes #593