From 05537780b8aed9d61529052b0056b94db66d2814 Mon Sep 17 00:00:00 2001 From: Hariom Balhara <1780212+hariombalhara@users.noreply.github.com> Date: Fri, 20 Feb 2026 23:08:11 +0530 Subject: [PATCH] fix: add biome overrides for embed-core to prevent auto-import of node:process (#27387) * fix: use import.meta.env instead of process.env in embed.ts Using import.meta.env is Vite's native way to handle environment variables in browser bundles. This prevents biome from auto-adding 'import process from node:process' which breaks the embed.js in browsers. Co-Authored-By: hariom@cal.com * Remove unncessar comment * fix: migrate remaining process.env to import.meta.env in embed.ts Complete the migration started by @hariombalhara by also converting process.env usages at lines 1681, 1682, and 1700 to import.meta.env. Update env.d.ts to include EMBED_PUBLIC_EMBED_FINGER_PRINT, EMBED_PUBLIC_EMBED_VERSION, and INTEGRATION_TEST_MODE types. This ensures no process.env references remain in embed.ts, fully preventing Biome from auto-adding import process from node:process. Co-Authored-By: unknown <> * fix: add biome overrides for embed-core to prevent auto-import of node:process Reverts import.meta.env back to process.env since API V2's tsconfig uses module: commonjs which doesn't support import.meta. Instead, adds biome overrides for embed-core to disable useNodejsImportProtocol, noProcessEnv, and noProcessGlobal rules that were causing biome to auto-add 'import process from node:process' on save. Co-Authored-By: hariom@cal.com --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- biome.json | 14 ++++++++++++++ packages/embeds/embed-core/src/embed.ts | 7 +++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/biome.json b/biome.json index e3b3ae1b53..e835cd95fe 100644 --- a/biome.json +++ b/biome.json @@ -177,6 +177,20 @@ } } }, + { + "includes": ["packages/embeds/embed-core/**/*.{ts,tsx,js,jsx}"], + "linter": { + "rules": { + "style": { + "useNodejsImportProtocol": "off", + "noProcessEnv": "off" + }, + "correctness": { + "noProcessGlobal": "off" + } + } + } + }, { "includes": ["apps/api/v2/**/*.ts", "apps/api/v2/**/*.controller.ts"], "linter": { diff --git a/packages/embeds/embed-core/src/embed.ts b/packages/embeds/embed-core/src/embed.ts index 1d76a502f6..7fd8363ae8 100644 --- a/packages/embeds/embed-core/src/embed.ts +++ b/packages/embeds/embed-core/src/embed.ts @@ -236,7 +236,7 @@ export class Cal { /** * Commands for which the queue persists across iframe resets */ - commandsPersistAcrossIframeResets: DoInIframeArg['method'][] = ["ui"]; + commandsPersistAcrossIframeResets: DoInIframeArg["method"][] = ["ui"]; isPrerendering?: boolean; @@ -374,7 +374,7 @@ export class Cal { // Very Important: Reset iframe ready flag and clear queue, as iframe might load a fresh URL and we need to check correctly when it is ready. this.iframeReset(); - + if (iframe.src === urlInstance.toString()) { // Ensure reload occurs even if the url is same - Though browser normally does it, but would be better to ensure it // This param has no other purpose except to ensure forced reload. @@ -414,7 +414,7 @@ export class Cal { resetQueue() { // Only keep UI related instructions in the queue, as we want to ensure that newly loaded iframe has the same UI configuration applied automatically - this.iframeDoQueue = this.iframeDoQueue.filter((doInIframeArg) => + this.iframeDoQueue = this.iframeDoQueue.filter((doInIframeArg) => this.commandsPersistAcrossIframeResets.includes(doInIframeArg.method) ); } @@ -1500,7 +1500,6 @@ class CalApi { }, }); - this.cal.doInIframe({ method: "ui", arg: uiConfig }); } }