add a fallback on detect rspack builds and attempt to fix a published Meteor version

This commit is contained in:
Nacho Codoñer
2025-09-09 09:51:08 +02:00
parent eb6038a084
commit 18e976b317

View File

@@ -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)