Skip to content

chore: add per-integration scriptTranspile flag to opt-out of Babel#40160

Open
ggazzo wants to merge 1 commit intodevelopfrom
chore/optional-integration-transpile
Open

chore: add per-integration scriptTranspile flag to opt-out of Babel#40160
ggazzo wants to merge 1 commit intodevelopfrom
chore/optional-integration-transpile

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Apr 14, 2026

Summary

Prepares the ground for the 9.0.0 breaking change (removal of Babel transpilation for webhook integration scripts) by letting admins opt-out per integration.

What changes

  • New compileIntegrationScript(script, { transpile }) helper (apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts): centralizes compile-or-validate logic. When transpile: true (default), runs @babel/core + @babel/preset-env. When transpile: false, validates with Node's built-in vm.Script and stores the script as-is — matching the 9.0.0 default.
  • New scriptTranspile?: boolean field on IIncomingIntegration and IOutgoingIntegration (default true). Exposed via rest-typings for Create and Update endpoints.
  • Create/Update methods (incoming + outgoing) now pass integration.scriptTranspile !== false to the compiler and persist the flag on the document.
  • Field is documented as deprecated — removed in 9.0.0 together with the Babel path.

Why per-integration (not global env var)

A single workspace can have dozens of webhook integrations with scripts written by different teams over years. A global env var would be all-or-nothing. With the per-integration flag, admins can:

  1. Flip one integration to scriptTranspile: false in staging
  2. Re-save (triggers recompilation without Babel)
  3. Verify the webhook still fires correctly
  4. Repeat for each integration
  5. Fix any scripts that break
  6. Confidently upgrade to 9.0.0 with scriptTranspile: false set on every integration

API usage

POST /api/v1/integrations.create
{
  "type": "webhook-incoming",
  "name": "My webhook",
  "script": "class Script { process_incoming_request({ request }) { ... } }",
  "scriptEnabled": true,
  "scriptTranspile": false,
  ...
}
POST /api/v1/integrations.update
{
  "integrationId": "...",
  "scriptTranspile": false,
  ...
}

Patterns that break with scriptTranspile: false

Pattern Fix
msg = x (implicit global in class method) const msg = x
function f() { this.JSON } (this in nested function) Use arrow function or pass explicitly
arguments.callee Named function expression
0777 (octal literal) 0o777
function(a, a) (duplicate params) Rename

Test plan

  • TypeScript / lint pass.
  • Default (scriptTranspile unset): Babel transpilation works as before.
  • scriptTranspile: false: scripts stored as-is, syntax errors caught, runtime executes in strict mode.
  • Existing e2e tests pass (both paths).
  • Admin UI can still edit integrations (UI may need a checkbox in a follow-up — not in this PR).

Summary by CodeRabbit

  • New Features

    • Per-integration toggle to skip script transpilation (scriptTranspile, defaults to true), persisted and accepted by the APIs; marked for future removal.
    • Unified script validation/transpile flow for consistent handling across integration create/update operations.
  • Bug Fixes

    • More consistent and structured error reporting for integration script validation and transpilation.

@ggazzo ggazzo requested a review from a team as a code owner April 14, 2026 21:49
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 14, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: c217518

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0bf5a0b-94bf-4ca8-add3-cdcf7c08adfb

📥 Commits

Reviewing files that changed from the base of the PR and between f09729e and c217518.

📒 Files selected for processing (9)
  • .changeset/integration-script-transpile-opt-out.md
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
  • apps/meteor/app/integrations/server/methods/outgoing/updateOutgoingIntegration.ts
  • packages/core-typings/src/IIntegration.ts
  • packages/rest-typings/src/v1/integrations/IntegrationsCreateProps.ts
  • packages/rest-typings/src/v1/integrations/IntegrationsUpdateProps.ts
✅ Files skipped from review due to trivial changes (4)
  • apps/meteor/app/integrations/server/methods/outgoing/updateOutgoingIntegration.ts
  • packages/core-typings/src/IIntegration.ts
  • .changeset/integration-script-transpile-opt-out.md
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/rest-typings/src/v1/integrations/IntegrationsCreateProps.ts
  • packages/rest-typings/src/v1/integrations/IntegrationsUpdateProps.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts

Walkthrough

Centralizes integration script compilation in a new server utility that either validates syntax or transpiles via Babel, updates integration methods/validation to use it, introduces a per-integration scriptTranspile flag (default true), and adds typings, REST schema entries, and a changeset documenting the opt-out.

Changes

Cohort / File(s) Summary
New Compilation Utility
apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
Adds exported compileIntegrationScript(script, { transpile }) that validates script syntax using node:vm.Script or synchronously transpiles with @babel/core/@babel/preset-env; returns { script } or { error: { name, message, stack } }.
Integration Methods & Validation
apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts, apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts, apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts, apps/meteor/app/integrations/server/methods/outgoing/updateOutgoingIntegration.ts
Replaced inline Babel transform logic with calls to compileIntegrationScript(...); added/persisted scriptTranspile (defaults to integration.scriptTranspile !== false); store compiler result in scriptCompiled or scriptError and unset the opposite field; removed direct Babel/pick/underscore imports where applicable.
API Types
packages/core-typings/src/IIntegration.ts
Added optional scriptTranspile?: boolean to IIncomingIntegration and IOutgoingIntegration with JSDoc noting default true and deprecation/removal in 9.0.0.
REST Schemas
packages/rest-typings/src/v1/integrations/IntegrationsCreateProps.ts, packages/rest-typings/src/v1/integrations/IntegrationsUpdateProps.ts
Added optional scriptTranspile?: boolean to create/update props and updated AJV schemas to accept nullable/optional boolean for incoming/outgoing webhook variants.
Changeset / Docs
.changeset/integration-script-transpile-opt-out.md
Documents the scriptTranspile flag, default behavior (true), opt-out behavior (skip transpile), and deprecation timeline toward 9.0.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a per-integration scriptTranspile flag to allow opting out of Babel transpilation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts (1)

86-105: Consider consolidating the database updates.

The script compilation result is persisted in a separate updateOne call (lines 89-104) before the main findOneAndUpdate (lines 152-178). If the second operation fails, the scriptCompiled/scriptError changes will persist while other fields remain unchanged. This two-phase update differs from the pattern in validateOutgoingIntegration.ts where compilation results are included in the integration data object.

While this may preserve existing behavior, consider whether consolidating into a single atomic update would improve consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`
around lines 86 - 105, The compilation result is being written via a separate
Integrations.updateOne call after calling
compileIntegrationScript(integration.script), which can lead to inconsistent
state if the subsequent findOneAndUpdate fails; instead, run
compileIntegrationScript first and then include either scriptCompiled or
scriptError into the same update object passed to the existing findOneAndUpdate
so the compilation fields are applied atomically with the rest of the
integration changes (remove the standalone Integrations.updateOne block and
merge its $set/$unset for scriptCompiled/scriptError into the findOneAndUpdate
payload).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`:
- Around line 86-105: The compilation result is being written via a separate
Integrations.updateOne call after calling
compileIntegrationScript(integration.script), which can lead to inconsistent
state if the subsequent findOneAndUpdate fails; instead, run
compileIntegrationScript first and then include either scriptCompiled or
scriptError into the same update object passed to the existing findOneAndUpdate
so the compilation fields are applied atomically with the rest of the
integration changes (remove the standalone Integrations.updateOne block and
merge its $set/$unset for scriptCompiled/scriptError into the findOneAndUpdate
payload).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6562b514-14ac-4742-8e41-257cca4cf09e

📥 Commits

Reviewing files that changed from the base of the PR and between 1c520d3 and 5c0cd7b.

📒 Files selected for processing (4)
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.

Applied to files:

  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts
  • apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts
  • apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts
  • apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts
🔇 Additional comments (10)
apps/meteor/app/integrations/server/lib/compileIntegrationScript.ts (5)

1-5: LGTM!

Imports are appropriate for the module's functionality.


6-24: LGTM!

The environment variable parsing is robust, and the deprecation/opt-in messages at module load time are appropriate for guiding admins through the migration.


37-45: LGTM!

The function signature and return type correctly match the scriptError type contract from packages/core-typings/src/IIntegration.ts.


47-61: LGTM!

The IIFE wrapper (function(){...}) correctly validates that the script is syntactically valid as a function body, and only SyntaxError is caught as expected for syntax validation.


63-82: LGTM!

The Babel configuration and error handling are appropriate. The fallback to the original script when result?.code is undefined preserves existing behavior.

apps/meteor/app/integrations/server/lib/validateOutgoingIntegration.ts (2)

6-6: LGTM!

Import of the centralized helper is correct.


180-182: LGTM!

The direct assignment pattern works correctly because compileIntegrationScript returns mutually exclusive properties - either script or error will be defined. This is a valid simplification over explicit conditional checks.

apps/meteor/app/integrations/server/methods/incoming/addIncomingIntegration.ts (2)

12-12: LGTM!

Import of the centralized helper is correct.


111-118: LGTM!

The conditional handling correctly sets scriptError on compilation failure and scriptCompiled on success, with proper cleanup of the opposite field.

apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts (1)

10-10: LGTM!

Import of the centralized helper is correct.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.18%. Comparing base (fc9ab29) to head (c217518).
⚠️ Report is 11 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40160      +/-   ##
===========================================
- Coverage    70.19%   70.18%   -0.02%     
===========================================
  Files         3280     3281       +1     
  Lines       116852   116915      +63     
  Branches     20666    20739      +73     
===========================================
+ Hits         82020    82052      +32     
- Misses       31541    31574      +33     
+ Partials      3291     3289       -2     
Flag Coverage Δ
e2e 59.64% <ø> (-0.04%) ⬇️
e2e-api 46.43% <ø> (-0.14%) ⬇️
unit 71.06% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo ggazzo force-pushed the chore/optional-integration-transpile branch from 5c0cd7b to 9af44a7 Compare April 15, 2026 12:56
@ggazzo ggazzo added this to the 8.4.0 milestone Apr 15, 2026
@ggazzo ggazzo added the docs Needs addition/changes to documentation label Apr 15, 2026
@dionisio-bot dionisio-bot bot removed the docs Needs addition/changes to documentation label Apr 15, 2026
@ggazzo ggazzo force-pushed the chore/optional-integration-transpile branch from 9af44a7 to f09729e Compare April 15, 2026 19:34
@ggazzo ggazzo requested a review from a team as a code owner April 15, 2026 19:34
@ggazzo ggazzo changed the title chore: deprecate Babel transpilation for integration scripts, add opt-in to skip chore: add per-integration scriptTranspile flag to opt-out of Babel Apr 15, 2026
Integration scripts are transpiled with @babel/core + @babel/preset-env
before being stored. In 9.0.0, this transpilation will be removed
entirely (scripts run as-is in isolated-vm's modern V8).

This commit adds a per-integration `scriptTranspile` flag (default
`true`) so admins can opt-out one integration at a time, test their
scripts for strict-mode compatibility, and migrate gradually before
upgrading to 9.0.0.

Changes:
- New apps/meteor/app/integrations/server/lib/compileIntegrationScript
  helper: takes `{ transpile: boolean }` and either runs Babel (legacy)
  or validates syntax with Node's built-in vm.Script (9.0.0 behavior).
- Add `scriptTranspile?: boolean` to IIncomingIntegration and
  IOutgoingIntegration. Field is documented as deprecated.
- Extend rest-typings Create and Update schemas to accept the flag.
- Add/Update methods (incoming + outgoing) now pass
  `integration.scriptTranspile !== false` to the compiler and persist
  the flag on the document.

Known strict-mode breaking patterns (documented in 9.0.0 changeset)
when `scriptTranspile: false`:
- Implicit globals: msg = x → const msg = x
- this in nested functions: this === undefined instead of globalThis
- arguments.callee: TypeError
- Octal literals: 0777 → 0o777
- Duplicate parameter names
@ggazzo ggazzo force-pushed the chore/optional-integration-transpile branch from f09729e to c217518 Compare April 15, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant