diff --git a/.github/actions/build-docker/action.yml b/.github/actions/build-docker/action.yml index 1bc8542e20464..a11733027bae5 100644 --- a/.github/actions/build-docker/action.yml +++ b/.github/actions/build-docker/action.yml @@ -82,8 +82,6 @@ runs: swc_arch='arm64' fi - find /tmp/build/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc -type d -name 'core-*' -not -name "*linux-${swc_arch}-gnu*" -exec rm -rf {} + - find /tmp/build/bundle/programs/server/npm/node_modules/@img -type d -name 'sharp-*' -not -name "*-linuxmusl-${swc_arch}" -exec rm -rf {} + find /tmp/build/bundle/programs/server/npm/node_modules/@napi-rs -type d -name 'pinyin-linux-*' -not -name "*-linux-${swc_arch}-*" -exec rm -rf {} + diff --git a/apps/meteor/.meteor/packages b/apps/meteor/.meteor/packages index 0b6c97b193712..757831b7a1bea 100644 --- a/apps/meteor/.meteor/packages +++ b/apps/meteor/.meteor/packages @@ -7,33 +7,33 @@ rocketchat:mongo-config rocketchat:livechat rocketchat:version -accounts-base@3.1.2 +accounts-base@3.2.0 accounts-facebook@1.3.4 accounts-google@1.4.1 accounts-meteor-developer@1.5.1 accounts-oauth@1.4.6 -accounts-password@3.2.1 +accounts-password@3.2.2 accounts-twitter@1.5.2 google-oauth@1.4.5 oauth@3.0.2 oauth2@1.3.3 -check@1.4.4 +check@1.5.0 ddp-rate-limiter@1.2.2 rate-limit@1.1.2 email@3.1.2 meteor-base@1.5.2 ddp-common@1.4.4 -webapp@2.0.7 +webapp@2.1.0 -mongo@2.1.4 +mongo@2.2.0 reload@1.3.2 service-configuration@1.3.5 session@1.2.2 -shell-server@0.6.2 +shell-server@0.7.0 dispatch:run-as-user ostrio:cookies @@ -50,11 +50,10 @@ tracker@1.3.4 reactive-dict@1.3.2 reactive-var@1.0.13 -babel-compiler@7.12.2 -standard-minifier-css@1.9.3 +standard-minifier-css@1.10.0 dynamic-import@0.7.4 -ecmascript@0.16.13 -typescript@5.6.6 +ecmascript@0.17.0 +typescript@5.9.3 autoupdate@2.0.1 diff --git a/apps/meteor/.meteor/release b/apps/meteor/.meteor/release index 4876d6ff64c16..703a72252657a 100644 --- a/apps/meteor/.meteor/release +++ b/apps/meteor/.meteor/release @@ -1 +1 @@ -METEOR@3.3.2 +METEOR@3.4 diff --git a/apps/meteor/.meteor/versions b/apps/meteor/.meteor/versions index 91adcc4d4e5f2..d83c4802bcf32 100644 --- a/apps/meteor/.meteor/versions +++ b/apps/meteor/.meteor/versions @@ -1,19 +1,19 @@ -accounts-base@3.1.2 +accounts-base@3.2.0 accounts-facebook@1.3.4 accounts-google@1.4.1 accounts-meteor-developer@1.5.1 accounts-oauth@1.4.6 -accounts-password@3.2.1 +accounts-password@3.2.2 accounts-twitter@1.5.2 allow-deny@2.1.0 autoupdate@2.0.1 -babel-compiler@7.12.2 +babel-compiler@7.13.0 babel-runtime@1.5.2 base64@1.0.13 binary-heap@1.0.12 -boilerplate-generator@2.0.2 +boilerplate-generator@2.1.0 callback-hook@1.6.1 -check@1.4.4 +check@1.5.0 core-runtime@1.0.0 ddp@1.4.2 ddp-client@3.1.1 @@ -23,7 +23,7 @@ ddp-server@3.1.2 diff-sequence@1.1.3 dispatch:run-as-user@1.1.1 dynamic-import@0.7.4 -ecmascript@0.16.13 +ecmascript@0.17.0 ecmascript-runtime@0.8.3 ecmascript-runtime-client@0.12.3 ecmascript-runtime-server@0.11.1 @@ -41,16 +41,16 @@ id-map@1.2.0 inter-process-messaging@0.1.2 localstorage@1.2.1 logging@1.3.6 -meteor@2.1.1 +meteor@2.2.0 meteor-base@1.5.2 meteor-developer-oauth@1.3.3 meteorhacks:inject-initial@1.0.5 minifier-css@2.0.1 -minimongo@2.0.4 +minimongo@2.0.5 modern-browsers@0.2.3 modules@0.20.3 modules-runtime@0.13.2 -mongo@2.1.4 +mongo@2.2.0 mongo-decimal@0.2.0 mongo-dev-server@1.1.1 mongo-id@1.0.9 @@ -63,7 +63,7 @@ ostrio:cookies@2.7.2 promise@1.0.0 random@1.2.2 rate-limit@1.1.2 -react-fast-refresh@0.2.9 +react-fast-refresh@0.3.0 reactive-dict@1.3.2 reactive-var@1.0.13 reload@1.3.2 @@ -75,15 +75,15 @@ routepolicy@1.1.2 service-configuration@1.3.5 session@1.2.2 sha@1.0.10 -shell-server@0.6.2 +shell-server@0.7.0 socket-stream-client@0.6.1 -standard-minifier-css@1.9.3 +standard-minifier-css@1.10.0 tracker@1.3.4 twitter-oauth@1.3.4 -typescript@5.6.6 +typescript@5.9.3 underscore@1.6.4 url@1.3.5 -webapp@2.0.7 +webapp@2.1.0 webapp-hashing@1.1.2 zodern:caching-minifier@0.5.0 zodern:standard-minifier-js@5.3.1 diff --git a/apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts b/apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts index fabe8cae7688d..d4b1a68af5796 100644 --- a/apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts +++ b/apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts @@ -1,7 +1,8 @@ +import { transformSync } from '@babel/core'; +import presetEnv from '@babel/preset-env'; import type { IUser, INewOutgoingIntegration, IOutgoingIntegration, IUpdateOutgoingIntegration } from '@rocket.chat/core-typings'; import { Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { pick } from '@rocket.chat/tools'; -import { Babel } from 'meteor/babel-compiler'; import { Match } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; @@ -179,13 +180,15 @@ export const validateOutgoingIntegration = async function ( integration.script.trim() !== '' ) { try { - const babelOptions = Object.assign(Babel.getDefaultOptions({ runtime: false }), { + const result = transformSync(integration.script, { + presets: [presetEnv], compact: true, minified: true, comments: false, }); - integrationData.scriptCompiled = Babel.compile(integration.script, babelOptions).code; + // TODO: Webhook Integration Editor should inform the user if the script is compiled successfully + integrationData.scriptCompiled = result?.code ?? undefined; integrationData.scriptError = undefined; } catch (e) { integrationData.scriptCompiled = undefined; diff --git a/apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts b/apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts index a64e0c40c7afe..3a7a48835a427 100644 --- a/apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts +++ b/apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts @@ -1,9 +1,10 @@ +import { transformSync } from '@babel/core'; +import presetEnv from '@babel/preset-env'; import type { INewIncomingIntegration, IIncomingIntegration } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Integrations, Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { Random } from '@rocket.chat/random'; import { removeEmpty } from '@rocket.chat/tools'; -import { Babel } from 'meteor/babel-compiler'; import { Match, check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import _ from 'underscore'; @@ -111,10 +112,15 @@ export const addIncomingIntegration = async (userId: string, integration: INewIn integration.script.trim() !== '' ) { try { - let babelOptions = Babel.getDefaultOptions({ runtime: false }); - babelOptions = _.extend(babelOptions, { compact: true, minified: true, comments: false }); + const result = transformSync(integration.script, { + presets: [presetEnv], + compact: true, + minified: true, + comments: false, + }); - integrationData.scriptCompiled = Babel.compile(integration.script, babelOptions).code; + // TODO: Webhook Integration Editor should inform the user if the script is compiled successfully + integrationData.scriptCompiled = result?.code ?? undefined; delete integrationData.scriptError; } catch (e) { integrationData.scriptCompiled = undefined; diff --git a/apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts b/apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts index 9e63ce5473b86..5ce2ffd4496aa 100644 --- a/apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts +++ b/apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts @@ -1,10 +1,10 @@ +import { transformSync } from '@babel/core'; +import presetEnv from '@babel/preset-env'; import type { IIntegration, INewIncomingIntegration, IUpdateIncomingIntegration } from '@rocket.chat/core-typings'; import type { ServerMethods } from '@rocket.chat/ddp-client'; import { Integrations, Subscriptions, Users, Rooms } from '@rocket.chat/models'; import { wrapExceptions } from '@rocket.chat/tools'; -import { Babel } from 'meteor/babel-compiler'; import { Meteor } from 'meteor/meteor'; -import _ from 'underscore'; import { addUserRolesAsync } from '../../../../../server/lib/roles/addUserRoles'; import { hasAllPermissionAsync, hasPermissionAsync } from '../../../../authorization/server/functions/hasPermission'; @@ -90,10 +90,15 @@ export const updateIncomingIntegration = async ( if (integration.scriptEnabled === true && integration.script && integration.script.trim() !== '') { try { - let babelOptions = Babel.getDefaultOptions({ runtime: false }); - babelOptions = _.extend(babelOptions, { compact: true, minified: true, comments: false }); + const result = transformSync(integration.script, { + presets: [presetEnv], + compact: true, + minified: true, + comments: false, + }); - scriptCompiled = Babel.compile(integration.script, babelOptions).code; + // TODO: Webhook Integration Editor should inform the user if the script is compiled successfully + scriptCompiled = result?.code ?? undefined; scriptError = undefined; await Integrations.updateOne( { _id: integrationId }, diff --git a/apps/meteor/package.json b/apps/meteor/package.json index f143d0b9cedf9..62c902ab2b334 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -69,6 +69,8 @@ "@aws-sdk/client-s3": "^3.862.0", "@aws-sdk/lib-storage": "^3.862.0", "@aws-sdk/s3-request-presigner": "^3.862.0", + "@babel/core": "~7.28.6", + "@babel/preset-env": "~7.28.6", "@babel/runtime": "~7.28.6", "@bugsnag/js": "~7.20.2", "@bugsnag/plugin-react": "~7.19.0", @@ -311,8 +313,6 @@ }, "devDependencies": { "@axe-core/playwright": "^4.10.2", - "@babel/core": "~7.28.6", - "@babel/preset-env": "~7.28.6", "@babel/preset-react": "~7.27.1", "@babel/register": "~7.28.6", "@faker-js/faker": "~8.0.2", @@ -334,6 +334,7 @@ "@testing-library/user-event": "~14.6.1", "@types/adm-zip": "^0.5.7", "@types/archiver": "~6.0.4", + "@types/babel__preset-env": "^7.10.0", "@types/bad-words": "^3.0.3", "@types/bcrypt": "^5.0.2", "@types/body-parser": "^1.19.6", diff --git a/yarn.lock b/yarn.lock index fdab5e3202e81..2beab8dce4d86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10071,6 +10071,7 @@ __metadata: "@testing-library/user-event": "npm:~14.6.1" "@types/adm-zip": "npm:^0.5.7" "@types/archiver": "npm:~6.0.4" + "@types/babel__preset-env": "npm:^7.10.0" "@types/bad-words": "npm:^3.0.3" "@types/bcrypt": "npm:^5.0.2" "@types/body-parser": "npm:^1.19.6" @@ -13703,6 +13704,13 @@ __metadata: languageName: node linkType: hard +"@types/babel__preset-env@npm:^7.10.0": + version: 7.10.0 + resolution: "@types/babel__preset-env@npm:7.10.0" + checksum: 10/7d4d12758d89708afe327079d7d7580e8af3292295f087b8a9a48e12ac1d90aadc18ac3bc00f9b0cbc8778f3ce9fe778801d4d49b7691a75e3f13a901b69fd07 + languageName: node + linkType: hard + "@types/babel__template@npm:*": version: 7.4.1 resolution: "@types/babel__template@npm:7.4.1"