Releases: TeamSupercell/typings-for-css-modules-loader
Releases · TeamSupercell/typings-for-css-modules-loader
Release 2.5.2
No code changes in this release, upgrading the dependencies to resolve all security audit alerts
- Move CI to Github actions
#84
- Upgrade dependencies
#83
- https://github.com/TeamSupercell/typings-for-css-modules-loader/issue…
#74
- Update dependencies
ee02894
- Move CI to github actions
fae780f
- #73 Update loader-utils library to the latest patch version with the fix, don't want to upgrade to the latest available version as it two major versions up and I'm not in this repo code and can't guarantee I this update will be smooth.
713a8f7
Release 2.5.1
v2.4.0
v2.3.0
V2.2.1
V2.2.0
- New option
disableLocalsExport
#23 by @raphael-leger
An option to not concatenate a type with alocals
key in generatedd.ts
files. Defaults tofalse
- Fix conflicting names in d.ts when linter is configured with
no-redeclare
#21 by @raphael-leger
v2.1.1
New verifyOnly
option
Validate generated *.d.ts
files and fail if an update is needed (useful in CI).
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
{
loader: "@teamsupercell/typings-for-css-modules-loader",
options: {
verifyOnly: process.env.NODE_ENV === 'production'
}
},
{
loader: "css-loader",
options: { modules: true }
}
]
}
]
}
};
v2.1.0
New template for generated files to avoid issues with the requirement to use default imports in environments that don't have esModuleInterop
enabled (PR #14) fixes #8
Example:
// generated d.ts
declare namespace ExampleCssModule {
export interface IExampleCss {
"bar-baz": string;
composed: string;
foo: string;
}
}
declare const ExampleCssModule: ExampleCssModule.IExampleCss & {
/** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */
locals: ExampleCssModule.IExampleCss;
};
export = ExampleCssModule;
This type declaration allows the following usage:
import * as styles from "./example.css";
import { IExampleCss } from "./example.css";
console.log(styles.composed);
// or default import when TS `esModuleInterop` enabled
import styles from "./example.css";
import { IExampleCss } from "./example.css";
console.log(styles.composed);
v2.0.1
v2.0.0
Changes
- Upgrade all dependencies and ensure the loader works with
webpack>=4
andcss-loader>=0.28.11
- Remove babel build - make the loader compatible with Node 8+ without additional build steps.
- Change the loader from being a drop-in replacement of
css-loader
to be used alongsidecss-loader
. - Remove
orderAlphabetically
options - the output keys are sorted by default - Remove
namedExport
andcamelCase
options. Generated type definition files now have default export and can both exportlocals
and support dashes in property names out of box. Example:
export interface IMyComponentScss {
"some-class": string;
someOtherClass: string;
"some-class-sayWhat": string;
}
export const locals: IExampleCss;
export default locals;
- Use the built-in webpack logger to report errors. Remove the
silent
options because it becomes redundant - Add a new
formatter
option to allow formatting the generated files withprettier
. That should solve theeol
issues and apply consistent code style with other files in the code base.
Upgrade guide:
- Update webpack config
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "@teamsupercell/typings-for-css-modules-loader",
options: {
// pass all the options for `css-loader` to `css-loader`, eg.
- namedExport: true
}
},
+ {
+ loader: "css-loader",
+ options: {
+ namedExport: true
+ }
+ },
]
}
]
}
};
- ensure all the typescript files import styles as default
- import * as styles from './styles.css';
+ import styles from './styles.css';
- add
allowSyntheticDefaultImports
TypeScript compiler option if there are type errors related to default imports