Skip to content

Commit b917bc5

Browse files
committed
Merge remote-tracking branch 'origin/master' into release-8.7.0
# Conflicts: # apps/meteor/CHANGELOG.md # apps/meteor/app/utils/rocketchat.info # apps/meteor/package.json # apps/meteor/server/api/v1/channels.ts # apps/meteor/server/api/v1/teams.ts # apps/meteor/server/lib/saml/lib/parsers/Response.ts # apps/meteor/server/models.ts # apps/meteor/tests/unit/server/lib/saml/server.tests.ts # package.json # packages/apps-engine/CHANGELOG.md # packages/apps-engine/package.json # packages/core-typings/CHANGELOG.md # packages/core-typings/package.json # packages/core-typings/src/index.ts # packages/model-typings/CHANGELOG.md # packages/model-typings/package.json # packages/model-typings/src/index.ts # packages/models/CHANGELOG.md # packages/models/package.json # packages/models/src/index.ts # packages/rest-typings/CHANGELOG.md # packages/rest-typings/package.json
2 parents 1e2f96a + bfd7823 commit b917bc5

23 files changed

Lines changed: 1652 additions & 1 deletion

.serena/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/cache
2+
/project.local.yml

.serena/project.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# the name by which the project can be referenced within Serena/when chatting with the LLM.
2+
project_name: "Rocket.Chat"
3+
4+
# the encoding used by text files in the project
5+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
6+
encoding: "utf-8"
7+
8+
# optional shell command to run before the language backend (LSP or JetBrains) is initialised.
9+
# the command runs in the project root directory and is only executed if the project is trusted
10+
# (see trusted_project_path_patterns in the global configuration).
11+
# serena waits for the command to exit: a non-zero exit code is logged as an error but does not
12+
# abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
13+
# backstop for non-terminating commands; on expiry the process is killed and activation continues.
14+
# example: activation_command: "npx nx run-many -t build"
15+
activation_command:
16+
17+
# maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
18+
# must be a positive number.
19+
activation_command_timeout: 180.0
20+
21+
# line ending convention to use when writing source files.
22+
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
23+
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
24+
line_ending:
25+
26+
# The language backend to use for this project.
27+
# If not set, the global setting from serena_config.yml is used.
28+
# Valid values: LSP, JetBrains
29+
# Note: the backend is fixed at startup. If a project with a different backend
30+
# is activated post-init, an error will be returned.
31+
language_backend:
32+
33+
# whether to use project's .gitignore files to ignore files
34+
ignore_all_files_in_gitignore: true
35+
36+
# advanced configuration option allowing to configure language server-specific options.
37+
# Maps the language key to the options.
38+
# The settings are considered only if the project is trusted (see global configuration to define trusted projects).
39+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
40+
ls_specific_settings: {}
41+
42+
# list of workspace folder paths (LSP backend only).
43+
# These folders will be used to build up Serena's symbol index.
44+
# Paths must be within the project root and should thus be relative to the project root.
45+
# Furthermore, the paths should not be filtered by ignore settings.
46+
# Default setting: The entire project root folder (".") is considered.
47+
# In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
48+
# ls_workspace_folders:
49+
# - "./subproject1"
50+
# - "./subproject2"
51+
ls_workspace_folders:
52+
- "."
53+
54+
# list of additional workspace folder paths for cross-package reference support.
55+
# Paths can be absolute or relative to the project root.
56+
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
57+
# symbols and references across package boundaries, but these folders are not indexed by Serena,
58+
# i.e. the respective symbols will not be found using Serena's symbol search tools.
59+
# Example:
60+
# additional_workspace_folders:
61+
# - ../sibling-package
62+
# - ../shared-lib
63+
ls_additional_workspace_folders: []
64+
65+
# list of additional paths to ignore in this project.
66+
# Same syntax as gitignore, so you can use * and **.
67+
# Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
68+
# Example:
69+
# ignored_paths:
70+
# - "examples/**"
71+
# - ".worktrees/**"
72+
# - "**/bin/**"
73+
# - "**/obj/**"
74+
# Note: global ignored_paths from serena_config.yml are also applied additively.
75+
ignored_paths: []
76+
77+
# whether the project is in read-only mode
78+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
79+
# Added on 2025-04-18
80+
read_only: false
81+
82+
# list of tool names to exclude.
83+
# This extends the existing exclusions (e.g. from the global configuration)
84+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
85+
excluded_tools: []
86+
87+
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
88+
# This extends the existing inclusions (e.g. from the global configuration).
89+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
90+
included_optional_tools: []
91+
92+
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
93+
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
94+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
95+
fixed_tools: []
96+
97+
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
98+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
99+
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
100+
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
101+
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
102+
# for this project.
103+
# This setting can, in turn, be overridden by CLI parameters (--mode).
104+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
105+
default_modes:
106+
107+
# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
108+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
109+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
110+
added_modes:
111+
112+
# initial prompt for the project. It will always be given to the LLM upon activating the project
113+
# (contrary to the memories, which are loaded on demand).
114+
initial_prompt: ""
115+
116+
# time budget (seconds) per tool call for the retrieval of additional symbol information
117+
# such as docstrings or parameter information.
118+
# This overrides the corresponding setting in the global configuration; see the documentation there.
119+
# If null or missing, use the setting from the global configuration.
120+
symbol_info_budget:
121+
122+
# list of regex patterns which, when matched, mark a memory entry as read‑only.
123+
# Extends the list from the global configuration, merging the two lists.
124+
read_only_memory_patterns: []
125+
126+
# list of regex patterns for memories to completely ignore.
127+
# Matching memories will not appear in list_memories or activate_project output
128+
# and cannot be accessed via read_memory or write_memory.
129+
# To access ignored memory files, use the read_file tool on the raw file path.
130+
# Extends the list from the global configuration, merging the two lists.
131+
# Example: ["_archive/.*", "_episodes/.*"]
132+
ignored_memory_patterns: []
133+
134+
# list of language servers to start when using the LSP backend; choose from:
135+
# ada al angular ansible bash
136+
# bsl clojure cpp cpp_ccls crystal
137+
# csharp csharp_omnisharp cue dart elixir
138+
# elm erlang fortran fsharp gdscript
139+
# go groovy haskell haxe hlsl
140+
# html java json julia kotlin
141+
# latex lean4 lua luau markdown
142+
# matlab msl nix ocaml pascal
143+
# perl php php_phpactor php_phpantom powershell
144+
# python python_jedi python_pyrefly python_ty r
145+
# rego ruby ruby_solargraph rust scala
146+
# scss solidity svelte swift systemverilog
147+
# terraform toml typescript typescript_vts vue
148+
# yaml zig
149+
# (This list may be outdated; generated with scripts/print_language_list.py;
150+
# For the current list, see values of Language enum here:
151+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
152+
# For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
153+
# Note:
154+
# - For C, use cpp
155+
# - For JavaScript, use typescript
156+
# - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
157+
# - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
158+
# - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
159+
# - For Free Pascal/Lazarus, use pascal
160+
# Special requirements:
161+
# Some language servers require additional setup/installations.
162+
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
163+
# When using multiple language servers, the first language server that supports a given file will be used for that file.
164+
# The first language server is the default language and the respective language server will be used as a fallback.
165+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
166+
language_servers:
167+
- typescript
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "babel-plugin-box-atomic",
3+
"version": "0.0.0",
4+
"main": "plugin.cjs",
5+
"private": true
6+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/**
2+
* PoC Babel plugin: build-time atomic extraction for <Box>.
3+
*
4+
* For every <Box> whose styling props are static literals, resolve them to
5+
* atomic class names at build time, strip the props, and add a plain
6+
* `className`. Non-literal props (expressions) are left untouched and handled
7+
* by the runtime atomic path.
8+
*
9+
* The resolved CSS rules are surfaced two ways:
10+
* options.sheet : Map<className, css> — collected out-of-band (tests/demo)
11+
* options.inject : boolean — when true, each file gets a top-of-
12+
* module `attachRules("<its rules>")` call, so the CSS lands
13+
* in the page at module load with no external asset. Sharing
14+
* across files is deduped/ref-counted by attachRules.
15+
*
16+
* Resolution defaults to the bundled snapshot of Fuselage's real runtime
17+
* resolver (resolver.generated.cjs) so the plugin is drop-in: a consumer adds
18+
* just this plugin, no wiring. Both can be overridden via options for tests:
19+
* options.styleProps : string[] — recognised styling prop names
20+
* options.resolve : (props) => { className, css }[]
21+
*/
22+
// Lazily loaded so requiring the plugin never fails if the snapshot is absent
23+
// (e.g. before the first esbuild bundle); only needed when resolve is omitted.
24+
let bundled;
25+
const getBundled = () => {
26+
// eslint-disable-next-line @typescript-eslint/no-require-imports
27+
if (!bundled) bundled = require('./resolver.generated.cjs');
28+
return bundled;
29+
};
30+
31+
// CANARY (temporary): fires when Meteor merely REQUIRES this module (before any
32+
// transform), proving resolution independent of the babel cache.
33+
try {
34+
require('fs').appendFileSync(
35+
'/tmp/box-atomic-canary.log',
36+
`[${process.pid}] module required ${new Date().toISOString()}\n`,
37+
);
38+
} catch (_) {}
39+
40+
module.exports = function boxAtomicPlugin({ types: t }) {
41+
// CANARY (temporary): proves Meteor loads this plugin, and counts compiled
42+
// <Box> across the build. Remove after verifying.
43+
if (!global.__RCX_BOX_PLUGIN) {
44+
global.__RCX_BOX_PLUGIN = { loaded: true, boxes: 0 };
45+
try {
46+
require('fs').appendFileSync(
47+
'/tmp/box-atomic-canary.log',
48+
`[${process.pid}] plugin loaded ${new Date().toISOString()}\n`,
49+
);
50+
} catch (_) {}
51+
console.error('[box-atomic] plugin loaded by babel');
52+
}
53+
54+
const staticValue = (node) => {
55+
if (node === null) return true; // boolean shorthand: <Box invisible />
56+
if (t.isStringLiteral(node)) return node.value;
57+
if (t.isJSXExpressionContainer(node)) {
58+
const { expression: e } = node;
59+
if (
60+
t.isStringLiteral(e) ||
61+
t.isNumericLiteral(e) ||
62+
t.isBooleanLiteral(e)
63+
)
64+
return e.value;
65+
}
66+
return undefined; // dynamic — leave for runtime
67+
};
68+
69+
return {
70+
name: 'fuselage-box-atomic',
71+
pre() {
72+
this.rules = new Map(); // className -> css, for this file
73+
},
74+
visitor: {
75+
JSXOpeningElement(path, state) {
76+
const { sheet } = state.opts;
77+
// Safe default: keep props on the element (runtime skips them via the
78+
// marker, so the render-CPU win is preserved) because whether a prop is
79+
// introspected elsewhere (cloneElement, child.props.x, spread) can't be
80+
// proven statically. Full stripping is opt-in via keepProps:false.
81+
const keepProps = state.opts.keepProps !== false;
82+
const resolve = state.opts.resolve || getBundled().resolve;
83+
const styleProps = state.opts.styleProps || getBundled().styleProps;
84+
const propSet = new Set(styleProps);
85+
86+
if (!t.isJSXIdentifier(path.node.name, { name: 'Box' })) return;
87+
88+
const collected = {};
89+
const toRemove = [];
90+
91+
for (const attr of path.node.attributes) {
92+
if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name))
93+
continue;
94+
if (!propSet.has(attr.name.name)) continue;
95+
96+
const value = staticValue(attr.value);
97+
if (value === undefined) continue; // dynamic prop stays
98+
99+
collected[attr.name.name] = value;
100+
toRemove.push(attr);
101+
}
102+
103+
if (toRemove.length === 0) return;
104+
105+
let resolved;
106+
try {
107+
resolved = resolve(collected);
108+
} catch (_) {
109+
return; // resolver failure → leave this Box to the runtime
110+
}
111+
if (!resolved || resolved.length === 0) return;
112+
113+
global.__RCX_BOX_PLUGIN.boxes++; // CANARY
114+
115+
const classNames = resolved.map((r) => r.className);
116+
for (const { className, css } of resolved) {
117+
if (sheet && !sheet.has(className)) sheet.set(className, css);
118+
if (!this.rules.has(className)) this.rules.set(className, css);
119+
}
120+
121+
if (keepProps) {
122+
// Keep the props on the element so runtime introspection (e.g.
123+
// `child.props.bg`, spreads) still works; mark which props are
124+
// already compiled so the runtime skips restyling them.
125+
path.node.attributes.push(
126+
t.jsxAttribute(
127+
t.jsxIdentifier('data-rcx-atomic'),
128+
t.stringLiteral(Object.keys(collected).join(' ')),
129+
),
130+
);
131+
} else {
132+
path.node.attributes = path.node.attributes.filter(
133+
(a) => !toRemove.includes(a),
134+
);
135+
}
136+
137+
const classString = classNames.join(' ');
138+
const existing = path.node.attributes.find(
139+
(a) =>
140+
t.isJSXAttribute(a) &&
141+
t.isJSXIdentifier(a.name, { name: 'className' }),
142+
);
143+
144+
if (!existing) {
145+
path.node.attributes.push(
146+
t.jsxAttribute(
147+
t.jsxIdentifier('className'),
148+
t.stringLiteral(classString),
149+
),
150+
);
151+
return;
152+
}
153+
154+
if (t.isStringLiteral(existing.value)) {
155+
existing.value = t.stringLiteral(
156+
`${classString} ${existing.value.value}`,
157+
);
158+
return;
159+
}
160+
161+
// className is an expression: prepend our static classes
162+
if (t.isJSXExpressionContainer(existing.value)) {
163+
existing.value = t.jsxExpressionContainer(
164+
t.binaryExpression(
165+
'+',
166+
t.stringLiteral(`${classString} `),
167+
existing.value.expression,
168+
),
169+
);
170+
}
171+
},
172+
Program: {
173+
exit(path, state) {
174+
if (!state.opts.inject || this.rules.size === 0) return;
175+
176+
const css = [...this.rules.values()].join('\n');
177+
const attach = path.scope.generateUidIdentifier('rcxAttach');
178+
179+
path.unshiftContainer('body', [
180+
t.importDeclaration(
181+
[t.importSpecifier(attach, t.identifier('attachRules'))],
182+
t.stringLiteral('@rocket.chat/css-in-js'),
183+
),
184+
t.expressionStatement(
185+
t.callExpression(attach, [t.stringLiteral(css)]),
186+
),
187+
]);
188+
},
189+
},
190+
},
191+
};
192+
};

0 commit comments

Comments
 (0)