@pplancq/postcss-config 2.1.18 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,4 +22,30 @@ npx init-postcss-config
22
22
 
23
23
  ### @pplancq/postcss-config
24
24
 
25
- This is the default configuration. To use, add `module.exports = require('@pplancq/postcss-config');` to your `.postcssrc.js`.
25
+ This is the default configuration. To use it, see the ESM migration section below for the correct syntax.
26
+
27
+ ## ⚠️ Breaking Change: ESM Only from v2
28
+
29
+ As of version 2.x, this package is ESM-only. CommonJS (`require`) is no longer supported.
30
+
31
+ ## Migration from CommonJS to ESM
32
+
33
+ **Old (CommonJS) usage:**
34
+
35
+ ```js
36
+ // .postcssrc.js or postcss.config.js
37
+ module.exports = require('@pplancq/postcss-config');
38
+ ```
39
+
40
+ **New (ESM) usage:**
41
+
42
+ ```js
43
+ // postcss.config.mjs (or postcss.config.js when using "type": "module")
44
+ import defaultConfig from '@pplancq/postcss-config';
45
+
46
+ export default {
47
+ ...defaultConfig,
48
+ };
49
+ ```
50
+
51
+ If you are using a `.js` config file, ensure your environment supports ESM (e.g., Node.js >= 18, or set "type": "module" in your package.json).
package/bin/init.mjs ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { writeFileSync } from 'node:fs';
3
+
4
+ console.info('Add postcss config in postcss.config.mjs');
5
+
6
+ writeFileSync(
7
+ 'postcss.config.mjs',
8
+ `import defaultConfig from '@pplancq/postcss-config';
9
+
10
+ export default {
11
+ ...defaultConfig,
12
+ };
13
+ `,
14
+ { encoding: 'utf-8' },
15
+ );
package/index.js CHANGED
@@ -1,8 +1,10 @@
1
- const postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
2
- const postcssPresetEnv = require('postcss-preset-env');
3
- const postcssNormalize = require('postcss-normalize');
1
+ import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
2
+ // eslint-disable-next-line import/no-unresolved
3
+ import postcssPresetEnv from 'postcss-preset-env';
4
+ import postcssNormalize from 'postcss-normalize';
4
5
 
5
- module.exports = {
6
+ // eslint-disable-next-line import/no-default-export
7
+ export default {
6
8
  ident: 'postcss',
7
9
  config: false,
8
10
  plugins: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pplancq/postcss-config",
3
- "version": "2.1.18",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "description": "pplancq postcss config",
6
6
  "author": "pplancq <paul.plancq@outlook.fr>",
@@ -24,9 +24,10 @@
24
24
  "bugs": {
25
25
  "url": "https://github.com/pplancq/dev-tools/issues"
26
26
  },
27
+ "type": "module",
27
28
  "main": "index.js",
28
29
  "bin": {
29
- "init-postcss-config": "bin/init.js"
30
+ "init-postcss-config": "bin/init.mjs"
30
31
  },
31
32
  "keywords": [
32
33
  "postcss",
@@ -35,16 +36,16 @@
35
36
  "dependencies": {
36
37
  "postcss-flexbugs-fixes": "^5.0.2",
37
38
  "postcss-normalize": "^13.0.1",
38
- "postcss-preset-env": "^10.6.0"
39
+ "postcss-preset-env": "^11.1.1"
39
40
  },
40
41
  "devDependencies": {
41
42
  "eslint": "^9.39.2",
42
- "eslint-plugin-prettier": "^5.5.4",
43
+ "eslint-plugin-prettier": "^5.5.5",
43
44
  "lint-staged": "^16.2.7",
44
- "prettier": "^3.7.4"
45
+ "prettier": "^3.8.1"
45
46
  },
46
47
  "engines": {
47
- "node": ">=18"
48
+ "node": ">=20.19.0"
48
49
  },
49
50
  "prettier": "@pplancq/prettier-config",
50
51
  "lint-staged": {
package/bin/init.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- const { writeFileSync } = require('fs');
3
-
4
- console.info('Add postcss config in .postcssrc.js');
5
-
6
- writeFileSync('.postcssrc.js', "module.exports = require('@pplancq/postcss-config');\n", { encoding: 'utf-8' });