- Added a type declaration for
postcss-modules/loaderso TypeScript users can extend it withdeclare modulewithout hitting a type error. #172 by @sapphi-red
- Minimum Node.js bumped from 20 to 20.6, the release that stabilized
module.register.
- New
postcss-modules/loadersubpath — an opt-in Node module-customization hook. Run withnode --import postcss-modules/loader app.mjsand JavaScript files can doimport styles from "./button.css"to receive the class-name token map as the default export, mirroringcss-loader'smodulesworkflow. Options live inpostcss-modules.config.{js,cjs,mjs}in cwd, thePOSTCSS_MODULES_CONFIGenv var, or a"postcss-modules"key inpackage.json, and accept the same shape as the PostCSS plugin. Aimed at non-bundler use cases (SSR, Node scripts, Jest/Vitest in node mode); bundler users keep using their existing integrations. #80
hashPrefixis now applied when no customgenerateScopedNameis set. Previously the option was only honoured bygeneric-names, so the built-in default generator silently ignored it. #160- Empty rules left behind after
:global { ... }unwrapping (e.g. a Sass block containing only a multi-line comment) are now removed instead of emitted as orphaned{ ... }blocks. #136
- New
localsConventionvalue'all'— emit the original class name plus the camelCase and dashes-camelCase variants in one pass. - New
localsConventionvalue'none'— emit only the original class name, with no additional aliases. - The function form of
localsConventionmay now return an array of strings. Every entry in the array is added to the locals map and resolves to the same value, which makes it easy to expose a single CSS class under multiple JS-friendly aliases.
Adapted from the unmerged work in #154 by @CarbonORM.
- Replaced Babel with swc across the entire toolchain:
@swc/clicompilessrc/tobuild/,@swc/jesttransforms test files, and ESLint now uses its defaultespreeparser. Removed five@babel/*devDependencies and the unused@babel/registerruntime hook. The publishedbuild/*.jskeeps the samemodule.exports = (opts) => ...; module.exports.postcss = trueshape, so existing CommonJS consumers are unaffected. - Pinned transitive
file-typeto v22 viaoverridesto silence@swc/cli's vulnerable dependency chain.
- Dropped support for Node.js 18. The minimum supported Node.js version is now 20.
- All
devDependenciesbumped to latest:@babel/*7 → 8,eslint7 → 9 (now uses flateslint.config.mjs),eslint-plugin-jest23 → 29,prettier2 → 3,husky4 → 9,lint-staged10 → 17,autoprefixerto 10.5,postcssto 8.5 - Bumped
postcss-modules-local-by-defaultto 4.2 andpostcss-modules-scopeto 3.2.1 - Pinned transitive
globto v12 viaoverrides
- Reformatted source with Prettier 3 (whitespace only)
- Bumped Babel compile target from Node 10 to Node 18
- Dropped support for Node.js 10, 12, 14, and 15. The minimum supported Node.js version is now 18.
- Patched 14 Dependabot security alerts in transitive dependencies (
form-data,lodash,@babel/core,@babel/plugin-transform-modules-systemjs,uuid,picomatch,flatted,minimatch,qs,js-yaml,nanoid) - Bumped
jestfrom 26 to 30 to drop vulnerablenode-notifier,sane, andjsdomchains
- Regenerated Jest snapshots for the new
pretty-formatserializer (cosmetic only; emitted CSS and JSON are unchanged)
- Updated dependencies by Bill Collins (@mrginglymus)
The resolve option has two parameters now and can return null. Thanks to Rene Haas (@KingSora)
https://github.com/madyankin/postcss-modules/commit/86d8135cb5014d0b2848ef395608ee74d82bd179
Parameters:
file— a module we want to resolveimporter— the file that imports the module we want to resolve
Return value: string | null | Promise<string | null>
postcss([
require("postcss-modules")({
resolve: function (file, importer) {
return path.resolve(
path.dirname(importer),
file.replace(/^@/, process.cwd()
);
},
}),
]);- #140 "'Failed to obtain root' error on Windows" fixed by Pierre LeMoine (@DrInfiniteExplorer) #144
icss-replace-symbolsreplaced with withicss-utilsby Jason Quense (@jquense). The updated replacer works better and will replace values in selectors, which didn't work until now. #145
- Fixed
composeson Windows by @sapphi-red #135 - Updated Babel to v7 by @sapphi-red. Minimal supported version of Node.js is 10 from now #134
- Fixed errors when using shorthand selectors by Felix Bruns (@fxb) #130
- Updated the
generic-namesdependency to reduce packages size by Bogdan Chadkin (@TrySound) #129
- Fix the build
- Fixed the
resolveoption behaviour by @kamilic #127
- Added the
resolveoption to configure lookup paths for composes/from by @kamilic #126
- Fixed package contents
- Fixed TypeScript typings by Shuman Lim (@origin-master) #124
- Added TypeScript typings by Shuman Lim (@origin-master) #123
- Upgraded to PostCSS 8 by Evan You (@yyx990803) #114
- Fixed user plugins order by Tom Jenkinson (@tjenkinson) #112
- Fixed an issue when some plugins were running multiple times by Tom Jenkinson (@tjenkinson) #111
- [
localsConventionoption] now supports a custom function(originalClassName: string, generatedClassName: string, inputFile: string) => className: stringby Gregory Waxman (@Akkuma) #109
- Added
exportGlobalsoption
- Dropped
css-modules-loader-coredependency - Upgraded all the dependencies
- Dropped support for unsupported Node versions. Supported versions are 10, 12 and 14+ https://nodejs.org/en/about/releases/
localsConventionoption by Hamza Mihai Daniel (@allocenx) #103, #93
camelCasecamelCase removed, use thelocalsConventionoption instead.
- Added
hashPrefixoption by Jesse Thomson (@jessethomson) #98
- Rebublished the previous release. Sorry :(
- Move dev tools to devDependecies by Anton Khlynovskiy (@ubzey) #85
- Updated dependecies
- Added prettier to format code
- Added option to transform classes to camelCase by Igor Ribeiro (@igor-ribeiro) #82
- Added ability to transmit outputFileName into getJSON by @lutien #72
- Dropped support for Node < 6
- Updated dependencies
- Updated PostCSS to 6 by Alexey Litvinov (@sullenor) #65
- Allowed empty string as opts.root by Sharon Rolel (@Mosho1) #56
- Allow async getJSON by Philipp A. (@flying-sheep) #59
- Added the
rootoption to pass the root path by Sharon Rolel (@Mosho1) (#55)
- Fixed regression in
isValidBehaviourfunction (#53)
- Refactored
getDefaultPluginsListfunction
- Fixed
generateScopedNamebug with multiple postcss-modules instances (#37)
- Added
globalModulePathsoption (Thanks to @pospi). - Refactored all the things.
- Updated dependencies
- Fixed sorting for composed dependencies by Josh Johnston (@joshwnj) (#38)
- Added
scopeBehaviouroption (#22) - Added ability to pass a string to
generateScopedName(#21) - Updated dependencies
- Fixed processing errors capturing by Boris Serdiuk (@just-boris)
- Added support for custom loaders by Björn Brauer (@ZauberNerd)
- Fixed processing for imported CSS
- Added default callback for saving exported JSON
- Fixed JSON export with shallow imports (#12)
- Fixed lookup paths (#13)
- Fixed imports overriding (#15)
- Global refactoring under the hood
Fixed failing on comments by @dfreeman (#14)
Fixed module export for ES5 (#9)
Call getExports only for top level css
Initial version