Merge branch 'modern-bundler-integration' into release-3.4

This commit is contained in:
Nacho Codoñer
2025-09-09 11:24:48 +02:00
2 changed files with 32 additions and 7 deletions

View File

@@ -243,10 +243,20 @@ BCp.processOneFileForTarget = function (inputFile, source) {
bare: !! fileOptions.bare
};
if (process.env.METEOR_VERBOSE === 'true') {
console.log('inputFilePath', inputFilePath, inputFile.getPathInPackage());
console.log('Plugin?.rspackHelpers?.isRspackOutputFile', Plugin?.rspackHelpers?.isRspackOutputFile);
console.log('Plugin?.rspackHelpers?.rspackFilePattern', Plugin?.rspackHelpers?.rspackFilePattern);
console.log('Plugin?.rspackHelpers?.isRspackOutputFile(inputFilePath)', Plugin?.rspackHelpers?.isRspackOutputFile(inputFilePath));
}
// 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 +270,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 +379,9 @@ BCp.processOneFileForTarget = function (inputFile, source) {
...(hasSwcHelpersAvailable &&
!isNodeTarget &&
(packageName == null ||
!['modules-runtime'].includes(packageName)) && {
!['core-runtime', 'modules', 'modules-runtime'].includes(
packageName,
)) && {
externalHelpers: true,
}),
},
@@ -1123,14 +1146,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 +1178,7 @@ function logTranspilation({
: color(originPaddedRaw, 35);
const cacheStatus = errorMessage
? color('⚠️ Fallback', 33)
: usedSwc
: usedSwc || usedRspack
? cacheHit
? color('🟢 Cache hit', 32)
: color('🔴 Cache miss', 31)

View File

@@ -113,8 +113,8 @@ async function ensureDependenciesInstalled(dependencies, globalStateKey, package
if (!success) {
const isYarnProj = process.env.YARN_ENABLED === 'true';
const installCommand = isYarnProj
? `yarn add --dev ${joinWithAnd(dependencyStrings)}`
: `meteor npm install -D ${joinWithAnd(dependencyStrings)}`;
? `yarn add --dev ${dependencyStrings.join(' ').trim()}`
: `meteor npm install -D ${dependencyStrings.join(' ').trim()}`;
logError(`\n┌─────────────────────────────────────────────────`);
logError(`│ ❌ ${packageName} Installation Failed`);