From af6fbb124b3ca37b4a2e6862dbee958cf73c5ee1 Mon Sep 17 00:00:00 2001 From: Mirko Pecora Date: Tue, 16 Jun 2026 16:31:27 +0200 Subject: [PATCH 1/2] refactor: break circular dependencies by moving environment constants to env.js --- src/core/clickInspector.ts | 3 ++- src/core/config.ts | 13 ++----------- src/core/elementNode.ts | 8 ++------ src/core/env.ts | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 src/core/env.ts diff --git a/src/core/clickInspector.ts b/src/core/clickInspector.ts index 835cb34..e991e84 100644 --- a/src/core/clickInspector.ts +++ b/src/core/clickInspector.ts @@ -1,5 +1,6 @@ -import { Config, isDev } from './config.js'; +import { Config } from './config.js'; import { isElementNode } from './utils.js'; +import { isDev } from './env.js'; import type { ElementNode } from './elementNode.js'; import { IRendererNode } from './dom-renderer/domRendererTypes.js'; diff --git a/src/core/config.ts b/src/core/config.ts index 2d51d20..2b6e055 100644 --- a/src/core/config.ts +++ b/src/core/config.ts @@ -22,17 +22,8 @@ import { See `vite-env.d.ts` for environment variable type definitions. */ -export const isDev = !!(import.meta.env && import.meta.env.DEV); - -/** Whether the DOM renderer is used instead of `@solidtv/renderer` */ -export const DOM_RENDERING = - typeof SOLIDTV_DOM_RENDERING !== 'undefined' && - SOLIDTV_DOM_RENDERING === true; - -/** Whether element shaders are enabled */ -export const SHADERS_ENABLED = - typeof SOLIDTV_DISABLE_SHADERS === 'undefined' || - SOLIDTV_DISABLE_SHADERS !== true; +export { isDev, DOM_RENDERING, SHADERS_ENABLED } from './env.js'; +import { DOM_RENDERING } from './env.js'; /** * True when the DOM renderer is both built in (`DOM_RENDERING`) and turned on diff --git a/src/core/elementNode.ts b/src/core/elementNode.ts index 4770237..e0f204c 100644 --- a/src/core/elementNode.ts +++ b/src/core/elementNode.ts @@ -33,12 +33,8 @@ import { isFunction, spliceItem, } from './utils.js'; -import { - Config, - isDev, - SHADERS_ENABLED, - isDomRendererActive, -} from './config.js'; +import { isDev, SHADERS_ENABLED } from './env.js'; +import { Config, isDomRendererActive } from './config.js'; import type { RendererMain, INode, diff --git a/src/core/env.ts b/src/core/env.ts new file mode 100644 index 0000000..cc1089f --- /dev/null +++ b/src/core/env.ts @@ -0,0 +1,17 @@ +/** + * Build-time environment constants with zero internal dependencies. + * Kept in a separate file to break the circular dependency between + * config.ts (which imports ElementNode) and elementNode.ts (which needs isDev). + */ + +export const isDev = !!(import.meta.env && import.meta.env.DEV); + +/** Whether the DOM renderer is used instead of `@solidtv/renderer` */ +export const DOM_RENDERING = + typeof SOLIDTV_DOM_RENDERING !== 'undefined' && + SOLIDTV_DOM_RENDERING === true; + +/** Whether element shaders are enabled */ +export const SHADERS_ENABLED = + typeof SOLIDTV_DISABLE_SHADERS === 'undefined' || + SOLIDTV_DISABLE_SHADERS !== true; From 2915f0c902983a096384be3742534e1e8aa62684 Mon Sep 17 00:00:00 2001 From: Mirko Pecora Date: Tue, 16 Jun 2026 16:34:12 +0200 Subject: [PATCH 2/2] refactor: remove comments --- src/core/env.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/core/env.ts b/src/core/env.ts index cc1089f..af64164 100644 --- a/src/core/env.ts +++ b/src/core/env.ts @@ -1,9 +1,3 @@ -/** - * Build-time environment constants with zero internal dependencies. - * Kept in a separate file to break the circular dependency between - * config.ts (which imports ElementNode) and elementNode.ts (which needs isDev). - */ - export const isDev = !!(import.meta.env && import.meta.env.DEV); /** Whether the DOM renderer is used instead of `@solidtv/renderer` */