From 6054da445d86186adb42f9216de57165b7f244aa Mon Sep 17 00:00:00 2001 From: "taeyoung.hong" Date: Wed, 24 Jun 2026 17:24:15 +0900 Subject: [PATCH 1/3] NXT-15922: Fix less -> css transpile issue while 'enact transpile' --- commands/transpile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/commands/transpile.js b/commands/transpile.js index 1285f4fc..0a9fa6c1 100755 --- a/commands/transpile.js +++ b/commands/transpile.js @@ -7,6 +7,19 @@ const less = require('less'); const LessPluginResolve = require('less-plugin-npm-import'); const minimist = require('minimist'); const LessPluginRi = require('resolution-independence'); +const getRiPlugin = require('resolution-independence/lib/resolution-independence'); +// Patch: calc() containing var() must pass through unchanged — the RI plugin's +// parseString regex groups "calc(132px" as one token, causing parseFloat to return NaN. +LessPluginRi.prototype.install = function (less, pluginManager) { + const Plugin = getRiPlugin(less); + const origParseString = Plugin.prototype.parseString; + Plugin.prototype.parseString = function (ruleNode, stringValues) { + const value = stringValues || ruleNode.value; + if (/calc\s*\(.*var\s*\(/.test(value)) return value; + return origParseString.call(this, ruleNode, stringValues); + }; + pluginManager.addVisitor(new Plugin(this.options)); +}; const {optionParser: app} = require('@enact/dev-utils'); let chalk; From e17d34c306760842384217835fb82273205c099d Mon Sep 17 00:00:00 2001 From: "taeyoung.hong" Date: Wed, 24 Jun 2026 17:41:00 +0900 Subject: [PATCH 2/3] fix lint errors --- commands/transpile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/transpile.js b/commands/transpile.js index 0a9fa6c1..294f02bc 100755 --- a/commands/transpile.js +++ b/commands/transpile.js @@ -10,8 +10,8 @@ const LessPluginRi = require('resolution-independence'); const getRiPlugin = require('resolution-independence/lib/resolution-independence'); // Patch: calc() containing var() must pass through unchanged — the RI plugin's // parseString regex groups "calc(132px" as one token, causing parseFloat to return NaN. -LessPluginRi.prototype.install = function (less, pluginManager) { - const Plugin = getRiPlugin(less); +LessPluginRi.prototype.install = function (_less, pluginManager) { + const Plugin = getRiPlugin(_less); const origParseString = Plugin.prototype.parseString; Plugin.prototype.parseString = function (ruleNode, stringValues) { const value = stringValues || ruleNode.value; From d2cf11461f9e9e81d67b24893bc9fba8da7415bb Mon Sep 17 00:00:00 2001 From: "taeyoung.hong" <35059065+hong6316@users.noreply.github.com> Date: Mon, 29 Jun 2026 09:33:08 +0900 Subject: [PATCH 3/3] Apply suggestion from @daniel-stoian-lgp Co-authored-by: Daniel Stoian <63335068+daniel-stoian-lgp@users.noreply.github.com> --- commands/transpile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/transpile.js b/commands/transpile.js index 294f02bc..1e57db59 100755 --- a/commands/transpile.js +++ b/commands/transpile.js @@ -15,7 +15,7 @@ LessPluginRi.prototype.install = function (_less, pluginManager) { const origParseString = Plugin.prototype.parseString; Plugin.prototype.parseString = function (ruleNode, stringValues) { const value = stringValues || ruleNode.value; - if (/calc\s*\(.*var\s*\(/.test(value)) return value; + if (/calc\s*\(/.test(value)) return value; return origParseString.call(this, ruleNode, stringValues); }; pluginManager.addVisitor(new Plugin(this.options));