Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
postcss: Type-check PostCSS configuration.
Anders Kaseorgd8c0eb91c1fe
diff --git a/package.json b/package.jsonindex 542a7cae9dd..ab6a4bd2b83 100644--- a/package.json+++ b/package.json@@ -154,6 +154,7 @@"mockdate": "^3.0.2","nyc": "^17.0.0","openapi-examples-validator": "^6.0.1",+ "postcss-load-config": "^6.0.1","preact": "^10.24.3","prettier": "~3.5.3","prettier-plugin-astro": "^0.14.1",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7210f8d4192..f8ef81a8888 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -483,6 +483,9 @@ importers:openapi-examples-validator:specifier: ^6.0.1version: 6.0.3+ postcss-load-config:+ specifier: ^6.0.1preact:specifier: ^10.24.3version: 10.27.1@@ -7449,6 +7452,24 @@ packages:peerDependencies:postcss: ^8.4+ resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==}+ engines: {node: '>= 18'}+ peerDependencies:+ jiti: '>=1.21.0'+ postcss: '>=8.0.9'+ tsx: ^4.8.1+ yaml: ^2.4.2+ peerDependenciesMeta:+ jiti:+ optional: true+ postcss:+ optional: true+ tsx:+ optional: true+ yaml:+ optional: true+resolution: {integrity: sha512-tHX+RkpsXVcc7st4dSdDGliI+r4aAQDuv+v3vFYHixb6YgjreG5AG4SEB0kDK8u2s6htqEEpKlkhSBUTvWKYnA==}engines: {node: '>= 18.12.0'}@@ -18314,6 +18335,14 @@ snapshots:'@csstools/utilities': 2.0.0([email protected])postcss: 8.5.6+ dependencies:+ lilconfig: 3.1.3+ optionalDependencies:+ jiti: 2.5.1+ postcss: 8.5.6+ yaml: 2.8.1+dependencies:cosmiconfig: 9.0.0([email protected])diff --git a/version.py b/version.pyindex 91da392550b..a886af5ab37 100644--- a/version.py+++ b/version.py@@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 425# historical commits sharing the same major version, in which case a# minor version bump suffices.-PROVISION_VERSION = (347, 4) # bumped 2025-09-09 to add @types/babel__core, @types/babel__preset-env+PROVISION_VERSION = (347, 5) # bumped 2025-09-09 to add postcss-load-configdiff --git a/web/postcss.config.js b/web/postcss.config.jsindex 44380e44248..5d33750dede 100644--- a/web/postcss.config.js+++ b/web/postcss.config.js@@ -1,3 +1,5 @@+// @ts-check+import path from "node:path";import postcssExtendRule from "postcss-extend-rule";@@ -8,9 +10,19 @@ import postcssSimpleVars from "postcss-simple-vars";import {container_breakpoints, media_breakpoints} from "./src/css_variables.ts";-const config = ({file}) => ({+/**+ * @param {object} ctx+ * @returns {import("postcss-load-config").Config}+ * @satisfies {import("postcss-load-config").ConfigFn & import("postcss-loader/dist/config").PostCSSLoaderOptions}+ */+const config = (ctx) => ({plugins: [- (file.basename ?? path.basename(file)) === "dark_theme.css" &&+ "file" in ctx &&+ (typeof ctx.file === "string"+ ? path.basename(ctx.file)+ : typeof ctx.file === "object" && ctx.file !== null && "basename" in ctx.file+ ? ctx.file.basename+ : undefined) === "dark_theme.css" &&// Add postcss-import plugin with postcss-prefixwrap to handle// the flatpickr dark theme. We do this because flatpickr themes// are not scoped. See https://github.com/flatpickr/flatpickr/issues/2168.diff --git a/web/src/types/postcss-extend-rule.d.ts b/web/src/types/postcss-extend-rule.d.tsnew file mode 100644index 00000000000..93cbfd75480--- /dev/null+++ b/web/src/types/postcss-extend-rule.d.ts@@ -0,0 +1,10 @@+import type {PluginCreator} from "postcss";++export type PostCSSExtendRuleOptions = {+ onFunctionalSelector?: "remove" | "ignore" | "warn" | "throw";+ onRecursiveExtend?: "remove" | "ignore" | "warn" | "throw";+ onUnusedExtend?: "remove" | "ignore" | "warn" | "throw";+};++declare const postcssExtendRule: PluginCreator<PostCSSExtendRuleOptions>;+export default postcssExtendRule;diff --git a/web/src/types/postcss-import.d.ts b/web/src/types/postcss-import.d.tsnew file mode 100644index 00000000000..af2f9ff0ebe--- /dev/null+++ b/web/src/types/postcss-import.d.ts@@ -0,0 +1,21 @@+import type {AcceptedPlugin, PluginCreator} from "postcss";++export type PostCSSImportOptions = {+ filter?: (path: string) => boolean;+ root?: string;+ path?: string | string[];+ plugins?: AcceptedPlugin[];+ resolve?: (+ id: string,+ basedir: string,+ importOptions: PostCSSImportOptions,+ astNode: unknown,+ ) => string | string[] | Promise<string | string[]>;+ load?: (filename: string, importOptions: PostCSSImportOptions) => string | Promise<string>;+ skipDuplicates?: boolean;+ addModulesDirectories?: string[];+ warnOnEmpty?: boolean;+};++declare const postcssImport: PluginCreator<PostCSSImportOptions>;+export default postcssImport;