@plaudit/webpack-extensions 3.10.0 → 3.11.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.11.0] - 2026-06-22
9
+ ### Added
10
+ - Logic to allow our internal PostCSS plugins to be "optional"
11
+
8
12
  ## [3.10.0] - 2026-06-15
9
13
  ### Added
10
14
  - Support for emitting namespaced code
@@ -13,21 +13,32 @@ function makeDefaultPostCSSFunctions(variables) {
13
13
  }
14
14
  };
15
15
  }
16
+ function unsafeRequire(id) {
17
+ try {
18
+ return require(id);
19
+ }
20
+ catch (e) {
21
+ if (typeof e === 'object' && !!e && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
22
+ return undefined;
23
+ }
24
+ throw e;
25
+ }
26
+ }
16
27
  function postcssConfigBuilder(variables, postCSSFunctions) {
17
28
  return {
18
29
  plugins: [
19
- require("postcss-import")(), // Once
20
- require("postcss-mixins")(), // Once
21
- require("@plaudit/postcss-variables")({ variables }), // Once
22
- require("postcss-functions")({ functions: { ...makeDefaultPostCSSFunctions(variables), ...postCSSFunctions(variables) } }),
23
- require("postcss-property-lookup")({ logLevel: "warn" }), // Rule
24
- require("@plaudit/postcss-strip-units")(), // AtRule, Declaration
25
- require("postcss-nested")(), // Rule
26
- require("postcss-url")(), // This is needed because PostCSS flattens everything to a single file, which break's WebPack's URL resolution unless PostCSS updates the URLs to account for the flattening itself
27
- require("postcss-calc")(calcOptions), // OnceExit
28
- require("@plaudit/postcss-color-function")(), // OnceExit
29
- require("autoprefixer")(autoprefixerOptions), // OnceExit
30
- require("postcss-reporter")({ clearReportedMessages: true }), // OnceExit
31
- ]
30
+ unsafeRequire("postcss-import")(), // Once
31
+ unsafeRequire("postcss-mixins")(), // Once
32
+ unsafeRequire("@plaudit/postcss-variables")?.({ variables }), // Once
33
+ unsafeRequire("postcss-functions")({ functions: { ...makeDefaultPostCSSFunctions(variables), ...postCSSFunctions(variables) } }),
34
+ unsafeRequire("postcss-property-lookup")({ logLevel: "warn" }), // Rule
35
+ unsafeRequire("@plaudit/postcss-strip-units")?.(), // AtRule, Declaration
36
+ unsafeRequire("postcss-nested")(), // Rule
37
+ unsafeRequire("postcss-url")(), // This is needed because PostCSS flattens everything to a single file, which break's WebPack's URL resolution unless PostCSS updates the URLs to account for the flattening itself
38
+ unsafeRequire("postcss-calc")(calcOptions), // OnceExit
39
+ unsafeRequire("@plaudit/postcss-color-function")?.(), // OnceExit
40
+ unsafeRequire("autoprefixer")(autoprefixerOptions), // OnceExit
41
+ unsafeRequire("postcss-reporter")({ clearReportedMessages: true }), // OnceExit
42
+ ].filter(plugin => plugin !== undefined)
32
43
  };
33
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "files": [
6
6
  "/dist",
@@ -31,7 +31,7 @@
31
31
  "@plaudit/gutenberg-api-extensions": "^2.97.1",
32
32
  "@types/browser-sync-webpack-plugin": "^2.2.5",
33
33
  "@types/jsdom": "^28.0.3",
34
- "@types/node": "^25.9.3",
34
+ "@types/node": "^25.9.4",
35
35
  "@types/postcss-functions": "^4.0.4",
36
36
  "@types/postcss-import": "^14.0.3",
37
37
  "@types/tapable": "^2.3.0",
@@ -42,12 +42,12 @@
42
42
  "webpack-bundle-analyzer": "^5.3.0"
43
43
  },
44
44
  "dependencies": {
45
- "@plaudit/php-writer": "^1.5.0",
45
+ "@plaudit/php-writer": "^1.5.2",
46
46
  "@plaudit/postcss-color-function": "^5.1.0",
47
47
  "@plaudit/postcss-strip-units": "^3.0.0",
48
48
  "@plaudit/postcss-variables": "^2.0.1",
49
- "@wordpress/dependency-extraction-webpack-plugin": "^6.48.0",
50
- "@wordpress/scripts": "^32.4.0",
49
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.48.1",
50
+ "@wordpress/scripts": "^32.4.1",
51
51
  "autoprefixer": "^10.5.0",
52
52
  "browser-sync": "^3.0.4",
53
53
  "copy-webpack-plugin": "10.2.4",