From 18e976b3170810f9c3842fbfbfacfdf258e030fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Codo=C3=B1er?= Date: Tue, 9 Sep 2025 09:51:08 +0200 Subject: [PATCH] add a fallback on detect rspack builds and attempt to fix a published Meteor version --- packages/babel-compiler/babel-compiler.js | 28 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/babel-compiler/babel-compiler.js b/packages/babel-compiler/babel-compiler.js index a33dc79a96..31f754c5ed 100644 --- a/packages/babel-compiler/babel-compiler.js +++ b/packages/babel-compiler/babel-compiler.js @@ -246,7 +246,10 @@ BCp.processOneFileForTarget = function (inputFile, source) { // Check if the file is a Rspack output file // If it is, bypass SWC/Babel and just read the file and its map file // as the contents are already transpiled by Rspack. - if (Plugin?.rspackHelpers?.isRspackOutputFile(inputFilePath)) { +if (process.env.METEOR_SKIP_OUTPUT_FILE_PROCESSING !== 'true' && + (Plugin?.rspackHelpers?.isRspackOutputFile(inputFilePath) || + inputFilePath.includes('-rspack.js')) + ) { try { // Get the full path to the file const fullPath = inputFile.getPathInPackage(); @@ -260,6 +263,17 @@ BCp.processOneFileForTarget = function (inputFile, source) { toBeAdded.sourceMap = JSON.parse(mapContent); } + if (this.isVerbose()) { + const arch = inputFile.getArch(); + logTranspilation({ + usedRspack: true, + inputFilePath, + packageName, + cacheHit: true, + arch, + }); + } + return toBeAdded; } catch (e) { // If there's an error reading the file or map, log it and continue with normal processing @@ -358,7 +372,9 @@ BCp.processOneFileForTarget = function (inputFile, source) { ...(hasSwcHelpersAvailable && !isNodeTarget && (packageName == null || - !['core-runtime', 'modules-runtime'].includes(packageName)) && { + !['core-runtime', 'modules', 'modules-runtime'].includes( + packageName, + )) && { externalHelpers: true, }), }, @@ -1123,14 +1139,16 @@ function logTranspilation({ packageName, inputFilePath, usedSwc, + usedRspack, cacheHit, isNodeModulesCode, arch, errorMessage = '', tip = '', }) { - const transpiler = usedSwc ? 'SWC' : 'Babel'; - const transpilerColor = usedSwc ? 32 : 33; + let transpiler = usedSwc ? 'SWC' : 'Babel'; + transpiler = usedRspack ? 'Rspack' : transpiler; + const transpilerColor = usedSwc || usedRspack ? 32 : 33; const label = color('[Transpiler]', 36); const transpilerPart = `${label} Used ${color( transpiler, @@ -1153,7 +1171,7 @@ function logTranspilation({ : color(originPaddedRaw, 35); const cacheStatus = errorMessage ? color('⚠️ Fallback', 33) - : usedSwc + : usedSwc || usedRspack ? cacheHit ? color('🟢 Cache hit', 32) : color('🔴 Cache miss', 31)