Revert "update Meteor Rspack to support cross-os multiline banner output"

This reverts commit fb3aeff59a.
This commit is contained in:
Nacho Codoñer
2025-09-01 14:54:09 +02:00
parent 300701c04d
commit ecc4ffb716
16 changed files with 23 additions and 37 deletions

View File

@@ -1,12 +1,12 @@
{ {
"name": "@meteorjs/rspack", "name": "@meteorjs/rspack",
"version": "0.0.37", "version": "0.0.36",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@meteorjs/rspack", "name": "@meteorjs/rspack",
"version": "0.0.37", "version": "0.0.36",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ignore-loader": "^0.1.2", "ignore-loader": "^0.1.2",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@meteorjs/rspack", "name": "@meteorjs/rspack",
"version": "0.0.37", "version": "0.0.36",
"description": "Configuration logic for using Rspack in Meteor projects", "description": "Configuration logic for using Rspack in Meteor projects",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",

View File

@@ -147,7 +147,7 @@ export default function (inMeteor = {}, argv = {}) {
const runPath = Meteor.runPath; const runPath = Meteor.runPath;
// Determine banner // Determine banner
const bannerOutput = JSON.parse(Meteor.bannerOutput || process.env.RSPACK_BANNER || ''); const bannerOutput = JSON.parse(Meteor.bannerOutput || '');
// Determine output directories // Determine output directories
const clientOutputDir = path.resolve(process.cwd(), 'public'); const clientOutputDir = path.resolve(process.cwd(), 'public');

View File

@@ -5,7 +5,7 @@
export const DEFAULT_RSPACK_VERSION = '1.5.0'; export const DEFAULT_RSPACK_VERSION = '1.5.0';
export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.37'; export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.36';
export const DEFAULT_METEOR_RSPACK_REACT_HMR_VERSION = '1.4.3'; export const DEFAULT_METEOR_RSPACK_REACT_HMR_VERSION = '1.4.3';

View File

@@ -59,11 +59,11 @@ export function getConfigFileName() {
} }
/** /**
* Gets the appropriate Rspack environment variables and command line arguments * Gets the appropriate Rspack environment variables
* @param {Object} options - Options for environment variables * @param {Object} options - Options for environment variables
* @param {boolean} options.isClient - Whether this is for client-side build * @param {boolean} options.isClient - Whether this is for client-side build
* @param {boolean} options.isServer - Whether this is for server-side build * @param {boolean} options.isServer - Whether this is for server-side build
* @returns {Object} Object containing params (command line arguments) and envs (environment variables) * @returns {string[]} Array of command line arguments for Rspack
*/ */
export function getRspackEnv({ isClient, isServer, isTest: inIsTest }) { export function getRspackEnv({ isClient, isServer, isTest: inIsTest }) {
const RSPACK_BUILD_CONTEXT = require('./constants').RSPACK_BUILD_CONTEXT; const RSPACK_BUILD_CONTEXT = require('./constants').RSPACK_BUILD_CONTEXT;
@@ -127,6 +127,7 @@ export function getRspackEnv({ isClient, isServer, isTest: inIsTest }) {
}), }),
], ],
['runPath', getBuildFilePath({ ...module, ...env, ...side, ...commandRole }) ], ['runPath', getBuildFilePath({ ...module, ...env, ...side, ...commandRole }) ],
['bannerOutput', JSON.stringify(getBuildFileContent({ ...module, ...env, ...side, role: FILE_ROLE.output }))],
['buildContext', RSPACK_BUILD_CONTEXT], ['buildContext', RSPACK_BUILD_CONTEXT],
['chunksContext', RSPACK_CHUNKS_CONTEXT], ['chunksContext', RSPACK_CHUNKS_CONTEXT],
['assetsContext', RSPACK_ASSETS_CONTEXT], ['assetsContext', RSPACK_ASSETS_CONTEXT],
@@ -141,19 +142,10 @@ export function getRspackEnv({ isClient, isServer, isTest: inIsTest }) {
...(isBundleVisualizerEnabled && [['isBundleVisualizerEnabled', isBundleVisualizerEnabled]] || []), ...(isBundleVisualizerEnabled && [['isBundleVisualizerEnabled', isBundleVisualizerEnabled]] || []),
].filter(Boolean); ].filter(Boolean);
return pairs.flatMap(([key, val]) => [
// Create environment variables object with bannerOutput
const envs = {
RSPACK_BANNER: JSON.stringify(getBuildFileContent({ ...module, ...env, ...side, role: FILE_ROLE.output }))
};
// Create params from pairs
const params = pairs.flatMap(([key, val]) => [
'--env', '--env',
`${key}=${val}` `${key}=${val}`
]); ]);
return { params, envs };
} }
/** /**
@@ -174,13 +166,11 @@ export function startRspackClientServe(options = {}) {
const appDir = getMeteorAppDir(); const appDir = getMeteorAppDir();
const configFile = getConfigFileName(); const configFile = getConfigFileName();
const { params, envs } = getRspackEnv({ isClient: true, isServer: false }); const { command, args } = getNpxCommand(['rspack', 'serve', '--config', configFile, ...getRspackEnv({ isClient: true, isServer: false })]);
const { command, args } = getNpxCommand(['rspack', 'serve', '--config', configFile, ...params]);
const newClientProcess = spawnProcess( const newClientProcess = spawnProcess(
command, command,
args, { args, {
cwd: appDir, cwd: appDir,
env: { ...process.env, ...envs },
onStdout: (data) => { onStdout: (data) => {
logInfo(`[Rspack Client] ${data}`); logInfo(`[Rspack Client] ${data}`);
if (onCompile && data.trim().includes("compiled")) { if (onCompile && data.trim().includes("compiled")) {
@@ -229,13 +219,11 @@ export function startRspackServerWatch(options = {}) {
const appDir = getMeteorAppDir(); const appDir = getMeteorAppDir();
const configFile = getConfigFileName(); const configFile = getConfigFileName();
const { params, envs } = getRspackEnv({ isClient: false, isServer: true }); const { command, args } = getNpxCommand(['rspack', 'build', '--watch', '--config', configFile, ...getRspackEnv({ isClient: false, isServer: true })]);
const { command, args } = getNpxCommand(['rspack', 'build', '--watch', '--config', configFile, ...params]);
const newServerProcess = spawnProcess( const newServerProcess = spawnProcess(
command, command,
args, { args, {
cwd: appDir, cwd: appDir,
env: { ...process.env, ...envs },
onStdout: (data) => { onStdout: (data) => {
logInfo(`[Rspack Server] ${data}`); logInfo(`[Rspack Server] ${data}`);
if (onCompile && data.trim().includes("compiled")) { if (onCompile && data.trim().includes("compiled")) {
@@ -279,14 +267,13 @@ export async function runRspackBuild({ isClient, isServer, isTest, isTestModule,
const endpoint = isTestModule ? 'Module' : isClient ? 'Client' : 'Server'; const endpoint = isTestModule ? 'Module' : isClient ? 'Client' : 'Server';
// Use a promise to ensure Meteor waits until Rspack finishes // Use a promise to ensure Meteor waits until Rspack finishes
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const { params, envs } = getRspackEnv({ isClient, isServer, isTest, isTestModule });
const rspackArgs = [ const rspackArgs = [
'rspack', 'rspack',
'build', 'build',
'--config', '--config',
configFile, configFile,
...(watch && ['--watch']) || [], ...(watch && ['--watch']) || [],
...params, ...getRspackEnv({ isClient, isServer, isTest, isTestModule }),
].filter(Boolean); ].filter(Boolean);
const { command, args } = getNpxCommand(rspackArgs); const { command, args } = getNpxCommand(rspackArgs);
spawnProcess( spawnProcess(
@@ -294,7 +281,6 @@ export async function runRspackBuild({ isClient, isServer, isTest, isTestModule,
args, args,
{ {
cwd: appDir, cwd: appDir,
env: { ...process.env, ...envs },
onStdout: (data) => { onStdout: (data) => {
logInfo(`[Rspack ${label} ${endpoint}] ${data}`); logInfo(`[Rspack ${label} ${endpoint}] ${data}`);
if (onCompile && data.trim().includes("compiled")) { if (onCompile && data.trim().includes("compiled")) {

View File

@@ -17,7 +17,7 @@
"vue-router": "^4.2.5" "vue-router": "^4.2.5"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@tailwindcss/postcss": "^4.1.12", "@tailwindcss/postcss": "^4.1.12",

View File

@@ -19,7 +19,7 @@
}, },
"devDependencies": { "devDependencies": {
"@graphql-tools/webpack-loader": "^7.0.0", "@graphql-tools/webpack-loader": "^7.0.0",
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3", "@rspack/plugin-react-refresh": "^1.4.3",

View File

@@ -14,7 +14,7 @@
"meteor-node-stubs": "^1.2.12" "meteor-node-stubs": "^1.2.12"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3" "@rspack/plugin-react-refresh": "^1.4.3"

View File

@@ -21,7 +21,7 @@
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3", "@rspack/plugin-react-refresh": "^1.4.3",

View File

@@ -12,7 +12,7 @@
"meteor-node-stubs": "^1.2.12" "meteor-node-stubs": "^1.2.12"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"chai": "^4.2.0" "chai": "^4.2.0"

View File

@@ -15,7 +15,7 @@
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3", "@rspack/plugin-react-refresh": "^1.4.3",

View File

@@ -14,7 +14,7 @@
"picocolors": "^1.1.1" "picocolors": "^1.1.1"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"babel-loader": "10.0.0", "babel-loader": "10.0.0",

View File

@@ -13,7 +13,7 @@
"meteor-node-stubs": "^1.2.12" "meteor-node-stubs": "^1.2.12"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"postcss-load-config": "^5.1.0", "postcss-load-config": "^5.1.0",

View File

@@ -16,7 +16,7 @@
"react-dom": "^17.0.2" "react-dom": "^17.0.2"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3", "@rspack/plugin-react-refresh": "^1.4.3",

View File

@@ -15,7 +15,7 @@
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@rspack/plugin-react-refresh": "^1.4.3", "@rspack/plugin-react-refresh": "^1.4.3",

View File

@@ -17,7 +17,7 @@
"vue-router": "^4.2.5" "vue-router": "^4.2.5"
}, },
"devDependencies": { "devDependencies": {
"@meteorjs/rspack": "^0.0.37", "@meteorjs/rspack": "^0.0.36",
"@rspack/cli": "^1.4.8", "@rspack/cli": "^1.4.8",
"@rspack/core": "^1.4.8", "@rspack/core": "^1.4.8",
"@tailwindcss/postcss": "^4.1.12", "@tailwindcss/postcss": "^4.1.12",