snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1 @@
/.npm

View File

@@ -0,0 +1,180 @@
import { CssTools } from 'meteor/minifier-css';
import postcss from 'postcss';
import postcssrc from 'postcss-load-config';
import { SourceMapConsumer, SourceMapGenerator } from 'source-map';
let loaded = false;
let postcssConfigPlugins = [];
let postcssConfigParser = null;
let postcssConfigExcludedPackages = [];
const loadPostcssConfig = async () => {
if (loaded) {
return;
}
try {
const config = await postcssrc({ meteor: true });
postcssConfigPlugins = config.plugins || [];
postcssConfigParser = config.options.parser || null;
postcssConfigExcludedPackages = config.options.excludedPackages || [];
} catch (error) {
if (error.message.indexOf('No PostCSS Config found') < 0) {
throw error;
}
} finally {
loaded = true;
}
};
const isImportFile = ({ _source: { url } }) => /\.import\.css$/.test(url) || /(?:^|\/)imports\//.test(url);
const isInExcludedPackages = (pathInBundle) =>
postcssConfigExcludedPackages.some((packageName) => pathInBundle.indexOf(`packages/${packageName.replace(':', '_')}/`) > -1);
const handleFileError = (file, error) => {
if (error.name === 'CssSyntaxError') {
file.error({
message: error.message,
line: error.line,
column: error.column,
});
return;
}
if (error.reason) {
file.error({
message: error.reason,
line: error.line,
column: error.column,
});
return;
}
file.error({ message: error.message });
};
const getAbstractSyntaxTree = async (file) => {
const filename = file.getPathInBundle();
if (isInExcludedPackages(filename)) {
return Object.assign(
CssTools.parseCss(file.getContentsAsString(), {
source: filename,
position: true,
}),
{ filename },
);
}
try {
const postcssResult = await postcss(postcssConfigPlugins).process(file.getContentsAsString(), {
from: process.cwd() + file._source.url,
parser: postcssConfigParser,
});
postcssResult.warnings().forEach((warn) => {
process.stderr.write(warn.toString());
});
return Object.assign(
CssTools.parseCss(postcssResult.css, {
source: filename,
position: true,
}),
{ filename },
);
} catch (error) {
if (error.name === 'CssSyntaxError') {
error.message = `${error.message}\n\nCss Syntax Error.\n\n${error.message}${error.showSourceCode()}`;
}
handleFileError(file, error);
return {
type: 'stylesheet',
stylesheet: {
rules: [],
},
filename,
};
}
};
const mergeCssFiles = async (files) => {
const cssAsts = await Promise.all(files.map(getAbstractSyntaxTree));
const mergedCssAst = CssTools.mergeCssAsts(cssAsts, (filename, msg) => {
console.warn(`${filename}: warn: ${msg}`);
});
const { code, map } = CssTools.stringifyCss(mergedCssAst, {
sourcemap: true,
inputSourcemaps: false,
});
if (!code) {
return {
code: '',
};
}
const mapFilenameToFile = files.reduce(
(obj, file) => ({
...obj,
[file.getPathInBundle()]: file,
}),
{},
);
map.sourcesContent = map.sources.map((filename) => mapFilenameToFile[filename].getContentsAsString());
// yes, this await is needed
const consumer = await new SourceMapConsumer(map);
const newMap = SourceMapGenerator.fromSourceMap(consumer);
consumer.destroy();
files
.filter((file) => file.getSourceMap())
.forEach((file) => {
newMap.applySourceMap(new SourceMapConsumer(file.getSourceMap()), file.getPathInBundle());
});
return {
code,
sourceMap: newMap.toString(),
};
};
const processFilesForBundle = async (files = [], { minifyMode }) => {
if (!files.length) {
return;
}
await loadPostcssConfig();
const filesToMerge = files.filter((file) => !isImportFile(file));
const { code, sourceMap } = await mergeCssFiles(filesToMerge);
if (minifyMode === 'development') {
files[0].addStylesheet({
data: code,
sourceMap,
path: 'merged-stylesheets.css',
});
return;
}
const minifiedFiles = await CssTools.minifyCssAsync(code);
minifiedFiles.forEach((data) => {
files[0].addStylesheet({ data });
});
};
Plugin.registerMinifier({ extensions: ['css'] }, () => ({
processFilesForBundle,
}));

View File

@@ -0,0 +1,15 @@
Package.describe({
name: 'rocketchat:postcss',
version: '1.0.0',
summary: 'CSS post-processing with PostCSS',
});
Package.registerBuildPlugin({
name: 'postcss',
use: ['ecmascript', 'minifier-css'],
sources: ['build.js'],
});
Package.onUse((api) => {
api.use('isobuild:minifier-plugin@1.0.0');
});